/* =============================================================================
 * mystic.css — visual language for the guest landing page.
 *
 * WHY THIS EXISTS
 *
 * The measured palette of the old landing page was navy (#1e3a8a), greys and
 * emerald, set in Inter, with copy reading "Professional", "Professional-Grade
 * Analysis", "Comprehensive Analysis Suite". That is B2B fintech dressing on a
 * product that sells graphology readings and daily horoscopes. The page also
 * contained ZERO images and ZERO inline SVG — 14 icon-font glyphs and 10
 * gradients were carrying the entire visual identity, which is exactly why it
 * read as a generic SaaS template.
 *
 * The target visitor is someone who already reads horoscopes. For them the
 * corporate register is a mismatch and, worse, it makes an implicit scientific
 * claim the product cannot support. Leaning mystical is both more appealing to
 * this audience AND more defensible: it frames the product as insight and
 * self-reflection rather than assessment.
 *
 * DESIGN RULES
 *   - Night sky, not dark mode: deep indigo/violet with warm gold accents.
 *   - Atmosphere from inline SVG and CSS gradients only. No image files, so the
 *     mood costs almost nothing in page weight.
 *   - One extra display face (serif) at two weights. Body copy stays Inter.
 *   - All motion respects prefers-reduced-motion.
 *   - Scoped to .mystic so it cannot leak into the logged-in app UI.
 * ========================================================================== */

.mystic {
    /* --- Palette ---------------------------------------------------------- */
    --m-void:        #05030f;   /* deepest background */
    --m-night:       #0b0620;   /* primary surface */
    --m-deep:        #150a35;   /* raised surface */
    --m-violet:      #2a1a5e;   /* borders, dividers */
    --m-glow:        #6d4aff;   /* interactive violet */
    --m-glow-soft:   #a78bfa;   /* hover / secondary */

    --m-gold:        #f0c453;   /* primary accent */
    --m-gold-warm:   #e8a13a;   /* accent gradient end */

    --m-ink:         #f4f1ff;   /* headings on dark */
    --m-body:        #c3bade;   /* body copy on dark */
    --m-muted:       #8d84ab;   /* captions */

    --m-radius:      1.25rem;
    --m-radius-lg:   1.75rem;

    color: var(--m-body);
    background-color: var(--m-night);
}

/* -----------------------------------------------------------------------------
 * Typography
 *
 * A serif display face does most of the tonal work — it reads as considered and
 * a little old-world, where Inter reads as software. Body text stays Inter for
 * legibility, especially in the 12 languages this site serves.
 * -------------------------------------------------------------------------- */
.mystic .m-display {
    font-family: 'Cormorant Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.08;
    color: var(--m-ink);
}

.mystic .m-display em {
    font-style: italic;
    font-weight: 500;
    /* Gold gradient on the emphasised word — the one flourish per heading. */
    background: linear-gradient(100deg, var(--m-gold) 0%, var(--m-gold-warm) 55%, var(--m-glow-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mystic .m-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--m-gold);
}

.mystic .m-lede {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--m-body);
}

/* -----------------------------------------------------------------------------
 * Night sky background.
 *
 * Three stacked radial gradients give depth without an image request. The star
 * field is a repeating-gradient trick rather than hundreds of DOM nodes.
 * -------------------------------------------------------------------------- */
.mystic .m-sky {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at 50% -10%,  rgba(109, 74, 255, 0.34) 0%, transparent 70%),
        radial-gradient(620px 420px at 12% 18%,   rgba(240, 196, 83, 0.10) 0%, transparent 65%),
        radial-gradient(760px 560px at 88% 82%,   rgba(167, 139, 250, 0.16) 0%, transparent 68%),
        linear-gradient(180deg, var(--m-void) 0%, var(--m-night) 45%, var(--m-deep) 100%);
}

/* Star field: two layers at different scales for parallax-free depth. */
.mystic .m-sky::before,
.mystic .m-sky::after {
    content: '';
    position: absolute;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background-repeat: repeat;
}

.mystic .m-sky::before {
    background-image:
        radial-gradient(1.5px 1.5px at 20px 30px,  rgba(255,255,255,0.75) 50%, transparent 50%),
        radial-gradient(1px 1px   at 90px 70px,   rgba(255,255,255,0.55) 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 150px 20px, rgba(240,196,83,0.55)  50%, transparent 50%);
    background-size: 200px 140px;
    opacity: 0.9;
    animation: m-twinkle 7s ease-in-out infinite;
}

.mystic .m-sky::after {
    background-image:
        radial-gradient(1px 1px at 40px 90px,  rgba(255,255,255,0.4) 50%, transparent 50%),
        radial-gradient(1px 1px at 130px 40px, rgba(167,139,250,0.5) 50%, transparent 50%);
    background-size: 320px 220px;
    opacity: 0.6;
    animation: m-twinkle 11s ease-in-out infinite reverse;
}

@keyframes m-twinkle {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 0.45; }
}

/* -----------------------------------------------------------------------------
 * Surfaces
 * -------------------------------------------------------------------------- */
.mystic .m-card {
    position: relative;
    border-radius: var(--m-radius);
    background: linear-gradient(160deg, rgba(42, 26, 94, 0.55) 0%, rgba(11, 6, 32, 0.75) 100%);
    border: 1px solid rgba(167, 139, 250, 0.18);
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.9);
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
}

.mystic .m-card:hover {
    transform: translateY(-3px);
    border-color: rgba(240, 196, 83, 0.4);
    box-shadow: 0 26px 60px -30px rgba(109, 74, 255, 0.55);
}

/* Thin gold hairline along the top edge — reads as gilding. */
.mystic .m-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    border-radius: var(--m-radius) var(--m-radius) 0 0;
    background: linear-gradient(90deg, transparent, rgba(240, 196, 83, 0.6), transparent);
}

.mystic .m-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--m-gold);
    background: rgba(240, 196, 83, 0.08);
    border: 1px solid rgba(240, 196, 83, 0.28);
}

/* -----------------------------------------------------------------------------
 * Buttons
 *
 * Minimum 48px tall so they clear the touch target floor on phones — the old
 * mobile theme toggle measured 56x32 and failed it.
 * -------------------------------------------------------------------------- */
.mystic .m-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 52px;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.mystic .m-btn-primary {
    color: #1b1006;
    background: linear-gradient(100deg, var(--m-gold) 0%, var(--m-gold-warm) 100%);
    box-shadow: 0 14px 34px -14px rgba(240, 196, 83, 0.6);
}

.mystic .m-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px -14px rgba(240, 196, 83, 0.75);
}

.mystic .m-btn-ghost {
    color: var(--m-ink);
    background: rgba(167, 139, 250, 0.10);
    border-color: rgba(167, 139, 250, 0.35);
}

.mystic .m-btn-ghost:hover {
    transform: translateY(-2px);
    background: rgba(167, 139, 250, 0.18);
    border-color: rgba(240, 196, 83, 0.45);
}

.mystic .m-btn:focus-visible {
    outline: 3px solid var(--m-gold);
    outline-offset: 3px;
}

/* -----------------------------------------------------------------------------
 * Step numerals for "how it works"
 * -------------------------------------------------------------------------- */
.mystic .m-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    border-radius: 999px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--m-gold);
    background: radial-gradient(circle at 30% 25%, rgba(240,196,83,0.22), rgba(11,6,32,0.9));
    border: 1px solid rgba(240, 196, 83, 0.35);
}

/* Connecting line between steps on desktop only. */
@media (min-width: 900px) {
    .mystic .m-steps {
        position: relative;
    }
    .mystic .m-steps::before {
        content: '';
        position: absolute;
        top: 1.5rem;
        left: 12%;
        right: 12%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(240,196,83,0.35), rgba(167,139,250,0.35), transparent);
        z-index: 0;
    }
    .mystic .m-step {
        position: relative;
        z-index: 1;
    }
}

/* -----------------------------------------------------------------------------
 * Sample analysis panel — styled to feel like a reading, not a report.
 * -------------------------------------------------------------------------- */
.mystic .m-reading {
    border-radius: var(--m-radius-lg);
    background:
        radial-gradient(420px 200px at 88% 0%, rgba(240, 196, 83, 0.10), transparent 70%),
        linear-gradient(165deg, rgba(21, 10, 53, 0.95), rgba(5, 3, 15, 0.98));
    border: 1px solid rgba(167, 139, 250, 0.22);
    box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 1);
}

.mystic .m-reading-dim {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--m-gold);
}

/* Handwriting-style quote for the sample */
.mystic .m-hand {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.375rem;
    line-height: 1.5;
    color: var(--m-ink);
}

/* -----------------------------------------------------------------------------
 * FAQ (native details/summary — no JavaScript required, keyboard accessible,
 * and the content stays in the DOM for crawlers)
 * -------------------------------------------------------------------------- */
.mystic .m-faq {
    border-bottom: 1px solid rgba(167, 139, 250, 0.16);
}

.mystic .m-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    padding: 1.05rem 0;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--m-ink);
    transition: color 0.2s ease;
}

.mystic .m-faq summary::-webkit-details-marker { display: none; }
.mystic .m-faq summary:hover { color: var(--m-gold); }
.mystic .m-faq summary:focus-visible { outline: 3px solid var(--m-gold); outline-offset: 2px; }

.mystic .m-faq summary::after {
    content: '+';
    flex: 0 0 auto;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--m-gold);
    transition: transform 0.25s ease;
}

.mystic .m-faq[open] summary::after {
    transform: rotate(45deg);
}

.mystic .m-faq-body {
    padding: 0 0 1.15rem;
    color: var(--m-body);
    line-height: 1.65;
}

/* -----------------------------------------------------------------------------
 * Divider glyph
 * -------------------------------------------------------------------------- */
.mystic .m-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(240, 196, 83, 0.55);
}

.mystic .m-rule::before,
.mystic .m-rule::after {
    content: '';
    height: 1px;
    width: min(28%, 12rem);
    background: linear-gradient(90deg, transparent, rgba(240, 196, 83, 0.45));
}

.mystic .m-rule::after {
    background: linear-gradient(90deg, rgba(240, 196, 83, 0.45), transparent);
}

/* -----------------------------------------------------------------------------
 * Mobile corrections, from real measurements at 371px.
 *
 * The old hero used py-24 — 96px of padding top AND bottom — so 160px of a
 * 840px screen was empty before the first word, and the hero ran to 940px
 * (1.12 screens). Tightened so the headline, promise and primary action all
 * land on the first screen.
 * -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .mystic .m-hero {
        padding-top: 2.5rem;
        padding-bottom: 3rem;
    }

    .mystic .m-section {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    /* Full-width actions: easier to hit, and reads as a single clear next step. */
    .mystic .m-btn {
        width: 100%;
    }

    .mystic .m-hand {
        font-size: 1.15rem;
    }
}

@media (min-width: 641px) {
    .mystic .m-hero    { padding-top: 5rem;   padding-bottom: 5.5rem; }
    .mystic .m-section { padding-top: 5.5rem; padding-bottom: 5.5rem; }
}

/* -----------------------------------------------------------------------------
 * Reduced motion.
 *
 * The twinkling star field and the card lifts are decorative. For users with
 * vestibular disorders animated backgrounds are a genuine problem, so they are
 * switched off entirely rather than merely shortened (WCAG 2.3.3).
 * -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .mystic .m-sky::before,
    .mystic .m-sky::after {
        animation: none;
    }

    .mystic .m-card,
    .mystic .m-btn {
        transition: none;
    }

    .mystic .m-card:hover,
    .mystic .m-btn:hover {
        transform: none;
    }
}

/* -----------------------------------------------------------------------------
 * Right-to-left (Arabic, Hebrew).
 *
 * Both languages ship complete translations, so the decorative asymmetries need
 * mirroring rather than leaving to chance.
 * -------------------------------------------------------------------------- */
[dir="rtl"] .mystic .m-reading {
    background:
        radial-gradient(420px 200px at 12% 0%, rgba(240, 196, 83, 0.10), transparent 70%),
        linear-gradient(195deg, rgba(21, 10, 53, 0.95), rgba(5, 3, 15, 0.98));
}

[dir="rtl"] .mystic .m-hand {
    font-family: 'Inter', system-ui, sans-serif;
    font-style: normal;
}

/* =============================================================================
 * SITE CHROME — navbar, mobile menu, footer.
 *
 * WHY THIS SECTION EXISTS
 *
 * Restyling the landing page alone left it bracketed by the old chrome: a white
 * glass navbar (`rgba(255,255,255,0.92)`) sitting on top of a near-black hero,
 * a white mobile menu panel, and a neutral grey-900 footer. Dark content between
 * two light bars does not read as a design choice, it reads as broken.
 *
 * SCOPING
 *
 * Everything here is gated on `body.mystic-page`, which is set only on the guest
 * landing page, AND on `html[data-auth="guest"]`. That second condition matters:
 * when a logged-in user loads index.php the guest landing is hidden and the light
 * `#app-container` dashboard is shown instead — a dark navbar above a light
 * dashboard would recreate exactly the mismatch this section exists to remove.
 *
 * So: guest sees dark chrome over the dark landing; a signed-in user sees the
 * original light chrome over the light app. Neither ever mixes.
 * ========================================================================== */

/* -----------------------------------------------------------------------------
 * Navbar surface, set through a custom property rather than an override.
 *
 * `.glass-navbar` in app.css declares its background with `!important`. Beating
 * that means winning a specificity contest — and specificity contests are what
 * broke this navbar three separate times. So app.css now reads its colour from
 * `--navbar-bg`, with the original white as the fallback, and this rule simply
 * supplies a different value further up the tree.
 *
 * Inheritance decides the outcome, not specificity. There is nothing to lose.
 * -------------------------------------------------------------------------- */
html[data-auth="guest"] body.mystic-page {
    background-color: var(--m-night);
    --navbar-bg: rgba(11, 6, 32, 0.82);
    --navbar-border: rgba(240, 196, 83, 0.16);
}

/* --- Navbar ---------------------------------------------------------------- */
html[data-auth="guest"] body.mystic-page #navbar {
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

/* Wordmark */
html[data-auth="guest"] body.mystic-page #navbar a[aria-label] {
    color: var(--m-ink);
}

/* The logo uses bg-clip-text with a dark gradient that vanishes on a dark bar.
   Replaced with a light-to-gold gradient. */
html[data-auth="guest"] body.mystic-page #navbar a[aria-label] .bg-clip-text {
    background-image: linear-gradient(95deg, var(--m-ink) 0%, var(--m-glow-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-auth="guest"] body.mystic-page #navbar a[aria-label] span:first-child,
html[data-auth="guest"] body.mystic-page #navbar a[aria-label] span:last-child {
    color: var(--m-gold);
}

/* Nav links */
html[data-auth="guest"] body.mystic-page #navbar .nav-links a {
    color: var(--m-body);
}

html[data-auth="guest"] body.mystic-page #navbar .nav-links a:hover {
    color: var(--m-gold);
}

/* The animated underline is indigo in app.css; gold reads better here. */
html[data-auth="guest"] body.mystic-page #navbar .nav-links a::after {
    background-color: var(--m-gold);
}

html[data-auth="guest"] body.mystic-page #navbar .nav-links a.is-active {
    color: var(--m-gold) !important;
}

/* Login button: gold, matching the primary CTA in the page body. */
html[data-auth="guest"] body.mystic-page #navbar #login-btn {
    color: #1b1006;
    background: linear-gradient(100deg, var(--m-gold) 0%, var(--m-gold-warm) 100%);
}

/* Language pill and theme toggle */
html[data-auth="guest"] body.mystic-page #navbar #language-selector {
    color: var(--m-ink);
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.3);
}

html[data-auth="guest"] body.mystic-page #navbar #theme-toggle,
html[data-auth="guest"] body.mystic-page #navbar #mobile-top-theme-toggle {
    background: rgba(5, 3, 15, 0.7);
    border-color: rgba(167, 139, 250, 0.28);
}

html[data-auth="guest"] body.mystic-page #navbar #credits-display {
    color: var(--m-ink);
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.25);
}

html[data-auth="guest"] body.mystic-page #navbar #mobile-menu-btn {
    color: var(--m-ink);
}

/* -----------------------------------------------------------------------------
 * Theme toggle: removed from the guest landing.
 *
 * WHY
 *
 * The landing has a fixed art direction — it is a night sky, deliberately, for
 * every visitor. Toggling "light mode" here changes nothing a visitor can see,
 * because every surface on the page is painted from the --m-* palette rather
 * than from Tailwind's light/dark pair. Offering a switch that does nothing is
 * worse than offering no switch: the person clicks it, sees no change, and
 * concludes something is broken.
 *
 * There were also THREE controls for this one setting — #theme-toggle in the
 * desktop bar, #mobile-top-theme-toggle in the mobile bar, and
 * #mobile-theme-toggle inside the mobile menu, the last two both visible on a
 * phone at the same time. Three controls for one boolean is its own confusion.
 *
 * The toggle remains everywhere it does something: the signed-in dashboard, the
 * horoscope page and the downloads page all still honour the preference, and the
 * stored setting is untouched — this only hides the control on this one page.
 *
 * IF YOU WANT THE CHOICE BACK: the honest way is a light "dawn" variant of the
 * mystic palette (parchment and ink instead of night and gold) rather than
 * re-showing a control that does nothing. That is a real design piece, not a
 * CSS tweak.
 * -------------------------------------------------------------------------- */
html[data-auth="guest"] body.mystic-page #theme-toggle,
html[data-auth="guest"] body.mystic-page #mobile-top-theme-toggle,
html[data-auth="guest"] body.mystic-page #mobile-theme-toggle {
    display: none !important;
}

/* --- Mobile menu panel ---------------------------------------------------- */
html[data-auth="guest"] body.mystic-page #mobile-menu {
    background: linear-gradient(180deg, rgba(21, 10, 53, 0.98), rgba(5, 3, 15, 0.99));
    border-top: 1px solid rgba(240, 196, 83, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

html[data-auth="guest"] body.mystic-page #mobile-menu a,
html[data-auth="guest"] body.mystic-page #mobile-menu button {
    color: var(--m-body);
    /* Measured: mobile menu rows were already 48px, which clears the touch
       minimum. Restated here so restyling cannot quietly shrink them. */
    min-height: 48px;
}

html[data-auth="guest"] body.mystic-page #mobile-menu a:hover,
html[data-auth="guest"] body.mystic-page #mobile-menu button:hover {
    color: var(--m-gold);
    background-color: rgba(240, 196, 83, 0.08) !important;
}

html[data-auth="guest"] body.mystic-page #mobile-menu a.is-active {
    color: var(--m-gold) !important;
    background-color: rgba(240, 196, 83, 0.1) !important;
}

/* --- Footer -------------------------------------------------------------- */
html[data-auth="guest"] body.mystic-page footer {
    background: linear-gradient(180deg, var(--m-void) 0%, #030209 100%) !important;
    border-top: 1px solid rgba(240, 196, 83, 0.14);
    color: var(--m-body);
}

html[data-auth="guest"] body.mystic-page footer h3,
html[data-auth="guest"] body.mystic-page footer h4 {
    color: var(--m-ink);
}

html[data-auth="guest"] body.mystic-page footer .text-gray-400,
html[data-auth="guest"] body.mystic-page footer p,
html[data-auth="guest"] body.mystic-page footer li {
    color: var(--m-muted);
}

html[data-auth="guest"] body.mystic-page footer button:hover,
html[data-auth="guest"] body.mystic-page footer a:hover {
    color: var(--m-gold) !important;
}

html[data-auth="guest"] body.mystic-page footer .border-t {
    border-color: rgba(167, 139, 250, 0.14) !important;
}

/* Footer support buttons need a real touch target on phones. */
html[data-auth="guest"] body.mystic-page footer button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* -----------------------------------------------------------------------------
 * Footer height on phones.
 *
 * Measured at 371px: the footer was 806px tall — 19% of the whole page, and
 * larger than most content sections. A four-column grid stacking into four full
 * rows on a phone is the cause. Two columns halves it without losing anything.
 * -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    body.mystic-page footer {
        padding-top: 2.5rem;
        padding-bottom: 2rem;
    }

    body.mystic-page footer > div > .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.75rem 1rem;
    }

    /* The description column reads better full width above the link columns. */
    body.mystic-page footer > div > .grid > div:first-child {
        grid-column: 1 / -1;
    }

    body.mystic-page footer .border-t {
        margin-top: 1.75rem;
        padding-top: 1.5rem;
    }

    body.mystic-page footer,
    body.mystic-page footer li,
    body.mystic-page footer p {
        font-size: 0.875rem;
    }
}

/* -----------------------------------------------------------------------------
 * Forced-colors / high-contrast mode: drop the atmosphere, keep the structure.
 * -------------------------------------------------------------------------- */
@media (forced-colors: active) {
    .mystic .m-sky::before,
    .mystic .m-sky::after { display: none; }

    .mystic .m-card,
    .mystic .m-reading,
    .mystic .m-badge { border: 1px solid CanvasText; }

    .mystic .m-display em { color: CanvasText; -webkit-text-fill-color: CanvasText; }
}
