/* ==========================================================================
   TRAUMATOLOGISTS+ — Optical Surgical Design System (From-Scratch v3)
   Modern Web Guidance: @layer, color-scheme + light-dark(), OKLCH, View Transitions
   ========================================================================== */

@layer reset, tokens, base, layout, components, utilities;

@view-transition {
    navigation: auto;
}

@layer tokens {
    :root {
        color-scheme: light dark;

        /* Typography — Clean Optical Humanist + Precision Tabular Mono */
        --font-sans: "Plus Jakarta Sans", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

        /* Type Scale (4px harmonic rhythm, weights 400–600 only) */
        --text-2xs: 0.6875rem; /* 11px */
        --text-xs: 0.75rem;    /* 12px */
        --text-sm: 0.8125rem;  /* 13px */
        --text-base: 0.875rem; /* 14px */
        --text-md: 1rem;       /* 16px */
        --text-lg: 1.25rem;    /* 20px */
        --text-xl: 1.5rem;     /* 24px */
        --text-2xl: 2.125rem;  /* 34px */

        /* Strict 4px Spacing Scale */
        --sp-1: 4px;
        --sp-2: 8px;
        --sp-3: 12px;
        --sp-4: 16px;
        --sp-5: 20px;
        --sp-6: 24px;
        --sp-8: 32px;

        /* Nested Corner Radii (inner = outer - padding) */
        --radius-xs: 6px;
        --radius-sm: 8px;
        --radius-md: 12px;
        --radius-lg: 16px;

        /* Layout Dimensions */
        --topbar-h: 48px;
        --studybar-h: 44px;

        /* Neutral Ramp — Clinical Porcelain (Light) / Optical Graphite (Dark) */
        --bg-app: light-dark(oklch(0.973 0.003 255), oklch(0.152 0.005 255));
        --bg-panel: light-dark(oklch(1 0 0), oklch(0.184 0.006 255));
        --bg-subtle: light-dark(oklch(0.958 0.004 255), oklch(0.168 0.005 255));
        --bg-elevated: light-dark(oklch(0.942 0.005 255), oklch(0.222 0.007 255));
        --bg-hover: light-dark(oklch(0.18 0.01 255 / 0.045), oklch(0.98 0 0 / 0.055));
        --bg-active: light-dark(oklch(0.18 0.01 255 / 0.08), oklch(0.98 0 0 / 0.09));

        /* Diagnostic Negatoscope — Always True Pitch-Black for MRI Contrast */
        --bg-negatoscope: #050608;

        /* Hairline Borders (6–10% ramp ink, zero glowing borders) */
        --border-subtle: light-dark(oklch(0.18 0.01 255 / 0.08), oklch(0.98 0 0 / 0.075));
        --border-strong: light-dark(oklch(0.18 0.01 255 / 0.16), oklch(0.98 0 0 / 0.15));

        /* Three Strict Text Roles (WCAG 2.1 AA >= 4.5:1 verified) */
        --text-primary: light-dark(oklch(0.175 0.008 255), oklch(0.962 0.003 255));
        --text-secondary: light-dark(oklch(0.395 0.012 255), oklch(0.735 0.008 255));
        --text-muted: light-dark(oklch(0.495 0.012 255), oklch(0.615 0.008 255));

        /* Monochrome Primary CTA (Zeiss / Linear quiet chrome) */
        --cta-bg: light-dark(oklch(0.175 0.008 255), oklch(0.962 0.003 255));
        --cta-fg: light-dark(oklch(0.995 0 0), oklch(0.152 0.005 255));

        /* Brand & Anatomical Accents (Meniscus Mint #28C794 + Gracilis Cobalt) */
        --brand-mint: light-dark(oklch(0.54 0.132 166), oklch(0.755 0.142 166));
        --brand-mint-soft: light-dark(oklch(0.54 0.132 166 / 0.10), oklch(0.755 0.142 166 / 0.13));
        --brand-mint-border: light-dark(oklch(0.54 0.132 166 / 0.28), oklch(0.755 0.142 166 / 0.30));

        --anat-st: light-dark(oklch(0.54 0.132 166), oklch(0.755 0.142 166));
        --anat-gt: light-dark(oklch(0.51 0.145 238), oklch(0.745 0.125 235));
        --anat-gt-soft: light-dark(oklch(0.51 0.145 238 / 0.10), oklch(0.745 0.125 235 / 0.14));

        /* Semantic Clinical Verdicts (Toned into palette, WCAG AA compliant) */
        --status-safe-fg: light-dark(oklch(0.48 0.13 164), oklch(0.77 0.14 164));
        --status-safe-bg: light-dark(oklch(0.54 0.13 164 / 0.09), oklch(0.75 0.14 164 / 0.11));
        --status-safe-border: light-dark(oklch(0.54 0.13 164 / 0.24), oklch(0.75 0.14 164 / 0.26));

        --status-warn-fg: light-dark(oklch(0.50 0.135 72), oklch(0.80 0.135 78));
        --status-warn-bg: light-dark(oklch(0.65 0.14 75 / 0.11), oklch(0.78 0.14 78 / 0.12));
        --status-warn-border: light-dark(oklch(0.58 0.14 75 / 0.28), oklch(0.78 0.14 78 / 0.28));

        --status-danger-fg: light-dark(oklch(0.51 0.185 25), oklch(0.74 0.165 24));
        --status-danger-bg: light-dark(oklch(0.55 0.185 25 / 0.09), oklch(0.68 0.175 24 / 0.13));
        --status-danger-border: light-dark(oklch(0.55 0.185 25 / 0.26), oklch(0.70 0.17 24 / 0.30));

        /* Neutral Elevation Shadow (Light theme subtle only; Dark uses surface steps) */
        --shadow-popover: light-dark(
            0 12px 32px -8px oklch(0.15 0.01 255 / 0.14),
            0 16px 40px -8px oklch(0 0 0 / 0.65)
        );

        /* GPU-Only Motion Tokens (.cursorrules: transform & opacity ONLY) */
        --ease-optical: cubic-bezier(0.2, 0, 0, 1);
        --dur-fast: 140ms;
        --dur-base: 220ms;
    }

    html[data-theme="light"] {
        color-scheme: light;
    }

    html[data-theme="dark"] {
        color-scheme: dark;
    }
}

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