/* ==========================================================
   AMA Leadership Guide — Design Tokens + Base
   Art direction: Editorial/scholarly. Deep navy + ivory +
   muted gold accent. Serif display + crisp sans body.
   ========================================================== */

: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);
  --text-hero: clamp(3rem, 0.5rem + 7vw, 7rem);

  /* Spacing */
  --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;

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

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

  /* Content widths */
  --content-narrow: 680px;
  --content-default: 1040px;
  --content-wide: 1240px;

  /* Fonts */
  --font-display: 'Fraunces', 'Cambria', 'Georgia', serif;
  --font-body: 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ----- Light mode (default) — warm ivory, ink navy ----- */
:root,
[data-theme='light'] {
  --color-bg: #f6f2ea;          /* ivory */
  --color-surface: #fbf8f1;     /* card */
  --color-surface-2: #ffffff;
  --color-surface-offset: #ebe4d6;
  --color-surface-inverse: #0e1a2b;

  --color-divider: #e2dac8;
  --color-border: #d2c9b3;

  --color-text: #101a2b;        /* ink navy */
  --color-text-muted: #5a6073;
  --color-text-faint: #9a9a8f;
  --color-text-inverse: #f6f2ea;

  --color-primary: #0e3a5f;     /* AMA-esque deep navy */
  --color-primary-hover: #12507f;
  --color-primary-highlight: #d6dfea;

  --color-accent: #a7762a;      /* muted scholarly gold */
  --color-accent-hover: #8b5f1e;
  --color-accent-highlight: #ede1c7;

  --color-success: #3a6a3a;
  --color-success-highlight: #d9e4d2;
  --color-warning: #9a4d1a;
  --color-warning-highlight: #e7d4c2;

  /* Tier colors for pathway stages */
  --tier-student: #7a5ea1;      /* plum */
  --tier-student-bg: #ece4f1;
  --tier-resident: #0e3a5f;     /* navy */
  --tier-resident-bg: #d6dfea;
  --tier-young: #a7762a;        /* gold */
  --tier-young-bg: #ede1c7;
  --tier-attending: #3a6a3a;    /* forest */
  --tier-attending-bg: #d9e4d2;

  --shadow-sm: 0 1px 2px rgba(16, 26, 43, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 26, 43, 0.08);
  --shadow-lg: 0 20px 48px rgba(16, 26, 43, 0.14);
}

/* ----- Dark mode ----- */
[data-theme='dark'] {
  --color-bg: #0d141f;
  --color-surface: #141b28;
  --color-surface-2: #1a2332;
  --color-surface-offset: #1f2a3c;
  --color-surface-inverse: #f6f2ea;

  --color-divider: #243044;
  --color-border: #32425a;

  --color-text: #eae4d4;
  --color-text-muted: #9aa2b4;
  --color-text-faint: #5e6577;
  --color-text-inverse: #0d141f;

  --color-primary: #6ea5d5;
  --color-primary-hover: #95c0e3;
  --color-primary-highlight: #1d3352;

  --color-accent: #d9a85a;
  --color-accent-hover: #ecc27d;
  --color-accent-highlight: #3d2f17;

  --color-success: #86b07e;
  --color-success-highlight: #26382a;
  --color-warning: #d88a57;
  --color-warning-highlight: #3e2b1b;

  --tier-student: #b094d0;
  --tier-student-bg: #2d2439;
  --tier-resident: #6ea5d5;
  --tier-resident-bg: #1d3352;
  --tier-young: #d9a85a;
  --tier-young-bg: #3d2f17;
  --tier-attending: #86b07e;
  --tier-attending-bg: #26382a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-bg: #0d141f;
    --color-surface: #141b28;
    --color-surface-2: #1a2332;
    --color-surface-offset: #1f2a3c;
    --color-divider: #243044;
    --color-border: #32425a;
    --color-text: #eae4d4;
    --color-text-muted: #9aa2b4;
    --color-text-faint: #5e6577;
    --color-primary: #6ea5d5;
    --color-primary-hover: #95c0e3;
    --color-primary-highlight: #1d3352;
    --color-accent: #d9a85a;
    --color-accent-highlight: #3d2f17;
    --tier-student: #b094d0;
    --tier-student-bg: #2d2439;
    --tier-resident: #6ea5d5;
    --tier-resident-bg: #1d3352;
    --tier-young: #d9a85a;
    --tier-young-bg: #3d2f17;
    --tier-attending: #86b07e;
    --tier-attending-bg: #26382a;
  }
}

/* ----- Base ----- */
*, *::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: 80px;
  hanging-punctuation: first last;
}

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: 'ss01', 'cv11';
}

img, svg { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

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

p, li { text-wrap: pretty; }

::selection {
  background: var(--color-accent-highlight);
  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;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a, button, [role='button'] {
  transition: color var(--transition-interactive),
              background var(--transition-interactive),
              border-color var(--transition-interactive),
              box-shadow var(--transition-interactive),
              transform var(--transition-interactive);
}

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