html {
    color-scheme: dark;
}

body,
header,
section,
footer,
.card-hover,
.glass,
.theme-toggle {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.theme-toggle {
    position: fixed;
    top: 92px;
    right: 1.25rem;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    box-shadow: 0 10px 25px rgba(2, 6, 23, 0.25);
    cursor: pointer;
    font: 600 0.8rem 'Inter', system-ui, sans-serif;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: #60a5fa;
    outline: 3px solid rgba(96, 165, 250, 0.3);
    outline-offset: 2px;
}

.theme-toggle i {
    font-size: 1rem;
}

html.theme-light {
    color-scheme: light;
}

html.theme-light body {
    background-color: #f8fafc !important;
    color: #172033 !important;
}

/* --- LIGHT MODE: neutralise ALL dark surfaces (fixes the black "vignette" cards) --- */
/* Broad catch-all: every bg-dark-* utility (any opacity variant) becomes a light surface. */
html.theme-light [class*="bg-dark-950"],
html.theme-light [class*="bg-dark-900"],
html.theme-light [class*="bg-dark-800"] {
    background-color: #ffffff !important;
}

/* Inner / nested panels get a soft grey so they stay distinguishable from white cards.
   (dark-950 panels stay white so the innermost content "pops" on top of grey containers.) */
html.theme-light .bg-dark-900\/70,
html.theme-light .bg-dark-900\/60,
html.theme-light .bg-dark-900\/50,
html.theme-light .bg-dark-800\/70,
html.theme-light .bg-dark-800\/60,
html.theme-light .bg-dark-800\/50 {
    background-color: #eef3fa !important;
}

html.theme-light .text-white {
    color: #172033 !important;
}

html.theme-light .text-slate-100,
html.theme-light .text-slate-200,
html.theme-light .text-slate-300 {
    color: #334155 !important;
}

html.theme-light .text-slate-400,
html.theme-light .text-slate-500 {
    color: #64748b !important;
}

html.theme-light .text-blue-300,
html.theme-light .text-emerald-300,
html.theme-light .text-rose-300,
html.theme-light .text-amber-300,
html.theme-light .text-violet-300 {
    color: #1d4ed8 !important;
}

html.theme-light .text-blue-400,
html.theme-light .text-emerald-400,
html.theme-light .text-rose-400,
html.theme-light .text-amber-400,
html.theme-light .text-violet-400 {
    color: #1e40af !important;
}

html.theme-light .bg-blue-500\/10,
html.theme-light .bg-blue-500\/20,
html.theme-light .bg-emerald-500\/10,
html.theme-light .bg-emerald-500\/20,
html.theme-light .bg-rose-500\/20,
html.theme-light .bg-amber-500\/10,
html.theme-light .bg-amber-500\/20,
html.theme-light .bg-violet-500\/20 {
    background-color: #e8f1ff !important;
}

html.theme-light .border-blue-900\/30,
html.theme-light .border-blue-900\/40,
html.theme-light .border-blue-900\/20,
html.theme-light .border-white\/5,
html.theme-light .border-white\/10,
html.theme-light .border-white\/15,
html.theme-light .border-white\/20 {
    border-color: #dbe4ef !important;
}

html.theme-light .border-t {
    border-color: #dbe4ef !important;
}

html.theme-light header {
    background-color: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

html.theme-light .hero-pattern,
html.theme-light .bg-gradient-to-br,
html.theme-light .bg-gradient-to-b,
html.theme-light .bg-gradient-to-r {
    background-image: none !important;
    background-color: #eef6ff !important;
}

html.theme-light .glass {
    background: rgba(255, 255, 255, 0.82) !important;
    border-color: #dbe4ef !important;
    color: #172033 !important;
}

html.theme-light .card-hover {
    background-color: #ffffff !important;
    border-color: #d5dfeb !important;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.08);
}

html.theme-light .card-hover:hover {
    box-shadow: 0 18px 36px rgba(30, 64, 175, 0.14);
}

html.theme-light .bg-dark-950\/60 {
    background-color: #f1f5f9 !important;
}

html.theme-light [class*="from-dark-950"],
html.theme-light [class*="via-dark-950"] {
    background-image: linear-gradient(to top, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.12), transparent) !important;
}

html.theme-light .theme-toggle {
    background: #ffffff;
    color: #172033;
    border-color: #cbd5e1;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

html.theme-light footer {
    background-color: #eaf2fb !important;
}

html.theme-light .section-divider {
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.25), transparent);
}

html.theme-light ::-webkit-scrollbar-track {
    background: #e2e8f0;
}

/* Keep content inside the viewport on phones and small tablets. */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

button,
a {
    touch-action: manipulation;
}

@media (max-width: 1023px) {
    .theme-toggle {
        top: 86px;
    }
}

@media (max-width: 640px) {
    html {
        font-size: 90%;
    }

    .theme-toggle {
        top: 84px;
        right: 0.75rem;
    }

    .theme-toggle span {
        display: none;
    }

    h1,
    h2,
    h3 {
        overflow-wrap: anywhere;
    }

    section>.max-w-7xl,
    footer>.max-w-7xl {
        width: 100%;
    }
}