/* ==========================================================================
   ABONEX Solutions — Base: reset, typography primitives, global texture
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--space-6));
}

body {
  background: var(--paper);
  color: var(--type);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

body.is-locked { overflow: hidden; }

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

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

ul, ol { list-style: none; padding: 0; }

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

:is(h1, h2, h3, h4, h5, h6) {
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p { text-wrap: pretty; }

/* ------------------------------------------------------- TYPE PRIMITIVES */

.display-xl,
.display-l,
.display-m,
.display-s {
  font-weight: 500;
  color: var(--type);
}

.display-xl { font-size: var(--fs-display-xl); line-height: var(--lh-tight); letter-spacing: var(--ls-tightest); }
.display-l  { font-size: var(--fs-display-l);  line-height: .98;            letter-spacing: var(--ls-tighter); }
.display-m  { font-size: var(--fs-display-m);  line-height: var(--lh-snug); letter-spacing: var(--ls-tight); }
.display-s  { font-size: var(--fs-display-s);  line-height: 1.2;            letter-spacing: var(--ls-tight); }

/* The accent voice. One or two words per headline — never a whole line. */
.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
}

/* In a headline the serif italic now carries the accent as well as the voice
   shift - it is already the one word doing the work, so it takes the one
   colour too. --accent, never --accent-hi: the bright cyan is 2.36:1 on paper
   and must not set type (see DESIGN.md). On the dark grounds the on-ink cyan
   takes over at 8.62:1. */
:is(h1, h2) .serif { color: var(--accent); }

.hero :is(h1, h2) .serif,
.section--ink :is(h1, h2) .serif { color: var(--accent-on-ink); }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-normal);
  color: var(--type-muted);
  max-width: 54ch;
}

.body-muted { color: var(--type-muted); }

/* Mono meta label — section numbers, eyebrows, field labels, tags */
.meta {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: var(--ls-meta);
  text-transform: uppercase;
  line-height: 1;
  color: var(--type-muted);
}

.meta--accent { color: var(--accent); }
.meta--faint  { color: var(--type-faint); }

/* Inline link with a rule that grows from the left */
.link {
  color: var(--accent);
  position: relative;
  display: inline-block;
  padding-bottom: 1px;
}
.link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-micro) var(--ease-out-quart);
}
.link:hover::after,
.link:focus-visible::after { transform: scaleX(1); }

/* ------------------------------------------------------------- SELECTION */

::selection { background: var(--selection-bg); color: var(--selection-fg); }

/* ----------------------------------------------------------------- FOCUS */

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.on-ink :focus-visible { outline-color: var(--accent-on-ink); }

/* ------------------------------------------------------------- SKIP LINK */

.skip {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform var(--dur-micro) var(--ease-out-quart);
}
.skip:focus-visible { transform: translateY(0); }

/* ------------------------------------------------------- PAPER TEXTURE
   A 2.5% fractal-noise overlay. This is what stops large flat areas of
   --paper reading as flat digital white, and it costs one data URI. */

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: .028;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------- SCROLL PROGRESS */

.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 2px;
  z-index: calc(var(--z-nav) + 1);
  pointer-events: none;
  background: transparent;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent-hi);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

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

/* `.sr-only` is aliased deliberately: it is the near-universal name for this
   utility, so reaching for it should never silently render visible text. */
.visually-hidden,
.sr-only {
  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;
}

.hairline { height: 1px; background: var(--hairline); border: 0; }
.on-ink .hairline { background: var(--hairline-ink); }

/* ------------------------------------------------------- SCROLL REVEALS
   One IntersectionObserver adds .is-visible. --d carries the stagger index.

   Every rule here is gated behind `html.js`, set by an inline script in the
   <head>. Anything that starts at opacity 0 and relies on JS to become
   visible is a blank page when a script fails to load — so with no JS the
   starting state never applies at all. */

.line-mask { display: block; overflow: hidden; }

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-reveal) var(--ease-out-expo),
    transform var(--dur-reveal) var(--ease-out-expo);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Line-by-line mask reveal, used on the hero headline */
.js .line-mask > span {
  display: block;
  transform: translateY(105%);
  transition: transform var(--dur-hero) var(--ease-out-expo);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js .is-loaded .line-mask > span { transform: none; }

/* --------------------------------------------------------- REDUCED MOTION
   Full kill-switch. Nothing animates, and nothing is left invisible. */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal { opacity: 1 !important; transform: none !important; }
  .js .line-mask > span { transform: none !important; }
  .hero__composition { transform: none !important; }
}
