/* ============================================================
   base.css — reset, design tokens, base typography
   ============================================================ */

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

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);

  /* Spacing (4px base) */
  --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;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --content: 1200px;
  --content-narrow: 720px;

  /* Fonts */
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

/* ---------- LIGHT MODE (default) ---------- */
:root,
[data-theme='light'] {
  /* Surfaces — light technical, slight cool steel tint */
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-surface-2: #fafbfc;
  --color-surface-offset: #eceef2;
  --color-divider: #e1e4ea;
  --color-border: #d3d7df;
  --color-border-strong: #b9bec8;

  /* Text — graphite */
  --color-text: #14171c;
  --color-text-muted: #5b626d;
  --color-text-faint: #8e95a1;
  --color-text-inverse: #f7f8fa;

  /* Accent — electric blue (used sparingly) */
  --color-primary: #1e6fe0;
  --color-primary-hover: #1758b9;
  --color-primary-active: #114391;
  --color-primary-soft: rgba(30, 111, 224, 0.1);

  /* Status */
  --color-success: #1f7a3f;
  --color-warning: #b6520f;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(20, 23, 28, 0.06);
  --shadow-md: 0 6px 18px rgba(20, 23, 28, 0.08);
  --shadow-lg: 0 16px 40px rgba(20, 23, 28, 0.12);

  /* Grid lines color */
  --grid-line: rgba(20, 23, 28, 0.05);
}

/* ---------- DARK MODE ---------- */
[data-theme='dark'] {
  --color-bg: #0d0f12;
  --color-surface: #14171c;
  --color-surface-2: #181b21;
  --color-surface-offset: #1c1f26;
  --color-divider: #23272f;
  --color-border: #2a2f38;
  --color-border-strong: #3a414c;

  --color-text: #e6e8ec;
  --color-text-muted: #9aa1ad;
  --color-text-faint: #6b7280;
  --color-text-inverse: #0d0f12;

  --color-primary: #5b9bff;
  --color-primary-hover: #7eb1ff;
  --color-primary-active: #97c1ff;
  --color-primary-soft: rgba(91, 155, 255, 0.14);

  --color-success: #5fbf7d;
  --color-warning: #e2884e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --grid-line: rgba(255, 255, 255, 0.04);
}

/* ---------- ELEMENTS ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  font-feature-settings: 'cv11', 'ss03', 'kern';
}

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

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

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--color-text);
  text-wrap: balance;
}

p, li {
  text-wrap: pretty;
}

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

[data-mono] {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78em;
}

::selection {
  background: var(--color-primary);
  color: #fff;
}

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

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.skip-link:focus {
  top: var(--space-2);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Container */
.container {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-8);
  }
}

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

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