:root {
  --bg: #0f172a;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #f59e0b;
  --accent-dark: #b45309;
  --callout: rgba(245, 158, 11, 0.18);
  --callout-border: #f59e0b;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--surface-2);
  line-height: 1.55;
}

a { color: var(--accent-dark); }

.site-header {
  background: var(--bg);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
  white-space: nowrap;
}
.site-title .accent { color: var(--accent); }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 16px;
  font-size: 0.95rem;
}
.site-nav a:hover { color: #fff; }

/* Language toggle (EN / EL) */
.lang-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin-left: 16px;
}
.lang-btn {
  background: transparent;
  border: 0;
  color: #cbd5e1;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.lang-btn:hover { color: #fff; }
.lang-btn.active {
  background: var(--accent);
  color: #1f2937;
}

/* "EN" pill on sidebar items where Greek isn't available */
.lang-en-badge {
  display: inline-block;
  background: var(--accent);
  color: #1f2937;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Banner shown above an article when its Greek translation is missing */
.lang-fallback-banner {
  background: rgba(245, 158, 11, 0.12);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: var(--text);
}

/* ---- Search ---- */
.search-box {
  position: relative;
  flex: 1;
  max-width: 540px;
}
.search-box input {
  width: 100%;
  padding: 9px 14px 9px 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: background 120ms ease, border-color 120ms ease;
  -webkit-appearance: none;
}
.search-box input::placeholder { color: rgba(203, 213, 225, 0.7); }
.search-box input:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent);
}
.search-box::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  opacity: 0.9;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.24);
  display: none;
  z-index: 90;
}
.search-results.open { display: block; }

.search-result {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover,
.search-result.active { background: var(--surface-2); }
.search-result-chapter {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 3px;
}
.search-result-title {
  font-weight: 600;
  font-size: 0.98rem;
}
.search-result-excerpt {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.search-result mark {
  background: rgba(245, 158, 11, 0.4);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
.search-empty {
  padding: 18px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .site-header { padding: 12px 16px; gap: 10px; }
  .search-box { max-width: none; }
  .site-nav { display: none; }
}

/* ---- Ask a question ---- */
.ask-panel {
  margin: 36px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 28px;
}
.ask-intro h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.ask-intro p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 640px;
}
.ask-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.88rem;
  color: var(--text);
}
.ask-form label span {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}
.ask-form label em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}
.ask-form abbr {
  text-decoration: none;
  color: var(--accent-dark);
  margin-left: 2px;
}
.ask-row {
  display: grid;
  gap: 14px;
}
.ask-row.two {
  grid-template-columns: 1fr 1fr;
}
.ask-row > label { margin-bottom: 14px; }
@media (max-width: 600px) {
  .ask-row.two { grid-template-columns: 1fr; }
}
.ask-form input[type="text"],
.ask-form input[type="email"],
.ask-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.ask-form input[type="text"]:focus,
.ask-form input[type="email"]:focus,
.ask-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.ask-form textarea {
  resize: vertical;
  min-height: 110px;
}
.ask-form input[type="file"] {
  font-size: 0.88rem;
}
.ask-submit {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 120ms ease;
}
.ask-submit:hover { background: var(--accent-dark); }
.ask-submit:disabled { opacity: 0.6; cursor: progress; }
.ask-status {
  margin-top: 14px;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.ask-status.ok { color: #15803d; font-weight: 600; }
.ask-status.error { color: #b91c1c; font-weight: 600; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

.intro h1 { font-size: 2rem; margin: 0 0 8px; }
.intro p { color: var(--muted); margin: 0 0 32px; max-width: 720px; }

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.chapter-card .num {
  display: inline-block;
  background: var(--bg);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.1em;
}
.chapter-card.stub { opacity: 0.55; }
.chapter-card.stub:hover { transform: none; box-shadow: none; border-color: var(--border); }
.chapter-card h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.chapter-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.chapter-card .count {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 600;
}
.chapter-card .count.empty { color: var(--muted); }

/* Article layout */
.article-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
@media (max-width: 900px) { .article-layout { grid-template-columns: 1fr; } }

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.sidebar h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.sidebar ol { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin: 2px 0; }
.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.current { background: var(--bg); color: #fff; }
.sidebar .back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.88rem;
}

.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 36px;
  max-width: 100%;
  overflow: hidden;
}
.article h1 { margin-top: 0; }
.article h2 {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}
.article h3 { margin-top: 24px; }
.article code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.article a { color: var(--accent-dark); }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }

/* Annotated screenshots */
.article figure.annotated {
  position: relative;
  margin: 20px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.article figure.annotated img { display: block; width: 100%; height: auto; }
.article figure.annotated .callout {
  position: absolute;
  border: 2px solid var(--callout-border);
  background: var(--callout);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  pointer-events: none;
}
.article figure.annotated .callout::before {
  content: attr(data-label);
  position: absolute;
  top: -13px;
  left: -13px;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.article ol.callout-list {
  counter-reset: clst;
  padding-left: 0;
  list-style: none;
  margin: 12px 0 24px;
}
.article ol.callout-list li {
  counter-increment: clst;
  position: relative;
  padding: 10px 14px 10px 46px;
  margin: 6px 0;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}
.article ol.callout-list li::before {
  content: counter(clst);
  position: absolute;
  left: 12px;
  top: 10px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.state { padding: 32px; text-align: center; color: var(--muted); }

/* Lightbox */
.article .zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 24px;
  z-index: 1000;
  animation: lightbox-in 120ms ease-out;
}
.lightbox.open { display: flex; }

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox .lightbox-content {
  position: relative;
  max-width: min(1600px, 96vw);
  max-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox .lightbox-figure-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.lightbox figure.annotated {
  position: relative;
  margin: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: default;
  display: inline-block;
  line-height: 0;
}

.lightbox figure.annotated img {
  display: block;
  max-height: calc(100vh - 72px);
  max-width: 96vw;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox figure.annotated .callout {
  position: absolute;
  border: 2px solid var(--callout-border);
  background: var(--callout);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  pointer-events: none;
}
.lightbox figure.annotated .callout::before {
  content: attr(data-label);
  position: absolute;
  top: -13px;
  left: -13px;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.lightbox .lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox .lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}
