/* ============================================================
   BASE — reset, typography, and the primitives every page uses
   (headings, ledes, eyebrows, buttons, links, media frames).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* ONE mechanism for clearing the sticky header, and it is the
   target's own scroll-margin — not scroll-padding on the scrollport
   as well. Both at once add up, and an anchor lands a header-height
   too far down. A section may raise this; nothing should restate it. */
:target,
section[id],
main[id] { scroll-margin-top: var(--header-h); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--shell);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* the one guard against a stray full-bleed element making the
     whole document scroll sideways on a phone */
  overflow-x: hidden;
}

img, video, svg { max-width: 100%; display: block; }
img, video { height: auto; }

/* Headings inherit the display face and the d-3 pair as a floor;
   the .d1–.d4 classes below set the size, tracking and leading
   together, because those three are one decision and not three. */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: var(--lh-d3);
  letter-spacing: var(--ls-d3);
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--deep); color: var(--shell); }

/* ── FOCUS ────────────────────────────────────────────────────
   One visible ring, on every interactive thing, in a colour that
   survives both grounds. :focus-visible only, so a mouse click
   never paints a ring the pointer user did not ask for. */
:focus-visible {
  outline: 2px solid var(--deep);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.on-deep :focus-visible,
.site-footer :focus-visible { outline-color: var(--brass-soft); }

.skip-link {
  position: fixed;
  top: .75rem; left: .75rem;
  z-index: 200;
  padding: .7rem 1.1rem;
  background: var(--deep);
  color: var(--shell);
  font-size: var(--t-sm);
  border-radius: var(--pill);
  transform: translateY(-160%);
  transition: transform var(--t-ui) var(--ease-ui);
}
.skip-link:focus-visible { transform: none; }

/* ============================================================
   LAYOUT
   ============================================================ */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: 58rem; }

section { position: relative; }

.section { padding-block: var(--sec); }
.section-lg { padding-block: var(--sec-lg); }

/* A dark chapter. Declared once; every dark section on the site
   opts in with this class rather than restating six colours. */
.on-deep {
  background: var(--deep);
  color: var(--foam);
}
.on-deep h1, .on-deep h2, .on-deep h3, .on-deep h4 { color: var(--shell); }
.on-deep .eyebrow { color: var(--foam-2); }
.on-deep .eyebrow::before { background: var(--brass-soft); }
.on-deep .num { color: var(--brass-soft); }
.on-deep .lede { color: var(--foam); }

.band { background: var(--shell-2); }

/* ============================================================
   TYPE PRIMITIVES
   ============================================================ */

/* Size, tracking and leading arrive together — a display step is
   one setting, not a font-size with two loose knobs beside it. */
.d1 { font-size: var(--d-1); letter-spacing: var(--ls-d1); line-height: var(--lh-d1); }
.d2 { font-size: var(--d-2); letter-spacing: var(--ls-d2); line-height: var(--lh-d2); }
.d3 { font-size: var(--d-3); letter-spacing: var(--ls-d3); line-height: var(--lh-d3); }
.d4 { font-size: var(--d-4); letter-spacing: var(--ls-d4); line-height: var(--lh-d4); }

/* The one emphasis device in the display face: italic. It is used
   on a single phrase per heading and nowhere else. */
h1 em, h2 em, h3 em { font-style: italic; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  flex: none;
  background: var(--brass);
}
.eyebrow-center { justify-content: center; }

/* Section numerals. Editorial furniture — they tell you where you
   are in the story without adding a word. Set in the SANS at the
   eyebrow's own size: two digits of a high-contrast display serif
   at 15px read as a smudge rather than as a number. */
.num {
  font-family: var(--sans);
  font-size: inherit;
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  color: var(--brass-ink);
  font-variant-numeric: tabular-nums lining-nums;
}

.lede {
  font-size: var(--t-lede);
  line-height: var(--lh-lede);
  letter-spacing: var(--ls-body);
  color: var(--ink-2);
  max-width: var(--measure);
  text-wrap: pretty;
}

.copy { color: var(--ink-2); max-width: var(--measure); }
.copy + .copy { margin-top: var(--s4); }

/* A run of paragraphs, spaced once rather than by whoever wrote
   the markup. Replaces the inline `display:grid; gap:1rem` that
   used to sit on the property section. */
.flow { display: grid; gap: var(--s4); }

.fine { font-size: var(--t-sm); color: var(--ink-3); line-height: 1.6; }

/* The standard opening of a chapter: numeral + eyebrow, heading,
   lede. Every section on the site uses this, so chapters cannot
   drift apart from each other. */
.head { display: grid; gap: var(--s5); margin-bottom: var(--gap-head); }
.head-top { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.head .lede { margin-top: calc(var(--s2) * -1); }

/* ============================================================
   ACTIONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  /* one height for every control on the site, so a row of actions
     lines up without anyone reconciling two padding values */
  min-height: var(--ctl-h);
  padding: 0 1.55rem;
  border-radius: var(--pill);
  background: var(--deep);
  color: var(--shell);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: .005em;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--deep);
  transition: background var(--t-ui) var(--ease-ui),
              border-color var(--t-ui) var(--ease-ui),
              color var(--t-ui) var(--ease-ui);
}
.btn:hover { background: var(--deep-3); border-color: var(--deep-3); }

/* THE PRESS ANSWERS FIRST. Feedback on a press has to land while
   the finger is still down; on the 260ms hover curve the button
   appeared to acknowledge the click after the click. A small
   scale on a 100ms ease-out is the whole effect. */
.btn:active {
  transform: scale(.98);
  transition: transform var(--t-press) ease-out;
}

.btn .arr { transition: transform var(--t-ui) var(--ease-ui); }
.btn:hover .arr { transform: translateX(3px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  /* a defined edge rather than a suggestion of one: the secondary
     action is an action, and at 14% it read as a disabled control */
  border-color: color-mix(in srgb, var(--ink) 26%, transparent);
}
.btn-ghost:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border-color: var(--ink);
  color: var(--ink);
}

.on-deep .btn {
  background: var(--shell);
  color: var(--deep);
  border-color: var(--shell);
}
.on-deep .btn:hover { background: #fff; border-color: #fff; }
.on-deep .btn-ghost {
  background: transparent;
  color: var(--shell);
  border-color: var(--line-dark-2);
}
.on-deep .btn-ghost:hover {
  border-color: var(--shell);
  background: rgba(255, 255, 255, .06);
}

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.btn-row-center { justify-content: center; }

/* A text link that behaves like a link: an underline that draws
   itself from the left on hover, and an arrow that steps out. */
.link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink);
  padding-bottom: .3rem;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--t-ui) var(--ease-ui);
}
.link:hover, .link:focus-visible { background-size: 100% 1px; }
.link .arr { transition: transform var(--t-ui) var(--ease-ui); }
.link:hover .arr { transform: translateX(3px); }
/* the third action type gets a press too, so all three answer */
.link:active { opacity: .6; transition: opacity var(--t-press) ease-out; }
.on-deep .link { color: var(--shell); }

/* ============================================================
   MEDIA
   ------------------------------------------------------------
   Photography carries no radius and no shadow. It is held by its
   own edge and by the space around it. Every frame declares an
   aspect-ratio so nothing on the page ever shifts as images load.
   ============================================================ */

.frame {
  position: relative;
  overflow: hidden;
  background: var(--shell-3);
}
.frame > img,
.frame > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r-32 { aspect-ratio: 3 / 2; }
.r-43 { aspect-ratio: 4 / 3; }
.r-11 { aspect-ratio: 1 / 1; }
.r-34 { aspect-ratio: 3 / 4; }
.r-169 { aspect-ratio: 16 / 9; }
.r-219 { aspect-ratio: 2.1 / 1; }

figure { margin: 0; }
figcaption {
  margin-top: var(--s3);
  font-size: var(--t-xs);
  color: var(--ink-3);
  letter-spacing: .01em;
}
.on-deep figcaption { color: var(--foam-2); }

/* A slow settle as a photograph decodes, so images arrive rather
   than snap. Driven by a class the script adds on load, never by
   a transition on the element's own src. */
.fade-media { opacity: 0; transition: opacity var(--t-media) var(--ease); }
.fade-media.is-loaded { opacity: 1; }

/* ============================================================
   SCROLL REVEALS
   ------------------------------------------------------------
   One device: a short rise into place, ordered by --d. Nothing
   travels far and nothing moves sideways. Under reduced motion
   (or with no JS at all) every element is simply present.
   ============================================================ */

/* 10px, not 14. The reveal is meant to register as the content
   settling rather than as an animation the reader watches —
   below about a dozen pixels it stops reading as travel at all
   and starts reading as presence. */
.rv {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition: opacity var(--t-in) var(--ease),
              transform var(--t-in) var(--ease);
  transition-delay: calc(var(--d, 0) * var(--stagger));
  will-change: opacity, transform;
}
.rv.is-in { opacity: 1; transform: none; }

/* No script: the reveal never applies in the first place, so a
   browser with JavaScript off gets the page rather than a column of
   invisible sections. The `js` class is set by an inline <script> in
   the document head, before first paint. */
html:not(.js) .rv { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .fade-media { opacity: 1; transition: none; }
}

/* ── utilities ─────────────────────────────────────────────── */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── SPACING AND MEASURE, AS TOKENS ────────────────────────────
   Eleven one-off values used to live in style attributes across
   the three pages — margin-top:1rem here, 2rem there, 3rem on the
   page after that, two different max-widths, a font-size. Each was
   defensible alone and together they were a spacing scale nobody
   had agreed to. These are the same intentions, named, built from
   the 8-pt scale, and settable in one place. */
.measure-narrow { max-width: 32rem; }
.measure-head { max-width: 16ch; }

/* the gap between an eyebrow and the heading it introduces, where
   the two are siblings rather than cells of a .head grid */
.head-h { margin-top: var(--s4); }

/* a note set after the block it belongs to — three distances,
   deliberately chosen, instead of whatever was typed at the time */
.note-after-sm { margin-top: var(--s4); }
.note-after { margin-top: var(--s6); }
.note-after-lg { margin-top: var(--s7); }

.copy-sm { font-size: var(--t-sm); }
