/* Layout: a single ivory card under a temple-arch frame, opened through a floral ivory gate (gate.css).
   Deliberately single-theme (a letterpress invitation), so every colour is set explicitly. */
:root {
  --paper: #FAF0DC;
  --paper-deep: #F1E1C0;
  --ink: #5B3A1C;
  --ink-soft: #7A5532;
  --gold: #B8893A;
  --gold-hi: #EED494;
  --gold-lo: #84591C;
  --maroon: #6E0F1E;
  --maroon-deep: #3E0710;

  --f-display: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  --f-caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-body: "Cormorant Garamond", "Cormorant", Garamond, Georgia, serif;
  --f-script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-door: cubic-bezier(.68, 0, .22, 1);

  --gold-sheen: linear-gradient(100deg, var(--gold-lo) 0%, #A9792F 30%, #D9B160 44%, #EDCF85 50%, #C8973F 56%, #95682A 70%, var(--gold-lo) 100%);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .15 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, #5A0C18 0%, transparent 70%),
    var(--maroon-deep);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.gate-locked, html.gate-locked body { overflow: hidden; height: 100%; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ───────── Card ───────── */
.card {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  background: var(--paper-grain), radial-gradient(140% 70% at 50% 35%, var(--paper) 55%, var(--paper-deep) 100%), var(--paper);
  overflow: hidden;
  display: grid;
  grid-template-areas: "stage" "finale";
  isolation: isolate;
}
@media (min-width: 540px) {
  .card { margin-block: 40px; border-radius: 6px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(238,212,148,.25); }
}

/* The top of the card has a hanging toran (toran.css); the bottom bouquet lives in .finale */
.floral { position: absolute; z-index: 3; pointer-events: none; user-select: none; }

/* ───────── Frame ───────── */
.frame, .content { grid-area: stage; }
.frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  margin-inline: calc(var(--gutter-l) - 2px) calc(var(--gutter-r) - 2px);
  margin-top: 44px;
  margin-bottom: 6px;
  pointer-events: none;
}
.frame svg { width: 100%; height: auto; display: block; overflow: visible; }
.frame path { fill: none; stroke: var(--gold); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.frame circle { fill: var(--gold); }
/* Side rules sit at the same x as the SVG strokes (x = 4 and x = 10 in the 360-unit viewBox),
   so they join the arch and the base exactly at any width. */
.frame-sides {
  --stroke: 1.1px;
  flex: 1;
  position: relative;
  transform-origin: top;
}
.frame-sides::before, .frame-sides::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  border-inline: var(--stroke) solid var(--gold);
}
.frame-sides::before { inset-inline: calc(100% * 4 / 360 - var(--stroke) / 2); }
.frame-sides::after { inset-inline: calc(100% * 10 / 360 - var(--stroke) / 2); }
.frame-top { margin-bottom: -0.5px; }
.frame-base { margin-top: -0.5px; }

/* ───────── Content ───────── */
.content {
  position: relative;
  z-index: 2;
  padding-left: calc(var(--gutter-l) + 26px);
  padding-right: calc(var(--gutter-r) + 26px);
  padding-block: 70px 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
section { display: flex; flex-direction: column; align-items: center; }

.blessing { gap: 14px; }

.rule { display: flex; align-items: center; gap: 10px; width: 70%; color: var(--gold); }
.rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule span:last-child { transform: scaleX(-1); }
.rule i { font-style: normal; font-size: 11px; }

.eyebrow {
  font-family: var(--f-caps);
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  max-width: 30ch;
  text-wrap: balance;
  line-height: 1.7;
}

.gold-text {
  background: var(--gold-sheen);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: sheen 7s ease-in-out infinite;
}
@keyframes sheen { 0%, 20% { background-position: 100% 0; } 60%, 100% { background-position: 0% 0; } }

/* scroll-cue.js sets --invite-min-h so the names block fills the first screen, its rows spread evenly */
.invite { gap: 0; min-height: var(--invite-min-h, auto); justify-content: space-evenly; }
.title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(30px, 9.4vw, 46px);
  line-height: 1.08;
  margin-top: 6px;
  letter-spacing: .01em;
  text-wrap: balance;
  padding-bottom: 4px;
}
.br-sm { display: none; }
@media (max-width: 420px) { .br-sm { display: inline; } }

.of, .amp-row { display: flex; align-items: center; gap: 14px; width: 78%; color: var(--gold); }
.of { font-family: var(--f-caps); font-size: 12px; letter-spacing: .2em; color: var(--ink); margin: 10px 0 18px; }
.of span, .amp-row span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 70%, transparent); }

.person { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(24px, 6.9vw, 40px);
  line-height: 1.2;
  letter-spacing: .005em;
  margin-bottom: 6px;
  white-space: nowrap;
}
.name .initial { font-weight: 400; }
.parents {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-style: italic;
  font-size: clamp(14px, 4.2vw, 16.5px);  /* both parents stay on one line, even on small phones */
  line-height: 1.35;
  color: var(--ink-soft);
  white-space: nowrap;
}
.parents-label {
  font-family: var(--f-caps);
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold-lo);
}

.amp-row { margin: 18px 0 8px; }
.amp-script, .gate-names .amp { font-family: var(--f-body); font-style: italic; font-weight: 400; }
.amp-script { font-size: 46px; line-height: .8; color: var(--gold); padding-top: 4px; }

/* ───────── Emblem ───────── */
/* The monogram between two leaf stems. The section keeps its earlier height (rings + monogram,
   225px), so the page length is unchanged and the row sits centred with equal space above and below. */
.emblem { min-height: 225px; justify-content: center; margin-top: var(--emblem-push, 0px); }  /* keeps the monogram below the fold */
.emblem-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.sprig { width: 58px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 1.1; stroke-linecap: round; }
.sprig--r { transform: scaleX(-1); }
.mono-wrap { width: 132px; position: relative; }
.mono { width: 100%; height: auto; display: block; overflow: visible; }
.mono-lines path { stroke-width: 1.6; }
/* The monogram draws itself once (.is-drawn) and stays. Then (.is-flowing) rounds of soft light travel
   along every line together: ~5.7 s to cross, then a ~1.8 s rest before the next round. Each round is
   four stacked dashes (--len / --op / --w from main.js), so the light fades smoothly at both ends. */
.mono .letter { fill-opacity: 0; }
.mono-wrap.is-drawn .mono .letter { fill-opacity: .14; transition: fill-opacity 1.4s ease 2.2s; }
.mono-flow { opacity: 0; filter: drop-shadow(0 0 1.5px rgba(232, 190, 110, .5)); }
.mono-wrap.is-flowing .mono-flow { opacity: 1; transition: opacity 1.5s ease; }
.mono-flow path {
  fill: none;
  stroke: #F6DEA0;                      /* warm pale gold: close to the lines, not stark white */
  stroke-opacity: var(--op, .3);
  stroke-width: var(--w, 2.4);
  stroke-linecap: round;
  stroke-dasharray: var(--len, .1) 3;   /* one dash per line; the gap is longer than the line */
  animation: mono-flow 7.5s cubic-bezier(.45, 0, .55, 1) infinite;
}
/* The dash's centre travels from just before the start of each line to just past its end, then rests
   (--from / --to are plain numbers set in main.js; calc() here would not animate smoothly) */
@keyframes mono-flow {
  0% { stroke-dashoffset: var(--from, .25); }
  76%, 100% { stroke-dashoffset: var(--to, -1.15); }
}

/* ───────── Countdown ───────── */
/* Below the monogram the sections get the same generous air as the names above */
.countdown, .details, .closing { margin-top: 22px; }
.countdown { gap: 20px; width: 100%; }
.cd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 320px;
  border-block: 1px solid rgba(184, 137, 58, .55);
  padding-block: 12px 10px;
}
.cd-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.cd-cell + .cd-cell::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 1px; background: rgba(184, 137, 58, .45); }
.cd-cell b { font-family: var(--f-body); font-weight: 500; font-size: 34px; line-height: 1; color: var(--maroon); font-variant-numeric: tabular-nums lining-nums; }
.cd-cell span { font-family: var(--f-caps); font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.cd-done { font-family: var(--f-body); font-style: italic; font-size: 20px; color: var(--maroon); }

/* ───────── Details ───────── */
.details { gap: 40px; width: 100%; }
.details svg { width: 26px; height: 26px; fill: none; stroke: var(--gold-lo); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.label { display: block; font-family: var(--f-caps); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-lo); margin-bottom: 2px; }
/* Two equal columns around the divider, so the divider sits exactly in the middle */
.when { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; column-gap: 18px; width: 100%; }
.when-item { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; min-width: 0; }
.when-item b { display: block; font-weight: 500; font-size: clamp(15px, 4.4vw, 17px); line-height: 1.25; color: var(--ink); }
.when-sep { width: 1px; background: linear-gradient(transparent, var(--gold), transparent); }

.venue { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.venue h4 { font-family: var(--f-caps); font-weight: 500; font-size: 19px; letter-spacing: .06em; color: var(--maroon); margin-top: 2px; }
.venue address { font-style: normal; font-size: 16px; line-height: 1.45; color: var(--ink); text-wrap: balance; max-width: 30ch; }
@media (max-width: 420px) { .venue address br { display: none; } }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 18px; }
.btn {
  font-family: var(--f-caps);
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 18px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--maroon);
  background: rgba(255, 250, 238, .55);
  transition: transform .3s var(--ease-out), box-shadow .3s, background .3s;
}
.btn--solid {
  color: var(--gold-hi);
  border-color: transparent;
  background: linear-gradient(160deg, #861629, var(--maroon) 55%, #4E0914);
  box-shadow: inset 0 0 0 1px rgba(238, 212, 148, .45), 0 6px 16px -8px rgba(110, 15, 30, .7);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }

/* Same stack as the date and time: icon, label, value, centred */
.dinner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.dinner b { display: block; font-weight: 500; font-size: clamp(15px, 4.4vw, 17px); line-height: 1.25; color: var(--ink); }

/* ───────── Closing & finale ───────── */
.closing { gap: 14px; padding-top: 6px; }
.closing-line { font-style: italic; font-size: 17px; color: var(--ink-soft); max-width: 26ch; text-wrap: balance; }
.closing-sign { font-family: var(--f-script); font-size: 30px; line-height: 1.3; color: var(--maroon); }
.closing-sign .amp-script { font-size: 30px; color: var(--gold); }

/* Finale: the illustrated couple from the printed invitation, with a bouquet in the corner */
.finale { grid-area: finale; position: relative; height: 0; padding-bottom: 92%; margin-top: -64px; z-index: 3; }
.couple { position: absolute; right: 0; bottom: 0; width: 66%; }
/* Same layered bouquet as the gate: a fixed base with sprigs that move on their own (.gf-part in gate.css) */
.floral--bl { display: block; left: -8px; bottom: -4px; width: 60%; z-index: 4; transform-origin: 0 100%; }

/* Petals and the opening gate live in gate.css */

/* ───────── Choreography (only once JS is running) ───────── */
/* The dash is slightly longer than the path (pathLength = 1) so rounding never leaves the end undrawn. */
.js .frame path { stroke-dasharray: 1.05; stroke-dashoffset: 1.05; }
.js .frame circle { opacity: 0; transition: opacity .6s ease 1.8s; }
.js .frame-sides { transform: scaleY(0); }
.js.is-open .frame path { stroke-dashoffset: 0; transition: stroke-dashoffset 2.6s cubic-bezier(.45, 0, .2, 1) .6s; }
.js.is-open .frame circle { opacity: 1; }
.js.is-open .frame-sides { transform: scaleY(1); transition: transform 3.2s cubic-bezier(.45, 0, .2, 1) 1.6s; }
.js .frame-base path { transition-delay: 3.8s !important; }
/* Once drawn, drop the dash: with non-scaling strokes some browsers size the dash a little
   short of the path at wider widths, which left the corners unjoined. Solid lines always meet. */
.js.frame-drawn .frame path { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }


.js [data-reveal] { opacity: 0; transform: translateY(22px); filter: blur(6px); }
.js [data-reveal].in { opacity: 1; transform: none; filter: blur(0); transition: opacity 1.2s ease, transform 1.4s var(--ease-out), filter 1.2s ease; transition-delay: var(--d, 0s); }

.js .mono-wrap .mono-lines path { stroke-dasharray: 1.05; stroke-dashoffset: 1.05; }
.js .mono-wrap.is-drawn .mono-lines path { stroke-dashoffset: 0; transition: stroke-dashoffset 2.4s cubic-bezier(.5, 0, .2, 1) var(--pd, 0s); }

.js .couple { opacity: 0; transform: translateY(40px); }
.js .floral--bl { opacity: 0; transform: translateX(-30px) rotate(-3deg); }
.js .finale.in .couple { opacity: 1; transform: none; transition: opacity 1.6s ease, transform 2s var(--ease-out); }
.js .finale.in .floral--bl {
  opacity: 1;
  transform: none;
  transition: opacity 1.4s ease .3s, transform 2s var(--ease-out) .3s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .gold-text { animation: none; }
  .petals { display: none; }
}
