/* Coronation cover. The crayon page stays underneath; this layer is
   transparent until the aria reaches the name. */
.throne {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
  background: transparent;
  color: transparent;
  pointer-events: none;
}

.throne.is-live,
.throne.is-crowned { pointer-events: auto; }

.throne-dim,
.throne-photo,
.throne-shade,
.throne-vignette,
.throne-light,
.throne-dust,
.throne-name,
.throne-curtain,
.throne-seam {
  position: absolute;
  inset: 0;
}

.throne-dim {
  background: #14080b;
  opacity: calc(var(--dim, 0) * 0.34);
  z-index: 0;
}

.throne-photo {
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  opacity: var(--photo, 0);
  transform: scale(calc(1.04 - 0.04 * var(--settle, 0)));
  transform-origin: 50% 28%;
}

.throne-shade {
  z-index: 2;
  background: #14080b;
  opacity: calc((1 - var(--settle, 0)) * var(--photo, 0));
  pointer-events: none;
}

.throne-vignette {
  z-index: 3;
  pointer-events: none;
  opacity: var(--photo, 0);
  background:
    radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(20, 8, 11, 0.55) 100%),
    linear-gradient(180deg, rgba(20, 8, 11, 0.28), transparent 16%, transparent 62%, rgba(20, 8, 11, 0.78));
}

.throne-light {
  z-index: 4;
  pointer-events: none;
  opacity: var(--light, 0);
  background:
    linear-gradient(180deg, rgba(255, 220, 150, 0.5), rgba(255, 196, 120, 0.14) 24%, transparent 50%),
    radial-gradient(ellipse 28% 42% at 50% 0%, rgba(255, 228, 170, 0.55), transparent 70%);
}

.throne-dust {
  z-index: 5;
  pointer-events: none;
  opacity: var(--dust, 0);
}

.throne-dust i {
  position: absolute;
  top: -6%;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d4 0%, #e4c56a 42%, transparent 72%);
  animation: throne-dust var(--dur) linear var(--delay) infinite;
}

@keyframes throne-dust {
  to { transform: translate3d(0, 108vh, 0); }
}

.throne-name {
  z-index: 6;
  inset: auto 0 calc(7vh + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.08em;
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PMingLiU", serif;
  font-size: clamp(64px, 10vw, 132px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  pointer-events: none;
}

.throne-rule {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.18em);
  width: min(42vw, 280px);
  height: 1px;
  transform: translateX(-50%) scaleX(var(--rule, 0));
  background: linear-gradient(90deg, transparent, #e6d19a, #8c6a32, #f3e2b0, transparent);
  opacity: 0.9;
}

.throne-name span:not(.throne-rule) {
  display: inline-block;
  background-image: linear-gradient(
    108deg,
    #4e1016 0%,
    #7c1c28 16%,
    #f8ecc4 40%,
    #e1c27a 47%,
    #6a1520 58%,
    #c6a15e 74%,
    #3f0c12 100%
  );
  background-size: 240% 100%;
  background-position: var(--foil, 120%) 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 0 rgba(42, 8, 12, 0.45);
  opacity: var(--ink, 0);
  transform: translate3d(0, calc((1 - var(--ink, 0)) * 22px), 0) scale(calc(0.96 + 0.04 * var(--ink, 0)));
}

.throne-curtain {
  z-index: 7;
  width: 58vw;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 236, 196, 0.05) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, #2a090e, #6a1824 22%, #431018 55%, #1c0609);
  box-shadow: inset -12px 0 18px rgba(212, 175, 110, 0.28), inset 0 0 50px rgba(0, 0, 0, 0.35);
}

.throne-curtain.left {
  right: auto;
  transform: translate3d(calc((var(--c, 0) - 1) * 105%), 0, 0);
}

.throne-curtain.right {
  left: auto;
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 236, 196, 0.05) 7px 8px),
    linear-gradient(270deg, #2a090e, #6a1824 22%, #431018 55%, #1c0609);
  box-shadow: inset 12px 0 18px rgba(212, 175, 110, 0.28), inset 0 0 50px rgba(0, 0, 0, 0.35);
  transform: translate3d(calc((1 - var(--c, 0)) * 105%), 0, 0);
}

.throne-seam {
  z-index: 8;
  left: 50%;
  right: auto;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(#f6e7bc, #a67c3a 40%, #f3e2b0 60%, #6e5424);
  box-shadow: 0 0 18px rgba(240, 210, 140, 0.85);
  opacity: var(--seam, 0);
  pointer-events: none;
}

body.throne-on { overflow: hidden; background: #14080b; }

.throne.is-crowned {
  --c: 0.18;
  --photo: 1;
  --settle: 1;
  --dust: 0;
  --light: 0;
  --seam: 0;
  --dim: 1;
  --rule: 1;
  background: #14080b;
}

.throne.is-crowned .throne-name span:not(.throne-rule) {
  --ink: 1;
  --foil: 38%;
}

.throne.is-quiet .throne-curtain,
.throne.is-quiet .throne-dust,
.throne.is-quiet .throne-light,
.throne.is-quiet .throne-seam { display: none; }

.throne.is-quiet.is-crowned .throne-photo,
.throne.is-quiet.is-crowned .throne-vignette,
.throne.is-quiet.is-crowned .throne-name span {
  transition: opacity 0.4s ease;
}

@media (max-width: 720px) {
  .throne-name {
    font-size: clamp(56px, 16vw, 88px);
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    bottom: calc(5vh + env(safe-area-inset-bottom));
  }
  .throne-photo { object-position: 50% 18%; }
}

@media (prefers-reduced-motion: reduce) {
  .throne-dust i { animation: none; }
}
