/* ==========================================================================
   Elvoros — base.css
   Tokens, reset, typography, shared utilities.
   ========================================================================== */

:root {
  /* ===== Command Code — semantic tokens ===== */

  /* Surfaces */
  --surface-base: #000000;
  --surface-strong: #141414;
  --surface-muted: #1a1a1a;
  --surface-elevated: #1c1c1f;

  /* Accent — indigo (derived from color.surface.muted #2e1b9c) */
  --accent: #2e1b9c;
  --accent-strong: #4334c9;
  --accent-foreground: #ffffff;
  --accent-text: #9d8cff;      /* AA on black: 7.63:1 */
  --accent-text-hover: #b9adff;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #e0e0e0;
  --text-inverse: #ffffff;

  /* Borders */
  --border-default: #222225;
  --border-muted: #27272a;
  --border-strong: oklab(0.253187 0.00155123 -0.00536697 / 0.6);

  /* Danger */
  --danger: #f87171;

  /* Shadows (neutral lift — replaces all neon glows) */
  --shadow-1: rgba(0, 0, 0, 0.4) 0px 1px 3px 0px, rgba(0, 0, 0, 0.3) 0px 1px 2px -1px;
  --shadow-2: 0 12px 28px rgba(0, 0, 0, 0.55);

  /* Motion */
  --duration-instant: 150ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* ===== Legacy aliases (keep old CSS working, now retinted) ===== */
  --void: var(--surface-base);
  --void-soft: var(--surface-strong);
  --panel: var(--surface-strong);
  --line: var(--border-default);
  --ink: var(--text-primary);
  --ink-dim: var(--text-secondary);
  --neon-cyan: var(--accent-text);
  --neon-magenta: var(--accent);
  --grid-line: rgba(155, 155, 200, 0.06);
  --glow-cyan: var(--shadow-1);
  --glow-magenta: var(--shadow-1);
  --glow-cyan-strong: var(--shadow-2);
  --tube-cyan: var(--shadow-1);

  /* Type */
  --font-display: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Scale */
  --h1-size: clamp(2.4rem, 6vw, 4.5rem);
  --h2-size: clamp(1.8rem, 4vw, 2.6rem);
  --h3-size: 1.25rem;
  --body-size: 1rem;
  --body-line: 1.5;

  /* Layout */
  --container: 1120px;
  --radius: 14px;
  --nav-h: 4.25rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

* {
  margin: 0;
}

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

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-line);
  color: var(--ink);
  background-color: var(--void);
  -webkit-font-smoothing: antialiased;
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: var(--h1-size);
}

h2 {
  font-size: var(--h2-size);
}

h3 {
  font-size: var(--h3-size);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

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

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section {
  padding-block: clamp(4rem, 9vw, 6.5rem);
}

section[id] {
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}

/* ---------- Focus ---------- */

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 600;
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

.skip-link:hover {
  text-decoration: none;
}

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

::selection {
  background: rgba(157, 140, 255, 0.32);
  color: var(--text-inverse);
}

/* ---------- Scrollbar (themed from palette, not browser default) ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-elevated) transparent;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-elevated);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  border: 3px solid transparent;
  background-clip: padding-box;
}

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

/* Subtle accent emphasis (replaces the old neon text-shadow). */
.text-glow-cyan {
  color: var(--accent-text);
}

/* ---------- Section header ---------- */

.section-header {
  max-width: 42rem;
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.section-header h2 {
  margin-top: 0;
}

.section-header p {
  margin-top: 1rem;
  color: var(--ink-dim);
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 360ms var(--ease), transform 360ms var(--ease);
  transition-delay: calc(var(--reveal-index, 0) * 80ms);
}

.reveal.revealed {
  opacity: 1;
  transform: none;
}

/* ---------- Reduced motion ---------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
