/* ==============================================================
   YEOMAN
   a folio, ruled and rubricated. the scribe corrects the record.
   ============================================================== */

:root {
  --ink:        #0a0a09;
  --ink-warm:   #0e0d0b;
  --parch:      #e8e0cc;
  --parch-2:    rgba(232, 224, 204, 0.62);
  --parch-3:    rgba(232, 224, 204, 0.34);
  --parch-4:    rgba(232, 224, 204, 0.16);
  --rubric:     #c04a26;
  --rubric-dim: rgba(192, 74, 38, 0.5);
  --forest:     #46503f;
  --rule:       rgba(232, 224, 204, 0.11);

  --display: "Bodoni Moda", Didot, Georgia, serif;
  --text:    "EB Garamond", Georgia, serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --rail: 58px;
  --gut: clamp(1.4rem, 5vw, 5.5rem);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--parch);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: var(--rubric); color: var(--parch); }
:focus-visible { outline: 1px dotted var(--rubric); outline-offset: 6px; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: rgba(232, 224, 204, 0.14); }

/* ---------------- atmosphere ---------------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 400;
  opacity: 0.04; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 390;
  background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 40%, rgba(0,0,0,0.55) 100%);
}

/* ---------------- ruled margin rail ---------------- */
.rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail);
  z-index: 300;
  display: flex; flex-direction: column; align-items: center;
  justify-content: space-between;
  padding: 1.6rem 0;
  border-right: 1px solid var(--rule);
}
.rail-mark, .rail-folio {
  font-family: var(--mono);
  font-size: 8.5px; font-weight: 400;
  letter-spacing: 0.34em;
  writing-mode: vertical-rl;
  color: var(--parch-3);
}
.rail-folio { color: var(--rubric); transform: rotate(180deg); }
.rail-rule { flex: 1; width: 1px; margin: 1.4rem 0; background: var(--rule); position: relative; }
.rail-ink {
  position: absolute; inset: 0 auto 0 0; width: 1px;
  height: var(--p, 0%);
  background: var(--rubric);
}

/* ---------------- top bar ---------------- */
.topbar {
  position: fixed; top: 0; left: var(--rail); right: 0; z-index: 310;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.15rem var(--gut);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--parch-2);
}
.brand { display: inline-flex; gap: .55em; align-items: baseline; }
.brand-rubric { color: var(--rubric); }
.topbar-nav { display: flex; gap: 1.9rem; }

/* ---------------- ink links (no boxes anywhere) ---------------- */
.ink {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 0.42em;
  padding-bottom: 0.16em;
  color: inherit;
  transition: color .35s var(--ease);
}
.ink::before, .ink::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
}
.ink::before { background: currentColor; opacity: .26; }
.ink::after {
  background: var(--rubric);
  transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.ink:hover::after { transform: scaleX(1); }
.ink-arrow { font-size: .82em; transition: transform .4s var(--ease); }
.ink:hover .ink-arrow { transform: translate(2px, -2px); }
.ink:hover { color: var(--parch); }
.ink-lg {
  font-family: var(--text); font-size: 1.05rem; font-style: italic;
  letter-spacing: 0.01em;
}
.ink-quiet { color: var(--parch-3); font-style: italic; }
.ink-quiet:hover .ink-arrow { transform: translateY(3px); }

/* ---------------- shared type ---------------- */
.rubric {
  font-family: var(--mono); font-size: 9.5px; font-weight: 400;
  letter-spacing: 0.36em; text-transform: uppercase;
  color: var(--parch-3);
}
.rubric-mark { color: var(--rubric); }
.section-rubric { margin-bottom: clamp(3rem, 8vh, 6rem); }

.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.dim { color: var(--parch-3); }
.mono-swap {
  font-family: var(--mono); font-weight: 300;
  font-size: 0.72em; letter-spacing: -0.01em;
  color: var(--parch);
}

.leader {
  flex: 1 1 auto; min-width: 1.5rem;
  border-bottom: 1px dotted var(--parch-4);
  transform: translateY(-0.3em);
}

.body {
  font-size: 1.02rem; line-height: 1.78;
  color: var(--parch-2); max-width: 44ch;
}
.body b { color: var(--parch); font-weight: 500; font-style: italic; }

/* reveal */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }
[data-reveal].on { opacity: 1; transform: none; }

.folio { position: relative; padding-left: var(--rail); }

/* ══════════════ FOLIO I · HERO ══════════════ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem var(--gut) 5rem calc(var(--rail) + var(--gut));
  overflow: hidden;
}
.hero-plate {
  position: absolute; top: -8%; right: -10%;
  width: min(46vw, 660px); height: 116%;
  background: url("assets/manuscript-gest.jpg") center / cover no-repeat;
  opacity: .1; filter: grayscale(.45) contrast(1.02);
  -webkit-mask-image: linear-gradient(100deg, transparent, black 52%, black 76%, transparent);
  mask-image: linear-gradient(100deg, transparent, black 52%, black 76%, transparent);
  will-change: transform;
}
.hero-body { position: relative; z-index: 2; max-width: 62rem; }
.display-hero {
  font-size: clamp(4.2rem, 15.5vw, 15rem);
  margin: clamp(1.6rem, 4vh, 3rem) 0 clamp(2rem, 5vh, 3.4rem) -0.06em;
}

/* THE TWIST: the scribe strikes the wrong titles */
.correction { list-style: none; }
.correction li {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 3.1rem);
  line-height: 1.42;
  color: var(--parch-3);
}
.strike { position: relative; display: inline-block; }
.strike::after {
  content: ""; position: absolute;
  left: -3%; right: -3%; top: 54%; height: 2px;
  background: var(--rubric);
  transform: rotate(var(--rot)) scaleX(0);
  transform-origin: left center;
}
.correction.on .strike::after { animation: struck .55s var(--ease) forwards; }
.correction.on li:nth-child(1) .strike::after { animation-delay: .15s }
.correction.on li:nth-child(2) .strike::after { animation-delay: .55s }
.correction.on li:nth-child(3) .strike::after { animation-delay: .95s }
@keyframes struck {
  from { transform: rotate(var(--rot)) scaleX(0) }
  to   { transform: rotate(var(--rot)) scaleX(1) }
}
.correction-true {
  color: var(--parch) !important;
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-top: .3em;
  opacity: 0;
}
.correction.on .correction-true { animation: rise 1.1s var(--ease) 1.55s forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
.gloss {
  font-family: var(--mono); font-style: normal;
  font-size: 10px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--rubric);
}

.lede {
  margin-top: clamp(2.2rem, 6vh, 3.6rem);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.85; color: var(--parch-2);
  max-width: 52ch;
}
.hero-actions {
  margin-top: clamp(2.2rem, 6vh, 3.4rem);
  display: flex; gap: clamp(1.5rem, 4vw, 3rem); align-items: baseline; flex-wrap: wrap;
}
.hero-cite {
  position: absolute; bottom: 1.5rem; left: calc(var(--rail) + var(--gut));
  font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .32em; color: var(--parch-4);
}
[data-h] { opacity: 0; transform: translateY(20px); animation: rise 1.2s var(--ease) forwards; }
[data-h="1"] { animation-delay: .15s }
[data-h="2"] { animation-delay: .35s }
[data-h="3"] { animation-delay: .75s; }
[data-h="4"] { animation-delay: 2.7s }
[data-h="5"] { animation-delay: 3s }

/* ══════════════ FOLIO II · PROOF ══════════════ */
.proof { padding: clamp(7rem, 16vh, 12rem) var(--gut) clamp(7rem, 16vh, 12rem) calc(var(--rail) + var(--gut)); }
.proof-grid {
  display: grid; grid-template-columns: minmax(0, 4.4fr) minmax(0, 6fr);
  gap: clamp(2.5rem, 7vw, 7rem); align-items: start;
}
.plate { position: relative; }
.plate img {
  width: 100%;
  filter: sepia(.16) contrast(1.04) brightness(.94);
  box-shadow: 0 40px 90px -40px rgba(0,0,0,.9);
}
.plate figcaption {
  display: flex; align-items: baseline; gap: .8rem;
  margin-top: 1rem;
  font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .3em; text-transform: uppercase; color: var(--parch-3);
}
.scripture { margin-bottom: clamp(2.6rem, 7vh, 4.4rem); }
.scripture p {
  font-family: var(--text);
  font-size: clamp(1.2rem, 2.2vw, 1.72rem);
  line-height: 1.62; color: var(--parch);
}
.scripture em { font-style: italic; color: var(--rubric); }
.initial {
  float: left;
  font-family: var(--display); font-weight: 400;
  font-size: 3.4em; line-height: .78;
  color: var(--rubric);
  margin: .06em .12em 0 0;
}
.scripture cite {
  display: block; margin-top: 1.3rem;
  font-family: var(--mono); font-style: normal;
  font-size: 8.5px; letter-spacing: .3em; color: var(--parch-4);
}
.display-2 {
  font-size: clamp(2.6rem, 6.4vw, 5.6rem);
  margin-bottom: 1.9rem;
}

.cites { list-style: none; margin-top: clamp(2.4rem, 6vh, 3.4rem); }
.cites li {
  display: flex; align-items: baseline; gap: .9rem;
  padding: .95rem 0;
  border-top: 1px solid var(--rule);
  font-size: .95rem;
}
.cites li:last-child { border-bottom: 1px solid var(--rule); }
.cite-n {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .12em; color: var(--rubric);
  min-width: 1.6rem;
}
.cite-src {
  font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .28em; text-transform: uppercase; color: var(--parch-4);
  white-space: nowrap;
}
.cites-wide { max-width: 46rem; }

/* ══════════════ VERDICT ══════════════ */
.verdict {
  min-height: 96svh; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(6rem, 14vh, 10rem) var(--gut) clamp(6rem, 14vh, 10rem) calc(var(--rail) + var(--gut));
}
.verdict-line {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.7rem, 9.6vw, 10.5rem);
  line-height: 0.95; letter-spacing: -0.025em;
}
.verdict-line span { display: block; }
.verdict-line span:nth-child(1) { color: var(--parch-3); }
.verdict-line span:nth-child(2) { margin-left: .06em; }
.verdict-line span:nth-child(3) { color: var(--parch-2); }
.verdict-line em { font-style: italic; color: var(--rubric); }
.verdict-line span:nth-child(2) { transition-delay: .12s }
.verdict-line span:nth-child(3) { transition-delay: .24s }
.verdict-line span:nth-child(4) { transition-delay: .36s }
.verdict-sub {
  margin-top: clamp(2rem, 5vh, 3.2rem);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .34em; text-transform: uppercase; color: var(--parch-3);
  transition-delay: .5s;
}
.verdict-sub .rubric-mark { margin-right: .8em; }
.verdict-cite { margin-top: clamp(1.6rem, 4vh, 2.4rem); max-width: 34rem; transition-delay: .62s; }
.verdict-cite li { border-top: none; padding-top: 0; }

/* ══════════════ FOLIO IV · DESCENT ══════════════ */
.descent { padding: clamp(6rem, 14vh, 11rem) var(--gut) clamp(7rem, 16vh, 12rem) calc(var(--rail) + var(--gut)); }
.ledger { list-style: none; max-width: 60rem; }
.entry {
  display: grid; grid-template-columns: clamp(4.5rem, 9vw, 8rem) 1fr;
  gap: clamp(1.2rem, 4vw, 3rem);
  padding: clamp(1.6rem, 4vh, 2.6rem) 0;
  border-top: 1px solid var(--rule);
}
.entry:last-child { border-bottom: 1px solid var(--rule); }
.entry-year {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--rubric); padding-top: .55em;
}
.entry-main { display: flex; gap: clamp(1.2rem, 3vw, 2.2rem); align-items: center; }
.entry-cut {
  width: clamp(76px, 9vw, 116px); flex: none;
  transform: rotate(-2.2deg);
  filter: sepia(.2) contrast(1.05) brightness(.92);
}
.entry-name {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.7rem, 4.4vw, 3.4rem);
  line-height: 1.02; letter-spacing: -0.02em;
}
.entry-note {
  margin-top: .55rem;
  font-size: .95rem; color: var(--parch-3); max-width: 40ch;
}
/* the voice migrates from scribe to machine */
.entry-mid .entry-name { font-family: var(--display); }
.entry-new .entry-name,
.entry-now .entry-name {
  font-family: var(--mono); font-weight: 300;
  font-size: clamp(1.3rem, 3.2vw, 2.5rem);
  letter-spacing: -0.01em;
}
.entry-new .entry-note, .entry-now .entry-note { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; }
.entry-now .entry-name { color: var(--parch); }
.entry-now .entry-year { color: var(--parch); }

.descent-line {
  margin-top: clamp(4.5rem, 12vh, 8.5rem);
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.6rem, 8.4vw, 8.6rem);
  line-height: 1.0; letter-spacing: -0.025em;
}

/* ══════════════ FOLIO V · COLOPHON ══════════════ */
.colophon {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(6rem, 14vh, 10rem) var(--gut) clamp(5rem, 12vh, 8rem) calc(var(--rail) + var(--gut));
}
.display-end {
  font-size: clamp(4rem, 15vw, 14.5rem);
  margin-left: -0.06em;
}
.colophon-span {
  margin-top: 1.6rem;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .34em; text-transform: uppercase; color: var(--parch-3);
}
.colophon-span .rubric-mark { margin: 0 .6em; }
.colophon-gloss {
  margin-top: .7rem;
  font-family: var(--text); font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.5rem); color: var(--parch-2);
}
.entryca { margin-top: clamp(3rem, 8vh, 5rem); max-width: 42rem; }
.cfg {
  display: flex; align-items: baseline; gap: .9rem;
  padding: 1rem 0; border-top: 1px solid var(--rule);
}
.entryca .cfg:last-child { border-bottom: 1px solid var(--rule); }
.cfg-ca dt {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--parch-4); min-width: 6rem;
}
.cfg-ca dd {
  font-family: var(--mono); font-size: .9rem;
  letter-spacing: .12em; color: var(--parch);
}
.cfg-ca dd code { font-family: var(--mono); }
.colophon-actions {
  margin-top: 2.2rem;
  display: flex; gap: clamp(1.5rem, 4vw, 3rem); align-items: baseline; flex-wrap: wrap;
}

/* ══════════════ FOOTER ══════════════ */
.footer {
  padding: 2.4rem var(--gut) 2.8rem calc(var(--rail) + var(--gut));
  border-top: 1px solid var(--rule);
}
.footer-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1.6rem; flex-wrap: wrap;
}
.footer-mark, .footer-nav {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .28em; text-transform: uppercase; color: var(--parch-3);
}
.footer-mark .rubric-mark { margin-right: .7em; }
.footer-nav { display: flex; gap: 1.9rem; }
.footer-fine {
  margin-top: 2rem; max-width: 54ch;
  font-size: .88rem; line-height: 1.8; color: var(--parch-4);
}

/* ══════════════ EVIDENCE ══════════════ */
.evidence-tab {
  position: fixed; right: 0; bottom: clamp(1.5rem, 6vh, 4rem); z-index: 320;
  display: flex; align-items: center; gap: .6em;
  padding: .8rem 1.1rem .8rem 1.3rem;
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--parch-2);
  background: var(--ink);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  transition: color .4s var(--ease), padding-right .4s var(--ease);
}
.evidence-tab:hover { color: var(--parch); padding-right: 1.6rem; }
.evidence-mark { color: var(--rubric); }
.evidence-count { color: var(--rubric); }

.drawer-veil {
  position: fixed; inset: 0; z-index: 330;
  background: rgba(4,4,4,.8); opacity: 0;
  transition: opacity .6s var(--ease);
  backdrop-filter: blur(2px);
}
.drawer-veil.open { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 340;
  width: min(470px, 100vw);
  padding: 2rem 2rem 2.6rem;
  overflow-y: auto;
  background: var(--ink-warm);
  border-left: 1px solid var(--rule);
  box-shadow: -60px 0 120px -50px rgba(0,0,0,.95);
  transform: translateX(101%);
  transition: transform .75s var(--ease);
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1.4rem;
  padding-bottom: 1.6rem; border-bottom: 1px solid var(--parch-4);
}
.drawer-title { font-family: var(--display); font-size: 1.5rem; letter-spacing: -0.02em; }
.drawer-meta {
  margin-top: .45rem;
  font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .26em; text-transform: uppercase; color: var(--parch-4);
}
.drawer-shut {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .26em; text-transform: uppercase; color: var(--parch-3);
  transition: color .3s;
}
.drawer-shut:hover { color: var(--rubric); }

.sources { list-style: none; }
.sources li {
  display: grid; grid-template-columns: 2.2rem 1fr;
  gap: .9rem; padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.src-n {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .1em; color: var(--rubric); padding-top: .5em;
}
.src-title { font-family: var(--display); font-size: 1.08rem; line-height: 1.3; }
.src-meta {
  margin-top: .35rem;
  font-family: var(--mono); font-size: 8px;
  letter-spacing: .24em; text-transform: uppercase; color: var(--parch-4);
}
.src-note { margin-top: .7rem; font-size: .93rem; line-height: 1.7; color: var(--parch-2); }
.src-note em { color: var(--rubric); }
.sources .ink {
  margin-top: .9rem; margin-right: 1.3rem;
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .24em; text-transform: uppercase;
}
.drawer-foot {
  padding-top: 1.5rem;
  font-family: var(--mono); font-size: 8px;
  letter-spacing: .26em; text-transform: uppercase; color: var(--parch-4);
}
.drawer-foot .rubric-mark { margin-right: .7em; }

/* ══════════════ EGG ══════════════ */
.egg {
  position: fixed; inset: 0; z-index: 450;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 2rem; text-align: center;
  background: rgba(6,6,5,.96);
  opacity: 0; pointer-events: none; transition: opacity .7s var(--ease);
}
.egg.show { opacity: 1; }
.egg-line {
  font-family: var(--display); font-style: italic;
  font-size: clamp(1.9rem, 6vw, 4.4rem); letter-spacing: -0.02em;
}
.egg-sub {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .38em; text-transform: uppercase; color: var(--rubric);
}

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 1000px) {
  .proof-grid { grid-template-columns: 1fr; }
  .plate { max-width: 460px; }
}
@media (max-width: 820px) {
  :root { --rail: 0px; }
  .rail { display: none; }
  .topbar { left: 0; }
  .folio { padding-left: 0; }
  .hero, .proof, .verdict, .descent, .colophon, .footer { padding-left: var(--gut); }
  .hero-cite { left: var(--gut); }
  .entry { grid-template-columns: 1fr; gap: .8rem; }
  .entry-year { padding-top: 0; }
  .cites li { flex-wrap: wrap; }
  .leader { min-width: .8rem; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero-plate {
    width: 130%; right: -30%; opacity: .055;
    -webkit-mask-image: radial-gradient(ellipse at 70% 40%, black, transparent 72%);
    mask-image: radial-gradient(ellipse at 70% 40%, black, transparent 72%);
  }
  .correction li { font-size: 1.55rem; }
  .cfg dt { min-width: 5.5rem; }
  .cite-src { display: none; }
  .evidence-tab { bottom: 1rem; }
  .footer-nav { gap: 1.2rem; }
}

/* ══════════════ REDUCED MOTION ══════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-h], .correction.on .strike::after, .correction.on .correction-true {
    animation-duration: .01s; animation-delay: 0s;
  }
  [data-reveal] { transition-duration: .01s }
  .drawer, .drawer-veil, .egg { transition-duration: .01s }
}
