/* ==========================================================================
   BASE — reset, elements, typography, layout primitives, utilities
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem; /* clears the sticky header on anchor jumps */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--clr-text);
  background: var(--clr-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* belt-and-braces against sub-pixel bleed */
}

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

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

p, li { text-wrap: pretty; }

h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.022em;
  text-wrap: balance;
  font-optical-sizing: auto;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); letter-spacing: -0.012em; line-height: 1.18; }
h4 { font-size: var(--fs-md); letter-spacing: -0.008em; line-height: 1.25; }

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

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* --- Focus: visible, branded, never removed ------------------------------ */
:focus-visible {
  outline: 3px solid var(--clr-brass-lite);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.on-light :focus-visible { outline-color: var(--clr-clay); }

/* --- Selection ---------------------------------------------------------- */
::selection { background: var(--clr-clay); color: var(--clr-text); }

/* --- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px; left: var(--sp-4);
  z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-5);
  background: var(--clr-brass);
  color: var(--clr-ink);
  font-weight: 700;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: top var(--d-base) var(--ease-out);
}
.skip-link:focus { top: 0; }

/* --- Scrollbar ---------------------------------------------------------- */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: var(--clr-ink); }
  ::-webkit-scrollbar-thumb {
    background: var(--clr-clay-deep);
    border-radius: var(--r-pill);
    border: 3px solid var(--clr-ink);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--clr-clay); }
}
html { scrollbar-color: var(--clr-clay-deep) var(--clr-ink); scrollbar-width: thin; }

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

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

.section {
  position: relative;
  padding-block: var(--sp-section);
  /* Ember .glow and .smoke are absolutely positioned with negative offsets so
     the light bleeds in from beyond the edge. Without this they extend the
     scrollable area and the whole page scrolls sideways. */
  overflow: hidden;
}

/* Light editorial section */
.section--light {
  background: var(--clr-cream);
  color: var(--clr-text-ink);
}
.section--light-alt {
  background: var(--clr-cream-2);
  color: var(--clr-text-ink);
}
.section--dark   { background: var(--clr-ink); }
.section--dark-2 { background: var(--clr-ink-2); }

/* Clay grain overlay — makes surfaces read as earthenware, not flat digital */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tx-grain);
  opacity: .035;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: var(--z-base);
}
.section--light.grain::after,
.section--light-alt.grain::after { opacity: .06; mix-blend-mode: multiply; }

.section > .container { position: relative; z-index: var(--z-raised); }

/* ==========================================================================
   TYPOGRAPHY HELPERS
   ========================================================================== */

/* Small-caps eyebrow with brass rule */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--ff-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--clr-brass);
  margin-bottom: var(--sp-4);
}
.eyebrow::before {
  content: "";
  width: 2.2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--clr-brass));
}
.eyebrow--center::after {
  content: "";
  width: 2.2rem;
  height: 1px;
  background: linear-gradient(270deg, transparent, var(--clr-brass));
}
.on-light .eyebrow, .section--light .eyebrow, .section--light-alt .eyebrow {
  color: var(--clr-clay);
}
.section--light .eyebrow::before, .section--light-alt .eyebrow::before {
  background: linear-gradient(90deg, transparent, var(--clr-clay));
}
.section--light .eyebrow--center::after, .section--light-alt .eyebrow--center::after {
  background: linear-gradient(270deg, transparent, var(--clr-clay));
}

.lede {
  font-size: var(--fs-md);
  line-height: 1.62;
  color: var(--clr-text-muted);
  max-width: 62ch;
}
.section--light .lede, .section--light-alt .lede { color: var(--clr-text-ink-mut); }

.prose p { max-width: 68ch; margin-bottom: var(--sp-4); }
.prose p:last-child { margin-bottom: 0; }

/* Brass-gradient display text */
.txt-brass {
  background: linear-gradient(100deg, var(--clr-brass-lite), var(--clr-brass) 45%, var(--clr-brass-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.txt-ember {
  background: linear-gradient(100deg, var(--clr-ember-hot), var(--clr-ember) 55%, var(--clr-clay));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Fallback where background-clip:text is unsupported */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .txt-brass { color: var(--clr-brass); background: none; }
  .txt-ember { color: var(--clr-ember); background: none; }
}

.deva {
  font-family: var(--ff-deva);
  font-weight: 400;
}

.section-head {
  max-width: 44ch;
  margin-bottom: var(--sp-7);
}
.section-head--center {
  max-width: 56ch;
  margin-inline: auto;
  text-align: center;
}
.section-head p { margin-top: var(--sp-4); }

/* ==========================================================================
   UTILITIES
   ========================================================================== */

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

.no-scroll { overflow: hidden; }

/* Ember radial glow, positioned by custom props */
.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(var(--glow-blur, 90px));
  background: radial-gradient(circle, var(--glow-clr, var(--clr-ember)) 0%, transparent 68%);
  opacity: var(--glow-o, .30);
  z-index: var(--z-base);
}

.hr-brass {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--clr-line-strong) 22%, var(--clr-line-strong) 78%, transparent);
}
