/* Light changes through the day; cream remains the daytime fallback. */
:root[data-time-theme="morning"] {
    --bg: #f9e9ed;
    --card-bg: #fff3f6;
    --surface-white: var(--card-bg);
    --line-ink: #725766;
    --link-hover: #87465e;
    --field-line: #aa8194;
    --rose-light: #e6bccb;
    --sage-light: #b9c4b2;
    --sky-light: #c3cadc;
    --bg-soft: #f3dde5;
    --bg-middle: #f8e6eb;
    --bg-warm: #ead3df;
    --header-bg: rgba(249, 233, 237, .94);
    --text: #513b48;
    --text-soft: #725766;
    --text-muted: #967887;
    --gold: #995c72;
    --gold-light: #bc8097;
    --rose: #d19aaa;
    --sage: #9caa94;
    --sky: #a6afc5;
    --card-back-filter: sepia(.85) saturate(.8) hue-rotate(305deg);
    --firefly-opacity: .55;
}

:root[data-time-theme="evening"] {
    --bg: #f5dcca;
    --surface-white: var(--card-bg);
    --line-ink: #705861;
    --link-hover: #874631;
    --field-line: #b78773;
    --rose-light: #e2bdbe;
    --sage-light: #becbbf;
    --sky-light: #b9d3e0;
    --bg-soft: #f0d0bc;
    --bg-middle: #f3d7c7;
    --bg-warm: #dfbfb1;
    --card-bg: #fcf0e5;
    --header-bg: rgba(216, 232, 239, .94);
    --text: #493c42;
    --text-soft: #705861;
    --text-muted: #8d6e76;
    --gold: #a35d46;
    --gold-light: #c78b67;
    --rose: #cd9b9f;
    --sage: #9aa99d;
    --sky: #91b8cd;
    --card-back-filter: sepia(.85) saturate(.8) hue-rotate(345deg);
    --firefly-opacity: 1;
}
/* The same sunset is painted by the page and its scrolling header. */
:root[data-time-theme="evening"] {
    --page-background:
        linear-gradient(180deg, #d8e8ef 0, #dde6e9 200px, #e7dfdc 430px, #f5dcca 850px, transparent 1100px),
        linear-gradient(180deg, var(--bg), var(--bg-soft) 50%, var(--bg-warm));
}

:root[data-time-theme="night"] {
    color-scheme: dark;
    --bg: #253247;
    --surface-white: var(--card-bg);
    --line-ink: #c0cfe5;
    --on-accent: #253247;
    --link-hover: #d7e3f3;
    --field-line: #9db6da;
    --bg-soft: #202b40;
    --bg-middle: #26334a;
    --bg-warm: #1c283b;
    --card-bg: #314159;
    --header-bg: rgba(37, 50, 71, .95);
    --text: #e0e7f1;
    --text-soft: #b5c4d8;
    --text-muted: #a6b4c8;
    --gold: #b8cbe4;
    --gold-light: #d7e3f3;
    --rose: #baa3bf;
    --rose-light: #cfbad0;
    --sage: #9cb5a9;
    --sage-light: #bccfc5;
    --sky: #9db6da;
    --sky-light: #c0cfe5;
    --card-back-filter: sepia(1) saturate(.95) hue-rotate(165deg) brightness(.88);
    --firefly-opacity: 1;
}

.hero__fireflies { opacity: var(--firefly-opacity, .8); }

/* Keep light paper legible in the moonlit garden. */
:root[data-time-theme="night"] :is(.auth-modal__content, .sidebar__widget--cta) {
    color-scheme: light;
    --text: #3a2e25;
    --text-soft: #6d5c4e;
    --text-muted: #8b7766;
    --gold: #a26340;
    --gold-light: #c78e60;
    --link-hover: #a65e3d;
    --field-line: #b29573;
    --on-accent: #fff;
    color: var(--text);
}
:root[data-time-theme="night"] .home-intent--blue { --intent-tint: rgba(79, 110, 150, .23); }
:root[data-time-theme="night"] .home-intent--sage { --intent-tint: rgba(100, 136, 122, .2); }
:root[data-time-theme="night"] .home-intent--rose { --intent-tint: rgba(152, 111, 146, .2); }
:root[data-time-theme="night"] :is(.hero__botanical, .home-intent__image, .home-learning__image) { mix-blend-mode: normal; }
:root[data-time-theme="night"] :is(.home-section-wash)::before { mix-blend-mode: normal; }
:root[data-time-theme="night"] .header-moon__shadow { fill: #46546d; }
:root[data-time-theme="night"] .header-moon__light { fill: #d3dfef; }
:root[data-time-theme="night"] :is(.mobile-menu__auth button, .mobile-menu [aria-current="page"], .nav__link[aria-current="page"], .sidebar__list a) { color: var(--gold); }
:root[data-time-theme="night"] :is(.home-learning__item:hover .home-learning__action, .home-questions__links a:hover, .tarot-intro__link:hover, .header__login:hover) { color: var(--gold-light); }
:root[data-time-theme="night"] .hero__daily-error { color: #f0b4a6; }
:root[data-time-theme="night"] .three-cards-slot__front::before { background: radial-gradient(ellipse, rgba(155, 180, 219, .13), transparent 72%); }

:root[data-time-theme="night"] .hero__moth,
:root[data-time-theme="night"] :is(.home-discovery, .home-library, .home-learning)::before,
:root[data-time-theme="night"] :is(.home-discovery, .home-library, .home-learning)::after,
:root[data-time-theme="night"] .tarot-intro::after { mix-blend-mode: normal; }
:root[data-time-theme="night"] .home-library { --section-wash: radial-gradient(ellipse 850px 600px at 0 10%, rgba(116, 142, 171, .13), transparent 75%), radial-gradient(ellipse 750px 500px at 100% 80%, rgba(151, 129, 159, .1), transparent 75%); }

/* Tone only the backs, including the moving copy during selection. */
:is(.hero__daily-card > img, .three-cards-card > img, .three-cards-slot__back > img, img.three-cards-flight) {
    filter: var(--card-back-filter, none);
}
:root[data-time-theme="night"] .hero__fireflies i {
    background: #c9d9ef;
    box-shadow: 0 0 9px 3px rgba(167, 195, 235, .2);
}

/* Saved-reading rows keep their open list treatment at night. */
:root[data-time-theme="night"] .account .reading-list__item { background: transparent; }
:root[data-time-theme="night"] .account-social__row .soul-form__error { color: #f0b4a6; }

/* Status colors stay readable on dark form and result surfaces. */
:root[data-time-theme="night"] :is(.soul-form__error, .three-cards-form__error) { color: #f0b4a6; }
