/* ==========================================================================
   GamLEARN Design System — Core Tokens
   Colors · Type · Spacing · Radii · Shadows
   ========================================================================== */

/* ---- Fonts ---- */
@font-face {
  font-family: "Urbanist";
  src: url("fonts/Urbanist-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Urbanist";
  src: url("fonts/Urbanist-Italic-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ====== COLOR — Brand ======
     Primaries come straight from the GamLEARN logo: deep purple + forest green.
     Yellow is the secondary highlight. */
  --color-primary:        #4B0082;   /* Deep Purple — headers, nav, emphasis */
  --color-primary-dark:   #38005F;   /* hover / active */
  --color-primary-light:  #F0E6F7;   /* tinted surfaces, selected rows */

  --color-secondary:      #00664D;   /* Forest Green — supporting emphasis */
  --color-secondary-dark: #004A37;
  --color-secondary-light:#E0EFEA;

  --color-accent:         #FEE581;   /* Soft Yellow — highlight / secondary CTA */
  --color-accent-dark:    #F5D14B;

  /* ====== COLOR — Surface ====== */
  --color-bg:             #FFFFFF;
  --color-sand:           #F5EFE6;   /* warm portal background */
  --color-surface-raised: #FFFFFF;
  --color-surface-sunken: #FAFBFC;

  /* ====== COLOR — Text ====== */
  --color-ink:            #1A1A1A;   /* primary text */
  --color-ink-muted:      #5A6670;   /* secondary text, labels */
  --color-ink-subtle:     #8A929B;   /* placeholder, helper */
  --color-ink-inverse:    #FFFFFF;

  /* ====== COLOR — Border ====== */
  --color-border:         #E1E5E8;   /* default dividers, inputs */
  --color-border-strong:  #C8CFD4;   /* emphasized */
  --color-border-subtle:  #EEF1F3;

  /* ====== COLOR — Semantic ======
     Always pair with icon or text — never color alone. */
  --color-success:        #2E7D5B;
  --color-success-bg:     #E6F1EC;
  --color-warning:        #C9851A;
  --color-warning-bg:     #FBF1DE;
  --color-error:          #C0392B;
  --color-error-bg:       #F8E3E0;
  --color-info:           #2F6FA3;
  --color-info-bg:        #E3EDF5;

  /* CTA = primary purple fill. Yellow is a highlight, not a CTA. */

  /* ====== TYPOGRAPHY ====== */
  --font-heading: "Urbanist", "Inter", system-ui, -apple-system, sans-serif;
  --font-body:    "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale (px) */
  --fs-display:  40px;
  --fs-h1:       32px;
  --fs-h2:       24px;
  --fs-h3:       20px;
  --fs-h4:       16px;
  --fs-body-lg:  16px;
  --fs-body:     14px;
  --fs-body-sm:  13px;
  --fs-caption:  12px;
  --fs-overline: 11px;

  /* Line heights */
  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-normal: 1.5;
  --lh-loose:  1.65;

  /* Weights */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ====== SPACING (4px base) ====== */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;

  /* ====== RADII ====== */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 999px;

  /* ====== SHADOWS — restrained, never hot ====== */
  --shadow-xs: 0 1px 2px rgba(75, 0, 130, 0.06);
  --shadow-sm: 0 1px 3px rgba(75, 0, 130, 0.08), 0 1px 2px rgba(75, 0, 130, 0.04);
  --shadow-md: 0 4px 12px rgba(75, 0, 130, 0.10), 0 2px 4px rgba(75, 0, 130, 0.04);
  --shadow-lg: 0 12px 32px rgba(75, 0, 130, 0.14);

  /* ====== LAYOUT ====== */
  --shell-sidebar:          240px;
  --shell-sidebar-collapsed: 64px;
  --shell-topbar:           64px;
  --max-crm:                1280px;
  --max-portal:             960px;
  --grid-columns:           12;
  --grid-gutter:            24px;

  /* ====== FOCUS ====== */
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-primary);

  /* ====== MOTION — restrained, no bounce ====== */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);
  --dur-fast: 120ms;
  --dur-med:  200ms;
  --dur-slow: 320ms;
}

/* ==========================================================================
   Base / semantic element styles
   ========================================================================== */

html { font-family: var(--font-body); color: var(--color-ink); background: var(--color-bg); }
body { margin: 0; font-size: var(--fs-body); line-height: var(--lh-normal); font-feature-settings: "tnum" 1, "cv11" 1; }

/* Tabular numbers everywhere */
* { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: var(--lh-snug);
}

.display  { font-size: var(--fs-display); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.02em; font-family: var(--font-heading); color: var(--color-primary); }
h1, .h1   { font-size: var(--fs-h1); letter-spacing: -0.015em; }
h2, .h2   { font-size: var(--fs-h2); }
h3, .h3   { font-size: var(--fs-h3); }
h4, .h4   { font-size: var(--fs-h4); font-weight: var(--fw-semibold); }

p         { margin: 0 0 var(--space-4); line-height: var(--lh-normal); text-wrap: pretty; }
.body-lg  { font-size: var(--fs-body-lg); line-height: var(--lh-loose); }
.body     { font-size: var(--fs-body); }
.body-sm  { font-size: var(--fs-body-sm); }
.caption  { font-size: var(--fs-caption); color: var(--color-ink-muted); }
.overline { font-size: var(--fs-overline); text-transform: uppercase; letter-spacing: 0.08em; font-weight: var(--fw-semibold); color: var(--color-ink-muted); }

a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--color-primary-dark); }

code, pre, kbd { font-family: var(--font-mono); font-size: 0.92em; }

/* Focus — always visible */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
