/* ==========================================================================
   BASE — reset, document defaults, typography primitives, layout helpers.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky header + top bar would otherwise cover anchor targets. */
  scroll-padding-top: calc(var(--header-h) + 2rem);
  /* Must live on <html>, not <body>: the browser propagates body's overflow
     to the viewport, which leaves body itself computing as `visible` and lets
     decorative breakout widen the document. `clip` rather than `hidden` so it
     does not become a scroll container and break position:sticky. */
  overflow-x: clip;
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--mist-400);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  /* Reserved by nav.js when the mobile action bar is visible. */
  padding-bottom: var(--mobilebar-h);
}

/* A faint film grain across the whole page kills gradient banding on the
   large dark fields and reads as workshop texture. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; cursor: pointer; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

hr { border: 0; border-top: 1px solid var(--ink-600); }

::selection { background: var(--gold-500); color: var(--ink-950); }

/* --- Focus -------------------------------------------------------------
   Visible on keyboard only, but always high contrast when it appears. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: var(--z-skip);
  padding: var(--s-3) var(--s-5);
  background: var(--gold-500);
  color: var(--ink-950);
  font-weight: 600;
  border-radius: var(--r-sm);
  transform: translateY(-160%);
  transition: transform var(--t-micro) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* --- Typography --------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  color: var(--bone-50);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  /* WONK stays off: Fraunces' wonky alternates swap in a turned ampersand
     (⅋) that reads as a rendering fault in service names like
     "Carved & Gold Leaf Signs". Kept on for .gild only, where the italic
     display sizing makes the alternates read as character rather than error. */
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 700; }
h2 { font-size: var(--fs-h2); line-height: 1.05; letter-spacing: var(--ls-display); font-weight: 700; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); font-family: var(--ff-body); font-weight: 600; letter-spacing: 0; }

p { max-width: var(--measure); }

strong, b { color: var(--bone-100); font-weight: 600; }

/* Gilded text — the gold gradient clipped to glyphs. Used on one or two
   words inside a headline, never a whole paragraph. */
.gild {
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  background: var(--grad-gold-text);
  /* 100%, not 200%: at 200% only the first half of the ramp renders, so the
     phrase runs dark gold → near-white and the tail reads as un-gilded. The
     full five-stop ramp returns to gold and reads as leaf catching light. */
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-style: italic;
  font-weight: 800;
  padding-right: 0.08em;   /* italic overhang would otherwise clip */
  margin-right: -0.04em;
}

/* Fallback for browsers without background-clip:text support. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .gild { color: var(--gold-400); -webkit-text-fill-color: var(--gold-400); background: none; }
}

/* Ampersand set in the UI font — see ampHtml() in build/lib/layout.js. */
.amp {
  font-family: var(--ff-body);
  font-weight: 400;
  font-variation-settings: normal;
  letter-spacing: 0;
  padding-inline: 0.04em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--ff-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: var(--s-4);
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  flex: none;
  background: var(--grad-gold);
}
.eyebrow--center { justify-content: center; }
.eyebrow--center::after {
  content: '';
  width: 28px;
  height: 1px;
  flex: none;
  background: var(--grad-gold);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--mist-400);
}

.prose > * + * { margin-top: var(--s-5); }
.prose h2, .prose h3 { margin-top: var(--s-7); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose a {
  color: var(--gold-400);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-micro) var(--ease-out);
}
.prose a:hover { color: var(--gold-300); }
.prose ul { display: grid; gap: var(--s-3); }
.prose ul li {
  position: relative;
  padding-left: var(--s-6);
  max-width: var(--measure);
}
.prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 10px;
  height: 2px;
  background: var(--grad-gold);
}

/* --- Layout ------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: 56rem; }

.section {
  position: relative;
  padding-block: var(--section-y);
  /* Layered compositions deliberately break out of .container. Clipping at
     the (full-width) section keeps that look while stopping it from widening
     the page. `clip` keeps sticky children working; `hidden` would not. */
  overflow-x: clip;
}
.section--alt { background: var(--ink-800); }
.section--tight { padding-block: clamp(3rem, 6vw, 6rem); }

/* Isolates a section's layout so a change inside one cannot force reflow of
   the whole document.

   Deliberately NOT `content-visibility: auto`: it replaces the height of every
   unrendered section with the contain-intrinsic-size estimate, so on a page
   this tall the document height is wrong by thousands of pixels until you have
   scrolled past everything — the scrollbar jumps, anchor links land in the
   wrong place, and scroll-linked parallax reads stale geometry. Lazy images
   with explicit width/height already deliver most of the loading win without
   any of that. */
.section--defer { contain: layout; }

.stack { display: grid; gap: var(--s-5); }
.stack--sm { gap: var(--s-3); }
.stack--lg { gap: var(--s-7); }

.grid { display: grid; gap: var(--s-5); }

.section-head {
  max-width: 48rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center p { margin-inline: auto; }
.section-head p { margin-top: var(--s-4); }

/* A hairline rule that fades out from a gold anchor point. */
.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, var(--gold-600), var(--ink-600) 22%, transparent);
}

/* --- Utilities ---------------------------------------------------------- */

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

.text-gold { color: var(--gold-500); }
.text-bone { color: var(--bone-50); }
.no-wrap { white-space: nowrap; }

/* Everything above the film-grain overlay. */
main, header, footer, .topbar, .mobile-bar { position: relative; z-index: 2; }
