/* Page sections, top to bottom, matching the Figma "Home" frame. */

/* ---------- 1. Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-height: 728px; /* with the next section's heading pulled up to meet it, that heading shows above the fold */
}
/* Background slider along the bottom (Figma "Frame 791"): video, a fade into the page on top, the toggle. */
.hero__media {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 520px;
}
.hero__slides {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
/* Each slide carries the page color, so its video multiplies against it even while the slide is moving
   (a moving slide becomes its own layer, which would otherwise leave the blend nothing to multiply with). */
.hero-slide {
  position: absolute;
  inset: 0;
  isolation: isolate;
  background: var(--bg-page);
}
.hero-slide + .hero-slide { transform: translateX(100%); } /* later slides wait off to the right */
.hero-slide__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: center / cover no-repeat; /* first-frame still until the video's own frame loads */
  mix-blend-mode: multiply;
}
.hero-slide__video--woman-walking { background-image: url(../assets/video/hero-woman-walking-poster.jpg); }
.hero-slide__video--man-office    { background-image: url(../assets/video/hero-man-office-poster.jpg); }
.hero-slide__video--woman-garden  { background-image: url(../assets/video/hero-woman-garden-poster.jpg); }
.hero-slide__video--man-couch     { background-image: url(../assets/video/hero-man-couch-poster.jpg); }
.hero__fade {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 88px;
  background: linear-gradient(to bottom, var(--neutral-50), rgba(255, 251, 246, 0));
  pointer-events: none;
}
/* The bottom of the video fades into the next section's top color, so the two run together. */
.hero__fade--bottom {
  top: auto;
  bottom: 0;
  height: 147px;
  background: linear-gradient(to bottom, rgba(59, 56, 51, 0), rgba(59, 56, 51, 0.75) 50%, var(--neutral-800));
}
/* The 24px icon sits 32px in from the right and bottom edges. */
.hero__toggle {
  right: calc(var(--space-8) - 10px);
  bottom: calc(var(--space-8) - 10px);
}
.hero__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  padding: var(--space-6);
}
.hero__heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
  text-align: center;
}
.hero__heading > .notify-button { align-self: center; } /* the badges sit in the heading block, 24px below the copy */
.hero__sub { color: var(--text-secondary); }
.hero__sub strong { font: var(--type-sans-small-bold); color: var(--text-primary); }

/* A slide's two bubbles, stacked like messages (Figma spots). The pair is anchored by its outer edge, toward the
   side of the frame away from the person; the typing bubble lines up with the inner edge of the message above,
   however wide that is (js/main.js fits each message bubble to its longest line, so none has empty space and
   the inner edge stays clear of the person). js/main.js brings the bubbles in newest-at-the-bottom. */
.chat-thread {
  position: absolute;
  left: var(--space-6);
  top: 193px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.chat-thread > .chat-bubble { position: relative; }
.chat-bubble--prompt {
  transform-origin: 0 100%; /* pops from its tail */
  width: 224px; /* at most; narrowed to its text */
  padding: var(--space-4);
  align-items: flex-start;
  justify-content: center;
}
.chat-bubble--prompt .chat-bubble__tail { left: 0; bottom: -8px; }
/* Mirrored slide: same distances from the right edge, tails and pop origins flipped. */
.hero-slide--mirrored .chat-thread { left: auto; right: var(--space-6); align-items: flex-start; }
.hero-slide--mirrored .chat-bubble--prompt { transform-origin: 100% 100%; }
.hero-slide--mirrored .chat-bubble--prompt .chat-bubble__tail { left: auto; right: 0; transform: scaleX(-1); }
.hero-slide--mirrored .chat-bubble--typing { transform-origin: 0 100%; }
.hero-slide--mirrored .chat-bubble--typing .chat-bubble__tail { right: auto; left: 0; transform: none; }
.chat-bubble__text {
  flex: 1 0 0;
  min-width: 1px;
  color: var(--accent);
}
.chat-bubble--typing {
  transform-origin: 100% 100%;
  height: 52px;
  padding: var(--space-3) var(--space-4);
  align-items: center;
  justify-content: flex-end;
}
.chat-bubble--typing .chat-bubble__tail { right: 0; bottom: -6.5px; transform: scaleX(-1); }
/* Typing indicator: three dots that rise and darken one after another. */
.typing-dots { display: flex; gap: var(--space-1); flex-shrink: 0; }
.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--typing-dot);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: none; background: var(--typing-dot); }
  30% { transform: translateY(-3px); background: var(--text-tertiary); }
}
.hero__media.is-paused .typing-dots span { animation-play-state: paused; }
/* With the script running, bubbles wait hidden until their cue (reduced motion shows the finished scene). */
@media (prefers-reduced-motion: no-preference) {
  .js [data-hero-slide] [data-bubble] { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-dots span { animation: none; }
}

/* ---------- 2. Daily WeDo ("All the Feels") ---------- */
.daily {
  gap: var(--space-12);
  padding-top: var(--space-6); /* the hero fades into this section, so its heading sits close under it */
  /* The bottom 200px fades behind the phones into the color the Daily Nudge below starts with. */
  background:
    linear-gradient(to bottom, rgba(255, 251, 246, 0), rgba(255, 251, 246, 0.5) 40%, var(--neutral-100)) bottom / 100% 200px no-repeat,
    var(--bg-dark-warm);
}
.daily .section-title { gap: var(--space-2); }
.daily__title { display: flex; flex-direction: column; }

/* Typewriter headline: types a theme, holds, backspaces, types the next (js/main.js). */
.typewriter { white-space: nowrap; }
.typewriter__cursor {
  display: none; /* shown once the script is running */
  width: 2px;
  height: 0.8em;
  margin-inline: 2px 1px;
  vertical-align: -0.04em;
  background: currentColor;
  animation: caret-blink 1.06s steps(1) infinite;
}
.typewriter.is-active .typewriter__cursor { display: inline-block; }
.typewriter.is-typing .typewriter__cursor { animation: none; } /* solid while typing or deleting */
@keyframes caret-blink { 50% { opacity: 0; } }
/* Very narrow phones: step down to Serif Medium so the longest theme stays on one line. */
@media (max-width: 359px) {
  .typewriter { font: var(--type-serif-medium-bold); letter-spacing: 0; }
}
/* Full-bleed track; the row inside steps left in time with the headline (js/main.js adds the copies). */
.phone-track {
  --phone-h: 480px;
  --shadow-device: var(--shadow-device-soft); /* phones: the section fades to cream behind them */
  flex-shrink: 0;
  width: calc(100% + 2 * var(--page-gutter));
  margin-inline: calc(-1 * var(--page-gutter));
  container-type: inline-size;
}
.phone-row {
  display: flex;
  gap: var(--space-4);
  width: max-content;
  /* First phone centered (it matches the first theme): the static, no-JS and reduced-motion state. */
  transform: translateX(calc(50cqw - var(--phone-h) * 380 / 779 / 2));
}
/* One step to the next theme's phone (js/main.js): a quick start, then a long, soft stop. */
.phone-row.is-sliding { transition: transform 0.9s cubic-bezier(0.65, 0, 0.25, 1); }

/* ---------- 3. Daily nudge (notifications) ---------- */
/* The section above fades into this one's top color; it lightens to the page color by its bottom. */
.nudge {
  gap: var(--space-12);
  padding-top: var(--space-6);
  background: linear-gradient(to bottom, var(--neutral-100), var(--neutral-50));
}
.notif-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  width: 100%;
}
.notif-stack .notif:nth-child(1) { z-index: 3; }
.notif-stack .notif:nth-child(2) { z-index: 2; opacity: 0.5; }
.notif-stack .notif:nth-child(3) { z-index: 1; opacity: 0.25; }
/* Arrival animation (js/main.js sets each card's position and opacity per step). */
.notif-stack.is-armed .notif {
  transition:
    transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.55s ease;
}
/* After they've all arrived: a slow, subtle float, each a beat apart. It uses `translate`, separate from the
   `transform` the arrival animation sets, so the two never fight. */
.notif-stack.is-floating .notif { animation: notif-float 4.5s ease-in-out infinite; }
.notif-stack.is-floating .notif:nth-child(2) { animation-delay: 0.7s; }
.notif-stack.is-floating .notif:nth-child(3) { animation-delay: 1.4s; }
@keyframes notif-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}
@media (prefers-reduced-motion: reduce) {
  .notif-stack.is-floating .notif { animation: none; }
}
.notif-stack.is-armed .notif.is-arriving {
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), /* slight overshoot, like an iOS banner */
    opacity 0.3s ease;
}

/* ---------- 4 & 9. Photo CTA cards ---------- */
.photo-cta {
  display: flex;
  align-items: center;
  padding-inline: var(--space-4);
}
.photo-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: center / cover no-repeat; /* first-frame still (inline style) until the video's own frame loads */
}

/* ---------- 5. Weekly tips ---------- */
.tips { gap: var(--space-12); }
.tips__group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
}
.tips__carousel {
  gap: var(--space-6);
  /* Centers a 304px slide: half the section's content box + gutter − half the slide. */
  padding-inline: calc(50% + var(--page-gutter) - 152px);
}
.tips__carousel > * { scroll-snap-align: center; }
.tip-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 304px;
}
.tip-slide { justify-content: space-between; } /* bubble on top, art on the bottom edge, aligned across slides */
.tip-slide__slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 18px;
}
.tip-slide__art {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  mix-blend-mode: multiply;
}
.tip-slide__video {
  display: block;
  width: 100%;
  height: 100%;
  background: center / contain no-repeat; /* first-frame still (inline style) until the video's own frame loads */
} /* white video backgrounds disappear via the art's multiply blend */
.tip-bubble__tail {
  position: absolute;
  right: 41.25px;
  bottom: -24px;
  width: 81.75px;
  height: 93px;
}
.tip-bubble__tail img { width: 100%; height: 100%; }
.tip-bubble__tail--small { right: 48px; bottom: -37.5px; width: 28.5px; height: 46.5px; }
.tip-bubble__signal {
  position: absolute;
  left: 50%;
  bottom: -33px;
  width: 30px;
  height: 24px;
  transform: translateX(-50%);
}
.tip-bubble__signal img {
  position: absolute;
  left: -1.146px;  /* -3.82% of the 30px slot */
  top: -0.703px;   /* -2.93% of the 24px slot */
  width: 32.2943px;
  height: 24.7041px;
}

/* One play/pause for all tip videos: the 24px icon sits 24px right of the centered 304px slide and 32px above the group's bottom. */
.tips__toggle {
  right: calc(50% - 152px - 24px - 10px);
  bottom: 22px;
}

/* ---------- 6. Date night (question deck) ---------- */
.date-night {
  z-index: 1; /* cards slide in from below and fly off over the neighboring sections */
  gap: var(--space-12);
  padding-bottom: 56px;
  overflow-x: clip;   /* flicked cards leave at the screen edge */
  overflow-y: visible; /* but can rise in from below and cross the neighbors */
  /* Phones: darkens to neutral/900 at the bottom, exactly where Small Moments begins. */
  background: linear-gradient(to bottom, #6a645e, var(--neutral-900));
}
/* Night sky: a star layer filling Date night and one filling Small Moments, each behind its
   section's content (z-index −1 within the section). js/main.js lays the stars out across both as one sky. */
.stars {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: -1;
  pointer-events: none;
  color: var(--neutral-100);
}
.stars--date-night { top: 0; }
.stars--science { top: 0; }
.science { isolation: isolate; } /* so its star layer sits above its background, below its content */
.stars .star {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  opacity: calc(var(--peak) * 0.4);
  transform: rotate(var(--turn)) scale(0.8);
  animation: twinkle var(--twinkle) ease-in-out var(--delay) infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: calc(var(--peak) * 0.2); transform: rotate(var(--turn)) scale(0.72); }
  50%      { opacity: var(--peak);             transform: rotate(var(--turn)) scale(1); }
}
.stars.is-resting .star { animation-play-state: paused; } /* off screen (js/main.js) */
@media (prefers-reduced-motion: reduce) {
  .stars .star { animation: none; opacity: calc(var(--peak) * 0.6); }
}
.date-night .section-title__heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.date-night__deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}
.q-stack {
  position: relative;
  flex-shrink: 0;
  width: 227px;
  height: 338px;
  touch-action: pan-y; /* horizontal drags move the card; vertical ones still scroll the page */
  user-select: none;
  -webkit-user-select: none;
}
/* Resting position per card comes from --x/--y/--r in the HTML; js/main.js moves them from there. */
.q-stack .q-card {
  left: 0;
  top: 0;
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0));
}
.q-stack .q-card img { pointer-events: none; -webkit-user-drag: none; }
/* Depth: cards further down the deck are shaded darker (js/main.js sets --shade per card). */
.q-stack .q-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--neutral-900);
  opacity: var(--shade, 0);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.q-stack.is-live .q-card.is-top { cursor: grab; }
.q-stack.is-live .q-card.is-top:active { cursor: grabbing; }
.q-stack .q-card:focus-visible { outline: 2px solid var(--white); outline-offset: 4px; }
.q-stack .q-card__text { text-wrap: balance; } /* even line lengths, so no question ends on a lone word */

.swipe-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
}
.swipe-hint__hand { transform-origin: 50% 90%; } /* pivots near the wrist during the demo */
.swipe-hint__label { color: var(--text-on-dark-tertiary); }
.swipe-hint__mouse { display: none; } /* "Drag to explore" for a mouse, on desktop (css/responsive.css) */

/* ---------- 7. Science ---------- */
.science {
  gap: var(--space-12);
  /* Phones: picks up from Date night at neutral/900 and lightens all the way to the page color, so Date night,
     Small Moments and the invite section read as one background. Only the sides are clipped, so the video's
     shadow can spill past the bottom. */
  padding-block: var(--space-10);
  overflow: clip visible;
  background: linear-gradient(to bottom, var(--neutral-900), var(--neutral-800) 50%, var(--neutral-50));
}
.science__video-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
}
.science .section-title__sub strong { font: var(--type-sans-small-bold); color: var(--text-on-dark); } /* the Parrotts' names */
/* Phones: a lighter shadow, as the section fades to the page color behind it. */
.science .video { box-shadow: 0 16px 32px rgba(0, 0, 0, 0.05); }
.video--parrotts .video__poster img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* a 9:16 frame, centered in the 3:4 card */
}

/* ---------- 8. Invite your partner ---------- */
.invite {
  gap: var(--space-6);
  padding-top: var(--space-10); /* Small Moments fades into the page right above */
}
/* Fireworks (js/main.js): a canvas filling the section, behind everything else in it. */
.invite__fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.invite > .section-title,
.invite > .carousel,
.invite > .dots,
.invite > .invite__art { position: relative; } /* painted above the canvas */
.invite > .section-title { margin-bottom: var(--space-4); } /* 40px down to the cards (with the section's 24px gap) */
.invite__carousel {
  gap: var(--space-4);
  /* Centers a 334px card: half the section's content box + gutter − half the card. */
  padding-inline: calc(50% + var(--page-gutter) - 167px);
}
.invite__carousel > * { scroll-snap-align: center; }
.invite__art {
  width: 240px;
  height: 240px;
  mix-blend-mode: multiply; /* the video's white background disappears into the page */
}
.invite__video {
  display: block;
  width: 100%;
  height: 100%;
  background: center / contain no-repeat; /* first-frame still (inline style) until the video's own frame loads */
}
/* The 24px icon sits 32px in from the right edge, level with the bottom of the video. */
.invite__toggle {
  right: calc(var(--space-8) - 10px);
  bottom: calc(var(--section-space) - 10px);
}

/* ---------- 10. Footer ---------- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-16) var(--page-gutter) var(--space-6);
  text-align: center;
}
.site-footer__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
}
/* Idaho Marriage Initiative credit (only for visitors in Idaho; see js/main.js) */
.imi-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
}
.imi-credit[hidden] { display: none; }
.imi-credit__logo { display: block; width: 146px; height: 48px; }
.site-footer__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.site-footer__copyright { color: var(--text-secondary); }
.site-footer__copyright a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
