/* Thomson View guided demo — Reagent
   Ported from the approved v0 design (suburban-sungod/v0-reagent-project,
   conversation-history branch): bright frosted white glass over the daylight
   aerial, dark ink text, Electric Blue as the single accent. */

:root {
    --primary: #2B3FCC;
    --primary-hover: #2537B4;
    --ink: #171719;
    --ink-dim: rgba(23, 23, 25, 0.62);
    --glass: rgba(255, 255, 255, 0.45);
    --glass-strong: rgba(255, 255, 255, 0.70);
    --glass-line: rgba(255, 255, 255, 0.60);
    --r: 14px;
    --r-lg: 18px;
    --shadow-card: 0 20px 60px rgba(15, 23, 42, 0.16);
    --shadow-panel: 0 18px 50px rgba(15, 23, 42, 0.14);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

button { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; }
button[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
    background: #0a0f18;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#pano { position: fixed; inset: 0; }

#stage { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#stage > * { pointer-events: auto; }

/* v0: bg-foreground/5 — a whisper of contrast, the view stays dominant */
.scrim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(23, 23, 25, 0.05);
}

/* ---------- glass building blocks ---------- */

.glass {
    background: var(--glass);
    border: 1px solid var(--glass-line);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
}

/* ---------- brand / home ---------- */

.brand {
    position: absolute;
    top: 20px;
    left: 26px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    transition: 0.25s var(--ease);
}
.brand:hover { background: rgba(255, 255, 255, 0.85); }
.brand img { height: 14px; display: block; }

/* ---------- compass ---------- */

#compass {
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    width: 220px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--glass-line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
#compass[hidden] { display: none; }
#compass-strip {
    position: absolute;
    top: 0; bottom: 0;
    display: flex;
    align-items: center;
    will-change: transform;
}
#compass-strip span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    color: var(--ink-dim);
}
#compass-strip span.cardinal { color: var(--ink); }
.compass-tick {
    position: absolute;
    left: 50%;
    top: 6px;
    bottom: 6px;
    width: 1.5px;
    background: var(--primary);
    transform: translateX(-50%);
}

/* ---------- welcome ---------- */

.panel-screen {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 90px 24px 48px;
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.panel-screen.is-out { opacity: 0; transform: scale(0.98); pointer-events: none; }

.welcome-card {
    width: min(740px, 100%);
    text-align: center;
    padding: 44px 48px;
    border-radius: var(--r-lg);
    background: var(--glass);
    border: 1px solid var(--glass-line);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow: var(--shadow-card);
    animation: rise 0.6s var(--ease) backwards;
}

.eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-dim);
}
.headline {
    margin: 0 0 12px;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink);
}
.subhead {
    margin: 0 auto 30px;
    max-width: 560px;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--ink-dim);
}
.prompt {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink);
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    text-align: left;
}
.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--r);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: 0.25s var(--ease);
    animation: rise 0.55s var(--ease) backwards;
}
.choice:nth-child(1) { animation-delay: 0.04s; }
.choice:nth-child(2) { animation-delay: 0.09s; }
.choice:nth-child(3) { animation-delay: 0.14s; }
.choice:nth-child(4) { animation-delay: 0.19s; }
.choice:hover { background: rgba(255, 255, 255, 0.72); }
.choice:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.choice .clabel { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink); }
.choice .chev { width: 16px; height: 16px; stroke: var(--primary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s var(--ease); }
.choice:hover .chev { transform: translateX(4px); }

@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- landmark dots (light theme tags) ---------- */

#dots { position: absolute; inset: 0; pointer-events: none; }

.dot {
    position: absolute;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}
.dot.is-in { opacity: 1; }

.dot .ring {
    position: relative;
    display: block;
    width: 10px; height: 10px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7);
    transform: scale(0);
    transition: transform 0.5s var(--ease);
}
.dot.is-in .ring { transform: scale(1); }
.dot .ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    animation: ping 2.6s var(--ease) infinite;
}
@keyframes ping {
    0%   { transform: scale(1);   opacity: 0.85; }
    70%  { transform: scale(3);   opacity: 0; }
    100% { transform: scale(3);   opacity: 0; }
}

.dot .stem {
    display: block;
    width: 1px;
    height: 26px;
    margin: 0 auto 3px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.2));
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.5s var(--ease) 0.08s;
}
.dot.is-in .stem { transform: scaleY(1); }

.dot .tag {
    display: block;
    margin-bottom: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.12);
    transform: translateY(6px);
    opacity: 0;
    transition: 0.5s var(--ease) 0.14s;
}
.dot.is-in .tag { transform: none; opacity: 1; }

.dot.is-crowded .tag { opacity: 0; transform: translateY(4px) scale(0.94); }
.dot.is-crowded .stem { opacity: 0.45; }

/* the "everything at once" state — deliberately overwhelming */
.dot.is-raw .tag { background: rgba(255, 255, 255, 0.55); font-weight: 400; }
.dot.is-raw .ring { background: #8f9bd8; box-shadow: 0 0 0 3px rgba(255,255,255,0.5); }
.dot.is-raw .ring::before { animation: none; opacity: 0; }

/* ---------- presenter ---------- */

#presenter {
    position: absolute;
    right: 26px;
    top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
#presenter[hidden] { display: flex; opacity: 0; transform: translateY(-12px); pointer-events: none; }

.presenter-tile {
    position: relative;
    width: 234px;
    aspect-ratio: 720 / 896;
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
#presenter-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#clip-video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: none;
}
#presenter.is-clip #clip-video { display: block; }
#presenter-fallback { position: absolute; inset: 0; }
#presenter-fallback img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
#presenter.has-video #presenter-fallback { display: none; }

.pf-wave {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}
.pf-wave i { width: 2.5px; background: #fff; border-radius: 2px; opacity: 0.9; animation: vu 1.1s ease-in-out infinite; }
.pf-wave i:nth-child(1) { height: 40%; animation-delay: 0s; }
.pf-wave i:nth-child(2) { height: 75%; animation-delay: 0.14s; }
.pf-wave i:nth-child(3) { height: 100%; animation-delay: 0.28s; }
.pf-wave i:nth-child(4) { height: 68%; animation-delay: 0.42s; }
.pf-wave i:nth-child(5) { height: 35%; animation-delay: 0.56s; }
@keyframes vu { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.book-btn {
    padding: 9px 18px;
    border-radius: 999px;
    background: var(--primary);
    border: 1px solid rgba(43, 63, 204, 0.2);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(43, 63, 204, 0.3);
    transition: 0.25s var(--ease);
}
.book-btn:hover { background: var(--primary-hover); }

/* ---------- tour panel (topic accordion) ---------- */

#tour-panel {
    position: absolute;
    left: 26px;
    bottom: 26px;
    width: 320px;
    max-height: calc(100svh - 8rem);
    overflow-y: auto;
    border-radius: var(--r-lg);
    padding: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-line);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow: var(--shadow-panel);
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
    scrollbar-width: thin;
}
#tour-panel[hidden] { display: block; opacity: 0; transform: translateY(14px); pointer-events: none; }

.topic-section {
    overflow: hidden;
    border-radius: var(--r);
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.topic-section + .topic-section { margin-top: 6px; }
.topic-section:hover { background: rgba(255, 255, 255, 0.55); }
.topic-section.is-active {
    border-color: rgba(255, 255, 255, 0.8);
    background: var(--glass-strong);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.topic-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
}
.topic-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.topic-head .tlabel { flex: 1; }
.topic-head .tdone {
    width: 15px; height: 15px;
    stroke: var(--primary); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}
.topic-section.is-done .tdone { opacity: 1; }
.topic-head .chev {
    width: 16px; height: 16px;
    stroke: var(--primary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    transition: transform 0.3s var(--ease);
}
.topic-section.is-active .chev { transform: rotate(90deg); }

.topic-body { border-top: 1px solid rgba(255, 255, 255, 0.6); padding: 12px 12px 10px; }

/* narration controls */
.narr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
}
.narr-track {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
}
#narr-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 3px;
}
.ctrl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    transition: 0.25s var(--ease);
}
.ctrl svg { width: 13px; height: 13px; fill: currentColor; }
.ctrl.play { background: var(--primary); color: #fff; }
.ctrl.play:hover { background: var(--primary-hover); }
.ctrl.restart { color: var(--ink-dim); }
.ctrl.restart:hover { background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.ctrl.restart svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* landmark rows */
.lm-list { display: flex; flex-direction: column; gap: 2px; }
.lm-row { border-radius: 10px; }
.lm-row.is-open { background: rgba(255, 255, 255, 0.85); }
.lm-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 10px;
    text-align: left;
    font-size: 13px;
    color: var(--ink-dim);
    transition: 0.2s var(--ease);
}
.lm-head:hover { background: rgba(255, 255, 255, 0.85); color: var(--ink); }
.lm-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.lm-row.is-lit .lm-head { color: var(--ink); }
.lm-head .lm-dot {
    width: 6px; height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(23, 23, 25, 0.18);
    transition: 0.3s var(--ease);
}
.lm-row.is-lit .lm-head .lm-dot { background: var(--primary); }
.lm-head .lm-name { flex: 1; }
.lm-head .chev {
    width: 14px; height: 14px;
    stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    opacity: 0.5;
    transition: transform 0.25s var(--ease);
}
.lm-row.is-open .chev { transform: rotate(90deg); }

.lm-body { padding: 0 8px 10px 22px; }
.lm-body p { margin: 0; font-size: 12.5px; font-weight: 300; line-height: 1.55; color: var(--ink-dim); }
.lm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lm-tag {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--ink);
    background: rgba(23, 23, 25, 0.06);
}

/* ---------- loading ---------- */

#loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #0a0f18;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.7);
    transition: opacity 0.7s var(--ease);
    z-index: 5;
}
#loading.is-out { opacity: 0; pointer-events: none; }
.spinner {
    width: 15px; height: 15px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .choices { grid-template-columns: 1fr; }
    .welcome-card { padding: 30px 22px; }
    #presenter { top: auto; bottom: 84px; right: 16px; }
    .presenter-tile { width: 132px; }
    .book-btn { font-size: 12px; padding: 8px 14px; }
    #tour-panel { left: 16px; bottom: 16px; width: calc(100vw - 170px); max-height: 44svh; }
    #compass { display: none; }
    .brand { top: 14px; left: 16px; }
}

/* Landmarks that carry their own Valentina clip */
.lm-speak {
    width: 13px; height: 13px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.75;
}
.lm-row.has-clip .lm-head { font-weight: 500; }
.lm-row.has-clip:hover .lm-speak { opacity: 1; }

/* Presenter is showing a landmark clip rather than the tour narration */
#presenter.is-clip .presenter-tile {
    box-shadow: 0 0 0 2px var(--primary), 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---------- lead form ---------- */
/* Mirrors the Space/Florim showcase form (bottom sheet on mobile, centred panel
   on desktop) with this demo's palette. */

@keyframes lead-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes lead-panel-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

#lead {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
#lead[hidden] { display: none; }
.lead-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 24, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.lead-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--glass-line);
    color: var(--ink);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 28px 22px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.3);
    animation: lead-sheet-up 0.28s var(--ease);
}
.lead-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(23, 23, 25, 0.06);
    color: var(--ink-dim);
    font-size: 22px;
    line-height: 1;
}
.lead-close:hover { background: rgba(23, 23, 25, 0.12); }
.lead-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lead-context {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-dim);
    background: rgba(23, 23, 25, 0.05);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 14px;
}
.lead-context:empty { display: none; }
#lead h2 { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 18px; }
#lead label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 14px; }
#lead input, #lead textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid rgba(23, 23, 25, 0.14);
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
    font-family: inherit;
    color: var(--ink);
}
#lead input:focus, #lead textarea:focus { outline: none; border-color: var(--primary); }
#lead textarea { resize: vertical; min-height: 64px; }
.lead-error { color: #b00020; font-size: 13px; margin: 0 0 12px; }
.lead-error[hidden] { display: none; }
.lead-privacy { font-size: 12px; color: var(--ink-dim); margin: 0 0 16px; line-height: 1.5; }
.lead-submit {
    width: 100%;
    height: 48px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    transition: 0.2s var(--ease);
}
.lead-submit:hover:not(:disabled) { background: var(--primary-hover); }
.lead-submit:disabled { opacity: 0.6; cursor: default; }
.lead-form[hidden] { display: none; }
.lead-success { text-align: center; padding: 16px 4px 8px; }
.lead-success[hidden] { display: none; }
.lead-check {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #1f7a3d;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lead-success p { color: var(--ink-dim); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
.lead-back {
    height: 46px;
    padding: 0 28px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
}

@media (min-width: 640px) {
    #lead { align-items: center; }
    .lead-panel {
        max-width: 440px;
        max-height: 92vh;
        border-radius: var(--r-lg);
        padding: 32px;
        animation: lead-panel-in 0.2s var(--ease);
    }
}
