:root {
  --ink: #ecebf5;
  --ink-dim: rgba(236, 235, 245, 0.62);
  --glow: rgba(190, 180, 255, 0.55);
  --fade: 1.4s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05060f;
  color: var(--ink);
  overflow: hidden;
}

body {
  font-family: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- backgrounds ---------- */

#scenes, #scenes canvas, .veil {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#scenes canvas {
  opacity: 0;
  transition: opacity var(--fade) ease;
}
#scenes canvas.on { opacity: 1; }

/* soft vignette so the words always stay readable */
.veil {
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(3, 4, 12, 0.42), rgba(3, 4, 12, 0) 70%),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* extra shade behind the words on the brighter scenes */
.veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 50% at 50% 48%, rgba(10, 10, 30, 0.5), rgba(10, 10, 30, 0) 75%);
  opacity: 0;
  transition: opacity var(--fade) ease;
}
body[data-scene="morning"] .veil::after,
body[data-scene="noon"] .veil::after,
body[data-scene="sky"] .veil::after { opacity: 1; }

/* ---------- lyrics ---------- */

.lyrics {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 1.5rem 6rem;
  text-align: center;
}

.eyebrow {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-size: 0.95rem;
  color: var(--ink-dim);
  margin: 0 0 2.6rem;
  opacity: 0;
  animation: rise 2.4s 0.2s ease forwards;
}

.line {
  margin: 0.35em 0;
  font-size: clamp(1.35rem, 3.6vw, 2.3rem);
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  line-height: 1.6;
  text-shadow: 0 0 18px rgba(5, 6, 20, 0.9), 0 0 2px rgba(5, 6, 20, 0.8);
  opacity: 0;
  animation: rise 2.2s ease forwards;
}
.line:nth-of-type(2) { animation-delay: 0.5s; }
.line:nth-of-type(3) { animation-delay: 0.9s; }
.line:nth-of-type(4) { animation-delay: 1.3s; }
.line:nth-of-type(5) { animation-delay: 1.7s; }
.line:nth-of-type(6) { animation-delay: 2.1s; }
.line:nth-of-type(7) { animation-delay: 2.6s; }

.line.en {
  margin-top: 1.4em;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-indent: 0;
  font-size: clamp(1.3rem, 3.2vw, 2.1rem);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ---------- links ---------- */

.lyrics a {
  color: inherit;
  text-decoration: none;
  position: relative;
  padding: 0 0.08em;
  margin: 0 0.12em;
  transition: color 0.6s ease, text-shadow 0.6s ease, opacity 0.8s ease;
}

/* a thin line of light under each word */
.lyrics a::after {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 0.05em;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220, 215, 255, 0.9), transparent);
  opacity: 0.45;
  transition: left 0.6s ease, right 0.6s ease, opacity 0.6s ease;
}
.lyrics a:hover::after,
.lyrics a:focus-visible::after { left: 0; right: 0; opacity: 1; }

.lyrics a:hover,
.lyrics a:focus-visible {
  color: #fff;
  text-shadow: 0 0 14px var(--glow), 0 0 32px var(--glow), 0 0 2px #000;
  outline: none;
}

/* while one word is chosen, the rest of the song steps back */
body.hovering .line { color: rgba(236, 235, 245, 0.55); transition: color 0.8s ease; }
body.hovering .lyrics a:hover,
body.hovering .lyrics a:focus-visible { color: #fff; }
.line { transition: color 0.8s ease; }

/* ---------- caption & footer ---------- */

.caption {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 3.2rem;
  margin: 0;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  pointer-events: none;
}
.caption span { transition: opacity 0.6s ease; }
.caption span.hidden { opacity: 0; }

footer {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 1rem;
  padding: 0 1rem;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: rgba(236, 235, 245, 0.35);
}

@media (max-height: 560px) {
  .caption { display: none; }
  footer { position: static; padding-bottom: 1rem; }
  html, body { overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .eyebrow, .line { animation: none; opacity: 1; }
  #scenes canvas { transition-duration: 0.3s; }
}
