/* ============================================================================
   SecondWave — Base layer
   ----------------------------------------------------------------------------
   Reset, document defaults, and bare element styling. Load order matters:
     1. tokens.css   2. base.css   3. components.css   4. page-specific CSS
   Nothing in this file uses a raw value; everything comes from tokens.css.
   ========================================================================== */

/* --- Type face -------------------------------------------------------------
   Self-hosted variable font (weight range 400-700), latin subset only —
   see PLAN.md M0.7. No external font request, no render-blocking CSS import.
   ----------------------------------------------------------------------- */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/archivo-variable-latin.woff2') format('woff2');
}

/* --- Reset ---------------------------------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Anchor links and scroll-to must not hide content under the sticky header */
  scroll-padding-top: var(--space-8);
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* svh, not dvh: dvh recalculates on every frame of the mobile browser's
     address-bar collapse, which reflows the whole page while scrolling and
     makes the fixed .tabbar visibly judder. svh is the stable, small-viewport
     value (chrome fully shown) so this stops fighting that animation. */
  min-height: 100svh;
  /* The bottom nav is fixed on mobile; keep content clear of it and of the
     home indicator on iOS. */
  padding-bottom: env(safe-area-inset-bottom);
}

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

/* Listing photography is the product. Square by default, never rounded. */
img {
  height: auto;
  background: var(--bg-recessed);
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* --- Typography ----------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-semi);
  line-height: var(--leading-snug);
  letter-spacing: var(--track-heading);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  letter-spacing: var(--track-display);
}

h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-body-lg); }

p {
  text-wrap: pretty;
}

/* Long-form copy gets a readable measure. Apply to about pages, policies,
   gear guides — not to UI labels. */
.prose {
  max-width: var(--prose-max);
  line-height: var(--leading-loose);
  color: var(--text-secondary);
}

.prose > * + * {
  margin-top: var(--space-4);
}

/* The page-owning headline. Used once per page, at most. */
.display {
  font-size: var(--text-display);
  font-weight: var(--weight-semi);
  line-height: var(--leading-tight);
  letter-spacing: var(--track-display);
  text-wrap: balance;
}

/* Uppercase micro-label. The only place positive tracking is allowed. */
.label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

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

/* Numeric alignment for prices, distances, sizes and volumes. Tabular figures
   stop columns of numbers from jittering. */
.numeric {
  font-variant-numeric: tabular-nums;
}

/* --- Links ---------------------------------------------------------------- */

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--text-secondary);
}

/* --- Focus ---------------------------------------------------------------- */
/* Because the palette is monochrome, the focus ring is the main way keyboard
   users orient themselves. It is deliberately loud. Never remove it, and never
   replace it with `outline: none` plus a border change. */

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

/* Pills keep their shape when focused. */
.btn:focus-visible,
.chip:focus-visible,
.badge:focus-visible {
  border-radius: var(--radius-pill);
}

/* --- Skip link ------------------------------------------------------------ */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-4);
  background: var(--ink-100);
  color: var(--ground-100);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-semi);
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-out);
}

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

/* --- Layout helpers ------------------------------------------------------- */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 768px) {
  .page {
    padding-inline: var(--gutter-lg);
  }
}

.stack > * + * {
  margin-top: var(--flow, var(--space-4));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.rule {
  border: 0;
  border-top: var(--rule);
}

/* Screen-reader-only. Use for icon-button labels and visually redundant text
   that assistive technology still needs. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
