:root {
  --wine: #5c252d;
  --deep-wine: #281316;
  --rose: #9b5d65;
  --cream: #f6eee8;
  --muted: #cbb9b7;
  --dark: #100d0e;
  --glass: rgba(16, 13, 14, 0.55);
  --line: rgba(246, 238, 232, 0.16);

  /* Swap the landing photograph here. */
  --photo: url("assets/background.jpg");

  --serif: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --pad-x: clamp(1.15rem, 5.4vw, 1.55rem);
  --safe-top: max(8vh, calc(env(safe-area-inset-top, 0px) + 0.75rem));
  --safe-bottom: max(10vh, calc(env(safe-area-inset-bottom, 0px) + 1.25rem));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--dark);
  color: var(--cream);
  font-family: var(--sans);
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
a {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
}

.page-bg {
  display: none;
}

.canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.photo {
  position: absolute;
  inset: -4%;
  background-image: var(--photo);
  background-size: cover;
  background-repeat: no-repeat;
  /* Keep Marta’s face in frame. Try 50% 36% or 50% 44% if the crop feels off. */
  background-position: 50% 40%;
  animation: memoryZoom 22s ease-out forwards;
  transform: scale(1);
  will-change: transform;
}

.grade,
.vignette,
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grade {
  background:
    radial-gradient(ellipse 70% 48% at 72% 24%, rgba(155, 93, 101, 0.16), transparent 58%),
    linear-gradient(
      180deg,
      rgba(40, 19, 22, 0.28) 0%,
      rgba(40, 19, 22, 0.04) 18%,
      rgba(92, 37, 45, 0.06) 42%,
      rgba(40, 19, 22, 0.38) 64%,
      rgba(16, 13, 14, 0.78) 86%,
      rgba(16, 13, 14, 0.9) 100%
    );
}

.vignette {
  background: radial-gradient(ellipse at center, transparent 42%, rgba(16, 13, 14, 0.52) 100%);
}

.grain {
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

.sound-toggle {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  right: max(0.85rem, calc(env(safe-area-inset-right, 0px) + 0.7rem));
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: rgba(16, 13, 14, 0.32);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cream);
}

.sound-toggle[hidden] {
  display: none;
}

.sound-toggle .icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.sound-toggle .icon-on,
.sound-toggle.is-on .icon-off {
  display: none;
}

.sound-toggle.is-on .icon-on,
.sound-toggle .icon-off {
  display: block;
}

.stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  width: 100%;
  padding: var(--safe-top) var(--pad-x) 1rem;
  text-align: center;
}

.play-prompt {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  padding: 0.55rem 0.95rem 0.55rem 0.7rem;
  border-radius: 999px;
  background: rgba(16, 13, 14, 0.38);
  border: 1px solid rgba(246, 238, 232, 0.22);
  color: var(--cream);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.play-prompt[hidden] {
  display: none;
}

.play-prompt-icon {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--deep-wine);
}

.play-prompt-icon svg {
  width: 0.7rem;
  height: 0.7rem;
  margin-left: 0.08rem;
  fill: currentColor;
}

.artist {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: var(--cream);
}

.track {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.track cite {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 4.4vw, 1.32rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.headline {
  margin: 0 auto 1.15rem;
  max-width: 22ch;
  font-family: var(--serif);
  font-size: clamp(1.42rem, 1.05rem + 2.6vw, 1.9rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--cream);
  text-wrap: balance;
}

.cta-wrap {
  width: 100%;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  height: clamp(56px, 7.2vh, 64px);
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--deep-wine);
  font-size: clamp(0.92rem, 3.7vw, 1.02rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 0 28px rgba(246, 238, 232, 0.18);
  animation: heartbeat 2.8s ease-in-out infinite;
  will-change: transform;
}

.cta:hover {
  background: #fffaf6;
}

.cta:active {
  transform: scale(0.985);
}

.eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 14px;
  margin-top: 0.85rem;
  opacity: 0.55;
}

.eq span {
  width: 2px;
  height: 5px;
  border-radius: 999px;
  background: var(--muted);
  transform-origin: center bottom;
}

.canvas.is-playing .eq span {
  animation: eq 1.1s ease-in-out infinite;
}

.canvas.is-playing .eq span:nth-child(2) {
  animation-duration: 0.9s;
  animation-delay: -0.2s;
}

.canvas.is-playing .eq span:nth-child(3) {
  animation-duration: 1.25s;
  animation-delay: -0.4s;
}

.canvas.is-playing .eq span:nth-child(4) {
  animation-duration: 0.8s;
  animation-delay: -0.1s;
}

.canvas.is-playing .eq span:nth-child(5) {
  animation-duration: 1.05s;
  animation-delay: -0.35s;
}

.cookie-link {
  margin-top: 0.7rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.48;
}

.cookie-link:hover,
.cookie-link:focus-visible {
  opacity: 0.9;
}

.canvas.has-banner .cookie-link {
  display: none;
}

.canvas:not(.has-banner) .stack {
  padding-bottom: var(--safe-bottom);
}

.cookie-banner {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
  padding: 0.75rem var(--pad-x) calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 13, 14, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
}

.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rose);
}

.cookie-banner-text {
  margin: 0 0 0.65rem;
  max-width: 36em;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.cookie-actions {
  display: flex;
  gap: 0.4rem;
}

.btn {
  flex: 1 1 0;
  min-height: 40px;
  padding: 0.45rem 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn-accept,
.btn-save {
  background: var(--cream);
  color: var(--deep-wine);
}

.btn-reject,
.btn-settings {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--line);
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(16, 13, 14, 0.46);
}

.sheet-backdrop[hidden],
.sheet[hidden] {
  display: none;
}

.sheet {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem var(--pad-x) calc(1.1rem + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: rgba(24, 16, 18, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.35);
}

.sheet-handle {
  width: 2.4rem;
  height: 0.28rem;
  margin: 0 auto 0.85rem;
  border-radius: 999px;
  background: rgba(246, 238, 232, 0.28);
}

.sheet h2 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.sheet-lead {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.pref-name {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.pref-desc {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
}

.switch {
  flex-shrink: 0;
  width: 2.7rem;
  height: 1.55rem;
  border-radius: 999px;
  background: rgba(246, 238, 232, 0.18);
  position: relative;
}

.switch::after {
  content: "";
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 1.22rem;
  height: 1.22rem;
  border-radius: 999px;
  background: var(--cream);
}

.switch[aria-checked="true"] {
  background: var(--rose);
}

.switch[aria-checked="true"]::after {
  left: auto;
  right: 0.16rem;
}

.switch:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-save {
  width: 100%;
  flex: none;
  margin-top: 0.85rem;
  min-height: 48px;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(8px);
  animation: reveal 0.58s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes memoryZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.03);
  }
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.025);
  }
}

@keyframes eq {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 13px;
  }
}

@media (min-width: 720px) {
  .page-bg {
    display: block;
    position: absolute;
    inset: -8%;
    background-image: var(--photo);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 50% 40%;
    filter: blur(32px) saturate(0.8) brightness(0.32);
    transform: scale(1.08);
  }

  .canvas {
    --frame-h: min(calc(100dvh - 40px), 852px);
    --frame-w: min(460px, calc(var(--frame-h) * 9 / 16));
    width: var(--frame-w);
    height: calc(var(--frame-w) * 16 / 9);
    min-height: 0;
    max-height: calc(100dvh - 40px);
    border-radius: 22px;
    box-shadow:
      0 24px 80px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(246, 238, 232, 0.08);
  }

  .headline {
    font-size: clamp(1.5rem, 4.6vw, 1.85rem);
  }
}

@media (max-width: 370px) {
  .headline {
    font-size: clamp(1.28rem, 6.4vw, 1.5rem);
  }

  .cta {
    font-size: 0.88rem;
  }

  .btn {
    font-size: 0.68rem;
  }
}

@media (max-height: 740px) {
  .cookie-banner-kicker {
    display: none;
  }

  .headline {
    margin-bottom: 0.85rem;
    font-size: clamp(1.22rem, 5.6vw, 1.5rem);
  }

  .track {
    margin-bottom: 0.55rem;
  }

  .cta {
    min-height: 52px;
    height: 52px;
  }

  .eq {
    display: none;
  }

  .play-prompt {
    margin-bottom: 0.7rem;
  }

  .cookie-banner-text {
    font-size: 0.68rem;
  }
}

@media (max-height: 680px) {
  .artist {
    letter-spacing: 0.36em;
  }

  .cookie-link {
    margin-top: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo,
  .reveal,
  .cta,
  .eq span {
    animation: none !important;
    transition: none !important;
  }

  .photo {
    transform: none;
    will-change: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
