:root {
  color-scheme: dark;
  --night: #080513;
  --white: #fff3fb;
  --pink: #ffd0ef;
  --muted: #ecd9fa;
  --line: #f3d6ff48;
  --display: "Baskerville", "Palatino Linotype", Georgia, serif;
  font-family: "Segoe UI", sans-serif;
  background: var(--night);
  color: var(--white);
}
* { box-sizing: border-box }
body { margin: 0 }
[hidden] { display: none !important }
::selection { background: var(--pink); color: var(--night) }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation }
button:focus-visible { outline: 2px solid var(--white); outline-offset: 4px }
.universe {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: auto minmax(420px, 1fr) auto / minmax(0, 1fr);
  min-height: 100svh;
  overflow: clip;
  background: #080513;
}
.nebula, canvas, .flash, .journey { position: absolute; inset: 0; width: 100%; height: 100% }
.nebula {
  z-index: -3;
  background: radial-gradient(ellipse at center, #0a05121a 20%, #080412a0 90%), url("nebulosa.webp") center / cover;
  transform: scale(1.12) translate(var(--drift-x, 0), var(--drift-y, 0));
  opacity: .8;
}
canvas { z-index: -2; pointer-events: none }
.flash {
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 56%, #fff6ec, #dc9cf1 8%, #8664ff40 34%, transparent 68%);
  opacity: 0;
}
.top, .bottom {
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-inline: max(clamp(12px, 3.6vw, 56px), env(safe-area-inset-left)) max(clamp(12px, 3.6vw, 56px), env(safe-area-inset-right));
}
.top { grid-row: 1; padding-top: max(clamp(14px, 4vh, 34px), env(safe-area-inset-top)) }
.bottom { grid-row: 3; padding-bottom: max(clamp(14px, 4vh, 34px), env(safe-area-inset-bottom)) }
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: italic clamp(1rem, 2.2vw, 1.45rem)/1 var(--display);
  white-space: nowrap;
  text-shadow: 0 2px 15px #090412;
}
.wordmark svg { width: 14px; height: 14px; fill: var(--pink); filter: drop-shadow(0 0 9px #edb6ff) }
.controls { display: flex; gap: 8px }
.quiet, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border-radius: 99px;
  border: 1px solid var(--line);
  padding: .62rem .96rem;
  background: #110920d9;
  white-space: nowrap;
  font-size: .9rem;
  transition: color .2s, background-color .2s, border-color .2s, transform .2s;
}
.quiet svg, .primary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.quiet:hover, .quiet[aria-pressed="true"] { border-color: #ffd0efb0; background: #301c41 }
.primary {
  background: #ffd8ec;
  color: #2c1338;
  border-color: #fff0f8;
  box-shadow: 0 6px 26px #e499e753;
  font-weight: 650;
}
.primary:hover { transform: translateY(-2px); background: #fff3fb }
.intro {
  position: relative;
  grid-row: 2;
  display: grid;
  place-items: center;
  padding: 6vh 16px 10vh;
  min-width: 0;
}
.intro-copy {
  z-index: 2;
  position: relative;
  text-align: center;
  padding: 40px 8px;
}
.intro-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -9% -16%;
  background: radial-gradient(ellipse closest-side, #090413eb 0%, #0c051795 55%, transparent);
}
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: -.035em; text-wrap: balance }
h1 { margin: 0; font-size: clamp(3.5rem, 8.9vw, 8rem); line-height: .88; text-shadow: 0 3px 26px #1c0725 }
h1 em { color: #ffd1e6; font-weight: 400 }
.intro-copy p {
  margin: 1.4rem 0 1.85rem;
  color: var(--muted);
  font-size: clamp(.98rem, 2vw, 1.24rem);
  line-height: 1.45;
  text-shadow: 0 2px 14px #090414;
}
.intro-copy .primary { padding: .83rem 1.16rem .83rem 1.32rem }
.intro-photos { position: absolute; inset: 0; pointer-events: none }
.intro-photo {
  position: absolute;
  width: clamp(82px, 15vw, 200px);
  aspect-ratio: .82;
  object-fit: cover;
  border: 1px solid #efc9ffaa;
  border-radius: 6px;
  box-shadow: 0 17px 42px #0c061a9e;
  filter: saturate(.78) brightness(.79);
  transform: translate(-50%,-50%) rotate(var(--tilt));
}
.intro-photo:nth-child(1) { top: 32%; left: 16%; --tilt: -13deg }
.intro-photo:nth-child(2) { top: 69%; left: 25%; --tilt: 10deg; width: clamp(65px, 11vw, 151px) }
.intro-photo:nth-child(3) { top: 27%; left: 82%; --tilt: 12deg; width: clamp(65px, 11vw, 151px) }
.intro-photo:nth-child(4) { top: 66%; left: 85%; --tilt: -9deg }
.journey { pointer-events: none }
.love {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 35%;
  margin: 0;
  transform: translate(-50%, -50%);
  font-style: italic;
  font-size: clamp(3.15rem, 9vw, 7rem);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 3px 17px #391136, 0 0 44px #ffb1ebbb;
}
.love:focus, .journey:focus { outline: none }
.orbit { position: absolute; inset: 0 }
.memory {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--white);
  text-shadow: 0 2px 9px #04020c, 0 1px 4px #04020c;
}
.tile {
  width: clamp(48px, 7.1vw, 104px);
  aspect-ratio: .89;
  display: block;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid #ffdcf3c2;
  background: #221034;
  box-shadow: 0 4px 15px #070313aa;
  transform: rotate(var(--tilt));
  transition: transform .25s, border-color .25s;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover }
.memory:hover .tile, .memory:focus-visible .tile { transform: rotate(0deg) scale(1.1); border-color: #fff }
.memory-name { font-size: clamp(.67rem, 1.15vw, .88rem); line-height: 1.2; white-space: nowrap }
.hint {
  margin: 0;
  text-align: center;
  font: italic clamp(.88rem, 1.65vw, 1.14rem)/1.22 var(--display);
  color: var(--muted);
  text-shadow: 0 1px 10px #05030a, 0 1px 4px #05030a;
}
dialog {
  width: min(850px, calc(100% - 24px));
  max-height: 91svh;
  padding: clamp(15px, 3.1vw, 34px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #140d23;
  color: var(--white);
  box-shadow: 0 16px 52px #05020cb0;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #06030dda; backdrop-filter: blur(7px) }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 14px }
.dialog-top h2 { margin: 0; font-size: clamp(2rem, 5.7vw, 3.65rem); line-height: 1.02 }
.viewer {
  position: relative;
  display: grid;
  place-items: center;
  margin: 16px 0 11px;
  overflow: hidden;
  border-radius: 10px;
  background: #090611;
  height: min(57svh, 540px);
}
.viewer img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain }
.viewer button { position: absolute; top: 50%; transform: translateY(-50%); font-size: 1.8rem; padding: 0; min-width: 44px }
.previous { left: 8px }
.next { right: 8px }
.viewer figcaption {
  position: absolute;
  bottom: 8px;
  border-radius: 99px;
  background: #0e081be8;
  color: var(--muted);
  padding: 5px 12px;
  font-size: .77rem;
  font-variant-numeric: tabular-nums;
}
.film { display: flex; gap: 8px; overflow-x: auto; padding: 7px 7px 12px; scrollbar-color: #7a597f #130c22 }
.film button { border: 1px solid var(--line); background: #090611; border-radius: 5px; padding: 0; flex: 0 0 52px; overflow: hidden }
.film button[aria-current="true"] { border: 2px solid #ffd0ef }
.film img { width: 100%; height: 56px; object-fit: cover; display: block }
#note { width: min(610px, calc(100% - 24px)); background: radial-gradient(ellipse at 96% 0, #4b234e, transparent 55%), #21122e }
#note p { font-size: clamp(1.03rem, 2.5vw, 1.16rem); color: var(--muted); line-height: 1.65 }
#note .signature { font: italic 1.5rem/1.3 var(--display); color: var(--pink) }
@media (max-width: 760px) {
  .top, .bottom { gap: 7px }
  .bottom { display: grid; grid-template-columns: auto auto; justify-content: space-between }
  .hint { grid-row: 1; grid-column: 1/-1; margin-bottom: 3px }
  .quiet, .primary { font-size: .81rem; padding-inline: .7rem; gap: 6px }
  .intro-photo:nth-child(1) { left: 19%; top: 17% }
  .intro-photo:nth-child(2) { left: 16%; top: 76% }
  .intro-photo:nth-child(3) { left: 83%; top: 16% }
  .intro-photo:nth-child(4) { left: 79%; top: 82% }
  .intro-copy { padding-block: 54px }
  .intro-copy::before { inset: 1% -4% }
  h1 em { display: block; margin-top: .07em }
}
@media (max-width: 360px) {
  .wordmark { gap: 5px }
  .controls { gap: 4px }
  .controls button { padding-inline: .52rem }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important }
}
/* La escena recibe los gestos. Los controles HTML quedan por encima. */
.universe.is-active canvas { z-index: 0; pointer-events: auto; touch-action: none; cursor: grab }
.universe.is-active canvas:active { cursor: grabbing }
.journey { z-index: 1 }
.is-active .nebula { opacity: .92 }
.love { font-size: clamp(1.9rem, 5vw, 4.8rem) }
.universe.is-active canvas.over-memory { cursor: zoom-in }
canvas:focus-visible { outline: 2px solid #ffd0ef; outline-offset: -4px }
#album[open] { animation: album-in .24s ease-out }
@keyframes album-in {
  from { opacity: 0; transform: translateY(8px) scale(.985) }
  to { opacity: 1; transform: translateY(0) scale(1) }
}
@media (max-width: 560px) {
  .top { flex-wrap: wrap }
  .controls { margin-left: auto }
  #tour, #motion, #sound { padding-inline: .57rem }
}
@media (prefers-reduced-motion: reduce) {
  #album[open] { animation: none }
}
