/* ============================================================================
   XARQ — reset, elements, typography primitives
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Paired with the same rule on body. A decorative element that reaches past
     the viewport (the aurora blobs, the oversized footer wordmark) must never
     be able to produce a horizontal scrollbar; `clip` does that without making
     either element a scroll container, which `hidden` would. */
  overflow-x: clip;
  /* Lenis drives scrolling. Native smooth-scroll on top of it produces two
     competing interpolators and a visible stutter on anchor jumps. */
  scroll-behavior: auto;
}

/* Lenis sets .lenis-smooth on <html>; the two rules below are the library's
   required host styles, inlined so there is no extra stylesheet request. */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  /* The theme swap is a genuine material change, so it is worth animating —
     but only the page ground, never every element (that would cost a repaint
     of the whole tree on each toggle). */
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

img,
picture,
svg,
canvas,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

:where(h1, h2, h3, h4, h5) {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ focus
   Focus is only ever drawn for keyboard users, but when it is drawn it is
   unmissable — a 2px accent ring with an offset so it clears rounded corners. */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

::selection {
  background: color-mix(in oklab, var(--accent) 34%, transparent);
  color: var(--text);
}

/* ---------------------------------------------------------------- scrollbar */
@supports (scrollbar-width: thin) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }
}

/* ------------------------------------------------------------------- utils */
.u-container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.u-prose {
  max-width: var(--maxw-prose);
  color: var(--text-2);
  font-size: var(--t-lg);
}

/* Gradient ink. -webkit-background-clip is still the only cross-browser
   spelling that Safari honours, so both are declared. */
.u-grad {
  background: var(--grad-brand);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  /* Instrument Serif sits on a smaller x-height than Clash Display; without
     the bump an accent word reads a size smaller than the words beside it. */
  font-size: 1.08em;
  letter-spacing: -0.01em;
  /* Italic overhang. With background-clip:text the gradient is clipped to the
     element's box, and the last glyph's tail sits outside it. */
  padding-right: 0.08em;
}

.u-mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.u-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link — visible only once focused, then pinned top-left. */
.u-skip {
  position: fixed;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: 200;
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease-spring);
}
.u-skip:focus-visible {
  transform: translateY(0);
}

/* ------------------------------------------------------------ reduced motion
   Not a blanket kill: the page must still be usable and still communicate
   hierarchy. Transforms and long transitions are removed; opacity fades stay,
   and every scroll-revealed element is forced visible by reveal.js. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
