:root {
  --paper: #f3efe6;
  --paper-deep: #e7e0d4;
  --ink: #221e1a;
  --muted: #6f675e;
  --line: #ddd4c6;
  --night: #12110f;
  --ivory: #f4f0e7;
  --fade: 1100ms;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", Candara, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--serif);
}

button, input, a {
  font: inherit;
}

button, a#download {
  touch-action: manipulation;
  cursor: pointer;
}

#app {
  height: 100%;
}

#stage {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--fade) ease;
  pointer-events: none;
}

.layer.is-on { opacity: 1; }

.wash {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(28px) brightness(0.38) saturate(0.82);
}

.fit {
  position: absolute;
  inset: 4.5vh 4vw 16vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

#album {
  position: fixed;
  z-index: 4;
  top: 1.35vh;
  left: 4.5vw;
  margin: 0;
  max-width: 70vw;
  font-size: clamp(16px, 1.55vw, 26px);
  letter-spacing: 0.06em;
  color: rgba(244, 240, 231, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

#album[hidden] { display: none; }

.cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12vh;
  text-align: center;
  font-style: italic;
  font-size: clamp(18px, 2vw, 32px);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
  padding: 0 8vw;
}

.title-card,
.chapter-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6vh 8vw 18vh;
}

.oval {
  height: min(46vh, 420px);
  width: calc(min(46vh, 420px) * 0.78);
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 8px rgba(244, 240, 231, 0.92),
    0 22px 60px rgba(0, 0, 0, 0.45);
  margin-bottom: 28px;
  flex: none;
}

.oval img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 16%;
}

.title-name {
  font-weight: normal;
  font-size: clamp(26px, 3.1vw, 58px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-indent: 0.14em;
  margin: 0;
}

.title-dates {
  font-style: italic;
  font-size: clamp(18px, 1.7vw, 30px);
  letter-spacing: 0.03em;
  margin: 14px 0 0;
  color: rgba(244, 240, 231, 0.88);
}

.chapter-kicker {
  margin: 0 0 18px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-indent: 0.28em;
  font-size: clamp(12px, 1.1vw, 16px);
  font-family: var(--sans);
  color: rgba(244, 240, 231, 0.72);
}

.chapter-rule {
  width: 52px;
  height: 1px;
  background: rgba(244, 240, 231, 0.55);
  margin-bottom: 22px;
}

.chapter-card h2 {
  font-weight: normal;
  font-size: clamp(36px, 5.4vw, 84px);
  margin: 0;
}

.bar {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62) 28%);
}

.bar button,
.bar a {
  border: 0;
  background: var(--ivory);
  color: var(--night);
  font-family: var(--sans);
  font-size: 15px;
  text-decoration: none;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.bar button[hidden],
.bar a[hidden] { display: none; }

.download { position: relative; }

.download-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

.download-menu[hidden] { display: none; }

.download-menu a { display: block; text-align: center; }

.play-wrap {
  position: relative;
  display: inline-flex;
}

.play-hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  width: 36px;
  height: 36px;
  color: var(--ivory);
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  animation: play-float 1.5s ease-in-out infinite;
}

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

.play-hint svg {
  display: block;
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes play-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

#play {
  min-width: 112px;
  font-size: 18px;
}

#gallery {
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

#gallery[hidden] { display: none; }

.gallery-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 22px 8px;
  background: rgba(243, 239, 230, 0.96);
}

.gallery-head h2 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: 28px;
  letter-spacing: 0.04em;
  margin: 0;
}

.gallery-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
}

.gallery-head button,
.chapters button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
}

.gallery-head button {
  background: var(--ink);
  color: var(--paper);
}

.chapters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 18px 4px;
  position: sticky;
  top: 78px;
  z-index: 2;
  background: rgba(243, 239, 230, 0.96);
}

.chapters button:hover,
.chapters button[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
}

.section { padding: 8px 18px 18px; }

.section h3 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: 24px;
  margin: 12px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.frame {
  position: relative;
  aspect-ratio: 1;
  background: var(--paper-deep);
  overflow: hidden;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

.card.is-current .frame {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.card .caption {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
  min-height: 1.3em;
}

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 7px;
}

.title-mini img {
  width: 62%;
  height: 82%;
  margin: 9% auto;
  object-fit: cover;
  object-position: 58% 18%;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(244, 240, 231, 0.9);
}

#gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--night);
}

#gate[hidden] { display: none; }

.gate-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate {
  width: min(420px, calc(100% - 36px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  text-align: center;
}

.gate h1 {
  font-weight: normal;
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-indent: 0.12em;
  margin: 0 0 12px;
}

.gate label {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 240, 231, 0.72);
}

.gate input {
  border: 0;
  border-radius: 999px;
  background: var(--ivory);
  color: var(--night);
  font-family: var(--sans);
  font-size: 18px;
  text-align: center;
  padding: 12px 16px;
  min-height: 48px;
}

.gate button {
  border: 0;
  border-radius: 999px;
  background: var(--ivory);
  color: var(--night);
  font-family: var(--sans);
  font-size: 16px;
  padding: 12px 16px;
  min-height: 48px;
  cursor: pointer;
}

.gate-error {
  margin: 0;
  font-family: var(--sans);
  color: #f0c7b8;
}

@media (max-width: 720px) {
  .fit { inset: 7vh 3vw 24vh; }
  .cap { bottom: 20vh; }
  .title-card, .chapter-card { padding-bottom: 26vh; }
  .oval { height: min(36vh, 280px); width: calc(min(36vh, 280px) * 0.78); }
  .chapters { top: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .layer { transition: none; }
  .play-hint { animation: none; }
}
