/* ============================================================
   Igor & Vanessa — 28.11.26
   Palette and type sampled from the printed invitation suite:
   cream main invite, olive suede detail cards, blush RSVP oval.
   ============================================================ */

:root {
  /* palette per the couple's mood board (Binh Minh) */
  --cream:       #ffffff; /* hero / topbar / footer background */
  --beige:       #f7f4d5; /* light text on dark, traditions bg */
  --olive:       #0a3323; /* dark green — itinerary bg */
  --olive-deep:  #105666; /* midnight green — details bg */
  --olive-text:  #f7f4d5;
  --olive-head:  #f7f4d5;
  --blush:       #a2584a; /* deep rosy terracotta — RSVP bg (darkened so beige text stays readable) */
  --moss:        #62733f; /* deep moss — Finer Details bg (same reason) */
  --ink:         #0a3323; /* main text on light/rosy sections */
  --ink-soft:    #666b43; /* dark olive text on white (hero) */
  --gold:        #839958; /* moss green accents */
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Prata", Georgia, serif;
  color: var(--ink);
  background: var(--cream);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.script {
  font-family: "Imperial Script", "Great Vibes", cursive;
  font-weight: 400;
  line-height: 1.1;
  word-spacing: 0.18em; /* Imperial Script's space glyph is nearly zero-width */
}
.script .amp { margin: 0 0.07em; }
/* Imperial Script ships Vietnamese glyphs (verified), Great Vibes is the fallback */

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.82); /* fallback: color-mix needs iOS 16.2+ */
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(102, 107, 67, 0.12);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

.monogram {
  font-family: "Prata", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.28em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: clamp(0.9rem, 2.5vw, 1.75rem);
  align-items: center;
}

.topnav a {
  font-family: "Prata", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap; /* VI labels wrapped to two lines at tablet widths */
}
.topnav a:hover { color: var(--ink); }

.topnav .nav-rsvp {
  border: 1px solid var(--ink);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  color: var(--ink);
}
.topnav .nav-rsvp:hover { background: var(--ink); color: var(--cream); }

.lang {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: "Prata", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.lang button {
  border: none;
  background: none;
  font: inherit;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.15rem 0.2rem;
  white-space: nowrap;
}
.lang button[aria-pressed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* the anchor links go first; Guide + RSVP stay reachable on every width */
@media (max-width: 900px) {
  .topnav a:not(.nav-rsvp):not(.nav-guide) { display: none; }
}
@media (max-width: 540px) {
  .topbar { gap: 0.55rem; padding-left: 0.7rem; padding-right: 0.7rem; }
  .topnav { gap: 0.7rem; }
  .monogram { letter-spacing: 0.15em; }
  .lang { font-size: 0.74rem; gap: 0.2rem; }
  .lang > span { display: none; } /* the · separator */
  .lang button { padding: 0.15rem 0.05rem; }
}
@media (max-width: 430px) {
  /* phones: on the INDEX the hero names sit right below, so its monogram is
     redundant; on the guide the monogram is the back-link and keeps .monogram-keep */
  .monogram:not(.monogram-keep) { display: none; }
  /* the guide keeps its monogram — compact everything so 'Tiếng Việt' fits */
  .monogram-keep { letter-spacing: 0.05em; }
  .topnav { margin-left: 0; margin-right: auto; }
  .topnav a { font-size: 0.74rem; }
  .topnav .nav-rsvp { padding: 0.25rem 0.65rem; }
  .lang { font-size: 0.7rem; }
}
@media (max-width: 480px) {
  .btn { letter-spacing: 0.14em; } /* long VI labels need the room */
}
@media (max-width: 400px) {
  .topbar { gap: 0.45rem; padding-left: 0.55rem; padding-right: 0.55rem; }
  .topnav { gap: 0.5rem; }
  .topnav a { font-size: 0.7rem; }
}
@media (max-width: 360px) {
  /* tiny phones: the guide monogram already links back to the invitation */
  .topnav a[data-i18n="nav.invite"] { display: none; }
}

/* ---------- sections ---------- */

.sec {
  position: relative;
  padding: clamp(4.5rem, 9vw, 7.5rem) clamp(1.25rem, 5vw, 2.5rem);
  scroll-margin-top: 4rem;
  overflow: hidden;
}
/* in-section anchors (e.g. guide.html#venue) must clear the fixed topbar too */
.detail[id] { scroll-margin-top: 4.5rem; }

/* subtle paper grain, like the suede card stock */
.sec::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.06'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin: 0 auto;
}
.wrap.narrow { max-width: 38rem; }

.sec--cream { background: var(--cream); color: var(--ink); }
.sec--beige { background: var(--beige); color: var(--ink); }
.sec--blush { background: var(--blush); color: var(--ink); }

/* white surfaces use the dark-olive text the couple picked (#666b43) */
.hero, .topbar, .footer { --ink: #666b43; --ink-soft: #666b43; }
.hero { color: var(--ink); }

.sec--olive {
  background: var(--olive);
  color: var(--olive-text);
}
.sec--olive-deep {
  background: var(--moss); /* deep moss — dark surface now, so it carries the same beige text as the itinerary */
  color: var(--olive-text);
}
.sec--olive-deep .btn {
  color: var(--olive-head);
  border-color: var(--olive-head);
}
.sec--olive-deep .btn:hover { background: var(--olive-head); color: var(--moss); }

/* RSVP section is a dark surface too — beige text like the itinerary */
.sec--blush .sec-title,
.sec--blush .prose,
.sec--blush .success { color: var(--beige); }
.sec--blush .privacy-note { color: var(--beige); opacity: 1; }
.sec--blush .field label,
.sec--blush .field legend { color: var(--beige); }
.sec--blush .field label em,
.sec--blush .field legend em { color: var(--beige); }
.sec--blush .field input,
.sec--blush .field textarea {
  border-color: rgba(247, 244, 213, 0.7);
  border-color: color-mix(in srgb, var(--beige) 70%, transparent);
}
.sec--blush .field input::placeholder,
.sec--blush .field textarea::placeholder {
  color: rgba(10, 51, 35, 0.78);
  color: color-mix(in srgb, var(--ink) 78%, transparent);
}
.sec--blush .field input:focus-visible,
.sec--blush .field textarea:focus-visible,
.sec--blush .pill input:focus-visible + span { outline-color: var(--beige); }
.sec--blush .checks input { accent-color: var(--beige); }
.sec--blush .pill span { border-color: var(--beige); color: var(--beige); }
.sec--blush .pill input:checked + span { background: var(--beige); color: var(--blush); }
.sec--blush .btn:not(.btn--solid) { color: var(--beige); border-color: var(--beige); }
.sec--blush .btn:not(.btn--solid):hover { background: var(--beige); color: var(--blush); }
.sec--blush .form-error { color: var(--beige); text-decoration: underline; text-underline-offset: 3px; }

/* Ha Long Bay photo ghosted behind the itinerary; falls back to flat color */
#itinerary {
  background-image:
    linear-gradient(color-mix(in srgb, var(--olive) 92%, transparent),
                    color-mix(in srgb, var(--olive) 96%, transparent)),
    url("assets/halong.jpg");
  background-size: cover;
  background-position: center;
}

/* lotus-field photo in an arch-top frame (traditions) */
.arch-photo {
  display: block;
  width: min(300px, 68vw);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  margin: 0 auto clamp(2rem, 5vw, 2.8rem);
  border-radius: 999px 999px 8px 8px;
  border: 1px solid rgba(131, 153, 88, 0.65);
  border: 1px solid color-mix(in srgb, var(--gold) 65%, transparent);
  padding: 8px;
  background: var(--cream);
  box-shadow: 0 12px 30px -18px rgba(10, 51, 35, 0.45);
}

.sec-title {
  text-align: center;
  font-size: clamp(3rem, 8vw, 4.5rem);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}
.sec--olive .sec-title { color: var(--olive-head); }

/* ---------- hero ---------- */

.hero {
  min-height: 100vh; /* fallback: svh needs iOS 15.4+ */
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 6rem;
}

.lotus {
  position: absolute;
  right: clamp(-3rem, 2vw, 6rem);
  bottom: 6%;
  width: clamp(200px, 34vw, 380px);
  color: var(--ink);
  opacity: 0.28;
  z-index: 0;
}

/* the couple's lotus & goldfish line art (assets/lotus.png): strokes pre-tinted
   the hero olive (#666b43) with real alpha; fills the full height of the hero */
.lotus-img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: right bottom;
  opacity: 0.45;
  z-index: 0;
  pointer-events: none;
}

.hero-wrap { max-width: 42rem; }

.eyebrow {
  font-family: "Prata", Georgia, serif;
  font-size: clamp(0.8rem, 2.4vw, 0.95rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.names {
  font-size: clamp(3.4rem, 12vw, 6.5rem);
  margin: 1.2rem 0 0.8rem;
}

.lede {
  font-family: "Prata", Georgia, serif;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  line-height: 2.1;
  white-space: pre-line; /* the dict string carries the intentional line break */
  text-wrap: balance;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 auto;
}
/* VI lines are longer than the authored break allows on phones — wrap naturally there */
@media (max-width: 480px) {
  html[lang="vi"] .lede { white-space: normal; }
}

/* never break inside the bride's name */
.names [data-i18n="hero.bride"],
.foot-script [data-i18n="hero.bride"] { white-space: nowrap; }

/* consecutive prose paragraphs (traditions) need breathing room */
.prose + .prose { margin-top: 1.1rem; }

.bigdate {
  font-family: "Prata", Georgia, serif;
  font-weight: 400; /* Prata ships a single weight */
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  letter-spacing: 0.12em;
  margin-top: 2.4rem;
}

.venue {
  font-family: "Prata", Georgia, serif;
  font-size: clamp(0.85rem, 2.6vw, 1rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin: 0.7rem 0 2.4rem;
  color: var(--ink-soft);
}
.venue a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.venue a:hover { color: var(--ink); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  text-wrap: balance;
  font-family: "Prata", Georgia, serif;
  font-size: 0.88rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.8rem 1.9rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.btn:hover { background: var(--ink); color: var(--cream); }

.btn--solid {
  background: var(--ink);
  color: var(--beige);
  border-color: var(--ink);
  width: 100%;
  margin-top: 0.5rem;
}
.btn--solid:hover { background: #06251a; color: var(--beige); }
.btn[disabled] { opacity: 0.6; cursor: default; }
/* greyed-out submit until every mandatory field is filled */
.btn--solid[disabled],
.btn--solid[disabled]:hover,
.btn--solid.is-incomplete,
.btn--solid.is-incomplete:hover {
  background: #55584f;
  border-color: #55584f;
  color: rgba(247, 244, 213, 0.7);
  cursor: not-allowed;
  opacity: 1;
}

/* mandatory-field marker: ::after survives i18n textContent swaps */
.req::after { content: " *"; }
.req-note {
  font-size: 0.85rem;
  margin: 0.2rem 0 1.2rem;
  opacity: 0.85;
}

/* ---------- timeline (itinerary) ---------- */

.timeline {
  list-style: none;
  max-width: 34rem;
  margin: 0 auto;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 0.4rem; bottom: 0.4rem;
  left: 7.2rem;
  width: 1px;
  background: rgba(247, 244, 213, 0.45);
  background: color-mix(in srgb, var(--olive-text) 45%, transparent);
}

.timeline li {
  display: grid;
  grid-template-columns: 5.6rem 3.2rem 1fr;
  align-items: start;
  margin-bottom: 2.4rem;
}
.timeline li:last-child { margin-bottom: 0; }

.tl-date {
  font-family: "Prata", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-align: right;
  padding-top: 0.15rem;
  color: var(--olive-head);
}

.tl-mark {
  justify-self: center;
  width: 3.2rem;
  display: flex;
  justify-content: center;
  padding-top: 0.38rem;
}
.tl-dot {
  width: 8px; height: 8px;
  background: var(--olive-head);
  transform: rotate(45deg);
  display: inline-block;
}

.tl-body h3 {
  font-family: "Prata", Georgia, serif;
  font-weight: 400;
  font-size: 1.06rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive-head);
}
.tl-body .place {
  font-style: italic;
  font-size: 1rem;
  color: rgba(247, 244, 213, 0.85);
  color: color-mix(in srgb, var(--olive-text) 85%, transparent);
}

@media (max-width: 480px) {
  .timeline::before { left: 5.7rem; }
  .timeline li { grid-template-columns: 4.4rem 2.6rem 1fr; }
  .tl-date { font-size: 0.95rem; }
  .tl-mark { width: 2.6rem; }
}

/* ---------- finer details ---------- */

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 3rem) clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}
@media (max-width: 640px) {
  .details-grid { grid-template-columns: 1fr; }
}

.details-more {
  text-align: center;
  margin-top: clamp(2.2rem, 5vw, 3rem);
}

.detail h3 {
  font-family: "Prata", Georgia, serif;
  font-weight: 400;
  font-size: 1.02rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--olive-head);
  margin-bottom: 0.6rem;
}
.detail p { color: var(--olive-text); }
.detail p a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------- traditions ---------- */

.prose { text-align: left; }
.prose.center, .wrap.narrow .prose { text-align: center; }

.soon {
  text-align: center;
  margin-top: 1.6rem;
  font-family: "Prata", Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink); /* moss-on-beige failed contrast (2.9:1) */
  opacity: 0.65;
}

/* ---------- RSVP form ---------- */

#rsvp .prose { margin-bottom: 2.5rem; }

#rsvp-form {
  max-width: 30rem;
  margin: 0 auto;
}

.hp { position: absolute; left: -9999px; top: -9999px; }

.field { margin-bottom: 1.35rem; }

.field label,
.field legend {
  display: block;
  font-family: "Prata", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
  color: var(--ink);
}
.field label em, .field legend em {
  text-transform: none;
  letter-spacing: 0.05em;
  font-style: italic;
  color: var(--ink-soft);
}

fieldset.field { border: none; }

.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="date"],
.field textarea {
  width: 100%;
  font-family: "Prata", Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  background: color-mix(in srgb, #ffffff 42%, transparent);
  border: 1px solid rgba(10, 51, 35, 0.38);
  border: 1px solid color-mix(in srgb, var(--ink) 38%, transparent);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}
.field input:focus-visible,
.field textarea:focus-visible,
.pill input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.field input::placeholder, .field textarea::placeholder {
  color: rgba(10, 51, 35, 0.45);
  color: color-mix(in srgb, var(--ink) 45%, transparent);
  font-style: italic;
}

.field-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}
.field-row .field.grow { min-width: 0; } /* date inputs' intrinsic width clipped the row on 375px phones */
.stay-dates { margin-top: 1.1rem; }
#guestnames-field[hidden], #stay-tbd-wrap[hidden] { display: none; }
.alt-options { margin-top: 0.6rem; }
.alt-options label { font-size: 0.92rem; margin-bottom: 0.25rem; }
.field input:disabled { opacity: 0.45; }
.stay-dates[hidden] { display: none; } /* .field-row's display:flex would beat the hidden attribute */
@media (max-width: 400px) {
  .field-row { flex-wrap: wrap; }
}
.field-row .field { flex: 0 0 auto; margin-bottom: 1.35rem; }
.field-row .field.grow { flex: 1 1 auto; }
.field-row .field:first-child:not(.grow) { width: 7.5rem; }

.pills { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; }
.pill span {
  display: inline-block;
  font-family: "Prata", Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.pill input:checked + span { background: var(--ink); color: var(--beige); }

.checks label {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  font-size: 1.02rem;
}
.checks input { accent-color: var(--ink); width: 1rem; height: 1rem; }

#rsvp-form.is-declining .logistics { display: none; }

.form-error {
  color: #5c1f14;
  font-style: italic;
  margin: 0.8rem 0;
  text-align: center;
}

.privacy-note {
  font-style: italic;
  font-size: 0.86rem;
  line-height: 1.6;
  text-align: center;
  margin-top: 1.4rem;
  opacity: 0.75;
}

.success {
  text-align: center;
  padding: 2.5rem 0 1rem;
}
.success-h { font-size: clamp(2.6rem, 8vw, 3.6rem); margin-bottom: 1rem; }

/* ---------- footer ---------- */

.footer {
  background: var(--cream);
  color: var(--ink); /* applies the footer's olive --ink override (was inheriting body ink) */
  text-align: center;
  padding: 3.5rem 1.5rem 3rem;
  border-top: 1px solid rgba(102, 107, 67, 0.1);
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}
.foot-script { font-size: 2.2rem; }
.foot-line {
  font-family: "Prata", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}

/* ---------- reveal on scroll ---------- */

/* Hidden state applies only once JS has actually started (html.js is added by
   the first line of each page's script) — if scripts fail or are blocked,
   content stays visible instead of the whole site rendering blank. */
html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Vietnamese typography ----------
   Prata ships no italic (browsers fake-slant it, which mangles diacritics),
   and wide tracking on UPPERCASE Vietnamese visually detaches tone marks. */
html[lang="vi"] .lede,
html[lang="vi"] .place,
html[lang="vi"] .g-intro,
html[lang="vi"] .g-note,
html[lang="vi"] .form-error,
html[lang="vi"] .privacy-note,
html[lang="vi"] .field label em,
html[lang="vi"] .field legend em,
html[lang="vi"] .field input::placeholder,
html[lang="vi"] .field textarea::placeholder {
  font-style: normal;
}

html[lang="vi"] .eyebrow { letter-spacing: 0.14em; }
html[lang="vi"] .lede { letter-spacing: 0.1em; }
html[lang="vi"] .venue { letter-spacing: 0.14em; }
html[lang="vi"] .btn { letter-spacing: 0.1em; }
html[lang="vi"] .topnav a { letter-spacing: 0.1em; }
html[lang="vi"] .field label,
html[lang="vi"] .field legend { letter-spacing: 0.08em; }
html[lang="vi"] .detail h3 { letter-spacing: 0.12em; }
html[lang="vi"] .tl-body h3 { letter-spacing: 0.08em; }
html[lang="vi"] .pill span { letter-spacing: 0.08em; }
html[lang="vi"] .g-table th { letter-spacing: 0.08em; }
html[lang="vi"] .soon { letter-spacing: 0.14em; }

/* Vietnamese speakers don't need Vietnamese lessons — hide the offer and the
   entire phrase-book section ("Một chút tiếng Việt") in the Vietnamese view */
html[lang="vi"] .lesson-field,
html[lang="vi"] .lesson-en-only,
html[lang="vi"] #phrases { display: none; }
