/* ============================================================
   base.css — Rayne Intelligence Concept B
   Reset + design tokens. Palette grounded in Rayne V6:
   tailwind.config.js (ink/accent/hairline) + ag-grid-counsel.css.
   ============================================================ */

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: 5rem;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

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

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

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.12;
  font-weight: 400;
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 68ch;
}

::selection {
  background: color-mix(in oklab, var(--color-accent) 20%, transparent);
  color: var(--color-text);
}

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

@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;
  }
}

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

table {
  border-collapse: collapse;
  width: 100%;
}

a, button, [role='button'], input, textarea, select {
  transition:
    color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.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;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Type scale — editorial. Restrained ceiling; serif display only. */
  --text-xs:   clamp(0.6875rem, 0.66rem + 0.14vw, 0.75rem);   /* 11 → 12 */
  --text-sm:   clamp(0.8125rem, 0.78rem + 0.18vw, 0.875rem);  /* 13 → 14 */
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);       /* 16 → 17 */
  --text-lg:   clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);   /* 18 → 21 */
  --text-xl:   clamp(1.5rem, 1.25rem + 1.1vw, 2.125rem);      /* 24 → 34 */
  --text-2xl:  clamp(2rem, 1.4rem + 2.6vw, 3.25rem);          /* 32 → 52 */
  --text-3xl:  clamp(2.5rem, 1.3rem + 4.4vw, 4.5rem);         /* 40 → 72 */

  /* 4px spacing system */
  --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;

  /* Content widths */
  --content-narrow: 640px;
  --content-text: 760px;
  --content-default: 1000px;
  --content-wide: 1200px;

  /* Fonts — free equivalents to the proprietary V6 Butterick faces:
     Source Serif 4 ≈ Equity (editorial serif display),
     Geist ≈ Concourse (UI/body sans, actually the V6 UI face),
     Geist Mono ≈ Triplicate (data/mono),
     Hanken Grotesk 700 = the exact Rayne wordmark face (BrandMark.jsx). */
  --font-display: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: var(--font-body);
  --font-brand: 'Hanken Grotesk', 'Geist', system-ui, sans-serif;

  /* One identity accent. Legacy token names remain as aliases so every
     existing mark resolves to the restrained mineral accent. */
  --brand-brass: #111111;
  --rayne-violet: #111111;
  --rayne-violet-soft: rgba(82, 100, 92, 0.13);
  --rayne-red: #B42318;
  --marker-red: #111111;
  --marker-red-soft: rgba(82, 100, 92, 0.13);
}

/* ---- LIGHT (default; Concept B) ---- */
:root,
[data-theme='light'] {
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-2: #F5F5F5;
  --color-ink-900: #000000;
  --color-ink-800: #222222;
  --color-ink-700: #333333;
  --color-ink-600: #555555;
  --color-ink-500: #52525B;
  --color-text: #000000;
  --color-text-muted: #222222;
  --color-text-faint: #555555;
  --color-text-inverse: #FFFFFF;

  --color-accent: #111111;
  --color-accent-hover: #333333;

  /* Sharp high-contrast hairlines — crisp black ink borders, zero gray mud */
  --hairline: rgba(9, 9, 11, 0.22);
  --hairline-soft: rgba(9, 9, 11, 0.12);
  --hairline-strong: rgba(9, 9, 11, 0.35);

  --status-denied: #C23B2E;
  --status-partial: #A07207;
  --status-granted: #0F8A4F;
  --photo-wash: rgba(255, 255, 255, 0.95);
}

/* ---- DARK (restrained, not neon) ---- */
[data-theme='dark'] {
  --color-bg: #121316;
  --color-surface: #17181B;
  --color-surface-2: #1C1D21;
  --color-text: #ECEAE3;
  --color-text-muted: #C6C3BA;   /* brighter, warm — no longer foggy */
  --color-text-faint: #9B978C;   /* legible tertiary, not near-invisible */
  --color-text-inverse: #16161A;
  --color-ink-900: #ECEAE3;
  --color-ink-800: #D6D4CD;
  --color-ink-700: #B4B1A9;
  --color-ink-600: #A6A298;
  --color-ink-500: #9A968C;

  --color-accent: #B8C7BB;
  --color-accent-hover: #D6DFD7;
  --brand-brass: #B8C7BB;
  --rayne-violet: #B8C7BB;
  --rayne-violet-soft: rgba(184, 199, 187, 0.2);
  --marker-red: #B8C7BB;
  --marker-red-soft: rgba(184, 199, 187, 0.2);
  --photo-wash: rgba(18, 19, 22, 0.84);

  --hairline: rgba(255, 253, 247, 0.17);
  --hairline-soft: rgba(255, 253, 247, 0.11);
  --hairline-strong: rgba(255, 253, 247, 0.28);

  --status-denied: #E0776C;
  --status-partial: #D0A54B;
  --status-granted: #57B584;
}

/* Light is the default regardless of system prefers-color-scheme.
   Dark applies only when the visitor explicitly opts in via [data-theme='dark']. */
