/* =========================================
   Map Alerts — Landing
   Single-section hero: copy + dual interactive demos.
   Palette taken from the app logo (pin gradient: orange → magenta → cyan).
   ========================================= */

:root {
    /* Surfaces (no pure black) */
    --ink-0:  #0a0a0f;
    --ink-1:  #11111a;
    --ink-2:  #181826;
    --ink-3:  #232336;
    --line:   rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);

    /* Logo pin colours */
    --pin-orange:  #FF9D44;
    --pin-magenta: #E83A8E;
    --pin-purple:  #9542CC;
    --pin-cyan:    #4FC3F7;

    /* Single accent — the magenta heart of the logo */
    --accent:        var(--pin-magenta);
    --accent-soft:   rgba(232, 58, 142, 0.16);
    --accent-glow:   rgba(232, 58, 142, 0.30);

    /* Brand gradient — the pin itself */
    --brand-gradient: linear-gradient(
        135deg,
        var(--pin-orange) 0%,
        var(--pin-magenta) 38%,
        var(--pin-purple) 68%,
        var(--pin-cyan) 100%
    );

    /* Text */
    --fg:        #F4F4F5;
    --fg-mute:   #A0A4B0;
    --fg-faint:  #5F6473;

    /* Type */
    --font-display: "Geist", "Inter Tight", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-body:    "Geist", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    /* Phone iframe geometry — auto-fits to viewport.
       The iframe always renders at 390×844 (its native phone size); the
       phone-frame is a smaller box with the iframe scaled to fit.
       --phone-h drives everything else; width and scale derive from it. */
    --iframe-w: 390px;
    --iframe-h: 844px;
    --phone-h-by-vh: calc(100vh - 130px);    /* fit height: vh minus paddings+banner+caption+gaps */
    --phone-h-by-vw: calc(52vw - 80px);      /* fit width: scales with viewport, no container cap */
    --phone-h: clamp(440px, min(var(--phone-h-by-vh), var(--phone-h-by-vw)), 1000px);
    --phone-w: calc(var(--phone-h) * 390 / 844);
    --phone-scale: calc(var(--phone-h) / var(--iframe-h));   /* px / px = unitless */

    /* Easing */
    --ease-soft: cubic-bezier(.2, .9, .25, 1);

    /* Rhythm */
    --gutter: clamp(20px, 4vw, 56px);
}

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    background: var(--ink-0);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: clamp(15px, 0.6vw + 0.7rem, 18px);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Atmospheric backdrop — very faint pin-coloured glows on the corners only,
   so they don't bleed onto the phones. Grain isolated to a fixed pseudo. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(28% 24% at 92% 6%,  rgba(232, 58, 142, 0.10), transparent 70%),
        radial-gradient(28% 24% at 8% 96%, rgba(79, 195, 247, 0.05), transparent 70%),
        linear-gradient(180deg, var(--ink-1) 0%, var(--ink-0) 60%);
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1   0 0 0 0 1   0 0 0 0 1   0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

::selection { background: var(--accent-soft); color: var(--fg); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ============ Layout shell ============ */
.shell {
    width: 100%;
    max-width: 2400px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ============ Hero brand (replaces nav) ============ */
.hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(15px, 1.05vw, 18px);
    letter-spacing: -0.01em;
    color: var(--fg);
    margin-bottom: clamp(20px, 2vw, 32px);
}
.hero-logo {
    width: clamp(40px, 3.2vw, 56px);
    height: clamp(40px, 3.2vw, 56px);
    border-radius: clamp(10px, 0.85vw, 14px);
    object-fit: cover;
}
.hero-brand-text {
    text-transform: none;
}

/* ============ Secondary text button (e.g. "How it works") ============ */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.65em 1em;
    border-radius: 10px;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(13px, 0.4vw + 0.7rem, 15px);
    color: var(--fg);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.btn-secondary:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}
.btn-secondary span { transition: transform .2s ease; }
.btn-secondary:hover span { transform: translateX(2px); }

/* ============ App Store badge ============ */
.btn-app-store {
    display: inline-block;
    line-height: 0;
    border-radius: 10px;
    transition: transform .15s ease, box-shadow .25s ease;
    will-change: transform;
}
.btn-app-store:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(244, 244, 245, 0.14);
}
.btn-app-store img {
    display: block;
    width: clamp(150px, 12vw, 180px);
    height: auto;
}

/* ============ Hero ============ */
.hero {
    position: relative;
    padding-top: clamp(16px, 2vw, 32px);
    padding-bottom: clamp(16px, 2vw, 32px);
    min-height: 100vh;
    display: flex;
    align-items: center;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: clamp(32px, 4vw, 56px);
    align-items: center;
    width: 100%;
}
.hero-copy {
    max-width: 560px;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0.4em var(--accent-soft); }
    50%      { box-shadow: 0 0 0 0.8em rgba(232, 58, 142, 0.04); }
}

.hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(44px, 5.6vw, 80px);
    line-height: 1.0;
    letter-spacing: -0.025em;
    margin: 0 0 24px;
}
.hero h1 .nb { display: block; }
.hero h1 .accent {
    font-style: normal;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Slight extra weight so the gradient text reads at smaller sizes */
    font-weight: 700;
}

.hero-sub {
    font-size: clamp(15px, 0.5vw + 0.85rem, 20px);
    line-height: 1.5;
    color: var(--fg);
    opacity: 0.92;
    margin: 0 0 0.9em;
    max-width: 32em;
}
.hero-body {
    font-size: clamp(13px, 0.3vw + 0.7rem, 16px);
    line-height: 1.65;
    color: var(--fg-mute);
    margin: 0 0 2em;
    max-width: 30em;
}

.hero-cta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

/* Inline legal links — replaces a footer so the hero never overflows the
   viewport. Lives at the bottom of the left column. */
.hero-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
    margin-top: 1.6em;
    font-size: clamp(11px, 0.25vw + 0.6rem, 13px);
    color: var(--fg-faint);
    font-family: var(--font-display);
}
.hero-legal a {
    color: var(--fg-mute);
    transition: color .18s ease;
}
.hero-legal a:hover { color: var(--fg); }
.hero-legal-sep {
    opacity: 0.5;
    user-select: none;
}
.hero-legal-copy {
    color: var(--fg-faint);
}

/* ============ Hero visual: dual interactive phones ============ */
.hero-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Live-demo banner — now sits in the left column, beneath the App Store CTA */
.demo-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    margin-top: 1.4em;
    padding: 0.55em 1.1em 0.55em 0.85em;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: clamp(11px, 0.3vw + 0.6rem, 14px);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--fg);
}
.demo-banner strong {
    font-weight: 600;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.demo-dot {
    position: relative;
    width: 0.6em; height: 0.6em;
    border-radius: 999px;
    background: var(--pin-magenta);
    box-shadow: 0 0 0 0.3em rgba(232, 58, 142, 0.18);
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Two phone cards */
.phones {
    display: flex;
    gap: clamp(8px, 0.8vw, 20px);
    align-items: center;
}

/* Rainbow arrow between the two phones */
.phones-arrow {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(64px, 7vw, 120px);
    align-self: center;
    /* Compensate so the arrow visually aligns with the phone screen,
       not the caption row above it. */
    margin-top: 1.6em;
    filter:
        drop-shadow(0 0 12px rgba(232, 58, 142, 0.45))
        drop-shadow(0 0 24px rgba(80, 168, 224, 0.30));
}
.phones-arrow svg {
    width: 100%;
    height: auto;
    overflow: visible;
}
.phone-card {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: var(--phone-w);
    position: relative;
}

/* Tap hint — animated GIF overlay shown only on mobile to indicate that the
   demo is interactive. Lives in .phone-card (NOT in .phone-frame, which has
   clip-path that Safari iOS sometimes lets hide absolutely-positioned
   siblings). Pointer-events:none so taps fall through to the iframe.

   Display is toggled directly (no opacity transition) — Safari iOS pauses
   GIF playback while opacity is mid-transition, leaving a frozen frame. */
.tap-hint {
    position: absolute;
    top: 0;
    left: 0;
    width: 84px;
    height: 84px;
    -webkit-transform: translate(-50%, -50%);   /* Safari ≤ 13 prefix */
            transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 6;
    box-sizing: border-box;
    overflow: hidden;          /* belt-and-braces — never let the gif spill */
}
.tap-hint img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    display: block;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}
@media (max-width: 980px), (pointer: coarse) {
    .tap-hint.visible { display: flex; }
}

/* Make demo banner actionable on mobile — tap to scroll down to the phones. */
@media (max-width: 980px), (pointer: coarse) {
    .demo-banner {
        cursor: pointer;
    }
    .demo-banner:active { transform: translateY(1px); }
}

.phone-caption {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.5em 1.1em;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: clamp(10px, 0.25vw + 0.55rem, 13px);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-mute);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    white-space: nowrap;
}
.phone-caption-dot {
    width: 0.55em; height: 0.55em;
    border-radius: 999px;
    flex: 0 0 0.55em;
}
.tg-dot { background: #229ED9; }
.ml-dot { background: var(--pin-magenta); }
.phone-caption-arrow {
    margin-left: 4px;
    color: var(--fg-faint);
}

/* Phone frame: holds a full-size iframe and visually scales it down. */
.phone-frame {
    position: relative;
    width: var(--phone-w);
    height: var(--phone-h);
    overflow: hidden;
    background: #0b0c0e;
    border-radius: calc(var(--phone-h) * 54 / 844);
    /* Chrome bug: overflow:hidden + border-radius does not always clip a
       scaled child (the iframe). Force a stacking context and use clip-path
       — both are reliable ways to make the rounded mask actually apply. */
    isolation: isolate;
    clip-path: inset(0 round calc(var(--phone-h) * 54 / 844));
}
.phone-frame iframe {
    position: absolute;
    top: 0; left: 0;
    width: var(--iframe-w);
    height: var(--iframe-h);
    border: 0;
    /* Belt-and-braces — round the iframe element itself in addition to the
       parent's clip-path. Chrome occasionally fails to clip a transformed
       iframe by its parent's rounded mask. */
    border-radius: 54px;
    overflow: hidden;
    transform: scale(var(--phone-scale));
    transform-origin: top left;
    background: transparent;
    color-scheme: light dark;
}

/* ============ Footer ============ */
.footer {
    border-top: 1px solid var(--line);
    padding: clamp(20px, 2vw, 36px) 0 clamp(24px, 2.4vw, 48px);
    color: var(--fg-mute);
    font-size: clamp(12px, 0.3vw + 0.65rem, 14px);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5em;
    flex-wrap: wrap;
}
.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 1.6em;
}
.footer-links a {
    color: var(--fg-mute);
    transition: color .2s ease;
}
.footer-links a:hover { color: var(--fg); }
.footer-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.65em;
    color: var(--fg-mute);
}
.footer-mark img {
    width: 1.6em; height: 1.6em;
    border-radius: 0.4em;
}

/* ============ Responsive ============ */
@media (max-width: 980px) {
    .hero {
        min-height: 0;
        padding-top: 40px;
        padding-bottom: 56px;
    }
    .hero-grid {
        grid-template-columns: 1fr;
        gap: clamp(32px, 6vw, 56px);
    }
    .hero-copy { order: 1; max-width: 100%; }
    .hero-visual { order: 2; }
}

@media (max-width: 720px) {
    .nav-inner { height: 60px; }
    .btn-app-store { padding: 8px 14px 8px 12px; }

    .hero h1 { font-size: clamp(36px, 10vw, 52px); }
    .hero-sub { font-size: 16px; }

    /* Stack the phones vertically on small screens.
       Auto-fit assumes side-by-side; override --phone-h for stacked. */
    .phones {
        flex-direction: column;
        align-items: center;
        gap: 1em;
    }
    :root {
        --phone-h: calc(844px * 0.74);
    }
    /* Rotate the arrow so it points downward in the vertical stack */
    .phones-arrow {
        margin-top: 0;
        width: clamp(44px, 12vw, 64px);
        transform: rotate(90deg);
    }

    .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
    :root {
        --phone-h: calc(844px * 0.66);
    }
}

/* ============ Legal pages (privacy, terms) ============ */
.legal-top {
    padding: clamp(20px, 2vw, 32px) 0;
    border-bottom: 1px solid var(--line);
}
.legal-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.legal-back {
    color: var(--fg-mute);
    font-family: var(--font-display);
    font-size: clamp(13px, 0.3vw + 0.7rem, 15px);
    font-weight: 500;
    transition: color .2s ease;
}
.legal-back:hover { color: var(--fg); }

.legal {
    padding: clamp(40px, 5vw, 80px) 0;
}
.legal-article {
    max-width: 760px;
}
.legal-article h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(32px, 3.6vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    color: var(--fg);
}
.legal-article h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(20px, 1.5vw, 26px);
    letter-spacing: -0.01em;
    margin: 2em 0 0.6em;
    color: var(--fg);
}
.legal-article h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(15px, 1vw, 18px);
    letter-spacing: -0.005em;
    margin: 1.6em 0 0.4em;
    color: var(--fg);
}
.legal-article p {
    color: var(--fg-mute);
    line-height: 1.7;
    margin: 0 0 1em;
}
.legal-article ul {
    color: var(--fg-mute);
    line-height: 1.7;
    padding-left: 1.4em;
    margin: 0 0 1em;
}
.legal-article li { margin-bottom: 0.4em; }
.legal-article a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color .15s ease;
}
.legal-article a:hover { color: var(--pin-orange); }
.legal-article strong { color: var(--fg); font-weight: 600; }
.legal-meta {
    color: var(--fg-faint);
    font-size: clamp(13px, 0.3vw + 0.7rem, 15px);
    margin-bottom: 2em;
}
.legal-article code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 5px;
    color: var(--fg);
}
.how-figure {
    margin: 2em 0;
    padding: 1.4em 1em;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}
.how-figure svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 760px;
    margin: 0 auto;
}

/* ============ Auto-tour cursor ============ */
.tour-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 30px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(-100px, -100px, 0);
    transition: opacity 0.35s ease;
    will-change: transform, opacity;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}
.tour-cursor.visible { opacity: 1; }
.tour-cursor svg {
    display: block;
    width: 100%;
    height: 100%;
}
/* Click ripple — appears under the cursor's tip when clickPulse() fires. */
.tour-pulse {
    position: absolute;
    left: 4px;        /* aligns with the cursor arrow tip */
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent, #E83A8E);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}
.tour-cursor.clicking .tour-pulse {
    animation: tour-click-pulse 0.65s cubic-bezier(.25, .8, .35, 1);
}
@keyframes tour-click-pulse {
    0%   { opacity: 0.55; transform: translate(-50%, -50%) scale(0.4); }
    60%  { opacity: 0.35; transform: translate(-50%, -50%) scale(2.4); }
    100% { opacity: 0;    transform: translate(-50%, -50%) scale(3.2); }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
    .demo-dot { animation: none; }
    .phone-card { transition: none; }
    html { scroll-behavior: auto; }
    /* Auto-tour cursor is a motion piece; hide it for users who opted out. */
    .tour-cursor { display: none; }
}
