/* D-352 y W-004: el recorrido público (/demo). El mismo paisaje de la portada: la hora avanza con el recorrido. */
@import './tokens.css';

@property --s1 { syntax: '<color>'; inherits: true; initial-value: #a9c9dc; }
@property --s2 { syntax: '<color>'; inherits: true; initial-value: #dfe9ea; }
@property --s3 { syntax: '<color>'; inherits: true; initial-value: #f6e6cf; }
@property --r1 { syntax: '<color>'; inherits: true; initial-value: #9db8c4; }
@property --r2 { syntax: '<color>'; inherits: true; initial-value: #7c9fa8; }
@property --r3 { syntax: '<color>'; inherits: true; initial-value: #55867d; }
@property --r4 { syntax: '<color>'; inherits: true; initial-value: #2f6650; }
@property --r5 { syntax: '<color>'; inherits: true; initial-value: #0b3d28; }

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; background: #0b3d28; }
[hidden] { display: none !important; }
.demo {
    --gold: #f4b400; --green: #0b5233; --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --spring: cubic-bezier(0.25, 1.3, 0.4, 1);
    --t: #0c1f17; --s1: #a9c9dc; --s2: #dfe9ea; --s3: #f6e6cf; --r1: #9db8c4; --r2: #7c9fa8; --r3: #55867d; --r4: #2f6650; --r5: #0b3d28;
    --oc: #ffd98a; --og: rgb(255 214 130 / 0.55); --stars: 0; --go: 0; --mx: 0; --my: 0;
    margin: 0; min-height: 100svh; overflow-x: clip; color: var(--t); font: 1.125rem/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
    transition: --s1 1600ms ease, --s2 1600ms ease, --s3 1600ms ease, --r1 1600ms ease, --r2 1600ms ease, --r3 1600ms ease, --r4 1600ms ease, --r5 1600ms ease;
}
.demo[data-hour='2'] { --s1: #7db8e0; --s2: #bcdcef; --s3: #e8f3f7; --r1: #93b6cb; --r2: #6c9cad; --r3: #458578; --r4: #22684c; --r5: #07402a; --oc: #fff6d6; --og: rgb(255 248 220 / 0.7); }
.demo[data-hour='3'] { --s1: #f2c48d; --s2: #f9dcb8; --s3: #fbe9d3; --r1: #d9a98c; --r2: #b7836c; --r3: #8a6150; --r4: #5c443c; --r5: #33291f; --oc: #ffb14a; --og: rgb(255 170 80 / 0.55); }
.demo[data-hour='4'] { --t: #fff; --s1: #070f24; --s2: #15234a; --s3: #3b3a66; --r1: #343c69; --r2: #28325a; --r3: #1c264a; --r4: #111a38; --r5: #080f22; --oc: #f4eed6; --og: rgb(220 225 255 / 0.22); --stars: 1; }
.demo h1, .demo h2, .demo p, .demo ul { margin: 0; padding: 0; }
.demo ul { list-style: none; }
.demo h1, .demo h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; text-wrap: balance; }
.demo button { font: inherit; color: inherit; cursor: pointer; }
.demo :focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 6px #0c1f17; }
.demo [tabindex='-1']:focus { outline: none; box-shadow: none; }
.icon { display: block; flex: none; }
.logo { display: inline-flex; align-items: center; gap: 0.625rem; min-height: 48px; color: inherit; text-decoration: none; font: 800 1.5rem/1 var(--font-display); letter-spacing: -0.02em; }
.logo img { display: block; }

/* ---------- Paisaje ---------- */
.world { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(var(--s1), var(--s2) 45%, var(--s3) 78%); }
.stars { position: absolute; inset: 0; width: 100%; height: 70%; fill: #fff; opacity: var(--stars); transition: opacity 1600ms ease; }
.orb { position: absolute; left: calc(8% + var(--go) * 82%); top: calc(46% - (1 - (var(--go) * 2 - 1) * (var(--go) * 2 - 1)) * 40%); width: clamp(56px, 7vw, 108px); aspect-ratio: 1; border-radius: 50%; background: var(--oc); box-shadow: 0 0 60px 30px var(--og), 0 0 180px 110px var(--og); transition: left 2200ms var(--ease), top 2200ms var(--ease), background-color 1600ms ease, box-shadow 1600ms ease; }
.ridge { position: absolute; left: -3%; bottom: 0; width: 106%; height: max(300px, 46svh); overflow: visible; }
.ridge-1 { stop-color: var(--r1); } .ridge-2 { stop-color: var(--r2); } .ridge-3 { stop-color: var(--r3); } .ridge-4 { stop-color: var(--r4); } .ridge-5 { stop-color: var(--r5); } .ridge-mist { stop-color: var(--s3); }
.world .ridge { bottom: -40px; }
/* En el recorrido solo queda el cielo: nada tapa las pantallas */
.demo[data-state='player'] .world .ridge { transform: translateY(110%); opacity: 0; }
.ridge, .ridge path { transition: transform 1200ms var(--ease), opacity 700ms ease; }
.world .ridge path:nth-of-type(1) { transform: translateX(calc(var(--mx) * -8px - var(--go) * 20px)); }
.world .ridge path:nth-of-type(2) { transform: translateX(calc(var(--mx) * -18px - var(--go) * 34px)); }
.world .ridge path:nth-of-type(3) { transform: translateX(calc(var(--mx) * -30px - var(--go) * 44px)); }
.world .ridge path:nth-of-type(n + 4) { transform: translateX(calc(var(--mx) * -46px)); }

/* ---------- Bienvenida y cierre ---------- */
.welcome { position: relative; display: grid; justify-items: center; align-content: start; min-height: 100svh; padding: clamp(1.25rem, 5svh, 3.5rem) 1.25rem 2rem; text-align: center; }
.welcome h1, .demo .big { margin-top: clamp(0.75rem, 2.5svh, 2rem) !important; max-width: 13em; font-size: clamp(2.5rem, 6.6vw, 5.75rem); line-height: 1; }
.demo .lead { max-width: 34em; margin: 1.25rem 0 1.75rem; font-size: clamp(1.125rem, 1.6vw, 1.375rem); text-wrap: balance; }
.acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.875rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.625rem; min-height: 64px; padding: 0.5rem 2rem; border: 2px solid transparent; border-radius: 999px; text-decoration: none; transition: transform 400ms var(--spring), box-shadow 300ms ease, background-color 200ms ease; }
.demo .btn { font: 800 1.1875rem/1.2 var(--font-display); }
.btn:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -12px rgb(4 18 12 / 0.55); }
.btn:active { transform: scale(0.97); }
.demo .btn--main { background: var(--green); color: #fff; } .demo .btn--white { background: #fff; color: #0c1f17; } .demo .btn--gold { background: var(--gold); color: #0c1f17; } .demo .btn--line { border-color: #fff; background: rgb(7 15 36 / 0.55); color: #fff; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.75rem; font-weight: 700; }
.demo .facts { margin-top: 1.25rem; }
.lens { position: relative; display: block; overflow: hidden; border-radius: 50%; background: #e6efe9; aspect-ratio: 1; }
.lens :is(img, canvas) { position: absolute; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.arc { width: min(82rem, 100%); margin-top: auto; padding-top: 1.25rem; }
.demo .arc > p { display: inline-block; padding: 0.25rem 1.125rem; border-radius: 999px; background: #fff; color: #0c1f17; font: 800 1.125rem/1.6 var(--font-display); }
.arc ul { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.5rem; margin-top: 1rem !important; }
.arc button { display: grid; justify-items: center; gap: 0.5rem; width: 100%; padding: 0; border: 0; border-radius: 1.5rem; background: none; }
.arc .lens { width: min(100%, 92px); border: 4px solid #fff; box-shadow: 0 18px 26px -12px rgb(4 18 12 / 0.65); transition: transform 500ms var(--spring); }
.arc button:hover .lens { transform: translateY(-12px) scale(1.18); }
.arc__name { padding: 0.125rem 0.625rem; border-radius: 999px; background: #fff; color: #0c1f17; font-weight: 700; font-size: 0.9375rem; line-height: 1.3; }
/* Los círculos siguen una curva, como el sol */
.arc li { animation: pop 800ms var(--spring) both; animation-delay: calc(var(--i, 0) * 60ms + 200ms); translate: 0 var(--dy, 0); }
@keyframes pop { from { opacity: 0; transform: translateY(80px) scale(0.4); } }
.welcome > :is(.logo, h1, .big, .lead, .acts, .facts) { animation: up 900ms var(--ease) both; }
.welcome > :is(h1, .big) { animation-delay: 80ms; } .welcome > .lead { animation-delay: 180ms; } .welcome > .acts { animation-delay: 260ms; } .welcome > .facts { animation-delay: 320ms; }
@keyframes up { from { opacity: 0; transform: translateY(40px); } }
.welcome--end { align-content: center; padding-bottom: 34svh; }

/* ---------- Recorrido ---------- */
.player { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100svh; overflow: hidden; overflow: clip; }
.top { position: relative; z-index: 4; display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem clamp(0.75rem, 2vw, 1.5rem); }
.top .logo { margin-right: auto; }
.where { min-height: 48px; display: grid; align-items: center; padding: 0 1.25rem !important; border-radius: 999px; background: #fff; color: #0c1f17; font: 800 1.125rem/1.2 var(--font-display); }
.demo .ctl--top { width: 48px; height: 48px; background: #fff; color: #0c1f17; }
.stage { position: relative; perspective: 1500px; touch-action: pan-y; }
/* La pantalla: sube completa y se echa hacia atrás cuando una pieza se despega */
.cam { position: absolute; left: 50%; top: var(--y, 0); width: var(--w); margin-left: calc(var(--w) / -2); transform-origin: 50% 50%; opacity: 0; visibility: hidden; transform: translate3d(0, 105%, -200px) rotateX(-30deg); transition: transform 1200ms var(--ease), opacity 700ms ease, visibility 0s 1200ms; }
.cam.is-past { transform: translate3d(-70%, -10%, -500px) rotateY(50deg) rotateZ(-8deg); }
.cam.is-on { visibility: visible; opacity: 1; transform: translate3d(0, 0, 0) rotateX(calc(var(--my) * -3deg)) rotateY(calc(var(--mx) * 4deg)); transition: transform 1200ms var(--ease), opacity 500ms ease, visibility 0s; }
.cam.is-on.is-back { transform: translate3d(0, -2%, -420px) rotateX(26deg) rotateZ(-4deg); opacity: 0.62; }
.cam img { display: block; width: 100%; height: auto; border-radius: clamp(1rem, 2.4vw, 2.25rem); box-shadow: 0 40px 70px -30px rgb(4 18 12 / 0.6); }
.spot { position: absolute; border-radius: 14px; opacity: 0; background: rgb(244 180 0 / 0.35); box-shadow: 0 0 0 4px var(--gold); transition: opacity 400ms ease; }
.is-back .spot { opacity: 1; }
.air { position: absolute; inset: 0; z-index: 3; perspective: 1300px; pointer-events: none; }
.piece { position: absolute; left: 50%; top: 50%; translate: -50% -50%; transform-style: preserve-3d; }
.piece__in { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: clamp(1.125rem, 2.2vw, 2.25rem); background: #fff; box-shadow: 0 0 0 6px #fff, 0 0 0 10px var(--gold), 0 60px 90px -30px rgb(4 18 12 / 0.75), 0 20px 40px -16px rgb(4 18 12 / 0.45); transform: rotateY(calc(var(--mx) * 10deg)) rotateX(calc(var(--my) * -8deg)); transition: transform 500ms ease-out; }
.piece img { position: absolute; display: block; max-width: none; }

.dock { position: relative; z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.25rem 2.5rem; border-radius: 2rem 2rem 0 0; padding: 1.125rem clamp(1rem, 4vw, 4rem) max(0.75rem, env(safe-area-inset-bottom)); background: var(--r5); color: #fff; }
.cap { min-height: 7.25rem; }
.cap h2 { font-size: clamp(1.5rem, 2.6vw, 2.375rem); }
.cap p { max-width: 58ch; font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.4; text-wrap: pretty; }
.demo .cap p { margin-top: 0.375rem; }
/* Subtítulo: las palabras se encienden al ritmo de la voz */
.cap i { font-style: normal; color: #c3d0cb; transition: color 200ms ease; }
.cap i.is-said { color: #fff; }
.cap h2 span { display: inline-block; overflow: clip; vertical-align: bottom; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.cap h2 b { display: inline-block; font-weight: inherit; animation: word 650ms var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes word { from { transform: translateY(110%) rotate(5deg); } }
.ctls { display: flex; align-items: center; gap: 0.25rem; }
.ctl { display: grid; flex: none; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: none; transition: transform 400ms var(--spring), background-color 200ms ease; }
.ctl:hover { background: rgb(255 255 255 / 0.16); transform: scale(1.08); }
.demo .ctl--top:hover { background: var(--gold); }
.ctl:active { transform: scale(0.92); }
.ctl:disabled { opacity: 0.4; cursor: default; transform: none; }
.demo .ctl--main { width: 76px; height: 76px; margin-inline: 0.25rem; background: var(--gold); color: #0c1f17; }
[data-playing='true'] .ctl--main .icon:last-child, [data-playing='false'] .ctl--main .icon:first-child { display: none; }
.ctl--voice[aria-pressed='false'] { background: linear-gradient(to top right, transparent calc(50% - 1.5px), #fff calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px)) center / 60% 60% no-repeat; }
.ctls input { width: 6.5rem; height: 48px; accent-color: var(--gold); cursor: pointer; }
.count { min-width: 4.25rem; white-space: nowrap; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.stops { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(var(--n, 12), minmax(64px, 1fr)); overflow-x: auto; scrollbar-width: none; padding-block: 0.5rem 0.25rem; }
.stops button { display: grid; justify-items: center; align-content: start; gap: 0.25rem; padding: 0.25rem 0; border: 0; border-radius: 1.25rem; background: none; color: #dbe5e0; font-size: 0.9375rem; line-height: 1.2; }
.ring { display: block; width: 56px; padding: 4px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p, 0) * 360deg), rgb(255 255 255 / 0.24) 0); transition: transform 500ms var(--spring); }
.ring .lens { filter: brightness(0.72); transition: filter 300ms ease; }
.stops button:hover .ring { transform: translateY(-3px) scale(1.06); }
.stops [aria-current] { color: #fff; font-weight: 700; }
.stops [aria-current] .stops__name { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 0.3em; }
.stops [aria-current] .ring { transform: scale(1.14); }
.stops [aria-current] .lens, .stops button:hover .lens { filter: none; }

@media (max-width: 1100px) {
    .stops { grid-template-columns: repeat(var(--n, 12), 84px); scroll-snap-type: x proximity; }
    .arc ul { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem 0.5rem; }
    .arc li { translate: none; }
}
@media (max-width: 900px) {
    .dock { grid-template-columns: minmax(0, 1fr); padding-inline: 1.125rem; }
    .cap { min-height: 8.75rem; }
    .ctls { justify-content: center; gap: 0.375rem; }
    .ctls input { display: none; }
    .count { min-width: 3.5rem; }
    .stops { margin-inline: -1.125rem; padding-inline: 1.125rem; }
}
@media (max-width: 640px) {
    .arc ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .arc__name { font-size: 0.875rem; padding-inline: 0.375rem; }
    .arc .lens { width: 68px; }
    .welcome .btn { width: 100%; }
    .acts { width: 100%; }
    .top .logo { font-size: 1.25rem; }
    .where { display: none; }
    .ctls { gap: 0; }
    .ctl { width: 48px; height: 48px; }
    .demo .ctl--main { width: 66px; height: 66px; }
    .count { padding-left: 0.25rem; }
    .stops button { font-size: 0.875rem; }
    .stops__name { display: none; }
    .stops [aria-current] .stops__name { display: block; }
    .stops { grid-template-columns: repeat(var(--n, 12), 72px); }
    .piece__in { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--gold), 0 30px 50px -18px rgb(4 18 12 / 0.75); }
}
@media (max-height: 700px) and (min-width: 901px) {
    .stops__name { display: none; }
    .ring { width: 48px; padding: 3px; }
    .cap { min-height: 5.75rem; }
    .demo .ctl--main { width: 64px; height: 64px; }
}
@media (max-height: 520px) {
    .stops { display: none; }
    .dock { grid-template-columns: minmax(0, 1fr) auto; }
    .cap { min-height: 4.5rem; }
    .cap h2 { font-size: 1.25rem; }
    .cap p { font-size: 1rem; }
    .top { padding-block: 0; }
    .ctl--voice, .count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .demo, .demo *, .demo *::before { transition: none !important; animation: none !important; }
    .cam.is-on, .cam.is-on.is-back { transform: none; }
}
@media (forced-colors: active) {
    .is-back .spot { outline: 4px solid Highlight; }
    .stops [aria-current] { outline: 2px solid Highlight; }
}

/* Aviso de la vista previa del panel */
.demo .draft { position: fixed; z-index: 20; left: 50%; top: 0.5rem; display: flex; align-items: center; gap: 1rem; padding: 0.25rem 1.25rem; border-radius: 999px; background: var(--gold); color: #0c1f17; font-weight: 700; white-space: nowrap; transform: translateX(-50%); }
.draft a { display: inline-flex; align-items: center; min-height: 48px; color: inherit; }
