/* =========================================================
   Shenasnapet — Dark Mode
   Controlled by html[data-shenasnapet-theme="dark"]
   ========================================================= */

html[data-shenasnapet-theme="dark"] {
    color-scheme: dark;
    --shenasnapet-bg: #15181B;
    --shenasnapet-bg-image: url('../images/backgrounds/dark-paw.webp');
    --shenasnapet-white: #22262A;
    --shenasnapet-text: #F4F1ED;
    --shenasnapet-muted: #B7B0A8;
    --shenasnapet-border: #3A3F44;
    --shenasnapet-orange-light: #3A291A;
}

html[data-shenasnapet-theme="dark"] body {
    background-color: #15181B;
    background-image: var(--shenasnapet-bg-image);
    color: #F4F1ED;
}

html[data-shenasnapet-theme="dark"] ::selection {
    background: rgba(242, 140, 40, 0.34);
    color: #FFFFFF;
}

/* Header / footer stay recognisably Shenasnapet, but become deeper. */
html[data-shenasnapet-theme="dark"] .theme_shenasnapet-header,
html[data-shenasnapet-theme="dark"] .theme_shenasnapet-nav,
html[data-shenasnapet-theme="dark"] .theme_shenasnapet-footer {
    background: #111416;
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-shenasnapet-theme="dark"] .theme_shenasnapet-nav li,
html[data-shenasnapet-theme="dark"] .theme_shenasnapet-mobile-language-row,
html[data-shenasnapet-theme="dark"] .theme_shenasnapet-footer-bottom {
    border-color: rgba(255, 255, 255, 0.09);
}

html[data-shenasnapet-theme="dark"] .theme_shenasnapet-menu-toggle {
    background: #292D31;
}

html[data-shenasnapet-theme="dark"] .theme_shenasnapet-menu-toggle span {
    background: #F5EEE8;
}

/* Color-scheme toggle */
.theme_shenasnapet-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(242, 140, 40, 0.72);
    border-radius: 50%;
    background: #24272A;
    color: #FFE7D0;
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.theme_shenasnapet-theme-toggle:hover {
    transform: translateY(-1px);
    background: #303438;
    color: #F28C28;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.theme_shenasnapet-theme-toggle:focus-visible {
    outline: 3px solid rgba(242, 140, 40, 0.32);
    outline-offset: 3px;
}

.theme_shenasnapet-theme-toggle svg {
    width: 19px;
    height: 19px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme_shenasnapet-theme-toggle .theme_shenasnapet-theme-icon--sun {
    display: none;
}

html[data-shenasnapet-theme="dark"] .theme_shenasnapet-theme-toggle .theme_shenasnapet-theme-icon--moon {
    display: none;
}

html[data-shenasnapet-theme="dark"] .theme_shenasnapet-theme-toggle .theme_shenasnapet-theme-icon--sun {
    display: block;
}

.theme_shenasnapet-theme-toggle--desktop {
    position: absolute;
    inset-inline-start: 82px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.theme_shenasnapet-theme-toggle--desktop:hover {
    transform: translateY(calc(-50% - 1px));
}

.theme_shenasnapet-mobile-utilities-row {
    display: none;
}

/* Generic public pages */
html[data-shenasnapet-theme="dark"] :where(
    .shenasnapet-about-card,
    .shenasnapet-how-step,
    .shenasnapet-faq-item,
    .shenasnapet-contact-card,
    .shenasnapet-step,
    .shenasnapet-feature-card,
    .shenasnapet-home-story-card,
    .shenasnapet-button-secondary
) {
    background: #22262A;
    border-color: rgba(255, 255, 255, 0.10);
    color: #F4F1ED;
    box-shadow: none;
}

html[data-shenasnapet-theme="dark"] :where(
    .shenasnapet-about-header h1,
    .shenasnapet-about-card h2,
    .shenasnapet-how-header h1,
    .shenasnapet-how-body h2,
    .shenasnapet-faq-header h1,
    .shenasnapet-faq-item summary,
    .shenasnapet-contact-page .shenasnapet-section-heading h1,
    .shenasnapet-contact-card h2,
    .shenasnapet-404 h1
) {
    color: #F4F1ED;
}

html[data-shenasnapet-theme="dark"] :where(
    .shenasnapet-about-header p,
    .shenasnapet-about-card p,
    .shenasnapet-how-header p,
    .shenasnapet-how-body p,
    .shenasnapet-faq-header p,
    .shenasnapet-faq-item p,
    .shenasnapet-contact-page .shenasnapet-section-heading p,
    .shenasnapet-contact-card p,
    .shenasnapet-404 p
) {
    color: #B7B0A8;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-how-it-works,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-cta {
    background: #15181B;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-contact-icon,
html[data-shenasnapet-theme="dark"] .shenasnapet-step-number {
    background: #382819;
    color: #F5A24F;
}

/* Home page variables + surfaces */
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page {
    --sp-home-ink: #F4F1ED;
    --sp-home-muted: #B7B0A8;
    --sp-home-orange: #F28C28;
    --sp-home-orange-deep: #F0A052;
    --sp-home-peach: #2A211A;
    --sp-home-cream: #211D19;
    --sp-home-blue: #1B2630;
    --sp-home-blue-strong: #22384B;
    --sp-home-mint: #1C2A22;
    --sp-home-line: rgba(255, 255, 255, 0.09);
    color: var(--sp-home-ink);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-hero p,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-section-heading p,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-step p,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card p,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-story-content p {
    color: #B7B0A8;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-how {
    background: #1B2630;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features {
    background: #1D1B19;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-story {
    background: #1C2A22;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-story-card,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-button-secondary {
    background: rgba(34, 38, 42, 0.94);
    border-color: rgba(255, 255, 255, 0.10);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-icon,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-step-number {
    background: #33271E;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-cta {
    background: #15181B;
}

/* Native controls on ordinary theme pages */
html[data-shenasnapet-theme="dark"] :where(input, textarea, select) {
    color-scheme: dark;
}

@media (max-width: 768px) {
    .theme_shenasnapet-theme-toggle--desktop {
        display: none;
    }

    .theme_shenasnapet-mobile-language-row {
        display: none;
    }

    .theme_shenasnapet-mobile-utilities-row {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 12px;
        margin-top: 4px;
        padding-top: 16px;
        border-top: 1px solid #F1F1F1;
    }

    html[data-shenasnapet-theme="dark"] .theme_shenasnapet-mobile-utilities-row {
        border-color: rgba(255, 255, 255, 0.09);
    }

    .theme_shenasnapet-nav .theme_shenasnapet-theme-toggle--mobile {
        display: inline-flex;
        width: 42px;
        height: 42px;
        padding: 0;
    }
}

/* =========================================================
   Phase 2.19 — Dark Mode hover polish
   ========================================================= */
html[data-shenasnapet-theme="dark"] .shenasnapet-button-secondary:hover {
    background: #2D3338;
    border-color: #F28C28;
    color: #F5A24F;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card:hover {
    background: #292E33;
    border-color: rgba(242, 140, 40, 0.28);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   Home v2.1 — Dark mode repair
   The homepage illustrations are opaque assets. Dark mode keeps the
   hero as an intentional media panel and removes decorative opaque
   background art where it would otherwise create bright rectangles.
   ========================================================= */

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-hero {
    background: #171A1D;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-hero h1,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-section-heading h2,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-step h3,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card h3,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-story-content h2 {
    color: #F7F3EF;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-step {
    background: #22282E;
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-how {
    background: #18232D;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features {
    background: #191B1D;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features-art {
    display: none;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features {
    min-height: 0;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features .shenasnapet-section-heading,
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-features-grid {
    width: min(100%, 900px);
    margin-inline: auto;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card {
    background: #23272B;
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-icon {
    background: #34271C;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-story-card {
    background: #222A25;
    border-color: rgba(132, 204, 157, 0.15);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-story-avatars img {
    background: #2A2F2C;
    border-color: #2A2F2C;
    filter: brightness(0.86) saturate(0.9);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-cta-box {
    background: #24282C;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-button-secondary {
    background: #2A2F34;
    color: #F4F1ED;
}

@media (min-width: 768px) {
    html[data-shenasnapet-theme="dark"] .shenasnapet-home-hero-desktop-art {
        filter: brightness(0.58) saturate(0.82) contrast(1.08);
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-hero::after {
        background: linear-gradient(
            90deg,
            rgba(23, 26, 29, 0.99) 0%,
            rgba(23, 26, 29, 0.94) 30%,
            rgba(23, 26, 29, 0.66) 48%,
            rgba(23, 26, 29, 0.18) 72%,
            rgba(23, 26, 29, 0.05) 100%
        );
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page--en .shenasnapet-home-hero::after {
        background: linear-gradient(
            90deg,
            rgba(23, 26, 29, 0.99) 0%,
            rgba(23, 26, 29, 0.94) 30%,
            rgba(23, 26, 29, 0.66) 48%,
            rgba(23, 26, 29, 0.18) 72%,
            rgba(23, 26, 29, 0.05) 100%
        );
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-how {
        padding-bottom: 82px;
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-how-art {
        display: none;
    }
}

@media (max-width: 767px) {
    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-hero {
        padding-top: 20px;
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-hero-mobile-art {
        width: calc(100% - 24px);
        margin: 0 auto 24px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 24px;
        background: #221E1A;
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-hero-mobile-art img {
        border-radius: inherit;
        filter: brightness(0.74) saturate(0.88) contrast(1.04);
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-how {
        padding-bottom: 60px;
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-how-art {
        display: none;
    }

    html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-home-features {
        padding-top: 58px;
        padding-bottom: 58px;
    }
}

/* =========================================================
   Home v2.2 — brighter blue feature icons in Dark Mode
   ========================================================= */
html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-icon {
    background: rgba(74, 163, 255, 0.14);
    border: 1px solid rgba(109, 184, 255, 0.22);
    box-shadow: inset 0 0 0 1px rgba(109, 184, 255, 0.025);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-icon img {
    /* Convert the dark SVG strokes to a clear brand-friendly light blue. */
    filter: brightness(0) saturate(100%) invert(69%) sepia(38%) saturate(1277%) hue-rotate(179deg) brightness(103%) contrast(102%);
    opacity: 1;
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card:hover .shenasnapet-feature-icon {
    background: rgba(109, 184, 255, 0.20);
    border-color: rgba(140, 200, 255, 0.38);
    transform: translateY(-1px);
}

html[data-shenasnapet-theme="dark"] .shenasnapet-home-page .shenasnapet-feature-card:hover .shenasnapet-feature-icon img {
    filter: brightness(0) saturate(100%) invert(78%) sepia(31%) saturate(1010%) hue-rotate(177deg) brightness(104%) contrast(103%);
}

/* =========================================================
   Phase 25 — FarazSMS login/register form in Dark Mode
   The FarazSMS plugin renders its own white surfaces, so the theme must
   explicitly override them when Shenasnapet dark mode is active.
   ========================================================= */
html[data-shenasnapet-theme="dark"] :where(
    .login-register-form,
    .farazsms-main-login-form,
    .farazsms-main-login-form form,
    form#submit-identifier
) {
    color: #F4F1ED !important;
}

html[data-shenasnapet-theme="dark"] .login-register-form {
    background: #1B1F23 !important;
    border-color: #3A4046 !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .20) !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form {
    background: transparent !important;
    color: #F4F1ED !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    h1, h2, h3, h4, h5, h6,
    p, label, span, strong, small, div
) {
    color: inherit;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    input[type="text"],
    input[type="tel"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input:not([type]),
    textarea,
    select
) {
    background: #24292E !important;
    color: #F7F3EE !important;
    border-color: #4A5158 !important;
    caret-color: #F28C28 !important;
    -webkit-text-fill-color: #F7F3EE !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    input[type="text"],
    input[type="tel"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input:not([type])
)::placeholder {
    color: #AFA79F !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #AFA79F !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form input:-webkit-autofill,
html[data-shenasnapet-theme="dark"] .farazsms-main-login-form input:-webkit-autofill:hover,
html[data-shenasnapet-theme="dark"] .farazsms-main-login-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: #F7F3EE !important;
    -webkit-box-shadow: 0 0 0 1000px #24292E inset !important;
    box-shadow: 0 0 0 1000px #24292E inset !important;
    border-color: #4A5158 !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    input:focus,
    textarea:focus,
    select:focus
) {
    border-color: #F28C28 !important;
    box-shadow: 0 0 0 3px rgba(242, 140, 40, .15) !important;
    outline: none !important;
}

/* OTP / segmented code inputs used by different FarazSMS versions. */
html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    .otp-input,
    .otp-code input,
    .verification-code input,
    [class*="otp"] input,
    [class*="verify"] input
) {
    background: #24292E !important;
    color: #F7F3EE !important;
    border-color: #4A5158 !important;
}

html[data-shenasnapet-theme="dark"] .farazsms-main-login-form :where(
    .description,
    .help-text,
    .form-text,
    small
) {
    color: #B7B0A8 !important;
}
