/* ==========================================================================
   BASE — reset, element defaults, layout primitives, the house animation.
   Loads after tokens.css, before components.css.
   ========================================================================== */

/* ---- Reset -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header instead of hiding behind it. */
  scroll-padding-top: calc(var(--header-h) + var(--sp-3));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---- Type defaults ------------------------------------------------------ */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text);
  text-wrap: balance;   /* progressive: ignored where unsupported */
}

h1 { font-size: var(--fs-h1); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-semibold);  line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-medium);    line-height: var(--lh-snug); }
h4 { font-size: var(--fs-h4); font-weight: var(--fw-semibold);  line-height: var(--lh-snug); }

p { text-wrap: pretty; }
p + p { margin-top: var(--sp-3); }

strong, b { font-weight: var(--fw-semibold); }
em { font-style: italic; }

/* Keep the ™ from growing the line box it sits in — otherwise a heading or a
   nav link carrying it sits lower than its neighbours. */
/* The negative margin closes the glyph's left side bearing, which at this
   size reads as a stray word space before the ™. */
sup { font-size: 0.62em; line-height: 0; vertical-align: super; margin-left: -0.06em; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-hover) var(--ease-out);
}
a:hover { text-decoration: underline; }
.on-dark a { color: var(--cream); }

hr {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--line);
}

::selection { background: var(--burgundy); color: var(--white); }

/* ---- Focus --------------------------------------------------------------
   Keyboard users always get a visible ring; mouse users never see one. */

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--sp-2);
  top: var(--sp-2);
  z-index: var(--z-skiplink);
  padding: var(--sp-1) var(--sp-2);
  background: var(--charcoal);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transform: translateY(-200%);
}
.skip-link:focus-visible {
  transform: translateY(0);
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   LAYOUT PRIMITIVES
   ========================================================================== */

/* Container — every horizontal edge on the site comes from one of these.
   Never set page margins on a component. */
.container {
  width: 100%;
  max-width: calc(var(--container) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--text { max-width: calc(var(--container-text) + (var(--gutter) * 2)); }
.container--wide { max-width: calc(var(--container-wide) + (var(--gutter) * 2)); }

/* Section — the vertical rhythm unit. One per content block, always.
   Background modifiers carry the white / cream alternation. */
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section--tight { padding-block: var(--section-y-tight); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.section--white { background: var(--white); }
.section--cream { background: var(--cream); }
.section--cream-deep { background: var(--cream-deep); }
.section--dark { background: var(--charcoal); }

/* Hairline between two same-colored sections, so rhythm stays readable. */
.section--ruled + .section--ruled { border-top: 1px solid var(--line); }

/* Stack — vertical spacing between siblings, no margin bookkeeping. */
.stack        { display: flex; flex-direction: column; }
/* The default p + p margin would stack on top of the gap and double it. */
.stack > p + p { margin-top: 0; }
.stack--1 { gap: var(--sp-1); }
.stack--2 { gap: var(--sp-2); }
.stack--3 { gap: var(--sp-3); }
.stack--4 { gap: var(--sp-4); }
.stack--5 { gap: var(--sp-5); }
.stack--6 { gap: var(--sp-6); }

/* Grid — auto-collapses to one column under 1024px per the brand spec. */
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--gap-lg { gap: var(--sp-5); }

@media (max-width: 1023px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Reading measure. */
.measure    { max-width: var(--measure); }
.measure-sm { max-width: var(--measure-sm); }

/* ---- Small text utilities ----------------------------------------------- */

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;   /* labels only — never headings or buttons */
  color: var(--accent);
  line-height: 1.4;
}
.eyebrow--muted { color: var(--text-muted); }
.on-dark .eyebrow { color: var(--taupe); }

.lede {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--text-muted);
}

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* Pull quote — Inter Medium, burgundy, editorial. */
.pullquote {
  font-family: var(--font-body);
  font-size: var(--fs-quote);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  color: var(--accent);
  max-width: 22ch;
  border-left: 2px solid var(--accent);
  padding-left: var(--sp-4);
}
.pullquote--wide { max-width: 34ch; }
.on-dark .pullquote { color: var(--cream); border-left-color: var(--taupe); }

.pullquote__cite {
  display: block;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  font-style: normal;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* Placeholder marker — visible on purpose. Anything the copy can't yet
   support gets wrapped in this so it is impossible to ship by accident. */
.placeholder {
  display: inline-block;
  padding: 2px var(--sp-1);
  border: 1px dashed var(--terracotta);
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 87, 0.08);
  color: #8F3E1F;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

/* ==========================================================================
   THE HOUSE ANIMATION
   One entrance, used everywhere: fade + rise, ~420ms, once, no reverse.

   Safety contract (this is deliberate, do not "simplify" it):
   the opacity:0 rule is gated behind .js on <html>, which an inline script in
   the <head> sets before first paint. If scripting is off, main.js 404s, or a
   JS error fires, no element is ever hidden — the page just renders static.
   Reveals are driven by getBoundingClientRect in a throttled scroll handler,
   NOT IntersectionObserver, and main.js carries a failsafe that reveals
   everything if nothing has revealed after a few seconds.
   ========================================================================== */

.js .reveal {
  opacity: 0;
  transform: translate3d(0, var(--reveal-shift), 0);
  /* transform + opacity only — nothing here can cause layout shift. */
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  will-change: opacity, transform;
}

.js .reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* Short, restrained stagger for a row of siblings. Max 3 steps — anything
   longer starts gating content instead of revealing it. */
.js .reveal--d1 { transition-delay: 70ms; }
.js .reveal--d2 { transition-delay: 140ms; }
.js .reveal--d3 { transition-delay: 210ms; }

/* Reduced motion: content is simply present. No transform, no delay, and the
   fade collapses to nothing. This is the static fallback for every effect. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .js .reveal,
  .js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
  .js .reveal--d1, .js .reveal--d2, .js .reveal--d3 { transition-delay: 0s; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
