/* ══════════════════════════════════════════════════════════════════════════════
   main.css — Design tokens, theme vars, base typography, globals
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Bootstrap primary override ──────────────────────────────────────────────── */
:root {
    --bs-primary: #428bca;
    --bs-primary-rgb: 66,139,202;
}
[data-bs-theme="dark"] {
    --bs-primary: #7ab4e3;
    --bs-primary-rgb: 122,180,227;
}

/* ── Design tokens ───────────────────────────────────────────────────────────── */
:root {
    --text-xs:  0.75rem;
    --text-sm:  0.8125rem;
    --text-base: 1rem;
    --text-lg:  1.125rem;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 50px;
    --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 2px 8px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.05);
    --shadow-lg:  0 4px 16px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.05);
    --shadow-xl:  0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    --shadow-glow: 0 0 0 3px rgba(66,139,202,.18);
    --shadow-glow-lg: 0 0 0 4px rgba(66,139,202,.14);
    --transition-fast: .15s cubic-bezier(.4,0,.2,1);
    --transition-base: .2s cubic-bezier(.4,0,.2,1);
    --transition-slow: .3s cubic-bezier(.4,0,.2,1);
    --transition-spring: .4s cubic-bezier(.34,1.56,.64,1);
    --accent: #428bca;
    --accent-light: #5a9dd5;
    --accent-subtle: rgba(66,139,202,.07);
    --accent-glow: rgba(66,139,202,.18);
    --heading-color: #2e4455;
    --gradient-primary: linear-gradient(135deg, #5a9dd5, #428bca);
    --gradient-primary-hover: linear-gradient(135deg, #6eaadd, #5a9dd5);
    --gradient-navbar: linear-gradient(135deg, #2e4455 0%, #3a5a73 100%);
    --gradient-shine: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.05) 50%, transparent 75%);
}

/* ── Light theme fine-tuning ─────────────────────────────────────────────────── */
[data-bs-theme="light"] {
    --surface-bg: #ffffff;
    --page-bg: #f5f9fc;
    --surface-hover: #eaf1f8;
    --surface-active: #dde8f3;
    --border-subtle: rgba(33,37,41,.09);
    --border-accent: rgba(66,139,202,.22);
    --text-primary: #212529;
    --text-secondary: #5a6470;

    /* Pastel palette */
    --pastel-lavender: #dceaf6;
    --pastel-lavender-fg: #2e4455;
    --pastel-sky:      #e0f2fe;
    --pastel-sky-fg:   #0369a1;
    --pastel-mint:     #d1fae5;
    --pastel-mint-fg:  #065f46;
    --pastel-rose:     #ffe4e6;
    --pastel-rose-fg:  #be123c;
    --pastel-amber:    #fef3c7;
    --pastel-amber-fg: #92400e;
    --pastel-peach:    #ffedd5;
    --pastel-peach-fg: #9a3412;

    /* Clip color palette — light mode */
    --clip-yellow-start:   #fefce8; --clip-yellow-end:   #fef9c3; --clip-yellow-border:   rgba(250,204,21,.15);
    --clip-peach-start:    #fff7ed; --clip-peach-end:    #ffedd5; --clip-peach-border:    rgba(251,146,60,.12);
    --clip-coral-start:    #fef2f2; --clip-coral-end:    #fee2e2; --clip-coral-border:    rgba(248,113,113,.12);
    --clip-pink-start:     #fdf2f8; --clip-pink-end:     #fce7f3; --clip-pink-border:     rgba(236,72,153,.10);
    --clip-lavender-start: #f5f3ff; --clip-lavender-end: #ede9fe; --clip-lavender-border: rgba(139,92,246,.10);
    --clip-blue-start:     #eff6ff; --clip-blue-end:     #dbeafe; --clip-blue-border:     rgba(59,130,246,.10);
    --clip-teal-start:     #f0fdfa; --clip-teal-end:     #ccfbf1; --clip-teal-border:     rgba(20,184,166,.10);
    --clip-mint-start:     #f0fdf4; --clip-mint-end:     #dcfce7; --clip-mint-border:     rgba(34,197,94,.10);
}
[data-bs-theme="light"] body { background-color: var(--page-bg) !important; }

/* ── Dark theme premium ──────────────────────────────────────────────────────── */
[data-bs-theme="dark"] {
    --surface-bg: #1e2028;
    --page-bg: #13141a;
    --surface-hover: #282a33;
    --surface-active: #32343e;
    --border-subtle: rgba(255,255,255,.06);
    --border-accent: rgba(147,197,253,.15);
    --text-primary: #f0f1f3;
    --text-secondary: #9ca3af;
    --shadow-xs:  0 1px 2px rgba(0,0,0,.2);
    --shadow-sm:  0 2px 6px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
    --shadow-xl:  0 20px 50px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
    --shadow-glow: 0 0 0 3px rgba(123,165,216,.22);
    --shadow-glow-lg: 0 0 0 4px rgba(123,165,216,.18);
    --accent-glow: rgba(123,165,216,.22);

    /* Clip color palette — dark mode */
    --clip-yellow-start:   #2a2714; --clip-yellow-end:   #252210; --clip-yellow-border:   rgba(250,204,21,.10);
    --clip-peach-start:    #2a1e14; --clip-peach-end:    #251a10; --clip-peach-border:    rgba(251,146,60,.10);
    --clip-coral-start:    #2a1414; --clip-coral-end:    #251010; --clip-coral-border:    rgba(248,113,113,.10);
    --clip-pink-start:     #2a1420; --clip-pink-end:     #25101c; --clip-pink-border:     rgba(236,72,153,.10);
    --clip-lavender-start: #201a38; --clip-lavender-end: #1c1630; --clip-lavender-border: rgba(139,92,246,.10);
    --clip-blue-start:     #141e30; --clip-blue-end:     #101a28; --clip-blue-border:     rgba(59,130,246,.10);
    --clip-teal-start:     #14241e; --clip-teal-end:     #10201a; --clip-teal-border:     rgba(20,184,166,.10);
    --clip-mint-start:     #14241a; --clip-mint-end:     #102016; --clip-mint-border:     rgba(34,197,94,.10);
}
[data-bs-theme="dark"] body { background-color: var(--page-bg) !important; }

/* ── Dark mode pastel overrides ──────────────────────────────────────────────── */
[data-bs-theme="dark"] {
    --pastel-lavender: rgba(96,165,250,.22);
    --pastel-lavender-fg: #93c5fd;
    --pastel-mint:     rgba(5,150,105,.2);
    --pastel-mint-fg:  #6ee7b7;
    --pastel-rose:     rgba(190,18,60,.2);
    --pastel-rose-fg:  #fca5a5;
    --pastel-amber:    rgba(146,64,14,.2);
    --pastel-amber-fg: #fcd34d;
    --pastel-sky:      rgba(14,116,144,.2);
    --pastel-sky-fg:   #7dd3fc;
}

/* ── Font & base ─────────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
pre {
    white-space: pre-wrap; word-wrap: break-word;
    font-family: 'Inter', system-ui, sans-serif; margin-bottom: 0;
    line-height: 1.7;
}


/* ── Headings — Inter, navy soft (Mamba-inspired) ────────────────────────────── */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
.card-title {
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: -.02em;
    color: var(--heading-color, var(--text-primary));
}
h1, h2, h3, .h1, .h2, .h3 { font-weight: 800; }

/* ── Fluid typography — scale smoothly across viewports ──────────────────────── */
h1, .h1             { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.2; }
h2, .h2             { font-size: clamp(1.5rem,  1.1rem + 1.6vw, 2rem);   line-height: 1.25; }
h3, .h3             { font-size: clamp(1.25rem, 1rem   + 1vw,   1.6rem); line-height: 1.3; }
.display-1          { font-size: clamp(2.75rem, 1.5rem + 5vw,   5rem);   line-height: 1.1; }
.display-2          { font-size: clamp(2.5rem,  1.4rem + 4vw,   4.5rem); line-height: 1.1; }
.display-3          { font-size: clamp(2.25rem, 1.3rem + 3.5vw, 4rem);   line-height: 1.15; }
.display-4          { font-size: clamp(2rem,    1.2rem + 3vw,   3.5rem); line-height: 1.2; }

/* ── Gradient text utility ───────────────────────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 60%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Focus visible — accessibility polish ────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 4px rgba(66,139,202,.14);
}

/* ── Selection color ─────────────────────────────────────────────────────────── */
::selection {
    background: rgba(66,139,202,.18);
    color: inherit;
}

/* ── Scrollbar (webkit) — refined ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.12);
    border-radius: 3px;
    transition: background .2s;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.22); }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ── Smooth scroll + reduced motion ──────────────────────────────────────────── */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Mobile bottom safe area ─────────────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .site-footer { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    #toast-container { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)) !important; }
}

/* NOTE: Yellow status dot (#ffc107) on white has 1.63:1 contrast.
   This is acceptable as it is purely decorative (status indicator, not text). */

/* ── Tables — transparent everywhere ────────────────────────────────────────── */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
}
.table-light {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
}
