/**
 * Factory website — professional light / dark theme
 * Toggle: #fsThemeToggle | storage key: website_theme
 */

:root,
html[data-theme="light"] {
    --fs-page: #f7f9fc;
    --fs-surface: #ffffff;
    --fs-surface-2: #f1f5f9;
    --fs-elevated: #ffffff;
    --fs-ink: #0f1c2e;
    --fs-muted: #5b6b7c;
    --fs-line: #e2e8f0;
    --fs-soft: #f1f5f9;
    --fs-chip: #f4f7fb;
    --fs-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --fs-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    color-scheme: light;
}

html[data-theme="dark"] {
    --fs-page: #080e1a;
    --fs-surface: #0f172a;
    --fs-surface-2: #152033;
    --fs-elevated: #1a2438;
    --fs-ink: #ffffff;
    --fs-muted: #94a3b8;
    --fs-line: rgba(148, 163, 184, 0.18);
    --fs-soft: #152033;
    --fs-chip: #1e293b;
    --fs-shadow: 0 22px 56px rgba(0, 0, 0, 0.45);
    --fs-shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

/* ── Base ── */
body.fs-body {
    background: var(--fs-page) !important;
    color: var(--fs-ink) !important;
    transition: background-color 0.25s ease, color 0.2s ease;
}

/* ── Theme toggle ── */
.fs-theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    border: 1px solid var(--fs-line);
    background: var(--fs-chip);
    color: var(--fs-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, color 0.2s ease;
    flex-shrink: 0;
}

.fs-theme-toggle:hover {
    border-color: var(--fs-blue);
    color: var(--fs-blue);
    transform: translateY(-1px);
}

.fs-theme-toggle i {
    font-size: 1rem;
    line-height: 1;
}

.fs-theme-toggle .fs-theme-icon--sun { display: none; }
.fs-theme-toggle .fs-theme-icon--moon { display: inline-block; }

html[data-theme="dark"] .fs-theme-toggle .fs-theme-icon--sun { display: inline-block; }
html[data-theme="dark"] .fs-theme-toggle .fs-theme-icon--moon { display: none; }

html[data-theme="dark"] .fs-theme-toggle {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f8fafc;
}

html[data-theme="dark"] .fs-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

/* ── Light polish ── */
html[data-theme="light"] body.fs-body .fs-topbar,
html:not([data-theme="dark"]) body.fs-body .fs-topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--fs-line);
}

html[data-theme="light"] body.fs-body .fs-nav,
html:not([data-theme="dark"]) body.fs-body .fs-nav {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--fs-line);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] body.fs-body .fs-section--soft,
html:not([data-theme="dark"]) body.fs-body .fs-section--soft {
    background: linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
}

html[data-theme="light"] body.fs-body .fs-btn--ghost,
html:not([data-theme="dark"]) body.fs-body .fs-btn--ghost {
    background: #fff;
    color: var(--fs-ink);
    border-color: var(--fs-line);
}

/* ── Dark: chrome ── */
html[data-theme="dark"] body.fs-body .fs-topbar {
    background: rgba(15, 23, 42, 0.92) !important;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--fs-line) !important;
}

html[data-theme="dark"] body.fs-body .fs-nav {
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--fs-line) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body.fs-body .fs-nav.is-scrolled {
    background: rgba(8, 14, 26, 0.98) !important;
}

html[data-theme="dark"] body.fs-body .fs-brand__text strong,
html[data-theme="dark"] body.fs-body .fs-topmeta__text strong {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-brand__text span,
html[data-theme="dark"] body.fs-body .fs-topmeta__text span,
html[data-theme="dark"] body.fs-body .fs-muted,
html[data-theme="dark"] body.fs-body .fs-text {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] body.fs-body .fs-brand__logo {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] body.fs-body .fs-topbar__chip {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] body.fs-body .fs-topbar__chip:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

html[data-theme="dark"] body.fs-body .fs-social__btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] body.fs-body .fs-social__btn:hover {
    background: var(--fs-blue) !important;
    border-color: var(--fs-blue) !important;
    color: #fff !important;
}

/* Nav links — white in dark, primary accent when active */
html[data-theme="dark"] body.fs-body .fs-nav__menu a:not(.fs-btn) {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] body.fs-body .fs-nav__menu a.is-active:not(.fs-btn),
html[data-theme="dark"] body.fs-body .fs-nav__menu a:not(.fs-btn):hover {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-nav__toggle span {
    background: #fff !important;
}

html[data-theme="dark"] body.fs-body .fs-lang__btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] body.fs-body .fs-lang__menu {
    background: #152033 !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: var(--fs-shadow);
}

html[data-theme="dark"] body.fs-body .fs-lang__menu a {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] body.fs-body .fs-lang__menu a.is-active,
html[data-theme="dark"] body.fs-body .fs-lang__menu a:hover {
    color: #fff !important;
    background: rgba(var(--primary-rgb, 47, 109, 147), 0.28) !important;
}

/* ── Dark: content surfaces ── */
html[data-theme="dark"] body.fs-body .fs-section--soft {
    background: #0c1424 !important;
}

html[data-theme="dark"] body.fs-body .fs-h2,
html[data-theme="dark"] body.fs-body .fs-contact h2,
html[data-theme="dark"] body.fs-body .fs-page__head .fs-h2,
html[data-theme="dark"] body.fs-body .fs-partners span,
html[data-theme="dark"] body.fs-body h1,
html[data-theme="dark"] body.fs-body h2,
html[data-theme="dark"] body.fs-body h3,
html[data-theme="dark"] body.fs-body h4 {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-kicker {
    color: var(--fs-blue) !important;
}

html[data-theme="dark"] body.fs-body .fs-hero__kicker,
html[data-theme="dark"] body.fs-body .fs-hero__title,
html[data-theme="dark"] body.fs-body .fs-hero__lead {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-pillar,
html[data-theme="dark"] body.fs-body .fs-value,
html[data-theme="dark"] body.fs-body .fs-solution,
html[data-theme="dark"] body.fs-body .fs-gallery__item,
html[data-theme="dark"] body.fs-body .fs-contact__card,
html[data-theme="dark"] body.fs-body .fs-contact__form,
html[data-theme="dark"] body.fs-body .fs-page__content,
html[data-theme="dark"] body.fs-body .fs-counter {
    background: var(--fs-elevated) !important;
    border-color: var(--fs-line) !important;
    color: #ffffff !important;
    box-shadow: var(--fs-shadow-sm);
}

html[data-theme="dark"] body.fs-body .fs-pillar p,
html[data-theme="dark"] body.fs-body .fs-value p,
html[data-theme="dark"] body.fs-body .fs-solution p,
html[data-theme="dark"] body.fs-body .fs-page__content p,
html[data-theme="dark"] body.fs-body .fs-contact__list span,
html[data-theme="dark"] body.fs-body .fs-contact__list div {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] body.fs-body .fs-pillar strong,
html[data-theme="dark"] body.fs-body .fs-value strong,
html[data-theme="dark"] body.fs-body .fs-solution strong,
html[data-theme="dark"] body.fs-body .fs-contact__list strong,
html[data-theme="dark"] body.fs-body .fs-counter strong {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-btn--ghost {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

html[data-theme="dark"] body.fs-body .fs-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #fff !important;
}

html[data-theme="dark"] body.fs-body .fs-btn--primary,
html[data-theme="dark"] body.fs-body .fs-btn--nav,
html[data-theme="dark"] body.fs-body .fs-topbar__login {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-input,
html[data-theme="dark"] body.fs-body .fs-textarea {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-input::placeholder,
html[data-theme="dark"] body.fs-body .fs-textarea::placeholder {
    color: #94a3b8 !important;
}

html[data-theme="dark"] body.fs-body .fs-input:focus,
html[data-theme="dark"] body.fs-body .fs-textarea:focus {
    border-color: var(--fs-blue) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 47, 109, 147), 0.28) !important;
}

html[data-theme="dark"] body.fs-body .fs-form-note {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] body.fs-body .fs-form-note.is-ok { color: #86efac !important; }
html[data-theme="dark"] body.fs-body .fs-form-note.is-err { color: #fca5a5 !important; }

/* Navy / primary sections keep white text */
html[data-theme="dark"] body.fs-body .fs-section--navy,
html[data-theme="dark"] body.fs-body .fs-section--navy .fs-h2,
html[data-theme="dark"] body.fs-body .fs-section--navy .fs-text,
html[data-theme="dark"] body.fs-body .fs-section--navy .fs-kicker,
html[data-theme="dark"] body.fs-body .fs-footer,
html[data-theme="dark"] body.fs-body .fs-footer * {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-footer {
    background: #060b14 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] body.fs-body .fs-footer__links a {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] body.fs-body .fs-footer__links a:hover {
    color: #ffffff !important;
}

html[data-theme="dark"] body.fs-body .fs-why__points li,
html[data-theme="dark"] body.fs-body .fs-why__copy,
html[data-theme="dark"] body.fs-body .fs-page__content li,
html[data-theme="dark"] body.fs-body .fs-page__content td,
html[data-theme="dark"] body.fs-body .fs-page__content th {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] body.fs-body .fs-page__content a {
    color: #93c5fd !important;
}

/* Mobile menu panel */
@media (max-width: 920px) {
    html[data-theme="dark"] body.fs-body .fs-nav__menu.is-open {
        background: #0f172a !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
        box-shadow: var(--fs-shadow);
    }
}
