/* ==========================================================================
   Interactive Service Visualizer
   Works with the existing styles.css tokens (--color-primary, --ease …).
   Dark mode: set <html data-theme="dark"> (see README → Theme toggle).
   ========================================================================== */

.vz-section {
    background-color: var(--vz-section-bg, var(--color-light-bg, #f5f5f7));
}

.vz {
    --vz-accent: var(--color-primary, #e0242a);
    --vz-accent-rgb: 224, 36, 42;
    --vz-text: #1f1f1f;
    --vz-muted: #5f6368;
    --vz-card: #ffffff;
    --vz-border: #e2e2e6;
    --vz-pop-bg: #ffffff;
    --vz-tint: rgba(var(--vz-accent-rgb), 0.08);
    --vz-ease: var(--ease, cubic-bezier(0.22, 1, 0.36, 1));

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr);
    grid-template-areas:
        "intro stage"
        "chips stage";
    grid-template-rows: auto 1fr;
    gap: 1.5rem 2.75rem;
    align-items: start;
    color: var(--vz-text);
}

:root[data-theme="dark"] .vz {
    --vz-text: #f1f1f3;
    --vz-muted: #a4a7ad;
    --vz-card: #1a1b1f;
    --vz-border: #2c2e34;
    --vz-pop-bg: #1d1e23;
    --vz-tint: rgba(var(--vz-accent-rgb), 0.16);
}

:root[data-theme="dark"] .vz-section {
    --vz-section-bg: #111214;
}

.vz-intro { grid-area: intro; }
.vz-intro h2 { color: var(--vz-text); }
.vz-intro p { color: var(--vz-muted); max-width: 30rem; }

/* ---------- Chips (system list) ---------- */

.vz-chips {
    grid-area: chips;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.vz-chip {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    height: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--vz-border);
    background: var(--vz-card);
    color: var(--vz-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s var(--vz-ease), box-shadow 0.2s var(--vz-ease),
        border-color 0.2s var(--vz-ease), background-color 0.2s var(--vz-ease);
}

.vz-chip:hover,
.vz-chip.is-active {
    border-color: var(--vz-accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(20, 20, 20, 0.1);
}

.vz-chip.is-active { background: var(--vz-tint); }

.vz-chip-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--vz-tint);
    color: var(--vz-accent);
}

.vz-chip.is-active .vz-chip-icon { background: var(--vz-accent); color: #fff; }

.vz-chip-text { min-width: 0; }

.vz-chip-label {
    display: block;
    font-weight: 650;
    font-size: 0.88rem;
    line-height: 1.25;
}

.vz-chip-price {
    display: block;
    margin-top: 2px;
    font-size: 0.74rem;
    color: var(--vz-muted);
}

/* ---------- Stage (the car) ---------- */

.vz-stage-wrap {
    grid-area: stage;
    position: relative;
    /* Stretch to the height of the intro + chips column so the two sides balance */
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.vz-stage {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 360px;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(90% 70% at 50% 105%, rgba(var(--vz-accent-rgb), 0.16), transparent 60%),
        radial-gradient(120% 90% at 50% 100%, #24272d 0%, #131418 55%, #0a0b0d 100%);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    padding: 3rem 1rem 1.25rem;
}

/* blueprint grid */
.vz-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
    pointer-events: none;
}

.vz-caption {
    position: absolute;
    top: 1rem;
    left: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.vz-caption-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vz-accent);
    box-shadow: 0 0 0 4px rgba(var(--vz-accent-rgb), 0.25);
}

.vz-svg {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.vz-shadow { fill: #000; opacity: 0.55; filter: blur(4px); }
.vz-body { stroke: rgba(255, 255, 255, 0.34); stroke-width: 1.6; }
.vz-glass { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.vz-lines path { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.2; }
.vz-handle { fill: rgba(255, 255, 255, 0.28); }
.vz-mirror { fill: #2a2d33; stroke: rgba(255, 255, 255, 0.3); stroke-width: 1; }
.vz-headlight { fill: #fff6d6; opacity: 0.85; }
.vz-taillight { fill: var(--vz-accent); opacity: 0.9; }
.vz-exhaust { fill: #555a62; }
.vz-tire { fill: #0b0c0e; stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.4; }
.vz-rim { fill: #2b2e34; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.2; }
.vz-disc { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 3; }
.vz-caliper { fill: none; stroke: var(--vz-accent); stroke-width: 5; stroke-linecap: round; }
.vz-spokes line { stroke: rgba(255, 255, 255, 0.45); stroke-width: 3; stroke-linecap: round; }
.vz-hub { fill: #9aa0a8; }

.vz-wheel { transform-box: fill-box; transform-origin: center; }

/* Highlightable part overlays */
.vz-part > * {
    fill: rgba(var(--vz-accent-rgb), 0);
    stroke: rgba(var(--vz-accent-rgb), 0);
    stroke-width: 2;
    transition: fill 0.28s var(--vz-ease), stroke 0.28s var(--vz-ease);
    pointer-events: none;
}

.vz-part.is-lit > * {
    fill: rgba(var(--vz-accent-rgb), 0.3);
    stroke: rgba(var(--vz-accent-rgb), 0.95);
}

/* Dim the rest of the car while a zone is active, for focus */
.vz.has-active .vz-body,
.vz.has-active .vz-wheel,
.vz.has-active .vz-glass {
    transition: opacity 0.3s var(--vz-ease);
    opacity: 0.72;
}

/* ---------- Hotspots ---------- */

.vz-hotspot { cursor: pointer; outline: none; }
.vz-hotspot .vz-hs-inner {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.22s var(--vz-ease);
}
.vz-hit { fill: transparent; }

.vz-ring {
    fill: rgba(var(--vz-accent-rgb), 0.28);
    stroke: rgba(var(--vz-accent-rgb), 0.9);
    stroke-width: 1.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: vz-pulse 2.6s ease-out infinite;
}

.vz-dot {
    fill: var(--vz-accent);
    stroke: #ffffff;
    stroke-width: 2.5;
    transition: fill 0.2s var(--vz-ease);
}

.vz-plus {
    stroke: #ffffff;
    stroke-width: 2;
    stroke-linecap: round;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.25s var(--vz-ease);
}

.vz-focus {
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-dasharray: 4 4;
    opacity: 0;
}

.vz-hotspot:hover .vz-hs-inner,
.vz-hotspot.is-active .vz-hs-inner { transform: scale(1.18); }
.vz-hotspot.is-active .vz-plus { transform: rotate(45deg); }
.vz-hotspot.is-active .vz-ring { animation-duration: 1.4s; }
.vz-hotspot:focus-visible .vz-focus { opacity: 1; }

.vz.has-active .vz-hotspot:not(.is-active) { opacity: 0.55; }
.vz-hotspot { transition: opacity 0.25s var(--vz-ease); }

@keyframes vz-pulse {
    0% { transform: scale(0.7); opacity: 0.9; }
    70% { transform: scale(1.7); opacity: 0; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* ---------- Pop-over ---------- */

.vz-popover {
    position: absolute;
    z-index: 20;
    top: 0;
    left: 0;
    width: 320px;
    max-width: calc(100% - 16px);
    padding: 1.1rem 1.1rem 0.95rem;
    border-radius: 16px;
    background: var(--vz-pop-bg);
    color: var(--vz-text);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--vz-border);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.2s var(--vz-ease), transform 0.25s var(--vz-ease), visibility 0.25s;
}

.vz-popover.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    /* visibility flips instantly on open so the pop-over is focusable at once */
    transition: opacity 0.2s var(--vz-ease), transform 0.25s var(--vz-ease), visibility 0s;
}

/* Narrow screens: dock under the car instead of floating over it */
.vz-popover.is-docked {
    position: relative;
    width: auto;
    max-width: none;
    margin-top: 0.85rem;
    left: auto !important;
    top: auto !important;
}
.vz-popover.is-docked:not(.is-open) { display: none; }

.vz-pop-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--vz-muted);
    cursor: pointer;
    transition: background-color 0.15s var(--vz-ease), color 0.15s var(--vz-ease);
}
.vz-pop-close:hover { background: var(--vz-tint); color: var(--vz-accent); }

.vz-pop-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-right: 2rem;
}

.vz-pop-icon {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--vz-accent);
    color: #fff;
}

.vz-pop-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
    color: var(--vz-text);
}

.vz-pop-blurb {
    margin: 0.6rem 0 0.8rem;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--vz-muted);
}

.vz-pop-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.vz-svc {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--vz-border);
    background: transparent;
    color: var(--vz-text);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.18s var(--vz-ease), background-color 0.18s var(--vz-ease), transform 0.18s var(--vz-ease);
}

.vz-svc-name { font-weight: 550; }

.vz-svc-price {
    flex: none;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity 0.18s var(--vz-ease), transform 0.18s var(--vz-ease);
}
.vz-svc-price small { font-weight: 500; font-size: 0.72rem; color: var(--vz-muted); }

.vz-svc-go {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--vz-accent);
    opacity: 0;
    transform: translate(8px, -50%);
    transition: opacity 0.18s var(--vz-ease), transform 0.18s var(--vz-ease);
}

.vz-svc:hover,
.vz-svc:focus-visible {
    border-color: var(--vz-accent);
    background: var(--vz-tint);
}
.vz-svc:hover .vz-svc-price,
.vz-svc:focus-visible .vz-svc-price { opacity: 0; transform: translateX(-8px); }
.vz-svc:hover .vz-svc-go,
.vz-svc:focus-visible .vz-svc-go { opacity: 1; transform: translate(0, -50%); }

.vz-pop-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--vz-border);
    font-size: 0.74rem;
    color: var(--vz-muted);
}
.vz-pop-call { font-weight: 650; color: var(--vz-accent); }

.vz-footnote {
    margin: 0.75rem 0 0;
    font-size: 0.78rem;
    color: var(--vz-muted);
}

/* Flash on the booking field that just got pre-filled */
.vz-flash { animation: vz-flash 1.4s var(--vz-ease); border-radius: 10px; }
@keyframes vz-flash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(224, 36, 42, 0); }
    25% { box-shadow: 0 0 0 6px rgba(224, 36, 42, 0.45); }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .vz {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "intro" "stage" "chips";
        grid-template-rows: auto;
    }
    .vz-stage { min-height: 0; }
}

@media (max-width: 560px) {
    .vz-stage { padding: 2.6rem 0.25rem 0.5rem; border-radius: 16px; }
    .vz-caption { font-size: 0.66rem; top: 0.85rem; left: 0.85rem; }
    .vz-chip { padding: 0.55rem 0.6rem; gap: 0.55rem; }
    .vz-chip-icon { width: 32px; height: 32px; }
    .vz-chip-label { font-size: 0.82rem; }
    /* The SVG renders at ~45% scale on phones — enlarge hotspots so each
       tap target stays ~38px (they're ≥97 SVG units apart, so no overlap). */
    .vz-hotspot .vz-hs-inner,
    .vz-hotspot:hover .vz-hs-inner { transform: scale(1.5); }
    .vz-hotspot.is-active .vz-hs-inner { transform: scale(1.7); }
}

@media (prefers-reduced-motion: reduce) {
    .vz-ring { animation: none; opacity: 0.35; }
}
