/* metroGHOST landing — core, theme, hero, marquee, footer */

:root {
    --font-display: 'Unbounded', system-ui, sans-serif;
    --font-body: 'Space Grotesk', system-ui, sans-serif;
}

:root[data-theme="dark"] {
    --bg: #050505;
    --fg: #f2f2f2;
    --dim: #8f8f8f;
    --line: rgba(255, 255, 255, 0.14);
    --veil: rgba(5, 5, 5, 0.55);
    --smoke-invert: 0;
}

:root[data-theme="light"] {
    --bg: #f4f4f4;
    --fg: #0a0a0a;
    --dim: #5c5c5c;
    --line: rgba(0, 0, 0, 0.16);
    --veil: rgba(244, 244, 244, 0.55);
    --smoke-invert: 1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
}

/* ---- ambient layers ---- */

#smoke {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    filter: invert(var(--smoke-invert));
    transition: filter 0.5s ease;
}

.grain {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
    animation: grain-shift 0.9s steps(4) infinite;
}

@keyframes grain-shift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2%, 1%); }
    50% { transform: translate(1%, -2%); }
    75% { transform: translate(-1%, 2%); }
    100% { transform: translate(2%, -1%); }
}

.page { position: relative; z-index: 1; }

/* ---- hero ---- */

.hero {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    padding: 2rem 1rem;
    text-align: center;
}

.wordmark {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 11vw, 8.5rem);
    line-height: 1;
    letter-spacing: 0.02em;
    user-select: none;
}

.wm-metro { font-weight: 300; text-transform: lowercase; opacity: 0.85; }
.wm-ghost { font-weight: 900; text-transform: uppercase; }

/* per-letter treatment (spans injected by landing.js) */
.wm-l {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.35em);
    filter: blur(6px);
    animation: wm-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    animation-delay: calc(0.15s + var(--i) * 70ms);
}

@keyframes wm-in {
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* settled pins the post-entrance state so flicker can't restart it */
.wm-l.settled {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
}

.wm-l.settled.flick { animation: wm-flick 0.18s steps(2) 2; }

@keyframes wm-flick {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.15; }
}

.hero-sub {
    color: var(--dim);
    letter-spacing: 0.35em;
    text-transform: lowercase;
    font-size: clamp(0.7rem, 2vw, 0.95rem);
    max-width: 34rem;
}

.scroll-hint {
    position: absolute;
    bottom: 2rem;
    width: 1px;
    height: 56px;
    background: var(--line);
    overflow: hidden;
}

.scroll-hint span {
    display: block;
    width: 100%;
    height: 40%;
    background: var(--fg);
    animation: hint-drop 2.2s ease-in-out infinite;
}

@keyframes hint-drop {
    0% { transform: translateY(-100%); }
    70%, 100% { transform: translateY(260%); }
}

/* ---- shared reveals ---- */

[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: calc(var(--d, 0) * 80ms);
}

[data-reveal].in { opacity: 1; transform: none; }

.tr-c {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.6em);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: calc(var(--i) * 35ms);
}

.tr-c.in { opacity: 1; transform: none; }

/* ---- marquee ---- */

.marquee {
    overflow: hidden;
    padding: 5rem 0 4rem;
    white-space: nowrap;
}

.marquee-track {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 9vw, 7rem);
    text-transform: uppercase;
    color: transparent;
    -webkit-text-stroke: 1px var(--dim);
    opacity: 0.35;
    animation: marquee-roll 28s linear infinite;
}

@keyframes marquee-roll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---- footer ---- */

.footer {
    padding: 2rem 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* Matches .footer-actions so nesting the funnels inside it is invisible. */
.funnel-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* After a submission the funnels dissolve over ten seconds. The blur and the
   drift upward make it read as the form letting go rather than the page
   breaking. Interaction is cut immediately -- the message is already sent, and
   a second click during the fade would only produce a duplicate lead. */
.funnel-actions.sent {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-0.5rem);
    pointer-events: none;
    transition: opacity 10s ease-in-out, filter 10s ease-in-out, transform 10s ease-in-out;
}

/* Once faded it is removed from the layout and the tab order both. */
.funnel-actions.sent-done { display: none; }

.ghost-btn {
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--fg);
    background: transparent;
    border: 1px solid var(--line);
    padding: 0.8rem 1.6rem;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.ghost-btn:hover, .ghost-btn:focus-visible {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
    outline: none;
}

.theme-toggle .tt-dot {
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    margin-right: 0.6em;
    border-radius: 50%;
    border: 1px solid currentColor;
    background: currentColor;
    vertical-align: baseline;
}

.disclosure { color: var(--dim); font-size: 0.72rem; max-width: 30rem; line-height: 1.6; }

.colophon { color: var(--dim); font-size: 0.72rem; letter-spacing: 0.08em; }
.colophon a { color: var(--dim); text-decoration: none; }
.colophon a:hover { color: var(--fg); }

/* ---- motion preferences ---- */

@media (prefers-reduced-motion: reduce) {
    .grain, .marquee-track, .scroll-hint span { animation: none; }
    .wm-l { animation-duration: 0.01s; animation-delay: 0s; }
    [data-reveal], .tr-c { transition: none; opacity: 1; transform: none; }

    /* Same outcome, no motion. Note opacity stays at 1: dropping it with the
       transition disabled would blink the buttons out instantly, which is a
       harder cut than the animation it is meant to spare you. They stay put
       and inert until .sent-done removes them on the same ten-second mark. */
    .funnel-actions.sent {
        transition: none;
        opacity: 1;
        filter: none;
        transform: none;
    }
}
