:root {
  color-scheme: dark;
  --bg: #090a0d;
  --bg-strong: #0f1117;
  --panel: rgba(17, 19, 26, 0.72);
  --panel-strong: rgba(14, 16, 22, 0.9);
  --text: #f6f1e6;
  --muted: #b9b1a4;
  --line: rgba(246, 241, 230, 0.12);
  --red: #ff4832;
  --gold: #ffd465;
  --blue: #5e86ff;
  --green: #4dc28b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --content-width: min(1120px, calc(100vw - 1.5rem));
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f7f5f0;
    --bg-strong: #ffffff;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-strong: rgba(255, 255, 255, 0.9);
    --text: #121317;
    --muted: #625d55;
    --line: rgba(18, 19, 23, 0.1);
    --shadow: 0 24px 70px rgba(38, 33, 24, 0.12);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a0d;
  --bg-strong: #0f1117;
  --panel: rgba(17, 19, 26, 0.72);
  --panel-strong: rgba(14, 16, 22, 0.9);
  --text: #f6f1e6;
  --muted: #b9b1a4;
  --line: rgba(246, 241, 230, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f0;
  --bg-strong: #ffffff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --text: #121317;
  --muted: #625d55;
  --line: rgba(18, 19, 23, 0.1);
  --shadow: 0 24px 70px rgba(38, 33, 24, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 72, 50, 0.08), transparent 24%),
    radial-gradient(circle at 78% 14%, rgba(94, 134, 255, 0.1), transparent 22%),
    radial-gradient(circle at 52% 84%, rgba(255, 212, 101, 0.08), transparent 20%),
    var(--bg);
  color: var(--text);
  font-family: "Sora", sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

body.is-gallery {
  overflow: auto;
}

body.lightbox-open {
  overflow: hidden;
}

a,
button {
  font: inherit;
}

button {
  border: 0;
}

.background-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.18;
  z-index: -1;
  transition: transform 900ms ease, opacity 900ms ease;
}

.background-glow--one {
  top: 8vh;
  left: 8vw;
  width: 14rem;
  height: 14rem;
  background: rgba(255, 72, 50, 0.35);
}

.background-glow--two {
  right: 8vw;
  bottom: 10vh;
  width: 18rem;
  height: 18rem;
  background: rgba(94, 134, 255, 0.24);
}

.background-glow--three {
  left: 42vw;
  top: 42vh;
  width: 10rem;
  height: 10rem;
  background: rgba(255, 212, 101, 0.26);
}

body.is-ceremony-live .background-glow--one {
  transform: translate3d(2vw, -1vh, 0) scale(1.15);
  opacity: 0.34;
}

body.is-ceremony-live .background-glow--two {
  transform: translate3d(-2vw, 2vh, 0) scale(1.08);
  opacity: 0.3;
}

body.is-ceremony-live .background-glow--three {
  transform: translate3d(0, -3vh, 0) scale(1.2);
  opacity: 0.36;
}

.journey {
  min-height: 100vh;
}

.scene {
  display: none;
  min-height: 100svh;
  padding: 1rem 0;
}

.scene.is-active {
  display: grid;
  place-items: center;
}

.scene--gallery.is-active {
  place-items: start center;
  padding: 5.5rem 0 4rem;
}

.scene__inner {
  width: var(--content-width);
  opacity: 0;
  transform: translateY(22px);
  animation: rise 700ms ease forwards;
}

.scene__inner--center,
.scene__inner--narrow {
  text-align: center;
}

.scene__inner--center {
  max-width: 52rem;
}

.scene__inner--narrow {
  max-width: 48rem;
}

.scene__inner--wide {
  max-width: 72rem;
}

.scene__eyebrow {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.birthday-title,
.scene-title,
.birthday-quote {
  font-family: "Cormorant Garamond", serif;
}

.birthday-title,
.scene-title {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.94;
}

.birthday-title {
  font-size: clamp(3.9rem, 10vw, 7.6rem);
}

.birthday-title span {
  display: block;
  opacity: 0.72;
  transform: translateY(8px) scale(0.995);
  transition: opacity 500ms ease, transform 500ms ease;
}

.birthday-title span:nth-child(1) {
  color: var(--text);
}

.birthday-title span:nth-child(2) {
  color: var(--gold);
}

.birthday-title span:nth-child(3) {
  color: var(--red);
}

body.is-ceremony-live .birthday-title span {
  opacity: 1;
  transform: translateY(0) scale(1);
}

body.is-ceremony-live .birthday-title span:nth-child(1) {
  transition-delay: 120ms;
}

body.is-ceremony-live .birthday-title span:nth-child(2) {
  transition-delay: 300ms;
}

body.is-ceremony-live .birthday-title span:nth-child(3) {
  transition-delay: 520ms;
}

.scene-title {
  font-size: clamp(2.7rem, 7vw, 5.2rem);
}

.scene-copy,
.scene__hint,
.lightbox__meta p {
  color: var(--muted);
  line-height: 1.75;
}

.scene-copy {
  max-width: 40rem;
  margin: 1.3rem auto 0;
  font-size: 1.04rem;
}

.flag-shell {
  width: min(21rem, 72vw);
  margin: 2rem auto 0;
  padding: 1rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0.82;
  transform: translateY(8px) scale(0.99);
  transition: opacity 700ms ease, transform 700ms ease;
}

body.is-ceremony-live .flag-shell {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.flag-svg {
  width: 100%;
  display: block;
  border-radius: 18px;
  transform-origin: left center;
}

body.is-ceremony-live .flag-svg {
  animation: flag-wave 3.6s ease-in-out infinite;
}

.scene__actions {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.8rem;
}

.button {
  min-height: 3.1rem;
  padding: 0.9rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.button:hover,
.button:focus-visible,
.memory__frame:hover,
.memory__frame:focus-visible {
  transform: translateY(-2px);
}

.button--solid {
  background: var(--text);
  color: var(--bg);
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.scene__hint {
  margin: 1rem auto 0;
  max-width: 28rem;
  font-size: 0.95rem;
}

.scene-header {
  margin-bottom: 2rem;
  text-align: center;
}

.timeline {
  display: grid;
  gap: 1.2rem;
}

.memory {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.memory:nth-child(even) .memory__frame {
  order: 2;
}

.memory__frame {
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - 8px);
  background: var(--bg-strong);
  cursor: pointer;
  align-self: start;
}

.memory__frame img {
  display: block;
  width: 100%;
  height: auto;
}

.memory__meta {
  display: grid;
  align-content: center;
  gap: 0.75rem;
  padding: 0.4rem 0.2rem;
}

.memory__tag {
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.memory__title {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  line-height: 0.98;
}

.memory__caption {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.birthday-quote {
  margin: 2rem 0 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.14;
}

.birthday-quote p {
  margin: 0;
}

.birthday-quote p + p {
  margin-top: 1rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.lightbox__dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(16rem, 0.9fr);
  gap: 1rem;
  width: min(1100px, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  margin: 0.5rem auto;
  padding: 1rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  cursor: pointer;
}

.lightbox__media {
  display: grid;
  place-items: center;
  min-height: min(74vh, 720px);
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - 8px);
  background: var(--bg-strong);
}

.lightbox__media img {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 680px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox__meta {
  align-self: end;
  padding: 0.4rem 0.2rem;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flag-wave {
  0%,
  100% {
    transform: perspective(600px) rotateY(0deg) rotateZ(0deg);
  }
  25% {
    transform: perspective(600px) rotateY(-11deg) rotateZ(-1deg);
  }
  50% {
    transform: perspective(600px) rotateY(4deg) rotateZ(0.6deg);
  }
  75% {
    transform: perspective(600px) rotateY(-7deg) rotateZ(-0.6deg);
  }
}

@media (max-width: 920px) {
  .memory,
  .lightbox__dialog {
    grid-template-columns: 1fr;
  }

  .memory:nth-child(even) .memory__frame {
    order: 0;
  }
}

@media (max-width: 680px) {
  .scene--gallery.is-active {
    padding-top: 4.6rem;
  }

  .memory {
    padding: 0.8rem;
  }

  .birthday-quote {
    padding: 1.1rem;
    line-height: 1.18;
  }

  .lightbox__dialog {
    width: min(100vw - 0.7rem, 100%);
  }

  .lightbox__media {
    min-height: 45vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
