/* =========================================================
   Invitación · "Del boceto al render"
   ========================================================= */
:root {
  --paper: #F2ECE1;
  --graphite: #2E2C2A;
  --red: #D9482B;
  --blue: #0D99FF;
  --ink: #15121C;
  --ink-2: #1E1928;
  --cream: #F6EFE3;
  --orange: #FF5F2E;
  --lilac: #BBA8FF;
  --lime: #D9FF4F;
  --line: rgba(246, 239, 227, .16);

  --f-serif: "Fraunces", "Times New Roman", Georgia, serif;
  --f-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --f-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --pad: clamp(22px, 6.4vw, 40px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; transition: background-color .6s; }
html.is-final { background: var(--ink); }
body {
  font-family: var(--f-mono);
  color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.is-locked { overflow: hidden; height: 100vh; height: 100svh; }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* =========================================================
   ESCENARIO
   ========================================================= */
.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  color: var(--graphite);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  --s2: 0; --s4: 0; --s5: 0;
}
body.is-locked .stage { touch-action: none; }
.stage.is-done { cursor: auto; }

/* Papel de cuaderno punteado */
.paper {
  position: absolute; inset: 0; z-index: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(46, 44, 42, .17) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: center center;
}
.paper::after {
  content: ""; position: absolute; inset: 0;
  background: var(--grain); opacity: .22; mix-blend-mode: multiply;
}

/* La "inundación" de color */
.flood {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(120% 70% at 85% 10%, rgba(187, 168, 255, .10), transparent 60%),
    radial-gradient(90% 60% at 10% 100%, rgba(255, 95, 46, .10), transparent 60%),
    var(--ink);
  clip-path: circle(0px at 50% 85%);
}
.flood::after {
  content: ""; position: absolute; inset: 0;
  background: var(--grain); opacity: .09; mix-blend-mode: overlay;
}

/* Mesa de trabajo */
.frame {
  position: absolute; inset: 0; z-index: 2;
  margin: 0 auto; max-width: 480px;
}
.artboard {
  position: absolute; inset: 0; z-index: 1;
  padding: calc(78px + var(--safe-t)) var(--pad) calc(176px + var(--safe-b));
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.artboard [data-sketch] { opacity: 0; }
.artboard > p, .title { position: relative; z-index: 2; }

.eyebrow {
  font: 500 11.5px/1 var(--f-mono);
  letter-spacing: .2em; text-transform: uppercase;
}
.title { display: flex; flex-direction: column; align-items: flex-start; font-weight: normal; margin-top: 18px; }
.title__name {
  max-width: 24ch;
  text-wrap: balance;
  font: italic 400 clamp(17px, 4.6vw, 21px)/1.25 var(--f-serif);
  font-variation-settings: "opsz" 36, "SOFT" 50;
  letter-spacing: -.01em;
}
.title__main {
  margin-top: 10px;
  font-family: var(--f-serif);
  font-style: italic; font-weight: 300;
  font-size: clamp(74px, 23vw, 132px);
  line-height: .86;
  letter-spacing: -.035em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  padding-right: .08em;
}
.squiggle {
  position: absolute; left: .1em; bottom: -18px;
  width: 64%; height: 20px; overflow: visible;
}
.squiggle path {
  fill: none; stroke: var(--graphite); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
}
.subtitle {
  margin-top: 30px;
  max-width: 24ch;
  text-wrap: balance;
  font: italic 400 clamp(20px, 5.4vw, 25px)/1.25 var(--f-serif);
  font-variation-settings: "opsz" 24;
}
.dedication {
  margin-top: 22px; max-width: 30ch;
  font: 400 14.5px/1.5 var(--f-mono);
}
.dedication strong {
  font-weight: 500;
  background: linear-gradient(transparent 58%, rgba(187, 168, 255, calc(var(--s4) * .5)) 0);
}

.blob {
  position: absolute; z-index: 0;
  width: min(60vw, 290px); aspect-ratio: 1; border-radius: 50%;
  right: -20%; top: 24%;
  background: radial-gradient(circle at 35% 30%, #FF7A4D, var(--orange) 55%, #F04A1C);
  transform-origin: center;
}

.stamp {
  position: absolute; z-index: 2;
  top: calc(64px + var(--safe-t)); right: var(--pad);
  width: 96px; height: 96px;
}
.stamp svg { width: 100%; height: 100%; overflow: visible; }
.stamp text { font: 500 10px var(--f-mono); fill: currentColor; letter-spacing: .06em; }
.stamp__core {
  position: absolute; inset: 27px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font: italic 500 17px/1 var(--f-serif);
  letter-spacing: -.02em;
  overflow: hidden;
}
.stamp__core::before {
  content: ""; position: absolute; inset: -2px; z-index: -1;
  background: var(--orange); opacity: var(--s4);
}
.is-alive .stamp svg { animation: spin 16s linear infinite; }

.spark {
  position: absolute; z-index: 3;
  color: var(--lime);
  opacity: var(--s4);
  scale: calc(.2 + var(--s4) * .8);
  line-height: 1;
}
.spark i { display: block; font-style: normal; }
.spark--1 { font-size: 26px; left: 66%; top: 33%; }
.spark--2 { font-size: 15px; left: 12%; top: 25%; color: var(--lilac); }
.spark--3 { font-size: 18px; right: 14%; bottom: 31%; }
.is-alive .spark i { animation: twinkle 2.4s ease-in-out infinite; }
.is-alive .spark--2 i { animation-delay: -.8s; }
.is-alive .spark--3 i { animation-delay: -1.6s; }

/* Grilla tipo Figma */
.grid {
  position: absolute; inset: 0 var(--pad); z-index: 3;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  pointer-events: none;
  opacity: calc(var(--s2) * (1 - var(--s5)));
}
.grid span {
  background: rgba(255, 64, 96, .07);
  border-left: 1px solid rgba(255, 64, 96, .22);
  border-right: 1px solid rgba(255, 64, 96, .22);
}

/* Capas del boceto */
.sketch, .layer { position: absolute; inset: 0; pointer-events: none; }
.sketch { z-index: 3; width: 100%; height: 100%; overflow: visible; }
#drafts { z-index: 3; }
#sels { z-index: 4; }
#notes { z-index: 4; }
.rough {
  fill: none; stroke: var(--graphite); stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.draft {
  position: absolute;
  font-family: var(--f-hand); font-weight: 500;
  color: var(--graphite);
  white-space: pre-line;
}
.sel {
  position: absolute; opacity: 0;
  border: 1.5px solid var(--blue);
  transform-origin: center;
}
.sel i {
  position: absolute; width: 7px; height: 7px;
  background: #fff; border: 1.5px solid var(--blue);
}
.sel i:nth-child(1) { left: -4px; top: -4px; }
.sel i:nth-child(2) { right: -4px; top: -4px; }
.sel i:nth-child(3) { left: -4px; bottom: -4px; }
.sel i:nth-child(4) { right: -4px; bottom: -4px; }
.sel b {
  position: absolute; left: 50%; top: 100%;
  transform: translate(-50%, 6px);
  background: var(--blue); color: #fff;
  font: 500 9px/1 var(--f-mono);
  padding: 3px 5px; border-radius: 3px; white-space: nowrap;
}
.note {
  position: absolute;
  font: 700 20px/1 var(--f-hand);
  color: var(--red);
  white-space: nowrap;
  transform: rotate(var(--r, -3deg));
}

/* Intro */
.intro {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 0 var(--pad) 120px;
  text-align: center; pointer-events: none;
  color: var(--graphite);
}
.intro__hi {
  font: 700 clamp(44px, 13vw, 64px)/1 var(--f-hand);
  transform: rotate(-3deg);
}
.intro__txt {
  margin-top: 18px;
  font: 500 clamp(23px, 6.6vw, 30px)/1.2 var(--f-hand);
  max-width: 18em;
}

/* Barra tipo app de diseño */
.appbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  padding: calc(16px + var(--safe-t)) var(--pad) 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: .04em;
}
.appbar__file { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; }
.is-done .appbar__dot { background: #3DDC84; }
.appbar__right { display: inline-flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.sound {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid currentColor; background: transparent;
  opacity: .8; cursor: pointer;
}
.sound .sound__mute { display: none; }
.sound[aria-pressed="false"] .sound__wave { display: none; }
.sound[aria-pressed="false"] .sound__mute { display: block; }

/* Botón mantener */
.control {
  position: absolute; left: 0; right: 0; z-index: 6;
  bottom: calc(30px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--ui, var(--graphite));
  transition: opacity .5s, transform .5s;
}
.hold {
  position: relative; width: 88px; height: 88px;
  border: 0; background: transparent; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.hold:focus-visible { outline: 2px dashed var(--blue); outline-offset: 6px; }
.hold__ring { position: absolute; inset: 0; transform: rotate(-90deg); overflow: visible; }
.hold__ring circle { fill: none; stroke-width: 3; }
.hold__track { stroke: var(--ui, var(--graphite)); opacity: .2; }
.hold__bar {
  stroke: var(--orange); stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.hold__core {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ui, var(--graphite));
  color: var(--ui-fg, var(--paper));
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.is-holding .hold__core { transform: scale(.86); }
.is-holding .hold__core svg { animation: scribble .22s ease-in-out infinite alternate; }
.hold::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  border: 1.5px solid var(--ui, var(--graphite));
  animation: pulse 2.2s cubic-bezier(.2, .6, .3, 1) infinite;
}
.has-pressed .hold::before { animation: none; opacity: 0; }
.control__label {
  font: 500 11px/1 var(--f-mono);
  letter-spacing: .16em; text-transform: uppercase;
  min-height: 1em;
}
.is-done .control { opacity: 0; transform: translateY(20px) scale(.9); pointer-events: none; }

.cue {
  position: absolute; left: 0; right: 0; z-index: 6;
  bottom: calc(34px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--cream);
  font: 500 11px/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase;
  opacity: 0; transform: translateY(10px);
  transition: opacity .8s, transform .8s;
  pointer-events: none;
}
.cue i { font-style: normal; font-size: 18px; animation: bob 1.6s ease-in-out infinite; }
.show-cue .cue { opacity: .8; transform: none; }

.flash {
  position: absolute; inset: -15%; z-index: 8; pointer-events: none; opacity: 0;
  mix-blend-mode: screen;
  filter: blur(22px);
  background:
    radial-gradient(65% 55% at 78% 35%, rgba(255, 242, 214, .95) 0%, rgba(255, 140, 36, .85) 36%, rgba(255, 58, 18, .55) 68%, transparent 100%),
    radial-gradient(75% 65% at 22% 72%, rgba(255, 175, 64, .8) 0%, rgba(235, 65, 20, .48) 55%, transparent 95%);
}
.film-burn {
  position: absolute; inset: -20%; z-index: 8; pointer-events: none; opacity: 0;
  mix-blend-mode: screen;
  filter: blur(30px);
  background:
    radial-gradient(50% 80% at 88% 50%, rgba(255, 248, 228, .95) 0%, rgba(255, 120, 28, .82) 38%, rgba(208, 36, 12, .45) 72%, transparent 100%);
}
.film-splice {
  position: absolute; left: 0; right: 0; height: 3px; z-index: 8; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 210, 140, .85) 20%, #FFF5E4 50%, rgba(255, 120, 40, .85) 80%, transparent 100%);
  box-shadow: 0 0 18px 4px rgba(255, 130, 40, .65);
}

/* =========================================================
   CONTENIDO
   ========================================================= */
.content { position: relative; background: var(--ink); color: var(--cream); overflow: hidden; }
.content::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--grain); opacity: .07; mix-blend-mode: overlay;
}
.sec { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 84px var(--pad); }
.sec + .sec { border-top: 1px solid var(--line); }

.kicker {
  display: flex; align-items: center; gap: 14px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--lilac);
}
.kicker::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .35; }
.h2 {
  margin: 22px 0 30px;
  font: italic 300 clamp(44px, 13vw, 68px)/.95 var(--f-serif);
  letter-spacing: -.035em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.lead { font: 400 15px/1.6 var(--f-mono); opacity: .85; margin-bottom: 28px; }
.lead strong { font-weight: 500; color: var(--lime); }

/* Nota */
.note-card {
  position: relative; margin: 44px 4px 0;
  padding: 38px 26px 28px;
  color: var(--graphite);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(46, 44, 42, .14) 1px, transparent 1.4px);
  background-size: 20px 20px;
  transform: rotate(-2deg);
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .7), 0 2px 0 rgba(0, 0, 0, .05);
}
.note-card::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .2; mix-blend-mode: multiply; pointer-events: none; }
.tape {
  position: absolute; top: -14px; left: 50%; width: 116px; height: 30px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(217, 255, 79, .78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.note-card__msg { font: 500 clamp(23px, 6.4vw, 27px)/1.25 var(--f-hand); }
.note-card__sign { margin-top: 18px; text-align: right; font: 700 30px/1 var(--f-hand); color: var(--orange); }

/* Timecode */
.timecode-wrap { margin-bottom: 34px; }
.rec {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; opacity: .75;
}
.rec i { width: 8px; height: 8px; border-radius: 50%; background: #FF3B3B; animation: blink 1.2s steps(2, start) infinite; }
.timecode {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 14px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.tc { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 2.2ch; }
.tc span { font: 500 clamp(24px, 7.6vw, 36px)/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tc small { font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .5; }
.tc--ff span { color: var(--orange); }
.timecode b { font: 400 clamp(20px, 6vw, 28px)/1.1 var(--f-mono); opacity: .3; }

/* Ficha técnica */
.spec { border-top: 1px solid var(--line); }
.spec > div {
  display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: baseline;
  padding: 17px 0; border-bottom: 1px solid var(--line);
}
.spec dt { font: 500 10px/1.6 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; opacity: .55; }
.spec dd { font: 400 20px/1.3 var(--f-serif); font-variation-settings: "opsz" 24; }
.spec dd small { display: block; margin-top: 4px; font: 400 13px/1.4 var(--f-mono); opacity: .6; }

/* Botones */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1px solid rgba(246, 239, 227, .3);
  background: transparent; color: inherit;
  font: 500 12.5px/1 var(--f-mono); letter-spacing: .05em;
  text-decoration: none; cursor: pointer;
  transition: transform .2s, background-color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(246, 239, 227, .07); border-color: rgba(246, 239, 227, .55); }
.btn:active { transform: scale(.97); }
.btn--primary {
  width: 100%; min-height: 64px;
  background: var(--orange); color: var(--ink); border: 0;
  font-size: 15px; letter-spacing: .03em;
  box-shadow: 0 20px 44px -16px rgba(255, 95, 46, .75);
}
.btn--primary:hover { background: #FF7447; }
.btn--link {
  width: 100%; margin-top: 8px; border: 0;
  text-decoration: underline; text-underline-offset: 5px; opacity: .7;
}
.btn--link:hover { background: transparent; opacity: 1; }

/* Créditos */
.sec--credits { text-align: center; padding-bottom: 64px; }
.sec--credits .kicker { text-align: left; }
.credits { padding-top: 40px; }
.credits__role {
  margin-top: 36px;
  font: 500 10px/1.4 var(--f-mono); letter-spacing: .22em; text-transform: uppercase; opacity: .5;
}
.credits__role:first-child { margin-top: 0; }
.credits__name { margin-top: 10px; font: 400 clamp(28px, 8vw, 38px)/1.1 var(--f-serif); font-variation-settings: "opsz" 72; }
.credits__name--sm { font-size: 22px; font-style: italic; }
.credits__list { list-style: none; margin-top: 10px; }
.credits__list li { font: 400 22px/1.5 var(--f-serif); font-variation-settings: "opsz" 36; }
.fin {
  margin-top: 64px;
  font: italic 300 clamp(80px, 26vw, 140px)/.9 var(--f-serif);
  letter-spacing: -.04em; color: var(--orange);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.replay {
  margin-top: 36px; background: none; border: 0; cursor: pointer;
  font: 500 11px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase;
  color: var(--lilac); padding: 12px;
}
.foot {
  position: relative; z-index: 1;
  padding: 26px var(--pad) calc(30px + var(--safe-b));
  text-align: center; font: 400 10.5px/1.5 var(--f-mono); letter-spacing: .08em; opacity: .45;
  border-top: 1px solid var(--line);
}

/* Aparición al hacer scroll */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity 1s ease, transform 1s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

/* =========================================================
   ANIMACIONES
   ========================================================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.6) rotate(45deg); opacity: .6; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes scribble { from { transform: translate(-1.5px, 1px) rotate(-6deg); } to { transform: translate(1.5px, -1px) rotate(4deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes blink { to { visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .is-alive .stamp svg, .is-alive .spark i, .hold::before, .cue i { animation: none; }
}
