/* ============================================================
   Studio J3L — illuminated manuscript
   Palette is the game's own (docs/color-palette.md, NA-MP-CPC-v2).
   Type: Cinzel (display) / Oswald (body) / Caveat (marginalia).
   ============================================================ */

@font-face {
  font-family: 'Cinzel';
  src: url('fonts/cinzel-400-900-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  src: url('fonts/oswald-300-700-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/caveat-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  /* The outer surface: darker kraft, so the sheet laid on it reads as a page. */
  --ground:         #b9a582;
  /* The sheet the text sits on: bone-white, a light tint of palette bone. */
  --sheet:          #F1EADC;
  --sheet-edge:     #a08f6f;

  --parchment:      #E7DDC9;
  --parchment-deep: #D9CEBA;
  --parchment-sink: #cabfa8;
  --ink:            #151218;
  --ink-muted:      #5a5058;
  --gold:           #C3A54A;
  --gold-deep:      #9c7a1e;
  --wine:           #713047;
  --indigo:         #292034;
  --umber:          #9B6A38;
  --moss:           #59633A;

  --measure: 34rem;
  --margin-col: 13rem;
  --rule: 1px solid rgba(21, 18, 24, .16);

  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  /* Deliberately plain: a colour and a tiling texture, nothing else. Earlier
     versions layered a vignette here (and before that a fixed, blend-mode
     pseudo-element), which meant the browser repainted a full-viewport layer on
     every scroll frame. A flat repeating tile is the cheapest thing a browser
     can paint, and on a two-page site it is also entirely sufficient. */
  background-color: var(--ground);
  background-image: url('img/paper.webp');
  background-repeat: repeat;
  background-size: 620px;
  color: var(--ink);
  font-family: 'Oswald', 'Segoe UI', sans-serif;
  font-weight: 300;
  font-size: clamp(1rem, .96rem + .2vw, 1.09rem);
  line-height: 1.72;
  overflow-x: hidden;
}

/* (The lifted-leaf vignette now lives in body's background layers, above.) */

/* ---------- structure ---------- */

.leaf {
  position: relative;
  z-index: 1;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.6rem 6rem;
}

/* Folio mark, like a manuscript page number. */
.folio {
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---------- the sheet ----------
   A bone-white leaf laid on the kraft ground. Holds the text column only;
   marginalia stays outside it, in the margin, the way a manuscript works. */

.sheet {
  position: relative;
  background: var(--sheet);
  padding: 2.5rem 2.6rem 2.2rem;
  border: 1px solid var(--sheet-edge);
  box-shadow:
    0 1px 0 rgba(255, 252, 245, .9) inset,
    0 2px 3px rgba(21, 18, 24, .14),
    0 14px 30px -10px rgba(21, 18, 24, .42);
}

/* Faint ruling, like a prepared page. */
.sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(21, 18, 24, .05) 1px, transparent 1px);
  background-size: 100% 2.05rem;
  background-position: 0 2.5rem;
  opacity: .55;
}
.sheet > * { position: relative; }

/* A turned corner, bottom right. */
.sheet::after {
  content: '';
  position: absolute;
  right: -1px; bottom: -1px;
  width: 1.5rem; height: 1.5rem;
  background: linear-gradient(315deg, var(--ground) 47%, rgba(21, 18, 24, .22) 48%, var(--sheet) 52%);
  border-left: 1px solid var(--sheet-edge);
  border-top: 1px solid var(--sheet-edge);
}

@media (max-width: 56rem) {
  .sheet { padding: 1.8rem 1.5rem 1.6rem; }
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.7rem;
  padding: 1.35rem 1.7rem 1.15rem;
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  border-bottom: 2px solid var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 252, 245, .9) inset,
    0 2px 3px rgba(21, 18, 24, .14),
    0 10px 22px -10px rgba(21, 18, 24, .4);
  position: relative;
}
/* The second, finer rule — a manuscript double-rule, kept inside the paper. */
.masthead::after {
  content: '';
  position: absolute;
  left: 1.7rem; right: 1.7rem; bottom: 4px;
  border-bottom: var(--rule);
}

.wordmark {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
}
.wordmark .three { color: var(--wine); }

.nav {
  display: flex;
  gap: 1.6rem;
  font-size: .8rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  font-weight: 400;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding-bottom: .2rem;
}
/* Underline drawn like a pen stroke. */
.nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 1.5px;
  width: 100%;
  background: var(--wine);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .32s cubic-bezier(.2, .7, .3, 1);
}
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); }
.nav a[aria-current='page']::after { transform: scaleX(1); background: var(--ink); }

/* ---------- opening ---------- */

.opening {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) var(--margin-col);
  gap: 3.2rem;
  align-items: start;
  padding: 3.6rem 0 2.4rem;
}

.title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(2.3rem, 1.4rem + 4.2vw, 4.1rem);
  line-height: .97;
  letter-spacing: .005em;
  margin: 0 0 1.4rem;
  text-wrap: balance;
}
.title .rubric { color: var(--wine); display: block; }

.standfirst {
  font-size: clamp(1.08rem, 1rem + .35vw, 1.28rem);
  font-weight: 300;
  line-height: 1.6;
  margin: 0 0 1.8rem;
  max-width: 30rem;
}

/* Illuminated initial — the signature move. */
.illuminated::first-letter {
  float: left;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 4.05em;
  line-height: .82;
  margin: .06em .16em 0 0;
  padding: .1em .13em .05em;
  color: var(--gold);
  background: var(--indigo);
  border: 2px solid var(--wine);
  box-shadow: 0 0 0 1px var(--gold-deep) inset, 3px 4px 0 rgba(21, 18, 24, .22);
}

/* ---------- marginalia ---------- */

/* Small slips of paper pasted into the margin — same stock as the sheet,
   so they read against the kraft instead of sinking into it. */
.marginalia {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.22rem;
  line-height: 1.32;
  color: var(--wine);
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  border-left: 3px solid var(--gold);
  padding: .85rem 1rem .95rem;
  box-shadow:
    0 1px 0 rgba(255, 252, 245, .9) inset,
    0 2px 3px rgba(21, 18, 24, .16),
    0 9px 18px -8px rgba(21, 18, 24, .38);
  transform: rotate(-1.1deg);
}
.marginalia + .marginalia { margin-top: 1.9rem; transform: rotate(.8deg); }
.marginalia .hand {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: .3rem;
}

/* ---------- prose sections ---------- */

.quire { padding: 2.2rem 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  margin: 0 0 1.5rem;
  padding-top: 1.6rem;
  border-top: var(--rule);
}
.section-head h2 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(1.3rem, 1.1rem + .8vw, 1.85rem);
  letter-spacing: .04em;
  margin: 0;
}
/* Rubricated pilcrow. */
.section-head::before {
  content: '\00B6';
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--wine);
  line-height: 1;
  flex: none;
}

/* Inside a sheet the page itself sets the measure, so lift the inner caps. */
.sheet > .section-head:first-child { border-top: 0; padding-top: 0; }
.sheet .prose,
.sheet .standfirst { max-width: none; }
.sheet .title { margin-top: 0; }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.15rem; }
.prose a {
  color: var(--ink);
  text-decoration-color: var(--gold-deep);
  text-underline-offset: .22em;
  text-decoration-thickness: 1.5px;
}
.prose a:hover { color: var(--wine); text-decoration-color: var(--wine); }

.split {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) var(--margin-col);
  gap: 3.2rem;
  align-items: start;
}

/* ---------- plate (images) ---------- */

.plate {
  margin: 2.6rem 0;
  border: 2px solid var(--ink);
  box-shadow: 6px 7px 0 rgba(21, 18, 24, .18);
  background: var(--parchment-sink);
  line-height: 0;
}
.plate img { width: 100%; height: auto; display: block; }
.plate figcaption {
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .19em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--ink);
  padding: .7rem .9rem;
  border-top: 2px solid var(--ink);
  background: var(--parchment);
}

/* Grid-breaking wide plate. */
.plate--wide { margin-inline: calc(var(--margin-col) * -.5) 0; }

.plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  margin: 2.4rem 0;
}
.plates .plate { margin: 0; }

/* ---------- catalogue list ---------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entries li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: var(--rule);
}
.entries .num {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold-deep);
  font-size: .85rem;
  letter-spacing: .1em;
}
.entries .what { font-weight: 400; }
.entries .when {
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ---------- call to action ---------- */

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  align-items: center;
  margin: 2rem 0 .5rem;
}

.seal {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--parchment);
  background: var(--ink);
  border: 2px solid var(--ink);
  padding: .78rem 1.5rem;
  box-shadow: 4px 4px 0 var(--gold-deep);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.seal:hover, .seal:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--wine);
  background: var(--indigo);
}
.seal:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--gold-deep); }

.seal--quiet {
  color: var(--ink);
  background: transparent;
  box-shadow: 4px 4px 0 rgba(21, 18, 24, .18);
}
.seal--quiet:hover { background: var(--parchment-sink); color: var(--ink); }

/* `.prose a` (0,1,1) outranks `.seal` (0,1,0), so a seal placed inside prose
   was inheriting ink-on-near-black and going unreadable. Restate it at equal
   specificity so a button is a button wherever it sits. */
.prose a.seal,
.prose a.seal:hover,
.prose a.seal:focus-visible {
  color: var(--parchment);
  text-decoration: none;
}
.prose a.seal--quiet,
.prose a.seal--quiet:hover,
.prose a.seal--quiet:focus-visible {
  color: var(--ink);
  text-decoration: none;
}

/* ---------- facts strip ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0;
  border: 2px solid var(--ink);
  margin: 2.4rem 0;
  background: var(--parchment-sink);
}
.facts div {
  padding: 1.1rem 1.15rem;
  border-right: var(--rule);
}
.facts div:last-child { border-right: 0; }
.facts dt {
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: .3rem;
}
.facts dd {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
}

/* ---------- colophon ---------- */

.colophon {
  margin-top: 4rem;
  padding: 1.15rem 1.7rem 1.25rem;
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  border-top: 2px solid var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 252, 245, .9) inset,
    0 2px 3px rgba(21, 18, 24, .14),
    0 10px 22px -10px rgba(21, 18, 24, .4);
  display: flex;
  justify-content: space-between;
  gap: 1.4rem;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--ink-muted);
}
.colophon a { color: var(--ink); text-decoration-color: var(--gold-deep); text-underline-offset: .2em; }
.colophon a:hover { color: var(--wine); }

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

@media (max-width: 56rem) {
  .opening, .split { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .plate--wide { margin-inline: 0; }
  .marginalia { transform: none; }
  .marginalia + .marginalia { transform: none; }
  .masthead { padding-top: 1.5rem; }
  .facts div { border-right: 0; border-bottom: var(--rule); }
  .facts div:last-child { border-bottom: 0; }
}

:focus-visible { outline: 2.5px solid var(--wine); outline-offset: 3px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem;
  z-index: 10;
  background: var(--ink);
  color: var(--parchment);
  padding: .7rem 1rem;
  font-family: 'Cinzel', serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .8rem;
}
