/* ==========================================================================
   Billy & Clarrisa — shared invitation shell
   Layout, typography, forms and behaviour that both invitations share.
   Colours and ornaments live in wedding.css / sangjit.css.
   ========================================================================== */

/* ---------- fonts ---------- */
@font-face {
  font-family: 'Petrona';
  src: url('../fonts/Petrona-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Petrona';
  src: url('../fonts/Petrona-Italic-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Tangerine';
  src: url('../fonts/Tangerine-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tangerine';
  src: url('../fonts/Tangerine-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --serif: 'Petrona', 'Iowan Old Style', 'Times New Roman', serif;
  --script: 'Tangerine', 'Segoe Script', cursive;

  --col: 480px;          /* width of the invitation column on large screens */
  --pad: 6.7%;           /* horizontal padding — matches the artboard margin */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --nav-h: 58px;
}

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--stage-bg);
  overflow-x: hidden;
}

/* height:auto stops the HTML width/height attributes (kept for layout
   stability) from stretching an image whose width CSS overrides. */
img { max-width: 100%; height: auto; display: block; border: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Stage — one column on phones, column + fixed panel on laptops
   ========================================================================== */
.stage { position: relative; }

.invite {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

/* Tablets and small laptops: centre the column rather than stretching the
   phone layout across the whole screen. */
@media (min-width: 640px) {
  .invite {
    width: min(100%, var(--col));
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.25);
  }
}



/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  position: relative;
  padding: 62px var(--pad);
  overflow: hidden;
}
.section--flush { padding-left: 0; padding-right: 0; }
.section--tight { padding-top: 42px; padding-bottom: 42px; }

/* decorative artwork pinned to a section corner */
.deco {
  position: absolute;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Parallax layers. `translate` is used rather than `transform` so a layer can
   still carry its own transform (a mirrored bloom, say) untouched. */
[data-parallax] {
  translate: 0 var(--par, 0px);
  will-change: translate;
}
@media (prefers-reduced-motion: reduce) {
  [data-parallax] { translate: none; }
}
/* :where() keeps this at zero specificity so a section can still pin a child
   with position:absolute without fighting the cascade. */
.section > :where(:not(.deco)) { position: relative; z-index: 1; }

/* repeating confetti texture */
.tex::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--tex);
  background-size: 200px;
  opacity: var(--tex-opacity, 0.5);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   Type
   ========================================================================== */
.eyebrow {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.script-img { margin-inline: auto; }

/* ornamental rule:  ——◆——  heading  ——◆——
   The two rules share whatever the heading leaves over, so the whole lockup
   keeps the artboard's proportions at any column width. */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.4%;
  width: 100%;
}
.rule > img:first-child,
.rule > img:last-child {
  flex: 1 1 0;
  min-width: 0;
  height: auto;
}
.rule__head { flex: 0 0 auto; height: auto; }

.lead {
  margin: 0;
  text-align: center;
  text-wrap: balance;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 30px;
  border: 0;
  border-radius: 4px;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: transform 0.25s var(--ease), filter 0.25s var(--ease);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ==========================================================================
   Map card
   ========================================================================== */
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 350;
  margin: 22px 0 18px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--map-stroke);
  background: var(--map-bg);
}
.map iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form { display: grid; gap: 18px; }

.field { display: grid; gap: 8px; }

.field__label {
  font-family: var(--script);
  font-size: 2.6rem;
  line-height: 0.9;
  text-align: center;
}
.field__label--left { text-align: left; }

.input,
.textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}
.textarea {
  text-align: left;
  min-height: 132px;
  resize: vertical;
  line-height: 2rem;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(2rem - 1.5px),
    var(--line) calc(2rem - 1.5px),
    var(--line) 2rem
  );
  border-bottom: 0;
  padding: 0 2px;
}
.input::placeholder,
.textarea::placeholder { color: currentColor; opacity: 0.4; }
.input:focus,
.textarea:focus { outline: 0; border-color: var(--accent); }
.textarea:focus { box-shadow: none; }

/* pill choices ------------------------------------------------------------ */
.choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
/* equal-width pills that always stay on one row */
.choices--grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 8px;
}
.choices--grid .choice span {
  padding: 8px 4px;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.15;
}
.choices--grid[style*='--cols: 3'] .choice span,
.choices--grid.choices--three .choice span { font-size: 0.82rem; }

.choice { position: relative; }
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 20px;
  border: 1.5px solid var(--pill-line);
  border-radius: 4px;
  background: var(--pill-bg);
  font-size: 1.05rem;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease),
              color 0.22s var(--ease);
}
.choice input:checked + span {
  background: var(--pill-bg-on);
  border-color: var(--pill-line-on);
  color: var(--pill-ink-on);
}
.choice input:focus-visible + span { outline: 2px solid currentColor; outline-offset: 2px; }

/* number stepper ---------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.stepper button {
  width: 42px; height: 42px;
  border: 1.5px solid var(--pill-line);
  border-radius: 4px;
  background: var(--pill-bg);
  font-size: 1.3rem;
  line-height: 1;
  transition: background 0.22s var(--ease);
}
.stepper button:hover { background: var(--pill-bg-on); }
.stepper input {
  width: 62px; height: 56px;
  font: inherit;
  font-size: 1.25rem;
  color: inherit;
  text-align: center;
  border: 1.5px solid var(--pill-line);
  border-radius: 4px;
  background: var(--pill-bg);
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.form__status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.92rem;
  text-align: center;
}
.form__status[data-state='error'] { color: var(--danger); }

/* ==========================================================================
   Wishes list
   ========================================================================== */
.wishes {
  display: grid;
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.wish__name {
  font-family: var(--script);
  font-size: 2.35rem;
  line-height: 0.95;
  border-bottom: 1.5px solid var(--line-alt);
  display: inline-block;
  padding-right: 30px;
}
.wish__text {
  margin: 10px 0 0;
  line-height: 2rem;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(2rem - 1.5px),
    var(--line-alt) calc(2rem - 1.5px),
    var(--line-alt) 2rem
  );
}
.wishes__empty { opacity: 0.7; font-style: italic; text-align: center; }

/* ==========================================================================
   Countdown
   ========================================================================== */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.countdown li {
  min-width: 0;
  padding: 12px 4px;
  border: 1.5px solid var(--pill-line);
  border-radius: 6px;
  background: var(--pill-bg);
  text-align: center;
}
.countdown b {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.countdown small {
  display: block;
  font-size: clamp(0.5rem, 2.4cqw, 0.6rem);
  font-size: min(0.6rem, 2.9vw);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 480px) {
  .countdown small { font-size: 0.6rem; }
}

/* ==========================================================================
   Cover scroll cue
   ========================================================================== */
.cover__cue {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px);   /* clear of the tab bar */
  translate: -50% 0;
  margin: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.8;
  pointer-events: none;
}
.cover__cue > span {
  position: relative;
  width: 1px;
  height: 40px;
  overflow: hidden;
  background: currentColor;
  opacity: 0.35;
}
.cover__cue > span::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  animation: cue-run 2.4s var(--ease) infinite;
}
@keyframes cue-run {
  0%        { transform: translateY(-100%); }
  55%, 100% { transform: translateY(100%); }
}

/* ==========================================================================
   Cover gate
   ========================================================================== */
.gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 8vh 6vw;
  text-align: center;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.gate[hidden] { display: none; }
.gate.is-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gate__media { position: absolute; inset: 0; overflow: hidden; }
.gate__media img { width: 100%; height: 100%; object-fit: cover; }
.gate__veil { position: absolute; inset: 0; }
.gate__inner {
  position: relative;
  display: grid;
  gap: 16px;
  justify-items: center;
  max-width: 420px;
}
.gate__monogram { width: 92px; }
.gate__to { margin: 0; font-size: 0.9rem; letter-spacing: 0.3em; text-transform: uppercase; }
.gate__guest {
  margin: 0;
  font-family: var(--script);
  font-size: 3.2rem;
  line-height: 1;
}
.gate__note { margin: 0; font-size: 0.95rem; max-width: 34ch; }

body.is-locked { overflow: hidden; }

/* ==========================================================================
   Floating controls + bottom nav
   ========================================================================== */
.audio-toggle {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + 16px);
  z-index: 70;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fab-bg);
  color: var(--fab-ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.audio-toggle svg { width: 20px; height: 20px; }
.audio-toggle .icon-off { display: none; }
.audio-toggle[aria-pressed='false'] .icon-on { display: none; }
.audio-toggle[aria-pressed='false'] .icon-off { display: block; }
.audio-toggle[hidden] { display: none; }

.navbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  color: var(--nav-ink);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
}
.navbar a {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.68;
  transition: opacity 0.2s var(--ease);
}
.navbar a svg { width: 19px; height: 19px; }
.navbar a[aria-current='true'],
.navbar a:hover { opacity: 1; }

/* the monogram in the bar — only used once the bar moves to the top */
.navbar__brand { display: none; }

/* keep the bar and the music button glued to the centred column */
@media (min-width: 640px) {
  .navbar {
    left: 50%;
    right: auto;
    margin-left: calc(var(--col) / -2);
    width: var(--col);
  }
  .audio-toggle { right: calc(50% - var(--col) / 2 + 14px); }
}


/* ==========================================================================
   Reveal on scroll
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay='1'] { transition-delay: 0.12s; }
.reveal[data-delay='2'] { transition-delay: 0.24s; }
.reveal[data-delay='3'] { transition-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* toast for the copy button */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 22px);
  z-index: 95;
  transform: translate(-50%, 14px);
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 0.9rem;
  background: var(--toast-bg);
  color: var(--toast-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
