/* ==========================================================
   Base reset, typography, layout primitives
   ========================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header rather than landing under it. */
  scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease);
}

a:hover { color: var(--brand); }

p { margin: 0 0 var(--sp-4); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--sp-4);
  color: var(--ink);
}

h1 { font-size: var(--fs-5xl); }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--brand); color: var(--ink-inverse); }

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.container--tight { max-width: var(--container-tight); }
.container--wide  { max-width: var(--container-wide); }

.section {
  padding-block: clamp(var(--sp-7), 8vw, var(--sp-9));
}

.section--deep { background: var(--bg-deep); color: var(--ink-inverse); }
.section--deep h1, .section--deep h2, .section--deep h3, .section--deep h4 { color: var(--ink-inverse); }
.section--deep p { color: var(--color-stone-300); }
.section--deep .lede { color: var(--color-stone-300); }

.section--muted { background: var(--bg-muted); }

.section--brand { background: var(--brand); color: var(--ink-inverse); }
.section--brand h1, .section--brand h2, .section--brand h3, .section--brand h4 { color: var(--ink-inverse); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: var(--sp-4);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-right: var(--sp-3);
}

.section--deep .eyebrow,
.section--brand .eyebrow { color: var(--color-brass-300); }

.lede {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  max-width: 60ch;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.95rem 1.6rem;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--brand);
  color: var(--ink-inverse);
  transition: transform var(--dur-1) var(--ease),
              background var(--dur-2) var(--ease),
              color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease);
}

.btn:hover {
  background: var(--brand-strong);
  color: var(--ink-inverse);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn--ghost:hover {
  background: var(--ink);
  color: var(--ink-inverse);
  border-color: var(--ink);
}

/* On dark backdrops the ghost variant inverts: light text and border by default,
   filled with the brand color on hover so we never produce light-on-light. */
.btn--on-dark {
  color: var(--ink-inverse);
  border-color: var(--ink-inverse);
}
.btn--on-dark:hover {
  background: var(--ink-inverse);
  color: var(--brand-strong);
  border-color: var(--ink-inverse);
}

.btn--accent {
  background: var(--accent);
  color: var(--ink);
}

.btn--accent:hover { background: var(--accent-strong); color: var(--ink-inverse); }

.btn--lg { padding: 1.1rem 2rem; font-size: var(--fs-base); }

.btn .arrow { transition: transform var(--dur-2) var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

/* Grid */
.grid { display: grid; gap: var(--sp-6); }
.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)); }

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

/* Visual helpers */
.divider {
  height: 1px;
  background: var(--line);
  margin-block: var(--sp-7);
}

.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* Reveal on scroll. JS toggles `is-visible`; no-JS users get the override below. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* If JS does not run, never hide content. */
.no-js .reveal { opacity: 1; transform: none; transition: none; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: var(--ink-inverse);
  padding: var(--sp-3) var(--sp-5);
  z-index: 1000;
}
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgb(var(--rgb-bone) / 0.95);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
