*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: #f3e6c8; overflow: hidden; }
body { font-family: "Cormorant Garamond", Georgia, serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- The film (always underneath) ---------- */
.scene { position: fixed; inset: 0; background: #000; }
.film { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }

/* ---------- The black veil with the quote ---------- */
.veil {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6vh 7vw; background: #000;
  --r: 0px; --f: 140px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--r) - var(--f)), #000 var(--r));
          mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--r) - var(--f)), #000 var(--r));
}
.veil.gone { display: none; }

/* A thin golden light running round the opening edge, like the sun catching the water. */
.ring {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-radius: 50%; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, transparent 0, transparent 62%, rgba(255, 214, 140, 0.0) 64%,
    rgba(255, 220, 150, 0.55) 69%, rgba(255, 236, 190, 0.25) 71%, transparent 74%);
  mix-blend-mode: screen; filter: blur(3px);
}

.quote { margin: 0; text-align: center; max-width: 62rem; transition: opacity 0.6s ease, transform 0.9s ease; }
.veil.opening .quote, .veil.opening .enter { opacity: 0; transform: scale(1.04); }
.line {
  margin: 0; font-family: "Pinyon Script", "Cormorant Garamond", cursive; font-weight: 400;
  font-size: clamp(1.75rem, 4.3vw, 3.4rem); line-height: 1.45; color: #ead7a6;
  text-shadow: 0 0 18px rgba(234, 190, 110, 0.18);
  text-wrap: balance; /* on narrow screens the long line breaks into two even halves */
}
.author {
  margin-top: 1.4em; font-family: "Pinyon Script", "Cormorant Garamond", cursive;
  font-size: clamp(1.25rem, 2.6vw, 2rem); color: #c9b384;
}

/* Words are written one after another, each revealed left to right as if by a pen.
   The padding gives the swashes room so the mask never clips them. */
.w {
  display: inline-block; padding: 0.3em 0.14em; margin: -0.3em -0.14em; white-space: nowrap;
  --p: -12%;
  -webkit-mask-image: linear-gradient(90deg, #000 var(--p), transparent calc(var(--p) + 10%));
          mask-image: linear-gradient(90deg, #000 var(--p), transparent calc(var(--p) + 10%));
}
.w.done { -webkit-mask-image: none; mask-image: none; }

/* ---------- ENTER (stand-in plaque until the owner's artwork arrives) ---------- */
.enter {
  position: relative; margin-top: 8vh; padding: 0.85em 3.4em; cursor: pointer;
  background: transparent; border: 1px solid rgba(226, 196, 132, 0.75); border-radius: 3px;
  box-shadow: inset 0 0 0 4px #000, inset 0 0 0 5px rgba(226, 196, 132, 0.45);
  color: #ead7a6; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600;
  font-size: clamp(0.95rem, 1.7vw, 1.2rem); letter-spacing: 0.46em; text-indent: 0.46em;
  opacity: 0; transform: translateY(10px); transition: opacity 1.1s ease, transform 1.1s ease, box-shadow 0.4s ease, color 0.4s ease;
}
.enter::before, .enter::after {
  position: absolute; top: 50%; font-size: 1.3em; color: rgba(226, 196, 132, 0.8); letter-spacing: 0; text-indent: 0;
}
.enter::before { content: "\2766"; left: -1.6em; transform: translateY(-50%) scaleX(-1); }
.enter::after { content: "\2766"; right: -1.6em; transform: translateY(-50%); }
.enter.show { opacity: 1; transform: none; }
.enter:hover, .enter:focus-visible {
  outline: none; color: #fff3d6;
  box-shadow: inset 0 0 0 4px #000, inset 0 0 0 5px rgba(240, 214, 150, 0.8), 0 0 22px rgba(240, 200, 120, 0.25);
}
.enter:disabled { cursor: default; }
/* When the owner's plaque arrives: <img class="enter-art"> inside the button replaces the frame. */
.enter.has-art { padding: 0; border: 0; box-shadow: none; }
.enter.has-art::before, .enter.has-art::after { content: none; }
.enter-art { display: block; width: clamp(220px, 30vw, 360px); height: auto; }
.enter.has-art { transition: opacity 1.1s ease, transform 1.1s ease, filter 0.35s ease; }
.enter.has-art:hover, .enter.has-art:focus-visible { outline: none; transform: scale(1.03);
  filter: drop-shadow(0 0 14px rgba(255, 205, 130, 0.38)); }

/* ---------- Sound toggle (the owner's gold medallions) ---------- */
.sound {
  position: fixed; z-index: 6; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  width: 52px; height: 52px; padding: 0; border: 0; background: transparent; cursor: pointer;
  opacity: 0; transition: opacity 1s ease, transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}
.sound img { display: block; width: 100%; height: 100%; }
.sound.show { opacity: 1; }
.sound:hover, .sound:focus-visible { outline: none; transform: scale(1.06);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(255, 205, 130, 0.45)); }

@media (prefers-reduced-motion: reduce) {
  .w { -webkit-mask-image: none; mask-image: none; }
  .enter, .quote { transition: none; }
}
