/* =========================================================
   Secret Gardens Miami · Vendor Appreciation Holiday Party
   A digital invitation suite laid on a candlelit table:
   envelope, invitation card, prints, details card, reply card.
   Imbue (condensed Didone) for display, Jost for reading.
   Written mobile-first: most guests open this on a phone.
   ========================================================= */

/* ---------- Fonts (self-hosted, latin subset, SIL OFL) ---------- */
@font-face {
  font-family: "Imbue";
  src: url("/assets/fonts/imbue.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("/assets/fonts/jost.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* The table */
  --table: oklch(0.13 0.02 15);

  /* Card stock and its ink */
  --paper: oklch(0.955 0.013 78);
  --paper-edge: oklch(0.84 0.025 62);
  --ink: oklch(0.29 0.09 18);

  /* Envelope and wax */
  --envelope: oklch(0.31 0.1 17);
  --envelope-deep: oklch(0.22 0.075 16);
  --cherry: oklch(0.5 0.18 24);
  --cherry-deep: oklch(0.45 0.17 23);

  /* Text tokens on the dark table. Cards redefine these for ink on paper. */
  --fg: oklch(0.94 0.014 75);
  --fg-muted: oklch(0.94 0.014 75 / 0.72);
  --fg-line: oklch(0.94 0.014 75 / 0.32);
  --rule: oklch(0.94 0.014 75 / 0.14);
  --label: oklch(0.76 0.012 260);
  --on-fg: var(--ink);

  --display: "Imbue", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --w-hair: 250;
  --w-text: 400;
  --w-heavy: 780;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* breathing room between the card and the screen edge */
  --margin: clamp(0.85rem, 4vw, 2rem);

  /* z-index scale */
  --z-content: 1;
  --z-dock: 20;
  --z-grain: 30;
  --z-skip: 50;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Fine film grain over everything; on the cards it reads as paper tooth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
address { font-style: normal; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: var(--cherry); color: oklch(0.97 0.01 75); }

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: var(--z-skip);
  padding: 0.75rem 1.25rem;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-radius: 2px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- The table ----------
   A blurred photograph of the party table, fixed behind the page.
   lvh keeps it from resizing as mobile browser bars come and go. */
.table {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100lvh;
  z-index: -1;
  overflow: hidden;
  background: var(--table);
}
.table__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}
.table::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 70% at 50% 35%, transparent 0%, oklch(0.1 0.02 15 / 0.55) 75%),
    linear-gradient(oklch(0.12 0.02 15 / 0.35), oklch(0.12 0.02 15 / 0.62));
}

/* ---------- Buttons and links ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--fg);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3.25rem;
  padding: 0.85rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition:
    background-color 0.35s var(--ease-out),
    color 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out);
}
.btn:active { translate: 0 1px; }

/* Cherry: the reply actions. Cream type on the red of the tapers. */
.btn--cherry {
  --btn-bg: var(--cherry);
  --btn-fg: oklch(0.97 0.01 75);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.18) inset, 0 6px 14px -8px oklch(0.3 0.12 20 / 0.8);
}
.btn--cherry:hover { --btn-bg: var(--cherry-deep); }

.btn--ink {
  --btn-bg: var(--fg);
  --btn-fg: var(--on-fg);
}
.btn--ink:hover { --btn-bg: oklch(0.22 0.08 18); }

.btn--ghost { box-shadow: inset 0 0 0 1px var(--fg-line); }
.btn--ghost:hover {
  --btn-bg: color-mix(in oklch, var(--fg) 6%, transparent);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.link-btn {
  padding: 0;
  background: none;
  border: 0;
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.link-btn:hover { text-decoration-thickness: 2px; }

/* ---------- Small-caps label voice (as printed on a card) ---------- */
.invite__kicker,
.datebar__side,
.invite__year,
.invite__city,
.invite__attire,
.reply__kicker,
.facts dt,
.calendar__label,
.reserved__label,
.reserved__meta {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
}

/* =========================================================
   CARD STOCK
   Ivory paper, oxblood ink, an engraved double frame,
   and a visible edge so it sits on the table like a real card.
   ========================================================= */
.card {
  --fg: var(--ink);
  --fg-muted: oklch(0.29 0.09 18 / 0.78);
  --fg-line: oklch(0.29 0.09 18 / 0.55);
  --rule: oklch(0.29 0.09 18 / 0.2);
  --label: oklch(0.29 0.09 18 / 0.74);
  --on-fg: var(--paper);
  --error: oklch(0.5 0.19 27);
  --field-bg: oklch(0.29 0.09 18 / 0.04);

  position: relative;
  color: var(--fg);
  background:
    var(--card-light, radial-gradient(90% 55% at var(--mx, 28%) var(--my, 0%), oklch(1 0.01 85 / 0.6), transparent 70%)),
    var(--paper);
  border-radius: 3px;
  box-shadow:
    0 1px 0 var(--paper-edge),
    0 2px 0 oklch(0.5 0.04 35 / 0.45),
    0 14px 24px -12px rgb(0 0 0 / 0.6),
    0 40px 80px -30px rgb(0 0 0 / 0.75);
}
/* Engraved double frame */
.card::before,
.card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 1px;
}
.card::before {
  inset: 9px;
  border: 1px solid oklch(0.29 0.09 18 / 0.34);
}
.card::after {
  inset: 13px;
  border: 1px solid oklch(0.29 0.09 18 / 0.14);
}

.card__title {
  font-family: var(--display);
  font-weight: var(--w-hair);
  font-size: clamp(2.6rem, 2rem + 2.8vw, 3.75rem);
  line-height: 0.92;
  text-align: center;
}
.card__title em {
  font-style: normal;
  font-weight: var(--w-heavy);
}

/* =========================================================
   THE INVITATION
   ========================================================= */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: var(--margin);
  overflow: clip;

  /* envelope geometry, shared by every envelope part */
  --env-w: min(100vw - 2.5rem, 34rem);
  --env-h: calc(var(--env-w) / 1.42);
  --env-top: calc(50svh - var(--env-h) * 0.28);
}

.invite {
  position: relative;
  width: min(100%, 31rem);
}
.invite__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(2.4rem, 9vw, 3.4rem) clamp(1.5rem, 7vw, 3rem) clamp(2.2rem, 8vw, 3rem);
}
.invite__cover { display: none; }

.invite__logo {
  display: block;
  width: clamp(84px, 24vw, 108px);
  aspect-ratio: 800 / 625;
  background: url("/assets/img/sg-logo.webp") center / contain no-repeat; /* original colours */
}

.invite__kicker { margin-top: 1.25rem; }

.invite__title {
  display: grid;
  margin-top: 0.45rem;
  font-family: var(--display);
  font-weight: var(--w-hair);
  font-size: clamp(2.95rem, 2.2rem + 3.4vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: -0.005em;
  /* letterpress: a hairline of light under each stroke */
  text-shadow: 0 1px 0 oklch(1 0 0 / 0.7);
}
.invite__line--heavy { font-weight: var(--w-heavy); }

.invite__message {
  max-width: 31ch;
  margin-top: 1rem;
  font-size: clamp(0.94rem, 0.9rem + 0.2vw, 1rem);
  line-height: 1.55;
  color: var(--fg-muted);
}

.invite__when {
  display: grid;
  justify-items: center;
  width: 100%;
  margin-top: 1.5rem;
}

/* TUESDAY | 1 | DECEMBER, ruled like an engraved date line */
.datebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0 0.9rem;
  width: min(100%, 19rem);
}
.datebar__side {
  padding-block: 0.5rem 0.45rem;
  border-block: 1px solid oklch(0.29 0.09 18 / 0.32);
  color: var(--fg);
  letter-spacing: 0.18em;
}
.datebar__day {
  font-family: var(--display);
  font-weight: var(--w-heavy);
  font-size: clamp(3.4rem, 2.9rem + 2vw, 4.2rem);
  line-height: 0.82;
  padding-inline: 0.1em;
  text-shadow: 0 1px 0 oklch(1 0 0 / 0.7);
}
.invite__year {
  margin-top: 0.55rem;
  letter-spacing: 0.4em;
  margin-right: -0.4em; /* optically centre the tracked numerals */
}
.invite__time {
  margin-top: 0.3rem;
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem);
  line-height: 1.2;
}

.invite__venue {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  margin-top: 1.3rem;
}
.invite__place {
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem);
  line-height: 1.15;
}

.invite__attire {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  min-width: 9rem;
}

.invite__cta {
  margin-top: 1.6rem;
  width: min(100%, 17.5rem);
}

/* ---------- Desktop: a folded invitation, opened flat ----------
   Left panel: the inside of the cover, printed with the table photograph.
   Right panel: the invitation. A soft shadow marks the fold. */
@media (min-width: 960px) {
  .invite {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: min(100%, 68rem);
  }
  .invite__card {
    border-radius: 0 3px 3px 0;
    --card-light:
      linear-gradient(to right, oklch(0.32 0.05 30 / 0.22), oklch(0.32 0.05 30 / 0.06) 3%, transparent 9%),
      radial-gradient(90% 55% at var(--mx, 28%) var(--my, 0%), oklch(1 0.01 85 / 0.6), transparent 70%);
    padding: clamp(2.2rem, 5.2vh, 3.4rem) clamp(2.5rem, 4vw, 3.5rem) clamp(2rem, 4.6vh, 3rem);
  }
  .invite__cover {
    display: block;
    position: relative;
    z-index: 2;
    transform-origin: 100% 50%;
    transform-style: preserve-3d;
  }
}

/* Short laptop screens: tighten the card so the whole spread fits in one view */
@media (min-width: 960px) and (max-height: 860px) {
  .hero { padding-block: 1.25rem; }
  .invite__card { padding-block: 1.75rem 1.6rem; }
  .invite__logo { width: 84px; }
  .invite__kicker { margin-top: 0.85rem; }
  .invite__title { font-size: clamp(3.3rem, 6.4vh, 4.4rem); }
  .invite__message { margin-top: 0.7rem; font-size: 0.92rem; line-height: 1.5; }
  .invite__when { margin-top: 1rem; }
  .datebar__day { font-size: clamp(3rem, 5.8vh, 4.2rem); }
  .invite__venue { margin-top: 0.85rem; }
  .invite__attire { margin-top: 0.6rem; padding-top: 0.6rem; }
  .invite__cta { margin-top: 1.1rem; min-height: 3rem; }
}

.invite__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
/* Card stock with the photograph printed inside a narrow paper margin */
.invite__face--inside {
  overflow: hidden;
  padding: 12px 0 12px 12px;
  border-radius: 3px 0 0 3px;
  background: var(--paper);
  box-shadow:
    0 2px 0 oklch(0.3 0.04 30 / 0.6),
    0 14px 24px -12px rgb(0 0 0 / 0.6),
    0 40px 80px -30px rgb(0 0 0 / 0.75);
}
.invite__face--inside picture,
.invite__face--inside img {
  display: block;
  width: 100%;
  height: 100%;
}
.invite__face--inside img {
  object-fit: cover;
  object-position: 58% 40%;
  border-radius: 1px;
}
/* the fold, and a little candlelight falloff toward the bottom */
.invite__face--inside::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to left, rgb(0 0 0 / 0.42), rgb(0 0 0 / 0.1) 4%, transparent 12%),
    linear-gradient(to top, rgb(0 0 0 / 0.22), transparent 26%);
}

/* The outside of the cover, seen only while the card opens */
.invite__face--front {
  transform: rotateY(180deg);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.75rem;
  border-radius: 0 3px 3px 0;
  color: var(--ink);
  background:
    radial-gradient(90% 55% at 70% 0%, oklch(1 0.01 85 / 0.6), transparent 70%),
    var(--paper);
  box-shadow:
    0 2px 0 oklch(0.5 0.04 35 / 0.45),
    0 14px 24px -12px rgb(0 0 0 / 0.6),
    0 40px 80px -30px rgb(0 0 0 / 0.75);
}
.invite__face--front::before,
.invite__face--front::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 1px;
}
.invite__face--front::before { inset: 9px; border: 1px solid oklch(0.29 0.09 18 / 0.34); }
.invite__face--front::after { inset: 13px; border: 1px solid oklch(0.29 0.09 18 / 0.14); }
.invite__front-logo {
  width: 9.5rem;
  aspect-ratio: 800 / 625;
  background: url("/assets/img/sg-logo.webp") center / contain no-repeat; /* original colours */
}
.invite__front-line {
  font-family: var(--display);
  font-weight: var(--w-hair);
  font-size: 3.4rem;
  line-height: 1;
}

/* Desktop pointer: the card tilts a little toward the pointer, and the light moves with it */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .invite {
    transform: perspective(2200px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    transition: transform 0.9s var(--ease-out);
  }
}

/* =========================================================
   THE ENVELOPE (opening intro only; see intro.js and app.js)
   Parts are siblings of the card so the card can sit between
   the back and the front pocket while it slides out.
   ========================================================= */
/* Out of flow, and with no z-index, so its parts share the hero's stacking context with the card */
.envelope {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
html.intro .envelope { display: block; }
html.intro .invite { z-index: 2; }
html.intro:not(.intro-run) .invite { visibility: hidden; }

.envelope > * {
  position: absolute;
  left: calc(50% - var(--env-w) / 2);
  top: var(--env-top);
  width: var(--env-w);
  height: var(--env-h);
  pointer-events: none;
  animation: envelope-in 0.7s var(--ease-expo) backwards;
}

.envelope__back {
  z-index: 1;
  border-radius: 3px;
  background: var(--envelope-deep);
  box-shadow: 0 30px 60px -24px rgb(0 0 0 / 0.85);
  overflow: hidden;
}
/* The liner: a photograph inside the envelope */
.envelope__back::before {
  content: "";
  position: absolute;
  inset: 5% 5% 30%;
  background: url("/assets/img/red-tapers-600.webp") center 30% / cover;
  opacity: 0.85;
}

.envelope__pocket {
  z-index: 3;
  border-radius: 0 0 3px 3px;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 50,54 0,100' fill='black' fill-opacity='.16'/%3E%3Cpolygon points='100,0 50,54 100,100' fill='black' fill-opacity='.16'/%3E%3Cpolygon points='0,100 50,60 100,100' fill='white' fill-opacity='.05'/%3E%3Cpolyline points='0,100 50,60 100,100' fill='none' stroke='black' stroke-opacity='.4' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3Cpolyline points='0,0 50,54 100,0' fill='none' stroke='white' stroke-opacity='.14' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat,
    var(--envelope);
}
.envelope__to {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13%;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.15rem, 0.9rem + 1.6vw, 1.6rem);
  line-height: 1.2;
  text-align: center;
  color: var(--fg);
  opacity: 0.94;
}

.envelope__flap {
  z-index: 4;
  height: calc(var(--env-h) * 0.56);
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transform: perspective(1400px) rotateX(0deg);
}
.envelope__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.envelope__face--out {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(to bottom, oklch(0.34 0.105 17), oklch(0.28 0.095 17));
}
/* Turned over, the inside of the flap shows the liner pointing up */
.envelope__face--in {
  transform: rotateX(180deg);
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background:
    linear-gradient(oklch(0.2 0.06 16 / 0.25), oklch(0.2 0.06 16 / 0.25)),
    url("/assets/img/red-tapers-600.webp") center 40% / cover;
}

.envelope__seal { z-index: 5; }
.seal {
  position: absolute;
  left: 50%;
  top: calc(var(--env-h) * 0.56);
  display: grid;
  place-items: center;
  width: clamp(56px, 15vw, 74px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 47% 53% 51% 49% / 52% 47% 53% 48%;
  background: radial-gradient(circle at 34% 30%, oklch(0.62 0.19 26), var(--cherry) 44%, oklch(0.34 0.13 22) 100%);
  box-shadow:
    0 4px 8px rgb(0 0 0 / 0.45),
    inset 0 -2px 4px rgb(0 0 0 / 0.3),
    inset 0 2px 3px oklch(1 0 0 / 0.2);
}
.seal::before {
  content: "";
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 0 oklch(1 0 0 / 0.16);
}
.seal__mark {
  width: 70%;
  aspect-ratio: 800 / 625;
  background: oklch(0.36 0.13 22);
  -webkit-mask: url("/assets/img/sg-logo.webp") center / contain no-repeat;
  mask: url("/assets/img/sg-logo.webp") center / contain no-repeat;
}

@keyframes envelope-in {
  from { opacity: 0; translate: 0 1.75rem; }
}

/* =========================================================
   PRINTS
   Phone: a strip of photo prints to swipe through.
   Desktop: laid out in one row, equal heights.
   ========================================================= */
.prints {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--margin);
  padding: 1.5rem var(--margin) 2.25rem;
  scrollbar-width: none;
}
.prints::-webkit-scrollbar { display: none; }
.prints:focus-visible { outline-offset: -4px; }

.print {
  flex: none;
  height: clamp(17rem, 64vw, 22rem);
  aspect-ratio: var(--r);
  scroll-snap-align: center;
  overflow: hidden;
  border-radius: 2px;
  background: oklch(0.18 0.02 15);
  rotate: var(--tilt);
  translate: 0 var(--lift, 0);
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.08) inset,
    0 14px 26px -12px rgb(0 0 0 / 0.75);
}
.print img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.print--toast { --r: 600 / 1053; --tilt: -1.4deg; }
.print--tiramisu { --r: 4 / 5; --tilt: 1.1deg; --lift: 0.6rem; }
.print--flutes { --r: 1100 / 951; --tilt: -0.7deg; --lift: -0.3rem; }
.print--tapers { --r: 0.756; --tilt: 1.5deg; --lift: 0.4rem; }

@media (min-width: 900px) {
  .prints {
    overflow: visible;
    max-width: 78rem;
    margin-inline: auto;
    gap: clamp(1rem, 1.6vw, 1.5rem);
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
  }
  .print {
    flex: var(--grow) 1 0;
    min-width: 0;
    height: auto;
    transition: rotate 0.6s var(--ease-out), translate 0.6s var(--ease-out);
  }
  .print--toast { --grow: 0.57; }
  .print--tiramisu { --grow: 0.8; }
  .print--flutes { --grow: 1.157; }
  .print--tapers { --grow: 0.756; }
  .print:hover { rotate: 0deg; translate: 0 -0.4rem; }
}

/* =========================================================
   DETAILS AND REPLY CARDS
   ========================================================= */
.suite {
  display: grid;
  justify-items: center;
  padding: 0 var(--margin) clamp(2.5rem, 8vw, 4.5rem);
}

.details-card {
  width: min(100%, 48rem);
  padding: clamp(2.4rem, 8vw, 3.4rem) clamp(1.5rem, 7vw, 3.5rem) clamp(2.2rem, 7vw, 3rem);
}

.details-card__cols {
  display: grid;
  gap: 1.75rem;
  margin-top: clamp(1.6rem, 5vw, 2.25rem);
}
.details-card__col {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}
.details-card .btn { width: 100%; }

.facts { display: grid; margin-bottom: 0.5rem; }
.facts__cell {
  display: grid;
  gap: 0.35rem;
  padding-block: 1rem 1.05rem;
  border-top: 1px solid var(--rule);
}
.facts dd {
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: clamp(1.4rem, 1.25rem + 0.7vw, 1.7rem);
  line-height: 1.15;
}

.calendar {
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.calendar__when {
  margin-bottom: 0.5rem;
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: clamp(1.4rem, 1.25rem + 0.7vw, 1.7rem);
  line-height: 1.15;
}

@media (min-width: 720px) and (max-width: 959.98px) {
  .details-card__cols {
    grid-template-columns: 1.15fr 1fr;
    gap: clamp(2rem, 5vw, 3.5rem);
  }
}

/* Desktop: the details card and reply card lie side by side on the table.
   The details card stays in view while the guest fills in the reply. */
@media (min-width: 960px) {
  .suite-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: clamp(1.75rem, 3.5vw, 3.5rem);
    width: min(100% - 2 * var(--margin), 76rem);
    margin-inline: auto;
    padding-bottom: clamp(3rem, 7vw, 5.5rem);
  }
  .suite { padding: 0; }
  .details {
    position: sticky;
    top: 2.5rem;
    margin-top: 2.5rem;
  }
  .details-card {
    --rest: -1.2deg;
    rotate: var(--rest);
    width: 100%;
  }
  .reply { width: 100%; }
}

.reply {
  width: min(100%, 44rem);
  padding: clamp(2.4rem, 8vw, 3.5rem) clamp(1.5rem, 7vw, 3.5rem) clamp(2.2rem, 7vw, 3rem);
}
.rsvp:focus { outline: none; }

.reply__header {
  display: grid;
  justify-items: center;
  text-align: center;
}
.reply__title {
  max-width: 12ch;
  margin-top: 0.6rem;
}
.reply__deadline {
  margin-top: 0.9rem;
  color: var(--fg-muted);
}
.reply__deadline strong { font-weight: 500; color: var(--fg); }

.rsvp__body {
  margin-top: clamp(1.75rem, 5vw, 2.5rem);
  padding-top: clamp(1.5rem, 4vw, 2rem);
  border-top: 1px solid var(--rule);
}

/* ---------- Form ---------- */
.form {
  display: grid;
  gap: 1.4rem 1.25rem;
}
@media (min-width: 640px) {
  .form { grid-template-columns: 1fr 1fr; }
  .field--full,
  .form__note,
  .form__footer { grid-column: 1 / -1; }
}

.form__note {
  font-size: 0.92rem;
  color: var(--fg-muted);
}

.field { display: grid; align-content: start; min-width: 0; }
.field label {
  margin-bottom: 0.45rem;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
}
.field__hint {
  margin: -0.2rem 0 0.7rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--fg-muted);
}

.field input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 0.95rem;
  font-size: 1.0625rem; /* 17px: keeps iOS from zooming on focus */
  line-height: 1.3;
  color: var(--fg);
  background: var(--field-bg);
  border: 1px solid var(--fg-line);
  border-radius: 2px;
  transition:
    border-color 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out),
    background-color 0.25s var(--ease-out);
}
.field input:hover { border-color: var(--fg); }
.field input:focus-visible {
  outline: none;
  border-color: var(--fg);
  background: oklch(1 0 0 / 0.55);
  box-shadow: 0 0 0 3px oklch(0.29 0.09 18 / 0.16);
}
.field input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  box-shadow: 0 0 0 100px var(--paper) inset;
  caret-color: var(--fg);
}

.field__error {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--error);
}
.field__error::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.42em;
  border-radius: 50%;
  background: currentColor;
}
.field__error[hidden] { display: none; }

/* Attendee stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stepper__btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--fg-line);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.stepper__btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.stepper__btn:hover:not(:disabled) {
  background: oklch(0.29 0.09 18 / 0.06);
  border-color: var(--fg);
}
.stepper__btn:disabled { opacity: 0.35; cursor: not-allowed; }

.field .stepper input {
  width: 5.25rem;
  flex: none;
  text-align: center;
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: 1.9rem;
  height: 3.25rem;
  min-height: 0;
  padding-block: 0;
  padding-inline: 0.5rem;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.stepper__unit {
  margin-left: 0.35rem;
  color: var(--fg-muted);
}

.form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__footer {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}
.btn--submit { width: 100%; }
@media (min-width: 640px) {
  .form__footer {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.5rem;
  }
  .btn--submit { width: auto; min-width: 14rem; }
}

.btn__spinner {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.form.is-sending .btn__spinner { display: inline-block; }
.form.is-sending .btn--submit { cursor: progress; opacity: 0.85; }

@keyframes spin { to { rotate: 360deg; } }

.form__status {
  min-height: 1.5em;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--fg-muted);
}
.form__status:empty { min-height: 0; }
.form__status.is-error { color: var(--error); }
.form__status a { color: var(--fg); }

/* ---------- Thank-you state: the reply card becomes a place card ---------- */
.thanks {
  display: grid;
  justify-items: center;
  text-align: center;
}
.thanks:focus { outline: none; }
.thanks:not([hidden]) { animation: turn-in 0.9s var(--ease-expo) backwards; }

.reserved {
  display: grid;
  justify-items: center;
  width: min(100%, 24rem);
  padding-block: 0.25rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.reserved__name {
  margin-top: 0.6rem;
  font-family: var(--display);
  font-weight: var(--w-text);
  font-size: clamp(2.3rem, 1.9rem + 2vw, 3rem);
  line-height: 1;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 oklch(1 0 0 / 0.7);
}
.reserved__company {
  margin-top: 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
}
.reserved__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.9rem;
  margin-top: 0.9rem;
}

.thanks__title {
  margin-top: 1.75rem;
  font-family: var(--display);
  font-weight: var(--w-hair);
  font-size: clamp(2rem, 1.6rem + 2vw, 2.8rem);
  line-height: 1;
}
.thanks__body {
  max-width: 34rem;
  margin-top: 0.9rem;
}
.calendar--thanks {
  display: grid;
  gap: 0.65rem;
  width: min(100%, 22rem);
  margin-top: 1.75rem;
  padding-top: 0;
  border-top: 0;
}
.calendar--thanks .btn { width: 100%; }
.thanks__change {
  max-width: 32rem;
  margin-top: 1.75rem;
  font-size: 0.92rem;
  color: var(--fg-muted);
}

@keyframes turn-in {
  from { opacity: 0; transform: perspective(1200px) rotateY(-24deg); }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  padding: clamp(1.5rem, 5vw, 3rem) var(--margin) calc(clamp(5rem, 12vw, 6rem) + env(safe-area-inset-bottom));
}
.footer__inner {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--fg-muted);
}
.footer__logo {
  display: block;
  width: 120px;
  aspect-ratio: 800 / 625;
  background: var(--fg);
  -webkit-mask: url("/assets/img/sg-logo.webp") center / contain no-repeat;
  mask: url("/assets/img/sg-logo.webp") center / contain no-repeat;
  opacity: 0.9;
}
.footer__contact { display: grid; gap: 0.25rem; }
.footer a {
  color: var(--fg);
  text-decoration-color: var(--fg-line);
  text-underline-offset: 0.2em;
}
.footer a:hover { text-decoration-color: var(--fg); }

/* =========================================================
   MOBILE RSVP DOCK
   ========================================================= */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: var(--z-dock);
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.7rem 1.75rem;
  font-weight: 500;
  font-size: 0.84rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: oklch(0.97 0.01 75);
  background: var(--cherry);
  border-radius: 2px;
  box-shadow: 0 16px 34px -12px rgb(0 0 0 / 0.75);
  translate: -50% calc(100% + 2rem);
  opacity: 0;
  pointer-events: none;
  transition:
    translate 0.6s var(--ease-expo),
    opacity 0.4s var(--ease-out);
}
.dock.is-visible {
  translate: -50% 0;
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 960px) {
  .dock { display: none; }
}

/* =========================================================
   SCROLL-DRIVEN MOTION (progressive enhancement)
   Cards slide onto the table as they come into view.
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @supports (animation-timeline: view()) {
    .details-card,
    .reply {
      animation: slide-on linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
  }
}

@keyframes slide-on {
  from { translate: 0 2.5rem; rotate: calc(var(--rest, 0deg) - 0.8deg); }
  to { translate: 0 0; rotate: var(--rest, 0deg); }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
