/* ============================================================
   EPISTRION — epistrion.com
   the place where one stands in order to know

   Palette
   marble   #EBEAE5  cool Pentelic stone, the ground
   stone    #DFDED6  deeper stone, footer surface
   ink      #20242B  Aegean blue-black, the letter
   miltos   #9C3221  red ochre brushed into cut letters
   graphite #6E7069  worn stone, captions and glosses

   Type
   display  GFS Didot        — the Greek Didot, lapidary
   body     Alegreya         — humanist serif with true Greek
   utility  GFS Neohellenic  — Athenian geometric sans, labels

   Signature: the visible baseline. Letters stand on drawn
   lines; descenders hang below them, as on a carved stone.
   ============================================================ */

:root {
  --marble: #EBEAE5;
  --stone: #E0DFD8;
  --ink: #20242B;
  --miltos: #9C3221;
  --graphite: #6E7069;
  --line: rgba(32, 36, 43, 0.6);
  --hair: rgba(32, 36, 43, 0.16);

  --font-display: 'GFS Didot', 'Didot', 'Bodoni 72', Georgia, serif;
  --font-body: 'Alegreya', Georgia, 'Times New Roman', serif;
  --font-utility: 'GFS Neohellenic', 'Avenir Next', 'Helvetica Neue', sans-serif;

  --measure: 38rem;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(180deg, #EDECE7 0%, var(--marble) 40%, #E8E7E1 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.75;
  min-height: 100vh;
}

::selection { background: var(--miltos); color: var(--marble); }

a { color: inherit; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--miltos);
  outline-offset: 3px;
}

/* ---------- the baseline device ------------------------------
   A drawn line placed at the type's baseline, behind the ink,
   so descenders cross it. The whole site's thesis in one rule. */
.baseline {
  background-image: linear-gradient(var(--line), var(--line));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 0.23em);
  padding-bottom: 0.02em;
}

/* ---------- header bar --------------------------------------- */
.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4rem var(--pad);
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  z-index: 10;
}

.bar .mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  text-decoration: none;
}

.bar .mark svg { display: block; }

.bar .lang {
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 2px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.bar .lang:hover { color: var(--miltos); border-color: var(--miltos); }

/* language dropdown */
.langs { position: relative; }
.langs summary {
  list-style: none;
  cursor: pointer;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 2px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: " ▾"; font-size: 0.85em; color: var(--graphite); }
.langs summary:hover { color: var(--miltos); border-color: var(--miltos); }
.langs-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.7rem);
  background: var(--marble);
  border: 1px solid var(--hair);
  box-shadow: 0 12px 32px rgba(32, 36, 43, 0.1);
  padding: 1rem 1.3rem;
  display: grid;
  gap: 0.6rem;
  min-width: 10rem;
  text-align: right;
  z-index: 30;
  text-transform: none;
  letter-spacing: 0.08em;
}
.langs-menu a {
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.langs-menu a:hover { color: var(--miltos); }
.langs-menu a[aria-current="true"] { color: var(--miltos); }

/* ---------- hero ---------------------------------------------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 5rem;
}

.hero-eyebrow {
  font-family: var(--font-utility);
  font-size: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  letter-spacing: 0.34em;
  text-align: center;
  color: var(--graphite);
  margin-bottom: clamp(2rem, 6vh, 4.5rem);
}

.hero-svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-svg .horizon {
  stroke: var(--line);
  stroke-width: 1.25;
}

.hero-svg .hero-word {
  font-family: var(--font-display);
  font-size: 132px;
  letter-spacing: 0.045em;
  fill: var(--ink);
}

.hero-gloss {
  text-align: center;
  margin-top: clamp(1.75rem, 4vh, 3rem);
  padding: 0 var(--pad);
}

.hero-headword {
  font-family: var(--font-utility);
  font-size: 0.9375rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--graphite);
}
.hero-headword b { font-weight: 700; color: var(--ink); }

.hero-defn {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.35;
  max-width: 26em;
  margin: 1.1rem auto 0;
}

.hero-etym {
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  color: var(--graphite);
  margin-top: 1.4rem;
}

/* hero choreography: horizon draws, the word rises to stand on it */
.js .hero-svg .horizon {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.js .hero-svg .hero-word { transform: translateY(300px); }
.js .hero-eyebrow,
.js .hero-gloss { opacity: 0; }

.js.fonts-in .hero-svg .horizon {
  animation: draw-horizon 1.3s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}
.js.fonts-in .hero-svg .hero-word {
  animation: rise 1.15s cubic-bezier(0.22, 0.9, 0.3, 1) 0.9s forwards;
}
.js.fonts-in .hero-eyebrow { animation: appear 0.9s ease 1.7s forwards; }
.js.fonts-in .hero-gloss { animation: appear 1.1s ease 1.95s forwards; }

@keyframes draw-horizon { to { stroke-dashoffset: 0; } }
@keyframes rise { to { transform: translateY(0); } }
@keyframes appear { to { opacity: 1; } }

/* ---------- passages ------------------------------------------ */
main {
  padding: 0 var(--pad);
}

.passage {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(4.5rem, 11vh, 8rem) 0 0;
}

.passage-eyebrow {
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.3em;
  color: var(--miltos);
  margin-bottom: 1.5rem;
}

.passage h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.4rem + 1.8vw, 2.625rem);
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 2.2rem;
  display: inline-block;
}

.passage p {
  margin-bottom: 1.4em;
}
.passage p:last-child { margin-bottom: 0; }

.passage .gr {
  font-family: var(--font-display);
  font-style: normal;
}

.passage strong { font-weight: 700; }

.rubric { color: var(--miltos); }

.note {
  font-size: 0.9em;
  color: var(--graphite);
  border-left: 1px solid var(--hair);
  padding-left: 1.4em;
  margin-top: 2.4em;
}

/* ---------- morpheme dissection ------------------------------- */
.morphemes {
  list-style: none;
  max-width: var(--measure);
  margin: clamp(4.5rem, 10vh, 7rem) auto 0;
  display: grid;
  gap: 2.6rem;
}

.morphemes li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}

.morphemes .gr {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2.6vw, 3.25rem);
  line-height: 1.1;
  flex: 1;
}

.morphemes .sense {
  font-style: italic;
  color: var(--graphite);
  text-align: right;
  white-space: nowrap;
}

/* ---------- the series of places ------------------------------ */
.series {
  list-style: none;
  max-width: var(--measure);
  margin: 3.2rem auto 0;
}

.series li {
  display: grid;
  grid-template-columns: minmax(9.5em, 1.15fr) 1.6fr auto;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--hair);
}
.series li:first-child { border-top: 1px solid var(--hair); }

.series .gr {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.625rem);
  transition: color 0.35s ease;
}

.series .sense {
  font-style: italic;
  color: var(--graphite);
}

.series .modern {
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--graphite);
  text-align: right;
}

.series li:hover .gr { color: var(--miltos); }

.series .coined .gr,
.series .coined .modern { color: var(--miltos); }
.series .coined .sense { color: var(--ink); }

/* ---------- the maxim ----------------------------------------- */
.maxim {
  text-align: center;
  margin: 3.4rem auto 0;
  max-width: var(--measure);
}

.maxim .gr {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.3rem + 2.4vw, 3rem);
  line-height: 1.5;
  display: inline-block;
}

.maxim .tr {
  display: block;
  font-style: italic;
  color: var(--graphite);
  margin-top: 1.1rem;
}

.maxim + .maxim { margin-top: 2.8rem; }

/* ---------- closing line -------------------------------------- */
.closing {
  text-align: center;
  padding: clamp(5rem, 14vh, 9rem) var(--pad) 0;
}

.closing .line {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.25rem);
  display: inline-block;
}

/* dot standing on a line — the site's mark, used once */
.stand {
  width: min(14rem, 60vw);
  margin: 0 auto clamp(3rem, 8vh, 5rem);
  display: block;
}
.stand .rule { stroke: var(--line); stroke-width: 1.5; }
.stand .pebble { fill: var(--miltos); }

/* ---------- footer --------------------------------------------- */
footer {
  margin-top: clamp(6rem, 16vh, 11rem);
  background: var(--stone);
  border-top: 1px solid var(--hair);
  padding: 3.2rem var(--pad) 3.6rem;
  text-align: center;
}

footer .fmark {
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

footer .colophon {
  font-size: 0.875rem;
  color: var(--graphite);
  max-width: 34em;
  margin: 1.3rem auto 0;
  line-height: 1.7;
}

footer .colophon .gr { font-family: var(--font-display); }

footer .flangs {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem 1.6rem;
  max-width: 44em;
  margin-left: auto;
  margin-right: auto;
}
footer .flang {
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: var(--graphite);
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 2px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
footer .flang:hover { color: var(--miltos); border-color: var(--miltos); }

/* ---------- per-language type: CJK stacks ----------------------- */
html[lang="zh-Hans"] {
  --font-display: 'GFS Didot', 'Songti SC', 'Noto Serif SC', 'SimSun', serif;
  --font-body: 'Alegreya', 'Songti SC', 'Noto Serif SC', 'SimSun', serif;
  --font-utility: 'GFS Neohellenic', 'PingFang SC', 'Noto Sans SC', sans-serif;
}
html[lang="zh-Hant"] {
  --font-display: 'GFS Didot', 'Songti TC', 'Noto Serif TC', 'PMingLiU', serif;
  --font-body: 'Alegreya', 'Songti TC', 'Noto Serif TC', 'PMingLiU', serif;
  --font-utility: 'GFS Neohellenic', 'PingFang TC', 'Noto Sans TC', sans-serif;
}
html[lang="ja"] {
  --font-display: 'GFS Didot', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
  --font-body: 'Alegreya', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
  --font-utility: 'GFS Neohellenic', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
}
html[lang="ko"] {
  --font-display: 'GFS Didot', 'Apple Myungjo', 'Nanum Myeongjo', 'Noto Serif KR', serif;
  --font-body: 'Alegreya', 'Apple SD Gothic Neo', 'Nanum Myeongjo', 'Noto Serif KR', serif;
  --font-utility: 'GFS Neohellenic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}
html[lang="zh-Hans"] body, html[lang="zh-Hant"] body,
html[lang="ja"] body, html[lang="ko"] body {
  line-height: 1.95;
  letter-spacing: 0.015em;
}
/* CJK has no true italics — synthesized oblique is noise, not voice */
html[lang="zh-Hans"] em, html[lang="zh-Hant"] em, html[lang="ja"] em, html[lang="ko"] em,
html[lang="zh-Hans"] .sense, html[lang="zh-Hant"] .sense, html[lang="ja"] .sense, html[lang="ko"] .sense,
html[lang="zh-Hans"] .maxim .tr, html[lang="zh-Hant"] .maxim .tr, html[lang="ja"] .maxim .tr, html[lang="ko"] .maxim .tr {
  font-style: normal;
}
html[lang="zh-Hans"] .hero-defn, html[lang="zh-Hant"] .hero-defn,
html[lang="ja"] .hero-defn, html[lang="ko"] .hero-defn {
  line-height: 1.6;
}

/* ---------- scroll reveal --------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.js .reveal.seen {
  opacity: 1;
  transform: none;
}

/* ---------- reduced motion -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero-svg .horizon { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .js .hero-svg .hero-word { transform: none; animation: none; }
  .js .hero-eyebrow, .js .hero-gloss { opacity: 1; animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- small screens ---------------------------------------- */
@media (max-width: 640px) {
  .series li {
    grid-template-columns: 1fr auto;
  }
  .series .sense {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.9em;
  }
  .morphemes li {
    flex-direction: column;
    gap: 0.3rem;
    align-items: flex-start;
  }
  .morphemes .sense { text-align: left; white-space: normal; }
}
