/* ==========================================================================
   base.css — fonts, reset, element defaults, focus, accessibility helpers.
   Loads after tokens.css.
   ========================================================================== */

/* ---------------------------------------------------------------- FONTS --
   Manrope variable, 400-800, self-hosted (ADR-006).
   Only the `latin` subset is preloaded in index.html: its unicode-range
   covers U+0000-00FF plus U+0152-0153, which is the whole of French
   including the OE ligature. `latin-ext` is declared but practically never
   fetched. */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../../public/fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
                 U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../../public/fonts/manrope-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
                 U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Metric-adjusted fallback so the font swap does not shift layout.
   Values are approximations of Manrope's metrics against the local faces;
   they reduce rather than wholly eliminate shift. See docs/PERFORMANCE.md. */
@font-face {
  font-family: 'Manrope Fallback';
  src: local('Segoe UI'), local('Helvetica Neue'), local('Arial');
  size-adjust: 103%;
  ascent-override: 102%;
  descent-override: 29%;
  line-gap-override: 0%;
}

/* ---------------------------------------------------------------- RESET -- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Clears the sticky header for any anchored target. Exceeds header height
     so a focused target is never obscured (WCAG 2.4.11). */
  scroll-padding-top: calc(var(--header-h) + var(--sp-5));
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  /* Guards against any single wide child forcing a horizontal scrollbar.
     Not a substitute for fixing overflow — tools/audit.ps1 still asserts
     document width at every QA viewport. */
  overflow-x: clip;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  color: var(--fg);
  text-wrap: balance;        /* avoids orphan words in headings */
  font-weight: var(--fw-bold);
}

h1 {
  font-size: var(--fs-display);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-display);
}

h2 {
  font-size: var(--fs-h2);
  font-weight: 750;
  letter-spacing: var(--ls-h2);
  line-height: var(--lh-h2);
}

h3 {
  font-size: var(--fs-h3);
  letter-spacing: var(--ls-h3);
  line-height: var(--lh-h3);
}

p { text-wrap: pretty; }

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-1) var(--ease-inout);
}
a:hover { color: var(--blue-700); }
.on-studio a:hover { color: var(--brass-hi); }

strong, b { font-weight: var(--fw-semi); }

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

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

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: var(--fw-semi); }

summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ''; }

:target { scroll-margin-top: calc(var(--header-h) + var(--sp-5)); }

/* ---------------------------------------------------------------- FOCUS --
   Never write a bare `outline: none`. One treatment, both surfaces. */

:focus-visible {
  outline: var(--focus-ring) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ------------------------------------------------------------- UTILITIES */

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

/* Skip link — first focusable element on the page. */
.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  border-radius: var(--r-md);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

[hidden] { display: none !important; }

.u-measure { max-width: var(--measure); }
.u-measure-tight { max-width: var(--measure-tight); }
.u-nowrap { white-space: nowrap; }

/* ------------------------------------------------------- REDUCED MOTION --
   Lives in base.css, not motion.css, so it applies even if motion.css
   fails to load. */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .nav-drawer, .sticky-contact { display: none; }
  body { background: var(--print-bg); color: var(--print-fg); }
}
