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

:root {
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body-size: 1.05rem;
  --body-weight: 300;
  --body-leading: 1.7;
  --body-tracking: 0.04em;
  --heading-size: 1.6rem;
  --heading-tracking: 0.12em;
  --footer-size: clamp(1.2rem, 3vw, 2rem);
  --bg: #f5f2ec;
}

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
}

img { display: block; }

/* ---------- Typography ---------- */
/* body text: content, menu, playlist, form */
main,
#menu p,
#song-title,
#hero-rsvp,
#rsvp-form label,
#rsvp-form input,
#rsvp-form textarea,
#rsvp-form button,
#rsvp-status {
  font-family: var(--font);
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-leading);
  letter-spacing: var(--body-tracking);
}

/* footer text */
#finale p,
.schedule-item span {
  font-family: var(--font);
  font-size: var(--footer-size);
  font-weight: var(--body-weight);
  letter-spacing: var(--body-tracking);
}

/* ---------- Fixed transparent header ---------- */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 2rem;
  z-index: 10;
  color: #ffffff;
  transition: background 0.3s ease;
}

@media (max-width: 1000px) {
  #header {
    padding: 0 calc(max((100% - 800px) / 2, 0px) + 1.5rem);
  }

  #header.scrolled {
    background: var(--bg);
  }
}

/* ---------- Music controls under the hero logo ---------- */
#music-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #ffffff;
}

#music-controls .buttons {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

#music-controls button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

#music-controls button:hover { opacity: 1; }

#music-toggle .icon-pause { display: none; }
body.playing #music-toggle .icon-pause { display: block; }
body.playing #music-toggle .icon-play { display: none; }

#song-title {
  color: #ffffff;
  text-align: center;
}

#hero-rsvp {
  margin-top: 0.75rem;
  color: #ffffff;
  background: transparent;
  border: 2px solid #ffffff;
  border-radius: 4px;
  padding: 0.9rem 2.5rem;
  text-decoration: none;
  filter: opacity(1);
  transition: filter 0.2s ease;
}

#hero-rsvp:hover { filter: opacity(0.7); }

/* ---------- Hero reveal: fade content in after the intro slides up ---------- */
#hero-logo,
#music-controls .buttons,
#song-title,
#hero-rsvp,
#menu-toggle,
#lang-toggle {
  opacity: 0;
}

body.hero-ready #hero-logo {
  animation: heroFadeIn 0.8s ease 0s forwards;
}

body.hero-ready #music-controls .buttons,
body.hero-ready #song-title {
  animation: heroFadeIn 0.8s ease 0.3s forwards;
}

body.hero-ready #hero-rsvp {
  animation: heroFadeIn 0.8s ease 0.6s forwards;
}

body.hero-ready #menu-toggle {
  animation: heroFadeIn 0.8s ease 0.9s forwards;
}

body.hero-ready #lang-toggle {
  animation: heroFadeIn 0.8s ease 0.9s forwards;
}

@keyframes heroFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#menu-toggle {
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: end;
  justify-content: center;
  gap: 8px;
  width: 40px;
  height: 40px;
}

/* ---------- Language toggle (left of the hamburger) ---------- */
#lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1.25rem;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
}

#lang-toggle span {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

#lang-toggle:not(.is-th) .lang-en,
#lang-toggle.is-th .lang-th {
  opacity: 1;
}

#menu-toggle span {
  display: block;
  height: 2px;
  width: 36px;
  background: currentColor;
  transition: transform 0.3s ease, width 0.3s ease, color 0.3s ease;
}

/* two-line hamburger: second line shorter */
#menu-toggle span:last-child { width: 24px; }

/* animate into an X when open */
body.menu-open #menu-toggle span:first-child {
  width: 36px;
  transform: translateY(5px) rotate(45deg);
}
body.menu-open #menu-toggle span:last-child {
  width: 36px;
  transform: translateY(-5px) rotate(-45deg);
}

/* ---------- Menu overlay ---------- */
#menu {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

body.menu-open #menu {
  opacity: 1;
  visibility: visible;
}

#menu p {
  color: #1a1a1a;
}

.event-info {
  text-align: center;
}

.event-info p + p {
  margin-top: 1.5rem;
}

.schedule {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  align-items: center;
  justify-items: center;
  gap: 1.25rem 2rem;
}

.separator {
  width: 89px;
  height: auto;
  margin: 2.5rem auto;
}

.schedule-item {
  min-width: 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.schedule-item img {
  height: 2.5rem;
  width: auto;
}

.schedule-item span {
  color: #ffffff;
}

#finale .footer-date {
  font-family: "Imperial Script", cursive;
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

#finale .save-the-date {
  font-family: "Fleur De Leah", cursive;
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 1.1;
}

/* Thai: hide the decorative "Save The Date!" line (the Latin display fonts
   have no Thai glyphs) and keep the finale text on the address font */
body.lang-th #finale .save-the-date {
  display: none;
}

body.lang-th #finale .footer-date {
  margin-top: 0;
  font-family: var(--font);
  font-size: var(--footer-size);
  font-weight: var(--body-weight);
  letter-spacing: var(--body-tracking);
}

body.lang-th .schedule-item span {
  font-family: var(--font);
  font-size: var(--footer-size);
  font-weight: var(--body-weight);
  letter-spacing: var(--body-tracking);
}

.footer-date {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 1.25rem;
}

.footer-date .date-weekday {
  justify-self: end;
}

.footer-date .date-year {
  justify-self: start;
}

.footer-date .date-bar {
  width: 1px;
  align-self: stretch;
  background: #ffffff;
}

.footer-date .date-daymonth {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

/* ---------- Intro: green bg + white logo fade in ---------- */
#intro {
  position: fixed;
  inset: 0;
  background: #464C29;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: transform 1.2s ease;
}

#intro-logo {
  height: min(55vh, 440px);
  width: auto;
  opacity: 0;
  animation: logoFadeIn 1.6s ease 0.3s forwards;
}

@keyframes logoFadeIn { to { opacity: 1; } }

#intro.leave { transform: translateY(-100%); pointer-events: none; }
#intro.gone { display: none; }

/* ---------- Hero: full page image + dark overlay + logo ---------- */
#hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hero .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

#hero-logo {
  height: min(55vh, 440px);
  width: auto;
}

/* ---------- Content ---------- */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  color: #1a1a1a;
  will-change: opacity;
}

main p { margin-bottom: 2rem; text-align: justify; }

/* Thai paragraphs read better centered than justified */
body.lang-th main p { text-align: center; }

/* drop cap */
p.dropcap { margin-bottom: 4rem; }

p.dropcap::first-letter {
  float: left;
  font-size: 4.2em;
  font-weight: 700;
  line-height: 0.82;
  padding-right: 0.12em;
  padding-top: 0.05em;
}

/* Thai script has no drop cap; keep the paragraph plain */
body.lang-th .dropcap::first-letter {
  float: none;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  padding: 0;
}

/* full-width-of-container images */
img.full {
  width: 100%;
  height: auto;
  margin: 0 0 1.5rem;
}

/* ---------- grid layout variations ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
  margin: 0 0 1.5rem;
}

.grid img {
  width: 100%;
  height: auto;
}

.grid {
  grid-template-columns: 1fr 1fr;
}

.grid img:nth-child(odd):last-child {
  grid-column: 1 / -1;
}

/* the last grid sits directly above the RSVP section, which supplies the gap */
main > div:last-of-type {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .footer-date {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.25rem;
  }

  .footer-date .date-weekday,
  .footer-date .date-year {
    justify-self: center;
  }

  .footer-date .date-bar {
    display: none;
  }
}

/* ---------- Finale: green section, white text ---------- */
#finale {
  position: relative;
  min-height: 100vh;
  background: #464C29;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 5rem 1.5rem;
  overflow: hidden;
}

#finale .finale-rose {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 72vh, 1200px);
  height: auto;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

#finale .event-info,
#finale .mapswrapper {
  position: relative;
  z-index: 1;
}

#finale .event-info {
  width: 100%;
}

#finale p {
  color: #ffffff;
  text-align: center;
}

#finale .footer-note {
  font-size: 0.85em;
}

#finale .mapswrapper {
  max-width: 100%;
}

#finale .mapswrapper iframe {
  max-width: 100%;
}

/* ---------- RSVP form ---------- */
#rsvp {
  padding-top: 5rem;
}

#rsvp h2 {
  font-family: var(--font);
  font-size: var(--heading-size);
  font-weight: var(--body-weight);
  letter-spacing: var(--heading-tracking);
  text-transform: uppercase;
  text-align: left;
  margin-bottom: 2.5rem;
}

#rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#rsvp-form label {
  display: block;
  margin-bottom: 0.5rem;
}

#rsvp-form label:has(+ [required])::after {
  content: " *";
  color: #a33;
}

#rsvp-form input[type="text"],
#rsvp-form input[type="number"],
#rsvp-form textarea {
  width: 100%;
  color: #1a1a1a;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #1a1a1a;
  padding: 0.5rem 0;
  border-radius: 0;
}

#rsvp-form textarea {
  resize: vertical;
  min-height: 6rem;
}

#rsvp-form input::placeholder,
#rsvp-form textarea::placeholder {
  color: #1a1a1a;
  opacity: 0.4;
}

#rsvp-form input:focus,
#rsvp-form textarea:focus {
  outline: none;
  border-bottom-color: #464C29;
}

#rsvp-form .honey {
  display: none;
}

#rsvp-form button {
  align-self: center;
  color: #1a1a1a;
  background: transparent;
  border: 2px solid #1a1a1a;
  border-radius: 4px;
  padding: 0.9rem 2.5rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#rsvp-form button:hover { opacity: 0.7; }
#rsvp-form button:disabled { opacity: 0.5; cursor: default; }

#rsvp-status {
  text-align: center;
  min-height: 1.2em;
  margin: 0;
}

#rsvp-status.success { color: #464C29; }
#rsvp-status.error { color: #a33; }
