/* ==========================================================================
   Alistair Carmichael
   Two layers: a composed charcoal surface, and the vermilion beneath it.
   ========================================================================== */

/* Vixa by Shady Red Pilgrim. Free to use with credit (see the footer). */
@font-face {
  font-family: "Vixa";
  src: url("assets/fonts/vixa-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Sampled from the reference images */
  --vermilion: #D62800;   /* flat red behind every portrait */
  --ink: #000000;         /* halftone shadows */
  --charcoal: #1C1C1C;    /* page */
  --charcoal-2: #262626;  /* raised panels */
  --olive: #7B7647;       /* the only skin tone */
  --olive-deep: #58482A;
  --bone: #C4AE8A;        /* text on dark */
  --bone-dim: #9C8F7C;    /* secondary text: 5.4:1 on charcoal, 4.8:1 on charcoal-2 */
  --ember: #D85339;       /* open rows, focus */
  --crimson: #96141E;
  --rust: #772800;
  --gilt: #C2A266;        /* hairline gold for ornament only (never text) */

  /* Lettering system shared by BARGAIN and the unveiled headline */
  --letter-texture: url("assets/img/bowed.png") center 30% / cover;
  --letter-dots: radial-gradient(circle, var(--olive) 0 1.3px, transparent 1.9px) 0 0 / 5px 5px;
  --letter-stroke: 1.5px;
  --gilt-soft: rgba(194, 162, 102, .55);

  --line: rgba(176, 154, 127, .2);
  --line-strong: rgba(176, 154, 127, .42);

  --f-black: "Grenze Gotisch", "UnifrakturCook", serif;
  --f-label: "Pirata One", "Grenze Gotisch", "UnifrakturCook", serif;
  --f-ornate: "Vixa", "EB Garamond", "Cormorant Garamond", serif;
  --f-serif: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  --f-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --gap: clamp(16px, 2vw, 28px);
  --ease: cubic-bezier(.7, 0, .2, 1);
}

/* Reset -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--charcoal);
  color: var(--bone);
  font: 400 1rem/1.7 var(--f-sans);
  overflow-x: hidden;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }
s { text-decoration-thickness: 1px; text-decoration-color: var(--vermilion); }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 200;
  display: inline-flex; align-items: center; min-height: 44px;
  background: var(--bone); color: var(--ink); padding: .75rem 1rem;
  font: 500 .9375rem var(--f-sans); text-decoration: none;
}
.skip:focus { top: 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Atmosphere ---------------------------------------------------------------- */
.grain {
  position: fixed; inset: -50%; z-index: 100; pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 9s steps(9) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -4%); }
  60%  { transform: translate(-4%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Two vertical hairlines bound the column for the full page */
.rails { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.rails::before, .rails::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line);
  left: max(10px, calc(50% - var(--wrap) / 2 - 1px));
}
.rails::after { left: auto; right: max(10px, calc(50% - var(--wrap) / 2 - 1px)); }

/* Image slots ---------------------------------------------------------------
   Backdrops: a cover image that fades in once loaded; a missing file leaves the
   section's own background. Framed plates: a missing file shows an ornamental
   plate (dot screen + a single star) so the layout never collapses. */
.backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.backdrop.is-loaded img { opacity: var(--bd-opacity, 1); }
.backdrop.is-empty img { display: none; }
.backdrop.is-loaded::after { content: ""; position: absolute; inset: 0; background: var(--bd-overlay, rgba(20, 20, 20, .8)); }

.frame.is-empty img, .is-empty > .frame img { display: none; }
.frame.is-empty::before, .is-empty > .frame::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(123, 118, 71, .55) 1px, transparent 1.6px) 0 0 / 6px 6px;
  -webkit-mask: radial-gradient(closest-side, #000 15%, transparent 100%);
          mask: radial-gradient(closest-side, #000 15%, transparent 100%);
}
.frame.is-empty::after, .is-empty > .frame::after {
  content: ""; position: absolute; inset: auto; left: 50%; top: 50%;
  width: 26px; height: 26px; transform: translate(-50%, -50%);
  background: var(--vermilion); mix-blend-mode: normal;
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
.frame--red.frame.is-empty::before, .is-empty > .frame--red::before {
  background-image: radial-gradient(circle, rgba(0, 0, 0, .5) 1px, transparent 1.6px);
}
.is-empty > .frame--red::after, .frame--red.is-empty::after { background: var(--ink); }

/* Layout -------------------------------------------------------------------- */
.wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter);
}
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.section { padding-block: clamp(5rem, 11vw, 9.5rem); }

/* Type voices --------------------------------------------------------------- */
.caption {
  font-family: var(--f-serif);
  font-size: .9375rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--bone);
}
.caption em {
  font-style: italic;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: var(--vermilion);
}
.caption--right { text-align: right; }
.ornate { font-family: var(--f-ornate); font-weight: 400; line-height: .9; letter-spacing: .01em; }
.lead {
  font-family: var(--f-serif);
  font-size: clamp(1.6rem, 3.2vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -.005em;
}

.star { width: 14px; height: 14px; fill: currentColor; flex: none; }
.star--accent { color: var(--vermilion); }

/* Masthead ------------------------------------------------------------------ */
.masthead {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding-block: .75rem; border-bottom: 1px solid var(--line);
}
.masthead__title { font-size: .875rem; }
.masthead__nav { display: flex; justify-content: flex-end; gap: clamp(.9rem, 2.4vw, 2rem); }
.masthead__nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font: 400 .9375rem/1 var(--f-serif); letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; border-bottom: 1px solid transparent;
}
.masthead__nav a:hover { border-bottom-color: var(--vermilion); }

/* Hero ---------------------------------------------------------------------- */
/* Without a background file: flat charcoal with a soft vignette */
.hero {
  position: relative; border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse 85% 75% at 50% 45%, #232323 0%, var(--charcoal) 55%, #111 100%);
}
/* Background slot: invisible until the file loads. Cover, centred, so the subject stays in the middle 60% */
.hero__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero__bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  opacity: 0; transition: opacity .8s ease;
}
.hero__bg.is-loaded img { opacity: 1; }
.hero__bg.is-empty img { display: none; }
/* Gradient overlay: darkest at the top (captions) and bottom (ledger), a little lighter behind the name */
.hero__bg.is-loaded::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, transparent 40%, rgba(10, 10, 10, .55) 100%),
    linear-gradient(180deg, rgba(16, 16, 16, .86) 0%, rgba(16, 16, 16, .58) 32%, rgba(16, 16, 16, .58) 62%, rgba(16, 16, 16, .92) 100%);
}

/* Gothic pillars in the margins: star finial, pointed arch, double-ruled shaft, plinth */
.pillar {
  position: absolute; z-index: 1; top: 4.5rem; bottom: 2rem; width: 48px;
  display: none; flex-direction: column; align-items: center;
  color: var(--gilt-soft); pointer-events: none;
}
.pillar__crown { width: 48px; height: 120px; flex: none; }
.pillar__shaft {
  flex: 1; width: 34px; margin-top: -1px;
  border-inline: 3px double var(--gilt-soft);
  background: linear-gradient(90deg, transparent calc(50% - .5px), var(--gilt-soft) calc(50% - .5px) calc(50% + .5px), transparent calc(50% + .5px));
}
.pillar__base { width: 48px; height: 40px; flex: none; margin-top: -1px; }
@media (min-width: 1320px) {
  .pillar { display: flex; }
  .pillar--l { left: calc((100% - var(--wrap)) / 4 - 24px); }
  .pillar--r { right: calc((100% - var(--wrap)) / 4 - 24px); }
}

.hero__inner {
  display: flex; flex-direction: column;
  min-height: 92vh; min-height: min(92svh, 1000px);
  padding-top: clamp(2rem, 4.5vw, 3.5rem);
  padding-bottom: clamp(3.25rem, 6vw, 5.25rem);
}
/* Fine double border around the hero content, sitting in the gutter so it never squeezes the name */
.hero__border {
  position: absolute; pointer-events: none;
  top: .9rem; bottom: .9rem;
  left: max(8px, calc(var(--gutter) - 30px)); right: max(8px, calc(var(--gutter) - 30px));
  border: 3px double var(--gilt-soft);
  color: var(--gilt);
}
.hero__corner { position: absolute; width: 40px; height: 40px; }
.hero__corner--tl { top: -7px; left: -7px; }
.hero__corner--tr { top: -7px; right: -7px; transform: scaleX(-1); }
.hero__corner--bl { bottom: -7px; left: -7px; transform: scaleY(-1); }
.hero__corner--br { bottom: -7px; right: -7px; transform: scale(-1, -1); }
.hero__top { display: flex; justify-content: space-between; gap: 1rem; }
/* Portrait and name share one grid cell; the name's two lines overlap the frame's top and bottom edges */
.hero__stage {
  display: grid; justify-items: center; align-items: center;
  margin-block: auto;
  padding-block: clamp(3.5rem, 9vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}
.hero__stage > * { grid-area: 1 / 1; }
.hero__portrait { width: min(400px, 58vw); aspect-ratio: 8 / 9; }
.hero__name {
  --size: clamp(3rem, 18vw, 11.25rem); /* "Carmichael" is ~4.9em wide in Vixa: 18vw still fits a 375px screen */
  position: relative; z-index: 2;
  align-self: stretch; width: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  margin-block: calc(var(--size) * -.42);
  font: 400 var(--size)/.95 var(--f-ornate);
  letter-spacing: .005em;
  color: var(--bone);
  pointer-events: none;
}
/* No portrait file: the name stands on its own */
.hero__stage.is-empty .hero__portrait { display: none; }
.hero__stage.is-empty .hero__name { margin-block: 0; }
.hero__first { align-self: flex-start; position: relative; }
.hero__last { align-self: flex-end; }
/* The one star that is three pixels too low */
.hero__star {
  position: absolute; top: .12em; right: -.32em;
  width: clamp(12px, 1.6vw, 18px); height: clamp(12px, 1.6vw, 18px);
  color: var(--vermilion); transform: translateY(3px);
}
.hero__tagline {
  max-width: 38ch; margin-inline: auto; margin-top: .75rem; text-align: center; text-wrap: balance;
  font: italic 400 clamp(1.25rem, 2.2vw, 1.6rem)/1.35 var(--f-serif);
}
.ledger {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.ledger > div { padding: 1.1rem 1.25rem 1.2rem; }
.ledger > div + div { border-left: 1px solid var(--line); }
.ledger dt, .facts dt, .surface__cells dt {
  font: 400 .875rem/1.3 var(--f-serif); letter-spacing: .08em; text-transform: uppercase;
  color: var(--bone-dim); margin-bottom: .3rem;
}
.ledger dd { font-size: .9375rem; }
.ledger__sub {
  display: block; margin-top: .2rem;
  font: 400 .875rem/1.3 var(--f-serif); letter-spacing: .08em; text-transform: uppercase; color: var(--bone-dim);
}

/* Frames -------------------------------------------------------------------- */
.frame {
  position: relative; overflow: hidden;
  border: 1.5px solid var(--ink); border-radius: 5px;
  background: var(--ink);
  outline: 1px solid var(--line); outline-offset: 5px;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
/* Non-halftone photographs: duotone + dot screen */
.frame--treat img { filter: url(#duotone-olive) contrast(1.15); }
.ht::after {
  content: ""; position: absolute; inset: -50%; pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,.65) .9px, transparent 1.5px) 0 0 / 4px 4px;
  transform: rotate(45deg);
  mix-blend-mode: multiply;
}
.plate figcaption { margin-top: 1rem; font-size: .875rem; }

/* Section heads ------------------------------------------------------------- */
.shead {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 1.25rem;
  margin-bottom: clamp(3rem, 7vw, 5.5rem);
}
.shead__rule { position: relative; height: 1px; background: var(--line-strong); }
.shead__rule::after {
  content: ""; position: absolute; top: -5px; width: 11px; height: 11px;
  background: currentColor;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.shead__rule:first-child::after { right: -2px; }
.shead__rule:last-of-type::after { left: -2px; }
.shead__index {
  position: absolute; left: 0; bottom: .6rem;
  font: 400 .875rem/1 var(--f-serif); letter-spacing: .08em; color: var(--bone-dim);
}
.shead__title {
  font: 400 clamp(1.6rem, 3vw, 2.1rem)/1 var(--f-label);
  letter-spacing: .01em; text-align: center;
}
.shead__star { width: 11px; height: 11px; margin-left: .3em; vertical-align: super; color: var(--vermilion); }
.shead__sub {
  grid-column: 1 / -1; margin-top: .9rem; text-align: center;
  font: italic 400 1rem/1.3 var(--f-serif); color: var(--bone-dim);
}

/* About --------------------------------------------------------------------- */
.about { row-gap: 3rem; align-items: start; }
.about__main { grid-column: 1 / span 7; }
.about__side { grid-column: 9 / span 4; padding-top: .5rem; }
/* The mat: the backdrop sits only here, behind the portrait plate, never behind the paragraphs or facts */
.about__mat {
  position: relative; isolation: isolate;
  margin-bottom: 3rem; padding: clamp(1.25rem, 2.5vw, 1.75rem) clamp(1.25rem, 2.5vw, 1.75rem) 1.25rem;
  border: 1px solid var(--line-strong);
  background: var(--charcoal-2);
}
.backdrop--mat { z-index: -1; --bd-opacity: .9; --bd-overlay: linear-gradient(180deg, rgba(20, 20, 20, .55), rgba(20, 20, 20, .88) 75%); }
.about__plate { position: relative; }
.about__frame { aspect-ratio: 4 / 5; }
.about__ornate { font-size: clamp(3.4rem, 9vw, 7.4rem); margin-bottom: 2.25rem; color: var(--bone); }
.about__lead { position: relative; padding-bottom: 2.25rem; border-bottom: 1px solid var(--line); }
/* A red hairline that draws itself, sits 4px under the rule, and runs 13px too far */
.drawline {
  position: absolute; left: 0; bottom: -5px; height: 1px; width: calc(100% + 13px);
  background: var(--vermilion);
  transform: scaleX(0); transform-origin: left;
  transition: transform 2.6s cubic-bezier(.65, 0, .35, 1) .3s;
}
.is-drawn .drawline { transform: scaleX(1); }
/* Two flowing columns, so paragraphs of different lengths still end level */
.about__cols {
  columns: 2; column-gap: var(--gap);
  padding-top: 2.25rem; color: var(--bone);
}
.about__cols p + p { margin-top: 1rem; }
.about__cols p { orphans: 3; widows: 3; }
.facts { border-top: 1px solid var(--line-strong); }
.facts > div { padding-block: 1rem; border-bottom: 1px solid var(--line); }
.facts dt { margin-bottom: .2rem; }

/* Pull quote: large blackletter, oversized opening mark, hairline frame */
.pullquote {
  position: relative; margin-top: 3rem;
  padding: 2.1rem clamp(1.25rem, 3vw, 2.25rem) 1.5rem clamp(3.25rem, 6vw, 4.75rem);
  border: 1px solid var(--line-strong);
  outline: 1px solid var(--line); outline-offset: 5px;
}
.pullquote__mark {
  position: absolute; left: .12em; top: -.12em;
  font: 400 clamp(6rem, 11vw, 8.5rem)/1 var(--f-black); color: var(--vermilion);
}
.pullquote__text p { font: 600 clamp(1.85rem, 3.4vw, 2.75rem)/1.08 var(--f-black); letter-spacing: .005em; }
.pullquote__cite { margin-top: .9rem; font-size: .875rem; color: var(--bone-dim); }

/* "A day at the house": time ····· entry */
.daybook { margin-top: 3rem; }
.daybook__title { margin-bottom: .9rem; font: 400 1.5rem/1.1 var(--f-label); }
.daybook__rows { border-top: 1px solid var(--line-strong); }
.daybook__row {
  display: grid; grid-template-columns: 3.4rem 2.5rem 1fr; align-items: baseline; column-gap: .6rem;
  padding-block: .6rem; border-bottom: 1px solid var(--line);
}
.daybook__time { font: 500 .9375rem/1 var(--f-sans); font-variant-numeric: tabular-nums; letter-spacing: .03em; color: var(--bone); }
.daybook__leader { border-bottom: 2px dotted var(--line-strong); transform: translateY(-.25em); }
.daybook__entry { font: 400 1.0625rem/1.4 var(--f-serif); }
/* 13:00 sits a hair off its line */
.daybook__row:nth-child(4) .daybook__time { transform: translateY(1px); }

/* The autograph, on a signature line. It sits at the foot of the side column
   (margin-top: auto), so the two columns end together. */
.about__side { align-self: stretch; display: flex; flex-direction: column; }
.autograph { margin-top: auto; padding-top: 3.5rem; width: 100%; max-width: 320px; }
.autograph__line {
  display: flex; align-items: center; gap: .55rem;
  color: var(--vermilion);
}
.autograph__line .star { width: 11px; height: 11px; }
.autograph__line::after { content: ""; flex: 1; height: 1px; background: #C9B28A; }
.autograph__sig { position: relative; display: block; margin-top: .4rem; }
.autograph__sig img { display: block; width: 100%; height: auto; }
/* Bone tint: the PNG stays in place (size, alt text); a bone fill masked by the same file sits on top */
.autograph.is-tinted .autograph__sig img { opacity: 0; }
.autograph__ink {
  position: absolute; inset: 0; background-color: #C9B28A;
  -webkit-mask: var(--sig) center / 100% 100% no-repeat;
          mask: var(--sig) center / 100% 100% no-repeat;
}
/* Text fallback when the file cannot load */
.autograph__text { display: block; padding-block: .4rem .2rem; font: italic 400 2rem/1.2 var(--f-serif); color: var(--bone); }
.autograph__caption {
  margin-top: .6rem;
  font: 400 1rem/1.3 var(--f-serif); font-variant-caps: all-small-caps; letter-spacing: .1em; color: var(--bone);
}
/* Draw-in, once. The hidden start state is set here in CSS, so it holds from the very first frame;
   only with JavaScript (html.js) and only when motion is allowed. script.js adds .is-drawn when the
   autograph is half in view and its image has decoded.
   Timeline: hairline 0–0.5s, star fades 0–0.3s, signature 0.3–1.9s (feathered mask sweeping left to right). */
@media (prefers-reduced-motion: no-preference) {
  .js .autograph__line .star { opacity: 0; transition: opacity .3s ease-out; }
  .js .autograph__line::after { transform: scaleX(0); transform-origin: left center; transition: transform .5s ease-out; }
  .js .autograph__sig {
    /* Opaque for the first third of a mask three times as wide, feathered, then transparent.
       At position 100% only the transparent third covers the signature: fully invisible. At 0, fully drawn. */
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 33.34%, transparent 40%, transparent 100%);
            mask-image: linear-gradient(to right, #000 0%, #000 33.34%, transparent 40%, transparent 100%);
    -webkit-mask-size: 300% 100%; mask-size: 300% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: 100% 0; mask-position: 100% 0;
    transition: -webkit-mask-position 1.6s ease-out .3s, mask-position 1.6s ease-out .3s;
  }
  .js .autograph.is-drawn .autograph__line .star { opacity: 1; }
  .js .autograph.is-drawn .autograph__line::after { transform: scaleX(1); }
  .js .autograph.is-drawn .autograph__sig { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

/* The Family ---------------------------------------------------------------- */
.band {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter);
  background: var(--vermilion);
  color: var(--ink);
}
/* Halftone photo inside the letters; if bowed.png is missing, a CSS dot screen shows instead */
.band__word {
  font-size: clamp(3.8rem, 15vw, 14rem);
  color: var(--ink);
  background:
    var(--letter-texture),
    linear-gradient(100deg, var(--ink) 30%, transparent 68%),
    var(--letter-dots);
  background-color: var(--ink);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: var(--letter-stroke) var(--ink);
  margin-bottom: -.22em; /* Vixa carries a deep descent; pull the band back into balance */
}
/* Ink on vermilion is 4.2:1, so only large bold type here */
.band__note {
  font: 700 1.2rem/1.2 var(--f-serif); letter-spacing: .05em; text-transform: uppercase;
  max-width: 12ch;
}
.band__note--r { justify-self: end; text-align: right; }

.family__grid { margin-top: clamp(3.5rem, 8vw, 6rem); row-gap: 3rem; align-items: start; }
.family__lamb { grid-column: 1 / span 3; }
.family__lamb .frame { aspect-ratio: 4 / 5; }
.frame--red { background: var(--vermilion); }
.frame--red img { object-fit: cover; padding: 12%; }
/* Faint dark backdrop behind the clauses */
.clauses-wrap {
  grid-column: 4 / 9; position: relative; isolation: isolate;
  padding: 1.25rem clamp(1rem, 2vw, 1.75rem) 1.5rem;
  border: 1px solid var(--line);
}
.backdrop--clauses { z-index: -1; --bd-opacity: .55; --bd-overlay: rgba(20, 20, 20, .78); }
.clauses { border-top: 1px solid var(--line); }
.clauses li {
  display: grid; grid-template-columns: 3rem 1fr; gap: .75rem;
  padding-block: 1.15rem; border-bottom: 1px solid var(--line);
}
.clauses__no { font: 400 1.25rem/1.4 var(--f-label); color: var(--bone-dim); }
.clauses p { font-size: 1.0625rem; }
/* Slightly off the grid on purpose */
.family__portrait { grid-column: 9 / span 4; transform: translate(7px, -5px); }
.family__portrait .frame { aspect-ratio: 1; }

/* Family tree */
.tree-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-top: clamp(4rem, 8vw, 6rem); margin-bottom: 1rem;
}
.tree-hint { display: none; gap: .5rem; color: var(--bone-dim); white-space: nowrap; }
.tree-hint span { color: var(--vermilion); }
.tree-overflows .tree-hint { display: inline-flex; }

.tree-scroll {
  position: relative; z-index: 1;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--charcoal);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--bone-dim) transparent;
}
.tree-scroll:focus-visible { outline-offset: -3px; }
.tree-scroll::-webkit-scrollbar { height: 6px; }
.tree-scroll::-webkit-scrollbar-thumb { background: var(--bone-dim); border-radius: 3px; }

.tree { position: relative; width: max-content; margin-inline: auto; padding: 3.5rem var(--gutter) 3rem; }
.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.links path { fill: none; stroke-width: 1; shape-rendering: crispEdges; }
.links__line { stroke: var(--line-strong); }
.links__branch { stroke: transparent; transition: stroke .8s ease; }
.is-cracked .links__branch { stroke: var(--vermilion); }

.tree ul { margin: 0; padding: 0; list-style: none; }
.tree__root { display: flex; justify-content: center; }
.unit { display: flex; flex-direction: column; align-items: center; }
.tree .kids { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin-top: 56px; }
.tree .kids[data-depth="1"] { gap: 40px; }
.couple { position: relative; z-index: 1; display: flex; align-items: center; }
.couple__tie { flex: none; width: 18px; height: 1px; background: var(--line-strong); }
/* The founding couple is joined by a gilded double line with a star at its centre */
.couple--g1 .couple__tie {
  position: relative; width: 56px; height: 5px;
  background: none; border-block: 1px solid var(--gilt);
}
.couple--g1 .couple__tie::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 13px; height: 13px;
  transform: translate(-50%, -50%); background: var(--gilt);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
/* Third generation: each sibling row staggers gently up and down */
.tree .kids[data-depth="2"] > .unit:nth-child(even) { margin-top: 20px; }

/* Nameplates (text only) */
.card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  min-height: 44px;
  background: var(--charcoal); border: 1px solid var(--line-strong);
  text-align: center; color: var(--bone);
  transition: transform .6s var(--ease), border-color .2s;
}
button.card { cursor: pointer; font: inherit; }
.card:focus-visible { outline-offset: 4px; }
.card__name { display: block; }
.card__years { font: 400 .8125rem/1 var(--f-sans); color: var(--bone-dim); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.card__more {
  font: italic 400 .8125rem/1 var(--f-serif); color: var(--bone-dim);
  text-decoration: underline; text-decoration-color: var(--vermilion); text-underline-offset: .2em;
}
button.card:hover, .card[aria-expanded="true"] { border-color: var(--ember); }

/* Generation I: large blackletter plate, double rule, star ornaments */
.card--g1 {
  min-width: 230px; padding: 1.6rem 1.75rem 1rem;
  border: 3px double var(--gilt-soft);
  outline: 1px solid var(--line); outline-offset: 5px;
  background: #191919;
}
.card--g1 .card__name { font: 400 1.85rem/1.05 var(--f-black); letter-spacing: .01em; max-width: 9em; }
.card__orn { display: flex; gap: .5rem; color: var(--gilt); }
.card__orn .star { width: 11px; height: 11px; }
.card__orn--top { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding-inline: 6px; background: #191919; }
.card__orn--top .star { width: 15px; height: 15px; }
.card__orn--bottom { margin-top: .35rem; }
.card__orn--bottom .star:nth-child(2) { color: var(--vermilion); }

/* Generation II: medium plaques, given names in italic, surname in small caps, a roman numeral */
.card--g2 { width: 152px; padding: .85rem .7rem .8rem; border-radius: 2px; box-shadow: inset 0 0 0 3px var(--charcoal), inset 0 0 0 4px var(--line); }
.card__numeral { font: 500 .875rem/1 var(--f-serif); color: var(--bone-dim); letter-spacing: .18em; padding-left: .18em; }
.card__numeral::before, .card__numeral::after { content: "·"; margin-inline: .25em; color: var(--vermilion); }
.card__given { display: block; font: italic 400 1.0625rem/1.15 var(--f-serif); }
.card__surname { display: block; margin-top: .15rem; font: 400 1rem/1.1 var(--f-serif); font-variant-caps: all-small-caps; letter-spacing: .12em; }

/* Generation III: compact plaques */
.card--g3 { width: 118px; padding: .6rem .5rem .55rem; }
.card--g3 .card__name { font: 400 .9375rem/1.15 var(--f-serif); }

/* Deceased: dimmed, with a dotted border (the † is in the years line) */
.card.is-deceased { border-style: dotted; border-color: var(--bone-dim); }
.card.is-deceased .card__name, .card.is-deceased .card__given, .card.is-deceased .card__surname { color: var(--bone-dim); }
/* Not yet named: muted italic surname, dashed border */
.card.is-placeholder { border-style: dashed; border-color: var(--bone-dim); }
.card.is-placeholder .card__name { font-style: italic; color: var(--bone-dim); }

/* The subject: vermilion plaque, black text at large/bold sizes only (4.2:1), red star on a charcoal disc */
.card.is-subject {
  width: auto; min-width: 150px; padding: .8rem 1rem .75rem;
  background: var(--vermilion); border: 1px solid var(--ink); color: var(--ink);
}
.card.is-subject .card__name { font: 700 1.1875rem/1.12 var(--f-serif); max-width: 8.5em; }
.card.is-subject .card__years { font: 700 1.1875rem/1 var(--f-sans); color: var(--ink); }
.card.is-subject .card__more { font: italic 700 1.1875rem/1 var(--f-serif); color: var(--ink); text-decoration-color: var(--ink); }
.card__mark {
  position: absolute; top: -12px; right: -12px;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--charcoal); color: var(--vermilion);
}
.card__mark .star { width: 15px; height: 15px; }
.card.is-subject:focus-visible { outline-color: var(--bone); }

/* During the reveal, a few things slip */
.is-cracked .card.is-subject { transform: translate(3px, -3px); }
.is-cracked .card.is-deceased { transform: translate(var(--slip-x, -2px), var(--slip-y, 2px)); }

.tree-note {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  max-width: 560px; margin: 1.5rem auto 0; padding: 1rem 1rem 1.1rem 1.25rem;
  border: 1px solid var(--line-strong); border-left: 2px solid var(--vermilion);
}
.tree-note[hidden] { display: none; }
.tree-note__name { font: 400 1.25rem/1.2 var(--f-label); margin-bottom: .3rem; }
.tree-note__close {
  flex: none; width: 44px; height: 44px; margin: -.5rem -.5rem 0 0;
  background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--bone);
}
.tree-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.75rem;
  margin-top: 1.5rem; font-size: .875rem; color: var(--bone-dim);
}
.tree-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.tree-legend .star { color: var(--vermilion); width: 12px; height: 12px; }

/* Beneath the Surface ------------------------------------------------------- */
.peelbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
  margin-bottom: 2rem;
}
.peelbar__note { max-width: 46ch; color: var(--bone); font-size: .9375rem; }
.peel {
  display: inline-flex; align-items: center; gap: .7rem; flex: none;
  min-height: 48px; padding: .8rem 1.25rem .85rem 1.05rem;
  background: transparent; border: 1px solid var(--line-strong); border-radius: 999px;
  font: 500 .9375rem/1 var(--f-serif); letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; touch-action: manipulation;
  transition: background-color .25s, color .25s, border-color .25s;
}
.peel .star { color: var(--vermilion); width: 12px; height: 12px; transition: transform .6s var(--ease); }
.peel:hover { border-color: var(--bone); }
/* Ember, not vermilion: small ink text needs the 5.2:1 */
.peel[aria-expanded="true"] { background: var(--ember); border-color: var(--ember); color: var(--ink); }
.peel[aria-expanded="true"] .star { color: var(--ink); transform: rotate(45deg); }

.crack {
  position: relative; overflow: hidden;
  border: 1.5px solid var(--ink); border-radius: 6px;
  outline: 1px solid var(--line); outline-offset: 5px;
  background: var(--vermilion);
}
.js .crack { display: grid; }
.js .crack > .under, .js .crack > .surface { grid-area: 1 / 1; }

/* Surface: impeccable */
.surface {
  position: relative; z-index: 1; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem;
  min-height: 100%;
  padding: clamp(1.5rem, 5vw, 4.5rem);
  background: var(--charcoal-2);
}
.surface__top { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
/* Background picture: fills the layer, shown once loaded (script adds .has-bg to the crack).
   Every panel carries a copy, so the picture splits and slides with them. */
.surface__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.surface__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%; opacity: 0; }
.crack.has-bg .surface__bg img { opacity: 1; }
.crack.has-bg .surface__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(20, 20, 20, .9) 0%, rgba(20, 20, 20, .78) 45%, rgba(20, 20, 20, .6) 100%);
}
.surface__quote p {
  max-width: 21ch;
  font: italic 400 clamp(1.9rem, 4.6vw, 3.6rem)/1.12 var(--f-serif);
}
.surface__cells { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.surface__cells > div { padding: 1rem 1.25rem 0 0; }
.surface__cells > div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.surface__sign { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.surface__thumb { width: 92px; aspect-ratio: 1; }
.surface__name { margin-left: auto; font: 400 clamp(1.6rem, 3vw, 2.2rem)/1 var(--f-label); }

/* Panels built by script.js: each is a clipped copy of the surface */
.panels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.panel {
  position: absolute; inset: 0;
  clip-path: inset(var(--t) var(--r) var(--b) var(--l));
  transform: translate(calc(var(--ox, 0px) + var(--sx, 0px) + var(--px, 0%)), calc(var(--oy, 0px) + var(--sy, 0px) + var(--py, 0%)));
  transition: transform 1.1s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.panel > .surface { position: absolute; inset: 0; }
/* Faint seam on each rectangle, like the fragmented face */
.panel::after {
  content: ""; position: absolute; z-index: 2;
  top: var(--t); left: var(--l); right: var(--r); bottom: var(--b);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55);
}
.crack.is-split > .surface { opacity: 0; }
.crack.is-open .panel { --px: var(--ex); --py: var(--ey); }

/* Under: raw */
.under {
  position: relative; z-index: 0; isolation: isolate;
  display: flex; flex-direction: column; gap: clamp(2rem, 5vw, 3.5rem);
  padding: clamp(1.5rem, 5vw, 4.5rem);
  background: var(--vermilion);
  color: var(--ink);
}
/* Photo background (script adds .has-photo once it loads; otherwise flat vermilion + dark text) */
.under__bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; isolation: isolate; }
.under__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; opacity: 0; }
.under.has-photo { background: #0B0403; color: var(--bone); }
.under.has-photo .under__bg img { opacity: 1; }
/* Vermilion tint: 'color' keeps the photo's brightness and gives it the site's exact red */
.under.has-photo .under__bg::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: var(--vermilion); mix-blend-mode: color; opacity: .45;
}
/* Scrim + vignette: at least 45% black everywhere text can sit, near-black at the edges,
   and a deeper band across the top where the vermilion headline sits (it needs a near-black ground for 3:1). */
.under.has-photo .under__bg::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(180deg, rgba(4, 2, 1, .8) 0%, rgba(4, 2, 1, .7) 22%, rgba(4, 2, 1, 0) 40%),
    radial-gradient(ellipse 80% 75% at 50% 42%, rgba(8, 3, 2, .45) 0%, rgba(8, 3, 2, .58) 55%, rgba(4, 2, 1, .94) 100%);
}

/* The headline, letter by letter (spans built by script.js), in the same system as BARGAIN:
   mostly solid, a few outline-only, a few filled with the halftone texture. The pattern is fixed. */
.under__shout .w { display: inline-block; white-space: nowrap; }
.under__shout .ch { display: inline-block; }
/* Fallback ground (flat vermilion): letters in black */
.ch--solid { color: var(--ink); }
.ch--outline { color: transparent; -webkit-text-fill-color: transparent; -webkit-text-stroke: 2px var(--ink); }
.ch--texture {
  background: var(--letter-texture), var(--letter-dots);
  background-color: var(--ink);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: var(--letter-stroke) var(--ink);
}
/* On the dark photo: vermilion letters, black outline, a bone hairline and a soft dark-red glow */
.under.has-photo .ch--solid { color: var(--vermilion); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.under.has-photo .ch--outline { -webkit-text-stroke: 2px var(--vermilion); }
.under.has-photo .ch {
  filter: drop-shadow(0 0 .6px rgba(201, 178, 138, .95)) drop-shadow(0 0 18px rgba(110, 14, 0, .55));
}
.under.has-photo .under__question,
.under.has-photo .under__end { color: var(--bone); text-shadow: 0 1px 14px rgba(0, 0, 0, .6); }
.under__shout {
  font: 400 clamp(3.1rem, 10.5vw, 9.25rem)/.92 var(--f-ornate);
  letter-spacing: 0;
  margin-left: -.03em;
}
.under__grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2.5rem;
  align-items: start;
}
.under__img { grid-column: 1 / span 7; aspect-ratio: 16 / 10; transform: translate(-4px, 6px); outline: none; }
.under__question {
  max-width: 24ch;
  font: 600 clamp(1.75rem, 3.4vw, 2.9rem)/1.06 var(--f-black);
}
.strips { grid-column: 8 / span 5; display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.strips li {
  background: var(--ink); color: var(--bone);
  padding: .3rem .6rem .35rem;
  font: 500 1rem/1.45 var(--f-sans);
}
.strips li:nth-child(3) { transform: translateX(9px); font-weight: 600; }
.strips li:nth-child(5) { transform: translateX(-3px); }
.under__end {
  margin-top: auto; /* when the surface is taller, the slack goes here, not between lines */
  text-align: right;
  font: 700 clamp(1.75rem, 3.6vw, 3rem)/1 var(--f-black);
}

/* Particulars --------------------------------------------------------------- */
.particulars { position: relative; isolation: isolate; }
/* Faint backdrop: a dark overlay that also fades to the page colour at the top and bottom edges */
.backdrop--particulars {
  z-index: -1; --bd-opacity: .7;
  --bd-overlay: linear-gradient(180deg, var(--charcoal) 0%, rgba(20, 20, 20, .87) 16%, rgba(20, 20, 20, .87) 84%, var(--charcoal) 100%);
}

/* A ledger: number │ label ········ Title ✦ */
.rows { border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.row { position: relative; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row h3 { font: inherit; }
.row__head {
  display: grid; grid-template-columns: 4.25rem auto minmax(2rem, 1fr) auto 2.25rem; align-items: center;
  width: 100%; min-height: 4.25rem; padding: .6rem 1rem .6rem .75rem;
  background: transparent; border: 0; color: var(--bone); text-align: left; cursor: pointer; touch-action: manipulation;
  transition: background-color .2s, color .2s;
}
.row__no { font: 600 1.6rem/1 var(--f-black); letter-spacing: .02em; }
/* 05 sits two pixels low */
.row:nth-child(5) .row__no { transform: translateY(2px); }
.row__meta {
  align-self: stretch; display: flex; align-items: center;
  padding-left: 1.25rem; border-left: 1px solid var(--line-strong);
  font: 400 1.0625rem/1.2 var(--f-serif); font-variant-caps: all-small-caps; letter-spacing: .12em; color: var(--bone-dim);
}
.row__leader { height: 0; margin: 0 1rem; border-bottom: 2px dotted var(--line-strong); align-self: center; transform: translateY(.45em); }
/* The leader under 03 sits a hair off */
.row:nth-child(3) .row__leader { transform: translateY(calc(.45em + 2px)); }
.row__title { font: 400 1.6rem/1.15 var(--f-serif); letter-spacing: .005em; }
.row__star { justify-self: end; width: 14px; height: 14px; color: var(--bone-dim); transition: color .2s, transform .4s var(--ease); }
.row__head:hover .row__star, .row__head:focus-visible .row__star { color: var(--vermilion); }
@media (hover: hover) { .row__head:hover { background: rgba(38, 38, 38, .7); } }
.row__head:focus-visible { outline-offset: -4px; }

/* Open: only this row fills with vermilion. Black text here is large or bold only (4.2:1). */
.row.is-open .row__head { background: var(--vermilion); color: var(--ink); }
/* Small caps would shrink the label below "large text", so the open row drops them */
.row.is-open .row__meta { color: var(--ink); border-left-color: var(--ink); font-weight: 700; font-size: 1.1875rem; font-variant-caps: normal; letter-spacing: .04em; }
.row.is-open .row__leader { border-bottom-color: rgba(0, 0, 0, .55); }
.row.is-open .row__star { color: var(--ink); transform: rotate(45deg); }
.row.is-open s { text-decoration-color: var(--ink); }
.row.is-open .row__head:focus-visible { outline-color: var(--ink); }
.row__panel {
  display: grid; grid-template-columns: 4.25rem 1fr;
  padding: 1.25rem 1rem 1.6rem .75rem;
  border-top: 1px solid var(--line);
}
.row__panel[hidden] { display: none; }
.row__panel p { grid-column: 2; max-width: 52ch; padding-left: 1.25rem; border-left: 1px solid var(--line-strong); }

/* Writer's Notes ------------------------------------------------------------
   The author speaking, a little outside the world: a typed memo pinned up,
   double-rule frame, thin vermilion rule along the top. */
.memo {
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.25rem);
  border: 3px double var(--line-strong);
  background: linear-gradient(180deg, rgba(38, 38, 38, .55), rgba(28, 28, 28, 0) 60%);
}
.memo::before {
  content: ""; position: absolute; left: -3px; right: -3px; top: -3px; height: 2px; background: var(--vermilion);
}
/* Two pins, as if tacked to a board */
.memo::after {
  content: ""; position: absolute; top: -7px; left: 2.5rem; right: 2.5rem; height: 10px; pointer-events: none;
  background:
    radial-gradient(circle 4.5px at 5px 50%, var(--bone-dim) 92%, transparent) left / 10px 10px no-repeat,
    radial-gradient(circle 4.5px at 5px 50%, var(--bone-dim) 92%, transparent) right / 10px 10px no-repeat;
}
.memo__head { padding-bottom: 1rem; margin-bottom: .5rem; border-bottom: 1px dashed var(--line-strong); color: var(--bone-dim); font-size: .875rem; }
.memo__list { columns: 2; column-gap: clamp(2rem, 4vw, 3.5rem); column-rule: 1px solid var(--line); }
.memo__item {
  break-inside: avoid;
  display: grid; grid-template-columns: 2.25rem 1fr; gap: .25rem .75rem;
  padding-block: 1.1rem; border-bottom: 1px solid var(--line);
}
.memo__no { font: 500 .875rem/1.6 var(--f-sans); font-variant-numeric: tabular-nums; letter-spacing: .06em; color: var(--bone-dim); }
.memo__label { font: 500 1.125rem/1.3 var(--f-serif); font-variant-caps: all-small-caps; letter-spacing: .1em; margin-bottom: .35rem; }
.memo__text { font: 400 .9375rem/1.7 var(--f-sans); color: var(--bone); }
.memo__foot { margin-top: 1.25rem; display: flex; justify-content: flex-end; }

/* Footer -------------------------------------------------------------------- */
.footer { position: relative; overflow: hidden; border-top: 1px solid var(--line); }
.footer__inner { padding-top: 2.5rem; }
.footer__cols { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.footer__cols .caption { font-size: .875rem; }
.footer__mid { display: flex; align-items: center; gap: .8rem; }
.footer__rings { width: 34px; height: 34px; fill: none; stroke: var(--bone-dim); stroke-width: .75; flex: none; }
.footer__rings circle:last-child { fill: var(--vermilion); stroke: none; }
.footer__link {
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: underline; text-decoration-color: var(--vermilion);
  text-decoration-thickness: 1px; text-underline-offset: .3em;
}
.footer__link:hover { color: var(--ember); }
.footer__link::after { content: "\2197"; margin-left: .35em; color: var(--vermilion); }
.footer__base { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; }
.footer__font { font: italic 400 .875rem/1.3 var(--f-serif); color: var(--bone-dim); text-align: center; }
.barcode {
  flex: none; width: 132px; height: 22px;
  background: repeating-linear-gradient(90deg,
    var(--bone-dim) 0 1px, transparent 1px 3px, var(--bone-dim) 3px 5px, transparent 5px 6px,
    var(--bone-dim) 6px 7px, transparent 7px 10px, var(--bone-dim) 10px 11px, transparent 11px 13px);
}
.footer__dash {
  flex: none; width: 104px; height: 2px;
  background: linear-gradient(90deg,
    var(--vermilion) 0 72px, transparent 72px 80px, var(--vermilion) 80px 84px,
    transparent 84px 90px, var(--vermilion) 90px 94px, transparent 94px 100px, var(--vermilion) 100px 104px);
}
/* The long phrase wraps (two lines on desktop, three on phones); only the bottom edge crops it */
.footer__word {
  font: 500 clamp(3.6rem, 12.5vw, 13rem)/.82 var(--f-black);
  color: #2E2C29;
  text-align: center;
  text-wrap: balance;
  padding-inline: var(--gutter);
  margin-top: 2.5rem;
  margin-bottom: -.2em;
  letter-spacing: -.01em;
}

/* Small screens ------------------------------------------------------------- */
@media (max-width: 900px) {
  /* Stacked About, in reading order: lead, paragraphs, pull quote, portrait, facts, timetable, autograph */
  .about { display: flex; flex-direction: column; align-items: stretch; }
  .about__main, .about__side { display: contents; }
  .about__ornate { order: 1; }
  .about__lead { order: 2; }
  .about__cols { order: 3; }
  .pullquote { order: 4; }
  .about__mat { order: 5; margin-top: 3.25rem; max-width: 440px; width: 100%; }
  .facts { order: 6; }
  .daybook { order: 7; }
  .autograph { order: 8; margin-top: 0; padding-top: 3rem; align-self: center; text-align: center; }
  .memo__list { columns: 1; }
  .family__lamb { grid-column: 1 / span 5; }
  .family__portrait { grid-column: 7 / span 6; }
  .clauses-wrap { grid-column: 1 / -1; grid-row: 2; }
  .under__img, .strips { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .masthead { grid-template-columns: 1fr auto; row-gap: 0; padding-top: 1rem; padding-bottom: 0; }
  .masthead__nav { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; gap: 0 1.15rem; border-top: 1px solid var(--line); margin-top: .75rem; }
  .daybook__row { grid-template-columns: 3.1rem 1rem 1fr; column-gap: .5rem; }
  .pullquote { padding-left: 3rem; }
  .memo__item { grid-template-columns: 2rem 1fr; }
  .memo__foot { justify-content: flex-start; }
  .masthead__nav a { font-size: .875rem; letter-spacing: .03em; white-space: nowrap; }
  .hero__inner { min-height: 0; }
  .hero__top { flex-direction: column; gap: .4rem; }
  .hero__top .caption--right { text-align: left; }
  .hero__stage { padding-block: 4.5rem 2.5rem; }
  .ledger { grid-template-columns: 1fr; }
  .ledger > div { padding-inline: 0; }
  .ledger > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .about__cols { columns: 1; padding-top: 1.75rem; }
  .shead { column-gap: .75rem; }
  .shead__title { font-size: 1.5rem; }
  .shead__index { display: none; }
  .band { grid-template-columns: 1fr; row-gap: .75rem; }
  .band__word { grid-row: 1; justify-self: center; margin-bottom: .1em; }
  .band__note { max-width: none; }
  .family__lamb, .family__portrait { grid-column: 1 / -1; }
  .family__lamb { max-width: 220px; }
  .family__portrait { grid-row: 3; transform: translate(5px, -3px); }
  .clauses li { grid-template-columns: 2.75rem 1fr; }
  .tree-head { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .peelbar { flex-direction: column; align-items: flex-start; }
  .under__bg img { object-position: 72% 40%; } /* the phone crop has the face on the right */
  .under__shout { font-size: 14.5vw; }
  /* Thinner outlines at phone size so Vixa's hairlines stay open */
  .under__shout { --letter-stroke: 1px; }
  .ch--outline, .under.has-photo .ch--outline { -webkit-text-stroke-width: 1.25px; }
  .under.has-photo .ch--solid { -webkit-text-stroke-width: 1.25px; }
  .surface__cells { grid-template-columns: 1fr; }
  .surface__cells > div { padding: .8rem 0; }
  .surface__cells > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .row__head { grid-template-columns: 3rem minmax(0, 1fr) 1.75rem; min-height: 3.75rem; padding-inline: .5rem .75rem; }
  .row__meta, .row__leader { display: none; }
  .row__no { font-size: 1.4rem; }
  .row__title { font-size: 1.375rem; }
  .row__panel { grid-template-columns: 3rem 1fr; padding-inline: .5rem .75rem; }
  .row__panel p { padding-left: .9rem; }
  .hero__corner { width: 30px; height: 30px; }
  .clauses-wrap { padding-inline: .9rem; }
  .footer__cols { grid-template-columns: 1fr; gap: .4rem; }
  .footer__cols .caption--right { text-align: left; }
  .footer__base { flex-wrap: wrap; }
  .footer__font { order: 3; flex-basis: 100%; text-align: left; }
  .footer__word { font-size: 19vw; }
}

/* Phones (≤ 700px) --------------------------------------------------------------
   Everything below only takes effect at max-width: 700px. Above that, these
   elements are hidden and the desktop layout is untouched. */
.masthead__menu, .hero__platecap, .tree-mobile { display: none; }

@media (max-width: 700px) {
  /* General rhythm: one section padding, 20px sides, quieter texture */
  :root { --gutter: 20px; }
  .section { padding-block: clamp(40px, 12vw, 56px); }
  .shead { margin-bottom: clamp(20px, 7vw, 32px); }
  .grain { opacity: .045; }
  .rails { display: none; }

  /* Masthead: one compact row, the links fold into a menu (≈ 60px tall closed) */
  .masthead { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; padding-block: .5rem; }
  .masthead .star--accent { display: none; }
  .masthead__title { font-size: .8125rem; }
  .masthead__menu {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: none; border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer;
  }
  .masthead__menu-icon { position: relative; width: 18px; height: 1px; background: var(--bone); box-shadow: 0 -6px 0 var(--bone), 0 6px 0 var(--bone); }
  .masthead__menu-icon::before, .masthead__menu-icon::after {
    content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 1px; background: var(--bone); opacity: 0;
  }
  .masthead.is-open .masthead__menu-icon { background: transparent; box-shadow: none; }
  .masthead.is-open .masthead__menu-icon::before { opacity: 1; transform: rotate(45deg); }
  .masthead.is-open .masthead__menu-icon::after { opacity: 1; transform: rotate(-45deg); }
  .js .masthead__nav { display: none; }
  .masthead.is-open .masthead__nav {
    display: flex; flex-direction: column; gap: 0;
    grid-column: 1 / -1; margin-top: .5rem; border-top: 1px solid var(--line);
  }
  .masthead__nav a { min-height: 44px; font-size: .9375rem; letter-spacing: .06em; border-bottom: 1px solid var(--line); }

  /* Hero: less padding, the name above and below the portrait, darker ground behind the text */
  .hero__corner { display: none; }
  .hero__inner { min-height: 0; padding-top: 1.25rem; padding-bottom: 2rem; }
  .hero__top .caption--right { display: none; }
  .hero__stage { padding-block: calc(clamp(3rem, 18vw, 11.25rem) * 1.15) clamp(3rem, 18vw, 11.25rem); }
  .hero__name { margin-block: calc(var(--size) * -1); }
  .hero__platecap { display: block; margin-top: .9rem; text-align: center; font-size: .8125rem; }
  .hero__tagline { margin-top: 1.25rem; padding-inline: .25rem; font-size: 1.125rem; }
  .hero__bg.is-loaded::after {
    background: linear-gradient(180deg, rgba(14, 14, 14, .86) 0%, rgba(14, 14, 14, .72) 32%, rgba(12, 12, 12, .84) 58%, rgba(10, 10, 10, .95) 78%, rgba(10, 10, 10, .97) 100%);
  }
  .ledger { grid-template-columns: 1fr; margin-top: 1.5rem; }
  .ledger > div { padding: .6rem 0; }
  .ledger > div + div { border-left: 0; border-top: 1px solid var(--line); }

  /* About: tighter, every gap 16–28px (the stacked layout must not add its desktop row gap on top) */
  .about { row-gap: 0; }
  #about .shead { margin-bottom: clamp(16px, 6vw, 28px); }
  .about__ornate { font-size: clamp(2.4rem, 11vw, 3rem); margin-bottom: clamp(16px, 5vw, 24px); }
  .about__lead { padding-bottom: clamp(16px, 5vw, 24px); }
  .about__cols { padding-top: clamp(16px, 5vw, 24px); font-size: 1rem; line-height: 1.6; }
  .pullquote { margin-top: clamp(20px, 6vw, 28px); padding: 1.5rem 1rem 1rem 2.75rem; }
  .pullquote__mark { font-size: 5.5rem; }
  .about__mat { margin-top: 28px; margin-bottom: 24px; }
  .daybook { margin-top: 28px; }
  .daybook__row { grid-template-columns: 4.5rem 1fr; column-gap: 0; padding-block: .5rem; }
  .daybook__leader { display: none; }
  .autograph { padding-top: 28px; }

  /* The Carmichael: band notes centred above and below the word, smaller plates, tighter clauses.
     The notes stay at 19px bold: ink on vermilion is 4.2:1, which only passes as large text. */
  .band { grid-template-columns: 1fr; row-gap: .5rem; padding-block: 1.5rem; }
  .band__note { grid-row: 1; justify-self: center; text-align: center; max-width: none; font-size: 1.1875rem; }
  .band__word { grid-row: 2; justify-self: center; margin-bottom: 0; }
  .band__note--r { grid-row: 3; justify-self: center; text-align: center; }
  .family__grid { margin-top: 2rem; row-gap: 1.5rem; }
  .family__lamb, .family__portrait { grid-column: 1 / -1; justify-self: center; width: 70%; max-width: 70%; text-align: center; }
  .family__grid .frame { outline-offset: 3px; }
  .frame--red img { padding: 8%; }
  .clauses-wrap { padding: .75rem .9rem; }
  .clauses li { padding-block: .65rem; }

  /* Family tree: hide the scrolling tree, show the branch outline */
  .family { padding-bottom: 32px; }
  .tree-scroll, .tree-hint, .tree-overflows .tree-hint { display: none; }
  .tree-head { margin-top: 2rem; margin-bottom: .75rem; }
  .tree-mobile { display: block; }
  .tree-legend { gap: .25rem 1rem; margin-top: 1rem; font-size: .8125rem; }

  .mtree__house { text-align: center; font-size: .8125rem; color: var(--bone-dim); margin-bottom: .75rem; }
  .mtree__root { display: flex; align-items: stretch; justify-content: center; }
  .mtree__root .couple__tie { align-self: center; }
  .mtree__root .card--g1 { min-width: 0; flex: 1 1 0; padding: 1.1rem .5rem .7rem; outline-offset: 3px; }
  .mtree__root .card--g1 .card__name { font-size: 1.3rem; max-width: none; }
  .mtree__root .couple__tie { flex: none; width: 16px; height: 5px; background: none; border-block: 1px solid var(--gilt); }
  .mtree__tools { display: flex; justify-content: flex-end; margin: 1.25rem 0 .25rem; }
  .mtree__all {
    min-height: 44px; padding: 0 .25rem; background: none; border: 0; cursor: pointer; color: var(--bone);
    font: 400 .875rem/1 var(--f-serif); letter-spacing: .08em; text-transform: uppercase;
    text-decoration: underline; text-decoration-color: var(--vermilion); text-underline-offset: .3em;
  }
  .mtree__branches { border-top: 1px solid var(--line-strong); }
  .branch { border-bottom: 1px solid var(--line); }
  /* Branch header: the whole row is the toggle, at least 56px tall */
  .branch__head {
    display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto 1.25rem; align-items: center; column-gap: .5rem;
    width: 100%; min-height: 56px; padding: .55rem .25rem;
    background: none; border: 0; text-align: left; color: var(--bone); cursor: pointer;
  }
  .branch__num, .tree-mobile .card__numeral { font: 500 .875rem/1 var(--f-serif); letter-spacing: .12em; color: var(--bone-dim); }
  .tree-mobile .card__numeral::before, .tree-mobile .card__numeral::after { display: none; }
  .branch__name { display: block; font: 400 1.0625rem/1.25 var(--f-serif); }
  .branch__with { display: block; font: italic 400 .9375rem/1.3 var(--f-serif); color: var(--bone-dim); }
  .branch__years { font: 400 .8125rem/1 var(--f-sans); font-variant-numeric: tabular-nums; color: var(--bone-dim); }
  .branch__chev { justify-self: center; width: 8px; height: 8px; border-right: 1px solid var(--bone); border-bottom: 1px solid var(--bone); transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
  .branch__head[aria-expanded="true"] .branch__chev { transform: translateY(2px) rotate(225deg); }
  .branch__head.is-deceased .branch__name { color: var(--bone-dim); }
  /* A sibling with no children: the plain nameplate as a row, no toggle */
  .branch--leaf .card {
    display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: center; column-gap: .5rem;
    width: 100%; min-height: 56px; margin-block: .4rem; padding: .5rem .25rem; text-align: left; box-shadow: none;
  }
  .branch--leaf .card__years { justify-self: end; padding-right: .5rem; }
  /* Children: an indented outline with a hairline down the left and a tick into each row */
  .branch__kids { padding: .1rem 0 .9rem .9rem; }
  .branch__kids > .card { width: 100%; margin-bottom: .5rem; }
  .mrows { position: relative; padding-left: 1rem; }
  .mrows::before { content: ""; position: absolute; left: 0; top: 0; bottom: 1.65rem; width: 1px; background: var(--line-strong); transition: background-color .8s ease; }
  .mrow { position: relative; padding-block: .3rem; }
  .mrow::before { content: ""; position: absolute; left: -1rem; top: 1.65rem; width: .7rem; height: 1px; background: var(--line-strong); }
  .mrow > .card {
    width: 100%; flex-direction: row; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .5rem .75rem; text-align: left;
  }
  .mrow > .card .card__years { white-space: nowrap; }
  /* Alistair: name on its own line, years and the note link beneath it */
  .mrow > .card.is-subject {
    display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: .3rem;
    padding: .7rem .8rem;
  }
  .mrow > .card.is-subject .card__name { grid-column: 1 / -1; max-width: none; }
  .is-cracked .branch--subject .mrows::before { background: var(--vermilion); }

  /* Particulars: the label sits above the title */
  .row__head {
    grid-template-columns: 2.75rem minmax(0, 1fr) 1.5rem;
    grid-template-areas: "no meta star" "no title star";
    row-gap: .1rem; min-height: 4rem; padding: .6rem .5rem .6rem .25rem;
  }
  .row__no { grid-area: no; font-size: 1.35rem; }
  .row__meta { display: block; grid-area: meta; align-self: end; padding-left: 0; border-left: 0; font-size: .875rem; }
  .row__leader { display: none; }
  .row__title { grid-area: title; align-self: start; font-size: 1.25rem; }
  .row__star { grid-area: star; }
  .row__panel { grid-template-columns: 2.75rem 1fr; padding-inline: .25rem .5rem; }

  /* Writer's Notes: one column, slimmer frame */
  .memo { padding: 18px; }
  .memo::after { left: 1.25rem; right: 1.25rem; }
  .memo__list { columns: 1; }
}

/* Reduced motion: everything still happens, nothing moves ------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .drawline { transform: scaleX(1); transition: none; }
  .panel, .card, .links__branch, .hero__bg img, .backdrop img, .row__head, .row__star, .peel, .peel .star { transition: none !important; }
  .crack .panel { --sx: 0px !important; --sy: 0px !important; }
  .crack.is-open .panel { visibility: hidden; }
}
