/* ── Theme Toggle (Neumorphic) ── */
.theme-switch {
    position: relative;
    flex-shrink: 0;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch:focus-visible .theme-switch__track {
    outline: 2px solid #0051ff;
    outline-offset: 3px;
}

.theme-switch__track {
    position: relative;
    display: flex;
    align-items: center;
    --track-w: 9.5rem;
    --thumb-size: 2.1rem;
    --thumb-gap: 0.2rem;
    --thumb-travel: calc(var(--track-w) - var(--thumb-size) - var(--thumb-gap) * 2);
    width: var(--track-w);
    height: 2.5rem;
    border-radius: 9999px;
    background: #e4e8ee;
    box-shadow:
        inset 3px 3px 7px rgba(0, 0, 0, 0.12),
        inset -3px -3px 7px rgba(255, 255, 255, 0.95);
    transition: background 0.45s ease, box-shadow 0.45s ease;
}

.theme-switch__text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #8b95a5;
    white-space: nowrap;
    transition: opacity 0.3s ease, color 0.45s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    pointer-events: none;
}

.theme-switch__text--light {
    right: 0.75rem;
    opacity: 1;
}

.theme-switch__text--dark {
    left: 0.75rem;
    opacity: 0;
}

.theme-switch__thumb {
    position: absolute;
    top: var(--thumb-gap);
    left: var(--thumb-gap);
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        3px 3px 8px rgba(0, 0, 0, 0.14),
        -2px -2px 6px rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
    transition:
        transform 0.5s cubic-bezier(0.34, 1.25, 0.64, 1),
        background 0.45s ease,
        box-shadow 0.45s ease;
    will-change: transform;
}

.theme-switch__icon {
    width: 1rem;
    height: 1rem;
    color: #9aa3b2;
    transition: opacity 0.3s ease 0.05s, transform 0.45s cubic-bezier(0.34, 1.25, 0.64, 1);
}

.theme-switch__icon--moon {
    position: absolute;
    opacity: 0;
    transform: scale(0.5) rotate(-30deg);
}

html.dark .theme-switch__track {
    background: #3a4d63;
    box-shadow:
        inset 4px 4px 10px rgba(0, 0, 0, 0.45),
        inset -2px -2px 6px rgba(255, 255, 255, 0.06);
}

html.dark .theme-switch__text--light {
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
}

html.dark .theme-switch__text--dark {
    opacity: 1;
    color: #6b7f96;
    transform: translateY(-50%) translateX(0);
}

.theme-switch__text--light {
    transform: translateY(-50%) translateX(0);
}

.theme-switch__text--dark {
    transform: translateY(-50%) translateX(-4px);
}

html:not(.dark) .theme-switch__text--dark {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
}

html.dark .theme-switch__thumb {
    transform: translateX(var(--thumb-travel));
    background: #9eb3c8;
    box-shadow:
        3px 3px 10px rgba(0, 0, 0, 0.35),
        -1px -1px 4px rgba(255, 255, 255, 0.12);
}

html.dark .theme-switch__icon--sun {
    opacity: 0;
    transform: scale(0.5) rotate(30deg);
}

html.dark .theme-switch__icon--moon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    color: #4a5d73;
}

@media (max-width: 480px) {
    .theme-switch__track {
        --track-w: 7.5rem;
    }

    .theme-switch__text {
        font-size: 0.5625rem;
        letter-spacing: 0.06em;
    }
}

/* ── Shared Dark Mode ── */
html.dark {
    color-scheme: dark;
}

html.dark body {
    background-color: #0b1220;
    color: #e2e8f0;
}

html.dark .page-bg {
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 81, 255, 0.14), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(37, 99, 235, 0.1), transparent),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(0, 81, 255, 0.08), transparent);
}

html.dark .glass-nav {
    background: rgba(11, 18, 32, 0.8);
    border-bottom-color: rgba(96, 165, 250, 0.1);
}

html.dark .glass-nav.is-scrolled {
    background: rgba(11, 18, 32, 0.95);
    border-bottom-color: rgba(96, 165, 250, 0.15);
    box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.45);
}

html.dark .bg-gray-50 { background-color: #111827 !important; }
html.dark .bg-white:not(.keep-white):not(.cta-btn-white) { background-color: #1e293b !important; }
html.dark .bg-gray-900 { background-color: #030712 !important; }
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-y { border-color: #334155 !important; }
html.dark .border-t { border-top-color: #334155 !important; }
html.dark .text-gray-900 { color: #f1f5f9 !important; }
html.dark .text-gray-800 { color: #e2e8f0 !important; }
html.dark .text-gray-600 { color: #94a3b8 !important; }
html.dark .text-gray-500 { color: #64748b !important; }
html.dark .text-gray-400 { color: #94a3b8 !important; }
html.dark strong.text-gray-900 { color: #f8fafc !important; }

html.dark .bg-brand-50 { background-color: rgba(0, 81, 255, 0.2) !important; }
html.dark .bg-blue-50 { background-color: rgba(37, 99, 235, 0.15) !important; }
html.dark .border-brand-100 { border-color: rgba(96, 165, 250, 0.2) !important; }

html.dark .about-card {
    background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
    border-color: rgba(96, 165, 250, 0.12);
    box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.4);
}

html.dark .hero-section::before {
    background-image:
        linear-gradient(rgba(96, 165, 250, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96, 165, 250, 0.07) 1px, transparent 1px);
}

html.dark .hero-badge {
    background-color: rgba(0, 81, 255, 0.18) !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
}

html.dark .service-card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html.dark .service-card:hover {
    border-color: rgba(96, 165, 250, 0.35) !important;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
}

html.dark .service-card .bg-brand-50 {
    background-color: rgba(0, 81, 255, 0.15) !important;
}

html.dark .btn-secondary {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html.dark .btn-secondary:hover {
    background-color: #334155 !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}

html.dark .cta-banner {
    background: linear-gradient(135deg, rgba(0, 81, 255, 0.18) 0%, rgba(37, 99, 235, 0.22) 50%, rgba(0, 81, 255, 0.18) 100%);
    border-color: rgba(96, 165, 250, 0.2) !important;
}

html.dark .faq-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html.dark .faq-item:hover,
html.dark .faq-item[open] {
    border-color: rgba(96, 165, 250, 0.3) !important;
}

html.dark footer {
    background-color: #0f172a !important;
}

html.dark footer .border-t {
    border-top-color: #334155 !important;
}

html.dark .social-btn {
    background-color: #334155 !important;
    color: #cbd5e1 !important;
}

html.dark .preview-card {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

html.dark .preview-card .bg-gray-700 {
    background-color: #334155 !important;
}

html.dark #benefits .bg-white\/10 {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* CTA section — keep white button on blue gradient */
html.dark .cta-btn-white {
    background-color: #ffffff !important;
    color: #0051ff !important;
}

html.dark .cta-btn-white:hover {
    background-color: #f1f5f9 !important;
    color: #0051ff !important;
}

/* Request page */
html.dark .page-shell {
    background-color: #0b1220;
}

html.dark .request-form-area,
html.dark .form-section {
    background-color: #0b1220 !important;
}

html.dark .form-card {
    background: rgba(30, 41, 59, 0.98) !important;
    border-color: #334155 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

html.dark .form-input,
html.dark select.form-input,
html.dark textarea.form-input {
    background-color: #0f172a !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

html.dark select.form-input option {
    background: #1e293b;
    color: #e2e8f0;
}

html.dark #request-form-error {
    background-color: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

html.dark .privacy-label input[type="checkbox"] {
    border-color: #475569;
    background-color: #0f172a;
}

/* Policy pages */
html.dark .notice-box {
    background-color: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(251, 191, 36, 0.28) !important;
}

html.dark .notice-box p {
    color: #fbbf24 !important;
}

html.dark .notice-box span {
    color: #fde68a !important;
}

html.dark .policy-content h2 {
    color: #f1f5f9;
}

html.dark .policy-content h3 {
    color: #e2e8f0;
}

html.dark .policy-content p,
html.dark .policy-content li {
    color: #94a3b8;
}

html.dark .policy-content strong.text-gray-800,
html.dark strong.text-gray-800 {
    color: #e2e8f0 !important;
}

html.dark .form-input:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15) !important;
}

html.dark .form-input::placeholder {
    color: #64748b;
}

/* Team page */
html.dark .member-card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html.dark .member-card .border-t {
    border-top-color: #334155 !important;
}

html.dark .skill-tag {
    background-color: rgba(0, 81, 255, 0.15) !important;
}

@media (prefers-reduced-motion: reduce) {
    .theme-switch__thumb {
        transition: none !important;
    }
}
