/* Demà — la portada. De noche (el sueño de los recuerdos) a la mañana (demà). */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #060818;
  --cream: #f6eee2;
  --muted: #bdb6d2;
  --gold: #f3c47e;
  --lilac: #c9b8ff;
  --line: rgba(246, 238, 226, 0.16);
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--cream);
  background: transparent;
  font: 400 1.0625rem/1.65 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(243, 196, 126, 0.35); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
a { color: inherit; }

/* Un idioma a la vez: el otro se esconde (también a los lectores de pantalla). */
html[data-lang="ca"] body [lang="es"]:not(.keep),
html[data-lang="es"] body [lang="ca"]:not(.keep) { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- El cielo: fondo, partículas, fotos reveladas, susurros y velo ---------- */

.sky, .whispers, .veil { position: fixed; inset: 0; pointer-events: none; }
.whispers, .memories { overflow: hidden; }
.sky { z-index: 0; }
.sky .night, .sky .dawn { position: absolute; inset: 0; }
.sky .night {
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(44, 50, 118, 0.5), transparent 70%),
    linear-gradient(180deg, #060818 0%, #0a0e27 50%, #10143a 100%);
}
.sky .dawn {
  opacity: var(--dawn, 0);
  background:
    radial-gradient(75% 45% at 50% 100%, rgba(255, 176, 124, 0.6), transparent 72%),
    linear-gradient(180deg, #0d0c26 0%, #2a1f50 38%, #6b3c6a 68%, #b35e68 100%);
}
#sky {
  position: fixed; left: 0; top: 0; z-index: 1; pointer-events: none;
  width: 100vw; height: 100vh; height: 100lvh;
}
.memories {
  position: fixed; left: 0; top: 0; z-index: 2; pointer-events: none;
  width: 100vw; height: 100vh; height: 100lvh;
}
.mem { position: absolute; margin: 0; opacity: 0; visibility: hidden; will-change: opacity, filter; }
.mem img, .still img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: radial-gradient(closest-side, #000 58%, transparent 98%);
  mask-image: radial-gradient(closest-side, #000 58%, transparent 98%);
}
.mem figcaption {
  position: absolute; top: 94%; left: -25%; right: -25%; text-align: center;
  font: italic 300 clamp(1rem, 1.35vw, 1.2rem)/1.35 var(--serif); color: rgba(246, 238, 226, 0.85);
  text-shadow: 0 1px 14px rgba(4, 5, 16, 0.9);
}
.whispers { z-index: 2; }
.whispers p {
  position: absolute; margin: 0; opacity: 0; white-space: nowrap; will-change: opacity, filter, transform;
  font: italic 300 clamp(0.95rem, 1.5vw, 1.3rem)/1.2 var(--serif); color: rgba(246, 238, 226, 0.82);
}
.whispers p:nth-child(1) { top: 12%; left: 9%; }
.whispers p:nth-child(2) { top: 9%; left: 58%; }
.whispers p:nth-child(3) { top: 86%; left: 7%; }
.whispers p:nth-child(4) { top: 15%; left: 33%; }
.whispers p:nth-child(5) { top: 90%; left: 46%; }
.whispers p:nth-child(6) { top: 12%; left: 80%; }
.whispers p:nth-child(7) { top: 95%; left: 71%; }
.whispers p:nth-child(8) { top: 93%; left: 22%; }
.whispers p:nth-child(9) { top: 88%; left: 60%; }
.whispers p:nth-child(10) { top: 6.5%; left: 40%; }
.veil {
  z-index: 3;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(3, 4, 14, 0.5) 100%);
  overflow: hidden;
}
.veil::after {
  content: ""; position: absolute; inset: -64px; opacity: 0.06;
  background-image: var(--grain, none);
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-14px, 9px); }
  40% { transform: translate(11px, -17px); }
  60% { transform: translate(-7px, 21px); }
  80% { transform: translate(19px, 4px); }
  100% { transform: translate(0, 0); }
}
html:not(.gl) #sky, html:not(.gl) .memories, html:not(.gl) .whispers { display: none; }

/* ---------- Cabecera ---------- */

.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 12px;
}
.bar > * { pointer-events: auto; }
.bar::before {                                  /* lo que pasa por debajo de la cabecera no se mezcla con ella */
  content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 8, 24, 0.72), rgba(6, 8, 24, 0));
  opacity: var(--mark, 0);
}
.mark {
  font: 400 1.45rem/1 var(--serif); font-variation-settings: "SOFT" 100;
  color: var(--cream); text-decoration: none; opacity: var(--mark, 0); transition: opacity 0.3s;
}
html:not(.js) .mark { opacity: 1; }
.bar nav { display: flex; align-items: center; gap: 12px; }
.langs { display: flex; gap: 2px; }
.langs button {
  appearance: none; background: none; border: 0; cursor: pointer; border-radius: 8px;
  color: var(--muted); font: 600 0.78rem/1 var(--sans); letter-spacing: 0.12em; padding: 10px 7px;
}
.langs button[aria-pressed="true"] {
  color: var(--cream); text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--gold);
}
html:not(.js) .langs { display: none; }
.cta {
  color: var(--cream); text-decoration: none; font: 600 0.9rem/1 var(--sans);
  padding: 11px 17px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 12, 34, 0.35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: border-color 0.2s;
}
.cta:hover { border-color: var(--gold); }

/* ---------- Portada ---------- */

main { position: relative; z-index: 4; }
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 520px;
  display: grid; place-items: center; text-align: center; padding: 0 20px;
}
.hero-in { max-width: 46rem; }
.wordmark {
  font-family: var(--serif); font-weight: 360; font-variation-settings: "SOFT" 100;
  font-size: clamp(4.5rem, 16vw, 12rem); line-height: 0.95; letter-spacing: -0.02em; margin: 0 0 0.15em;
}
.tagline {
  font: italic 320 clamp(1.3rem, 2.4vw, 1.9rem)/1.3 var(--serif);
  margin: 0 0 0.6em; opacity: var(--hin, 1); transition: opacity 0.2s;
}
.gloss { color: var(--muted); font-size: 0.95rem; margin: 0; opacity: var(--hin, 1); }
.gl .hero .wordmark {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.gl .hero-in {
  position: absolute; left: 20px; right: 20px; margin: 0 auto;
  top: calc(var(--word-bottom, 64vh) + 24px);
  opacity: var(--hero, 1);
  filter: blur(calc((1 - var(--hero, 1)) * 6px));
  transform: translateY(calc((1 - var(--hero, 1)) * -30px));
}
.cue {
  position: absolute; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--muted); text-decoration: none; font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.18em; text-transform: uppercase; white-space: nowrap;
  opacity: calc(var(--hero, 1) * var(--hin, 1));
}
.cue::after {
  content: ""; width: 1px; height: 44px; transform-origin: top;
  background: linear-gradient(var(--cream), transparent); animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue {
  0% { transform: scaleY(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- Los tramos del relato ---------- */

.step {
  position: relative; min-height: 150vh; min-height: 150svh;
  display: grid; grid-template-columns: minmax(0, 1fr);      /* la columna nunca crece más que la pantalla */
  align-items: center; padding: 0 clamp(20px, 6vw, 96px);
}
.step.long { min-height: 230vh; min-height: 230svh; --sm: 0.5; --out: 0.9; }
.gl .step.long { align-items: start; }
/* En los tramos de dos formas el texto se queda quieto mientras cambian; `top` es donde queda su borde de
   arriba (sin translate: sticky calcula con la caja sin desplazar y se soltaría antes de tiempo). */
.gl .step.long .copy { position: sticky; top: 28vh; top: 28svh; margin: 30vh 0 8vh; }
.gl .step.long.center .copy { top: 50vh; top: 50svh; }
.copy { position: relative; max-width: min(31rem, 40vw); text-shadow: 0 1px 18px rgba(4, 5, 16, 0.85); }
.step[data-side="right"] .copy { justify-self: start; }
.step[data-side="left"] .copy { justify-self: end; }
.step.center .copy, .step.final .copy { justify-self: center; text-align: center; max-width: 38rem; }
.copy h2 {
  font-family: var(--serif); font-weight: 340; font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: clamp(2.1rem, 4.4vw, 3.9rem); line-height: 1.05; letter-spacing: -0.015em;
  margin: 0 0 0.55em; text-wrap: balance;
}
.copy p { color: var(--muted); font-size: clamp(1.03rem, 1.25vw, 1.16rem); margin: 0 0 1em; text-wrap: pretty; }
.step.center .copy p { margin-left: auto; margin-right: auto; max-width: 34rem; }
.copy p.big {
  font: italic 320 clamp(1.35rem, 2.2vw, 1.8rem)/1.3 var(--serif); color: var(--cream); margin-top: 1.2em;
}
.tag {
  display: inline-block; margin: 0 0 1.1em; padding: 6px 11px; border-radius: 999px;
  border: 1px solid rgba(243, 196, 126, 0.45); color: var(--gold) !important;
  font: 600 0.7rem/1 var(--sans) !important; letter-spacing: 0.16em; text-transform: uppercase;
}
.tag.soon { border-color: rgba(201, 184, 255, 0.5); color: var(--lilac) !important; }
.chips { list-style: none; padding: 0; margin: 1.4em 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.04); text-shadow: none;
}

.voice {
  margin: 0 auto 1.3em; max-width: 30rem; padding: 18px 20px 20px; border-radius: 20px; text-align: left;
  background: rgba(12, 14, 38, 0.55); border: 1px solid var(--line); text-shadow: none;
}
.rec {
  display: flex !important; align-items: center; gap: 8px; margin: 0 0 10px !important;
  font: 600 0.74rem/1 var(--sans) !important; letter-spacing: 0.1em; text-transform: uppercase;
}
.rec .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ff6b5e; box-shadow: 0 0 12px #ff6b5e;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
.said {
  margin: 0 !important; min-height: 2.7em; color: var(--cream) !important;
  font: italic 340 clamp(1.25rem, 2.1vw, 1.6rem)/1.35 var(--serif) !important;
}
.caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em;
  background: var(--gold); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
html:not(.js) .caret { display: none; }
.search {
  display: flex; align-items: center; gap: 10px; margin: 0 0 1.2em; max-width: 26rem; min-height: 50px;
  padding: 13px 18px; border-radius: 999px; background: rgba(12, 14, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.16); font-size: 1.02rem; text-shadow: none;
}
.search svg { color: var(--muted); flex: none; }

/* El texto se enfoca como un recuerdo al llegar y se desenfoca al irse (--q: 0 → 1 a lo largo del tramo). */
@media (prefers-reduced-motion: no-preference) {
  .js .step .w, .js .step .fade {
    --k: clamp(0, (var(--q, 0) - var(--s) * var(--sm, 1)) * 12, 1);
    --o: calc(1 - clamp(0, (var(--q, 0) - var(--out, 0.8)) * 6, 1));
    opacity: calc(var(--k) * var(--o));
    filter: blur(calc((1 - var(--k)) * 10px + (1 - var(--o)) * 8px));
    transform: translate3d(0, calc((1 - var(--k)) * 0.4em), 0);
  }
  .js .step .w { display: inline-block; }
  .js .step .fade { --s: 0.24; }
  .js .step .fade.late { --s: 0.3; }
  .js .step .tag.fade { --s: 0.06; }
  .js .step.final .fade, .js .step.final .w { --o: 1; }
}

/* ---------- La lista de espera ---------- */

.step.final { min-height: auto; align-items: start; padding-top: 30vh; padding-bottom: 6vh; }
.signup {
  margin: 2.2em auto 0; max-width: 30rem; padding: 24px; border-radius: 24px; text-align: left;
  background: rgba(16, 14, 40, 0.5); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px) saturate(1.15); backdrop-filter: blur(16px) saturate(1.15);
  text-shadow: none; scroll-margin-top: 16vh;
}
.signup h3 { font: 400 1.65rem/1.2 var(--serif); font-variation-settings: "SOFT" 100; margin: 0 0 0.3em; }
.signup > p { color: var(--muted); margin: 0 0 1.1em; font-size: 1rem; }
.label {
  display: block; margin-bottom: 8px; color: var(--muted);
  font: 600 0.74rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
}
.field { display: flex; gap: 8px; }
.field input {
  /* width 100 % y min-width 0: ocupa lo que quede junto al botón, o todo el ancho si van uno encima del otro */
  flex: 1 1 auto; width: 100%; min-width: 0; font: 1.02rem var(--sans); color: var(--cream);
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 13px 18px; outline: none; -webkit-appearance: none; appearance: none;
}
.field input:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243, 196, 126, 0.25); }
/* El autorrelleno de Safari y Chrome pinta el campo de claro: se tapa con una sombra interior del mismo color. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream); caret-color: var(--cream);
  -webkit-box-shadow: 0 0 0 40px #28213f inset; box-shadow: 0 0 0 40px #28213f inset;
  transition: background-color 100000s ease-out 0s;
}
.field button {
  flex: none; cursor: pointer; border: 0; border-radius: 999px; padding: 13px 22px;
  font: 600 1rem var(--sans); color: #24152e; background: linear-gradient(180deg, #ffe2ad, #f4a582);
  transition: transform 0.2s, filter 0.2s;
}
.field button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.field button:disabled { opacity: 0.6; cursor: default; transform: none; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 0.88rem; line-height: 1.5; color: var(--muted); cursor: pointer; }
.consent input { accent-color: #f4a582; width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.consent a { color: var(--cream); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.4em; margin: 12px 0 0 !important; font-size: 0.95rem !important; color: var(--cream) !important; }
.status[data-kind="invalid"], .status[data-kind="consent"], .status[data-kind="error"], .status[data-kind="closed"] { color: #ffb8a6 !important; }
.done .label, .done .field, .done .consent { display: none; }
.done .status { font: italic 340 1.7rem/1.3 var(--serif) !important; margin: 0 !important; }
@media (max-width: 380px) { .field { flex-direction: column; } .field input { flex: none; } }   /* también con el texto ampliado */

/* ---------- El regalo del final (ADR-0041): el retrato de Olívia junto al sol y su nombre ---------- */

.step.gift { min-height: 130vh; min-height: 130svh; }
.mem[data-shape="olivia"] figcaption { display: none; }   /* su nombre lo escriben las partículas */
.step.gift .still { width: min(100%, 20rem); }
.step.gift .still figcaption { margin-top: 0.4em; font: 400 2.4rem/1 var(--serif); font-variation-settings: "SOFT" 100; }
html:not(.gl) .step.gift { min-height: auto; }

/* ---------- Pie ---------- */

.foot {
  position: relative; z-index: 4; text-align: center; color: var(--muted); font-size: 0.9rem;
  padding: 64px clamp(20px, 6vw, 96px) max(36px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10, 8, 26, 0), rgba(10, 8, 26, 0.82) 38%);
  text-shadow: 0 1px 12px rgba(4, 5, 16, 0.8);
}
.foot-mark { font: 400 2rem/1 var(--serif); font-variation-settings: "SOFT" 100; color: var(--cream); margin: 0 0 12px; }
.foot a { color: var(--cream); }
.foot p { margin: 0 0 8px; }
.note { max-width: 36rem; margin: 14px auto 0 !important; font-size: 0.8rem; opacity: 0.8; }

/* ---------- Sin cielo (sin JavaScript, sin WebGL2 o con «reducir movimiento»): fotos quietas ---------- */

.still { margin: 0; justify-self: center; width: min(100%, 26rem); }
.still figcaption { text-align: center; margin-top: -6%; font: italic 300 1.05rem/1.35 var(--serif); color: rgba(246, 238, 226, 0.85); }
.gl .still { display: none; }
html:not(.gl) .step { min-height: auto; padding-top: 14vh; padding-bottom: 14vh; gap: 4vw; }
html:not(.gl) .step:has(.still) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
html:not(.gl) .step .copy { justify-self: center; max-width: 32rem; }
html:not(.gl) .step[data-side="left"] .still { order: -1; }
html:not(.gl) .hero { height: auto; min-height: 100svh; }

/* ---------- Móvil: la forma arriba, el texto debajo ---------- */

@media (max-width: 819px) {
  .step { padding: 0 22px; }
  .step .copy, .step[data-side] .copy { justify-self: center; max-width: 34rem; }
  .copy h2 { font-size: clamp(1.85rem, 7.8vw, 2.6rem); }
  .whispers p { font-size: 0.95rem; }
  .whispers p:nth-child(n + 5) { display: none; }
  .whispers p:nth-child(1) { top: 10%; left: 6%; }
  .whispers p:nth-child(2) { top: 14%; left: 44%; }
  .whispers p:nth-child(3) { top: 92%; left: 8%; }
  .whispers p:nth-child(4) { top: 95%; left: 46%; }
  .gl .step.long .copy, .gl .step.long.center .copy { top: 56svh; }
  .mem figcaption { font-size: 0.95rem; top: 92%; }
  .cta { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .veil::after, .cue::after, .rec .dot, .caret { animation: none; }
}
