/* ==========================================================================
   base.css — Fonts, global typography, links, focus, utility layer
   Depends on reset.css + tokens.css (loaded after both).
   ========================================================================== */

/* --- Self-hosted fonts ----------------------------------------------------
   woff2 only — see /fonts/FONTS.md for expected files, weights, and licences.
   Fraunces + Inter are variable; we load one file per family and drive
   weight/optical-size via CSS. Mono is a single weight.
   font-display: swap keeps text visible during load (fallbacks in tokens).   */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/Fraunces-Variable.woff2") format("woff2-variations");
  font-weight: 300 600;
  font-stretch: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.woff2") format("woff2-variations");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- Global element styles ----------------------------------------------- */

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: var(--weight-regular);
  /* Inter optical tweaks for screen legibility.                             */
  font-feature-settings: "cv05" 1, "cv08" 1, "ss01" 1;
}

/* Headings use the editorial serif; optical sizing scales with the step.    */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-semi);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-optical-sizing: auto;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); line-height: var(--leading-tight); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p {
  max-width: 60ch; /* readable measure                                       */
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

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

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

/* --- Focus: visible, on-brand, keyboard-only ----------------------------- */

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

:focus:not(:focus-visible) {
  outline: none;
}

/* --- Selection ----------------------------------------------------------- */

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

/* ==========================================================================
   Utility layer — small, composable helpers. Keep it lean.
   ========================================================================== */

/* Layout container — centered band with fluid gutters.                     */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

/* Section vertical rhythm.                                                  */
.section {
  padding-block: var(--space-3xl);
}

/* Monospace eyebrow / section number — "01 / Work".                        */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow__index {
  color: var(--accent);
}

.text-muted {
  color: var(--text-muted);
}

/* The through-line: exactly one burnt-orange keyword per section heading.
   Used sparingly so the accent always reads as a signal, never decoration. */
.accent {
  color: var(--accent);
}

/* Lead paragraph — larger intro copy.                                      */
.lead {
  font-size: var(--step-1);
  line-height: var(--leading-normal);
  color: var(--text);
  max-width: 48ch;
}

/* Visually hidden but available to assistive tech.                         */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — first focusable element.                                     */
.skip-link {
  position: absolute;
  top: 0;
  left: var(--gutter);
  transform: translateY(-120%);
  z-index: var(--z-overlay);
  padding: var(--space-2xs) var(--space-s);
  background-color: var(--accent);
  color: var(--bg);
  font-weight: var(--weight-medium);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--bg);
}

/* --- Buttons -------------------------------------------------------------
   Full interaction states: hover, active (tactile press), focus.           */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-m);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

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

.btn--primary:hover {
  background-color: var(--accent-hover);
  color: var(--bg);
}

.btn--primary:active {
  background-color: var(--accent-press);
  transform: translateY(1px); /* tactile press                              */
}

.btn--ghost {
  background-color: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn--ghost:hover,
.btn--ghost.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--ghost:active {
  transform: translateY(1px);
}

/* --- Grain overlay -------------------------------------------------------
   Fixed, pointer-events-none, very subtle. Texture file dropped later;
   stays inert until then. Disabled under reduced-motion is unnecessary
   (it doesn't animate) but it must never intercept input.                  */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  /* background-image set in sections.css once the noise asset exists.        */
}
