/* Menos ruido, más vida — estilos
   Paleta de marca: azul #3558C1 · blanco #FAF9F6 · amarillo #F6D016
   Tipos: DM Serif Display (principal) · Great Vibes (acento) · Montserrat (texto) */

:root {
  --azul: #3558C1;
  --azul-hondo: #22398A;   /* tinta para texto largo y fondos profundos */
  --tinta: #1E2A55;
  --papel: #FAF9F6;
  --amarillo: #F6D016;
  --escarcha: #DCE4F5;     /* azul helado de las acuarelas */
  --texto-suave: #4A5578;

  --serif: 'DM Serif Display', Georgia, serif;
  --script: 'Great Vibes', cursive;
  --sans: 'Montserrat', system-ui, sans-serif;

  --rail: 112px;
  --ease: cubic-bezier(.6, .05, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 1rem/1.65 var(--sans);
}
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Login ---------------- */
.login {
  min-height: 100svh;
  background: var(--azul);
  color: var(--papel);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 48px 20px 88px;
}
.login-thread {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: var(--amarillo); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 2000; stroke-dashoffset: 2000;
  animation: draw 3.2s var(--ease) .3s forwards;
  vector-effect: non-scaling-stroke;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.login-inner { position: relative; width: min(560px, 100%); }
.login-by { font-family: var(--script); font-size: 2rem; line-height: 1; margin: 0 0 .5rem; color: var(--amarillo); }
.login-title {
  font: 400 clamp(3rem, 9vw, 5.6rem)/0.95 var(--serif);
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
}
.login-sub { font-size: 1.1rem; max-width: 34ch; margin: 0 0 2.75rem; opacity: .92; }
.login-form label { display: block; font-size: .9rem; margin-bottom: .6rem; }
.login-field { display: flex; gap: 12px; border-bottom: 2px solid var(--papel); padding-bottom: 6px; }
.login-field:focus-within { border-color: var(--amarillo); }
.login-field input {
  flex: 1; min-width: 0; background: none; border: 0; color: var(--papel);
  font: 400 1.35rem var(--serif); padding: 6px 0;
}
.login-field input::placeholder { color: rgba(250, 249, 246, .55); }
.login-field input:focus { outline: none; }
.login-field button {
  background: var(--amarillo); color: var(--tinta); border: 0; border-radius: 999px;
  padding: 10px 22px; font-weight: 600;
}
.login-field button:disabled { opacity: .7; }
.login-msg { min-height: 1.6em; margin: .9rem 0 0; color: #FFF3B0; font-weight: 500; }
.login-demo { font-size: .8rem; opacity: .7; margin-top: 2rem; }
.login-help { position: absolute; bottom: 24px; left: 20px; right: 20px; text-align: center; color: var(--papel); font-size: .9rem; }

/* ---------------- Estructura del recorrido ---------------- */
.journey {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100svh;
}
.topbar {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  background: var(--azul); color: var(--papel);
}
.brand { font: 400 1.25rem var(--serif); }
.logout { background: none; border: 0; color: var(--papel); font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }

.rail {
  background: var(--azul);
  display: flex; justify-content: center;
  padding: 8px 0 40px;
}

/* ---------------- El hilo ---------------- */
.thread { position: sticky; top: 16px; align-self: flex-start; }
.thread svg { display: block; overflow: visible; }
.thread-base { fill: none; stroke: rgba(250, 249, 246, .35); stroke-width: 1.5; stroke-dasharray: 3 7; stroke-linecap: round; }
.thread-progress { fill: none; stroke: var(--amarillo); stroke-width: 4; stroke-linecap: round; }

.knot {
  position: absolute; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: var(--azul); color: var(--papel);
  border: 2px solid var(--papel);
  font: 400 1rem/1 var(--serif);
  transition: transform .25s var(--ease), background .3s, color .3s;
}
.knot-start { width: 16px; height: 16px; }
.knot.is-done { background: var(--papel); color: var(--azul); }
.knot.is-current { background: var(--amarillo); border-color: var(--amarillo); color: var(--tinta); }
.knot.is-current:not(.knot-start)::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid var(--amarillo); opacity: .6;
  animation: halo 2.8s ease-in-out infinite;
}
@keyframes halo { 50% { transform: scale(1.18); opacity: 0; } }
.knot.is-locked { border: 2px dashed rgba(250, 249, 246, .45); color: rgba(250, 249, 246, .5); cursor: not-allowed; }
.knot:not(:disabled):hover { transform: translate(-50%, -50%) scale(1.1); }
.knot.is-viewing { box-shadow: 0 0 0 5px var(--azul), 0 0 0 7px var(--papel); }
.knot-gift { background: none; border: 0; width: 38px; height: 38px; }
.knot-gift svg { width: 100%; height: 100%; fill: rgba(250, 249, 246, .25); stroke: rgba(250, 249, 246, .6); stroke-width: 1; stroke-dasharray: 2 2; }
.knot-gift.is-current svg, .knot-gift.is-done svg { fill: var(--amarillo); stroke: none; }
.knot-gift.is-current { background: none; }
.knot-gift.is-viewing { box-shadow: none; }
.knot-gift.is-viewing svg { filter: drop-shadow(0 0 6px rgba(246, 208, 22, .7)); }

/* ---------------- Día ---------------- */
.day {
  padding: 56px clamp(20px, 6vw, 88px) 140px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.day:focus { outline: none; }
.day.is-entering { animation: enter .6s var(--ease) both; }
.day.is-leaving { opacity: 0; transition: opacity .5s; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

.day-head { position: relative; margin-bottom: 56px; }
.day-word {
  font: 400 clamp(2.4rem, 6vw, 3.4rem)/1 var(--script);
  color: var(--azul);
  margin: 0;
  position: relative; z-index: 1;
  transform: translate(.2em, .55em) rotate(-6deg);
  display: inline-block;
}
.day-num {
  font: 400 clamp(7rem, 20vw, 12rem)/0.8 var(--serif);
  color: var(--azul);
  margin: 0;
  -webkit-text-stroke: 0;
  text-shadow: 6px 6px 0 var(--amarillo);
}
.day-title {
  font: 400 clamp(1.7rem, 4vw, 2.4rem)/1.15 var(--serif);
  margin: 18px 0 0;
  max-width: 22ch;
  color: var(--tinta);
}
.day-head-gift .day-word { transform: rotate(-4deg); font-size: clamp(3rem, 8vw, 4.6rem); }

.lede { font-size: 1.1rem; max-width: 52ch; }

/* Momentos del día */
.moments { list-style: none; margin: 0; padding: 0; }
.moment { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 32px; padding: 40px 0; border-top: 1px solid var(--escarcha); }
.moment:first-child { border-top: 0; padding-top: 0; }
.when { margin: 6px 0 0; font-size: .85rem; font-weight: 600; color: var(--azul); }
.m-title { font: 400 1.75rem/1.2 var(--serif); margin: 0 0 4px; }
.m-sub { margin: 0 0 20px; font-size: 1.05rem; color: var(--texto-suave); max-width: 46ch; }
.m-text { margin: 18px 0 0; color: var(--texto-suave); max-width: 52ch; }
.moment-audio { display: block; padding-top: 0; border: 0; margin-bottom: 64px; }

/* Imágenes como postales */
.postcard {
  display: block; border: 0; padding: 10px; margin-top: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(30, 42, 85, .12), 0 12px 30px -12px rgba(30, 42, 85, .3);
  transform: rotate(-1.2deg);
  transition: transform .4s var(--ease);
  cursor: zoom-in;
}
.postcard-placer { max-width: 400px; }
.postcard-reflexion { max-width: 480px; transform: rotate(1deg); }
.postcard:hover, .postcard:focus-visible { transform: rotate(0) scale(1.01); }

.lightbox { border: 0; padding: 0; background: none; max-width: min(92vw, 900px); max-height: 92vh; }
.lightbox::backdrop { background: rgba(30, 42, 85, .82); }
.lightbox img { max-height: 84vh; width: auto; margin: 0 auto; }
.lightbox-close { display: block; margin: 12px auto 0; background: var(--papel); border: 0; border-radius: 999px; padding: 8px 20px; color: var(--tinta); font-weight: 600; }

/* Reproductor */
.player { display: flex; align-items: center; gap: 18px; max-width: 520px; }
.player-btn { flex: none; width: 92px; height: 92px; border: 0; padding: 0; background: none; border-radius: 50%; }
.player-btn svg { width: 100%; height: 100%; overflow: visible; }
.blob { fill: var(--azul); transition: fill .3s; }
.player-btn:hover .blob { fill: var(--azul-hondo); }
.player-btn g { fill: var(--papel); }
.ico-pause { display: none; }
.is-playing .ico-play { display: none; }
.is-playing .ico-pause { display: inline; }
.player-track { flex: 1; }
.player-bar { position: relative; height: 22px; cursor: pointer; }
.player-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--escarcha); border-radius: 2px; }
.player-fill { position: absolute; left: 0; top: 9px; height: 4px; width: 0; background: var(--azul); border-radius: 2px; }
.player-fill::after { content: ''; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--amarillo); border: 2px solid var(--azul); }
.player-time { display: flex; justify-content: space-between; font-size: .8rem; color: var(--texto-suave); font-variant-numeric: tabular-nums; }

/* Guía del día 0 */
.guide { margin: 0 0 24px; padding: 40px clamp(20px, 4vw, 44px); background: var(--escarcha); border-radius: 28px 4px 28px 4px; }
.guide-title { font: 400 2rem/1.15 var(--serif); margin: 0 0 8px; color: var(--azul-hondo); }
.guide-lede { margin: 0 0 28px; max-width: 52ch; }
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.guide-list li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0 24px; }
.guide-list .when { grid-row: span 2; }
.guide-list h3 { font: 400 1.35rem/1.2 var(--serif); margin: 0 0 4px; }
.guide-list p { margin: 0; color: var(--texto-suave); }
.guide-note { margin: 30px 0 0; font-size: .95rem; font-style: italic; }

/* Continuar */
.continue-wrap { margin-top: 64px; padding-top: 40px; border-top: 2px dotted var(--amarillo); text-align: center; }
.continue-wrap p { color: var(--texto-suave); margin: 0 auto 20px; max-width: 44ch; }
.continue {
  background: var(--azul); color: var(--papel); border: 0; border-radius: 999px;
  padding: 18px 34px; font-weight: 600; font-size: 1rem;
  box-shadow: 0 6px 0 var(--azul-hondo);
  transition: transform .15s, box-shadow .15s;
}
.continue:hover { transform: translateY(-1px); }
.continue:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--azul-hondo); }
.continue:disabled { opacity: .6; cursor: wait; }
.continue-ghost { background: none; color: var(--azul); box-shadow: inset 0 0 0 2px var(--azul); }
.continue-ghost:active { box-shadow: inset 0 0 0 2px var(--azul); }
.continue-err { color: #B3261E; margin-top: 14px; }
.closing { margin-top: 40px; color: var(--texto-suave); max-width: 52ch; }

/* WhatsApp */
.wa {
  position: fixed; right: 20px; bottom: 20px; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: var(--tinta); color: var(--papel); text-decoration: none;
  padding: 12px 18px 12px 14px; border-radius: 999px;
  font-size: .9rem; font-weight: 500;
  box-shadow: 0 10px 24px -10px rgba(30, 42, 85, .6);
}
.wa svg { width: 22px; height: 22px; fill: var(--amarillo); }

/* ---------------- Móvil ---------------- */
@media (max-width: 860px) {
  .journey { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .rail {
    position: sticky; top: 0; z-index: 4;
    padding: 0 16px 6px; justify-content: flex-start;
    overflow-x: auto; scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .thread { position: relative; top: 0; margin: 0 auto; }
  .day { padding: 36px 20px 120px; }
  .moment, .guide-list li { grid-template-columns: minmax(0, 1fr); }
  .guide-list .when { grid-row: auto; margin: 0 0 2px; }
  .player-btn { width: 78px; height: 78px; }
  .wa span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wa { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .login-thread { stroke-dashoffset: 0; }
}
