/* ==================================================================
 * BASE — layout & mechanics only. Themes set the look by overriding
 * the custom properties below and styling .deco, cards, etc.
 * ================================================================== */
:root {
  --bg: #fff;
  --bg-alt: #f6f6f6;
  --surface: #fff;
  --ink: #222;
  --muted: #666;
  --line: rgba(0, 0, 0, .12);
  --accent: #c0504d;
  --accent-2: #e0a040;
  --accent-3: #3a8f86;
  --accent-4: #6b4c8a;
  --on-accent: #fff;

  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-script: "Brush Script MT", cursive;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
  --maxw: 1080px;
  --section-pad: clamp(4.5rem, 10vw, 8rem);
  --nav-h: 64px;

  /* envelope */
  --env-w: min(360px, 78vw);
  --env-back: #d9c7a8;
  --env-front: #ead9bb;
  --env-flap: #e2cfae;
  --letter: #fffdf7;
  --seal: var(--accent);
  --cover-bg: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.container {
  position: relative;
  z-index: 1;
  width: min(var(--maxw), 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .9em 2em;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1 var(--font-body);
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }
.btn--small { padding: .6em 1.3em; font-size: .875rem; }

/* ---------- decorations (themes decide what these look like) ---------- */
.deco { position: absolute; pointer-events: none; z-index: 0; display: none; }

/* ---------- nav ---------- */
.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  transition: background .3s, box-shadow .3s, transform .5s;
}
.site-nav.is-scrolled { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
.site-nav__inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--nav-h); }
.site-nav__brand { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; text-decoration: none; flex: none; }
.site-nav__links {
  display: flex; gap: 1.4rem; list-style: none; margin: 0 0 0 auto; padding: 0;
  overflow-x: auto; scrollbar-width: none; white-space: nowrap;
}
.site-nav__links::-webkit-scrollbar { display: none; }
.site-nav__links a { text-decoration: none; font-size: .95rem; padding-block: .4rem; display: inline-block; }
.site-nav__links a:hover { color: var(--accent); }
html:not(.site-ready) .site-nav { transform: translateY(-110%); }
@media (max-width: 640px) {
  .site-nav__inner { gap: 1rem; }
  .site-nav__links { gap: 1rem; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .site-nav__links a { font-size: .85rem; }
}

/* ---------- section heads ---------- */
.section { padding-block: var(--section-pad); position: relative; overflow: hidden; }
.section-head { text-align: center; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section-kicker { font-family: var(--font-script); font-size: 1.6rem; color: var(--accent); }
.section-title { font-size: clamp(2.3rem, 6vw, 3.8rem); position: relative; display: inline-block; }
.section-intro { max-width: 34rem; margin: 1.2rem auto 0; color: var(--muted); }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: grid; place-items: center; text-align: center; position: relative; overflow: hidden; padding-block: calc(var(--nav-h) + 2rem) 4rem; }
.hero__inner { display: grid; justify-items: center; gap: 1rem; }
.hero__personal { font-family: var(--font-script); font-size: clamp(1.4rem, 3.5vw, 2rem); color: var(--accent); }
.hero__eyebrow { text-transform: uppercase; letter-spacing: .25em; font-size: .8rem; color: var(--muted); }
.hero__names { font-size: clamp(3.2rem, 13vw, 8.5rem); display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 .3em; outline: none; }
.hero__amp { font-family: var(--font-script); font-weight: 400; color: var(--accent); }
.hero__tagline { font-size: clamp(1.1rem, 2.5vw, 1.4rem); color: var(--muted); }
.hero__date { display: grid; gap: .2rem; font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 1.6rem); margin-top: .5rem; }
.hero__place { font-family: var(--font-body); font-size: .9rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.hero__scroll { margin-top: 2rem; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; color: var(--muted); display: grid; justify-items: center; gap: .6rem; }
.hero__scroll::after { content: ""; width: 1px; height: 40px; background: currentColor; animation: scrollhint 2s ease-in-out infinite; transform-origin: top; }
@keyframes scrollhint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* hero entrance after invite opens */
.js .hero__inner > * { opacity: 0; transform: translateY(20px); }
.site-ready .hero__inner > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; }
.site-ready .hero__inner > *:nth-child(2) { animation-delay: .1s; }
.site-ready .hero__inner > *:nth-child(3) { animation-delay: .25s; }
.site-ready .hero__inner > *:nth-child(4) { animation-delay: .45s; }
.site-ready .hero__inner > *:nth-child(5) { animation-delay: .6s; }
.site-ready .hero__inner > *:nth-child(6) { animation-delay: .9s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- couple ---------- */
.couple { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: clamp(1.5rem, 4vw, 3rem); }
.couple__amp { align-self: center; font-family: var(--font-script); font-size: clamp(4rem, 10vw, 7rem); color: var(--accent); line-height: 1; }
.person { display: grid; justify-items: center; text-align: center; gap: .6rem; }
.person__portrait { width: min(260px, 64vw); aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent-2); margin-bottom: 1rem; }
.person__portrait img { width: 100%; height: 100%; object-fit: cover; }
.person__initials { font-family: var(--font-display); font-size: clamp(3rem, 9vw, 5rem); color: var(--on-accent); }
.person__role { text-transform: uppercase; letter-spacing: .2em; font-size: .78rem; color: var(--muted); }
.person__name { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.person__parents { font-style: italic; color: var(--muted); }
.person__bio { max-width: 28rem; }
@media (max-width: 760px) {
  .couple { grid-template-columns: 1fr; }
  .couple__amp { justify-self: center; }
}

/* ---------- date + countdown ---------- */
.date-card { text-align: center; display: grid; gap: .4rem; margin-bottom: 3rem; }
.date-card__date { font-family: var(--font-display); font-size: clamp(1.6rem, 4.5vw, 2.6rem); }
.date-card__time, .date-card__venue { color: var(--muted); }
.countdown { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(.8rem, 3vw, 2rem); }
.countdown__unit { display: grid; justify-items: center; align-content: center; gap: .2rem; width: clamp(5.5rem, 20vw, 9rem); aspect-ratio: 1; }
.countdown__num { font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, 3.8rem); line-height: 1; font-variant-numeric: tabular-nums; }
.countdown__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .15em; }
@media (max-width: 520px) {
  .countdown { gap: .55rem; flex-wrap: nowrap; }
  .countdown__unit { width: 20vw; }
  .countdown__num { font-size: 1.9rem; }
  .countdown__label { font-size: .58rem; letter-spacing: .08em; }
}
.countdown__done { font-family: var(--font-display); font-size: 1.6rem; text-align: center; }

/* ---------- horizontal rails (story + schedule) ---------- */
.rail { --rail-gap: clamp(1rem, 2.5vw, 1.75rem); --rail-pad: max(1.25rem, calc((100% - var(--maxw)) / 2)); position: relative; z-index: 1; }
.rail__track {
  list-style: none; margin: 0;
  display: flex; gap: var(--rail-gap);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--rail-pad);
  padding: 1rem var(--rail-pad) 2.5rem;
  scrollbar-width: none;
  outline: none;
}
.rail__track::-webkit-scrollbar { display: none; }
.rail__track:focus-visible { outline: 3px solid var(--accent-2); outline-offset: -3px; }
.rail__item { flex: none; width: var(--rail-item-w, clamp(250px, 28vw, 310px)); scroll-snap-align: start; position: relative; display: flex; flex-direction: column; }
.rail__item > .card { flex: 1; }
.rail__dot { position: relative; z-index: 1; width: 16px; height: 16px; margin: 0 0 1.25rem 1.5rem; border-radius: 50%; background: var(--accent); flex: none; }
.rail__item::before { content: ""; position: absolute; top: 7px; left: 1.5rem; right: calc(-1 * var(--rail-gap) - 1.5rem); height: 2px; background: var(--line); }
.rail__item:last-child::before { display: none; }
.rail__controls { display: none; justify-content: center; gap: .75rem; }
.rail.is-scrollable .rail__controls { display: flex; }
.rail__btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s, opacity .2s, background .2s;
}
.rail__btn:hover:not(:disabled) { transform: translateY(-2px); background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rail__btn:disabled { opacity: .3; cursor: default; }
.rail__btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }
@media (max-width: 640px) {
  .rail { --rail-item-w: 78vw; }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem 1.5rem; display: grid; gap: .35rem; align-content: start; }

/* story card */
.story-card__photo { border-radius: calc(var(--radius) / 2); margin-bottom: .6rem; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.story-card__num { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--accent); opacity: .9; }
.story-card__when { font-family: var(--font-script); font-size: 1.5rem; color: var(--accent); line-height: 1.1; }
.story-card__title { font-size: 1.45rem; }
.story-card__text { color: var(--muted); }

/* ---------- schedule ---------- */
.event__day { text-transform: uppercase; letter-spacing: .15em; font-size: .75rem; color: var(--muted); }
.event__name { font-size: 1.6rem; margin-bottom: .2rem; }
.event__time { font-weight: 700; color: var(--accent); }
.event__venue { font-weight: 600; }
.event__address, .event__dress { color: var(--muted); font-size: .95rem; }
.event__label { font-weight: 600; color: var(--ink); }
.event__map { justify-self: start; margin-top: .8rem; }

/* ---------- contact ---------- */
.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 1.5rem; max-width: 760px; margin-inline: auto; }
.contact { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem 1.6rem; display: grid; justify-items: center; text-align: center; gap: .3rem; }
.contact__avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-3); color: var(--on-accent); font-family: var(--font-display); font-size: 1.4rem; margin-bottom: .6rem; }
.contact__name { font-size: 1.5rem; }
.contact__role { color: var(--muted); margin-bottom: .6rem; }
.contact__links { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.contact__links a { display: inline-flex; gap: .6rem; text-decoration: none; }
.contact__links a:hover span:last-child { text-decoration: underline; }
.contact__label { font-weight: 700; color: var(--accent); min-width: 5.5em; text-align: right; }

/* ---------- footer ---------- */
.site-footer { text-align: center; padding: 4rem 0 calc(4rem + env(safe-area-inset-bottom, 0px)); color: var(--muted); display: grid; gap: .3rem; }
.site-footer__names { font-family: var(--font-display); font-size: 2rem; color: var(--ink); }
.site-footer__hashtag { color: var(--accent); font-weight: 700; }

/* ---------- reveal ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 90ms); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ==================================================================
 * INVITE COVER + ENVELOPE (mechanics; colours from variables)
 * ================================================================== */
.cover {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--cover-bg);
  overflow: hidden;
  padding: 1.5rem;
  transition: opacity .9s ease, transform .9s ease;
}
.cover.is-leaving { opacity: 0; transform: scale(1.08); pointer-events: none; }
.cover__inner { position: relative; z-index: 1; display: grid; justify-items: center; gap: 1.2rem; text-align: center; }
.cover__greeting { font-family: var(--font-script); font-size: clamp(2.2rem, 7vw, 3.4rem); color: var(--accent); line-height: 1.1; }
.cover__message { font-family: var(--font-display); font-size: clamp(1.1rem, 3vw, 1.5rem); max-width: 22rem; margin-bottom: 1.5rem; }
.cover__open { margin-top: 1.5rem; }
.cover__inner > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
.cover__inner > :nth-child(2) { animation-delay: .15s; }
.cover__inner > :nth-child(3) { animation-delay: .3s; }
.cover__inner > :nth-child(4) { animation-delay: .6s; }
.cover.is-open .cover__open { opacity: 0; transition: opacity .3s; }

.envelope { position: relative; width: var(--env-w); aspect-ratio: 3 / 2; perspective: 1200px; }
.envelope > * { position: absolute; }
.envelope__back { inset: 0; background: var(--env-back); border-radius: 6px; }
.envelope__letter {
  left: 6%; right: 6%; top: 6%; bottom: 4%;
  background: var(--letter); border-radius: 4px;
  display: grid; place-content: center; gap: .3rem; text-align: center;
  padding: 1rem; z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .9s cubic-bezier(.3,.7,.2,1) .55s;
}
.envelope__names { font-family: var(--font-display); font-size: clamp(1.2rem, 5vw, 1.8rem); font-weight: 700; color: var(--ink); }
.envelope__date { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.envelope__front {
  inset: 0; z-index: 3; background: var(--env-front); border-radius: 6px;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
.envelope__flap {
  left: 0; right: 0; top: 0; height: 62%; z-index: 4;
  background: var(--env-flap);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .6s ease-in, z-index 0s .3s;
}
.envelope__seal {
  left: 50%; top: 62%; z-index: 5;
  width: 3.2rem; height: 3.2rem; margin: -1.6rem 0 0 -1.6rem;
  border-radius: 50%; background: var(--seal); color: var(--on-accent);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .4s ease, opacity .4s ease;
}
.cover.is-open .envelope__seal { transform: scale(0); opacity: 0; }
.cover.is-open .envelope__flap { transform: rotateX(180deg); z-index: 1; }
.cover.is-open .envelope__letter { transform: translateY(-58%); }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
