/* ==========================================================================
   The Enchiridion — design system
   A Roman reading room: warm lime plaster, one breath of Pompeiian oxblood,
   bronze and verdigris held back for the margin voices. Two surfaces:
   plaster (day) and lamp (reading by oil light). No framework, no build.
   ========================================================================== */

/* ---- tokens -------------------------------------------------------------- */
:root {
  /* plaster (light) */
  --bg: #f1ebdf;
  --bg-deep: #e9e1d1;
  --bg-raised: #f8f4ea;
  --ink: #26201a;
  --ink-soft: #514639;
  --muted: #7d6f5c;
  --line: rgba(60, 46, 30, 0.16);
  --line-soft: rgba(60, 46, 30, 0.09);

  --accent: #913a28;          /* Pompeiian oxblood */
  --accent-deep: #74301f;
  --accent-ink: #f6efe2;      /* text on accent */
  --bronze: #8a6a2f;          /* Σ note voice */
  --verdigris: #4f7264;       /* cf voice */

  --night: #201812;           /* dark panels on the light theme */
  --night-ink: #ece3d2;

  --shadow: 0 1px 2px rgba(38, 28, 16, 0.06), 0 8px 28px -12px rgba(38, 28, 16, 0.25);
  --shadow-pop: 0 2px 6px rgba(24, 16, 8, 0.14), 0 18px 44px -16px rgba(24, 16, 8, 0.38);

  --font-display: "Marcellus", "Times New Roman", serif;
  --font-text: "Literata", Georgia, serif;
  --font-greek: "GFS Didot", "Literata", serif;
  --font-ui: "Archivo", "Helvetica Neue", sans-serif;

  --w-page: 72rem;
  --w-prose: 44rem;
}

html.lamp {
  /* lamp (dark) */
  --bg: #171209;
  --bg-deep: #100c06;
  --bg-raised: #211a10;
  --ink: #ece3cf;
  --ink-soft: #cbbd9f;
  --muted: #9a8a70;
  --line: rgba(236, 227, 207, 0.17);
  --line-soft: rgba(236, 227, 207, 0.09);

  --accent: #cd6b4c;
  --accent-deep: #b4553a;
  --accent-ink: #1c130c;
  --bronze: #c39d55;
  --verdigris: #86ab98;

  --night: #211a10;
  --night-ink: #ece3cf;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px -12px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.5), 0 18px 44px -16px rgba(0, 0, 0, 0.8);
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* the plaster: a whisper of grain + uneven wash, both themes */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(255, 252, 240, 0.55), transparent 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(145, 58, 40, 0.05), transparent 55%);
  pointer-events: none;
}
html.lamp body::before {
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(255, 214, 150, 0.05), transparent 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(205, 107, 76, 0.06), transparent 55%);
}

img { max-width: 100%; display: block; }
a { color: inherit; }
p a, li a, .colophon a { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
p a:hover, li a:hover { text-decoration-color: currentColor; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: 0.005em; }
[lang="grc"] { font-family: var(--font-greek); }

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; font-family: var(--font-ui); font-size: 0.85rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---- shared atoms --------------------------------------------------------- */
.eyebrow, .section-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.7rem;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.85rem 1.3rem; text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

.chip {
  display: inline-flex; align-items: baseline; gap: 0.45rem;
  border: 1px solid var(--line); padding: 0.4rem 0.75rem;
  text-decoration: none; font-family: var(--font-ui); font-size: 0.8rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--accent); background: var(--bg-raised); }
.chip__gr { font-family: var(--font-greek); font-size: 0.95rem; color: var(--accent); }

/* ---- masthead -------------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.masthead__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand__seal {
  width: 2.15rem; height: 2.15rem; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-greek); font-size: 1.25rem; line-height: 1;
  border-radius: 3px;
}
.brand__text { display: grid; line-height: 1.25; }
.brand__title { font-family: var(--font-display); font-size: 1.05rem; }
.brand__sub { font-size: 0.72rem; color: var(--muted); }

.masthead__links { display: flex; align-items: center; gap: clamp(0.6rem, 2vw, 1.4rem); }
.navlink {
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.05em; text-decoration: none; color: var(--ink-soft);
  padding: 0.35rem 0.1rem; border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.navlink:hover { color: var(--ink); border-bottom-color: var(--accent); }
.navlink--icon svg { width: 1.1rem; height: 1.1rem; display: block; }

.theme-toggle {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  border-radius: 999px; cursor: pointer; padding: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle__moon { display: none; }
html.lamp .theme-toggle__sun { display: none; }
html.lamp .theme-toggle__moon { display: block; }

.masthead__burger { display: none; }

@media (max-width: 46rem) {
  .masthead__burger {
    display: grid; gap: 4px; background: none; border: 0; padding: 0.5rem; cursor: pointer;
  }
  .masthead__burger span { width: 1.3rem; height: 2px; background: var(--ink); }
  .masthead__links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-raised); border-bottom: 1px solid var(--line);
    padding: 0.9rem clamp(1rem, 4vw, 2.5rem) 1.1rem;
    flex-direction: row; flex-wrap: wrap;
  }
  .masthead__links.is-open { display: flex; }
  .brand__sub { display: none; }
}

/* ==========================================================================
   HOME
   ========================================================================== */

.hero {
  position: relative;
  background: var(--night);
  color: var(--night-ink);
  overflow: hidden;
}
.hero__art { position: absolute; inset: 0; }
.hero__art img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.9;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(78deg, rgba(24, 17, 11, 0.92) 0%, rgba(24, 17, 11, 0.78) 34%, rgba(24, 17, 11, 0.25) 68%, rgba(24, 17, 11, 0.45) 100%),
    linear-gradient(0deg, rgba(24, 17, 11, 0.55) 0%, transparent 30%);
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(5rem, 12vw, 9.5rem) clamp(1rem, 4vw, 2.5rem) clamp(4rem, 9vw, 7rem);
}
.hero__eyebrow {
  font-family: var(--font-greek); font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: #d8a06a; margin: 0 0 1.2rem;
  animation: rise 0.7s ease both;
}
.hero__eyebrow-en { font-family: var(--font-ui); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(236, 227, 207, 0.75); }
.hero__title {
  font-size: clamp(2.6rem, 6.5vw, 4.9rem);
  max-width: 15ch;
  animation: rise 0.7s 0.08s ease both;
}
.hero__title em { font-style: normal; color: #e0a276; }
.hero__lede {
  max-width: 36rem; font-size: clamp(1.02rem, 1.5vw, 1.16rem);
  line-height: 1.65; color: rgba(236, 227, 207, 0.9);
  margin: 1.4rem 0 0;
  animation: rise 0.7s 0.16s ease both;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.2rem; animation: rise 0.7s 0.24s ease both; }
.hero .btn--ghost { border-color: rgba(236, 227, 207, 0.4); color: var(--night-ink); }
.hero .btn--ghost:hover { border-color: var(--night-ink); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---- dichotomy ------------------------------------------------------------- */
.dichotomy { border-bottom: 1px solid var(--line-soft); }
.dichotomy__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem);
  text-align: center;
}
.dichotomy__cols {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(1.2rem, 4vw, 3.5rem);
  max-width: 54rem; margin: 1.8rem auto 0; text-align: left;
}
.dichotomy__rule { width: 1px; background: linear-gradient(var(--accent), transparent 85%); }
.dichotomy__gr { font-family: var(--font-greek); font-size: 1.05rem; color: var(--accent); margin: 0 0 0.3rem; }
.dichotomy__col h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 0.9rem; }
.dichotomy__col ul {
  list-style: none; margin: 0; padding: 0;
  font-family: var(--font-ui); font-size: 0.92rem; letter-spacing: 0.02em;
}
.dichotomy__col li { padding: 0.42rem 0; border-top: 1px solid var(--line-soft); }
.dichotomy__col--ours li::marker { content: ""; }
.dichotomy__verdict { font-style: italic; color: var(--muted); font-size: 0.92rem; margin: 0.9rem 0 0; }
.dichotomy__col--ours .dichotomy__verdict { color: var(--accent); }
.dichotomy__coda { margin: 2.4rem auto 0; max-width: 40rem; color: var(--ink-soft); }

@media (max-width: 46rem) {
  .dichotomy__cols { grid-template-columns: 1fr; }
  .dichotomy__rule { width: 100%; height: 1px; background: linear-gradient(90deg, var(--accent), transparent 85%); }
}

/* ---- parts grid ------------------------------------------------------------ */
.parts { background: var(--bg-deep); border-bottom: 1px solid var(--line-soft); }
.parts__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem);
}
.parts__title { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 2rem; }
.parts__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1.1rem;
}
.partcard {
  display: grid; grid-template-rows: auto 1fr;
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  text-decoration: none; overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.partcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line); }
.partcard__art { aspect-ratio: 5 / 2.6; overflow: hidden; }
.partcard__art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.partcard:hover .partcard__art img { transform: scale(1.04); }
.partcard__body { display: grid; gap: 0.28rem; padding: 1.05rem 1.15rem 1.25rem; align-content: start; }
.partcard__top { display: flex; align-items: baseline; justify-content: space-between; }
.partcard__roman { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); }
.partcard__gr { font-family: var(--font-greek); color: var(--muted); font-size: 0.95rem; }
.partcard__title { font-family: var(--font-display); font-size: 1.32rem; }
.partcard__sub { color: var(--muted); font-size: 0.92rem; }
.partcard__range { font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-soft); margin-top: 0.55rem; }

/* ---- apparatus -------------------------------------------------------------- */
.apparatus__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem);
  display: grid; gap: 2.2rem; grid-template-columns: minmax(16rem, 0.9fr) 1.6fr;
}
.apparatus__intro h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: 0.9rem; }
.apparatus__intro p { color: var(--ink-soft); }
.apparatus__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.apparatus__card {
  border: 1px solid var(--line-soft); border-top: 3px solid var(--line);
  background: var(--bg-raised); padding: 1.1rem 1.15rem 1.2rem;
}
.apparatus__card--praxis { border-top-color: var(--accent); }
.apparatus__card--scholion { border-top-color: var(--bronze); }
.apparatus__card--cf { border-top-color: var(--verdigris); }
.apparatus__card--terms { border-top-color: var(--ink); }
.apparatus__mark { font-family: var(--font-greek); font-size: 1.35rem; color: var(--muted); }
.apparatus__card--praxis .apparatus__mark { color: var(--accent); }
.apparatus__card--scholion .apparatus__mark { color: var(--bronze); }
.apparatus__card--cf .apparatus__mark { color: var(--verdigris); }
.apparatus__card h3 { font-size: 1.18rem; margin: 0.35rem 0 0.45rem; }
.apparatus__card p { margin: 0; font-size: 0.94rem; line-height: 1.6; color: var(--ink-soft); }

@media (max-width: 52rem) { .apparatus__inner { grid-template-columns: 1fr; } }

/* ---- numbers ---------------------------------------------------------------- */
.numbers { background: var(--night); color: var(--night-ink); }
.numbers__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 2.4rem) clamp(1rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 6vw, 4.5rem);
}
.numbers div { display: grid; }
.numbers dt { font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(236, 227, 207, 0.6); order: 2; }
.numbers dd { margin: 0; font-family: var(--font-display); font-size: clamp(1.7rem, 3.5vw, 2.3rem); color: #e0a276; order: 1; }

/* ---- closing ---------------------------------------------------------------- */
.closing__inner {
  max-width: 46rem; margin: 0 auto; text-align: center;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1rem, 4vw, 2.5rem);
}
.closing__quote {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.3rem); line-height: 1.3; margin: 0;
}
.closing__attr { color: var(--muted); font-family: var(--font-ui); font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; margin: 1rem 0 2rem; }

/* ==========================================================================
   GENERIC PAGE (read / concepts / search / about / 404)
   ========================================================================== */

.page { max-width: var(--w-page); margin: 0 auto; padding: clamp(2.2rem, 5vw, 4rem) clamp(1rem, 4vw, 2.5rem) 4rem; }
.page__head { max-width: 46rem; margin-bottom: clamp(2rem, 5vw, 3.2rem); }
.page__title { font-size: clamp(2.1rem, 5vw, 3.3rem); }
.page__lede { font-size: 1.1rem; line-height: 1.65; color: var(--ink-soft); margin: 1rem 0 0; }
.page__body > h2 { font-size: 1.6rem; margin: 2.4rem 0 0.8rem; }
.page__body { max-width: 46rem; }
.page__body p, .page__body li { color: var(--ink); }

/* ---- read / contents ---------------------------------------------------------- */
.toc-part { margin-bottom: 2.6rem; }
.toc-part__link {
  display: flex; align-items: center; gap: 1.1rem;
  text-decoration: none; padding: 0.9rem 0; border-bottom: 2px solid var(--ink);
}
.toc-part__roman { font-family: var(--font-display); font-size: 2rem; color: var(--accent); min-width: 2.6rem; }
.toc-part__title { font-family: var(--font-display); font-size: 1.45rem; display: block; }
.toc-part__sub { color: var(--muted); font-size: 0.92rem; }
.toc-part__go { margin-left: auto; font-size: 1.2rem; color: var(--accent); transition: transform 0.15s ease; }
.toc-part__link:hover .toc-part__go { transform: translateX(4px); }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item a {
  display: grid; grid-template-columns: 2.6rem minmax(11rem, 16rem) 1fr; gap: 1.1rem;
  align-items: baseline;
  padding: 0.55rem 0.4rem; text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s ease;
}
.toc-item a:hover { background: var(--bg-raised); }
.toc-item__no { font-family: var(--font-ui); font-size: 0.78rem; color: var(--muted); }
.toc-item__title { font-family: var(--font-display); font-size: 1.02rem; }
.toc-item__snip { color: var(--muted); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
@media (max-width: 46rem) {
  .toc-item a { grid-template-columns: 2rem 1fr; }
  .toc-item__snip { display: none; }
}

/* ---- concepts ------------------------------------------------------------------ */
.concepts { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.concept {
  display: grid; grid-template-columns: minmax(9rem, 12rem) 1fr; gap: 1.4rem;
  padding: 1.7rem 0; border-top: 1px solid var(--line);
}
.concept__gr { font-family: var(--font-greek); font-size: clamp(1.5rem, 3vw, 1.9rem); color: var(--accent); display: block; line-height: 1.2; }
.concept__tr { color: var(--muted); font-style: italic; font-size: 0.95rem; }
.concept__name { font-size: 1.3rem; margin-bottom: 0.45rem; }
.concept__gloss { margin: 0 0 0.7rem; color: var(--ink-soft); }
.concept__meta { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: baseline; margin: 0; font-family: var(--font-ui); font-size: 0.78rem; }
.concept__count { color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.concept__find { color: var(--accent); text-decoration: none; }
.concept__find:hover { text-decoration: underline; }
@media (max-width: 40rem) { .concept { grid-template-columns: 1fr; gap: 0.5rem; } }

/* ---- search ---------------------------------------------------------------------- */
.search { max-width: 46rem; }
.search__input {
  width: 100%; font-family: var(--font-text); font-size: 1.15rem;
  padding: 0.85rem 1rem; color: var(--ink);
  background: var(--bg-raised); border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
}
.search__input:focus { outline: none; border-bottom-color: var(--accent); }
.search__count { font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); min-height: 1.2em; margin: 0.6rem 0 0; }
.search__hints { margin-top: 1.6rem; }
.search__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.search__results { list-style: none; margin: 1.4rem 0 0; padding: 0; }
.result__link {
  display: block; text-decoration: none;
  padding: 0.9rem 0.4rem; border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s ease;
}
.result__link:hover { background: var(--bg-raised); }
.result__top { display: flex; gap: 0.8rem; align-items: baseline; margin-bottom: 0.25rem; }
.result__ref { font-family: var(--font-display); color: var(--accent); font-size: 1.05rem; }
.result__title { font-family: var(--font-ui); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--ink-soft); }
.result__snip { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; display: block; }
.result__snip mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; padding: 0 0.1em; }
.result__empty { padding: 1rem 0.4rem; color: var(--muted); font-style: italic; }

.notfound { font-size: 1.15rem; font-style: italic; }

/* ==========================================================================
   READER (part pages)
   ========================================================================== */

.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; pointer-events: none; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }

.book { max-width: var(--w-page); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; }

/* ---- part head -------------------------------------------------------------- */
.part-head {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.6rem, 4vw, 2.6rem);
  border-bottom: 1px solid var(--line);
}
.part-head__art { order: 2; }
.part-head__art img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.part-head__title { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.part-head__gr { font-size: 1.1rem; color: var(--accent); margin: 0.7rem 0 0; }
.part-head__tr { font-family: var(--font-text); font-style: italic; font-size: 0.95rem; color: var(--muted); }
.part-head__blurb { max-width: 34rem; color: var(--ink-soft); line-height: 1.65; margin: 1rem 0 0; }
@media (max-width: 52rem) {
  .part-head { grid-template-columns: 1fr; }
  .part-head__art { order: 0; }
}

/* ---- reader bar -------------------------------------------------------------- */
.readerbar {
  position: sticky; top: 3.6rem; z-index: 90;
  margin: 0 0 0.4rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.readerbar__inner {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.55rem 0;
}
.readerbar__label { font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.readerbar__group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-ui); font-size: 0.75rem; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  padding: 0.32rem 0.75rem; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.pill__mark { font-family: var(--font-greek); font-size: 0.85rem; }
.pill[data-toggle-voice="praxis"] .pill__mark { color: var(--accent); }
.pill[data-toggle-voice="scholion"] .pill__mark { color: var(--bronze); }
.pill[data-toggle-voice="cf"] .pill__mark { color: var(--verdigris); }
.pill[aria-pressed="true"] { background: var(--bg-raised); border-color: var(--ink-soft); color: var(--ink); }
.pill[aria-pressed="false"] { opacity: 0.55; }
.pill--focus { margin-left: auto; }
.pill--focus[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill--focus[aria-pressed="true"] .pill__t::after { content: " ✓"; }

/* ---- jump nav ----------------------------------------------------------------- */
.jump { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.7rem 0 0.4rem; }
.jump__label { font-family: var(--font-display); color: var(--accent); font-size: 1.1rem; }
.jump__nums { display: flex; flex-wrap: wrap; gap: 0.14rem; }
.jump__nums a {
  font-family: var(--font-ui); font-size: 0.75rem; text-decoration: none;
  color: var(--muted); padding: 0.22rem 0.42rem; border-radius: 2px;
  transition: color 0.12s ease, background 0.12s ease;
}
.jump__nums a:hover { color: var(--ink); background: var(--bg-raised); }
.jump__nums a.is-current { color: var(--accent-ink); background: var(--accent); }

/* ---- entries -------------------------------------------------------------------- */
.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem 2.2rem;
  padding: clamp(1.8rem, 4vw, 2.6rem) 0;
  border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: 7rem;
}
.entry:target { animation: settle 1.6s ease; }
@keyframes settle {
  from { background: color-mix(in srgb, var(--accent) 9%, transparent); }
  to { background: transparent; }
}

.entry__meta { display: flex; align-items: baseline; gap: 0.9rem; }
.entry__ref { text-decoration: none; display: flex; align-items: baseline; gap: 0.55rem; }
.entry__no {
  font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2rem);
  color: var(--accent); letter-spacing: 0.04em;
}
.entry__ref:hover .entry__no { color: var(--accent-deep); }
.entry__count { font-family: var(--font-ui); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--muted); }
.entry__title { font-size: 1.15rem; color: var(--ink-soft); font-style: normal; }

.entry__text { max-width: var(--w-prose); font-size: 1.13rem; line-height: 1.78; }
.entry__text .prose { margin: 0 0 1.1em; }
.entry__text .prose:last-child { margin-bottom: 0; }
.entry__text .prose:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 3.1em; line-height: 0.78;
  float: left; padding: 0.08em 0.12em 0 0;
  color: var(--accent);
}

.maxim {
  margin: 1.2em 0; padding: 0.4em 0 0.4em 1.2em;
  border-left: 2px solid var(--accent);
  font-style: italic;
}
.maxim p { margin: 0; }

/* ---- inline concept terms --------------------------------------------------------- */
.term {
  position: relative;
  cursor: help;
  text-decoration: underline dotted color-mix(in srgb, var(--accent) 55%, transparent) 1.5px;
  text-underline-offset: 3px;
}
.term:hover, .term:focus-visible { text-decoration-color: var(--accent); }
.term__pop {
  position: absolute; left: 0; top: calc(100% + 0.5rem); z-index: 60;
  width: min(21rem, 78vw);
  display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.7rem;
  background: var(--bg-raised); color: var(--ink);
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  box-shadow: var(--shadow-pop);
  padding: 0.8rem 0.95rem 0.9rem;
  font-size: 0.86rem; line-height: 1.5; font-style: normal;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
.term:hover .term__pop, .term:focus .term__pop, .term:focus-within .term__pop {
  opacity: 1; visibility: visible; transform: none;
}
.term__gr { font-family: var(--font-greek); font-size: 1.5rem; color: var(--accent); grid-row: span 2; align-self: center; }
.term__head { display: flex; gap: 0.5rem; align-items: baseline; }
.term__tr { font-style: italic; color: var(--muted); }
.term__nm { font-family: var(--font-ui); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.term__df { grid-column: 2; color: var(--ink-soft); }

/* ---- margin glosses ---------------------------------------------------------------- */
.entry__notes { display: grid; gap: 0.7rem; align-content: start; }
.gloss {
  --voice: var(--accent);
  border-left: 2px solid var(--voice);
  padding: 0.1rem 0 0.15rem 0.85rem;
  font-size: 0.88rem; line-height: 1.58;
}
.gloss--scholion { --voice: var(--bronze); }
.gloss--cf { --voice: var(--verdigris); }
.gloss__head { display: flex; gap: 0.45rem; align-items: baseline; margin-bottom: 0.2rem; }
.gloss__mark { font-family: var(--font-greek); font-size: 0.9rem; color: var(--voice); }
.gloss--cf .gloss__mark { font-family: var(--font-ui); font-size: 0.72rem; font-style: italic; }
.gloss__who { font-family: var(--font-ui); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--voice); }
.gloss__body p { margin: 0; color: var(--ink-soft); }
.gloss__body a { color: var(--voice); }

/* voice + focus visibility — CSS-driven so it degrades without JS */
body.hide-praxis .gloss--praxis,
body.hide-scholion .gloss--scholion,
body.hide-cf .gloss--cf { display: none; }
body.focus-reading .entry__notes,
body.focus-reading .entry__title { display: none; }
body.focus-reading .entry { grid-template-columns: minmax(0, 1fr); }
body.focus-reading .entry__text { margin: 0 auto; }

/* wide screens: gutter | text | margin rail */
@media (min-width: 64rem) {
  .entry { grid-template-columns: 8.5rem minmax(0, var(--w-prose)) minmax(13rem, 16rem); }
  .entry__meta { flex-direction: column; gap: 0.3rem; position: sticky; top: 7.2rem; align-self: start; }
  .entry__title { font-size: 1rem; line-height: 1.35; }
  .entry__notes { grid-column: 3; grid-row: 1; position: sticky; top: 7.2rem; align-self: start; }
  .entry__text { grid-column: 2; grid-row: 1; }
  .entry__meta { grid-column: 1; grid-row: 1; }
  body.focus-reading .entry { grid-template-columns: 8.5rem minmax(0, var(--w-prose)) minmax(13rem, 16rem); }
  body.focus-reading .entry__meta { display: flex; }
}

/* ---- book nav ------------------------------------------------------------------------ */
.booknav {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center;
  padding: 1.6rem 0 0.4rem;
}
.booknav__side { display: grid; gap: 0.2rem; text-decoration: none; }
.booknav__next { text-align: right; }
.booknav__dir { font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); }
.booknav__name { font-family: var(--font-display); font-size: 1.1rem; color: var(--ink); }
.booknav__side:hover .booknav__name { color: var(--accent); }
.booknav__top {
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: 0.8rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.booknav__top:hover { border-color: var(--ink); color: var(--ink); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.colophon { background: var(--night); color: var(--night-ink); margin-top: 4rem; }
.layout-home .colophon, .layout-part .colophon { margin-top: 0; }
.colophon__inner {
  max-width: var(--w-page); margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem) 2rem;
}
.colophon__brand { margin-bottom: 2rem; }
.colophon__seal {
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-greek); font-size: 1.3rem; border-radius: 3px;
}
html.lamp .colophon__seal { color: var(--accent-ink); }
.colophon__title { font-family: var(--font-display); font-size: 1.3rem; margin: 0.8rem 0 0.1rem; }
.colophon__sub { color: rgba(236, 227, 207, 0.65); margin: 0; font-size: 0.9rem; font-style: italic; }
.colophon__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 2rem; }
.colophon__label { font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: #d8a06a; margin: 0 0 0.6rem; }
.colophon__cols a { display: block; color: rgba(236, 227, 207, 0.85); text-decoration: none; padding: 0.18rem 0; font-size: 0.92rem; }
.colophon__cols a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.colophon__note { color: rgba(236, 227, 207, 0.65); font-size: 0.88rem; line-height: 1.6; margin: 0; }
.colophon__foot {
  margin-top: 2.6rem; padding-top: 1.2rem;
  border-top: 1px solid rgba(236, 227, 207, 0.15);
  font-family: var(--font-ui); font-size: 0.78rem; color: rgba(236, 227, 207, 0.55);
}
.colophon__foot a { color: inherit; }

/* ---- print -------------------------------------------------------------------- */
@media print {
  .masthead, .readerbar, .jump, .booknav, .colophon, .reading-progress { display: none; }
  body { background: #fff; color: #000; }
  .entry { grid-template-columns: 1fr; }
}
