/*
 * Landing de Dueto · dirección A («Un solo hilo»), elegida en Visual Delight.
 * Un mundo deliberadamente claro: crema con toques pastel, tinta azul noche y un solo hilo coral.
 * Layout: portada con «dueto.» enorme; debajo, hojas que el hilo va cosiendo en zigzag.
 */
:root {
  --bg: #FBF7F1;
  --ink: #1E2A3A;
  --soft: #55607A;
  --faint: #8A93A6;
  --card: #FFFFFF;
  --lav: #ECE6FA;
  --lav-2: #E6E1EF;
  --peach: #FCE3D8;
  --peach-2: #F7DCCF;
  --mint: #E2EBE3;
  --butter: #FFF1CF;
  /* el hilo (se ajusta desde el panel) */
  --thread: #E2674A;
  --thread-dark: #B9492F;
  --thread-light: #F6B19E;
  --tw: 13px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 30px 60px -36px rgba(30, 42, 58, 0.35), 0 8px 18px -12px rgba(30, 42, 58, 0.12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--thread); outline-offset: 3px; border-radius: 8px; }

/* Fondo: manchas pastel que se mueven muy despacio */
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blobs i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.85; animation: drift 26s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { width: 58vw; height: 58vw; left: -18vw; top: -16vw; background: var(--lav); }
.blobs i:nth-child(2) { width: 50vw; height: 50vw; right: -16vw; top: 30vh; background: var(--peach); animation-delay: -9s; }
.blobs i:nth-child(3) { width: 44vw; height: 44vw; left: 10vw; bottom: -20vw; background: var(--mint); animation-delay: -17s; opacity: 0.6; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(4vw, -3vh) scale(1.08); } }

/* Barra */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); }
.top {
  position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.mark { font: 600 26px/1 var(--serif); letter-spacing: -0.03em; color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); }
.mark b { color: var(--thread); font-weight: 600; }
.top nav { display: flex; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px; background: var(--card); color: var(--ink); font: 600 14px var(--sans); border: 0; box-shadow: 0 8px 20px -12px rgba(30, 42, 58, 0.35); text-decoration: none; cursor: pointer; }
.pill--ghost { background: color-mix(in srgb, var(--card) 60%, transparent); }

/* Capas del hilo */
#thread-layer { position: absolute; top: 0; left: 0; z-index: 4; pointer-events: none; overflow: visible; opacity: 0; transition: opacity 0.4s var(--ease); }
#thread-layer.ready { opacity: 1; }
main { position: relative; z-index: 2; }

/* ═══ Portada ═══ */
.hero {
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 2.4vh, 26px); text-align: center;
  padding-block: 96px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.word-wrap { position: relative; display: inline-block; }
/* Sin márgenes del navegador: la palabra, sus personajes y el texto quedan juntos y centrados */
/* Fraunces «suave»: letras redondas y gorditas */
.word, h2, h3, .mark, .num, .demo-msg, .big-quote { font-variation-settings: 'SOFT' 100, 'WONK' 0; }
.word { margin: 0; padding: 0.12em 0.2em 0.62em; /* abajo: sitio para la rúbrica del hilo */ font: 600 clamp(104px, min(21vw, 31vh), 320px)/0.9 var(--serif); letter-spacing: -0.045em; color: var(--ink); white-space: nowrap; }
.word .ch { display: inline-block; opacity: 0; transform: translateY(0.35em); animation: rise 1s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms + 150ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
/* El punto va separado de la «o» lo justo para que la vuelta del hilo lo rodee sin tapar la letra */
.dot { position: relative; display: inline-block; width: 0.15em; height: 0.15em; margin-left: 0.15em; }
.dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--thread); transform: scale(0); animation: pop 0.6s var(--spring) 0.35s forwards; }
.dot::before { content: ""; position: absolute; inset: -30%; border-radius: 50%; border: 2px solid var(--thread); opacity: 0; }
.dot.tied::before { animation: ring 1.4s var(--ease) 0.1s; }
@keyframes pop { to { transform: scale(1); } }
@keyframes ring { 0% { opacity: 0.7; transform: scale(0.6); } 100% { opacity: 0; transform: scale(2.6); } }
.face {
  position: absolute; width: clamp(64px, 8vw, 118px); aspect-ratio: 1; overflow: hidden;
  box-shadow: 0 22px 40px -22px rgba(30, 42, 58, 0.45);
  animation: bob 5.5s ease-in-out infinite;
}
.face img { position: absolute; left: 50%; bottom: -2%; width: 94%; translate: -50% 0; }
.face--lily, .face--alex { top: 36%; margin-top: calc(clamp(64px, 8vw, 118px) * -0.5); }
.face--lily { right: 100%; margin-right: clamp(10px, 3vw, 56px); background: var(--lav-2); border-radius: 30% 30% 30% 6%; }
.face--alex { left: 100%; margin-left: clamp(10px, 3vw, 56px); background: var(--peach-2); border-radius: 30% 30% 6% 30%; animation-delay: -2.7s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
.lead { margin: 0; max-width: 30ch; font: 500 clamp(19px, 2vw, 25px)/1.45 var(--sans); color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 26px; border-radius: 999px; font: 700 16px var(--sans); text-decoration: none; transition: transform 0.3s var(--spring), box-shadow 0.3s; }
.btn--ink { background: var(--ink); color: #fff; box-shadow: 0 16px 30px -16px rgba(30, 42, 58, 0.6); }
.btn--ink:hover { transform: translateY(-2px); }
.btn--soft { background: var(--card); color: var(--ink); box-shadow: 0 12px 26px -18px rgba(30, 42, 58, 0.5); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.follow { margin: 6px 0 0; font: 700 12px var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }

/* ═══ Hojas cosidas ═══ */
.sheets {
  display: grid; gap: clamp(120px, 20vh, 210px);
  padding-block: clamp(40px, 8vh, 90px) clamp(120px, 20vh, 200px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.sheet {
  position: relative; width: min(100%, 1040px); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(24px, 4vw, 56px); align-items: center;
  padding: clamp(24px, 4vw, 52px);
  background: var(--card); border-radius: 40px; box-shadow: var(--shadow);
  opacity: 0.5;
  transition: opacity 0.8s var(--ease), box-shadow 0.9s var(--ease);
}
.sheet > * { transition: opacity 0.8s var(--ease) 0.1s; }
.sheet:not(.reached) > * { opacity: 0.55; }
.sheet.reached { opacity: 1; box-shadow: 0 40px 80px -40px rgba(30, 42, 58, 0.4), 0 10px 22px -14px rgba(30, 42, 58, 0.14); }
.sheet--flip .copy { order: 2; }
.copy { display: grid; gap: 16px; min-width: 0; }
.eyebrow { margin: 0; font: 700 12px/1.3 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--thread-dark); }
h2 { margin: 0; font: 500 clamp(36px, 4.4vw, 58px)/1.04 var(--serif); letter-spacing: -0.025em; text-wrap: balance; }
.body { margin: 0; color: var(--soft); max-width: 40ch; }
.art { position: relative; min-width: 0; }

/* Puntadas: el hilo cose cada elemento al pasar */
.stitched { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.stitched li { position: relative; padding: 9px 0 9px 40px; color: var(--faint); transition: color 0.5s var(--ease); }
.stitched li::before { content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; border-left: 2px dotted #D9DCE4; }
.stitched li.lit { color: var(--ink); }
.stitched b { display: block; font-weight: 700; color: inherit; }
.stitched span { display: block; font-size: 15px; color: var(--faint); }
.stitched li.lit span { color: var(--soft); }

/* Escena */
.stage { position: relative; aspect-ratio: 360 / 250; border-radius: 30px; overflow: hidden; background: var(--lav-2) center / cover no-repeat; }
.stage--cafe { background-image: url("assets/scenes/cafe.svg"); }
.stage--walk { background-image: url("assets/scenes/walk.svg"); }
.who { position: absolute; bottom: 0; width: 40%; aspect-ratio: 200 / 220; }
.who img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; transition: opacity 0.25s; }
.who--l { left: 8%; }
.who--r { right: 8%; }
.who--c { left: 50%; translate: -50% 0; width: 50%; }

/* Personajes */
.cast { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
.cast figure { margin: 0; display: grid; gap: 8px; justify-items: center; text-align: center; }
.cast .bub { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 30% 30% 30% 8%; transition: transform 0.5s var(--spring); }
.cast figure:nth-child(even) .bub { border-radius: 30% 30% 8% 30%; }
.cast .bub img { position: absolute; left: 50%; bottom: -2%; width: 96%; translate: -50% 0; }
.cast figure.lit .bub { transform: translateY(-4px) rotate(-2deg); }
.cast figure:nth-child(even).lit .bub { transform: translateY(-4px) rotate(2deg); }
.cast figcaption { font-size: 14px; line-height: 1.3; color: var(--faint); padding-bottom: 18px; }
.cast figcaption b { display: block; font-size: 15px; color: var(--ink); }

/* Demo */
.demo { display: grid; gap: 12px; padding: 18px; border-radius: 20px; background: #F7F4EE; }
.demo-label { margin: 0; font: 700 12px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.demo-msg { margin: 0; font: 400 21px/1.55 var(--serif); }
.frag {
  font: inherit; color: inherit; background: transparent; border: 0; padding: 1px 3px; margin: 0 -1px; border-radius: 6px; cursor: pointer; text-align: left;
  transition: background-color 0.25s, box-shadow 0.25s;
}
.frag-t { text-decoration: underline dotted #C9CEDA; text-decoration-thickness: 2px; text-underline-offset: 5px; }
/* Palabras clave de un título: el hilo las subraya por detrás, cosiéndose de izquierda a derecha */
.sew {
  padding: 0 0.04em 0.06em;
  background-image:
    repeating-linear-gradient(115deg, transparent 0 7px, color-mix(in srgb, var(--thread-dark) 32%, transparent) 7px 10px),
    linear-gradient(color-mix(in srgb, var(--thread) 55%, transparent), color-mix(in srgb, var(--thread) 55%, transparent));
  background-repeat: no-repeat; background-position: left 0 bottom 0.02em; background-size: 0% 0.3em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 0.75s var(--ease) calc(0.2s + var(--i, 0) * 0.55s);
}
.sewn .sew { background-size: 100% 0.3em; }
.frag:hover { background-color: #EFEBE3; }
/* El buen detalle: el hilo se tensa y lo envuelve */
.frag.ok { background-color: var(--peach); box-shadow: 0 0 0 2px var(--thread); }
.frag.ok .frag-t { text-decoration-color: var(--thread); }
.frag.meh { background-color: var(--butter); }
.out:empty { display: none; }
.out { display: grid; gap: 8px; animation: in 0.5s var(--spring); }
@keyframes in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
.found { margin: 0; font: 700 12px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--thread-dark); }
.mine { margin: 0; padding-left: 14px; border-left: 4px solid var(--thread); font: 600 18px/1.45 var(--sans); }
.meh-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--butter); color: #6B4E12; font-size: 15px; }

/* Más que frases */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; grid-column: 1 / -1; }
.panel { display: grid; gap: 10px; align-content: start; padding: 22px; border-radius: 28px; background: #F7F4EE; }
.panel:nth-child(1) { background: var(--lav); }
.panel:nth-child(2) { background: var(--peach); }
.panel:nth-child(3) { background: var(--mint); }
.panel h3 { margin: 0; font: 600 24px/1.15 var(--serif); padding-bottom: 20px; }
.panel p { margin: 0; color: var(--soft); font-size: 15px; }
.num { font: 600 64px/1 var(--serif); letter-spacing: -0.03em; }
.ask { display: inline-flex; align-items: center; gap: 10px; justify-self: start; padding: 10px 16px; border-radius: 999px; background: #fff; font-weight: 600; font-size: 15px; }
.bars { display: inline-flex; gap: 3px; height: 18px; align-items: center; }
.bars i { width: 4px; height: 100%; border-radius: 2px; background: var(--thread); animation: bar 0.9s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -0.2s; } .bars i:nth-child(3) { animation-delay: -0.45s; } .bars i:nth-child(4) { animation-delay: -0.1s; }
@keyframes bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.trio-head { grid-column: 1 / -1; display: grid; gap: 14px; }

/* Idiomas */
.langs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.langs button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: #F3EFE8; color: var(--ink); font: 600 14px var(--sans); cursor: pointer; transition: transform 0.3s var(--spring), background-color 0.3s; }
.langs button:hover { transform: translateY(-3px); background: var(--peach); }
.langs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.big-quote { margin: 0; font: italic 400 clamp(26px, 3vw, 38px)/1.25 var(--serif); color: var(--ink); }

/* Cierre */
.end { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 22px; padding-block: 80px 120px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.end h2 { max-width: 16ch; }
.end .word { font-size: clamp(96px, min(19vw, 28vh), 280px); }
.end .word .ch, .end .dot::after { animation: none; opacity: 1; transform: none; }
.foot { position: relative; z-index: 2; text-align: center; padding: 26px 16px 40px; font-size: 13px; color: var(--faint); }

/* El hilo (SVG) */
.t-shadow { fill: none; stroke: rgba(120, 40, 20, 0.16); stroke-width: calc(var(--tw) + 2px); stroke-linecap: butt; transform: translate(2px, 4px); }
.t-base { fill: none; stroke: var(--thread); stroke-width: var(--tw); stroke-linecap: round; }
.t-twist { fill: none; stroke: var(--thread-dark); stroke-width: var(--tw); stroke-dasharray: 3.6 7.4; opacity: 0.34; }
.t-shine { fill: none; stroke: var(--thread-light); stroke-width: calc(var(--tw) * 0.24); stroke-linecap: round; opacity: 0.9; transform: translate(-0.8px, -2px); }
.reveal { fill: none; stroke: #fff; stroke-width: calc(var(--tw) + 14px); stroke-linecap: round; }
.hole { fill: rgba(30, 42, 58, 0.22); }
.hole-ring { fill: none; stroke: rgba(30, 42, 58, 0.12); stroke-width: 2; transition: r 0.4s var(--spring), stroke 0.4s; }
.hole-g.hit .hole-ring { stroke: var(--thread); r: 12px; }
.tug .t-base { animation: tug 0.9s var(--spring); }
@keyframes tug { 30% { stroke-width: calc(var(--tw) * 1.6); } }

/* Accesibilidad e idiomas */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang { position: relative; padding: 0 0 0 14px; gap: 0; }
.lang svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: none; }
.lang select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--ink); font: 600 14px var(--sans); min-height: 42px; padding: 0 16px 0 8px; border-radius: 999px; cursor: pointer; }
.note { margin: 0; font-size: 14px; color: var(--faint); }
.eyebrow--plain { color: var(--faint); margin-top: 6px; }
.lead strong { color: var(--ink); font-weight: 600; }
:lang(ja) { line-break: strict; overflow-wrap: anywhere; }
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(ja) h2, :lang(ko) h2 { letter-spacing: 0; line-height: 1.2; }

/* Móvil */
@media (max-width: 820px) {
  .top .hide-s { display: none; }
  .sheet, .sheet:nth-child(odd), .sheet:nth-child(even) { grid-template-columns: minmax(0, 1fr); translate: 0 0; }
  .sheet--flip .copy { order: 0; }
  .art:not(.stitched) { order: -1; }
  .trio { grid-template-columns: minmax(0, 1fr); }
  .sheets { gap: 150px; }
  .face--lily, .face--alex { top: auto; bottom: calc(100% + 14px); margin: 0; }
  .face--lily { right: auto; left: 12%; }
  .face--alex { left: auto; right: 12%; }
  .hero .lead, .end h2, .end .eyebrow { padding-inline: 24px; }
  :root { --tw: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .blobs i, .face, .bars i, .word .ch, .dot::after { animation: none !important; opacity: 1 !important; transform: none !important; }
  .frag, .sew { transition: none !important; }
  .dot.tied::before { animation: none; }
  .sheet { transition: none; }
}
