/**
 * ============================================================
 * GRADEWISE CORE STYLESHEET  |  gradewise-core.css  |  v1.0
 * ============================================================
 * Full guide: ~/gradewise/NEW_PAGE_GUIDE.md
 * Design System Bible: ~/gradewise/DESIGN_SYSTEM.md
 * ============================================================
 *
 * QUICK START — every new page needs these three things:
 *
 *   1. FONTS in <head>:
 *      <link rel="preconnect" href="https://fonts.googleapis.com">
 *      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 *      <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap" rel="stylesheet">
 *
 *   2. THIS FILE first in <head>:
 *      <link rel="stylesheet" href="/assets/css/gradewise-core.css">
 *
 *   3. ZONE CLASS on <body>:
 *      <body class="zone-library">     ← warm editorial (default)
 *      <body class="zone-platform">    ← dashboards, teacher tools
 *      <body class="zone-games">       ← dark UI, Vocab Royale, etc.
 *      <body class="zone-slideshow">   ← projector / lesson mode
 *
 * ── PER-GUIDE ACCENT OVERRIDES ─────────────────────────────
 *   Add a second class to <body>:
 *      <body class="zone-library guide-romeo">
 *
 *   guide-romeo / guide-handmaids  → Crimson  #8B1A1A
 *   guide-twelfth-night            → Royal    #4A1A6B
 *   guide-hamlet                   → Slate    #2C3E50
 *   guide-olive                    → Olive    #3A5A2A
 *
 * ── PER-PAGE / PER-SCHOOL OVERRIDE ────────────────────────
 *   Drop a <style> block after this stylesheet:
 *   <style>
 *     :root {
 *       --zone-accent:        #YOUR_COLOR;
 *       --zone-accent-light:  #YOUR_LIGHT;
 *       --zone-accent-faint:  rgba(r,g,b,0.06);
 *       --zone-accent-border: rgba(r,g,b,0.20);
 *     }
 *   </style>
 *
 * ── KEY VARIABLES TO USE IN PAGE CSS ──────────────────────
 *   --page-bg            page background
 *   --surface            card / panel background
 *   --surface-secondary  subtle contrast areas
 *   --text-primary       headings, labels
 *   --text-secondary     body text
 *   --text-tertiary      meta / captions
 *   --zone-accent        primary action color
 *   --zone-accent-faint  light tint of accent
 *   --zone-divider-color gold line color (Library) or border (Platform)
 *   --font-display       Cormorant Garamond
 *   --font-body          DM Sans
 *
 * ── READY-MADE COMPONENTS ─────────────────────────────────
 *   .card .card-body .card-header .card-footer .card-accent-bar
 *   .btn .btn-primary .btn-ghost .btn-gold .btn-danger .btn-sm .btn-lg
 *   .badge .badge-accent .badge-gold .badge-success .badge-error
 *   .tag
 *   .form-group .form-label .form-control
 *   .alert .alert-info .alert-success .alert-warning .alert-error
 *   .topbar .topbar-logo .topbar-actions
 *   .sidebar .sidebar-nav-item .sidebar-section-label
 *   .spinner .spinner-lg .fade-in-up .stagger-1…6
 *   .eyebrow .lead .meta .caption
 *   .section-divider  (gold ruled line with centered text)
 *   .container .container-sm/md/lg/2xl
 *   .page-wrapper     (min-height:100vh, pads for topbar)
 *
 * ── NEVER DO ──────────────────────────────────────────────
 *   ✗ Hardcode hex colors in page CSS — use variables
 *   ✗ Load this file after page-specific CSS
 *   ✗ Override :root zone variables inside a component rule
 *
 * ============================================================
 */


/* ============================================================
   GOOGLE FONTS — Include in HTML <head> on every page
   ============================================================
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap" rel="stylesheet">
   ============================================================ */


/* ============================================================
   1. GLOBAL RESET & BOX MODEL
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    display: block;
}

a {
    color: var(--zone-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--zone-accent-light);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}


/* ============================================================
   2. DESIGN TOKENS — FOUNDATION (Never changes across zones)
   ============================================================ */

:root {

    /* ── Fonts ─────────────────────────────────────────── */
    --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

    /* ── Type Scale ────────────────────────────────────── */
    --text-xs:   0.70rem;   /* 11.2px — captions, copyright */
    --text-sm:   0.75rem;   /* 12px   — meta, tags */
    --text-base: 0.875rem;  /* 14px   — body (platform-density) */
    --text-md:   1rem;      /* 16px   — standard body */
    --text-lg:   1.125rem;  /* 18px   — lead text */
    --text-xl:   1.25rem;   /* 20px   — card titles */
    --text-2xl:  1.5rem;    /* 24px   — section headings */
    --text-3xl:  2rem;      /* 32px   — page titles */
    --text-4xl:  2.5rem;    /* 40px   — hero headings */
    --text-5xl:  3.5rem;    /* 56px   — display */

    /* ── Foundation Surfaces ───────────────────────────── */
    --cream:         #FAF7F2;
    --cream-dark:    #F0EBE3;
    --parchment:     #F5F0E8;
    --white:         #FFFFFF;

    /* ── Ink Scale ─────────────────────────────────────── */
    --ink:           #1A1A1A;
    --ink-light:     #4A4A4A;
    --ink-lighter:   #7A7A7A;
    --ink-faint:     #B0A899;

    /* ── Border & Divider ──────────────────────────────── */
    --border:        rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --border-color:  #E5DED4;  /* solid equivalent for border-color use */

    /* ── Shadows ───────────────────────────────────────── */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 2px 6px rgba(0,0,0,0.07);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.09);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl:  0 16px 48px rgba(0,0,0,0.16);

    /* ── Radius ────────────────────────────────────────── */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-2xl: 24px;
    --radius-pill: 999px;

    /* ── Spacing ───────────────────────────────────────── */
    --space-1:  0.25rem;   /* 4px */
    --space-2:  0.5rem;    /* 8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */

    /* ── Transitions ───────────────────────────────────── */
    --transition-fast:   0.15s ease;
    --transition-base:   0.25s ease;
    --transition-slow:   0.4s ease;

    /* ── Z-Index Scale ─────────────────────────────────── */
    --z-below:   -1;
    --z-base:     0;
    --z-above:    1;
    --z-sticky:   100;
    --z-overlay:  200;
    --z-modal:    300;
    --z-toast:    400;

    /* ── Layout ────────────────────────────────────────── */
    --container-sm:  640px;
    --container-md:  768px;
    --container-lg:  1024px;
    --container-xl:  1200px;
    --container-2xl: 1400px;

    /* ── Topbar ────────────────────────────────────────── */
    --topbar-height: 56px;

    /* ── Static Accent Colors (non-zone-specific use) ──── */
    --accent:          #1A3A5C;
    --accent-light:    #2A5A8C;
    --accent-faint:    rgba(26, 58, 92, 0.06);

    --gold:            #B8860B;
    --gold-light:      #D4A843;
    --gold-faint:      rgba(184, 134, 11, 0.08);
    --gold-border:     rgba(184, 134, 11, 0.25);

    --crimson:         #8B1A1A;
    --crimson-light:   #C0392B;
    --crimson-faint:   rgba(139, 26, 26, 0.06);

    --emerald:         #1A5C3A;
    --emerald-light:   #27AE60;
    --emerald-faint:   rgba(26, 92, 58, 0.06);

    --royal:           #4A1A6B;
    --royal-light:     #7B3FC4;
    --royal-faint:     rgba(74, 26, 107, 0.06);

    --olive:           #3A5A2A;
    --olive-light:     #5A8A42;
    --olive-faint:     rgba(58, 90, 42, 0.06);

    --slate:           #2C3E50;
    --slate-light:     #34495E;
    --slate-faint:     rgba(44, 62, 80, 0.06);

    /* ── Semantic Feedback Colors ───────────────────────── */
    --color-success:       #1A5C3A;
    --color-success-bg:    #EBF7F1;
    --color-success-border: rgba(26,92,58,0.2);

    --color-warning:       #92610A;
    --color-warning-bg:    #FEF9EC;
    --color-warning-border: rgba(184,134,11,0.25);

    --color-error:         #8B1A1A;
    --color-error-bg:      #FDEAEA;
    --color-error-border:  rgba(139,26,26,0.2);

    --color-info:          #1A3A5C;
    --color-info-bg:       #EAF0F7;
    --color-info-border:   rgba(26,58,92,0.2);

    /* ── Games Zone Colors (used within .zone-games) ────── */
    --game-dark:       #0F172A;
    --game-darker:     #080E1A;
    --game-blue:       #667EEA;
    --game-purple:     #7C3AED;
    --game-pink:       #EC4899;
    --game-surface:    rgba(255,255,255,0.05);
    --game-surface-md: rgba(255,255,255,0.08);
    --game-text:       #F1F5F9;
    --game-text-muted: rgba(241,245,249,0.65);
    --game-border:     rgba(255,255,255,0.1);
}


/* ============================================================
   3. ZONE SYSTEM — CSS Variable Overrides
   ============================================================
   Each zone resets the "active" variables that components use.
   Components reference --page-bg, --zone-accent, etc.
   Never hard-code zone colors in component rules.
   ============================================================ */

/* ── Library Zone (Default) ────────────────────────────────
   Warm, editorial, scholarly. Cormorant headings, cream bg.
   ─────────────────────────────────────────────────────────── */
:root,
.zone-library {
    --page-bg:             var(--cream);
    --surface:             var(--white);
    --surface-secondary:   var(--cream-dark);
    --surface-hover:       var(--parchment);
    --text-primary:        var(--ink);
    --text-secondary:      var(--ink-light);
    --text-tertiary:       var(--ink-lighter);
    --text-disabled:       var(--ink-faint);

    --zone-accent:         var(--accent);         /* #1A3A5C navy */
    --zone-accent-light:   var(--accent-light);   /* #2A5A8C */
    --zone-accent-faint:   var(--accent-faint);   /* rgba(26,58,92,0.06) */
    --zone-accent-border:  rgba(26, 58, 92, 0.2);

    --zone-heading-font:   var(--font-display);
    --zone-body-font:      var(--font-body);

    --zone-topbar-bg:      var(--white);
    --zone-topbar-border:  var(--border);
    --zone-topbar-text:    var(--ink);
    --zone-topbar-logo:    var(--accent);

    --zone-sidebar-bg:     var(--white);
    --zone-sidebar-hover:  var(--parchment);
    --zone-sidebar-active: var(--accent-faint);
    --zone-sidebar-text:   var(--ink-light);
    --zone-sidebar-active-text: var(--accent);

    --zone-card-bg:        var(--white);
    --zone-card-border:    var(--border);
    --zone-card-shadow:    var(--shadow-sm);

    --zone-btn-primary-bg:   var(--accent);
    --zone-btn-primary-text: var(--white);
    --zone-btn-primary-hover: var(--accent-light);
    --zone-btn-ghost-text:   var(--accent);

    --zone-input-bg:       var(--white);
    --zone-input-border:   var(--border-strong);
    --zone-input-focus:    var(--accent);

    --zone-divider-color:  var(--gold);  /* gold eyebrow lines */
}


/* ── Platform Zone ─────────────────────────────────────────
   Same warm base as Library but more utilitarian. Dashboards,
   grading, admin, teacher tools.
   ─────────────────────────────────────────────────────────── */
.zone-platform {
    --page-bg:             var(--cream);
    --surface:             var(--white);
    --surface-secondary:   var(--cream-dark);
    --surface-hover:       var(--parchment);
    --text-primary:        var(--ink);
    --text-secondary:      var(--ink-light);
    --text-tertiary:       var(--ink-lighter);
    --text-disabled:       var(--ink-faint);

    --zone-accent:         var(--accent);
    --zone-accent-light:   var(--accent-light);
    --zone-accent-faint:   var(--accent-faint);
    --zone-accent-border:  rgba(26, 58, 92, 0.2);

    --zone-heading-font:   var(--font-body);      /* Platform uses DM Sans for headings */
    --zone-body-font:      var(--font-body);

    --zone-topbar-bg:      var(--white);
    --zone-topbar-border:  var(--border);
    --zone-topbar-text:    var(--ink);
    --zone-topbar-logo:    var(--accent);

    --zone-sidebar-bg:     var(--white);
    --zone-sidebar-hover:  var(--parchment);
    --zone-sidebar-active: var(--accent-faint);
    --zone-sidebar-text:   var(--ink-light);
    --zone-sidebar-active-text: var(--accent);

    --zone-card-bg:        var(--white);
    --zone-card-border:    var(--border);
    --zone-card-shadow:    var(--shadow-sm);

    --zone-btn-primary-bg:   var(--accent);
    --zone-btn-primary-text: var(--white);
    --zone-btn-primary-hover: var(--accent-light);
    --zone-btn-ghost-text:   var(--accent);

    --zone-input-bg:       var(--white);
    --zone-input-border:   var(--border-strong);
    --zone-input-focus:    var(--accent);

    --zone-divider-color:  var(--border-color);   /* Neutral divider, not gold */
}


/* ── Games Zone ────────────────────────────────────────────
   Dark atmospheric UI. Vocab Royale, Knowledge Quest, etc.
   ─────────────────────────────────────────────────────────── */
.zone-games {
    --page-bg:             var(--game-dark);
    --surface:             var(--game-surface);
    --surface-secondary:   var(--game-surface-md);
    --surface-hover:       rgba(255,255,255,0.12);
    --text-primary:        var(--game-text);
    --text-secondary:      var(--game-text-muted);
    --text-tertiary:       rgba(241,245,249,0.45);
    --text-disabled:       rgba(241,245,249,0.25);

    --zone-accent:         var(--game-blue);
    --zone-accent-light:   #8B9FFF;
    --zone-accent-faint:   rgba(102, 126, 234, 0.15);
    --zone-accent-border:  rgba(102, 126, 234, 0.3);

    --zone-heading-font:   var(--font-body);
    --zone-body-font:      var(--font-body);

    --zone-topbar-bg:      var(--game-darker);
    --zone-topbar-border:  var(--game-border);
    --zone-topbar-text:    var(--game-text);
    --zone-topbar-logo:    var(--game-blue);

    --zone-sidebar-bg:     rgba(255,255,255,0.04);
    --zone-sidebar-hover:  var(--game-surface-md);
    --zone-sidebar-active: rgba(102, 126, 234, 0.15);
    --zone-sidebar-text:   var(--game-text-muted);
    --zone-sidebar-active-text: var(--game-blue);

    --zone-card-bg:        var(--game-surface);
    --zone-card-border:    var(--game-border);
    --zone-card-shadow:    0 4px 20px rgba(0,0,0,0.4);

    --zone-btn-primary-bg:   var(--game-blue);
    --zone-btn-primary-text: var(--white);
    --zone-btn-primary-hover: #7B8EFF;
    --zone-btn-ghost-text:   var(--game-blue);

    --zone-input-bg:       rgba(255,255,255,0.07);
    --zone-input-border:   var(--game-border);
    --zone-input-focus:    var(--game-blue);

    --zone-divider-color:  var(--game-border);

    color-scheme: dark;
}


/* ── Slideshow Zone ────────────────────────────────────────
   Projection-ready. Large type. Neutral bg.
   Accent is inherited from Library by default but can be
   overridden per deck with a page-level :root {} block.
   ─────────────────────────────────────────────────────────── */
.zone-slideshow {
    --page-bg:             #F9FAFB;
    --surface:             var(--white);
    --surface-secondary:   #F1F5F9;
    --surface-hover:       #E8EDF2;
    --text-primary:        var(--ink);
    --text-secondary:      var(--ink-light);
    --text-tertiary:       var(--ink-lighter);
    --text-disabled:       var(--ink-faint);

    --zone-accent:         var(--accent);
    --zone-accent-light:   var(--accent-light);
    --zone-accent-faint:   var(--accent-faint);
    --zone-accent-border:  rgba(26, 58, 92, 0.2);

    --zone-heading-font:   var(--font-display);
    --zone-body-font:      var(--font-body);

    --zone-card-bg:        var(--white);
    --zone-card-border:    var(--border);
    --zone-card-shadow:    var(--shadow-md);

    --zone-btn-primary-bg:   var(--accent);
    --zone-btn-primary-text: var(--white);
    --zone-btn-primary-hover: var(--accent-light);
    --zone-btn-ghost-text:   var(--accent);

    --zone-input-bg:       var(--white);
    --zone-input-border:   var(--border-strong);
    --zone-input-focus:    var(--accent);

    --zone-divider-color:  var(--gold);

    /* Slideshow-specific: projector font sizes */
    --slide-h1:   3rem;
    --slide-h2:   2.2rem;
    --slide-h3:   1.1rem;
    --slide-body: 1.25rem;
    --slide-def:  1.3rem;
    --slide-q:    1.8rem;
}

/* Projector Mode — triggered by .projector-mode on <body> or slide container */
.projector-mode {
    --slide-h1:   4.2rem;
    --slide-h2:   3rem;
    --slide-h3:   1.4rem;
    --slide-body: 1.7rem;
    --slide-def:  1.75rem;
    --slide-q:    2.4rem;
}


/* ============================================================
   4. PER-GUIDE ACCENT OVERRIDES
   ============================================================
   Apply these classes to <body> or a wrapper element alongside
   a zone class to swap the accent color for specific guides.

   Example: <body class="zone-library guide-romeo">

   Or override inline in a <style> block if per-page:
     :root { --zone-accent: #8B1A1A; }
   ============================================================ */

.guide-romeo,
.guide-handmaids {
    --zone-accent:        var(--crimson);
    --zone-accent-light:  var(--crimson-light);
    --zone-accent-faint:  var(--crimson-faint);
    --zone-accent-border: rgba(139, 26, 26, 0.2);
    --zone-divider-color: var(--crimson);
}

.guide-twelfth-night {
    --zone-accent:        var(--royal);
    --zone-accent-light:  var(--royal-light);
    --zone-accent-faint:  var(--royal-faint);
    --zone-accent-border: rgba(74, 26, 107, 0.2);
    --zone-divider-color: var(--royal);
}

.guide-hamlet {
    --zone-accent:        var(--slate);
    --zone-accent-light:  var(--slate-light);
    --zone-accent-faint:  var(--slate-faint);
    --zone-accent-border: rgba(44, 62, 80, 0.2);
    --zone-divider-color: var(--slate);
}

.guide-olive {
    --zone-accent:        var(--olive);
    --zone-accent-light:  var(--olive-light);
    --zone-accent-faint:  var(--olive-faint);
    --zone-accent-border: rgba(58, 90, 42, 0.2);
    --zone-divider-color: var(--olive);
}


/* ============================================================
   5. TYPOGRAPHY — GLOBAL RULES
   ============================================================ */

h1, h2, h3 {
    font-family: var(--zone-heading-font, var(--font-display));
    color: var(--text-primary);
    line-height: 1.2;
}

h4, h5, h6 {
    font-family: var(--zone-body-font, var(--font-body));
    color: var(--text-primary);
    line-height: 1.3;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.eyebrow {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--zone-divider-color, var(--gold));
}

.lead {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    line-height: 1.6;
}

.meta {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.caption {
    font-size: var(--text-xs);
    color: var(--text-disabled);
}

code, pre {
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.875em;
}

code {
    background: var(--surface-secondary);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--zone-accent);
}


/* ============================================================
   6. LAYOUT UTILITIES
   ============================================================ */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: var(--space-6);
}

.container-sm  { max-width: var(--container-sm); }
.container-md  { max-width: var(--container-md); }
.container-lg  { max-width: var(--container-lg); }
.container-2xl { max-width: var(--container-2xl); }

.page-wrapper {
    min-height: 100vh;
    background: var(--page-bg);
    padding-top: var(--topbar-height);
}

.section {
    padding-block: var(--space-16);
}

.section-sm {
    padding-block: var(--space-8);
}

/* Gold section divider bar (Library Zone staple) */
.section-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--zone-divider-color, var(--gold));
    opacity: 0.35;
}

.section-divider::before {
    max-width: 48px;
}


/* ============================================================
   7. CARD COMPONENT
   ============================================================ */

.card {
    background: var(--zone-card-bg, var(--white));
    border: 1px solid var(--zone-card-border, var(--border));
    border-radius: var(--radius-lg);
    box-shadow: var(--zone-card-shadow, var(--shadow-sm));
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: var(--space-6);
}

.card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--zone-card-border, var(--border));
    background: var(--surface-secondary);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--zone-card-border, var(--border));
    background: var(--surface-secondary);
}

/* Accent gradient bar at top of card (Library Zone guide cards) */
.card-accent-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--zone-accent), var(--zone-accent-light));
}


/* ============================================================
   8. BUTTON SYSTEM
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--zone-btn-primary-bg);
    color: var(--zone-btn-primary-text);
}

.btn-primary:hover {
    background: var(--zone-btn-primary-hover);
    color: var(--zone-btn-primary-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--zone-btn-ghost-text);
    border: 1px solid var(--zone-accent-border, var(--border-strong));
}

.btn-ghost:hover {
    background: var(--zone-accent-faint);
    color: var(--zone-btn-ghost-text);
}

.btn-gold {
    background: var(--gold);
    color: var(--white);
}

.btn-gold:hover {
    background: var(--gold-light);
    color: var(--white);
}

.btn-danger {
    background: var(--crimson);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--crimson-light);
    color: var(--white);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: var(--text-md);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* ============================================================
   9. BADGE / TAG / PILL
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.2em 0.65em;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-accent  { background: var(--zone-accent-faint);  color: var(--zone-accent); }
.badge-gold    { background: var(--gold-faint);          color: var(--gold); }
.badge-success { background: var(--color-success-bg);    color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg);    color: var(--color-warning); }
.badge-error   { background: var(--color-error-bg);      color: var(--color-error); }
.badge-neutral { background: var(--surface-secondary);   color: var(--text-tertiary); }

.tag {
    display: inline-block;
    padding: 0.25em 0.75em;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--parchment);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}


/* ============================================================
   10. FORM ELEMENTS
   ============================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-label .required {
    color: var(--crimson);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.875rem;
    background: var(--zone-input-bg, var(--white));
    border: 1px solid var(--zone-input-border, var(--border-strong));
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--zone-input-focus);
    box-shadow: 0 0 0 3px var(--zone-accent-faint);
}

.form-control::placeholder {
    color: var(--text-disabled);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--surface-secondary);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A7A7A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-error);
}


/* ============================================================
   11. ALERT / NOTICE BANNERS
   ============================================================ */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-base);
}

.alert-info    { background: var(--color-info-bg);    border-color: var(--color-info-border);    color: var(--color-info); }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.alert-error   { background: var(--color-error-bg);   border-color: var(--color-error-border);   color: var(--color-error); }


/* ============================================================
   12. TOPBAR
   ============================================================ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--zone-topbar-bg, var(--white));
    border-bottom: 1px solid var(--zone-topbar-border, var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--space-6);
    z-index: var(--z-sticky);
    gap: var(--space-4);
}

.topbar-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--zone-topbar-logo, var(--accent));
    text-decoration: none;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
}


/* ============================================================
   13. SIDEBAR
   ============================================================ */

.sidebar {
    width: 240px;
    min-height: calc(100vh - var(--topbar-height));
    background: var(--zone-sidebar-bg, var(--white));
    border-right: 1px solid var(--border);
    padding: var(--space-4) 0;
    flex-shrink: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.45rem var(--space-5);
    font-size: var(--text-base);
    color: var(--zone-sidebar-text, var(--ink-light));
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: 0;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: var(--zone-sidebar-hover, var(--parchment));
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--zone-sidebar-active, var(--accent-faint));
    color: var(--zone-sidebar-active-text, var(--accent));
    font-weight: 600;
}

.sidebar-section-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-disabled);
    padding: var(--space-4) var(--space-5) var(--space-1);
}


/* ============================================================
   14. LOADING & SPINNERS
   ============================================================ */

@keyframes gw-spin {
    to { transform: rotate(360deg); }
}

@keyframes gw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes gw-fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--zone-accent-faint);
    border-top-color: var(--zone-accent);
    border-radius: 50%;
    animation: gw-spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

.pulse {
    animation: gw-pulse 1.5s ease-in-out infinite;
}

.fade-in-up {
    animation: gw-fadeInUp 0.4s ease both;
}

/* Stagger delays for lists */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.30s; }


/* ============================================================
   15. UTILITY CLASSES
   ============================================================ */

/* Display */
.d-flex    { display: flex; }
.d-grid    { display: grid; }
.d-block   { display: block; }
.d-none    { display: none; }
.d-inline  { display: inline; }

/* Flex */
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* Text align */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text color */
.text-accent   { color: var(--zone-accent); }
.text-gold     { color: var(--gold); }
.text-crimson  { color: var(--crimson); }
.text-emerald  { color: var(--emerald); }
.text-muted    { color: var(--text-tertiary); }
.text-disabled { color: var(--text-disabled); }

/* Font weight */
.fw-normal  { font-weight: 400; }
.fw-medium  { font-weight: 500; }
.fw-semibold{ font-weight: 600; }
.fw-bold    { font-weight: 700; }

/* Font family */
.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }

/* Spacing — margin */
.mt-0  { margin-top: 0; }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

/* Spacing — padding */
.p-4   { padding: var(--space-4); }
.p-6   { padding: var(--space-6); }
.px-4  { padding-inline: var(--space-4); }
.px-6  { padding-inline: var(--space-6); }
.py-4  { padding-block: var(--space-4); }
.py-6  { padding-block: var(--space-6); }

/* Width */
.w-full    { width: 100%; }
.max-w-sm  { max-width: var(--container-sm); margin-inline: auto; }
.max-w-md  { max-width: var(--container-md); margin-inline: auto; }
.max-w-lg  { max-width: var(--container-lg); margin-inline: auto; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Borders */
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-pill { border-radius: var(--radius-pill); }
.border       { border: 1px solid var(--border); }
.border-strong{ border: 1px solid var(--border-strong); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Misc */
.pointer   { cursor: pointer; }
.select-none { user-select: none; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}


/* ============================================================
   16. RESPONSIVE BREAKPOINTS
   ============================================================
   Mobile-first. Adjust as needed per component.
   ============================================================ */

/* Tablet and below: 768px */
@media (max-width: 768px) {
    :root {
        --topbar-height: 52px;
    }

    .container {
        padding-inline: var(--space-4);
    }

    .section {
        padding-block: var(--space-10);
    }

    .sidebar {
        display: none;  /* Override per-page for mobile nav patterns */
    }
}

/* Mobile: 520px */
@media (max-width: 520px) {
    :root {
        --text-3xl: 1.6rem;
        --text-4xl: 2rem;
        --text-5xl: 2.5rem;
    }

    .container {
        padding-inline: var(--space-3);
    }

    .btn-lg {
        padding: 0.625rem 1.25rem;
    }
}


/* ============================================================
   17. PRINT STYLES
   ============================================================ */

@media print {
    .topbar,
    .sidebar,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        font-size: 11pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    @page {
        margin: 0.75in;
    }
}


/* ============================================================
   END OF GRADEWISE-CORE.CSS
   ============================================================
   To use:
     1. Link this file FIRST on every page
     2. Add zone class to <body> (zone-library, zone-games, etc.)
     3. Add guide class if needed (guide-romeo, guide-hamlet, etc.)
     4. Use CSS variables in all page-specific styles
     5. Never hardcode hex colors in component CSS
   ============================================================ 
