/* ============================================================
   BASE.CSS — Design tokens, reset, typography, shared utilities
   mathisthomsen.de
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
@font-face {
  font-family: 'Space Grotesk';
  src: url('/assets/fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Color — WCAG AA contrast ratios measured on --color-surface (#111111) */
  --color-bg:            #080808;
  --color-surface:       #111111;
  --color-surface-2:     #181818;
  --color-border:        #242424;
  --color-border-subtle: #1a1a1a;
  --color-text-primary:  #f0ede8;   /* ~19:1 on surface ✓ AAA */
  --color-text-secondary:#8a8a82;   /* ~5.5:1 on surface ✓ AA  */
  --color-text-tertiary: #787870;   /* ~4.3:1 on surface / ~4.5:1 on bg */
  --color-accent:        #c8b99a;   /* warm sand — ~6.1:1 on surface ✓ AA */
  --color-accent-dim:    #3d3526;   /* dark sand for subtle borders */
  --color-glitch-r:      #ff003c;
  --color-glitch-c:      #00e5ff;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter',         system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Type scale — fluid via clamp(min, preferred, max) */
  --text-2xs:  clamp(0.625rem, 0.9vw,  0.6875rem);
  --text-xs:   clamp(0.7rem,   1vw,    0.75rem);
  --text-sm:   clamp(0.8rem,   1.2vw,  0.875rem);
  --text-base: clamp(0.9rem,   1.5vw,  1rem);
  --text-lg:   clamp(1rem,     2vw,    1.125rem);
  --text-xl:   clamp(1.1rem,   2.5vw,  1.375rem);
  --text-2xl:  clamp(1.3rem,   3vw,    1.75rem);
  --text-3xl:  clamp(1.8rem,   4vw,    2.5rem);
  --text-4xl:  clamp(2.2rem,   5.5vw,  3.5rem);
  --text-hero: clamp(3.5rem,   10vw,   8.5rem);

  /* Line heights */
  --leading-tight:  1.1;
  --leading-snug:   1.3;
  --leading-base:   1.6;
  --leading-relaxed:1.75;

  /* Letter spacing */
  --tracking-tight:  -0.03em;
  --tracking-normal:  0em;
  --tracking-wide:    0.06em;
  --tracking-widest:  0.15em;

  /* Spacing (0.25rem base unit) */
  --space-1:   0.25rem;
  --space-2:   0.5rem;
  --space-3:   0.75rem;
  --space-4:   1rem;
  --space-5:   1.25rem;
  --space-6:   1.5rem;
  --space-8:   2rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;
  --space-20:  5rem;
  --space-24:  6rem;
  --space-32:  8rem;

  /* Layout */
  --container-max: 72rem;
  --container-pad: clamp(1.25rem, 5vw, 3rem);

  /* Motion */
  --duration-fast:   120ms;
  --duration-base:   280ms;
  --duration-slow:   600ms;
  --duration-xslow:  1200ms;
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);

  /* Borders */
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

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

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

button {
  all: unset;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* ── Scan-line texture (always on, no motion) ──────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.06) 3px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: var(--color-bg);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  z-index: 10000;
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── Visually hidden (screen-reader only) ──────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Focus styles ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ── Shared footer ─────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: var(--space-6) var(--container-pad);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-wide);
  font-family: var(--font-mono);
}

.site-footer a {
  color: var(--color-text-secondary);
  transition: color var(--duration-fast);
}

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

.site-footer__sep {
  margin-inline: var(--space-3);
  opacity: 0.4;
}
