/* Relling — v2 base layer. Load AFTER tokens.css.
   Resets + element defaults + the type ramp as utility classes. */

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

html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 110px; }
/* anchored headings must clear the fixed nav pill (~78px + breathing room) —
   scroll-margin covers scrollers that ignore scroll-padding (Lenis glides) */
[id] { scroll-margin-top: 110px; }
/* Lenis drives the glide itself — native smooth scrolling would fight it */
html.lenis { scroll-behavior: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--grotesk);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }

/* Sharp by principle — kill default rounding on form controls */
input, textarea, select, button { font: inherit; border-radius: var(--radius); }

::selection { background: var(--signal); color: var(--on-signal); }

/* Keyboard focus — visible ring on every interactive element (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--signal-text); outline-offset: 3px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* Skip to content — visually hidden until focused (WCAG 2.4.1) */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 999;
  transform: translateY(-150%);
  background: var(--bg); color: var(--text);
  border: var(--hairline) solid var(--border-strong);
  font-family: var(--sub); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 12px 18px;
  transition: transform .25s var(--ease, ease);
}
.skip-link:focus { transform: translateY(0); }

/* Layout */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--margin); }
.hairline { height: var(--hairline); background: var(--border); border: 0; }

/* ---- Type ramp (mirrors the Figma DS) ----
   Söhne does display + headings + body. Mona Sans (--sub) does labels,
   captions, and numbers — the technical/instrument layer. */
.t-display     { font-family: var(--grotesk); font-weight: 600; font-size: clamp(38px, 6.2vw, 74px);  line-height: 1.0; letter-spacing: -0.03em; }
.t-h1          { font-family: var(--grotesk); font-weight: 600; font-size: clamp(30px, 4.7vw, 49px); line-height: 1.04; letter-spacing: -0.028em; }
.t-h2          { font-family: var(--grotesk); font-weight: 500; font-size: clamp(23px, 3.1vw, 33px);  line-height: 1.08; letter-spacing: -0.022em; }
.t-title       { font-family: var(--grotesk); font-weight: 500; font-size: 21px; line-height: 1.22; letter-spacing: -0.016em; }
.t-lede        { font-family: var(--grotesk); font-weight: 400; font-size: clamp(17px, 1.9vw, 21px); line-height: 1.42; letter-spacing: -0.012em; color: var(--text-2); }
.t-body        { font-family: var(--grotesk); font-weight: 400; font-size: 16px; line-height: 1.6; }
.t-body-sm     { font-family: var(--grotesk); font-weight: 400; font-size: 15.5px; line-height: 1.6; }
.t-label       { font-family: var(--sub); font-weight: 500; font-size: 12px; line-height: 1.2; letter-spacing: 0.1em; text-transform: uppercase; }
.t-caption     { font-family: var(--sub); font-weight: 400; font-size: 11px; line-height: 1.35; letter-spacing: 0.07em; }
.t-number      { font-family: var(--sub); font-weight: 500; font-size: 22px; line-height: 1.0; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

/* Color helpers */
.text-2 { color: var(--text-2); } .text-mute { color: var(--text-mute); } .signal { color: var(--signal-text); }

/* Wordmark — CSS mask so fill inherits --text from whatever theme context it's in */
.wordmark {
  display: block;
  width: 99px; height: 28px;
  background: var(--text);
  -webkit-mask: url('/assets/img/wordmark-v4.svg') no-repeat center / contain;
  mask: url('/assets/img/wordmark-v4.svg') no-repeat center / contain;
  flex-shrink: 0;
}

/* Cross-page view transitions (MPA) — seamless page-to-page motion.
   Progressive enhancement: browsers without support just navigate normally.
   NOTE: the nav must NOT get its own view-transition-name — naming an ancestor
   of the blurred pills puts them in an isolated snapshot layer in Chromium and
   permanently kills their backdrop-filter (text collides with the nav). The
   nav rides the root cross-fade instead. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out .25s cubic-bezier(0.4, 0, 1, 1) both; }
  ::view-transition-new(root) { animation: vt-in .55s cubic-bezier(0.22, 1, 0.36, 1) both; }
  @keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }
}
