:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #59645f;
  --paper: #f7f6f1;
  --surface: #ffffff;
  --soft: #eef2ed;
  --green: #245c46;
  --green-dark: #173d2f;
  --line: #d8ddd8;
  --accent: #996a21;
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Offset anchor scrolling so sticky header doesn't cover the target */
[id] { scroll-margin-top: 72px; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 var(--font); }
a { color: inherit; }
button { color: inherit; font: inherit; }
[hidden] { display: none !important; }

.site-header { position: sticky; z-index: 30; top: 0; border-bottom: 1px solid var(--line); background: rgba(247,246,241,.97); }
.header-inner { display: flex; width: min(calc(100% - 32px),var(--max)); min-height: 58px; margin: auto; align-items: center; justify-content: space-between; gap: 28px; }
.wordmark { display: grid; color: var(--green-dark); font-size: 1.12rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.05; text-decoration: none; }
.wordmark small { margin-top: 3px; color: var(--muted); font-size: .57rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.site-header nav { display: flex; align-items: stretch; gap: 4px; }
.site-header nav a { padding: 18px 12px 16px; color: #3e4a44; border-bottom: 2px solid transparent; font-size: .86rem; text-decoration: none; }
.site-header nav a:hover,.site-header nav a:focus-visible { color: var(--green); border-bottom-color: var(--green); }

.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.home-intro { width: min(calc(100% - 32px),var(--max)); margin: auto; padding: 34px 0 28px; border-bottom: 1px solid var(--line); }
.home-intro h1 { max-width: 680px; margin: 0; font-size: clamp(2rem,4vw,2.55rem); font-weight: 760; letter-spacing: -.045em; line-height: 1.08; }
.home-intro > div > p:last-child { max-width: 720px; margin: 13px 0 0; color: var(--muted); }

.learning-shell { display: grid; width: min(calc(100% - 32px),var(--max)); margin: auto; padding: 28px 0 40px; grid-template-columns: 190px minmax(0,1fr); gap: 34px; align-items: start; }
.library-nav { display: grid; gap: 2px; }
.library-nav h2 { margin: 0 0 8px; font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; }
.section-filter { display: flex; width: 100%; padding: 8px 10px; align-items: center; justify-content: space-between; color: #45514b; border: 0; border-radius: 5px; background: transparent; font: inherit; font-size: .86rem; text-align: left; cursor: pointer; }
.section-filter:hover,.section-filter.active { color: var(--green-dark); background: #e5ece7; }
.library-nav b { color: #78817d; font-size: .73rem; font-weight: 600; }
.library-heading { display: flex; margin-bottom: 14px; align-items: end; justify-content: space-between; gap: 20px; }
.library-heading h2 { margin: 0; font-size: 1.65rem; letter-spacing: -.025em; }

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.compact-filters { margin-bottom: 12px; }
.filter { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); cursor: pointer; font-size: .78rem; }
.filter:hover,.filter.active { color: white; border-color: var(--green); background: var(--green); }
.filter-divider { width: 1px; margin: 3px 4px; background: var(--line); }

.material-list,.card-grid { display: grid; gap: 8px; }
.card-grid { grid-template-columns: 1fr; }
.material-card { display: grid; position: relative; min-height: 0; padding: 15px 16px; grid-template-columns: 48px minmax(0,1fr) 56px; gap: 14px; align-items: start; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.material-card:hover { border-color: #aebbb3; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.filter { transition: background .15s, color .15s, border-color .15s; }
.material-card h3 a.card-link::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.material-card h3 a.card-link { text-decoration: none; }
.material-card.is-coming { background: rgba(255,255,255,.55); cursor: default; pointer-events: none; }
.material-level { display: grid; width: 42px; height: 29px; place-items: center; color: var(--green-dark); border-radius: 4px; background: #e4ece7; font-size: .72rem; font-weight: 800; }
.material-kicker { color: var(--muted); font-size: .7rem; }
.material-card h3 { margin: 2px 0 4px; font-size: 1rem; font-weight: 750; line-height: 1.3; }
.material-card h3 a { text-decoration: none; }
.material-card h3 a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.material-card p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.material-side { display: grid; min-height: 54px; justify-items: end; align-content: space-between; color: var(--muted); font-size: .7rem; }
.text-link { color: var(--green); font-size: .76rem; font-weight: 750; text-decoration: none; }
.coming-soon { color: #7b847f; font-size: .72rem; font-weight: 700; }
.empty-state { padding: 24px; color: var(--muted); text-align: center; }
.content-guide { display: grid; width: min(calc(100% - 32px),var(--max)); margin: 0 auto 28px; padding: 24px 0; grid-template-columns: 220px minmax(0,1fr); gap: 34px; border-top: 1px solid var(--line); }
.content-guide h2 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.guide-text { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.guide-text p,.content-copy p { margin: 0; color: #46524c; font-size: .9rem; line-height: 1.6; }
.content-copy { padding-top: 8px; }
.content-copy h2 { margin: 0 0 10px; font-size: 1.45rem; letter-spacing: -.025em; }
.content-copy p + p { margin-top: 12px; }
.site-note { width: min(calc(100% - 32px),var(--max)); margin: auto; padding: 17px 0 30px; border-top: 1px solid var(--line); }
.site-note p,.trust-note { max-width: 800px; margin: 0; color: var(--muted); font-size: .76rem; }

.section,.page-intro,.lesson-head,.lesson-layout { width: min(calc(100% - 32px),var(--max)); margin-right: auto; margin-left: auto; }
.section { padding-top: 26px; padding-bottom: 32px; }
.section.compact { padding-top: 24px; padding-bottom: 24px; }
.section.warm { background: transparent; }
.section.narrow,.prose { max-width: 720px; }
.section-heading { display: flex; margin-bottom: 18px; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h2,.page-intro h1,.lesson-head h1,.lesson-section h2 { margin: 0; font-weight: 750; letter-spacing: -.035em; }
.section-heading h2 { font-size: 1.75rem; }
.page-intro { padding-top: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.page-intro h1 { max-width: 820px; font-size: clamp(1.9rem,4vw,2.5rem); line-height: 1.1; }
.page-intro > p:last-child { max-width: 720px; margin: 10px 0 0; color: var(--muted); font-size: .95rem; }
.clean-list { display: grid; gap: 8px; padding-left: 22px; }
.notice { margin-top: 22px; padding: 14px 16px; border-left: 3px solid var(--accent); background: #f0eadf; color: #4f5b55; }
.prose h2 { margin: 30px 0 8px; font-size: 1.45rem; }
.prose p { color: #49554f; }

.case-grid { display: grid; gap: 0; }
.case-grid article { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 20px 0; border-top: 1px solid var(--line); }
.case-number { color: var(--accent); font-size: .78rem; font-weight: 800; }
.case-grid h2 { margin: 0; font-size: 1.4rem; }
.case-grid p { margin: 4px 0; color: var(--muted); }
.greek-label { color: var(--green) !important; font-weight: 700; }

.lesson-head { padding-top: 20px; padding-bottom: 16px; }
.back-link { display: inline-flex; margin-bottom: 14px; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; text-decoration: none; }
.back-link:hover { color: var(--green); }
.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.lesson-meta span { padding: 3px 7px; color: var(--green-dark); border-radius: 4px; background: #e4ece7; font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.lesson-title-pair { display: grid; max-width: 850px; margin-top: 14px; grid-template-columns: 1fr 1fr; gap: 18px; }
.lesson-title-pair h1 { font-size: clamp(1.8rem,3.5vw,2.35rem); line-height: 1.12; }
.lesson-title-pair h1:first-child { color: var(--green); }
.lesson-head > p:last-child { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.lesson-layout { display: grid; grid-template-columns: 150px minmax(0,760px); gap: 34px; align-items: start; }
.lesson-nav { position: sticky; top: 78px; display: grid; gap: 6px; padding-top: 6px; }
.lesson-nav span { margin-bottom: 4px; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.lesson-nav a { color: #52605a; font-size: .8rem; text-decoration: none; }
.lesson-nav a:hover { color: var(--green); }
.lesson-content { min-width: 0; padding-bottom: 56px; }
.study-note { margin-bottom: 14px; padding: 13px 15px; border-radius: 6px; background: var(--soft); }
.study-note h2 { margin: 0 0 3px; font-size: .92rem; }
.study-note p { margin: 0; color: var(--muted); font-size: .8rem; }
.tense-switcher { display: grid; grid-template-columns: repeat(3,1fr); padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #eeece4; }
.tense-switcher button { display: grid; min-height: 52px; padding: 6px 10px; place-items: center; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.tense-switcher button span { font-size: .86rem; font-weight: 700; }
.tense-switcher button small { color: var(--muted); font-size: .64rem; font-weight: 400; }
.tense-switcher button.active { color: white; background: var(--green); }
.tense-switcher button.active small { color: #d8e8e0; }
.story { padding-top: 8px; }
.story-paragraph { padding: 12px 0; }
.greek-paragraph { max-width: 72ch; margin: 0; font-size: clamp(1.08rem,2vw,1.25rem); line-height: 1.65; }
.word-button { display: inline; padding: 1px 0; border: 0; border-radius: 2px; background: transparent; font: inherit; line-height: inherit; cursor: pointer; }
.word-button:hover,.word-button:focus-visible { color: var(--green); background: #e4ece7; outline: 2px solid rgba(36,92,70,.3); }
.translation-toggle { margin-top: 6px; padding: 0; color: #78827d; border: 0; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 650; }
.translation-toggle:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.paragraph-translation { margin: 8px 0 0; padding: 0; color: #68736e; background: transparent; font-size: clamp(1.08rem,2vw,1.25rem); line-height: 1.65; }
.interaction-hint { color: var(--muted); font-size: .72rem; }
.lesson-section { padding-top: 44px; }
.lesson-section h2 { margin-bottom: 16px; font-size: 1.65rem; }
.verb-table-wrap { overflow-x: auto; }
.verb-table { width: 100%; border-collapse: collapse; background: white; }
.verb-table th,.verb-table td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.verb-table thead th { color: white; background: var(--green); font-size: .72rem; }
.verb-table tbody th span { display: block; font-size: .98rem; }
.verb-table tbody th small { display: block; color: var(--muted); font-weight: 400; }
.questions { display: grid; gap: 8px; }
.question-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 5px; background: white; }
.question-greek { margin: 0; font-size: 1rem; font-weight: 650; }
.question-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 7px; }
.question-toggle { padding: 0; color: #6f7974; border: 0; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 650; }
.question-toggle:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.question-translation,.question-answer { margin: 9px 0 0; font-size: .9rem; }
.question-translation { color: var(--muted); }
.question-answer { color: var(--green-dark); font-weight: 650; }
.source-note { margin-top: 42px; padding-top: 16px; color: #7a847f; border-top: 1px solid var(--line); font-size: .7rem; }
.word-popover { position: fixed; z-index: 50; display: grid; min-width: 170px; max-width: min(280px,calc(100vw - 24px)); gap: 3px; padding: 10px 12px 12px; color: white; border-radius: 7px; background: var(--green-dark); box-shadow: 0 12px 32px rgba(16,38,29,.25); }
.word-popover strong { font-size: 1rem; }
.word-popover span { color: #dce9e2; font-size: .78rem; }
.word-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.word-audio-button { display: grid; flex: 0 0 auto; width: 28px; height: 28px; padding: 0; place-items: center; color: #dcebe5; border: 1px solid rgba(255,255,255,.26); border-radius: 50%; background: transparent; cursor: pointer; }
.word-audio-button:hover,.word-audio-button:focus-visible { color: var(--green-dark); background: white; outline: none; }
.word-audio-button svg { width: 15px; height: 15px; fill: currentColor; }

/* ── Exam page ────────────────────────────────── */
.exam-parts { display: grid; gap: 22px; margin-top: 18px; }
.exam-part { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }
.exam-part-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.exam-part-header h3 { margin: 0; font-size: 1.05rem; }
.exam-icon { font-size: 1.3rem; }
.exam-tip { margin-top: 10px; padding: 10px 14px; background: rgba(36,92,70,.06); border-left: 3px solid var(--green); border-radius: 0 6px 6px 0; font-size: .88rem; }
.exam-tip strong { color: var(--green-dark); }
.exam-notice { padding: 12px 16px; background: rgba(36,92,70,.05); border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; color: var(--muted); }

/* ── Reading / Writing content pages ─────────── */
.reading-text { margin-bottom: 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.reading-text:last-of-type { border-bottom: none; }
.text-kicker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.text-kicker span { padding: 2px 8px; background: var(--soft); border-radius: 4px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.vocab-table-wrap { overflow-x: auto; margin-top: 4px; }
.vocab-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.vocab-table th { padding: 7px 10px; text-align: left; background: var(--soft); font-size: .72rem; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.vocab-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vocab-table td:first-child { font-weight: 650; color: var(--green-dark); }
.vocab-table tr:last-child td { border-bottom: none; }
.expressions-list { display: grid; gap: 10px; margin-top: 4px; }
.expression-item { padding: 10px 14px; background: var(--soft); border-radius: 6px; }
.expression-item strong { display: block; font-size: 1rem; color: var(--green-dark); margin-bottom: 3px; }
.expression-item p { margin: 0; font-size: .85rem; color: var(--muted); }
.grammar-notes { display: grid; gap: 12px; margin-top: 4px; }
.grammar-note { padding: 12px 16px; border-left: 3px solid var(--green); background: rgba(36,92,70,.04); border-radius: 0 6px 6px 0; }
.grammar-note h3 { margin: 0 0 6px; font-size: .9rem; color: var(--green-dark); }
.grammar-note p { margin: 0; font-size: .85rem; line-height: 1.5; color: #49554f; }

.site-footer { border-top: 1px solid var(--line); }
.site-footer > div { display: flex; width: min(calc(100% - 32px),var(--max)); min-height: 68px; margin: auto; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .72rem; }
.site-footer span:last-child { display: flex; gap: 16px; }
.site-footer a { text-decoration: none; }
.footer-disclosure { width: min(calc(100% - 32px),var(--max)); margin: -10px auto 20px; color: #78817d; font-size: .68rem; }
:focus-visible { outline: 3px solid rgba(36,92,70,.28); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Search + toolbar ─────────────────────────────── */
.catalog-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.catalog-toolbar .filters { margin-bottom: 0; }
.search-wrap { flex: 1 1 180px; min-width: 140px; max-width: 280px; }
.catalog-search { width: 100%; padding: 6px 10px 6px 30px; border: 1px solid var(--line); border-radius: 6px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2378817d' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='5'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") no-repeat 8px center / 16px 16px; font: inherit; font-size: .84rem; color: var(--ink); }
.catalog-search::placeholder { color: var(--muted); }
.catalog-search:focus { outline: 3px solid rgba(36,92,70,.28); border-color: var(--green); }

/* ── Pagination ───────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; padding: 18px 0 6px; flex-wrap: wrap; }
.page-btn { padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: .84rem; cursor: pointer; }
.page-btn:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
.page-btn:disabled { opacity: .38; cursor: default; }
.page-dots { padding: 0 4px; color: var(--muted); }

/* ── Mobile menu ─────────────────────────────────── */
.mobile-menu-btn { display: none; }
.mobile-nav { display: none; }

@media (max-width: 760px) {
  .site-header { position: static; }
  .header-inner { min-height: auto; padding: 14px 0; }
  .site-header #mainNav { display: none; }
  /* Show hamburger button */
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; background: none; cursor: pointer; color: var(--ink); padding: 0; }
  .mobile-menu-btn svg { width: 22px; height: 22px; }
  /* Mobile nav dropdown */
  .mobile-nav { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; z-index: 40; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 0; }
  .mobile-nav a { padding: 11px 20px; text-decoration: none; color: var(--ink); font-size: .95rem; }
  .mobile-nav a:hover { color: var(--green); background: rgba(36,92,70,.05); }
  .site-header { position: relative; }
  .learning-shell { grid-template-columns: 1fr; gap: 22px; }
  .content-guide { grid-template-columns: 1fr; gap: 14px; }
  .guide-text { grid-template-columns: 1fr; gap: 12px; }
  .library-nav { display: flex; padding-bottom: 5px; overflow-x: auto; }
  .library-nav h2 { display: none; }
  .section-filter { flex: 0 0 auto; width: auto; gap: 8px; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-title-pair { grid-template-columns: 1fr; gap: 2px; }
  .lesson-nav { position: static; display: flex; padding: 9px 0; overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .lesson-nav span { display: none; }
  .lesson-nav a { flex: 0 0 auto; }
}

@media (max-width: 540px) {
  .home-intro,.learning-shell,.content-guide,.section,.page-intro,.lesson-head,.lesson-layout,.site-note,.site-footer > div,.footer-disclosure,.header-inner { width: min(calc(100% - 24px),var(--max)); }
  .home-intro { padding: 25px 0 22px; }
  .home-intro h1 { font-size: 1.9rem; }
  .material-card { grid-template-columns: 40px minmax(0,1fr) auto; padding: 13px; gap: 10px; }
  .material-level { width: 36px; }
  .material-side { min-height: 0; align-self: center; }
  .filter-divider { display: none; }
  .case-grid article { grid-template-columns: 36px 1fr; gap: 8px; }
  .tense-switcher button span { font-size: .78rem; }
  .tense-switcher button small { font-size: .62rem; }
  .greek-paragraph { font-size: 1.08rem; }
  .site-footer > div { padding: 16px 0; flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
