/* Hannah & David: component styles. Loaded after tokens.css; uses only its custom properties.
   The live site (dkpoult/wedding-website) uses this file unchanged as public/components.css. */

body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-text); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.hd-stage { padding: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.hd-stack { padding: var(--space-6); display: grid; gap: var(--space-5); max-width: 390px; box-sizing: border-box; }
.hd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Heading ---------- */
.hd-heading { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1.05; margin: 0 0 var(--space-3); color: var(--ink); }
.hd-heading--rose { color: var(--rose); }
.hd-heading--lavender { color: var(--lavender-deep); }
.hd-heading--sage { color: var(--sage-deep); }

/* ---------- Button ---------- */
.hd-btn {
  appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-6);
  border: 0; border-radius: var(--radius-pill);
  background: var(--rose); color: var(--on-colour);
  font-family: var(--font-text); font-size: 16px; font-weight: 650; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.hd-btn:hover { background: var(--rose-deep); }
.hd-btn:active { transform: scale(0.97); }
.hd-btn--secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--control); }
.hd-btn--secondary:hover { background: var(--surface); }
.hd-btn--on-band { background: var(--on-colour); color: var(--rose-deep); }
.hd-btn--on-band:hover { background: var(--rose-soft); }
.hd-btn--block { display: flex; width: 100%; }

/* ---------- Reply toggle (coming / can't make it) ---------- */
.hd-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: var(--space-1); border: 0; margin: 0; min-width: 0;
  border-radius: var(--radius-pill); background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--control);
}
.hd-toggle::before {
  content: ""; position: absolute; top: var(--space-1); bottom: var(--space-1); left: var(--space-1);
  width: calc(50% - var(--space-1)); border-radius: var(--radius-pill);
  background: var(--rose); opacity: 0;
  transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.2s ease, background-color 0.2s ease;
}
.hd-toggle:has(input:nth-of-type(1):checked)::before { opacity: 1; }
.hd-toggle:has(input:nth-of-type(2):checked)::before { opacity: 1; transform: translateX(100%); background: var(--ink); }
.hd-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hd-toggle label {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: center;
  transition: color 0.2s ease;
}
.hd-toggle input:checked + label { color: var(--on-colour); }
.hd-toggle input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Chips (small choices: yes / no, nights) ---------- */
.hd-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; margin: 0; padding: 0; min-width: 0; }
.hd-chip { position: relative; display: inline-flex; }
.hd-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hd-chip span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-pill); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--control);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.hd-chip input:checked + span { background: var(--sage-deep); color: var(--on-colour); box-shadow: none; }
.hd-chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Text field ---------- */
.hd-field { display: grid; gap: var(--space-2); }
.hd-field__label { font-size: 16px; font-weight: 600; }
.hd-field__hint { font-size: 14px; font-weight: 500; color: var(--ink-muted); }
.hd-field input, .hd-field textarea {
  box-sizing: border-box; width: 100%;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--control); border-radius: var(--radius-sm);
  padding: 13px 16px;
}
.hd-field textarea { resize: vertical; min-height: 96px; }
.hd-field input::placeholder, .hd-field textarea::placeholder { color: var(--ink-muted); }
.hd-field input:focus-visible, .hd-field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.hd-field--error input, .hd-field--error textarea { border-color: var(--rose); }
.hd-field__error { font-size: 14px; font-weight: 600; color: var(--rose-deep); margin: 0; }

/* ---------- Panel ---------- */
.hd-panel { box-sizing: border-box; border-radius: var(--radius-lg); padding: var(--space-6); background: var(--lavender-soft); }
.hd-panel--rose { background: var(--rose-soft); }
.hd-panel--sage { background: var(--sage-soft); }
.hd-panel > :first-child { margin-top: 0; }
.hd-panel > :last-child { margin-bottom: 0; }
.hd-panel__row { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4); }

/* ---------- Colour band: the one bold moment ---------- */
.hd-band {
  position: relative; overflow: hidden; box-sizing: border-box;
  border-radius: var(--radius-lg); padding: var(--space-7) var(--space-6);
  background: var(--rose); color: var(--on-colour);
}
.hd-band--lavender { background: var(--lavender-deep); }
.hd-band__title { position: relative; font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1; margin: 0 0 var(--space-3); padding-right: 48px; }
.hd-band__text { position: relative; margin: 0 0 var(--space-6); }
.hd-band__bloom { position: absolute; top: -24px; right: -24px; width: 96px; height: 96px; pointer-events: none; }
.hd-band__bloom .petal { fill: var(--lavender); }
.hd-band__bloom .centre { fill: var(--rose-soft); }
.hd-band--lavender .hd-band__bloom .petal { fill: var(--rose); }

/* ---------- Photo ---------- */
.hd-photo { display: block; box-sizing: border-box; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-lg); object-fit: cover; background: var(--lavender-soft); }
.hd-photo--arch { border-radius: 50% 50% var(--radius-lg) var(--radius-lg) / 40% 40% var(--radius-lg) var(--radius-lg); } /* a true semicircle on a 4:5 frame */
.hd-photo--wide { aspect-ratio: 3 / 2; }
.hd-photo--rose { background: var(--rose-soft); }
.hd-photo--sage { background: var(--sage-soft); }
.hd-photo--empty { display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--ink-muted); }

/* ---------- Hero: photo first, the guests' names overlapping its foot ---------- */
.hd-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); }
/* The photo's foot fades softly into the page, so the overlapping names stay readable on any photo.
   (Also when the photo sits in the Opening's frame.) */
.hd-hero > .hd-photo, .hd-hero > .hd-opening__frame > .hd-photo {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 80%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 80%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
}
.hd-hero__names {
  position: relative; z-index: 1; margin: -0.7em 0 var(--space-4); padding: 0 var(--space-2);
  font-family: var(--font-display); font-weight: 500; font-size: 64px; line-height: 0.95; letter-spacing: -0.01em;
  color: var(--rose); overflow-wrap: break-word;
}
.hd-hero__lede { margin: 0 0 var(--space-3); font-size: 20px; line-height: 1.45; }
.hd-hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.hd-hero__names.is-arriving { animation: hd-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes hd-rise { from { opacity: 0; transform: translateY(0.35em); } to { opacity: 1; transform: none; } }

/* ---------- Tag ---------- */
.hd-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--sage-soft); color: var(--sage-deep); font-size: 14px; font-weight: 650; line-height: 1.4; }
.hd-tag--rose { background: var(--rose-soft); color: var(--rose-deep); }
.hd-tag--lavender { background: var(--lavender-soft); color: var(--lavender-deep); }

/* ---------- Schedule ---------- */
.hd-schedule { list-style: none; margin: 0; padding: 0; }
.hd-schedule li { display: grid; grid-template-columns: 56px 1fr; gap: var(--space-4); padding: var(--space-3) 0; }
.hd-schedule time { font-size: 15px; font-weight: 700; color: var(--sage-deep); padding-top: 1px; }
.hd-schedule__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: 650; }
.hd-schedule__text { display: block; font-size: 15px; color: var(--ink-muted); }

/* ---------- Vine: grows down the page as you scroll ---------- */
.hd-vine-host { position: relative; }
.hd-vine-host > :not(.hd-vine) { position: relative; z-index: 1; }
.hd-vine { position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; overflow: visible; }
.hd-vine__stem { fill: none; stroke: var(--sage); stroke-width: 2.5; stroke-linecap: round; }
.hd-vine__twig { fill: none; stroke: var(--sage); stroke-width: 1.5; stroke-linecap: round; }
.hd-vine__leaf { fill: var(--sage); }
.hd-vine__bud { fill: var(--lavender); }
.hd-vine__petal { fill: var(--rose); }
.hd-vine__centre { fill: var(--rose-soft); }
.hd-vine__orn { transform: scale(0); transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1); }
.hd-vine__orn.is-grown { transform: scale(1); }

/* ---------- Tilt: cards sit at slight, alternating angles ---------- */
.hd-tilt { --hd-tilt: -0.8deg; transform: rotate(var(--hd-tilt)); }
.hd-tilt--right { --hd-tilt: 0.8deg; }
.hd-tilt--slight { --hd-tilt: -0.4deg; }
.hd-tilt--slight.hd-tilt--right { --hd-tilt: 0.4deg; }

/* ---------- Drift: cards settle in from the side as they rise into view ---------- */
.hd-drift {
  opacity: 0.35;
  transform: translateX(var(--hd-drift-x, 22px)) rotate(calc(var(--hd-tilt, 0deg) + var(--hd-drift-turn, 0.5deg)));
  transition: opacity 0.9s ease-out, transform 1.2s cubic-bezier(0.2, 0.7, 0.15, 1);
}
.hd-drift--left { --hd-drift-x: -22px; --hd-drift-turn: -0.5deg; }
.hd-drift.is-in { opacity: 1; transform: rotate(var(--hd-tilt, 0deg)); }

/* ---------- Reply moments: small reactions to a guest's answer ---------- */
/* "Can't make it": a petal comes loose from the band's bloom and drifts down, and their name sighs. */
.hd-band__bloom .petal { transform-box: fill-box; transform-origin: center; transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
.hd-band__bloom .petal.is-fallen { opacity: 0; transform: scale(0.3); }
.hd-petal-fall { position: absolute; z-index: 3; pointer-events: none; }
.hd-petal-fall svg { display: block; width: 100%; height: 100%; fill: var(--lavender); }
.hd-band--lavender .hd-petal-fall svg { fill: var(--rose); }
.hd-name-sigh { display: inline-block; transition: color 0.6s ease, transform 0.8s cubic-bezier(0.3, 0.6, 0.3, 1); }
.is-declined .hd-name-sigh { color: var(--ink-muted); transform: translateY(3px); }
.hd-name-sigh.is-sighing { animation: hd-sigh 0.9s cubic-bezier(0.3, 0.6, 0.3, 1); }
@keyframes hd-sigh { 0% { transform: none; } 45% { transform: translateY(7px); } 100% { transform: translateY(3px); } }
.hd-miss { margin: 0; font-size: 15px; font-weight: 500; color: var(--ink-muted); }
/* "Coming": the bloom gives a happy little bounce. */
.hd-band__bloom { transform-origin: 60% 40%; }
.hd-band__bloom.is-happy { animation: hd-bloom-joy 0.75s cubic-bezier(0.3, 1.2, 0.5, 1); }
@keyframes hd-bloom-joy { 0% { transform: none; } 35% { transform: scale(1.16) rotate(12deg); } 70% { transform: scale(0.97) rotate(-4deg); } 100% { transform: none; } }

/* ---------- Opening: plays once when a guest's own page opens ---------- */
/* Fine burnt rose lines draw a bloom over see-through lavender petals; a fine arch is drawn around the photo;
   the bloom softens away as the photo fills the arch from its centre; the names rise word by word while
   Kalnia's weight fills in. Add .is-playing to the .hd-opening hero to run it (opening.js decides when).
   Without .is-playing everything is simply in its finished state. */
.hd-opening { --hd-open-ease: cubic-bezier(0.16, 1, 0.3, 1); }
.hd-opening__frame { position: relative; }
.hd-opening__arch, .hd-opening__bloom { display: none; position: absolute; pointer-events: none; overflow: visible; }
.hd-opening__arch { inset: 0; width: 100%; height: 100%; }
.hd-opening__arch path { fill: none; stroke: var(--rose); stroke-width: 1.25; }
.hd-opening__bloom { left: 50%; top: 50%; width: 160px; height: 160px; margin: -80px 0 0 -80px; }
.hd-opening__bloom .wash { fill: var(--lavender); fill-opacity: 0.32; }
.hd-opening__bloom .washes { mix-blend-mode: multiply; }
.hd-opening__bloom .line, .hd-opening__bloom .heart-ring { fill: none; stroke: var(--rose); stroke-width: 1.25; stroke-linecap: round; }
.hd-opening__bloom .heart-dot { fill: var(--rose); }
.hd-opening__word { display: inline-block; }

.hd-opening.is-playing .hd-opening__arch, .hd-opening.is-playing .hd-opening__bloom { display: block; }
.hd-opening.is-playing .hd-opening__bloom .line { stroke-dasharray: 100 100; animation: hd-open-draw 0.7s cubic-bezier(0.45, 0, 0.2, 1) calc(var(--i, 0) * 0.05s) both; }
.hd-opening.is-playing .hd-opening__bloom .wash { transform-box: view-box; transform-origin: 80px 80px; animation: hd-open-wash 0.6s var(--hd-open-ease) 0.25s both; }
.hd-opening.is-playing .hd-opening__bloom .heart { animation: hd-open-fade 0.4s var(--hd-open-ease) 0.45s both; }
.hd-opening.is-playing .hd-opening__bloom { animation: hd-open-release 0.7s var(--hd-open-ease) 0.8s both; }
/* The outline is about 1 397 units long; a 1 400 dash draws all of it, with no gap where it closes */
.hd-opening.is-playing .hd-opening__arch path { stroke-dasharray: 1400 1400; animation: hd-open-arch 1.5s cubic-bezier(0.45, 0, 0.2, 1) 0.45s both; }
.hd-opening.is-playing .hd-opening__frame .hd-photo {
  /* The widening opening, combined with the hero's soft foot so nothing changes when the opening ends */
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%), linear-gradient(to bottom, #000 0, #000 80%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
  mask-image: radial-gradient(circle, #000 55%, transparent 72%), linear-gradient(to bottom, #000 0, #000 80%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: 50% 50%; mask-position: 50% 50%;
  -webkit-mask-composite: source-in; mask-composite: intersect;
  animation: hd-open-photo 0.95s var(--hd-open-ease) 0.95s both;
}
.hd-opening.is-playing .hd-opening__word { animation: hd-open-word 0.9s var(--hd-open-ease) calc(1.15s + var(--i, 0) * 0.1s) both; }
.hd-opening.is-playing > :not(.hd-opening__frame):not(.hd-hero__names) { animation: hd-open-after 0.8s var(--hd-open-ease) 1.4s both; }

@keyframes hd-open-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes hd-open-wash { from { opacity: 0; transform: scale(0.82); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes hd-open-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hd-open-release { from { opacity: 1; transform: none; filter: blur(0); } to { opacity: 0; transform: scale(2.3); filter: blur(5px); } }
@keyframes hd-open-arch { 0% { stroke-dashoffset: 1400; opacity: 1; } 50% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes hd-open-photo {
  from { -webkit-mask-size: 1px 1px, 100% 100%; mask-size: 1px 1px, 100% 100%; transform: scale(1.03); opacity: 0; }
  to { -webkit-mask-size: 1600px 1600px, 100% 100%; mask-size: 1600px 1600px, 100% 100%; transform: none; opacity: 1; }
}
@keyframes hd-open-word { from { clip-path: inset(0 0 100% 0); transform: translateY(0.45em); font-weight: 200; } to { clip-path: inset(0 0 -20% 0); transform: none; font-weight: 500; } }
@keyframes hd-open-after { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .hd-btn, .hd-toggle::before, .hd-toggle label, .hd-chip span { transition: none; }
  .hd-btn:active { transform: none; }
  .hd-hero__names.is-arriving { animation: none; }
  .hd-vine__orn { transform: none; transition: none; }
  .hd-drift { opacity: 1; transform: rotate(var(--hd-tilt, 0deg)); transition: none; }
  .hd-band__bloom .petal, .hd-name-sigh { transition: none; }
  .hd-name-sigh.is-sighing, .hd-band__bloom.is-happy { animation: none; }
  .hd-opening.is-playing .hd-opening__arch, .hd-opening.is-playing .hd-opening__bloom { display: none; }
  .hd-opening.is-playing * { animation: none; }
}
