/* =================================================================
   Melaspas ceremony invitation
   Dark, elegant style: family & house photos, charcoal and mist-gray
   backgrounds, Alegreya for headings/reading and Alegreya Sans for
   labels/buttons.
   ================================================================= */

/* ---------- Fonts (self-hosted, SIL OFL license: assets/fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/alegreya-normal-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/alegreya-normal-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/alegreya-italic-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("assets/fonts/alegreya-italic-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/alegreya-sans-normal-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Balinese script: only downloaded when the page contains Balinese characters. */
@font-face {
  font-family: "Noto Serif Balinese";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/noto-serif-balinese-400-balinese.woff2") format("woff2");
  unicode-range: U+001D, U+1B00-1B7F, U+200C-200D, U+25CC;
}

/* ---------- Tokens ---------- */
:root {
  /* Palette (text contrast checked against its background) */
  --charcoal: #121212;          /* main background; white text 18.7:1 */
  --white: #FFFFFF;
  --gray-text: #B8B8B8;         /* secondary text on charcoal, 9.4:1 */
  --mist-gray: #6E7282;         /* event, location, RSVP, closing; white text 4.8:1 */
  --card-gray: #EDEDED;         /* form card; charcoal text 16:1 */
  --error-red: #9A2B1C;         /* error messages on light cards, 6.6:1 */

  /* Derived */
  --text-soft: #DADADA;         /* body text on charcoal, 13.4:1 */
  --text-card: #4D4F57;         /* secondary text on cards, 7:1 */
  --input-border: #85888F;      /* input borders, ≥3:1 */
  --line-light: rgba(255, 255, 255, 0.4);

  --font-serif: "Alegreya", Georgia, "Times New Roman", serif;
  --font-sans: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --column-width: 30rem;
  --gutter: 1.5rem;
  --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--charcoal);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.7;
  /* On wide screens, the sides of the column show a heavily blurred cover photo */
  background:
    linear-gradient(rgba(18, 18, 18, 0.72), rgba(18, 18, 18, 0.72)),
    url("assets/img/bg-blur.webp") center / cover fixed,
    var(--charcoal);
}

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

img {
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

h2 {
  font-size: 2.25rem;
  letter-spacing: 0.01em;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Wide-tracked uppercase labels */
.label {
  margin: 0 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.label--small {
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  letter-spacing: 0.24em;
}

.label--heading {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3em;
}

/* ---------- Invitation column ---------- */
.content {
  position: relative;
  max-width: var(--column-width);
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: clip;
  background-color: var(--charcoal);
}

@media (min-width: 34rem) {
  .content {
    box-shadow: 0 0 4rem rgba(0, 0, 0, 0.6);
  }
}

.section {
  padding: 4.5rem var(--gutter);
  text-align: center;
}

.section--dark {
  background-color: var(--charcoal);
}

.section--gray {
  background-color: var(--mist-gray);
}

/* Consecutive sections of the same color join without double spacing */
.section--dark + .section--dark,
.section--gray + .section--gray {
  padding-top: 0;
}

/* Short rule between dark sections */
.section--dark + .section--dark::before {
  content: "";
  display: block;
  width: 3rem;
  height: 1px;
  margin: 0 auto 4.5rem;
  background-color: var(--line-light);
}

/* Vertical rule at the start of a gray section (including photo-backed ones) */
.section--dark + .section--gray::before,
.photo-bg__layer + .section--gray::before {
  content: "";
  display: block;
  width: 1px;
  height: 3.5rem;
  margin: -2rem auto 2.5rem;
  background-color: rgba(255, 255, 255, 0.75);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3rem;
  padding: 0.75rem 1.625rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s var(--ease-smooth), color 0.3s var(--ease-smooth), transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn__icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.btn--glass {
  border-color: rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.16);
  color: var(--white);
  letter-spacing: 0.14em;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.btn--light {
  background-color: var(--white);
  color: var(--charcoal);
}

.btn--outline {
  border-color: var(--white);
  background-color: transparent;
  color: var(--white);
}

.btn--dark {
  background-color: var(--charcoal);
  color: var(--white);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (hover: hover) {
  .btn--glass:hover {
    background-color: rgba(255, 255, 255, 0.26);
  }

  .btn--light:hover {
    background-color: var(--card-gray);
  }

  .btn--outline:hover {
    background-color: rgba(255, 255, 255, 0.12);
  }

  .btn--dark:hover {
    background-color: #2A2A2A;
  }
}

/* Placeholder box for data/assets that are not available yet */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.5rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.5);
  border-radius: 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--gray-text);
  text-align: center;
}

/* =================================================================
   REVEAL ANIMATION — only active when main.js adds .reveal-ready
   (never for prefers-reduced-motion)
   ================================================================= */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(1.75rem);
  transition: opacity 1.1s var(--ease-smooth), transform 1.1s var(--ease-smooth);
  transition-delay: var(--delay, 0s);
}

.reveal-ready [data-reveal="photo"] {
  transform: translateY(1.25rem) scale(0.97);
  transition-duration: 1.4s;
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* =================================================================
   1. COVER SCREEN — full-screen cover photo
   ================================================================= */
html.is-locked,
html.is-locked body {
  overflow: hidden;
}

.cover {
  position: fixed;
  inset: 0;
  z-index: 20;
  max-width: calc(var(--column-width) + 0.75rem);
  margin-inline: auto;
  overflow: hidden;
  background-color: var(--charcoal);
  touch-action: pinch-zoom;
  overscroll-behavior: contain;
  transition: opacity 0.85s var(--ease-smooth), transform 0.85s var(--ease-smooth), visibility 0s linear 0.85s;
}

.cover__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  animation: slow-zoom 20s var(--ease-smooth) both;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(18, 18, 18, 0.72) 0%,
    rgba(18, 18, 18, 0.28) 30%,
    rgba(18, 18, 18, 0.3) 48%,
    rgba(18, 18, 18, 0.88) 74%,
    #121212 100%
  );
}

.cover__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: max(3.5rem, 10vh, env(safe-area-inset-top)) var(--gutter) max(2.5rem, env(safe-area-inset-bottom));
  text-align: center;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5);
}

.cover__residence {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 1.4rem + 3vw, 2.75rem);
  line-height: 1.15;
}

.cover__date {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.cover__guest {
  margin-bottom: 0.5rem;
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cover__apology {
  margin-bottom: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-soft);
}

.cover.is-opening {
  opacity: 0;
  transform: translateY(-3%);
  visibility: hidden;
  pointer-events: none;
}

@keyframes slow-zoom {
  from { transform: scale(1.1); }
  to { transform: scale(1); }
}

/* Short viewports (e.g. a phone in landscape) */
@media (max-height: 30rem) {
  .cover__content {
    padding-top: 1.25rem;
    padding-bottom: 1rem;
  }

  .cover__residence {
    font-size: 1.75rem;
  }

  .cover__apology {
    display: none;
  }
}

/* =================================================================
   HERO — photo with the family name
   ================================================================= */
.hero {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 6rem var(--gutter);
  overflow: hidden;
  text-align: center;
}

.hero__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(18, 18, 18, 0.55) 0%,
    rgba(18, 18, 18, 0.62) 55%,
    #121212 100%
  );
}

.hero__content {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5);
}

.hero__residence {
  margin-bottom: 0.5rem;
  font-size: clamp(2.125rem, 1.5rem + 3vw, 2.875rem);
  line-height: 1.15;
}

.hero__date {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.hero__content [data-reveal]:nth-child(2) { --delay: 0.18s; }
.hero__content [data-reveal]:nth-child(3) { --delay: 0.36s; }

/* Small "scroll down" indicator line */
.hero__scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  z-index: 1;
  width: 1px;
  height: 3.5rem;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.25);
}

.hero__scroll::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--white);
  animation: scroll-hint 2.4s var(--ease-smooth) infinite;
}

@keyframes scroll-hint {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* =================================================================
   2. OPENING GREETING
   ================================================================= */
.balinese {
  max-width: 16rem;
  margin: 0 auto 2rem;
}

.balinese img {
  width: auto;
  max-height: 5.5rem;
  margin: 0 auto;
}

.balinese__script {
  margin: 0;
  font-family: "Noto Serif Balinese", var(--font-serif);
  font-size: 1.75rem;
  line-height: 2.2; /* room for vowel marks above and below the letters */
  overflow-wrap: anywhere;
}

.balinese__transliteration {
  margin: 0.5rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-style: italic;
  color: var(--gray-text);
}

.greeting__title {
  font-size: 2.5rem;
  font-style: italic;
}

.greeting__text {
  max-width: 25rem;
  margin-inline: auto;
  color: var(--text-soft);
}

/* =================================================================
   3. FAMILY — photo card
   ================================================================= */
.photo-card {
  position: relative;
  margin: 0 0 2.5rem;
  overflow: hidden;
  border-radius: 0.25rem;
  background-color: #1E1E1E;
  aspect-ratio: 2 / 3;
  text-align: left;
}

.photo-card__frame,
.photo-card__frame img {
  width: 100%;
  height: 100%;
}

.photo-card__frame img {
  object-fit: cover;
}

.photo-card__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 6rem 1.5rem 1.75rem;
  background: linear-gradient(to top, rgba(18, 18, 18, 0.95), rgba(18, 18, 18, 0));
}

.photo-card__name {
  margin: 0;
  font-size: 2rem;
}

.photo-card--no-photo {
  aspect-ratio: auto;
  background: none;
  text-align: center;
}

.photo-card--no-photo .photo-card__caption {
  position: static;
  padding: 0;
  background: none;
}

.family__head {
  display: grid;
  gap: 0.25rem;
}

.family__head-name {
  font-size: 1.375rem;
}

/* =================================================================
   4. MEANING
   ================================================================= */
.meaning__text {
  max-width: 26rem;
  margin-inline: auto;
  color: var(--text-soft);
}

/* =================================================================
   5. EVENT TIME (gray)
   ================================================================= */
.event__date {
  margin-bottom: 0.375rem;
  font-size: 1.875rem;
  line-height: 1.25;
}

.event__time {
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.event__balinese-date {
  font-style: italic;
}

.event__status {
  max-width: 22rem;
  margin: 2rem auto 0;
  font-size: 1.1875rem;
  font-style: italic;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
  max-width: 20rem;
  margin: 2.25rem auto 0;
}

.countdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0.75rem 0 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 0.375rem;
}

.countdown__number {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
}

.countdown__label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.calendar {
  margin-top: 2.5rem;
}

.calendar__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* =================================================================
   6. LOCATION (gray)
   ================================================================= */
.location__address {
  max-width: 22rem;
  margin: 0 auto 1.75rem;
  font-style: normal;
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-bottom: 2rem;
  padding: 0.75rem 0.25rem 0.5rem;
  border-top: 1px solid var(--white);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
}

.arrow-link::after {
  content: "›";
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.3s var(--ease-smooth);
}

.arrow-link:hover::after {
  transform: translateX(0.25rem);
}

.location__map iframe,
.location__map .placeholder {
  display: flex;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.375rem;
}

.location__map iframe {
  border: 0;
}

.location__map .placeholder {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.7);
}

/* =================================================================
   PARALLAX PHOTO BACKGROUND — wraps Event & Location and RSVP &
   Closing. The photo layer sticks (position: sticky) at viewport
   height and main.js shifts it slightly (--shift) so it moves slower
   than the text. Without a photo, the sections keep the mist-gray
   background.
   ================================================================= */
.photo-bg {
  position: relative;
  isolation: isolate;
  /* Clip the photo layer so it doesn't spill into the next section.
     (overflow: hidden would break position: sticky; clip-path doesn't.) */
  clip-path: inset(0);
  background-color: var(--mist-gray);
}

.photo-bg__layer {
  display: none;
}

.photo-bg--active .photo-bg__layer {
  position: sticky;
  top: 0;
  z-index: -1;
  display: block;
  height: 100vh;
  margin-bottom: -100vh;
  overflow: hidden;
}

.photo-bg__image {
  width: 100%;
  height: calc(100% + 18vh); /* parallax travel room, same as PARALLAX_SHIFT in main.js */
  object-fit: cover;
  transform: translate3d(0, var(--shift, 0px), 0);
  will-change: transform;
}

/* Dark overlay so white text stays readable (≥ 6:1 on the brightest part of the photo) */
.photo-bg__layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(24, 25, 32, 0.72);
}

.photo-bg--active .section--gray {
  background-color: transparent;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.photo-bg--active .rsvp__form,
.photo-bg--active .rsvp__form * {
  text-shadow: none;
}

/* House photo at the start of the gallery section */
.gallery__intro {
  margin: 0 0 3.5rem;
  overflow: hidden;
  border-radius: 0.25rem;
}

.gallery__intro img {
  width: 100%;
}

/* =================================================================
   7. GALLERY & LIGHTBOX
   ================================================================= */
.gallery__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Every 5th photo spans both columns so the grid doesn't feel monotonous */
.gallery__list li:nth-child(5n + 1) {
  grid-column: span 2;
}

.gallery__button {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.25rem;
  background-color: #1E1E1E;
  cursor: zoom-in;
}

.gallery__list li:nth-child(5n + 1) .gallery__button {
  aspect-ratio: 3 / 2;
}

.gallery__button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-smooth);
}

@media (hover: hover) {
  .gallery__button:hover img {
    transform: scale(1.04);
  }
}

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 4rem 1rem 1.5rem;
  border: 0;
  background: transparent;
  color: var(--white);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.4s var(--ease-smooth);
}

.lightbox::backdrop {
  background-color: rgba(10, 10, 10, 0.94);
}

.lightbox__content {
  width: fit-content;
  max-width: 100%;
  margin: 0;
}

.lightbox__content img {
  width: auto;
  max-height: calc(100vh - 9rem);
  margin: 0 auto;
  border-radius: 0.25rem;
}

.lightbox__close {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--white);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =================================================================
   8. GUEST INFORMATION
   ================================================================= */
.info__list {
  display: grid;
  gap: 1rem;
  max-width: 24rem;
  margin: 0 auto 2rem;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
}

.info__list li + li::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 1px;
  margin: 0 auto 1rem;
  background-color: var(--line-light);
}

/* =================================================================
   9. DIGITAL ENVELOPE — white cards
   ================================================================= */
.envelope__intro {
  max-width: 24rem;
  margin-inline: auto;
  color: var(--text-soft);
}

.envelope__list {
  display: grid;
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.25rem 1rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: var(--white);
  color: var(--charcoal);
  text-align: left;
}

.account p {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-sans);
}

.account__name {
  font-weight: 700;
}

.account__number {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: lining-nums tabular-nums;
  overflow-wrap: anywhere;
}

.account__holder {
  color: var(--text-card);
}

.account__copy {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-width: 5.5rem;
  border-radius: 0.75rem;
  border-color: var(--charcoal);
  background-color: var(--charcoal);
  color: var(--white);
}

.account :focus-visible {
  outline-color: var(--charcoal);
}

/* =================================================================
   10. RSVP & WISHES (gray)
   ================================================================= */
.rsvp__info {
  max-width: 24rem;
  margin: 0 auto 2rem;
}

.rsvp__form {
  padding: 1.5rem;
  border-radius: 0.75rem;
  background-color: var(--card-gray);
  color: var(--charcoal);
  text-align: left;
}

.rsvp__form :focus-visible {
  outline-color: var(--charcoal);
}

.field {
  min-width: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.field__label {
  display: block;
  margin-bottom: 0.375rem;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
}

.field__optional {
  font-weight: 500;
  color: var(--text-card);
}

.field__input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--input-border);
  border-radius: 0.5rem;
  background-color: var(--white);
  font-family: var(--font-sans);
  font-size: 1.0625rem; /* ≥16px so iOS Safari doesn't zoom the page */
  line-height: 1.4;
}

.field__input:focus-visible {
  border-color: var(--charcoal);
}

.field__input--short {
  width: 7rem;
}

textarea.field__input {
  min-height: 7.5rem;
  resize: vertical;
}

.field__input[aria-invalid="true"] {
  border-color: var(--error-red);
}

.field__error {
  margin: 0.375rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--error-red);
}

.field__counter {
  margin: 0.25rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-card);
  text-align: right;
}

/* Hadir / Tidak hadir as two side-by-side buttons */
.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.choice__option {
  position: relative;
}

.choice__option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background-color: var(--white);
  font-family: var(--font-sans);
  font-weight: 700;
  transition: background-color 0.25s var(--ease-smooth), color 0.25s var(--ease-smooth);
}

.choice__option input:checked + span {
  border-color: var(--charcoal);
  background-color: var(--charcoal);
  color: var(--white);
}

.choice__option input:focus-visible + span {
  outline: 2px solid var(--charcoal);
  outline-offset: 3px;
}

.choice__option input[aria-invalid="true"] + span {
  border-color: var(--error-red);
}

/* Bot trap: hidden from people and screen readers */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.rsvp__status {
  margin: 0 0 1.25rem;
  padding: 0.875rem 1rem;
  border-left: 0.25rem solid var(--charcoal);
  border-radius: 0.375rem;
  background-color: var(--white);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
}

.rsvp__status--error {
  border-left-color: var(--error-red);
  color: var(--error-red);
}

.rsvp__submit {
  width: 100%;
}

/* Wishes list */
.wishes {
  margin-top: 3.5rem;
  text-align: left;
}

.wishes__title {
  text-align: center;
}

.wishes__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wish {
  padding: 1.125rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.wish:first-child {
  padding-top: 0;
}

.wish__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.625rem;
  margin: 0 0 0.25rem;
}

.wish__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.wish__attendance {
  padding: 0.0625rem 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
}

.wish__attendance--yes {
  border-color: var(--white);
  background-color: var(--white);
  color: var(--charcoal);
}

.wish__text {
  margin: 0 0 0.375rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.wish__time {
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.wishes__status {
  margin: 1rem 0 0;
  text-align: center;
}

.wishes__status:empty {
  display: none;
}

#wishes-more {
  display: flex;
  margin: 1.5rem auto 0;
}

#wishes-more[hidden] {
  display: none;
}

/* =================================================================
   11. CLOSING (gray)
   ================================================================= */
.closing {
  padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}

.closing__title {
  font-size: 2.75rem;
}

.closing__text {
  max-width: 24rem;
  margin: 0 auto 2rem;
}

.closing__greeting {
  margin-bottom: 2.5rem;
  font-size: 1.5rem;
  font-style: italic;
}

.closing__family {
  display: grid;
  gap: 0.25rem;
  font-size: 1.375rem;
}

.closing__music {
  margin-top: 3rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

/* ---------- Music toggle ---------- */
.music-toggle {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background-color: rgba(18, 18, 18, 0.6);
  color: var(--white);
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 34rem) {
  .music-toggle {
    right: max(1rem, calc(50vw - 15rem + 1rem));
  }
}

.music-toggle__icon {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

.music-toggle__icon--pause,
.music-toggle--playing .music-toggle__icon--play {
  display: none;
}

.music-toggle--playing .music-toggle__icon--pause {
  display: block;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cover {
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }

  .cover.is-opening {
    transform: none;
  }

  .cover__photo,
  .hero__scroll::after,
  .lightbox[open] {
    animation: none;
  }

  .gallery__button img,
  .arrow-link::after {
    transition: none;
  }
}
