/* ————————————————————————————————————————————————
   GoldBerry — goldberry-here.co.uk
   "The Critical Edition" apparatus · v2 · 2026-09-14
   Roman = the document. Italic + gold = GoldBerry.
   ———————————————————————————————————————————————— */

:root {
  --paper: #FBFAF6;        /* archival near-white ground            */
  --ink: #26231C;          /* warm reading ink                      */
  --apparatus: #6E6656;    /* captions, folio numerals, metadata    */
  --gilt: #9A7418;         /* the auditor's pen — marks, underlines */
  --gilt-ink: #8A6714;     /* gilt at text size (AA on paper)       */
  --gilt-wash: #F3EAD2;    /* flag highlight wash                   */
  --madder: #8A3B2C;       /* findings: CMR stamps, diagnoses       */
  --hairline: #E3DFD3;     /* rules                                 */
  --codebg: #F1EEE6;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Literata', Georgia, 'Times New Roman', serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.62;
  font-optical-sizing: auto;
}

/* ── Page scaffold ─────────────────────────────── */

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  position: relative;
  padding: 4.25rem 0 3.25rem 88px;
  border-bottom: 1px solid var(--hairline);
}

section:last-of-type { border-bottom: 0; }

.sec-num {
  position: absolute;
  left: 6px;
  top: 4.55rem;
  font-size: 0.92rem;
  color: var(--gilt-ink);
  font-variant-numeric: oldstyle-nums;
}

.prose { max-width: 66ch; }

h2 {
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin-bottom: 1.3rem;
  max-width: 24ch;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2.1rem 0 0.55rem;
}

p { margin-bottom: 1.05rem; }

a {
  color: var(--gilt-ink);
  text-decoration: underline;
  text-decoration-color: var(--gilt);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--gilt-ink);
  outline-offset: 2px;
}

em { font-style: italic; }

/* ── The two voices ────────────────────────────── */
/* GoldBerry speaks in italic, marked in gold.      */

blockquote {
  font-style: italic;
  border-left: 2px solid var(--gilt);
  padding: 0.15rem 0 0.15rem 1.2rem;
  margin: 1.9rem 0;
  max-width: 60ch;
}

blockquote .attr {
  display: block;
  margin-top: 0.55rem;
  font-style: normal;
  font-size: 0.88rem;
  color: var(--apparatus);
}

/* ── Annotation apparatus ──────────────────────── */

.annotated {
  display: grid;
  grid-template-columns: minmax(0, 66ch) 280px;
  column-gap: 48px;
  margin: 1.6rem 0;
}

.annotated > .body   { grid-column: 1; grid-row: 1; min-width: 0; }
.annotated > .margin { grid-column: 2; grid-row: 1; align-self: start; }

.flag {
  background-color: var(--gilt-wash);
  border-bottom: 2px solid var(--gilt);
  color: inherit;
  padding: 0 0.08em;
}

.note {
  font-style: italic;
  font-size: 0.93rem;
  line-height: 1.5;
  border-left: 2px solid var(--gilt);
  padding-left: 0.85rem;
  margin-bottom: 1.05rem;
  color: var(--ink);
}

.note .who {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--apparatus);
  margin-top: 0.3rem;
}

/* Quoted source text under audit */
.specimen {
  font-size: 1.12rem;
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

/* Marginal CMR stamp */
.stamp {
  display: inline-block;
  color: var(--madder);
  border: 1.5px solid var(--madder);
  padding: 0.32rem 0.62rem;
  font-weight: 600;
  font-size: 0.98rem;
  transform: rotate(-1.1deg);
  margin-bottom: 0.5rem;
}

.stamp-caveat {
  display: block;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--apparatus);
  max-width: 24ch;
  margin-bottom: 1.1rem;
}

.dateline {
  font-size: 0.85rem;
  color: var(--apparatus);
  margin: -0.6rem 0 1.1rem;
}

/* ── Masthead + nav ────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0 1.2rem;
  border-bottom: 1px solid var(--hairline);
}

.masthead .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.masthead .brand img { height: 1.9rem; width: auto; }

.masthead .org {
  font-size: 0.85rem;
  color: var(--apparatus);
}

nav.toc {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  padding: 0.6rem 0;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

nav.toc a {
  color: var(--apparatus);
  text-decoration: none;
  margin-right: 1.5em;
}

nav.toc a:hover { color: var(--gilt-ink); text-decoration: underline; text-decoration-color: var(--gilt); }

/* ── Hero ──────────────────────────────────────── */

.hero {
  padding: 4.5rem 0 4rem 88px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}

.hero .sec-label {
  position: absolute;
  left: 6px;
  top: 4.8rem;
  font-size: 0.92rem;
  color: var(--gilt-ink);
}

.hero .specimen {
  font-size: clamp(1.45rem, 3.4vw, 2.05rem);
  line-height: 1.45;
  max-width: 24ch;
  margin-bottom: 0;
}

.hero .specimen-src {
  font-size: 0.85rem;
  color: var(--apparatus);
  margin: 0.9rem 0 0;
}

.hero .thesis {
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.4;
  font-weight: 500;
  max-width: 30ch;
  margin: 3rem 0 0.9rem;
}

.hero .standfirst {
  max-width: 56ch;
  color: var(--ink);
  margin-bottom: 1.9rem;
}

.cta-row { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  padding: 0.72rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--ink);
}

.btn:hover { background: var(--paper); color: var(--ink); }

/* Hero annotation sequence — the page's one motion moment */
@media (prefers-reduced-motion: no-preference) {
  .hero .flag {
    border-bottom-color: transparent;
    background-color: transparent;
    background-image: linear-gradient(var(--gilt), var(--gilt));
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: 0 100%;
    animation: gb-draw 0.55s ease forwards;
  }
  .hero .flag:nth-of-type(2) { animation-delay: 0.5s; }
  .hero [data-reveal] { opacity: 0; animation: gb-settle 0.6s ease forwards; }
  .hero [data-reveal="1"] { animation-delay: 0.45s; }
  .hero [data-reveal="2"] { animation-delay: 0.95s; }
  .hero [data-reveal="3"] { animation-delay: 1.5s; }
}

@keyframes gb-draw   { to { background-size: 100% 2px; } }
@keyframes gb-settle { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── The eight lenses: table of instruments ────── */

.lens-list {
  border-top: 1px solid var(--hairline);
  margin: 1.8rem 0 1.6rem;
  max-width: 66ch;
}

.lens {
  display: grid;
  grid-template-columns: 2.2rem 1.9rem 12.5rem minmax(0, 1fr);
  column-gap: 1.1rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--hairline);
}

.lens .n {
  color: var(--gilt-ink);
  font-variant-numeric: oldstyle-nums;
}

.lens .name { font-weight: 600; }

.lensmark {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.22rem;
  stroke: var(--gilt);
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lens .corrects {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.lens .ask {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--apparatus);
}

/* ── Suffixscape pattern names ─────────────────── */

.pattern-name { color: var(--madder); }

/* ── Trust clauses ─────────────────────────────── */

.clause {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: 0.6rem;
  max-width: 66ch;
  margin-bottom: 1.5rem;
}

.clause .rn { color: var(--gilt-ink); font-size: 1.02rem; padding-top: 0.1rem; }
.clause h3 { margin: 0 0 0.35rem; }
.clause p { margin-bottom: 0; }

/* ── Registry list (where it runs) ─────────────── */

.registry { max-width: 66ch; }

.registry .entry {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--hairline);
}

.registry .entry:first-of-type { border-top: 1px solid var(--hairline); margin-top: 1.4rem; }
.registry .entry h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.registry .entry p { margin: 0; font-size: 0.97rem; }

/* ── Platform table ────────────────────────────── */

.table-wrap { overflow-x: auto; max-width: 66ch; margin: 1.6rem 0; }

table.platforms {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
  line-height: 1.5;
}

table.platforms th {
  text-align: left;
  font-weight: 500;
  font-style: italic;
  color: var(--apparatus);
  border-bottom: 1px solid var(--ink);
  padding: 0.45rem 1.1rem 0.45rem 0;
}

table.platforms td {
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
  padding: 0.6rem 1.1rem 0.6rem 0;
}

table.platforms td:first-child { font-weight: 600; white-space: nowrap; }

/* ── Use cases ─────────────────────────────────── */

.usecase {
  max-width: 66ch;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--hairline);
}

.usecase:first-of-type { border-top: 1px solid var(--hairline); margin-top: 1.5rem; }
.usecase h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.usecase .who { font-size: 0.85rem; color: var(--apparatus); margin-bottom: 0.55rem; }
.usecase p { margin-bottom: 0; font-size: 0.97rem; }

/* ── Instruction blocks / code ─────────────────── */

.how {
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--gilt);
  padding: 1.15rem 1.4rem;
  margin: 1.8rem 0;
  max-width: 66ch;
  font-size: 0.97rem;
}

.how ol { margin: 0.7rem 0 0 1.3rem; }
.how li { margin-bottom: 0.45rem; }

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: var(--codebg);
  padding: 0.12em 0.4em;
  border-radius: 2px;
}

/* ── Analysis pages ────────────────────────────── */

.analysis {
  position: relative;
  padding: 3rem 0 3.4rem 88px;
}

.analysis-head { margin-bottom: 2.4rem; max-width: 66ch; }
.analysis-head h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.005em;
  margin-bottom: 0.7rem;
  max-width: 22ch;
}
.analysis-head .dateline { margin: 0 0 1.2rem; }

.editors-note {
  font-size: 0.92rem;
  color: var(--apparatus);
  border-left: 2px solid var(--hairline);
  padding-left: 1rem;
  max-width: 60ch;
  margin: 1.6rem 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  max-width: 66ch;
  margin: 2.8rem 0;
}

.lens-audit {
  border-left: 2px solid var(--apparatus);
  padding-left: 1.25rem;
  margin: 1.7rem 0;
  max-width: 63ch;
}
.lens-audit h3 { margin-top: 0; }
.lens-audit p { margin-bottom: 0; font-size: 0.98rem; }
.lens-audit .status { font-style: italic; font-weight: 400; }
.lens-audit.absent  { border-left-color: var(--madder); }
.lens-audit.absent .status  { color: var(--madder); }
.lens-audit.partial { border-left-color: var(--gilt); }
.lens-audit.partial .status { color: var(--gilt-ink); }

.findings { list-style: none; margin: 1.5rem 0; max-width: 63ch; }
.findings li {
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 2px solid var(--madder);
  margin-bottom: 0.55rem;
  font-size: 0.96rem;
}
.findings li strong { color: var(--madder); font-weight: 600; }

.pathway { max-width: 63ch; margin-bottom: 1.05rem; }
.pathway strong { color: var(--gilt-ink); }

.backbar { margin-top: 2.6rem; font-size: 0.95rem; }
.backbar a { margin-right: 1.6rem; }

@media (max-width: 920px) {
  .analysis { padding-left: 0; }
}

/* ── Footer ────────────────────────────────────── */

footer {
  border-top: 1px solid var(--hairline);
  padding: 3.2rem 0 3.6rem;
  text-align: center;
}

footer img { height: 2.2rem; width: auto; margin-bottom: 0.9rem; }
footer .river { font-style: italic; max-width: 46ch; margin: 0 auto 1rem; }
footer .ip { font-size: 0.82rem; color: var(--apparatus); }

/* ── Responsive ────────────────────────────────── */

@media (max-width: 920px) {
  body { font-size: 17px; }
  .page { padding: 0 1.15rem; }
  section, .hero { padding-left: 0; }
  .sec-num, .hero .sec-label { position: static; display: block; margin-bottom: 0.5rem; }
  .annotated { grid-template-columns: minmax(0, 1fr); }
  .annotated > .margin { grid-column: 1; grid-row: auto; margin: 0.3rem 0 0.6rem 1rem; }
  .lens { grid-template-columns: 2.2rem 1.9rem minmax(0, 1fr); }
  .lens .rest { grid-column: 2 / -1; }
  .masthead { flex-wrap: wrap; }
}

@media (min-width: 921px) {
  .lens .rest { grid-column: 4; }
}
