/* ============================================================
   Gianna & Nathan — Save the Date
   A single-theme design: an engraved plate on black-tie ground.
   Palette drawn from Villa Siena itself — whitewashed stucco,
   terracotta walk, wrought iron, bougainvillea.
   ============================================================ */

/* Fonts are self-hosted rather than pulled from Google. Guests open this on
   hotel wifi and in-app browsers; a third-party font request is one more thing
   that can hang, flash unstyled text, or be blocked outright. Subset to the
   glyphs this page actually uses: 28 KB for all four faces. */

@font-face {
  font-family: "Caslon Display";
  src: url("/caslon-display-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Caslon Text";
  src: url("/caslon-text-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Caslon Text";
  src: url("/caslon-text-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  --ink:        #14110e;   /* black-tie ground, warm not blue */
  --ink-soft:   #1d1915;
  --paper:      #efe9dd;   /* letterpress stock */
  --paper-deep: #e5ddcd;
  --text:       #241f19;
  --text-soft:  #5d554a;
  --gilt:       #9c7f4e;   /* leaf, hairlines only */
  --wine:       #8e2f47;   /* bougainvillea — the one accent, used twice */

  /* Hero only. The opening is the inverse of the plate: a dark brown
     envelope laid on light parchment, rather than paper on ink. */
  --hero:       #e4decf;   /* parchment ground behind the envelope */
  --hero-hi:    #ece7da;
  --hero-lo:    #dcd5c3;
  --env:        #4a3320;   /* envelope stock */
  --env-deep:   #3a2717;   /* pocket front, in shadow */

  --display: "Caslon Display", "Baskerville", "Times New Roman", serif;
  --script:  "Caslon Text", "Baskerville", "Times New Roman", serif;
  --label:   "Caslon Text", "Baskerville", "Times New Roman", serif;

  --ease:      cubic-bezier(.22, 1, .36, 1);
  --ease-lift: cubic-bezier(.16, .84, .28, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--script);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Hard lock: position:fixed pins body to the viewport on iOS so the rubber-
   band scroll can't reveal the invitation below, dvh matches the CURRENT
   visible area (adapts as the URL bar shows/hides — svh alone was smaller
   than the actual visible viewport when the URL bar had auto-hidden, and
   the invitation top would peek through the gap). */
body.is-locked {
  position: fixed;
  inset: 0;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  overscroll-behavior: none;
}

img { display: block; width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 1px solid var(--gilt);
  outline-offset: 6px;
}

/* ── Shared type ─────────────────────────────────────────── */

.label {
  margin: 0;
  font-family: var(--label);
  font-weight: 400;
  font-size: clamp(.62rem, 1.5vw, .72rem);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.quiet {
  margin: 0;
  font-family: var(--script);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: var(--text-soft);
}

.quiet--wide {
  font-style: italic;
  letter-spacing: .05em;
}

/* Diamond ornament — a printer's mark, not decoration for its own sake:
   it separates the names from the date the way an engraved plate would. */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(240px, 60%);
  margin-inline: auto;
}
.ornament i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt), transparent);
  opacity: .6;
}
.ornament b {
  width: 5px; height: 5px;
  transform: rotate(45deg);
  background: var(--wine);
}

/* Monogram — G, hairline, N */
.monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 16px);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 3.6rem);
  line-height: 1;
  color: var(--text);
}
.monogram i {
  width: 1px;
  height: clamp(34px, 7vw, 48px);
  background: var(--gilt);
  opacity: .75;
}
.monogram--small { font-size: clamp(1.5rem, 4vw, 1.9rem); }
.monogram--small i { height: clamp(20px, 4vw, 26px); }

/* ════════════════════════════════════════════════════════════
   1. THE OPENING — envelope on an ink field
   ════════════════════════════════════════════════════════════ */

.opening {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* dvh matches the current visible viewport (adapts as the URL bar shows/
     hides) so the hero always exactly fills what the guest sees — no gap
     at the bottom for the invitation to peek through. vh is a fallback. */
  min-height: 100vh;
  min-height: 100dvh;
  /* svh for padding: shortest viewport keeps the pad reasonable when the
     URL bar is visible; the min-height above handles filling. */
  padding: clamp(30px, 9svh, 110px) 20px;
  background: linear-gradient(168deg, var(--hero-hi) 0%, var(--hero) 48%, var(--hero-lo) 100%);
}

.opening__date {
  margin: 0 0 clamp(22px, 5.5svh, 64px);
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.1rem, 3.6vw, 1.6rem);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text);
  transition: opacity .6s ease;
}

.envelope-trigger {
  /* Capped on BOTH axes. The envelope is 1.42:1, so an 84vw envelope on a
     phone held sideways stood 366px tall inside a 390px screen and ran into
     the "Open" prompt. 62svh keeps its height under ~44% of the screen. */
  width: min(520px, 84vw, 62svh);
  cursor: pointer;
}

/* perspective lives here, on the flap's own parent, and `preserve-3d` is
   deliberately absent: with it, paint order comes from translateZ and z-index
   is ignored, which is how the card ended up in front of the pocket. */
.envelope {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.42 / 1;
  perspective: 1500px;
  transition: transform 1.1s var(--ease);
}
.envelope-trigger:hover .envelope { transform: translateY(-5px); }
body.is-open .envelope-trigger { cursor: default; }
body.is-open .envelope-trigger:hover .envelope { transform: none; }

/* Envelope back / body */
.envelope__body {
  position: absolute;
  inset: 0;
  background: linear-gradient(168deg, var(--env) 0%, var(--env-deep) 100%);
  box-shadow:
    0 2px 1px rgba(255,255,255,.06) inset,
    0 40px 70px -28px rgba(0,0,0,.85);
}

/* The card that lifts out */
.envelope__card {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 9%;
  bottom: 9%;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Anchored high: once the card lifts, only its top half clears the pocket,
     so the monogram has to live in that band rather than at dead centre. */
  justify-content: flex-start;
  padding-top: 12%;
  gap: clamp(10px, 2vw, 16px);
  background: linear-gradient(180deg, #fdfaf3 0%, #f4eee2 100%);
  box-shadow: 0 -8px 20px -10px rgba(0,0,0,.35);
  transform: translateY(0);
  transition: transform 1.15s var(--ease-lift) .5s;
}
.envelope__card-mono {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  line-height: 1;
  color: var(--text);
}
.envelope__card-mono i {
  width: 1px;
  height: clamp(20px, 4vw, 28px);
  background: var(--gilt);
}
.envelope__card-label {
  font-family: var(--label);
  font-weight: 400;
  font-size: clamp(.5rem, 1.5vw, .6rem);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* Side + bottom flaps, drawn as one shape */
.envelope__lining {
  position: absolute;
  inset: 0;
  background: var(--env-deep);
  clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%);
  box-shadow:
    0 -1px 0 rgba(0,0,0,.06) inset,
    0 -14px 22px -16px rgba(0,0,0,.55) inset;
}

/* The top flap that opens */
.envelope__flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 52%;
  background: linear-gradient(180deg, var(--env) 0%, var(--env-deep) 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition:
    transform 1.05s var(--ease),
    opacity .3s ease .62s,
    z-index 0s linear .42s;
}

/* Wax seal — the single place the bougainvillea accent appears */
.seal {
  position: absolute;
  left: 50%;
  top: 52%;
  width: clamp(44px, 9.5%, 58px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  /* Poured wax, not a button: off-centre highlight, dark pooled rim,
     and a pressed edge where the seal met the paper. */
  background:
    radial-gradient(circle at 37% 30%, #8b3047 0%, #74253a 42%, #521729 78%, #3d1120 100%);
  box-shadow:
    0 3px 7px rgba(0,0,0,.55),
    inset 0 2px 3px rgba(255,190,200,.16),
    inset 0 -3px 5px rgba(0,0,0,.5);
  transition: transform .5s var(--ease), opacity .5s ease;
}
.seal::before {
  content: "";
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 1px solid rgba(255, 205, 215, .13);
}
.seal__mono {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--display);
  font-size: clamp(.7rem, 1.8vw, .85rem);
  color: rgba(255, 240, 235, .82);
}
.seal__mono i {
  width: 1px;
  height: clamp(9px, 2vw, 12px);
  background: rgba(255, 240, 235, .5);
}

/* Opened state */
body.is-open .envelope__flap {
  /* past 90deg the flap belongs behind the envelope, so the z-index steps
     down mid-fold rather than letting it sweep across the face */
  z-index: 0;
  transform: rotateX(-172deg);
  /* fully folded it sits behind the envelope; the last of it is dropped so no
     sliver of the tip shows above the card */
  opacity: 0;
}
body.is-open .seal {
  transform: translate(-50%, -50%) scale(.82);
  opacity: 0;
  transition-duration: .32s;
}
body.is-open .envelope__card {
  transform: translateY(-58%);
}
body.is-open .opening__date { opacity: 0; }

.opening__prompt,
.opening__continue {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-family: var(--label);
  font-weight: 400;
  font-size: clamp(.56rem, 1.8vw, .66rem);
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.opening__prompt {
  bottom: max(38px, env(safe-area-inset-bottom, 0px));
  cursor: pointer;
  transition: opacity .5s ease, transform .7s var(--ease);
}
body.is-open .opening__prompt { cursor: default; pointer-events: none; }
.opening__prompt i {
  width: 1px; height: 30px;
  background: linear-gradient(180deg, rgba(156,127,78,.85), transparent);
}
.opening__continue {
  bottom: max(34px, env(safe-area-inset-bottom, 0px));
  opacity: 0;
  transition: opacity .7s ease 1.5s;
}
.opening__continue i {
  width: 1px; height: 26px;
  background: linear-gradient(180deg, rgba(156,127,78,.85), transparent);
  animation: drift 2.6s var(--ease) infinite;
}
body.is-open .opening__prompt { opacity: 0; transform: translate(-50%, 10px); }
body.is-open .opening__continue { opacity: 1; }

@keyframes drift {
  0%, 100% { transform: translateY(0); opacity: .9; }
  50%      { transform: translateY(7px); opacity: .35; }
}

/* Short viewports — a phone held sideways, or a small laptop. The envelope
   and the prompt were competing for the same 390px of height. */
@media (max-height: 520px) {
  .opening { padding: clamp(18px, 5svh, 40px) 20px; }
  .opening__date { margin-bottom: clamp(14px, 3.4svh, 26px); }
  .envelope-trigger { width: min(520px, 84vw, 52svh); }
  .opening__prompt { bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .opening__continue { bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .opening__prompt, .opening__continue { gap: 7px; }
  .opening__prompt i { height: 15px; }
  .opening__continue i { height: 13px; }
}

/* ════════════════════════════════════════════════════════════
   2. THE PLATE — the invitation itself
   One screen, landscape. Everything the guest needs is visible
   at once: no scrolling inside the invitation.
   ════════════════════════════════════════════════════════════ */

.plate {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 3.4svh, 42px) clamp(20px, 3.6vw, 64px);
  color: var(--text);
  /* Parchment, not flat stock: a warm top-to-shadow wash under fibre grain
     and burnished edges. All CSS — no image, so it costs nothing. */
  background: linear-gradient(172deg, #f6efdf 0%, #efe4cd 44%, #e8dabd 100%);
}

.plate__fibre {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  mix-blend-mode: multiply; opacity: .42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='700'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='700' height='700' filter='url(%23m)' opacity='.75'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)' opacity='.5'/%3E%3C/svg%3E");
  background-size: 700px 700px, 240px 240px;
}

.plate__burnish {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 160px rgba(122,96,58,.26), inset 0 0 44px rgba(110,86,52,.16);
}

/* Engraved double border, inset from the trim like a printed plate */
.plate__rule {
  position: absolute; z-index: 2; pointer-events: none;
  inset: clamp(14px, 2.2svh, 26px) clamp(14px, 1.7vw, 30px);
  border: 1px solid rgba(140,112,68,.52);
}
.plate__rule::after {
  content: "";
  position: absolute; inset: 7px;
  border: 1px solid rgba(140,112,68,.26);
}

/* Two columns: the photograph, then the type. */
.leaf {
  position: relative; z-index: 3;
  display: grid;
  align-items: center;
  justify-content: center;
  grid-template-columns: clamp(280px, 33vw, 470px) minmax(0, clamp(360px, 40vw, 530px));
  gap: clamp(34px, 4.6vw, 76px);
  max-width: 100%;
  max-height: 100%;
}

.plate-figure {
  margin: 0; position: relative;
  width: 100%;
  /* Portrait 4:5 next to the type column, but capped so the whole plate
     still fits within 100svh on landscape desktops down to ~700px tall.
     50svh × 4/5 = 40svh photo height, leaving 60svh for the parchment/rule/type. */
  max-width: min(50svh, 470px);
  aspect-ratio: 4 / 5;
  justify-self: center;
}
.plate-figure img {
  display: block; width: 100%; height: 100%;
  /* Source is natively 2:3; the 4:5 frame trims a little from top and bottom.
     40% keeps the couple centred with slightly more room above their heads. */
  object-fit: cover;
  object-position: 50% 40%;
  box-shadow: 0 18px 40px -22px rgba(60,44,24,.55);
}
.plate-figure::after {
  content: "";
  position: absolute; inset: -9px;
  border: 1px solid rgba(156,127,78,.42);
  pointer-events: none;
}

.leaf__type {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Type is scaled off viewport HEIGHT here, not width: the constraint on a
   one-screen landscape plate is vertical, so height is what must govern. */
.leaf__type .monogram {
  gap: clamp(9px, 1.1vw, 15px);
  font-size: clamp(1.9rem, 3.9svh, 3rem);
}
.leaf__type .monogram i { height: clamp(22px, 3svh, 34px); }

.leaf__type .label {
  margin: clamp(12px, 2.2svh, 22px) 0 0;
  font-size: clamp(.62rem, 1.3svh, .78rem);
  letter-spacing: .42em;
}
.leaf__type .quiet {
  margin: clamp(10px, 1.8svh, 18px) 0 0;
  font-size: clamp(.95rem, 1.9svh, 1.15rem);
}

.names {
  margin: clamp(6px, 1.2svh, 12px) 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.15rem, 6.4svh, 4.5rem);
  line-height: 1.1;
  letter-spacing: .005em;
}
.names em {
  display: block;
  font-family: var(--script);
  font-style: italic;
  font-size: clamp(.95rem, 1.9svh, 1.2rem);
  color: var(--text-soft);
  margin: clamp(2px, .5svh, 6px) 0;
  letter-spacing: .02em;
}

.leaf__type .ornament {
  width: min(420px, 86%);
  margin: clamp(16px, 2.9svh, 30px) auto 0;
}

.date {
  margin: clamp(12px, 2.2svh, 22px) 0 0;
  font-size: clamp(.98rem, 2.4svh, 1.42rem);
  letter-spacing: .24em;
  text-transform: uppercase;
}

.leaf__venue {
  margin: clamp(8px, 1.4svh, 14px) 0 0;
  font-style: italic;
  font-size: clamp(1rem, 2.1svh, 1.3rem);
  color: var(--text-soft);
  letter-spacing: .04em;
}

.leaf__foot {
  margin: clamp(18px, 3.2svh, 34px) 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(.78rem, 1.6svh, 1rem);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--text);
  /* Long enough to wrap on a phone; balance it so it never leaves a
     single orphaned word on the second line. */
  text-wrap: balance;
}

/* ── Portrait screens (phones) ────────────────────────────
   Full-height flex column instead of a centred grid, so nothing collects
   as dead space at the bottom of a tall phone. Photo sits at the top; the
   type block below FILLS the remaining height, with its items distributed
   via `space-around` so gaps grow proportionally on tall viewports and
   stay tight on iPhone SE. `.leaf`'s desktop max-height cap is released. */
@media (max-aspect-ratio: 1 / 1) {
  .plate {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(14px, 2.4svh, 26px) clamp(18px, 5vw, 34px);
  }

  .plate__rule { inset: clamp(10px, 1.7svh, 18px) clamp(10px, 3vw, 18px); }
  .plate__rule::after { inset: 6px; }

  .leaf {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    width: 100%;
    max-width: 480px;
    max-height: none;
    /* Explicit gap so "Save the Date" doesn't butt up against the photo. */
    gap: clamp(22px, 3.6svh, 38px);
  }

  .plate-figure {
    /* Slightly less tall than 8:7 (6:5 = 1.2) so the type block has real
       breathing room below, without shrinking the photo's width. */
    width: 100%;
    max-width: none;
    aspect-ratio: 6 / 5;
    flex: 0 0 auto;
    justify-self: center;
  }
  .plate-figure img {
    /* Y=15% shifts the visible window UP into the source so Nathan's hair
       isn't clipped at the top edge (source has heads sitting close to the
       top). Trades some floor/leg area at the bottom, which is fine. */
    object-position: 50% 15%;
  }
  .plate-figure::after { inset: -6px; }

  .leaf__type {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centre the type block in the remaining vertical space. Blank space
       (if any) is distributed symmetrically above and below — reads as
       intentional margin, not as clipped content at the fold. Individual
       item spacing comes from margin-top, preserving the natural rhythm
       of a wedding invitation (tight names/em/name, breath before date). */
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    text-align: center;
  }

  .leaf__type .label {
    margin: 0;
    font-size: min(3.4vw, 1.6svh);
    letter-spacing: .34em;
  }
  .leaf__type .quiet {
    margin: clamp(9px, 1.6svh, 16px) 0 0;
    font-size: min(4.6vw, 2.4svh);
  }

  /* Names cap in vw so "Gianna Sholes" never overflows a 375px phone;
     svh cap keeps them from towering on tall viewports. */
  .names {
    margin: clamp(11px, 2svh, 20px) 0 0;
    font-size: min(11.6vw, 5.8svh);
  }
  .names em {
    margin: clamp(3px, .6svh, 7px) 0;
    font-size: min(4.2vw, 2svh);
  }

  .leaf__type .ornament {
    margin: clamp(15px, 2.6svh, 26px) 0 0;
    width: min(280px, 72%);
  }

  .date {
    margin: clamp(13px, 2.2svh, 22px) 0 0;
    font-size: min(4.8vw, 2.6svh);
    letter-spacing: .2em;
  }
  .leaf__venue {
    margin: clamp(7px, 1.2svh, 12px) 0 0;
    font-size: min(4.4vw, 2.2svh);
  }
  .leaf__foot {
    margin: clamp(17px, 2.9svh, 30px) 0 0;
    font-size: min(3.8vw, 1.9svh);
    letter-spacing: .18em;
    /* Balanced wrap so the closing line breaks cleanly instead of
       stranding "follow" on its own row. */
    max-width: 28ch;
  }
}

/* ── Scroll reveals ──────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.1s ease, transform 1.25s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ── Reduced motion ──────────────────────────────────────── */

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

/* ── Small screens ───────────────────────────────────────── */

@media (max-width: 600px) {
  .plate { padding-inline: clamp(20px, 7vw, 34px); }
  .ornament { width: min(180px, 66%); }
}

@media print {
  body.is-locked { overflow: visible; height: auto; }
  .opening { display: none; }
  .reveal { opacity: 1; transform: none; }
  .plate { background: #fff; height: auto; overflow: visible; }
  .plate__fibre, .plate__burnish { display: none; }
}
