/* Vector-First Design System — bRRAIn */

:root {
    /* Make native controls (select popups, scrollbars, inputs) match. */
    color-scheme: dark;
    /* Colors */
    --color-bg: #000000;
    --color-surface-1: rgba(255, 255, 255, 0.02);
    --color-surface-2: rgba(255, 255, 255, 0.06);
    --color-surface-3: rgba(255, 255, 255, 0.09);
    --color-surface-4: rgba(255, 255, 255, 0.12);
    --color-surface-5: rgba(255, 255, 255, 0.16);

    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.55);
    --color-text-tertiary: rgba(255, 255, 255, 0.32);

    --color-accent-cyan: #00ebff;
    --color-accent-cyan-hover: #33efff;
    --color-accent-cyan-muted: rgba(0, 235, 255, 0.15);

    --color-success: #00c853;
    --color-warning: #ffd600;
    --color-error: #ff1744;

    --color-border: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    --text-5xl: 3.5rem;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --space-xl: 64px;
    --space-2xl: 128px;

    /* Layout */
    --max-width: 1200px;
    --max-width-narrow: 800px;
    --max-width-wide: 1440px;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-index scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* Grid texture color (dark theme default) */
    --grid-line: rgba(255, 255, 255, 0.025);

    /* Primary button colors (dark theme default) */
    --btn-primary-bg: #ffffff;
    --btn-primary-fg: #000000;
    --btn-primary-hover-bg: rgba(255, 255, 255, 0.85);
}

/* ===== Light theme overrides ===== */
[data-theme="light"] {
    color-scheme: light;
    --color-bg: #ffffff;
    --color-surface-1: rgba(0, 0, 0, 0.02);
    --color-surface-2: rgba(0, 0, 0, 0.05);
    --color-surface-3: rgba(0, 0, 0, 0.08);
    --color-surface-4: rgba(0, 0, 0, 0.12);
    --color-surface-5: rgba(0, 0, 0, 0.16);

    --color-text-primary: #0a0a0a;
    --color-text-secondary: rgba(0, 0, 0, 0.60);
    --color-text-tertiary: rgba(0, 0, 0, 0.38);

    --color-accent-cyan: #0095a8;
    --color-accent-cyan-hover: #007785;
    --color-accent-cyan-muted: rgba(0, 149, 168, 0.12);

    --color-success: #00894e;
    --color-warning: #b78d00;
    --color-error: #c50028;

    --color-border: rgba(0, 0, 0, 0.12);

    /* Match the visibility of the dark-mode grid: 2.5% white on black ≈
       needs ~8% black on white to read similarly. */
    --grid-line: rgba(0, 0, 0, 0.085);

    --btn-primary-bg: #0a0a0a;
    --btn-primary-fg: #ffffff;
    --btn-primary-hover-bg: rgba(10, 10, 10, 0.85);
}

/* Base body styles */
body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-family: var(--font-ui);
    font-size: var(--text-base);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);

    /* 64px grid texture at 2.5% opacity (3.5% in light mode for visibility) */
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container--narrow {
    max-width: var(--max-width-narrow);
}

.container--wide {
    max-width: var(--max-width-wide);
}

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin-top: 8px;
    margin-bottom: 8px;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent-cyan);
    outline-offset: 2px;
}

/* Primary: theme-aware (white on dark, black on light) */
.btn--primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border-color: var(--btn-primary-bg);
}

.btn--primary:hover {
    background: var(--btn-primary-hover-bg);
    border-color: var(--btn-primary-hover-bg);
}

/* Secondary: theme-aware border */
.btn--secondary {
    background: transparent;
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn--secondary:hover {
    background: var(--color-surface-2);
}

/* Accent: cyan border */
.btn--accent {
    background: transparent;
    color: var(--color-accent-cyan);
    border-color: var(--color-accent-cyan);
}

.btn--accent:hover {
    background: var(--color-accent-cyan-muted);
}

/* Button sizes */
.btn--sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
}

.btn--lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-base);
}

/* ===== Cards ===== */

.card {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 24px;
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--color-surface-5);
}

.card__title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
}

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

/* ===== Forms ===== */

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-family: var(--font-ui);
    font-size: var(--text-base);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    border-color: var(--color-accent-cyan);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-tertiary);
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.55)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-sm) center;
    padding-right: var(--space-lg);
}

/* Native <option> dropdowns use the OS palette by default, which can
   render white-on-white or black-on-black depending on browser/OS. The
   root color-scheme declaration (dark by default, light under
   [data-theme="light"]) fixes this on all modern browsers; we also
   explicitly paint each option as a belt-and-braces fallback. */
.form-select option {
    background-color: #0a0a0a;
    color: #ffffff;
}
[data-theme="light"] .form-select option {
    background-color: #ffffff;
    color: #0a0a0a;
}

/* ===== Code blocks ===== */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-surface-2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-accent-cyan);
}

pre {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow-x: auto;
    line-height: 1.7;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--color-text-primary);
}

/* ===== Responsive ===== */

/* Mobile first: base styles above target mobile */

/* Tablet: 768px+ */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-lg);
    }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-xl);
    }
}

/* ===== Theme Switcher ===== */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.theme-switcher__label {
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.theme-switcher__buttons {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 2px;
    background: var(--color-surface-1);
}

.theme-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.theme-switcher__btn:hover {
    color: var(--color-text-primary);
}

.theme-switcher__btn.is-active {
    background: var(--color-surface-3);
    color: var(--color-text-primary);
}

.theme-switcher__btn svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .theme-switcher__btn span {
        display: none;
    }
}

/* Footer layouts adjust for theme switcher (docs + app footers keep it inline;
   marketing footer now places the switcher inside the brand column). */
.footer-docs__container,
.footer-app__container {
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* ===== Eyebrow label (shared utility used by SDK, auth, docs pages) ===== */
.eyebrow {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent-cyan);
    margin-bottom: var(--space-md);
}

/* Nav sign-in link (marketing nav) — visually balanced against the
   primary "Get Started" button: same vertical center, matched padding
   height, subtle underline on hover. */
.nav-public__signin {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--space-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-public__signin:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-2);
}

/* =============================================================================
   LIGHT-MODE OVERRIDES
   Many CSS files (certification.css, maturity-matrix.css, marketing.css,
   partners.css, learn.css, etc.) use hardcoded rgba(255,255,255,X) for
   surfaces, borders, and text. Those don't auto-flip under [data-theme="light"].
   The blocks below redefine the scoped CSS custom properties and override the
   specific selectors that hardcode white — so every page reads cleanly in
   light mode without touching the dark-mode baseline.
   ========================================================================== */

/* ---- Shared: flip any scoped --cert-*, --mm-*, etc. vars ---- */
[data-theme="light"] .cert-page,
[data-theme="light"] .cert-theme {
    --cert-bg-surface:    rgba(0, 0, 0, 0.03);
    --cert-bg-elevated:   rgba(0, 0, 0, 0.05);
    --cert-text-secondary: rgba(0, 0, 0, 0.62);
    --cert-text-tertiary:  rgba(0, 0, 0, 0.42);
    --cert-text-disabled:  rgba(0, 0, 0, 0.22);
    --cert-border-subtle:  rgba(0, 0, 0, 0.12);
    --cert-border-mid:     rgba(0, 0, 0, 0.30);
}

/* ---- Shared: low-opacity white surfaces/borders/text → black equivalents ---- */
[data-theme="light"] .cert-page .cert-quote-box blockquote,
[data-theme="light"] .cert-page [class*="cert-"][class*="-card"],
[data-theme="light"] .cert-page [class*="cert-"][class*="-box"],
[data-theme="light"] .cert-page [class*="cert-"][class*="-table"],
[data-theme="light"] .mm-page [class*="mm-"][class*="-card"],
[data-theme="light"] .mm-page [class*="mm-"][class*="-box"] {
    color: var(--color-text-primary);
}

/* Primary button variants that hardcode white bg + black text for dark mode
   need to invert in light mode (black bg + white text). */
[data-theme="light"] .cert-btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border-color: var(--btn-primary-bg);
}

[data-theme="light"] .cert-btn-primary:hover {
    background: var(--btn-primary-hover-bg);
}

/* White quote borders / card borders become black in light mode */
[data-theme="light"] .cert-discipline-card {
    border-left-color: var(--color-text-primary);
}
[data-theme="light"] .cert-discipline-cells { border-left-color: #0095a8; }
[data-theme="light"] .cert-discipline-ops   { border-left-color: #a37806; }
[data-theme="light"] .cert-discipline-care  { border-left-color: #2d8f4e; }
[data-theme="light"] .cert-discipline-dev   { border-left-color: #7052d6; }

/* Discipline color variables flip to WCAG-friendly darker tones in light mode
   so the colored text stays readable on a white background. Using broad
   attribute selectors catches inline styles on any element (a/span/svg/h3). */
[data-theme="light"] .cert-color-cells,
[data-theme="light"] .cert-role-cells,
[data-theme="light"] [style*="color:#00ebff"],
[data-theme="light"] [style*="color: #00ebff"] { color: #0095a8 !important; }

[data-theme="light"] .cert-color-ops,
[data-theme="light"] .cert-role-ops,
[data-theme="light"] [style*="color:#fbbf24"],
[data-theme="light"] [style*="color: #fbbf24"] { color: #a37806 !important; }

[data-theme="light"] .cert-color-care,
[data-theme="light"] .cert-role-care,
[data-theme="light"] [style*="color:#4ade80"],
[data-theme="light"] [style*="color: #4ade80"] { color: #2d8f4e !important; }

[data-theme="light"] [style*="color:#a78bfa"],
[data-theme="light"] [style*="color: #a78bfa"] { color: #7052d6 !important; }

/* Cert theme accent variable — flip to darker shades per discipline so
   text and icons colored by var(--cert-accent) remain readable. */
[data-theme="light"] .cert-theme--cells { --cert-accent: #0095a8; }
[data-theme="light"] .cert-theme--ops   { --cert-accent: #a37806; }
[data-theme="light"] .cert-theme--care  { --cert-accent: #2d8f4e; }
[data-theme="light"] .cert-theme--dev   { --cert-accent: #7052d6; }

/* .eyebrow uses --color-accent-cyan which already flips via the root
   [data-theme="light"] rule at top of this file. No override needed. */

/* --- Surface background overrides (hardcoded rgba whites) --- */
[data-theme="light"] .cert-quote-box blockquote,
[data-theme="light"] .cert-role-card,
[data-theme="light"] .cert-comparison-table,
[data-theme="light"] .cert-path-role-card,
[data-theme="light"] .mm-quote-box blockquote,
[data-theme="light"] .mm-levels-table,
[data-theme="light"] .assess-container,
[data-theme="light"] .assess-option,
[data-theme="light"] .assess-result-card,
[data-theme="light"] .tier-card,
[data-theme="light"] .tier-table {
    background: var(--color-surface-2) !important;
}

[data-theme="light"] .cert-discipline-card,
[data-theme="light"] .cert-role-pricing-bundle,
[data-theme="light"] .mm-card,
[data-theme="light"] .mm-ninety-nine-card {
    background: var(--color-surface-1) !important;
}

/* Borders that hardcode rgba(255,255,255,X) → flip to black equivalents */
[data-theme="light"] .cert-role-card,
[data-theme="light"] .cert-comparison-table th,
[data-theme="light"] .cert-comparison-table td,
[data-theme="light"] .mm-levels-table th,
[data-theme="light"] .mm-levels-table td,
[data-theme="light"] .assess-option {
    border-color: var(--color-border) !important;
}

/* Quote block border-left colors were hardcoded cyan — keep them visible but
   use the darker accent to contrast better on white. */
[data-theme="light"] .cert-quote-box blockquote,
[data-theme="light"] .mm-quote-box blockquote {
    border-left-color: #0095a8 !important;
}

/* Text color overrides for elements where rgba(255,255,255,X) was used
   directly as a color (not as a var). These are ABI — if they break, the
   dark-mode look is unaffected because these rules only match under
   [data-theme="light"]. */
[data-theme="light"] .cert-quote-box blockquote p,
[data-theme="light"] .mm-quote-box blockquote p {
    color: var(--color-text-primary);
}

[data-theme="light"] .cert-quote-box blockquote cite,
[data-theme="light"] .mm-quote-box blockquote cite {
    color: var(--color-text-tertiary);
}

/* --- Homepage hero orb: tone down the blue radial gradient in light mode
   so it doesn't blow out against a white page. --- */
[data-theme="light"] .hero::before {
    background: radial-gradient(ellipse 90% 80% at 40% 30%,
        rgba(0, 100, 200, 0.08) 0%,
        rgba(0, 100, 200, 0.04) 30%,
        transparent 60%);
}

/* --- Footer becomes a light surface with dark text --- */
[data-theme="light"] .footer-marketing {
    background: var(--color-surface-1);
}

/* --- Nav, dropdown menu, and code blocks --- */
[data-theme="light"] .nav-public {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--color-border);
}

/* Nav mega-menu dropdown panel: hardcoded rgba(10,10,14,0.98) in dark mode.
   Flip to a light translucent surface so menu items are visible. */
[data-theme="light"] .nav-dropdown__menu {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--color-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .nav-mega__item:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] pre,
[data-theme="light"] code {
    background: var(--color-surface-3);
    color: var(--color-text-primary);
}

[data-theme="light"] .step-card pre,
[data-theme="light"] .code-tabs__panel,
[data-theme="light"] .integration-card pre {
    background: var(--color-surface-2);
}

/* --- FAQ accordion: border was too subtle in light mode (12% alpha).
   Give it a visible bottom border + a tiny hover background. --- */
[data-theme="light"] .faq-accordion__item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .faq-accordion__question:hover {
    color: var(--color-accent-cyan-hover);
}

/* --- Card components that had rgba white backgrounds --- */
[data-theme="light"] .card,
[data-theme="light"] .feature-card,
[data-theme="light"] .step-card:not(.step-card--next),
[data-theme="light"] .addon-card,
[data-theme="light"] .testimonial-card,
[data-theme="light"] .pricing-card,
[data-theme="light"] .use-case-card,
[data-theme="light"] .integration-item,
[data-theme="light"] .stat-card,
[data-theme="light"] .metric-card {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
}

[data-theme="light"] .card:hover,
[data-theme="light"] .feature-card:hover,
[data-theme="light"] .use-case-card:hover {
    background: var(--color-surface-2);
    border-color: var(--color-border);
}

/* Hero illustrations and SVG decorations that use #00ebff should still
   be readable on white — cyan #00ebff on white is pale. Shift to the
   darker teal used elsewhere in light mode. */
[data-theme="light"] .use-case-card__metric-value,
[data-theme="light"] .use-case-card .card__solution,
[data-theme="light"] .use-case-card__link {
    color: #0095a8;
}

/* --- Open FAQ accordion item gets a subtle background tint so users see
   the expanded state clearly in light mode. --- */
[data-theme="light"] details.faq-accordion__item[open] {
    background: var(--color-surface-1);
}

/* --- Subtitle / paragraph text inside homepage problem/solution columns
   that was white and is invisible on light bg. --- */
[data-theme="light"] .problem-solution__text,
[data-theme="light"] .problem-solution__col p,
[data-theme="light"] .hero__subtitle,
[data-theme="light"] .section__subtitle,
[data-theme="light"] .card__description,
[data-theme="light"] .card__text {
    color: var(--color-text-secondary);
}

/* --- SVG / illustration whites: inline SVG elements that set stroke="#fff"
   or stroke="rgba(255,255,255,...)" become invisible on white backgrounds.
   We can't override inline attributes with CSS alone, but we CAN override
   fills/strokes set via CSS. For SVGs using currentColor (most of ours),
   the color automatically flips via the parent text color. --- */

/* --- Auth alert panels that used rgba(255,255,255,X) overlays --- */
[data-theme="light"] .auth-alert--error {
    background: rgba(197, 0, 40, 0.08);
    border-color: rgba(197, 0, 40, 0.28);
}

[data-theme="light"] .auth-alert--success {
    background: rgba(0, 137, 78, 0.08);
    border-color: rgba(0, 137, 78, 0.28);
}

/* --- Generic: any element using rgba(255,255,255,low-alpha) as a bg inside
   the content container → force to surface-1/2. This is a blunt safety net
   for any selector we haven't specifically enumerated. --- */
[data-theme="light"] .section,
[data-theme="light"] main {
    color: var(--color-text-primary);
}
