/* ===== GIFBR BASE STYLES ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

/* ===== DESIGN TOKENS ===== */
:root {
  /* Type scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    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: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px oklch(0.15 0.02 240 / 0.10);
  --shadow-md: 0 4px 16px oklch(0.15 0.02 240 / 0.14);
  --shadow-lg: 0 12px 40px oklch(0.15 0.02 240 / 0.18);

  /* Content widths */
  --content-narrow:  640px;
  --content-default: 960px;
  --content-wide:   1200px;

  /* Fonts */
  --font-display: 'DM Serif Display', 'Georgia', serif;
  --font-body:    'Inter', 'Helvetica Neue', sans-serif;
}

/* ===== LIGHT MODE (default) ===== */
:root, [data-theme="light"] {
  --color-bg:             #F4F6F9;
  --color-surface:        #FFFFFF;
  --color-surface-2:      #EEF1F6;
  --color-surface-offset: #E4E8F0;
  --color-border:         #D1D8E4;
  --color-divider:        #DDE2EC;

  --color-text:        #111827;
  --color-text-muted:  #4B5563;
  --color-text-faint:  #9CA3AF;
  --color-text-inverse:#F9FAFB;

  /* Deep navy primary */
  --color-primary:          #1B3A6B;
  --color-primary-hover:    #142d55;
  --color-primary-active:   #0e2040;
  --color-primary-highlight:#D0DCF0;

  /* Teal accent — tuned to match the hero gradient's brighter teal end
     stop (#11A0B5) so buttons, links, and the banner share one hue family. */
  --color-accent:        #11A0B5;
  --color-accent-hover:  #0D8399;
  --color-accent-active: #0A6878;
  --color-accent-light:  #D6F0F5;

  /* Tertiary brand — echoes the neuron color in the GIFBR mark.
     Desaturated from the raw logo violet (#b76af4) so it sits comfortably
     next to the navy/teal palette without screaming. */
  --color-brand-purple:        #8A5BC7;
  --color-brand-purple-soft:   #E7DCF5;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --color-bg:             #0D1117;
  --color-surface:        #161B22;
  --color-surface-2:      #1C2230;
  --color-surface-offset: #1A2030;
  --color-border:         #2A3347;
  --color-divider:        #222B3C;

  --color-text:        #E8EDF5;
  --color-text-muted:  #8B96AA;
  --color-text-faint:  #4A5568;
  --color-text-inverse:#111827;

  --color-primary:          #4A7CC4;
  --color-primary-hover:    #6090D4;
  --color-primary-active:   #7AA4E0;
  --color-primary-highlight:#1E2E48;

  --color-accent:       #3DC4D9;
  --color-accent-hover: #5AD3E5;
  --color-accent-active:#7EE0F0;
  --color-accent-light: #0F3540;

  --color-brand-purple:      #A986D9;
  --color-brand-purple-soft: #2A1E3F;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #0D1117;
    --color-surface:        #161B22;
    --color-surface-2:      #1C2230;
    --color-surface-offset: #1A2030;
    --color-border:         #2A3347;
    --color-divider:        #222B3C;
    --color-text:        #E8EDF5;
    --color-text-muted:  #8B96AA;
    --color-text-faint:  #4A5568;
    --color-text-inverse:#111827;
    --color-primary:          #4A7CC4;
    --color-primary-hover:    #6090D4;
    --color-primary-active:   #7AA4E0;
    --color-primary-highlight:#1E2E48;
    --color-accent:       #3DC4D9;
    --color-accent-hover: #5AD3E5;
    --color-accent-active:#7EE0F0;
    --color-accent-light: #0F3540;
  }
}

/* ===== BASE RESETS ===== */
body {
  min-height: 100dvh;
  line-height: 1.65;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: clip;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.2;
  font-family: var(--font-display);
  color: var(--color-text);
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 70ch;
}

a, button, [role="button"] {
  transition: color var(--transition), background var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              opacity var(--transition);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }

ul[role="list"], ol[role="list"] { list-style: none; }

::selection {
  background: color-mix(in oklch, var(--color-accent) 25%, transparent);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@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;
  }
}

.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;
}
