/* ==========================================================================
   sections.css  |  kolam mandala, hero card, date chapter, countdown ledger,
   reception ticket, footer. The gallery has its own file; the guest envelope is envelope.css.

   The idea: the page is the invitation card. A pearl card on deep wine, the
   zari karai border at its edges, the kolam drawn on it; further down the
   stationery continues (a ticket, a coupon) and the footer is the card's back.
   ========================================================================== */

/* Kolam (mandala.js) ------------------------------------------------------- */
.mandala { width: 100%; height: 100%; overflow: visible; }
.mandala path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;                 /* hidden until drawn */
}
.mandala path.is-fill {
  fill: currentColor;
  fill-opacity: 0;
  transition: fill-opacity 1.1s var(--ease-soft) 0.1s;
}
.mandala__dot { fill: currentColor; opacity: 0; }

/* The karai band: the woven zari border, a flat strip ------------------------ */
.hero__karai, .footer__karai {
  height: 16px;
  background: var(--karai) repeat-x center / auto 100%;
}

/* Hero: the invitation, edge to edge ---------------------------------------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: var(--nav-h) 0 5vw;           /* the date chapter's arch rises over the last 5vw */
  isolation: isolate;
  overflow: clip;
}
.hero__face {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: clamp(1.25rem, 4vh, 3rem) var(--gutter) clamp(0.5rem, 2vh, 1.25rem);
  overflow: clip;
}

/* the kolam is printed on the page, faint, and clears where the names are */
.hero__mandala {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  height: 150%;
  aspect-ratio: 1;
  color: var(--ornament);
  opacity: 0.6;
  /* a mask that clears the kolam where the names sit; nothing is painted with it */
  -webkit-mask-image: radial-gradient(closest-side, transparent 38%, #000 74%); /* taste-skill-ignore */
  mask-image: radial-gradient(closest-side, transparent 38%, #000 74%); /* taste-skill-ignore */
  transform: translate3d(-50%, calc(-50% + var(--lift, 0px)), 0) rotate(var(--rot, 0deg));
  pointer-events: none;
}

/* one centred stack, symmetrical like a printed invitation */
.hero__stack {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: clamp(0.9rem, 3vh, 1.9rem);
  width: 100%;
  text-align: center;
}
.hero__lead { max-width: 28ch; font-size: var(--step-0); color: var(--text-soft); }
.hero__invite {
  max-width: 34ch;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  line-height: 1.2;
  color: var(--name-ink);
}

.names {
  display: grid;
  justify-items: center;
  font-family: var(--font-names);
  /* sized by width AND height, so very wide or very short screens never blow it up */
  font-size: calc(clamp(3.4rem, min(14vw, 25svh), 13rem) * var(--names-scale, 1));
  font-style: var(--names-style, normal);
  font-weight: 400;
  line-height: var(--names-leading, 0.84);
  letter-spacing: var(--names-tracking, -0.035em);
  color: var(--name-ink);
}
.names__line { display: block; }
.names__amp {
  margin-block: 0.12em;
  font-family: var(--font-display);
  font-size: 0.4em;
  font-style: italic;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ornament-ink);
}

/* letters rise out of the mask, one after another */
.ch {
  display: inline-block;
  transform: translate3d(0, 150%, 0) rotate(6deg);
  transform-origin: 0 100%;
  will-change: transform;
}
.hero.is-ready .ch {
  transform: none;
  transition: transform 1.2s var(--ease-expo) calc(250ms + var(--i) * 45ms);
}

/* supporting lines arrive just after the names: opacity only */
.hero__fade { opacity: 0; }
.hero.is-ready .hero__fade {
  opacity: 1;
  transition: opacity 1s var(--ease-soft) 1.1s;
}

/* the kolam draws itself once, quickly */
.hero .mandala__dot { opacity: 0; }
.hero.is-ready .mandala path {
  animation: draw 1.8s var(--ease-expo) both;
  animation-delay: calc(150ms + var(--r) * 100ms);
}
.hero.is-ready .mandala__dot {
  animation: fade-in 0.7s ease both;
  animation-delay: calc(400ms + var(--r) * 100ms + var(--k) * 8ms);
}

/* the cue says what scrolling does */
.hero__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: var(--step-0);
  text-decoration: none;
}
.hero__cue svg { width: 1.25rem; height: 1.25rem; animation: cue-bob 2.2s var(--ease-soft) infinite; }

/* Date chapter: scroll draws the kolam ------------------------------------ */
.date {
  position: relative;
  z-index: var(--z-date);
  height: 175svh;                /* short on purpose: about three flicks of the wheel */
  margin-top: -5vw;
  border-radius: 50% 50% 0 0 / 5vw 5vw 0 0;
  overflow: clip;
}
.date__sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  place-items: center;
}
.date__mandala {
  position: absolute;
  left: 50%;
  top: calc(50% - 2.5vw);               /* clear of the countdown's arch */
  width: min(max(92vmin, 34rem), 66rem);
  aspect-ratio: 1;
  translate: -50% -50%;
  color: var(--ornament);
}
.date__mandala .mandala { will-change: transform; }

.date__title {
  position: absolute;
  left: var(--gutter);
  top: calc(var(--nav-h) + clamp(1rem, 3vh, 2rem));
  font-size: var(--step-2);
  font-style: italic;
  color: var(--text);
}
.date__hint {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(1.5rem, 6vh, 3.5rem);
  font-size: var(--step-0);
  color: var(--text-soft);
}
/* where the kolam is complete; the bar's Date link scrolls to it */
.date__end { position: absolute; left: 0; top: calc(100% - 100svh); width: 1px; height: 1px; pointer-events: none; }   /* taste-skill-ignore: an invisible anchor, not a rule */

.date__card {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  text-align: center;
}
.date__event { font-size: var(--step-0); color: var(--ornament-ink); }
.date__day {
  font-size: clamp(5.2rem, 17vmin, 12rem);
  line-height: 0.9;
  color: var(--name-ink);
}
.date__month { font-size: clamp(1.4rem, 3.8vmin, 2.6rem); line-height: 1.1; }
.date__time { font-size: var(--step-0); color: var(--text-soft); }
.date__pending { max-width: 10ch; font-size: clamp(1.8rem, 5vmin, 3rem); line-height: 1.05; color: var(--name-ink); }

.date__card .mask > span { transform: translate3d(0, 160%, 0); }
.date.is-complete .date__card .mask > span {
  transform: none;
  transition: transform 1s var(--ease-expo) calc(var(--d, 0) * 0.7ms);
}
.date.is-complete .mandala path.is-fill { fill-opacity: 0.16; }

/* reduced motion: no pinning, everything already shown */
.date.is-static { height: auto; }
.date.is-static .date__sticky { position: relative; height: auto; min-height: 100svh; padding-block: 6rem; }
.date.is-static .date__end { top: 0; }

/* Countdown: a ledger. Figures align on the right, their words on the baseline. */
.countdown {
  position: relative;
  z-index: calc(var(--z-date) + 1);
  margin-top: -5vw;
  padding-block: calc(5vw + var(--section-pad)) var(--section-pad);
  border-radius: 50% 50% 0 0 / 5vw 5vw 0 0;
  background: var(--bg);
}
.countdown__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 60rem) {
  .countdown__grid { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
}
.countdown__head { display: grid; gap: var(--space-4); align-content: center; }
.countdown__head h2 { font-size: var(--step-3); }
.countdown__note { font-size: var(--step-0); color: var(--text-soft); max-width: 30ch; }

.cd {
  display: grid;
  gap: clamp(0.25rem, 1vw, 0.75rem);
  justify-self: start;
  width: min(100%, 36rem);
  font-size: clamp(4.25rem, 12vw, 11rem);         /* the figures set the scale of each row */
}
@media (min-width: 60rem) { .cd { justify-self: end; } }
.cd__unit {
  display: grid;
  grid-template-columns: 1.5em minmax(0, 1fr);       /* room for three digits of days */
  align-items: end;
  column-gap: clamp(0.9rem, 2vw, 1.5rem);
}
.cd__digits {
  display: flex;
  justify-content: flex-end;
  font-family: var(--font-display);
  font-size: 1em;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--name-ink);
  font-variant-numeric: lining-nums;
}
.cd__slot { display: block; width: 0.47em; height: 1em; overflow: hidden; text-align: center; }
.cd__roll {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--d, 0) * -10%));
  transition: transform 0.9s var(--ease-expo);
}
.cd__roll span { display: block; height: 1em; }
.cd__label { padding-bottom: 0.2em; color: var(--text); font-size: var(--step-0); line-height: 1.2; }
.cd[data-state="pending"] .cd__digits { opacity: 0.28; }

/* Reception: details on a ticket ------------------------------------------------ */
.reception { padding-block: var(--section-pad); }
.reception__grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 6rem);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 60rem) {
  .reception__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; }
}
.reception__info { display: grid; gap: var(--space-6); align-content: start; }
.reception__title { font-size: var(--step-4); line-height: 0.9; }

/* the ticket: pearl stock, a karai strip along its top, a punched line between */
.facts { display: grid; background: var(--surface); }
.facts::before {
  content: "";
  height: 16px;
  background: var(--karai) repeat-x center / auto 100%;
}
.facts__row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-5) clamp(1.25rem, 3vw, 2rem);
}
.facts__row + .facts__row { border-top: 5px dotted var(--bg); }
.facts dt { color: var(--text-soft); font-size: var(--step-0); padding-top: 0.5em; }
.facts dd { display: grid; gap: 0.25rem; font-size: var(--step-0); }
.facts__main {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.1;
  color: var(--name-ink);
}
.facts dd .soft { color: var(--text); }
.is-pending { color: var(--text-soft); font-style: italic; }
.reception__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.reception__note { font-size: var(--step-0); }

/* the map sits in an arch, like the mehrab of a hall */
.reception__map {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 50% 50% 0 0 / 37.5% 37.5% 0 0;
  background: var(--surface);
}
@media (max-width: 59.99rem) and (min-width: 40.01rem) { .reception__map { width: min(100%, 30rem); justify-self: center; } }
.reception__map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  color: var(--text);
}
.map__empty svg { width: 3rem; height: 3rem; color: var(--ornament-ink); }
.map__empty p { max-width: 20ch; font-size: var(--step-0); }

/* Footer: the back of the card ------------------------------------------------------ */
.footer {
  position: relative;
  padding: var(--space-8) 0 calc(var(--space-7) + env(safe-area-inset-bottom));
}
/* the card's cut edge: scallops standing on the footer's top */
.footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 24px;
  background: var(--scallop) repeat-x left bottom / 48px 24px;
}
.footer__karai { margin-bottom: var(--space-7); }
.footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-7);
}
.footer__note { font-size: var(--step-1); line-height: 1.25; max-width: 24ch; color: var(--text); }
.footer__names {
  display: grid;
  font-family: var(--font-names);
  font-size: calc(clamp(3.4rem, 15vw, 15rem) * var(--names-scale, 1));
  font-style: var(--names-style, normal);
  line-height: var(--names-leading, 0.84);
  letter-spacing: var(--names-tracking, -0.035em);
  color: var(--name-ink);
}
.footer__name--2 { justify-self: end; }
