/* ==========================================================================
   Apollo's Reader

   A quiet classical dark theme. One accent colour, one ornament (the meander),
   and type that gets out of the way of the Greek.

   Layout-critical positioning never depends on `transform`, and nothing is
   only visible at the end of a transition: elements are shown and hidden with
   the `hidden` attribute so the interface is correct even where animation is
   suppressed.
   ========================================================================== */

/* --- tokens -------------------------------------------------------------- */
:root {
  --bg:        #141210;
  --bg-tint:   #1a1714;
  --surface:   #1e1a17;
  --raised:    #262119;
  --rule:      #352f28;
  --rule-soft: #272219;
  --text:      #ede5d7;
  --text-dim:  #a99f8e;
  --text-faint:#756c5f;
  --grc:       #f5efe4;
  --shadow:    0 24px 60px -12px rgba(0,0,0,.72), 0 0 0 1px rgba(255,255,255,.04);

  --accent:      #cf8355;
  --accent-soft: #cf835522;
  --accent-line: #cf835559;
  --accent-text: #e7a87c;
  --on-accent:   #17120e;

  --font-ui:  "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-dis: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --font-eng: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-grc: "Cardo", "Gentium Book Plus", "EB Garamond", Georgia, serif;

  --grc-size: 21px;
  --eng-size: 17px;
  --lead:     1.95;
  --measure:  38rem;

  --topbar-h: 54px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
}

html[data-grc-font="gentium"]  { --font-grc: "Gentium Book Plus", "Cardo", Georgia, serif; }
html[data-grc-font="garamond"] { --font-grc: "EB Garamond", "Cardo", Georgia, serif; }

html[data-theme="ink"] {
  --bg:#0c0d10; --bg-tint:#111318; --surface:#15171c; --raised:#1c1f25;
  --rule:#2a2f36; --rule-soft:#1e2228;
  --text:#e5e8ee; --text-dim:#9aa2ad; --text-faint:#6c737e; --grc:#f0f3f8;
}
html[data-theme="slate"] {
  --bg:#181b20; --bg-tint:#1d2128; --surface:#212630; --raised:#2a313c;
  --rule:#3a424f; --rule-soft:#2a313b;
  --text:#e7eaf0; --text-dim:#a3acba; --text-faint:#747e8d; --grc:#f1f4f9;
}
html[data-theme="papyrus"] {
  --bg:#f7f2e7; --bg-tint:#f2ecdd; --surface:#fffdf8; --raised:#f1ead9;
  --rule:#ded4c0; --rule-soft:#e9e1d0;
  --text:#221e17; --text-dim:#5d5547; --text-faint:#8a8272; --grc:#191510;
  --accent-text:#9c552a; --on-accent:#fff;
  --shadow: 0 20px 48px -14px rgba(80,62,34,.28), 0 0 0 1px rgba(0,0,0,.05);
}

html[data-accent="gold"]  { --accent:#c9a227; --accent-soft:#c9a22722; --accent-line:#c9a22759; --accent-text:#ddbb4e; }
html[data-accent="olive"] { --accent:#8d9d5e; --accent-soft:#8d9d5e22; --accent-line:#8d9d5e59; --accent-text:#abbb7c; }
html[data-accent="lapis"] { --accent:#5f88b5; --accent-soft:#5f88b522; --accent-line:#5f88b559; --accent-text:#88abd2; }
html[data-theme="papyrus"][data-accent="gold"]  { --accent:#9a7b12; --accent-text:#7a6210; }
html[data-theme="papyrus"][data-accent="olive"] { --accent:#6b7a3d; --accent-text:#55632e; }
html[data-theme="papyrus"][data-accent="lapis"] { --accent:#3f6693; --accent-text:#355681; }

/* --- scrollbars ----------------------------------------------------------
   `color-scheme` makes the browser's own chrome (scrollbars, form controls,
   the overscroll gutter) follow the theme; the rules under it restyle the
   scrollbars themselves in engines that allow it. Both are needed: Firefox
   only takes `scrollbar-*`, WebKit only takes the pseudo-elements.          */
:root { color-scheme: dark; }
html[data-theme="papyrus"] { color-scheme: light; }

* { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--rule);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-faint); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* --- reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1,h2,h3,h4,p,ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent-text); text-decoration-color: var(--accent-line); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; color: var(--text-faint); }
.gk { font-family: var(--font-grc); }

.skip-link {
  position: fixed; top: 8px; left: -9999px; z-index: 200;
  padding: 10px 14px; background: var(--raised);
  border: 1px solid var(--rule); border-radius: var(--r-sm);
}
.skip-link:focus { left: 8px; }

/* reading progress, a 2px hairline at the very top */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 70; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); opacity: .75; }

/* --- the meander --------------------------------------------------------- */
:root {
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.3'%3E%3Cpath d='M0 11.35H16'/%3E%3Cpath d='M2 11.35V2H13V8H5.5V4.9H9.6'/%3E%3C/g%3E%3C/svg%3E");
}
.meander {
  height: 11px;
  background-color: var(--accent);
  opacity: .26;
  -webkit-mask-image: var(--meander); mask-image: var(--meander);
  -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
  -webkit-mask-size: 16px 11px; mask-size: 16px 11px;
}
.meander.small { opacity: .18; margin-bottom: 26px; }

/* --- top bar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--rule-soft);
}
.brand { min-width: 0; flex: 1; }
.brand h1 {
  font-family: var(--font-dis); font-size: 21px; font-weight: 600;
  letter-spacing: .012em; line-height: 1.1; white-space: nowrap;
}
.brand-sub {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; color: var(--text-dim); flex: none;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small svg { width: 16px; height: 16px; }
.actions { display: flex; gap: 2px; }

.modes {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-tint); border: 1px solid var(--rule-soft); border-radius: 11px;
}
.modes button {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--text-dim); white-space: nowrap;
}
.modes button svg { width: 15px; height: 15px; }
.modes button:hover { color: var(--text); }
.modes button[aria-selected="true"] {
  background: var(--accent-soft); color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* --- layout -------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 252px minmax(0,1fr); }
body[data-nav="shut"] .layout { grid-template-columns: minmax(0,1fr); }
body[data-nav="shut"] .sidebar { display: none; }
.reader { min-width: 0; padding: 40px 24px 110px; }

/* --- sidebar ------------------------------------------------------------- */
.sidebar { border-right: 1px solid var(--rule-soft); background: var(--bg-tint); }
.sidebar-inner {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 22px 16px 40px; scrollbar-width: thin;
}
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-head h2, .set-group h4 {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
}
#navClose { display: none; }
.side-hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; margin: 7px 0 18px; }

.speech-group { margin-bottom: 20px; }
.speech-label {
  font-family: var(--font-dis); font-size: 15px; font-style: italic;
  color: var(--text-dim); margin-bottom: 8px;
}
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px,1fr)); gap: 3px; }
.ref-grid button {
  padding: 6px 2px; border-radius: 7px; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--text-faint);
  border: 1px solid transparent;
}
.ref-grid button:hover { background: var(--raised); color: var(--text); }
.ref-grid button[aria-current="true"] {
  background: var(--accent-soft); color: var(--accent-text);
  border-color: var(--accent-line); font-weight: 600;
}

/* --- headings ------------------------------------------------------------ */
.work-head { max-width: var(--measure); margin: 0 auto 54px; text-align: center; }
.work-head .wh-grc { font-family: var(--font-grc); font-size: 32px; color: var(--grc); line-height: 1.25; }
.work-head .wh-eng {
  font-family: var(--font-dis); font-size: 17px; font-style: italic;
  color: var(--text-dim); margin-top: 7px;
}
.work-head .wh-meta {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 18px;
}

.speech-head { max-width: var(--measure); margin: 64px auto 36px; text-align: center; }
.reader > .speech-head:first-of-type { margin-top: 10px; }
.speech-head .sh-rule { height: 1px; background: linear-gradient(90deg, transparent, var(--rule), transparent); }
.speech-head h2 {
  font-family: var(--font-dis); font-size: 20px; font-weight: 500; font-style: italic;
  color: var(--text-dim); margin-top: -12px;
}
.speech-head h2 span { background: var(--bg); padding: 0 18px; }

/* --- sections ------------------------------------------------------------ */
.sec { scroll-margin-top: calc(var(--topbar-h) + 20px); position: relative; }
.sec-ref {
  font-family: var(--font-ui); font-size: 10px; font-weight: 600;
  letter-spacing: .09em; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  background: none; padding: 0; border-radius: 5px;
}
.sec-ref:hover { color: var(--accent-text); }
.sec-ref.copied { color: var(--accent-text); }
html[data-refs="off"] .sec-ref { visibility: hidden; }
.sec-ref.range { cursor: default; }

/* Stephanus numbers set inside the prose, for paragraph pairing. */
.inline-ref {
  font-family: var(--font-ui); font-size: 9.5px; font-weight: 600;
  letter-spacing: .07em; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  vertical-align: .45em; cursor: pointer;
  padding: 0 1px; border-radius: 3px; white-space: nowrap;
  scroll-margin-top: calc(var(--topbar-h) + 26px);
}
.inline-ref:hover { color: var(--accent-text); background: var(--accent-soft); }
.inline-ref.copied { color: var(--accent-text); }
html[data-refs="off"] .inline-ref { display: none; }
.eng-text .inline-ref { vertical-align: .4em; }

/* Paragraph pairing gives the two columns room to breathe. */
.by-paragraph.mode-parallel .sec { padding: 22px 0; }
.by-paragraph .grc-text p + p, .by-paragraph .eng-text p + p { margin-top: 1em; }

.set-note {
  font-size: 12px; line-height: 1.6; color: var(--text-faint);
  margin-top: 10px; max-width: 54ch;
}
.set-note strong { color: var(--text-dim); font-weight: 600; }

.grc-text {
  font-family: var(--font-grc); font-size: var(--grc-size); line-height: var(--lead);
  color: var(--grc); hyphens: none;
}
html[data-justify="on"] .grc-text { text-align: justify; text-justify: inter-word; }
.eng-text { font-family: var(--font-eng); font-size: var(--eng-size); line-height: 1.7; color: var(--text-dim); }
.grc-text p + p, .eng-text p + p { margin-top: .8em; }
.verse { display: block; padding-left: 1.6em; font-style: italic; }
.eng-note { font-size: .84em; color: var(--text-faint); margin-top: .6em; font-style: italic; }

/* parallel ---------------------------------------------------------------- */
.mode-parallel .sec {
  display: grid; grid-template-columns: 34px minmax(0,1fr) minmax(0,1fr);
  gap: 0 34px; max-width: 80rem; margin: 0 auto; padding: 16px 0;
  border-top: 1px solid var(--rule-soft);
}
.mode-parallel .sec:first-of-type { border-top: 0; }
.mode-parallel .sec-ref { padding-top: .4em; text-align: right; }
html[data-swap="on"] .mode-parallel .sec-grc { order: 3; }
html[data-swap="on"] .mode-parallel .sec-eng { order: 2; }
.mode-parallel .sec-eng { border-left: 1px solid var(--rule-soft); padding-left: 34px; }
html[data-swap="on"] .mode-parallel .sec-eng {
  border-left: 0; border-right: 1px solid var(--rule-soft); padding-left: 0; padding-right: 34px;
}

/* greek only + interlinear share a single measured column ------------------ */
.mode-greek .sec, .mode-interlinear .sec { max-width: var(--measure); margin: 0 auto; }
.mode-greek .sec { padding: 5px 0; }
.mode-greek .sec-ref, .mode-interlinear .sec-ref {
  position: absolute; left: -3.9em; width: 2.8em; text-align: right; padding-top: .55em;
}
.mode-greek .sec-eng, .mode-interlinear .sec-eng { display: none; }

/* --- interlinear ---------------------------------------------------------
   Each word is a column as wide as the wider of the Greek and its gloss, so
   the glosses are kept deliberately short (see tiny_gloss in the build).
   `vertical-align: top` keeps every Greek word on a common line while the
   glosses hang beneath.                                                     */
.mode-interlinear .sec { padding: 14px 0; }
.mode-interlinear .grc-text { line-height: 1.25; }
.iw {
  display: inline-block; vertical-align: top;
  margin: 0 .44em calc(var(--lead) * 0.42em) 0;
  border-radius: 5px;
}
.iw .w-line { display: block; line-height: 1.3; white-space: nowrap; }
.iw .gl {
  display: block; font-family: var(--font-ui);
  font-size: max(9.5px, calc(var(--grc-size) * .43));
  line-height: 1.3; color: var(--text-faint);
  letter-spacing: .005em; max-width: 15ch;
  margin-top: 1px; font-weight: 400;
}
.iw .gl .pr {
  display: block;
  color: color-mix(in srgb, var(--accent) 52%, var(--text-faint));
  font-size: .92em; font-variant-numeric: tabular-nums;
}
.iw:hover { background: var(--accent-soft); }
.iw:hover .gl { color: var(--text-dim); }
html[data-gloss="off"] .iw .gl { display: none; }
html[data-gloss="off"] .iw { margin-bottom: 0; }
html[data-gloss="off"] .mode-interlinear .grc-text { line-height: var(--lead); }
html[data-gloss="hover"] .iw .gl { visibility: hidden; }
html[data-gloss="hover"] .iw:hover .gl,
html[data-gloss="hover"] .iw.is-open .gl { visibility: visible; }

/* --- words --------------------------------------------------------------- */
.w { cursor: pointer; border-radius: 4px; }
.w:hover { background: var(--accent-soft); }
.w.is-open, .iw.is-open { background: var(--accent); color: var(--on-accent); }
.iw.is-open .w { background: none; color: var(--on-accent); }
.iw.is-open .gl { color: color-mix(in srgb, var(--on-accent) 72%, transparent); }
.w.unknown { text-decoration: underline dotted color-mix(in srgb, var(--text-faint) 55%, transparent); text-underline-offset: 3px; }
.hit { background: color-mix(in srgb, var(--accent) 26%, transparent); border-radius: 4px; }

/* --- vocabulary ---------------------------------------------------------- */
.vocab { grid-column: 2 / -1; margin: 10px 0 2px; }
.mode-greek .vocab, .mode-interlinear .vocab { grid-column: auto; }
html[data-vocab="off"] .vocab { display: none; }
.vocab summary {
  font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-faint); cursor: pointer; padding: 5px 0; list-style: none;
}
.vocab summary::-webkit-details-marker { display: none; }
.vocab summary::before { content: "\25B8"; display: inline-block; margin-right: 7px; }
.vocab[open] summary::before { content: "\25BE"; }
.vocab summary:hover { color: var(--text-dim); }
.vocab-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(222px,1fr));
  gap: 2px 24px; padding: 8px 0 6px;
}
.vocab-list li { font-size: 13px; color: var(--text-faint); line-height: 1.55; }
.vocab-list b { font-family: var(--font-grc); font-size: 1.15em; font-weight: 400; color: var(--text-dim); }

/* ==========================================================================
   Word lookup: an anchored popover on a pointer, a bottom sheet on a phone.
   ========================================================================== */
.pop {
  position: absolute; z-index: 80;
  width: min(392px, calc(100vw - 24px));
  display: flex; flex-direction: column;
  max-height: min(64vh, 540px);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.pop[hidden] { display: none; }
.pop-arrow {
  position: absolute; left: var(--arrow-x, 50%); width: 12px; height: 12px;
  margin-left: -6px; background: var(--surface);
  border-left: 1px solid var(--rule); border-top: 1px solid var(--rule);
  rotate: 45deg;
}
.pop[data-dir="down"] .pop-arrow { top: -7px; }
.pop[data-dir="up"] .pop-arrow { bottom: -7px; rotate: 225deg; }
.pop-grab { display: none; }

.pop-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 14px 14px 10px;
}
.pop-form { font-size: 25px; font-weight: 400; color: var(--grc); line-height: 1.15; }
.pop-ref {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 4px;
}
.pop-body { overflow-y: auto; padding: 0 14px 4px; overscroll-behavior: contain; }

.an { padding: 9px 0; border-top: 1px solid var(--rule-soft); }
.an:first-child { border-top: 0; padding-top: 2px; }
.an-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.an-lemma { font-family: var(--font-grc); font-size: 19px; color: var(--accent-text); }
.an-pos {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--rule);
  border-radius: 999px; padding: 1px 7px;
}
.an-flag { font-size: 10px; color: var(--text-faint); font-style: italic; }
.an-parse {
  font-size: 12.5px; color: var(--text-dim); margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.an-gloss { font-family: var(--font-eng); font-size: 16px; color: var(--text); margin-top: 5px; line-height: 1.5; }
.an-ed {
  font-family: var(--font-ui); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint);
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 1px 5px; margin-left: 7px; vertical-align: 2px;
}
.an-note {
  font-family: var(--font-eng); font-size: 14px; line-height: 1.6;
  color: var(--text-dim); margin: 10px 0 4px; padding: 10px 12px;
  background: var(--accent-soft); border-radius: var(--r-sm);
  border-left: 2px solid var(--accent);
}
.an-note-tag {
  display: block; font-family: var(--font-ui); font-size: 9px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 3px;
}

.pop-foot {
  padding: 10px 14px 12px; border-top: 1px solid var(--rule-soft);
  display: flex; flex-direction: column; gap: 9px;
}
.pop-more {
  width: 100%; text-align: left; font-size: 12.5px; color: var(--text-dim);
  padding: 8px 11px; border: 1px solid var(--rule); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: space-between;
}
.pop-more::after { content: "\25BE"; font-size: 10px; color: var(--text-faint); }
.pop-more[aria-expanded="true"]::after { content: "\25B4"; }
.pop-more:hover { border-color: var(--accent-line); color: var(--text); }
.pop-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pop-links a {
  font-size: 11.5px; padding: 5px 10px; border: 1px solid var(--rule);
  border-radius: 999px; text-decoration: none; color: var(--text-faint);
}
.pop-links a:hover { border-color: var(--accent); color: var(--accent-text); }

/* --- the dictionary entry itself ----------------------------------------
   LSJ entries are dense by nature. Readability comes from: generous leading,
   translations picked out in the text colour, sense numbers in the accent,
   nesting shown with an indent and a hairline, and citations hidden unless
   asked for.                                                               */
.lex-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.lex-block > h4 {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 10px;
}
.lex-entry { font-family: var(--font-eng); font-size: 15px; line-height: 1.78; color: var(--text-dim); }
.lex-entry + .lex-entry { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule-soft); }
.lex-hw { font-size: 20px; color: var(--grc); font-weight: 400; margin-bottom: 2px; }
.lex-sense { margin: 7px 0; }
.lex-sense[data-level="2"] { margin-left: .85em; padding-left: .85em; border-left: 1px solid var(--rule-soft); }
.lex-sense[data-level="3"] { margin-left: .8em; padding-left: .8em; border-left: 1px solid var(--rule-soft); }
.lex-sense[data-level="4"], .lex-sense[data-level="5"] {
  margin-left: .75em; padding-left: .75em; border-left: 1px solid var(--rule-soft);
}
.lex-n {
  font-family: var(--font-ui); font-size: .72em; font-weight: 600;
  color: var(--accent-text); margin-right: 4px;
  letter-spacing: .04em; vertical-align: 1px;
}
.lex-tr { color: var(--text); font-weight: 600; }
.lex-orth, .lex-itype { color: var(--text); }
.lex-etym { color: var(--text-faint); }
.lex-gram, .lex-usg { font-style: italic; color: var(--text-faint); }
.lex-cite { font-size: .84em; color: var(--text-faint); }
.lex-cite-title { font-style: italic; }
html[data-citations="off"] .lex-cite { display: none; }
.lex-entry .gk { font-size: 1.05em; color: var(--text); }
.lex-cut { font-style: italic; color: var(--text-faint); margin-top: 10px; font-size: .95em; }
.wp-empty { font-family: var(--font-eng); font-size: 14.5px; color: var(--text-faint); line-height: 1.6; }
.lex-loading { font-size: 12.5px; color: var(--text-faint); padding: 6px 0; }

.pop-lemma-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.pop-lemma-tabs button {
  font-family: var(--font-grc); font-size: 15px; padding: 4px 11px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--text-dim);
}
.pop-lemma-tabs button[aria-checked="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text);
}

/* --- sheets (settings / search) ------------------------------------------ */
.sheet {
  position: fixed; z-index: 95; inset: 0; margin: auto;
  width: min(560px, calc(100vw - 32px));
  height: max-content; max-height: min(78vh, 720px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.sheet[hidden] { display: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--rule-soft);
}
.sheet-head h3 { font-family: var(--font-dis); font-size: 20px; font-weight: 600; }
.sheet-head-actions { display: flex; align-items: center; gap: 6px; }
.text-btn { font-size: 12.5px; color: var(--text-faint); padding: 6px 9px; border-radius: 7px; }
.text-btn:hover { color: var(--text); background: var(--raised); }
.sheet-body { overflow-y: auto; padding: 6px 18px 20px; overscroll-behavior: contain; }
.set-group { padding: 15px 0; border-bottom: 1px solid var(--rule-soft); }
.set-group:last-child { border-bottom: 0; }
.set-group h4 { margin: 0 0 10px; }
.set-group h4:not(:first-child) { margin-top: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .chips { margin-top: 7px; }
.chips button {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--rule);
  font-size: 12.5px; color: var(--text-dim);
}
.chips button:hover { border-color: var(--text-faint); color: var(--text); }
.chips button[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.swatches button { display: inline-flex; align-items: center; gap: 7px; }
.swatches i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.swatches button[data-v="terracotta"] i { background: #cf8355; }
.swatches button[data-v="gold"] i { background: #c9a227; }
.swatches button[data-v="olive"] i { background: #8d9d5e; }
.swatches button[data-v="lapis"] i { background: #5f88b5; }

.range { display: block; margin: 13px 0; }
.range > span { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; }
.range output { color: var(--text-faint); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--rule); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--rule);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border: 2px solid var(--surface);
  border-radius: 50%; background: var(--accent); cursor: pointer;
}

.toggle { display: flex; align-items: center; gap: 11px; padding: 8px 0; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--rule); position: relative; cursor: pointer;
}
.toggle input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint);
}
.toggle input:checked { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.toggle input:checked::after { left: 19px; background: var(--accent); }

.search-input {
  width: 100%; padding: 12px 14px; margin: 12px 0 4px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--rule); border-radius: var(--r-md);
  font-family: var(--font-grc); font-size: 17px;
}
.search-input::placeholder { font-family: var(--font-ui); font-size: 14px; color: var(--text-faint); }
.search-results { margin-top: 8px; }
.search-results button {
  display: block; width: 100%; text-align: left; padding: 10px 11px;
  border-radius: var(--r-sm); border-bottom: 1px solid var(--rule-soft);
}
.search-results button:hover { background: var(--raised); }
.sr-ref { font-size: 10px; letter-spacing: .11em; color: var(--accent-text); font-weight: 600; text-transform: uppercase; }
.sr-txt { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; margin-top: 3px; }
.sr-txt.gk { font-size: 15.5px; }
.sr-none { font-size: 13px; color: var(--text-faint); padding: 14px 2px; }
.sr-count { font-size: 11px; color: var(--text-faint); padding: 4px 2px 8px; letter-spacing: .06em; }

.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); }
.scrim[hidden] { display: none; }

/* --- loading ------------------------------------------------------------- */
.loading { text-align: center; padding: 90px 20px; color: var(--text-faint); }
.loading-mark { font-size: 24px; color: var(--accent); }
.loading p { margin-top: 12px; font-size: 13px; letter-spacing: .05em; }

/* --- footer -------------------------------------------------------------- */
.sitefoot { border-top: 1px solid var(--rule-soft); background: var(--bg-tint); margin-top: 40px; }
.foot-inner { max-width: 60rem; margin: 0 auto; padding: 34px 24px 60px; }
.sitefoot h2 { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px; }
.sitefoot p { font-size: 13px; line-height: 1.7; color: var(--text-faint); max-width: 62ch; }
.creditlist { margin: 16px 0; display: grid; gap: 10px; }
.creditlist li {
  font-size: 12.5px; line-height: 1.65; color: var(--text-faint);
  max-width: 74ch; padding-left: 13px; border-left: 2px solid var(--rule-soft);
}
.creditlist strong { color: var(--text-dim); font-weight: 600; }
.foot-note { margin-top: 16px; }
.foot-sig { margin-top: 26px; font-size: 12.5px; color: var(--text-faint); }
.foot-sig .gk { font-size: 15px; color: var(--text-dim); }

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .layout, body[data-nav="shut"] .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar, body[data-nav="shut"] .sidebar {
    display: block;
    position: fixed; z-index: 90; top: 0; bottom: 0; width: 286px;
    background: var(--surface); border-right: 1px solid var(--rule);
    left: -288px; box-shadow: var(--shadow); visibility: hidden;
  }
  body[data-nav="open"] .sidebar { left: 0; visibility: visible; }
  .sidebar-inner { top: 0; max-height: 100vh; padding-top: 16px; }
  #navClose { display: grid; }
}
@media (max-width: 980px) {
  .mode-parallel .sec { grid-template-columns: 30px minmax(0,1fr); gap: 0 14px; }
  .mode-parallel .sec-eng {
    grid-column: 2; border-left: 0; padding-left: 0; margin-top: 12px;
    padding-top: 12px; border-top: 1px dashed var(--rule-soft);
  }
  html[data-swap="on"] .mode-parallel .sec-grc,
  html[data-swap="on"] .mode-parallel .sec-eng { order: 0; }
  html[data-swap="on"] .mode-parallel .sec-eng { border-right: 0; padding-right: 0; }
}
@media (max-width: 860px) {
  .modes button span { display: none; }
  .modes button { padding: 7px 10px; }
  .brand h1 { font-size: 18px; }
  .brand-sub { display: none; }
}
@media (max-width: 760px) {
  .reader { padding: 24px 18px 90px; }
  .mode-greek .sec-ref, .mode-interlinear .sec-ref {
    position: static; width: auto; text-align: left; padding-top: 0;
    display: block; margin-bottom: 3px;
  }
  .work-head .wh-grc { font-size: 25px; }
  .work-head { margin-bottom: 40px; }

  /* the lookup becomes a bottom sheet */
  .pop {
    position: fixed; inset: auto 0 0 0; width: auto;
    max-height: 72vh; border-left: 0; border-right: 0; border-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pop-arrow { display: none; }
  .pop-grab { display: block; width: 40px; height: 4px; border-radius: 3px; background: var(--rule); margin: 8px auto 0; }
  .pop-head { padding-top: 10px; }
  .pop-form { font-size: 23px; }

  .sheet {
    inset: auto 0 0 0; margin: 0;
    width: auto; height: auto; max-height: 86vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .foot-inner { padding: 28px 18px 48px; }
  .vocab-list { grid-template-columns: 1fr; }
}

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

@media print {
  .topbar, .sidebar, .pop, .sheet, .scrim, .meander, .vocab, .progress { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { grid-template-columns: 1fr; }
  .iw .gl { color: #555; }
}
