:root {
  --bg: #080a0d;
  --bg-elevated: #10141a;
  --ink: #f6f1e8;
  --muted: #9e978c;
  --gold: #c9a85c;
  --gold-bright: #efd48a;
  --teal: #3dceb8;
  --teal-deep: #0d5c56;
  --line: rgba(246, 241, 232, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --nav-h: 4.5rem;
  --page-pad: clamp(1.25rem, 4.5vw, 3.5rem);
}

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

html {
  height: 100%;
  height: 100dvh;
}

body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

/* ---------- Pages ---------- */
.page {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(6%, 0, 0) scale(0.985);
  transition:
    opacity 0.65s var(--ease),
    transform 0.8s var(--ease),
    visibility 0.65s;
  overflow: hidden;
}

.page.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  z-index: 2;
}

.page.is-exit {
  opacity: 0;
  transform: translate3d(-4%, 0, 0) scale(1.015);
  z-index: 1;
}

/* ---------- Enter ---------- */
.page--enter {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, rgba(201, 168, 92, 0.2), transparent 55%),
    radial-gradient(ellipse 55% 45% at 90% 85%, rgba(61, 206, 184, 0.1), transparent 50%),
    radial-gradient(ellipse 40% 35% at 5% 70%, rgba(201, 168, 92, 0.06), transparent 45%),
    linear-gradient(165deg, #080a0d 0%, #121820 48%, #080a0d 100%);
}

.enter__atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.enter__glow {
  position: absolute;
  top: 18%;
  left: 50%;
  translate: -50% 0;
  width: min(78vw, 480px);
  height: min(78vw, 480px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 168, 92, 0.28), transparent 68%);
  filter: blur(48px);
  animation: pulse 5s ease-in-out infinite;
}

.enter__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: min(88vw, 620px);
  height: min(88vw, 620px);
  border: 1px solid rgba(201, 168, 92, 0.14);
  border-radius: 50%;
  animation: ringSpin 48s linear infinite;
}

.enter__ring::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px dashed rgba(61, 206, 184, 0.12);
  border-radius: 50%;
}

.enter__grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.65; }
  50% { transform: scale(1.12); opacity: 1; }
}

@keyframes ringSpin {
  to { transform: rotate(360deg); }
}

.enter__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: calc(2rem + var(--safe-top)) clamp(1.25rem, 5vw, 2.5rem) calc(2rem + var(--safe-bottom));
  max-width: 40rem;
  width: 100%;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ornament span:not(.ornament__diamond) {
  width: clamp(2.5rem, 8vw, 4rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.ornament__diamond {
  width: 7px;
  height: 7px;
  background: var(--gold-bright);
  rotate: 45deg;
  box-shadow: 0 0 16px rgba(239, 212, 138, 0.55);
}

.eyebrow {
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.15rem;
  font-weight: 500;
}

.eyebrow.gold {
  color: var(--gold-bright);
}

.enter__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.35rem, 9vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}

.enter__sub {
  color: var(--muted);
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  line-height: 1.6;
  margin: 0 auto 2rem;
  max-width: 28rem;
  text-wrap: pretty;
}

.enter__hint {
  margin-top: 1.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(158, 151, 140, 0.75);
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding: 0.9rem 1.75rem;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 55%, #a8863f 100%);
  color: #0a0c0f;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: transform 0.28s var(--ease), box-shadow 0.28s, filter 0.28s;
  box-shadow:
    0 10px 36px rgba(201, 168, 92, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.cta__arrow {
  transition: transform 0.28s var(--ease);
}

.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 14px 44px rgba(201, 168, 92, 0.45);
}

.cta:hover .cta__arrow {
  transform: translateX(3px);
}

.cta:active {
  transform: translateY(0);
}

.cta--ghost {
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid rgba(201, 168, 92, 0.45);
  box-shadow: none;
  margin-top: 1.35rem;
  filter: none;
}

.cta--ghost:hover {
  background: rgba(201, 168, 92, 0.1);
  box-shadow: none;
  filter: none;
}

/* ---------- Photo pages ---------- */
.page--photo {
  display: grid;
  grid-template-rows: 1fr;
}

.page__media {
  position: absolute;
  inset: 0;
}

.page__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, center top);
}

.kenburns {
  animation: kenburns 16s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes kenburns {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.07) translate3d(0, -1%, 0); }
}

.page__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      185deg,
      rgba(8, 10, 13, 0.15) 0%,
      rgba(8, 10, 13, 0.2) 35%,
      rgba(8, 10, 13, 0.72) 62%,
      rgba(8, 10, 13, 0.96) 100%
    );
}

.page__veil--gold {
  background:
    linear-gradient(
      185deg,
      rgba(30, 22, 8, 0.2) 0%,
      rgba(8, 10, 13, 0.35) 40%,
      rgba(18, 14, 6, 0.78) 68%,
      rgba(8, 10, 13, 0.97) 100%
    );
}

.page__veil--mono {
  background:
    linear-gradient(
      185deg,
      rgba(0, 0, 0, 0.15) 0%,
      rgba(0, 0, 0, 0.35) 40%,
      rgba(0, 0, 0, 0.78) 68%,
      rgba(0, 0, 0, 0.96) 100%
    );
}

.page__veil--teal {
  background:
    linear-gradient(
      185deg,
      rgba(8, 28, 26, 0.2) 0%,
      rgba(8, 10, 13, 0.35) 40%,
      rgba(6, 22, 20, 0.78) 68%,
      rgba(8, 10, 13, 0.97) 100%
    );
}

.page__veil--ice {
  background:
    linear-gradient(
      185deg,
      rgba(10, 18, 28, 0.25) 0%,
      rgba(8, 10, 13, 0.35) 40%,
      rgba(8, 16, 26, 0.8) 68%,
      rgba(8, 10, 13, 0.97) 100%
    );
}

.page__frame {
  position: absolute;
  inset: clamp(0.65rem, 2vw, 1.15rem);
  border: 1px solid rgba(246, 241, 232, 0.08);
  pointer-events: none;
  z-index: 1;
}

.page__frame::before,
.page__frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(201, 168, 92, 0.55);
  border-style: solid;
}

.page__frame::before {
  top: -1px;
  left: -1px;
  border-width: 1.5px 0 0 1.5px;
}

.page__frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1.5px 1.5px 0;
}

.page__copy {
  position: relative;
  z-index: 2;
  align-self: end;
  width: min(100%, 40rem);
  padding: var(--page-pad);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 0.75rem);
  animation: riseIn 0.85s var(--ease) both;
}

.page.is-active .page__copy {
  animation: riseIn 0.85s var(--ease) both;
}

.page.is-active .page__copy .label,
.page.is-active .page__copy .brand-mark {
  animation: fadeSlide 0.7s var(--ease) 0.05s both;
}

.page.is-active .page__copy .display {
  animation: fadeSlide 0.8s var(--ease) 0.12s both;
}

.page.is-active .page__copy .rule {
  animation: ruleGrow 0.9s var(--ease) 0.22s both;
}

.page.is-active .page__copy .tagline,
.page.is-active .page__copy .wish {
  animation: fadeSlide 0.85s var(--ease) 0.28s both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ruleGrow {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.55rem, 5.5vw, 2.6rem);
  color: var(--gold-bright);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 48px rgba(201, 168, 92, 0.45);
}

.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 9.5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.038em;
  margin-bottom: 0.85rem;
  text-wrap: balance;
}

.display--sm {
  font-size: clamp(1.7rem, 6.8vw, 3.1rem);
  letter-spacing: -0.03em;
}

.tagline {
  color: var(--teal);
  font-weight: 500;
  font-size: clamp(0.95rem, 2.5vw, 1.08rem);
  margin-bottom: 0.7rem;
  letter-spacing: 0.01em;
}

.label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: clamp(0.62rem, 1.7vw, 0.7rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.7rem;
  font-weight: 500;
}

.label span {
  display: inline-grid;
  place-items: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.3rem;
  border: 1px solid rgba(201, 168, 92, 0.45);
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  color: var(--gold-bright);
}

.rule {
  width: 3.25rem;
  height: 1.5px;
  margin: 0 0 1rem;
  background: linear-gradient(90deg, var(--gold-bright), transparent);
  transform-origin: left center;
}

.rule--center {
  margin-left: auto;
  margin-right: auto;
  width: 4rem;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  transform-origin: center;
}

.wish {
  color: var(--muted);
  font-size: clamp(0.95rem, 2.5vw, 1.12rem);
  line-height: 1.65;
  max-width: 30rem;
  text-wrap: pretty;
}

/* ---------- Finale ---------- */
.page--finale {
  background:
    radial-gradient(ellipse 75% 45% at 50% -5%, rgba(201, 168, 92, 0.16), transparent 55%),
    radial-gradient(ellipse 45% 35% at 10% 90%, rgba(61, 206, 184, 0.08), transparent 50%),
    var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.finale__inner {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding:
    calc(2.5rem + var(--safe-top))
    clamp(1rem, 4vw, 2rem)
    calc(var(--nav-h) + var(--safe-bottom) + 1.5rem);
}

.finale__name {
  margin-bottom: 0.35rem;
  background: linear-gradient(125deg, var(--ink) 20%, var(--gold-bright) 70%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(2.4rem, 10vw, 4.6rem);
}

.finale__wish {
  max-width: 36rem;
  color: var(--muted);
  line-height: 1.7;
  font-size: clamp(0.95rem, 2.4vw, 1.08rem);
  margin: 0.85rem auto 1.75rem;
  text-wrap: pretty;
}

.finale__brand {
  margin-top: 1.35rem;
  color: var(--muted);
  font-size: clamp(0.88rem, 2.2vw, 0.98rem);
}

.finale__brand strong {
  color: var(--gold-bright);
  font-weight: 600;
}

.collage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(64px, 12vw);
  gap: 0.4rem;
  width: min(100%, 560px);
}

.collage__item {
  overflow: hidden;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.collage__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease), filter 0.45s;
}

.collage__item:hover img {
  transform: scale(1.06);
  filter: saturate(1.15) brightness(1.04);
}

.collage__item--tall {
  grid-row: span 2;
}

.collage__item--wide {
  grid-column: span 2;
}

.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Chrome ---------- */
.nav {
  position: fixed;
  bottom: calc(0.85rem + var(--safe-bottom));
  left: 50%;
  translate: -50% 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  background: rgba(8, 10, 13, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(246, 241, 232, 0.1);
  border-radius: 999px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  max-width: calc(100vw - 1.5rem);
}

.nav__btn {
  flex-shrink: 0;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  background: rgba(201, 168, 92, 0.14);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  transition: background 0.2s, transform 0.2s;
}

.nav__btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.nav__btn:hover:not(:disabled) {
  background: rgba(201, 168, 92, 0.28);
  transform: scale(1.04);
}

.nav__btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.nav__dots {
  display: none;
  align-items: center;
  gap: 0.28rem;
  padding: 0 0.25rem;
}

.nav__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(246, 241, 232, 0.22);
  transition: width 0.3s var(--ease), background 0.3s, border-radius 0.3s;
}

.nav__dot.is-active {
  width: 14px;
  border-radius: 999px;
  background: var(--gold-bright);
}

.nav__count {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  min-width: 4.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mute-btn {
  position: fixed;
  top: calc(0.85rem + var(--safe-top));
  right: calc(0.85rem + var(--safe-right));
  z-index: 60;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: rgba(8, 10, 13, 0.65);
  border: 1px solid rgba(201, 168, 92, 0.35);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s;
}

.mute-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.mute-btn .icon-off {
  display: none;
}

.mute-btn.is-muted .icon-on {
  display: none;
}

.mute-btn.is-muted .icon-off {
  display: block;
}

.mute-btn:hover {
  background: rgba(201, 168, 92, 0.18);
  border-color: rgba(201, 168, 92, 0.55);
}

.progress {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  height: 2px;
  z-index: 70;
  background: rgba(246, 241, 232, 0.06);
}

.progress__bar {
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold-bright));
  transition: width 0.45s var(--ease);
  box-shadow: 0 0 12px rgba(239, 212, 138, 0.45);
}

/* ---------- Tablet+ ---------- */
@media (min-width: 640px) {
  .collage {
    grid-auto-rows: minmax(80px, 9vw);
    gap: 0.5rem;
  }

  .nav__dots {
    display: flex;
  }

  .nav__count {
    display: none;
  }
}

@media (min-width: 768px) {
  .page__copy {
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 1.25rem);
  }

  .page__frame {
    inset: 1.25rem;
  }
}

/* ---------- Desktop: editorial split feel ---------- */
@media (min-width: 960px) {
  .page__veil,
  .page__veil--gold,
  .page__veil--mono,
  .page__veil--teal,
  .page__veil--ice {
    background:
      linear-gradient(
        100deg,
        rgba(8, 10, 13, 0.94) 0%,
        rgba(8, 10, 13, 0.78) 28%,
        rgba(8, 10, 13, 0.35) 52%,
        rgba(8, 10, 13, 0.08) 72%,
        transparent 100%
      ),
      linear-gradient(
        0deg,
        rgba(8, 10, 13, 0.55) 0%,
        transparent 38%
      );
  }

  .page__copy {
    align-self: center;
    max-width: 34rem;
    padding-left: clamp(3rem, 7vw, 6.5rem);
    padding-right: 2rem;
    padding-bottom: var(--page-pad);
  }

  .page__copy--reveal {
    max-width: 38rem;
  }

  .display {
    font-size: clamp(3rem, 5.5vw, 5rem);
  }

  .display--sm {
    font-size: clamp(2.2rem, 3.8vw, 3.35rem);
  }

  .collage {
    width: min(100%, 640px);
    grid-auto-rows: 110px;
    gap: 0.6rem;
  }

  .nav {
    bottom: calc(1.25rem + var(--safe-bottom));
    gap: 0.75rem;
    padding: 0.45rem 0.7rem;
  }
}

@media (min-width: 1280px) {
  .page__copy {
    max-width: 38rem;
    padding-left: clamp(4rem, 9vw, 8rem);
  }

  .wish {
    font-size: 1.15rem;
  }
}

/* ---------- Short / landscape phones ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  .enter__title {
    font-size: clamp(1.8rem, 6vw, 2.6rem);
  }

  .enter__sub {
    font-size: 0.9rem;
    margin-bottom: 1.1rem;
  }

  .enter__glow,
  .enter__ring {
    opacity: 0.5;
  }

  .page__veil,
  .page__veil--gold,
  .page__veil--mono,
  .page__veil--teal,
  .page__veil--ice {
    background:
      linear-gradient(
        90deg,
        rgba(8, 10, 13, 0.92) 0%,
        rgba(8, 10, 13, 0.55) 45%,
        rgba(8, 10, 13, 0.2) 100%
      );
  }

  .page__copy {
    align-self: center;
    max-width: 55%;
    padding: 1rem 1rem 1rem 1.5rem;
    padding-bottom: 1rem;
  }

  .display,
  .display--sm {
    font-size: clamp(1.35rem, 4.5vw, 2rem);
    margin-bottom: 0.4rem;
  }

  .wish {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .brand-mark {
    font-size: 1.2rem;
  }

  .page__frame {
    display: none;
  }

  .finale__inner {
    padding-top: 1.25rem;
    padding-bottom: calc(var(--nav-h) + 0.75rem);
  }

  .collage {
    grid-auto-rows: 56px;
    width: min(100%, 420px);
  }
}

/* ---------- Very small phones ---------- */
@media (max-width: 380px) {
  .enter__title {
    font-size: 2.1rem;
  }

  .label {
    letter-spacing: 0.18em;
  }

  .nav__count {
    min-width: 3.6rem;
    font-size: 0.65rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .kenburns,
  .enter__glow,
  .enter__ring {
    animation: none;
  }

  .page {
    transition: opacity 0.25s ease;
    transform: none;
  }

  .page.is-active .page__copy,
  .page.is-active .page__copy * {
    animation: none !important;
  }

  .collage__item img {
    transition: none;
  }
}
