/* The e-invitation at /invite/: a faithful copy of the printed card, gold foil on sindoor red.
   Every piece sits at its position on the card photo, measured in photo pixels; --u turns one
   photo pixel into a share of the panel's width, so each panel scales as a whole. */

:root {
  --foil: #f2d6aa;
  --foil-deep: #e1b986;
  --red: #c0101a;
  --night: #3b0709;
  --deva: 'Noto Sans Devanagari', 'Kohinoor Devanagari', 'Noto Sans Devanagari', sans-serif;
  /* soft dark clouds in the red, like the petal print on the card stock */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.011' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .38 0 0 0 0 0 0 0 0 0 .02 0 0 0 1.3 -.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  gap: 1rem;
  padding: clamp(0.75rem, 3vmin, 2rem) clamp(0.5rem, 2vw, 2rem);
  background:
    radial-gradient(120% 80% at 50% 0%, #6e1013 0%, transparent 70%),
    var(--night);
  color: var(--foil);
  font-family: var(--deva);
}

p, h2, ul { margin: 0; }

.card {
  display: grid;
  gap: clamp(1.5rem, 5vmin, 3rem);
  width: min(100%, 64rem, calc((100svh - 4rem) * 2000 / 1464));
}


/* ---------- panels ---------- */

.panel {
  position: relative;
  container-type: inline-size;
  --u: calc(100cqw / var(--pw));
  background: var(--grain), radial-gradient(90% 60% at 40% 30%, #d0161f 0%, var(--red) 55%, #a70d16 100%);
  background-size: 420px 420px, auto;
}

.art, .t, .rule, .strip, .to, .family {
  position: absolute;
  left: calc(var(--x, 0) * var(--u));
  top: calc((var(--y) - var(--py, 0)) * var(--u));
}
/* On the cover (and any .abs panel) x is measured from the card's left edge, not the panel's. */
.cover .art, .cover .rule, .cover .to, .cover .strip,
.abs .art, .abs .rule, .abs .box, .abs .t:not(.c, .at) { left: calc((var(--x) - var(--px)) * var(--u)); }
.art { width: calc(var(--w) * var(--u)); height: auto; display: block; }
.rule { width: calc(var(--w) * var(--u)); height: max(1px, calc(2.6 * var(--u))); background: var(--foil); border-radius: 2px; }

.t {
  transform: translateY(-50%);
  white-space: nowrap;
  --fs: 28;
  font-size: calc(var(--fs) * var(--u) * var(--shrink, 1));
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  word-spacing: 0.32em;
}
.t.c { left: 0; right: 0; text-align: center; }
/* Centred pieces sit on the middle of their panel: the photos the card was traced from drift a
   little, so their own x is ignored. A group (.grp) keeps its pieces' spacing around --gx. */
.t.at { left: 50%; transform: translate(-50%, -50%); text-align: center; }
.panel .solo { left: calc((var(--pw) - var(--w)) / 2 * var(--u)); }
.panel .grp, .panel .t.grp { left: calc(50% + (var(--x) - var(--gx)) * var(--u)); }
.lead { --fs: 42; font-weight: 800; letter-spacing: 0.015em; }
.sub { font-weight: 700; }
.tiny { --fs: 17; font-weight: 600; }
.para { word-spacing: 0.22em; }
.name { font-size: 1.32em; font-weight: 800; }
.verse { width: calc(var(--w) * var(--u)); text-align: center; --fs: 18.5; font-weight: 600; }

/* "समय : …" rows: label, colon and value in the card's three columns */
.row { left: calc(43 * var(--u)); display: grid; grid-template-columns: calc(75 * var(--u)) calc(15 * var(--u)) auto; }

.fill { letter-spacing: 0.06em; }
.fill.filled {
  letter-spacing: 0.01em;
  font-weight: 800;
  padding: 0 0.25em;
  border-bottom: max(1px, calc(1.6 * var(--u))) dotted color-mix(in srgb, var(--foil) 70%, transparent);
}

/* directions to the reception, where the printed card has its QR code */
.map {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.45em 1em 0.4em 0.8em;
  border: max(1px, calc(2.2 * var(--u))) solid var(--foil);
  border-radius: 999px;
  color: var(--foil);
  font-weight: 700;
  text-decoration: none;
  word-spacing: 0.12em;
  transition: background-color 0.2s, color 0.2s;
}
.map svg { width: 1.15em; height: 1.15em; flex: none; }
.map:hover, .map:focus-visible { background: var(--foil); color: var(--red); outline: none; }

/* ---------- outside ---------- */

.cover {
  display: grid;
  grid-template-columns: 700fr 730fr 570fr;
  border-radius: 3px;
  box-shadow: 0 1.5rem 3.5rem rgb(0 0 0 / 0.55);
}
.cover .panel { aspect-ratio: var(--pw) / 1365; }
/* the two folds */
.c-mid::before, .c-front::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2.5%;
  background: linear-gradient(90deg, rgb(60 0 0 / 0.28), transparent);
  pointer-events: none;
  z-index: 1;
}
.strip {
  top: 0;
  bottom: 0;
  width: calc(var(--w) * var(--u));
  /* the traced repeat starts 250 px down the card: 250 - 227 = 23 */
  background: url('/assets/invite/strip.svg') left calc(23 * var(--u)) / 100% auto repeat-y;
}

.honorifics {
  left: 0;
  right: 0;
  text-align: center;
  --fs: 22;
  font-weight: 600;
  word-spacing: 0;
}
/* On a personal invitation each title gets a little foil box, ticked for the ones chosen. */
.honorifics.picked span::before {
  content: '';
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.22em;
  vertical-align: -0.02em;
  border: max(1px, 0.09em) solid var(--foil);
  border-radius: 0.08em;
}
.honorifics.picked span.on::before {
  content: '✓';
  background: var(--foil);
  color: var(--red);
  font-size: 1em;
  line-height: 0.62em;
  text-align: center;
  font-weight: 800;
}
.honorifics.picked span:not(.on) { opacity: 0.6; }

.to {
  width: calc(var(--w) * var(--u));
  --lh: 82;
  --name: 38;
  height: calc(2 * var(--lh) * var(--u));
  line-height: calc(var(--lh) * var(--u));
  text-align: center;
  font-size: calc(var(--fit, var(--name)) * var(--u));
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}
.to span { position: relative; top: calc(var(--lh) * 0.24 * var(--u)); }

/* ---------- inside ---------- */

.inside {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 2000 / 1464;
  --U: calc(100cqw / 2000);
  background: var(--grain), radial-gradient(90% 60% at 45% 35%, #cf141e 0%, var(--red) 55%, #a50c15 100%);
  background-size: 420px 420px, auto;
  border-radius: 3px;
  box-shadow: 0 1.5rem 3.5rem rgb(0 0 0 / 0.55);
}
.inside > .panel {
  position: absolute;
  left: calc(var(--px) * var(--U));
  top: calc(126 * var(--U));
  width: calc(var(--pw) * var(--U));
  aspect-ratio: var(--pw) / 1224;
  background: none;
}
/* double foil frame with a flourish in each corner */
.inside > .panel::before, .inside > .panel::after {
  content: '';
  position: absolute;
  border: max(1px, calc(2.6 * var(--u))) solid var(--foil);
  pointer-events: none;
}
.inside > .panel::before { inset: 0; }
.inside > .panel::after { inset: calc(10.5 * var(--u)); }
.corner {
  position: absolute;
  width: calc(162 * var(--u));
  left: calc(15 * var(--u));
  top: calc(14 * var(--u));
  pointer-events: none;
}
.corner.tr { left: auto; right: calc(15 * var(--u)); transform: scaleX(-1); }
.corner.bl { top: auto; bottom: calc(14 * var(--u)); transform: scaleY(-1); }
.corner.br { top: auto; left: auto; right: calc(15 * var(--u)); bottom: calc(14 * var(--u)); transform: scale(-1); }

.band {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(74 * var(--U));
  background: url('/assets/invite/flowers.svg') left top / auto 100% repeat-x;
}
.band.top { top: calc(27 * var(--U)); }
.band.bottom { top: calc(1376 * var(--U)); transform: scaleY(-1); }

.family {
  left: 0;
  right: 0;
  list-style: none;
  padding: 0;
  text-align: center;
  font-size: calc(28 * var(--u) * var(--shrink, 1));
  font-weight: 500;
  word-spacing: 0.32em;
  line-height: calc(44.7 * var(--u));
  transform: translateY(calc(-22 * var(--u)));
  white-space: nowrap;
}
.family .rel { font-weight: 700; }

/* ---------- scrolling down to the inside ---------- */

/* Each panel of the inside settles into place as it scrolls into view (see invite.js). */
@media (prefers-reduced-motion: no-preference) {
  .reveal .inside > * { transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .reveal .inside > :not(.seen) { opacity: 0; transform: translateY(1.5rem); }
}

/* ---------- phones and narrow windows: one panel after another ---------- */

@media (max-width: 899px), (max-height: 559px) {
  .card { width: min(100%, 34rem); }
  .cover { display: flex; flex-direction: column; gap: 0.6rem; box-shadow: none; }
  .cover .panel { box-shadow: 0 0.8rem 2rem rgb(0 0 0 / 0.5); border-radius: 3px; }
  .c-front { order: -1; }
  .c-mid::before, .c-front::before { display: none; }

  .inside {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: none;
    box-shadow: none;
  }
  .inside > .panel {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    background: var(--grain), radial-gradient(90% 60% at 45% 35%, #cf141e 0%, var(--red) 55%, #a50c15 100%);
    background-size: 420px 420px, auto;
    box-shadow: 0 0.8rem 2rem rgb(0 0 0 / 0.5);
    border-radius: 3px;
  }
  .i-mid { order: -1; }
  .band { display: none; }

}
