/* ==========================================================
   Raksha & Vasantharaja · Engagement invitation
   A walk through the venue: gate, aisle, mandap.
   ========================================================== */
:root {
  --paper: #f8f2e7;        /* warm ivory, the colour of jasmine */
  --paper-2: #f1e8d8;
  --ink: #4a2c1b;          /* teak */
  --ink-soft: #846a59;
  --leaf: #33492b;         /* deep garden green */
  --rose: #c9697f;
  --hair: #cdb99c;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --vh: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 20px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
img, canvas { display: block; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, p, figure { margin: 0; font-weight: 400; }

.label { font: 500 12px / 1.6 var(--serif); letter-spacing: .3em; text-transform: uppercase; color: var(--leaf); }
.script { font-family: var(--script); font-weight: 400; color: var(--ink); line-height: 1.05; }
.serif-i { font-style: italic; font-size: 21px; line-height: 1.45; color: var(--ink-soft); text-wrap: balance; }
.date { font-size: 26px; line-height: 1.3; letter-spacing: .02em; }
h2.script { font-size: clamp(50px, 14vw, 72px); margin: 8px 0 10px; }

/* ==========================================================
   The walk
   ========================================================== */
.journey { position: relative; height: 1100vh; }
.stage { position: sticky; top: 0; height: var(--vh); overflow: hidden; background: #d9d2c5; }
.walk { position: absolute; inset: 0; width: 100%; height: 100%; }
.grain {              /* a whisper of film grain over the picture; static, so it costs nothing while scrolling */
  position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: 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='.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- text that lives in the scene --- */
.pin {
  position: absolute; left: 0; top: 0; width: 1000px; transform-origin: 0 0; visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  color: var(--ink); pointer-events: none; will-change: transform, opacity;
  text-shadow: 0 0 18px rgba(255, 252, 244, .95), 0 0 46px rgba(255, 252, 244, .9), 0 0 90px rgba(255, 250, 238, .8);
}
.pin::before {        /* soft light the words sit in */
  content: ""; position: absolute; inset: 4% 16%; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 252, 244, .78), rgba(255, 252, 244, .42) 55%, rgba(255, 252, 244, 0));
}
.pin-names { height: 576px; }
.pin-request { height: 455px; }
.pin-date { height: 906px; }
.p-label { font: 500 19px / 1.5 var(--serif); letter-spacing: .32em; text-transform: uppercase; color: var(--leaf); }
.p-script { font: 400 112px / 1 var(--script); margin: 0; }
.p-script em { display: block; font: italic 400 36px / 1.1 var(--serif); color: var(--rose); }
.pin-names .p-label { margin-bottom: 14px; }
.p-serif { font: italic 400 40px / 1.25 var(--serif); color: var(--ink); }
.pin-request .p-script { font-size: 124px; margin-top: 6px; }
.p-date { font: 400 68px / 1.2 var(--serif); letter-spacing: .01em; margin: 6px 0; }
.pin-date .p-label { font-size: 25px; }
.p-hair { display: block; width: 2px; height: 70px; background: var(--hair); margin: 30px 0 22px; }
.p-venue { font-size: 122px; margin-bottom: 14px; }

.intro { position: absolute; left: 0; right: 0; top: 0; padding: calc(34px + env(safe-area-inset-top, 0px)) 16px 0; text-align: center; will-change: transform, opacity; }
.intro .label { text-shadow: 0 0 14px rgba(255, 252, 244, .9); }
.intro-names { font-size: clamp(34px, 10vw, 52px); white-space: nowrap; text-shadow: 0 0 18px rgba(255, 252, 244, .95), 0 0 40px rgba(255, 252, 244, .8); }
.cue {
  margin-top: 6px; display: grid; justify-items: center; gap: 8px; text-align: center;
  font: italic 400 19px / 1.3 var(--serif); color: var(--ink); text-shadow: 0 0 14px rgba(255, 252, 244, 1), 0 0 30px rgba(255, 252, 244, .9);
  will-change: opacity;
}
.cue i { display: block; width: 1px; height: 30px; background: rgba(74, 44, 27, .3); position: relative; overflow: hidden; }
.cue i::after { content: ""; position: absolute; inset: 0; background: var(--ink); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { from { transform: translateY(-100%); } to { transform: translateY(100%); } }

/* petals drifting through the air */
.petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.petal { position: absolute; top: -30px; width: 13px; height: 16px; border-radius: 80% 0 80% 0; background: linear-gradient(135deg, #f6c3cd, #d9738a); opacity: 0; animation: fall linear infinite; }
.petal.w { background: linear-gradient(135deg, #fffdf7, #efe2cf); }
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate3d(1, 1, 0, 0deg); opacity: 0; }
  10% { opacity: .9; } 85% { opacity: .85; }
  100% { transform: translate3d(var(--dx), 108vh, 0) rotate3d(1, .6, .2, var(--rot)); opacity: 0; }
}

/* ==========================================================
   The invitation
   ========================================================== */
main { position: relative; background: var(--paper); overflow-x: clip; }
section { position: relative; text-align: center; padding: 120px 28px; perspective: 900px; }
.sc { will-change: transform, opacity; transform-origin: 50% 100%; backface-visibility: hidden; }

.words { min-height: 105vh; display: flex; align-items: center; justify-content: center; }
.tagline { font-style: italic; font-size: clamp(32px, 9vw, 52px); line-height: 1.25; max-width: 15em; text-wrap: balance; }
.tagline .w { color: rgba(74, 44, 27, .18); transition: color .5s var(--ease); }
.tagline .w.on { color: var(--ink); }

/* rendered views of the venue between the sections */
.band { position: relative; height: 78vh; max-height: 760px; overflow: hidden; background: var(--paper-2); }
.band img { position: absolute; inset: -12% 0; width: 100%; height: 124%; object-fit: cover; will-change: transform; }
.band::before, .band::after { content: ""; position: absolute; left: 0; right: 0; height: 22%; z-index: 1; pointer-events: none; }
.band::before { top: 0; background: linear-gradient(180deg, var(--paper), rgba(248, 242, 231, 0)); }
.band::after { bottom: 0; background: linear-gradient(0deg, var(--paper), rgba(248, 242, 231, 0)); }

/* ---------- scratch and stills ---------- */
.frame-shadow { box-shadow: 0 0 0 1px var(--hair), 0 0 0 10px #fffdf8, 0 0 0 11px var(--hair), 0 40px 60px -30px rgba(74, 44, 27, .4); }
.scratch {
  position: relative; width: min(78%, 300px); aspect-ratio: 3 / 4.1; margin: 34px auto 0;
  border-radius: 999px 999px 6px 6px; overflow: hidden; isolation: isolate; background: var(--paper-2);
  box-shadow: 0 0 0 1px var(--hair), 0 0 0 10px #fffdf8, 0 0 0 11px var(--hair), 0 40px 60px -30px rgba(74, 44, 27, .4);
  -webkit-mask-image: radial-gradient(#000, #000);
}
.scratch img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .9s var(--ease); }
.scratch.done canvas { opacity: 0; pointer-events: none; }
.textlink { display: inline-block; margin-top: 26px; padding: 10px; background: none; border: 0; cursor: pointer; font: italic 400 18px var(--serif); color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 5px; }
.textlink.hide { visibility: hidden; }
.stills { display: grid; gap: 70px; margin-top: 110px; perspective: 900px; }
.still { width: min(74%, 290px); aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--paper-2); box-shadow: 0 0 0 10px #fffdf8, 0 0 0 11px var(--hair), 0 40px 60px -30px rgba(74, 44, 27, .4); }
.still:nth-child(odd) { justify-self: start; margin-left: 4%; }
.still:nth-child(even) { justify-self: end; margin-right: 4%; }
.still img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 760px) { .stills { grid-template-columns: repeat(3, auto); justify-content: center; gap: 46px; } .still, .still:nth-child(n) { width: 240px; margin: 0; justify-self: auto; } .still:nth-child(2) { margin-top: 60px; } }

/* ---------- venue ---------- */
.venue-photo {
  width: min(86%, 380px); aspect-ratio: 4 / 5; margin: 36px auto 34px; overflow: hidden; background: var(--paper-2);
  border-radius: 999px 999px 6px 6px;
  box-shadow: 0 0 0 1px var(--hair), 0 0 0 10px #fffdf8, 0 0 0 11px var(--hair), 0 40px 60px -30px rgba(74, 44, 27, .4);
}
.venue-photo img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 14px 34px; margin-top: 30px;
  font: 500 13px / 1 var(--serif); letter-spacing: .28em; text-transform: uppercase; text-decoration: none;
  color: var(--leaf); background: transparent; border: 1px solid var(--leaf); border-radius: 999px; cursor: pointer;
  transition: background-color .3s var(--ease), color .3s var(--ease);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn.solid { width: 100%; background: var(--leaf); color: var(--paper); }
.btn:active { background: var(--leaf); color: var(--paper); }
.btn.solid:active { background: #43603a; }
.btn:focus-visible, .textlink:focus-visible, .stepper button:focus-visible { outline: 2px solid var(--leaf); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--leaf); color: var(--paper); } .btn.solid:hover { background: #43603a; } }

/* ---------- rsvp ---------- */
.form { margin: 44px auto 0; max-width: 400px; text-align: left; perspective: 900px; }
.field { display: block; border: 0; padding: 0; margin: 0 0 34px; min-width: 0; }
.field > .label, .field legend { display: block; padding: 0; margin-bottom: 8px; }
.field input[type=text], .field textarea {
  width: 100%; padding: 8px 0 10px; border: 0; border-bottom: 1px solid var(--hair); border-radius: 0;
  background: transparent; font-size: 24px; line-height: 1.3; resize: none; outline: 0; color: var(--ink);
  transition: border-color .3s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(74, 44, 27, .32); font-style: italic; }
.field input:focus, .field textarea:focus { border-bottom-color: var(--ink); }
.err { display: block; margin-top: 8px; font-style: italic; font-size: 17px; color: #a0412d; }
.err:empty { display: none; }
.seg { display: grid; gap: 4px; }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; gap: 14px; min-height: 48px; font-size: 24px; color: var(--ink-soft); transition: color .3s var(--ease); }
.seg span::before { content: ""; flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--leaf); box-shadow: inset 0 0 0 3px var(--paper); transition: background-color .3s var(--ease); }
.seg input:checked + span { color: var(--ink); }
.seg input:checked + span::before { background: var(--leaf); }
.seg input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; border-bottom: 1px solid var(--hair); }
.stepper button { width: 52px; height: 52px; border: 0; background: none; cursor: pointer; font-size: 28px; line-height: 1; color: var(--ink); touch-action: manipulation; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 48px; text-align: center; font-size: 28px; font-variant-numeric: lining-nums tabular-nums; }
#guestsField[hidden] { display: none; }
.form-note { margin-top: 18px; text-align: center; font-size: 18px; }
.form-note:empty { display: none; }

/* ---------- footer: looking back at the gate ---------- */
.foot { position: relative; min-height: 100vh; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; text-align: center; background: var(--paper-2); }
.foot-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.foot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%; z-index: 1; background: linear-gradient(180deg, var(--paper), rgba(248, 242, 231, 0)); }
.foot-inner {
  position: relative; z-index: 2; width: 100%; padding: 120px 24px calc(64px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; justify-items: center; perspective: 900px;
  background: linear-gradient(0deg, rgba(248, 242, 231, .96) 30%, rgba(248, 242, 231, 0));
}
.foot-names { font-size: clamp(40px, 11.5vw, 64px); }

@media (prefers-reduced-motion: reduce) {
  .cue i::after { animation: none; }
  .petals { display: none; }
  .tagline .w { color: var(--ink); transition: none; }
}
