/* Heraclitus: a split-screen reader.
   White, ink, one blue. Greek in GFS Didot, English in Inter, numbers in Plex Mono. */

.reader {
  --bg: #ffffff;
  --panel: #f7f7f5;
  --panel-2: #ececea;
  --ink: #131313;
  --ink-2: #5c5c5a;
  --ink-3: #9a9a97;
  --rule: #e6e6e3;
  --rule-2: #d3d3cf;
  --card-border: #e2e2de;
  --inset-hi: rgba(255, 255, 255, 0.7);
  --blue: #002fa7;
  --blue-2: #2a5be0;
  --blue-3: #5d86ff;
  --on-blue: #ffffff;

  /* theme colours, shared by the bar and the chips */
  --t-logos: #002fa7;
  --t-fire: #d0532c;
  --t-rivers: #2a9d8f;
  --t-opposites: #7b5ea7;
  --t-soul: #b8477c;
  --t-wisdom: #c39a1f;
  --t-gods: #8a6a4a;
  --t-city: #4f7f45;
  --t-none: #c6c6c2;

  --btn-a: #ffffff;
  --btn-b: #f6f6f4;
  --btn-border: #dcdcd8;
  --btn-border-hover: #c4c4bf;
  --btn-shadow: 0 1px 1px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --btn-pressed: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  --float: rgba(255, 255, 255, 0.84);
  --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, 0.22), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 32px 80px -24px rgba(0, 0, 0, 0.3), 0 4px 12px -4px rgba(0, 0, 0, 0.08);
  --scrim: rgba(20, 20, 20, 0.28);

  --greek: 'GFS Didot', 'Literata', 'Gentium Book Plus', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

  --gut: 96px;
  --gap: 56px;
  --pad: 32px;
  --rail: 68px;   /* room at the left edge for the bar */
  --measure: 1180px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .reader {
    --bg: #0e0e10;
    --panel: #16161a;
    --panel-2: #1e1e23;
    --ink: #ece9e1;
    --ink-2: #a3a29b;
    --ink-3: #6d6c66;
    --rule: #242429;
    --rule-2: #35353b;
    --card-border: #2b2b32;
    --inset-hi: rgba(255, 255, 255, 0.035);
    --blue: #4d76ff;
    --blue-2: #3a66ff;
    --blue-3: #8aa4ff;
    --on-blue: #0b0b0d;
    --t-logos: #4d76ff;
    --t-fire: #e0694a;
    --t-rivers: #3fb3a4;
    --t-opposites: #9a7fc4;
    --t-soul: #d0629a;
    --t-wisdom: #d6ae3a;
    --t-gods: #a8886a;
    --t-city: #6a9b5f;
    --t-none: #37373d;
    --btn-a: #24242a;
    --btn-b: #1a1a1f;
    --btn-border: #34343b;
    --btn-border-hover: #47474f;
    --btn-shadow: 0 1px 1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --btn-pressed: inset 0 1px 2px rgba(0, 0, 0, 0.6);
    --float: rgba(14, 14, 16, 0.82);
    --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 32px 80px -24px rgba(0, 0, 0, 0.9), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.62);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .reader .btn .ico-moon { display: none; }
  :root:not([data-theme="light"]) .reader .btn .ico-sun { display: block; }
}
:root[data-theme="dark"] .reader {
  --bg: #0e0e10;
  --panel: #16161a;
  --panel-2: #1e1e23;
  --ink: #ece9e1;
  --ink-2: #a3a29b;
  --ink-3: #6d6c66;
  --rule: #242429;
  --rule-2: #35353b;
  --card-border: #2b2b32;
  --inset-hi: rgba(255, 255, 255, 0.035);
  --blue: #4d76ff;
  --blue-2: #3a66ff;
  --blue-3: #8aa4ff;
  --on-blue: #0b0b0d;
  --t-logos: #4d76ff;
  --t-fire: #e0694a;
  --t-rivers: #3fb3a4;
  --t-opposites: #9a7fc4;
  --t-soul: #d0629a;
  --t-wisdom: #d6ae3a;
  --t-gods: #a8886a;
  --t-city: #6a9b5f;
  --t-none: #37373d;
  --btn-a: #24242a;
  --btn-b: #1a1a1f;
  --btn-border: #34343b;
  --btn-border-hover: #47474f;
  --btn-shadow: 0 1px 1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --btn-pressed: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  --float: rgba(14, 14, 16, 0.82);
  --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 32px 80px -24px rgba(0, 0, 0, 0.9), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.62);
  color-scheme: dark;
}
:root[data-theme="dark"] .reader .btn .ico-moon { display: none; }
:root[data-theme="dark"] .reader .btn .ico-sun { display: block; }
.btn .ico-moon { display: block; }
.btn .ico-sun { display: none; }

/* Keep the scrollbar's space reserved so fixed elements never shift between modes. */
html { scrollbar-gutter: stable; }
html.focus, html.landing-open { overflow: hidden; }

/* Safari paints native bezels on buttons unless told not to. Zero specificity, so components win. */
:where(.reader button) { -webkit-appearance: none; appearance: none; background: none; border: 0; margin: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.float, .bar, .bar-tip, .frag-num { user-select: none; -webkit-user-select: none; }

.reader ::selection { background: color-mix(in srgb, var(--blue) 18%, transparent); }
.reader :focus-visible { outline: 2px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.reader [lang="grc"] { font-family: var(--greek); letter-spacing: 0; }
.reader kbd { font: inherit; font-size: 11.5px; color: inherit; opacity: 0.6; }

.num, .frag-num, .r-num, .bar-tip b, .ap-words dt i {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
  box-shadow: var(--btn-shadow);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s, color 0.15s;
}
.btn > * { line-height: 1; }
.btn:hover { border-color: var(--btn-border-hover); }
.btn:active { box-shadow: var(--btn-pressed); }
.btn svg { width: 14px; height: 14px; display: block; flex: none; }
.btn-icon { width: 30px; padding: 0; }
.btn[aria-pressed="true"], .btn[aria-checked="true"], .btn-primary {
  color: var(--on-blue);
  border-color: color-mix(in srgb, var(--blue) 85%, black);
  background: linear-gradient(180deg, var(--blue-3), var(--blue-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary { height: 36px; padding: 0 18px; font-size: 13.5px; }
.btn-mini { display: none; font-size: 12px; font-weight: 600; letter-spacing: -0.02em; }

.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 8px 0 0 8px; }
.seg .btn:last-child { border-radius: 0 8px 8px 0; }
.seg .btn + .btn { margin-left: -1px; }
.seg .btn[aria-checked="true"] { position: relative; z-index: 1; }

/* ---------- floating chrome ---------- */

.float {
  position: fixed;
  top: 22px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: var(--float);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: var(--shadow-sm);
}
.home { left: 24px; }
.tools { right: 24px; }
.tools-sep { width: 1px; height: 18px; background: var(--rule); }

/* ---------- the bar ---------- */

/* A column of segments down the left edge, one per fragment, coloured by theme.
   Past segments are solid, future ones faint, the present one wider. Hover widens the column. */
.bar {
  position: fixed;
  left: 28px;
  top: 86px;
  bottom: 40px;
  width: 22px;
  z-index: 29;
  cursor: pointer;
}
.bar-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: width 0.18s var(--ease);
}
.bar:hover .bar-track, .bar.is-active .bar-track { width: 12px; }
.bar-seg {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  border-radius: 1px;
  background: var(--c, var(--t-none));
  opacity: 0.24;
  transform-origin: left;
  transition: opacity 0.2s, transform 0.18s var(--ease);
}
.bar-seg:first-child { border-radius: 3px 3px 1px 1px; }
.bar-seg:last-child { border-radius: 1px 1px 3px 3px; }
.bar-seg::before { content: ''; position: absolute; inset: -0.5px -12px; }
.bar-seg.is-past { opacity: 0.8; }
.bar-seg.is-now { opacity: 1; transform: scaleX(2.4); }
.bar:hover .bar-seg.is-now, .bar.is-active .bar-seg.is-now { transform: scaleX(1.5); }
.bar-seg:hover { opacity: 1; }

.bar-tip {
  position: fixed;
  z-index: 31;
  max-width: 320px;
  padding: 7px 10px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  white-space: nowrap;
}
.bar-tip b { color: inherit; }
.bar-tip .tip-theme { opacity: 0.72; margin-left: 8px; }
.bar-tip .tip-theme::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 2px; background: var(--c, var(--t-none)); vertical-align: 0; }
.bar-tip .tip-en { display: block; overflow: hidden; text-overflow: ellipsis; opacity: 0.75; margin-top: 2px; }

/* ---------- page ---------- */

.page { max-width: var(--measure); margin: 0 auto; padding: 96px var(--pad) 120px max(var(--pad), var(--rail)); }

/* ---------- fragments ---------- */

.frags { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }

.frag {
  padding: 30px 0 28px;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 28px;
}

.frag-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--gut) minmax(0, 1fr) var(--gap) minmax(0, 1fr);
  align-items: first baseline;
}
/* The spine between the two languages, run through the row padding so it reads as continuous. */
.frag-body::before {
  content: '';
  position: absolute;
  top: -30px;
  bottom: -28px;
  left: calc(var(--gut) + (100% - var(--gut)) / 2);
  width: 1px;
  background: var(--rule);
}
.frag-body::after {
  content: '';
  position: absolute;
  top: 4px;
  left: calc(var(--gut) + (100% - var(--gut)) / 2 - 1px);
  width: 3px;
  height: 28px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--blue-3), var(--blue));
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.frag.is-now .frag-body::after { opacity: 1; }

/* Gutter: the number, and under it the one control that belongs to this fragment. */
.frag-gutter { grid-column: 1; display: grid; gap: 10px; justify-items: start; align-content: start; padding-right: 14px; }
.frag-num { color: var(--ink-3); transition: color 0.2s var(--ease); }
.frag:hover .frag-num { color: var(--ink); }
.frag.is-now .frag-num { color: var(--blue); }

.notes-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 0 9px;
  border: 1px solid var(--btn-border);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
  box-shadow: var(--btn-shadow);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 22px;
  opacity: 0;
  transition: opacity 0.15s var(--ease), border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.frag:hover .notes-btn, .frag:focus-within .notes-btn, .frag.is-open .notes-btn,
[data-mode="focus"] .notes-btn { opacity: 1; }
@media (hover: none) { .notes-btn { opacity: 1; } }
.notes-btn:hover { color: var(--ink); border-color: var(--btn-border-hover); }
.notes-btn:active { box-shadow: var(--btn-pressed); }
.notes-btn svg { width: 9px; height: 9px; flex: none; transition: transform 0.2s var(--ease); }
.notes-btn[aria-expanded="true"] { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, var(--btn-border)); }
.notes-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.notes-btn .nb-text { display: inline; }

.frag-greek {
  grid-column: 2;
  font-family: var(--greek);
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink);
}
.frag-greek p { margin: 0; }
.frag-greek[lang="la"] { font-family: var(--sans); font-style: italic; font-size: 19px; letter-spacing: -0.006em; }
.ctx { color: var(--ink-3); }

.frag-translit {
  display: none;
  margin-top: 12px !important;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
}
.show-translit .frag-translit { display: block; }

.frag-en {
  grid-column: 4;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-2);
  transition: color 0.25s var(--ease);
}
.frag-en p { margin: 0; }
.frag-en p + p { margin-top: 8px; }
.frag:hover .frag-en, .frag.is-now .frag-en { color: var(--ink); }
.frag-en .absent { display: block; font-size: 13px; color: var(--ink-3); }

/* Glossed words: a quiet dotted underline, always there, blue on approach. Longhands, for Safari. */
.lex {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--blue) 45%, transparent);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.15s var(--ease);
}
@supports not (color: color-mix(in srgb, red, blue)) { .lex { text-decoration-color: #8fa3dc; } }
.lex:hover { text-decoration-color: var(--blue); }

/* ---------- notes (apparatus) ---------- */

.frag-detail {
  display: none;
  margin: 22px 0 0 var(--gut);
  padding: 16px 20px 18px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 var(--inset-hi);
  font-size: 13.5px;
  line-height: 1.55;
}
.frag.is-open .frag-detail { display: block; animation: reveal 0.25s var(--ease) both; }

.ap-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  min-height: 24px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 24px;
}
.ap-meta:not(:last-child) { margin-bottom: 14px; }
.ap-meta b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.ap-meta .ap-threads { display: flex; flex-wrap: wrap; gap: 5px; margin-left: auto; }

.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 36px; }
.ap-block { min-width: 0; }
.ap-h { margin: 0 0 8px; }

.ap-words { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); column-gap: 20px; row-gap: 8px; margin: 0; align-items: baseline; }
.ap-words dt { display: flex; gap: 9px; align-items: baseline; font-family: var(--greek); font-size: 17.5px; line-height: 1.3; color: var(--ink); }
.ap-words dt i { font-style: normal; color: var(--ink-3); }
.ap-words dd { margin: 0; color: var(--ink-2); }

.ap-rel { list-style: none; margin: 0; padding: 0; display: grid; row-gap: 8px; }
.ap-rel li { display: grid; grid-template-columns: minmax(52px, max-content) minmax(0, 1fr); column-gap: 14px; align-items: baseline; }
.ap-rel a { color: var(--blue); font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; }
.ap-rel a:hover { text-decoration: underline 1px var(--blue); text-underline-offset: 3px; }
.ap-rel .rel-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ap-rel .rel-text [lang="grc"] { color: var(--ink); font-size: 15.5px; }
.ap-rel .rel-en { color: var(--ink-3); }
.ap-rel .rel-en::before { content: ' — '; }

/* Theme chips: a coloured dot names the thread; the bar uses the same colour. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px 0 9px;
  border: 1px solid var(--btn-border);
  border-radius: 99px;
  background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
  box-shadow: var(--btn-shadow);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 22px;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.chip > * { line-height: 1; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-3)); flex: none; }
.chip:hover { color: var(--ink); border-color: var(--btn-border-hover); }
.chip:active { box-shadow: var(--btn-pressed); }
.chip [lang="grc"] { font-size: 13.5px; color: var(--ink); }
.chip .n { color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] {
  color: var(--on-blue);
  border-color: color-mix(in srgb, var(--c, var(--blue)) 70%, black);
  background: var(--c, var(--blue));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.chip[aria-pressed="true"]::before { background: var(--on-blue); }
.chip[aria-pressed="true"] [lang="grc"], .chip[aria-pressed="true"] .n { color: inherit; }
.chip[aria-pressed="true"] .n { opacity: 0.75; }
.chip[data-thread=""]::before { display: none; }

[data-thread="logos"] { --c: var(--t-logos); }
[data-thread="fire"] { --c: var(--t-fire); }
[data-thread="rivers"] { --c: var(--t-rivers); }
[data-thread="opposites"] { --c: var(--t-opposites); }
[data-thread="soul"] { --c: var(--t-soul); }
[data-thread="wisdom"] { --c: var(--t-wisdom); }
[data-thread="gods"] { --c: var(--t-gods); }
[data-thread="city"] { --c: var(--t-city); }
[data-thread="none"] { --c: var(--t-none); }

/* ---------- focus mode ---------- */

[data-mode="focus"] .page { position: fixed; inset: 0; max-width: none; padding: 0; }
[data-mode="focus"] .frags {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border: 0;
}
[data-mode="focus"] .frags::-webkit-scrollbar { display: none; }
[data-mode="focus"] .frag {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  border: 0;
  padding: 0;
  scrollbar-width: none;
}
[data-mode="focus"] .frag::-webkit-scrollbar { display: none; }
[data-mode="focus"] .frag-inner {
  margin: auto;
  width: min(100% - var(--pad) - var(--rail) - 40px, var(--measure));
  padding: 88px 0 72px;
  padding-left: calc(var(--rail) - var(--pad) + 8px);
}
[data-mode="focus"] .frag-body::before { top: -6px; bottom: -6px; }
[data-mode="focus"] .frag-body::after { top: 8px; }
[data-mode="focus"] .frag-greek { font-size: clamp(22px, 1.9vw, 27px); line-height: 1.5; }
[data-mode="focus"] .frag-greek[lang="la"] { font-size: clamp(19px, 1.6vw, 23px); }
[data-mode="focus"] .frag-en { font-size: clamp(16px, 1.25vw, 18px); line-height: 1.6; color: var(--ink); }
[data-mode="focus"] .frag-detail { margin-top: 32px; }

/* ---------- landing ---------- */

.landing {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink-2);
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}
.landing.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.landing-art { position: relative; overflow: hidden; background: var(--bg); }
.landing-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.landing-text {
  align-self: center;
  max-width: 600px;
  padding: 48px clamp(32px, 6vw, 88px);
  overflow-y: auto;
  max-height: 100%;
  scrollbar-width: none;
}
.landing-text::-webkit-scrollbar { display: none; }
.landing-text p { margin: 0 0 16px; font-size: 16px; line-height: 1.65; }
.mast-title {
  margin: 0 0 24px;
  font-family: var(--greek);
  font-size: clamp(48px, 5vw, 72px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.mast-title [lang="grc"] { display: block; }
.mast-sub {
  display: block;
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 0.45em;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--ink-2);
}
.landing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 28px 0 32px; }
.landing-foot { font-size: 12.5px !important; color: var(--ink-3); line-height: 1.6 !important; }
.landing-foot a { color: var(--ink-2); }

/* ---------- gloss ---------- */

.gloss {
  position: fixed;
  z-index: 50;
  width: max-content;
  max-width: 300px;
  padding: 12px 14px 13px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: reveal 0.14s var(--ease) both;
}
@keyframes reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.g-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 3px; }
.g-lemma { font-family: var(--greek); font-size: 19px; color: var(--ink); }
.g-tr { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.g-def { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }

/* ---------- info ---------- */

/* Not a button: a quiet mark that reveals the note on hover, or on focus/tap. */
.info { position: fixed; bottom: 22px; right: 24px; z-index: 30; }
.info-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--bg);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-3);
  cursor: help;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.info:hover .info-mark, .info-mark:focus-visible { color: var(--ink-2); border-color: var(--ink-2); }
.info-mark:focus-visible { border-radius: 50%; outline-offset: 3px; }
.info-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  visibility: hidden;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease), visibility 0s 0.14s;
}
.info-panel p { margin: 0; }
.info-panel p + p { margin-top: 8px; color: var(--ink-3); }
.info:focus-within .info-panel { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
@media (hover: hover) {
  .info:hover .info-panel { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
}

/* ---------- index ---------- */

.sheet {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
  margin: 18vh auto auto;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sheet[open] { animation: sheet-in 0.2s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.search { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.search svg { flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  height: 56px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 16px/1 var(--sans);
  letter-spacing: -0.006em;
  -webkit-appearance: none;
  appearance: none;
}
.search input, .search input:focus, .search input:focus-visible { outline: none; box-shadow: none; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.sheet-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px; border-bottom: 1px solid var(--rule); background: var(--panel); }

.results {
  height: min(46vh, 440px);
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}
.results::-webkit-scrollbar { width: 6px; }
.results::-webkit-scrollbar-track { background: transparent; }
.results::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 3px; }
.results button {
  width: 100%;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  align-items: baseline;
  color: inherit;
}
.results button.is-sel { background: var(--panel); }
.results button:focus-visible { outline: none; }
.r-num { color: var(--ink-3); }
.results button.is-sel .r-num { color: var(--blue); }
.r-text { display: grid; min-width: 0; }
.r-greek, .r-en { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-greek { font-size: 16.5px; line-height: 1.35; color: var(--ink); }
.r-en { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.results .empty { padding: 20px 12px; font-size: 13.5px; color: var(--ink-3); }

.noscript { padding: 48px 24px; text-align: center; }

/* ---------- narrow ---------- */

@media (max-width: 1100px) {
  .reader { --gap: 40px; --gut: 88px; --rail: 60px; }
  .bar { left: 20px; }
}

@media (max-width: 900px) {
  .reader { --pad: 20px; --gut: 84px; --rail: 20px; }
  /* The column has nowhere to go at this width, so it lies along the top edge instead. */
  .bar { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 14px; }
  .bar-track { top: 0; bottom: auto; left: 0; right: 0; width: auto; height: 3px; flex-direction: row; gap: 0; }
  .bar:hover .bar-track, .bar.is-active .bar-track { width: auto; height: 8px; }
  .bar-seg { width: auto; height: 100%; transform-origin: top; }
  .bar-seg.is-now { transform: scaleY(2.2); }
  .bar:hover .bar-seg.is-now, .bar.is-active .bar-seg.is-now { transform: scaleY(1.4); }
  .bar-seg::before { inset: -0.5px -0.5px -12px; }
  .home { left: 16px; top: 18px; }
  .tools {
    top: auto;
    bottom: 16px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);
  }
  .tools .btn-text { display: none; }
  .tools .btn-mini { display: inline; }
  .page { padding-top: 84px; }
  .page { padding-bottom: 96px; }
  /* The toolbar takes the bottom edge here, so the info button moves to the free top-right corner. */
  .info { top: 29px; bottom: auto; right: 18px; }
  .info-panel { bottom: auto; top: calc(100% + 10px); }
  .landing { grid-template-columns: minmax(0, 1fr); grid-template-rows: 40vh minmax(0, 1fr); }
  .landing-text { align-self: start; padding: 28px 24px 40px; max-width: none; }
  .mast-title { font-size: 44px; }
  [data-mode="focus"] .frag-inner { padding-left: 0; width: calc(100% - 2 * var(--pad)); }
}

@media (max-width: 720px) {
  .reader { --gut: 46px; }
  .frag-body::before, .frag-body::after { display: none; }
  .frag-body { grid-template-columns: var(--gut) minmax(0, 1fr); }
  .frag-gutter { padding-right: 8px; }
  .notes-btn { height: 22px; padding: 0 6px; }
  .notes-btn .nb-text { display: none; }
  .frag-greek { grid-column: 2; font-size: 20px; }
  .frag-en { grid-column: 2; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 15.5px; }
  .frag-detail { margin-left: 0; padding: 16px 18px; }
  .ap-meta .ap-threads { margin-left: 0; }
  .ap-words, .ap-rel li { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .ap-words dd { margin-bottom: 8px; }
  [data-mode="focus"] .frag-inner { padding: 40px 0 96px; }
  [data-mode="focus"] .frag-greek { font-size: 21px; }
  [data-mode="focus"] .frag-en { font-size: 16px; }
  .sheet { margin-top: 8vh; }
  .results { height: 50vh; }
}

/* Keyboard hints appear for pointer users and keyboard focus. */
.tools .btn[aria-describedby] { position: relative; }
.shortcut-hint {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  visibility: hidden;
  pointer-events: none;
}
.tools .btn:focus-visible .shortcut-hint { visibility: visible; }
@media (hover: hover) {
  .tools .btn:hover .shortcut-hint { visibility: visible; }
}
@media (max-width: 900px) {
  .tools .index-shortcut { display: none; }
  .shortcut-hint { top: auto; bottom: calc(100% + 10px); }
  [data-act="prev"] .shortcut-hint { left: 0; transform: none; }
}
