/* =========================================================
   Birthday Invitation — generic stylesheet
   No event content lives here. All colors/fonts come from
   data/invite.json via CSS custom properties set by JS.
   ========================================================= */

/* Global rule: the HTML `hidden` attribute always wins. */
[hidden] {
  display: none !important;
}

:root {
  --primary: #ff5c8a;
  --secondary: #7b5cff;
  --accent: #ffc94d;
  --background: #fff7fb;
  --surface: #ffffff;
  --text: #2a1b33;
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --font-heading: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 22px;
  --shadow: 0 18px 50px -20px color-mix(in srgb, var(--text) 45%, transparent);
  --wrap: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.12;
  margin: 0 0 0.4em;
  font-weight: 700;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

/* ---------- Boot screens ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--background);
}
.boot__spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
.boot__title {
  font-size: 1.5rem;
}
.boot__text {
  color: var(--muted);
  margin: 0;
}
.boot__hint {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 34ch;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Decorations ---------- */
.decorations {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.deco {
  position: absolute;
  pointer-events: none;
  will-change: transform;
}
.deco--balloon {
  width: 46px;
  height: 58px;
  border-radius: 50% 50% 48% 48%;
  opacity: 0.5;
  animation: drift linear infinite;
}
.deco--balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 46px;
  background: currentColor;
  opacity: 0.4;
}
.deco--confetti {
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.6;
  animation: fall linear infinite;
}
.deco--hat {
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  opacity: 0.5;
  animation: drift linear infinite;
}
.deco--cake {
  font-size: 26px;
  opacity: 0.45;
  animation: drift linear infinite;
}
@keyframes drift {
  0% {
    transform: translate3d(0, 110vh, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(28px, -20vh, 0) rotate(18deg);
  }
}
@keyframes fall {
  0% {
    transform: translate3d(0, -12vh, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(-40px, 112vh, 0) rotate(420deg);
  }
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
.header__brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  margin-right: auto;
  color: var(--primary);
}
.nav {
  display: flex;
  gap: 1.15rem;
}
.nav a {
  text-decoration: none;
  font-size: 0.93rem;
  color: var(--text);
  opacity: 0.8;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover {
  opacity: 1;
  border-bottom-color: var(--primary);
}
.header__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
  order: 3;
}
.header__burger span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.music-btn {
  border: 0;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  font-size: 1.05rem;
  display: grid;
  place-items: center;
}
.music-btn.is-playing .music-btn__icon {
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    transform: scale(1.25);
  }
}

@media (max-width: 760px) {
  .header__burger {
    display: flex;
  }
  .nav {
    position: fixed;
    inset: 0 0 auto;
    top: 58px;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.2rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateY(-140%);
    transition: transform 0.28s ease;
    pointer-events: none;
  }
  .nav.is-open {
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* ---------- Sections ---------- */
.section--pad {
  padding: clamp(3.2rem, 9vw, 5.5rem) 0;
  position: relative;
  z-index: 2;
}
.section__title {
  font-size: clamp(1.8rem, 5.4vw, 2.7rem);
  text-align: center;
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 5rem 1.25rem;
  overflow: hidden;
  z-index: 2;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -2;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--primary) 35%, transparent),
    color-mix(in srgb, var(--secondary) 45%, transparent)
  );
}
.hero__inner {
  max-width: 760px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  padding: clamp(1.6rem, 5vw, 3rem);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.74rem;
  color: var(--secondary);
  margin: 0 0 0.9rem;
}
.hero__title {
  font-size: clamp(2.4rem, 11vw, 4.6rem);
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__age {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 4.4vw, 1.5rem);
  color: var(--accent);
  margin: 0 0 0.5rem;
  font-weight: 700;
}
.hero__subtitle {
  color: var(--muted);
  margin: 0 0 1.6rem;
}
.hero__scroll {
  position: absolute;
  bottom: 18px;
  font-size: 1.4rem;
  animation: bob 1.8s ease-in-out infinite;
  color: var(--surface);
}
@keyframes bob {
  50% {
    transform: translateY(9px);
  }
}

.btn {
  display: inline-block;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn--primary {
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  color: #fff;
}
.btn--ghost {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
  margin-top: 1.4rem;
}

/* ---------- Invitation ---------- */
.invitation {
  text-align: center;
}
.invitation__message {
  font-size: clamp(1.02rem, 3.2vw, 1.22rem);
  max-width: 62ch;
  margin: 0 auto;
  white-space: pre-line;
}
.invitation__signature {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--primary);
  margin-top: 1.5rem;
}

/* ---------- Profile ---------- */
.profile {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 3rem);
  align-items: center;
}
.profile__photo {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 6px solid var(--surface);
}
.profile__photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.profile .section__title {
  text-align: left;
}
.profile__tagline {
  color: var(--muted);
  font-style: italic;
}
.facts {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0.6rem;
}
.facts li {
  background: var(--surface);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  box-shadow: 0 6px 18px -14px var(--text);
  border-left: 4px solid var(--accent);
}
@media (max-width: 760px) {
  .profile {
    grid-template-columns: 1fr;
  }
  .profile .section__title {
    text-align: center;
  }
}

/* ---------- Countdown ---------- */
.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 1.1rem);
  max-width: 680px;
  margin-inline: auto;
}
.cd-cell {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(0.8rem, 3vw, 1.4rem) 0.3rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.cd-cell__num {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 7vw, 2.8rem);
  font-weight: 700;
  color: var(--primary);
  display: block;
  font-variant-numeric: tabular-nums;
}
.cd-cell__label {
  font-size: clamp(0.6rem, 2.4vw, 0.78rem);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.countdown__message {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 1.15rem;
  color: var(--secondary);
  font-weight: 600;
}

/* ---------- Event ---------- */
.event__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.event-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.event-card__label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--secondary);
}
.event-card__value {
  font-family: var(--font-heading);
  font-size: 1.22rem;
  margin-top: 0.35rem;
}
.event-card__sub {
  color: var(--muted);
  font-size: 0.92rem;
}
#event .btn--ghost {
  display: table;
  margin-inline: auto;
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.2rem;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--primary), var(--secondary));
  opacity: 0.35;
}
.tl-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.tl-item__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--primary);
  margin-top: 8px;
}
.tl-item__card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
}
.tl-item__card.no-image {
  grid-template-columns: 1fr;
}
.tl-item__card img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}
.tl-item__body {
  padding: 1.1rem 1.3rem;
}
.tl-item__date {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary);
}
.tl-item__title {
  font-size: 1.15rem;
  margin: 0.2rem 0 0.35rem;
}
.tl-item__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
@media (max-width: 620px) {
  .tl-item__card {
    grid-template-columns: 1fr;
  }
}

/* ---------- Gallery ---------- */
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 0.9rem;
}
.gallery__item {
  border: 0;
  padding: 0;
  cursor: pointer;
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.gallery__item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery__item:hover img {
  transform: scale(1.06);
}
.gallery__cap {
  position: absolute;
  inset: auto 0 0;
  padding: 0.6rem;
  font-size: 0.8rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  text-align: left;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(12, 6, 18, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
}
.lightbox__figure {
  margin: 0;
  max-width: min(92vw, 1000px);
  text-align: center;
}
.lightbox__figure img {
  max-height: 78vh;
  width: auto;
  margin-inline: auto;
  border-radius: 12px;
}
.lightbox__figure figcaption {
  color: #fff;
  margin-top: 0.7rem;
  font-size: 0.9rem;
}
.lightbox__nav,
.lightbox__close {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 0;
  cursor: pointer;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1.7rem;
  line-height: 1;
  flex: none;
}
.lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.5rem;
}

/* ---------- RSVP ---------- */
.rsvp {
  text-align: center;
}
.rsvp__note {
  max-width: 55ch;
  margin-inline: auto;
  color: var(--muted);
}
.rsvp__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.6rem;
}
.rsvp__deadline {
  margin-top: 1.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Candles ---------- */
.candles {
  text-align: center;
}
.candles__hint {
  color: var(--muted);
}
.cake {
  background: none;
  border: 0;
  cursor: pointer;
  display: inline-grid;
  justify-items: center;
  gap: 4px;
  padding: 1rem;
}
.cake__flames {
  display: flex;
  gap: 16px;
}
.cake__flames i {
  width: 12px;
  height: 20px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 70%, #fff3b0, var(--accent));
  animation: flicker 0.7s ease-in-out infinite alternate;
}
.cake.is-out .cake__flames i {
  opacity: 0;
  transform: scale(0.3);
  transition: 0.3s ease;
}
@keyframes flicker {
  to {
    transform: scale(1.18) translateY(-2px);
  }
}
.cake__body {
  width: 150px;
  height: 92px;
  border-radius: 14px 14px 20px 20px;
  background: linear-gradient(var(--surface) 34%, var(--primary) 34%, var(--secondary));
  box-shadow: var(--shadow);
}

/* ---------- Confetti burst ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: burst 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes burst {
  to {
    transform: translate3d(var(--dx), var(--dy), 0) rotate(640deg);
    opacity: 0;
  }
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  color: #fff;
}
.footer__message {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin: 0 0 0.6rem;
}
.footer__hashtag {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.8rem;
  opacity: 0.9;
}
.socials {
  list-style: none;
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 0;
  margin: 1.2rem 0 0;
}
.socials a {
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 0.92rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
