/* Colours taken from the invitation site */
:root {
  --paper: #f3f2ec;
  --leaf: #447a31;
  --lime: #b5ce5b;
  --ink: #1f2a19;
  --blush: #ead3dc;
  --periwinkle: #8497cc;
  --periwinkle-deep: #52669f;
  --butter: #f6d477;
  --lilac: #8d5f9c;
  --serif: "Cormorant Garamond", Georgia, serif;
  /* handmade paper grain */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.45' numOctaves='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1.4' lighting-color='white'%3E%3CfeDistantLight azimuth='45' elevation='60'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body { background: var(--paper) var(--grain); color: var(--ink); font: 500 1.15rem/1.5 var(--serif); text-align: center; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 3px; }

.page { position: relative; overflow: clip; }

/* Ribbons and petals sit behind the content */
#decor { position: absolute; inset: 0; pointer-events: none; }
#decor svg { position: absolute; overflow: visible; }
.ribbon { width: 90px; height: 620px; filter: drop-shadow(3px 6px 4px rgb(40 50 90 / .2)); }
.petal { filter: drop-shadow(1px 4px 3px rgb(120 50 70 / .18)); animation: drift 7s ease-in-out infinite alternate; }
@keyframes drift { to { translate: 6px 16px; rotate: 22deg; } }

/* Hero */
.hero { position: relative; padding: 12px 14px 8px; max-width: 760px; margin: 0 auto; }
.strand { --columns: 3; max-width: 460px; margin: 0 auto 36px; }
.strand .polaroid { padding: 6px 6px 22px; }

.envelope { position: relative; width: min(84%, 380px); aspect-ratio: 1 / 1.08; margin: 0 auto; }
.env-back, .env-front, .env-front i { position: absolute; }
.env-back { inset: 0; background: #d9bcc7 var(--grain); clip-path: polygon(0 42%, 50% 0, 100% 42%, 100% 100%, 0 100%); }
.env-photo {
  position: absolute; left: 7%; top: 7%; width: 86%; height: 84%; object-fit: cover; object-position: 50% 68%;
  border: 7px solid #fffdf8; border-bottom-width: 0; border-radius: 46% 46% 0 0 / 22% 22% 0 0;
  animation: rise 1.6s .25s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { translate: 0 24%; clip-path: inset(0 0 24% 0); } to { translate: 0 0; clip-path: inset(0); } }
.env-front { inset: 0; filter: drop-shadow(0 12px 12px rgb(70 40 50 / .25)); }
.env-front i { inset: 0; background: var(--blush) var(--grain); }
.env-front i:nth-child(1) { clip-path: polygon(0 52%, 55% 82%, 0 100%); }
.env-front i:nth-child(2) { clip-path: polygon(100% 52%, 45% 82%, 100% 100%); background-color: #e5ccd6; }
.env-front i:nth-child(3) { clip-path: polygon(0 100%, 50% 69%, 100% 100%); background-color: #f0dde4; }

.bouquet { position: absolute; width: 56%; aspect-ratio: 1; pointer-events: none; }
.bouquet svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 5px rgb(60 50 40 / .18)); }
.bouquet-left { left: -22%; top: 38%; }
.bouquet-right { right: -22%; top: 55%; }

.doily { position: relative; z-index: 1; width: min(100%, 400px); aspect-ratio: 360 / 440; margin: -14px auto 0; }
.doily svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 12px 14px rgb(50 60 30 / .25)); }
.doily-text { position: absolute; inset: 13% 17%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.monogram { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }
.monogram span + span { display: inline-block; margin-left: -.1em; transform: translateY(.3em); font-style: italic; }
h1 { display: flex; flex-direction: column; font: 400 clamp(3.2rem, 17vw, 4.5rem)/.9 "Sacramento", cursive; }
h1 i { font: italic 500 1.5rem/1.2 var(--serif); }
#date { margin-top: 14px; font-weight: 600; }
.invite { text-wrap: balance; font-style: italic; line-height: 1.3; margin-top: 4px; max-width: 11em; }

/* Upload button: stitched blue ribbon label with a cream camera seal */
.seal-button {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 14px;
  width: min(100%, 360px); margin: 18px auto 0; padding: 12px 24px 12px 12px;
  border: 3px solid #fffdf8; border-radius: 60px; color: #fff; text-align: left;
  background: linear-gradient(135deg, #6a7fbb, var(--periwinkle-deep) 55%, #3f5087);
  box-shadow: 0 0 0 2px var(--periwinkle-deep), 0 12px 24px rgb(40 50 90 / .4);
}
.seal-button::before { /* stitching */
  content: ""; position: absolute; inset: 4px; border: 1.5px dashed rgb(255 255 255 / .55); border-radius: inherit; pointer-events: none;
}
.seal-button::after { /* soft ring that draws the eye */
  content: ""; position: absolute; inset: -5px; border: 3px solid var(--periwinkle); border-radius: inherit; pointer-events: none;
  animation: halo 2.2s ease-out infinite;
}
@keyframes halo { from { opacity: .9; scale: 1; } 70%, to { opacity: 0; scale: 1.1 1.32; } }
.seal-button svg {
  flex: none; width: 56px; height: 56px; padding: 13px; border-radius: 50%; background: #fffdf8;
  fill: none; stroke: var(--periwinkle-deep); stroke-width: 1.7; stroke-linejoin: round;
}
.seal-button span { flex: 1; text-align: center; }
.seal-button b { display: block; font-weight: 600; font-size: 1.4rem; line-height: 1.15; }
.seal-button small { display: block; font-style: italic; font-size: 1.05rem; line-height: 1.2; }
.seal-button:active { transform: scale(.96); }
.seal-float { position: fixed; z-index: 10; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); width: min(100% - 32px, 360px); margin: 0 auto; }
#status { position: relative; min-height: 1.6em; margin-top: 10px; }

/* Sections */
main { position: relative; max-width: 1040px; margin: 0 auto; padding: 8px 12px 48px; }
section { padding-top: 36px; }
h2 { font: 400 clamp(2.6rem, 11vw, 4rem)/1.2 "Pinyon Script", cursive; color: var(--leaf); }
.lead { font-style: italic; margin-bottom: 20px; }

/* Polaroids pegged on twine */
.line { position: relative; display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: 14px; padding: 0 6px; margin-bottom: 30px; }
.twine { position: absolute; left: -14px; top: 0; width: calc(100% + 28px); height: 44px; overflow: visible; }
.twine path { fill: none; stroke: #b98a5c; stroke-width: 3; vector-effect: non-scaling-stroke; }
.polaroid {
  position: relative; top: var(--drop); transform: rotate(var(--tilt)); transform-origin: top center;
  border: 0; padding: 8px 8px 30px; background: #fffefb; box-shadow: 0 6px 14px rgb(40 40 30 / .22);
}
.polaroid::before { /* clothes peg */
  content: ""; position: absolute; z-index: 1; left: 50%; top: -16px; width: 11px; height: 34px; margin-left: -5px; border-radius: 3px;
  background: linear-gradient(#0000 45%, #8c7a5c 45% 55%, #0000 55%), linear-gradient(90deg, #e9cf96, #f8e6bb 50%, #d9b978);
}
.frame { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: #e4e6da; }
.frame img, .frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; left: 0; right: 0; bottom: 5px; font-size: .95rem; font-style: italic; }
.empty { color: var(--leaf); }
.empty .frame { display: grid; place-items: center; font: 400 2.6rem "Pinyon Script", cursive; background: #e9eedb; }
.empty.tint-1 .frame { background: #f8e3e9; }
.empty.tint-2 .frame { background: #e3e7f4; }
.empty.tint-3 .frame { background: #f9eecb; }

/* A new photo develops like instant film */
.developing img, .developing video { animation: develop 2.4s ease-out both; }
@keyframes develop { from { filter: brightness(1.7) sepia(.8) blur(7px); opacity: .15; } to { filter: none; opacity: 1; } }

/* Countdown */
#clock { display: flex; justify-content: center; gap: clamp(8px, 3vw, 22px); }
#clock div { width: 74px; padding: 14px 0 10px; border-radius: 50% 50% 10px 10px / 32% 32% 10px 10px; background: #fffdf8; box-shadow: 0 5px 12px rgb(60 40 80 / .16); }
#clock dd { color: var(--lilac); font-size: 2.2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
#clock dt { font-style: italic; font-size: 1rem; }

/* Prenup scrapbook */
.scrapbook { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 14px; max-width: 620px; margin: 14px auto 0; padding: 0 8px; }
.print { position: relative; border: 0; padding: 8px 8px 4px; background: #fffefb; box-shadow: 0 8px 18px rgb(40 40 30 / .22); rotate: -2deg; }
.print:nth-child(even) { rotate: 2.5deg; }
.print::before { /* washi tape */
  content: ""; position: absolute; left: 50%; top: -11px; width: 76px; height: 24px; margin-left: -38px; rotate: -4deg;
  background: repeating-linear-gradient(45deg, rgb(239 143 180 / .5) 0 6px, rgb(247 184 207 / .5) 6px 12px);
}
.print img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.print.wide { grid-column: 1 / -1; }
.print.wide img { aspect-ratio: 3 / 2; }
.print.short img { object-position: 50% 45%; aspect-ratio: 1; }
.print span { display: block; font: 400 clamp(1.5rem, 6.4vw, 1.9rem)/1.6 "Sacramento", cursive; }

footer { position: relative; padding: 40px 16px 110px; background: var(--lime) var(--grain); }
footer::before { /* scalloped lace edge */
  content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 13px;
  background: radial-gradient(circle at 50% 100%, var(--lime) 12px, #0000 13px) 0 0 / 26px 13px repeat-x;
}
footer .sign { font: 400 3.6rem/1.2 "Pinyon Script", cursive; }

dialog { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; padding: 16px; background: rgb(22 28 18 / .94); }
dialog[open] { display: flex; flex-direction: column; gap: 12px; }
#close { align-self: flex-end; border: 1px solid #fff8; border-radius: 30px; background: none; color: #fff; padding: 6px 18px; }
#stage { flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
#stage img, #stage video { max-width: 100%; max-height: 100%; border: 8px solid #fffefb; }

@media (min-width: 720px) {
  .strand { max-width: 600px; }
  .ribbon { width: 130px; height: 900px; }
  .scrapbook { max-width: 760px; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .developing img, .developing video, .env-photo, .petal, .seal-button::after { animation: none; }
  .seal-button::after { opacity: 0; }
}
