/* Mappa del sito 3D: una strada al neon con le pagine ai lati (mappa.js). Senza JS, o con "meno movimento", resta l'elenco. */
:root {
    --bg: #05070f;
    --surface: #0f1426;
    --border: rgba(120, 140, 255, 0.18);
    --text: #e6e9f5;
    --muted: #8f97b8;
    --cyan: #22c7f5;
    --blue: #2563eb;
    --violet: #8b2be2;
    --grad: linear-gradient(135deg, var(--cyan) 0%, var(--blue) 50%, var(--violet) 100%);
    --horizon: 42%;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body { background: var(--bg); color: var(--text); font: 16px/1.6 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* ---------- HUD ---------- */
.hud-top { position: fixed; z-index: 20; inset: 0 0 auto; display: flex; align-items: center; gap: 16px; padding: 14px 20px;
    background: linear-gradient(rgba(5, 7, 15, .85), transparent); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1rem Orbitron, sans-serif; letter-spacing: .12em; }
.hud-title { flex: 1; color: var(--muted); font-size: .85rem; letter-spacing: .2em; text-transform: uppercase; }
.hud-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
    background: rgba(15, 20, 38, .7); color: var(--text); font: 600 .85rem Inter, sans-serif; cursor: pointer; backdrop-filter: blur(8px); }
.hud-btn:hover { border-color: rgba(120, 140, 255, .45); }

/* ---------- Elenco (sempre nel DOM) ---------- */
.list { max-width: 880px; margin: 0 auto; padding: 110px 16px 80px; }
.list h1 { font: 800 clamp(2rem, 6vw, 3rem)/1.1 Orbitron, sans-serif; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.list-lead { color: var(--muted); margin-top: 12px; }
.station { margin-top: 44px; }
.station h2 { font: 700 .8rem Orbitron, sans-serif; letter-spacing: .24em; text-transform: uppercase; color: var(--c, var(--cyan)); }
.station ul { list-style: none; margin-top: 14px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.station a { display: block; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-weight: 600; }
.station a:hover, .station a:focus-visible { border-color: var(--c, var(--cyan)); outline: none; }
.station small { display: block; color: var(--muted); font-weight: 400; font-size: .86rem; margin-top: 4px; }

.sky, .world, .hud-bottom, .look, .spacer { display: none; }

/* ---------- Vista 3D ---------- */
.is-3d .list { display: none; }
.is-3d .sky, .is-3d .world { display: block; }
.is-3d .spacer { display: block; }
.is-3d .hud-bottom:not([hidden]) { display: block; }
.is-3d .look:not([hidden]) { display: flex; }

.sky { position: fixed; z-index: 0; inset: 0; overflow: hidden;
    background:
        radial-gradient(1px 1px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 32% 8%, #fff6, transparent),
        radial-gradient(1.5px 1.5px at 58% 22%, #fff7, transparent), radial-gradient(1px 1px at 76% 12%, #fff5, transparent),
        radial-gradient(1px 1px at 88% 30%, #fff6, transparent), radial-gradient(1.5px 1.5px at 6% 34%, #fff5, transparent),
        radial-gradient(1px 1px at 44% 30%, #fff4, transparent), radial-gradient(1px 1px at 67% 4%, #fff6, transparent),
        linear-gradient(#03040a 0%, #0a0b24 calc(var(--horizon) - 12%), #2a1458 var(--horizon), #05070f calc(var(--horizon) + .5%)); }
.sun { position: absolute; left: 50%; top: var(--horizon); width: min(52vw, 440px); translate: -50% -104%;
    filter: drop-shadow(0 0 28px rgba(34, 199, 245, .45)) drop-shadow(0 0 60px rgba(139, 43, 226, .45)); }
.sun svg { display: block; width: 100%; height: auto; overflow: visible; }
.hills { position: absolute; left: -10%; right: -10%; top: calc(var(--horizon) - 7vh); height: 7vh;
    background: linear-gradient(transparent, rgba(5, 7, 15, .95));
    clip-path: polygon(0 100%, 0 70%, 8% 40%, 15% 65%, 24% 20%, 33% 60%, 40% 45%, 47% 75%, 53% 75%, 60% 35%, 68% 62%, 77% 15%, 86% 55%, 93% 38%, 100% 70%, 100% 100%); }

.world { position: fixed; z-index: 2; inset: 0; overflow: hidden; perspective: var(--persp, 900px); perspective-origin: 50% var(--horizon);
    touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.dragging .world { cursor: grabbing; }
.dragging .panel { pointer-events: none; }
.floor-world { z-index: 1; pointer-events: none; }
.scene, .rig, .moving { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.rig, .moving { left: 0; top: 0; }
.scene { top: var(--horizon); }

/* Terreno: segue la camera, griglia e strisce scorrono (solo transform, niente ridisegni) */
.ground { position: absolute; left: 0; top: 0; transform-origin: 50% 0; transform-style: preserve-3d;
    overflow: hidden; }
.fog { position: absolute; inset: 0; background: linear-gradient(transparent 35%, #05070f 92%); }
.grid, .dashes { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }
.grid { background-image: linear-gradient(rgba(139, 43, 226, .45) 2px, transparent 2px), linear-gradient(90deg, rgba(34, 199, 245, .28) 2px, transparent 2px);
    background-size: 200px 200px; background-position: center top; }
.road { position: absolute; top: 0; bottom: 0; left: 50%; translate: -50% 0; background: rgba(8, 10, 24, .94);
    border-left: 4px solid var(--cyan); border-right: 4px solid var(--violet);
    box-shadow: -10px 0 40px -6px rgba(34, 199, 245, .7), 10px 0 40px -6px rgba(139, 43, 226, .7); }
.dashes { left: 50%; width: 8px; margin-left: -4px; background: repeating-linear-gradient(var(--cyan) 0 80px, transparent 80px 200px);
    box-shadow: 0 0 16px rgba(34, 199, 245, .8); }

/* Pagine ai lati */
.panel { position: absolute; left: 0; top: 0; transform-style: preserve-3d; text-decoration: none; outline: none; }
.panel .face { width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
    background: linear-gradient(160deg, #121a36, #0a0e1c 70%); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .03), 0 0 40px -8px var(--c);
    transform: rotateY(var(--a)); transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; backface-visibility: hidden; }
.panel { -webkit-user-drag: none; cursor: pointer; }
.panel:hover .face, .panel:focus-visible .face { transform: rotateY(calc(var(--a) * .7)) translateZ(24px); box-shadow: 0 0 0 2px var(--c), 0 0 70px -4px var(--c); }
.panel::after { content: ""; position: absolute; left: 50%; top: 100%; width: 3px; height: var(--post, 60px); translate: -50% 0;
    background: linear-gradient(var(--c), transparent); box-shadow: 0 0 14px var(--c); }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(255, 255, 255, .04); border-bottom: 1px solid var(--border); }
.dots { display: flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.dots i:first-child { background: var(--c); }
.url { flex: 1; font-size: .72em; color: var(--muted); background: rgba(0, 0, 0, .3); border-radius: 99px; padding: 2px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbody { flex: 1; display: flex; flex-direction: column; padding: 1.1em 1.3em; gap: .35em; }
.picon { width: 2.4em; height: 2.4em; display: grid; place-items: center; border-radius: 12px; font-size: 1.05em;
    background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.peyebrow { margin-top: .4em; font: 700 .62em Orbitron, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--c); }
.ptitle { font: 700 1.35em/1.15 Orbitron, sans-serif; }
.pdesc { color: var(--muted); font-size: .85em; line-height: 1.45; }
.skel { display: grid; gap: 6px; margin-top: auto; }
.skel span { height: 6px; border-radius: 9px; background: rgba(255, 255, 255, .07); }
.skel span:nth-child(2) { width: 80%; } .skel span:nth-child(3) { width: 55%; }
.pcta { margin-top: .7em; align-self: flex-start; font-weight: 700; font-size: .82em; padding: .45em 1em; border-radius: 99px; background: var(--grad); }

/* Ultimo cartello: luce che corre sul bordo, frase a battito */
.runner { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); overflow: visible; pointer-events: none;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.panel.finale:hover .runner, .panel.finale:focus-visible .runner { transform: translateZ(24px); }
.runner rect { fill: none; stroke-linecap: round; stroke-dasharray: 18 82; animation: run 3.2s linear infinite; }
.runner .glow { stroke: var(--c); stroke-width: 9; filter: blur(6px); opacity: .95; }
.runner .core { stroke: #fff; stroke-width: 4; filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px var(--c)) drop-shadow(0 0 22px var(--c)); }
@keyframes run { to { stroke-dashoffset: -100; } }
.pulse { margin: auto 0 .2em; align-self: center; text-align: center; font: 800 1.55em/1.25 Orbitron, sans-serif; letter-spacing: .05em; color: #fff; }
.pulse span { display: inline-block; animation: beat 1.5s ease-in-out infinite; animation-delay: calc(var(--i) * 28ms); }
.pulse .sp { width: .4em; }
@keyframes beat {
    0%, 55%, 100% { opacity: .35; text-shadow: none; }
    12% { opacity: 1; text-shadow: 0 0 6px #fff, 0 0 16px var(--c), 0 0 30px var(--c); }
    22% { opacity: .55; text-shadow: 0 0 4px var(--c); }
    32% { opacity: 1; text-shadow: 0 0 8px #fff, 0 0 20px var(--c), 0 0 38px var(--c); }
}
@media (prefers-reduced-motion: reduce) {
    .runner rect { animation: none; stroke-dasharray: none; }
    .runner .glow { opacity: .5; }
    .pulse span { animation: none; opacity: 1; text-shadow: 0 0 10px var(--c); }
}

/* Portali delle tappe */
.gate { position: absolute; left: 0; top: 0; pointer-events: none; }
.gate::before, .gate::after { content: ""; position: absolute; bottom: 0; width: 14px; top: 40px; border-radius: 4px;
    background: linear-gradient(var(--c), transparent); box-shadow: 0 0 24px var(--c); }
.gate::before { left: 0; } .gate::after { right: 0; }
.gate span { position: absolute; left: 0; right: 0; top: 0; height: 56px; display: grid; place-items: center; border-radius: 10px;
    border: 2px solid var(--c); background: rgba(5, 7, 15, .75); box-shadow: 0 0 30px var(--c), inset 0 0 20px color-mix(in srgb, var(--c) 30%, transparent);
    font: 800 26px Orbitron, sans-serif; letter-spacing: .3em; text-transform: uppercase; color: #fff; text-shadow: 0 0 12px var(--c); }

/* Barra delle tappe e frecce per guardare ai lati */
.hud-bottom { position: fixed; z-index: 20; left: 50%; bottom: 18px; translate: -50% 0; width: min(760px, calc(100% - 32px)); }
.track { height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.track-fill { height: 100%; width: 0; background: var(--grad); }
.stops { display: flex; justify-content: space-between; gap: 6px; margin-top: 10px; }
.stops button { flex: 1; min-width: 0; padding: 7px 6px; border-radius: 10px; border: 1px solid var(--border); background: rgba(15, 20, 38, .92);
    color: var(--muted); font: 600 .72rem Inter, sans-serif; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stops button[aria-current="true"] { color: #fff; border-color: var(--c); box-shadow: 0 0 16px -2px var(--c); }
.hint { margin-top: 8px; text-align: center; color: var(--muted); font-size: .75rem; }
.hint-touch { display: none; }
@media (hover: none) { .hint-desktop { display: none; } .hint-touch { display: inline; } }
.look { position: fixed; z-index: 19; inset: 50% 0 auto; translate: 0 -50%; justify-content: space-between; padding: 0 12px; pointer-events: none; }
.look-btn { pointer-events: auto; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); background: rgba(15, 20, 38, .6);
    color: var(--text); cursor: pointer; backdrop-filter: blur(8px); }
.look-btn[aria-pressed="true"] { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 199, 245, .6); }

@media (max-width: 640px) {
    .hud-title { display: none; }
    .stops button { font-size: .62rem; padding: 6px 2px; }
    .gate span { font-size: 18px; height: 44px; }
}
