/* Reusable components. Section-specific placement lives in sections.css. */

/* ---------- Logo (mark + wordmark, positioned as in Figma) ---------- */
.logo {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 103px;
  height: 40px;
}
.logo--lg { width: 103px; height: 40px; } /* header (larger from 768, in responsive.css) */
.logo--xl { width: 144px; height: 56px; } /* footer (larger from 768, in responsive.css) */
/* Static logo (header) and the animated logo build (footer): the same 164 × 64 artwork, scaled to the box. */
.logo__img,
.logo__build { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Store badges ---------- */
/* Both badges by default; the <head> script sets data-platform so phones see only their own store. */
.store-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
}
/* The pair is 322px wide: like Figma, it may reach into its container's side padding rather than wrap,
   and only wraps on phones too narrow for that. */
@media (max-width: 353px) { .store-badges { flex-wrap: wrap; } }
.store-badge { display: block; flex-shrink: 0; height: 48px; }
.store-badge img { display: block; width: auto; height: 100%; }
[data-platform="ios"] .store-badge--google,
[data-platform="android"] .store-badge--apple { display: none; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font: var(--type-sans-small-bold);
  white-space: nowrap;
}
.button__icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Single-color icon drawn in the current text color (icon file used as a mask). */
.icon {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.icon--copy  { --icon: url("../assets/icons/copy.svg"); }
.icon--pause { --icon: url("../assets/icons/pause.svg"); }
.icon--play  { --icon: url("../assets/icons/play.svg"); }
.icon--play-solid { --icon: url("../assets/icons/play-solid.svg"); }
.icon--close { --icon: url("../assets/icons/close.svg"); }
.button--dark  { background: var(--button-dark-bg);  color: var(--button-dark-label); }
.button--light { background: var(--button-light-bg); color: var(--button-light-label); }
.button--white { background: var(--white); color: var(--text-primary); } /* on photos (Figma "on-dark") */
.button--block { width: 100%; }

/* ---------- Chat bubble (hero) ---------- */
.chat-bubble {
  position: absolute;
  display: flex;
  gap: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-md);
  filter: drop-shadow(var(--shadow-chat));
}
.chat-bubble__tail { position: absolute; width: 27.25px; height: 31px; }
.chat-bubble > :not(.chat-bubble__tail) { position: relative; } /* content paints above the tail */
.chat-bubble__tail img { width: 100%; height: 100%; }

/* ---------- Tip bubble (weekly coaching tips) ---------- */
.tip-bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 304px;
  min-height: 182px; /* all four bubbles share Figma's fixed height */
  padding: var(--space-6) 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  filter: drop-shadow(var(--shadow-card));
  text-align: center;
}
.tip-bubble > p { position: relative; width: 100%; }
.tip-bubble__eyebrow { color: var(--text-secondary); }
.tip-bubble__quote   { color: var(--text-primary); }
.tip-bubble__why     { color: var(--text-secondary); text-wrap: pretty; }
.tip-bubble__why strong { font: var(--type-sans-caption-bold); color: var(--text-primary); }

/* ---------- Pagination dots ---------- */
.dots {
  display: flex;
  gap: var(--space-2);
  min-height: 8px; /* reserves space before the script adds the dots */
}
.dots__dot {
  width: 8px;
  height: 8px;
  border-radius: 40px;
  background: var(--darken-200);
  transition: width 0.2s ease, background-color 0.2s ease;
}
.dots__dot.is-active { width: 32px; background: var(--accent); }

/* ---------- Carousel: full-bleed horizontal scroller ---------- */
.carousel {
  display: flex;
  width: calc(100% + 2 * var(--page-gutter));
  margin-inline: calc(-1 * var(--page-gutter));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  /* Room for card shadows, which a scroll box would otherwise clip. */
  padding-block-end: var(--space-8);
  margin-block-end: calc(-1 * var(--space-8));
}
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { flex-shrink: 0; scroll-snap-align: start; }

/* ---------- Phone mockup ---------- */
.phone {
  position: relative;
  flex-shrink: 0;
  height: var(--phone-h, 377px); /* width follows from the iPhone 15 Pro aspect ratio */
  aspect-ratio: 380 / 779;
  filter: drop-shadow(var(--shadow-device));
}
.phone__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.phone__screen {
  position: absolute;
  left: 4.4%;
  right: 4.48%;
  top: calc(50% + 0.5px);
  transform: translateY(-50%);
  aspect-ratio: 437.3416 / 948.9519;
}
.phone__screen img { width: 100%; height: 100%; }
/* Video phones: the recording sits under the frame, its corners rounded just inside the frame's opening
   (the opening's corners are about 120px at the frame's 936 × 1920 size; the video rounds at 110px, so its
   edge tucks under the bezel). The shadow is the same as the other phones', drawn as a box-shadow around the
   phone's outline (about a 155px corner) instead of a filter over a playing video. */
.phone--video { filter: none; isolation: isolate; }
/* The frame (bezel and camera oval) on its own layer, explicitly above the video: Safari on iPhone can draw a
   playing video above later siblings while the row slides, which hid the camera oval mid-slide. */
.phone--video .phone__screen { z-index: 0; }
.phone--video .phone__frame { z-index: 1; transform: translateZ(0); }
.phone--video::before {
  content: "";
  position: absolute;
  inset: 0 0.75% 0 0.53%;
  border-radius: 16.6% / 8.07%;
  box-shadow: var(--shadow-device);
}
.phone--video .phone__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12.9% / 5.95%;
  /* The first frame, set per video as a background-image in index.html: iPhones may leave a paused video
     that hasn't played yet empty (no poster, nothing loaded), so the still shows through behind it. */
  background: var(--neutral-50) center / cover no-repeat;
}

/* ---------- iOS notification (illustrative) ---------- */
.notif {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9.143px;
  width: 320px;
  padding: 11.886px 15.543px 24.686px 12.8px;
  border-radius: 21.943px;
  font-family: var(--font-ios);
}
.notif__banner {
  position: absolute;
  left: 0; right: 0;
  height: 7.314px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: clip;
  border-radius: 21.943px;
}
.notif__banner--back { bottom: -1.52px; opacity: 0.8; padding-inline: 36.571px; }
.notif__banner--mid  { bottom: 5.79px;  opacity: 0.9; padding-inline: 18.286px; }
.notif__banner-glass {
  position: relative;
  flex-shrink: 0;
  height: 58.514px;
  width: 100%;
}
.notif__banner-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.07);
  mix-blend-mode: screen;
}
/* Card surface: frosted white with a soft halo (Figma: 8% black, shown outside the card only). */
.notif__glass {
  position: absolute;
  inset: -0.46px 1.83px 13.56px -1.83px;
  border-radius: 18px;
  box-shadow: var(--shadow-notification);
}
.notif__glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  mix-blend-mode: screen;
}
.notif__icon {
  position: relative;
  flex-shrink: 0;
  width: 35.657px;
  height: 35.798px;
  border-radius: 8.889px;
  object-fit: cover;
}
.notif__text {
  position: relative;
  flex: 1 0 0;
  min-width: 1px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.notif__row { display: flex; align-items: flex-start; gap: 14.629px; }
.notif__title {
  flex: 1 0 0;
  min-width: 1px;
  font-weight: 590;
  font-size: 13.71px;
  line-height: 15.543px;
  letter-spacing: -0.1725px;
  color: var(--darken-900);
}
.notif__time {
  flex-shrink: 0;
  font-size: 13.71px;
  line-height: 20.724px;
  color: #4d4d4d;
  text-align: right;
  white-space: nowrap;
}
.notif__body {
  font-size: 13.71px;
  line-height: 16.457px;
  letter-spacing: -0.1725px;
  color: var(--darken-500);
}

/* ---------- Question card (Stacks) ---------- */
.q-card {
  position: absolute;
  display: flex;
  width: 227px;
  height: 227px;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  overflow: clip;
  background: var(--surface);
  box-shadow: var(--shadow-stack-top);
}
.q-card__border {
  position: relative;
  flex: 1 0 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--darken-100);
  border-radius: var(--radius-sm);
}
.q-card__text {
  flex: 1 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-4) 0;
  text-align: center;
  color: var(--text-primary);
}
.q-card__footer {
  display: flex;
  justify-content: center;
  padding: var(--space-4) var(--space-4) var(--space-6);
}

/* WeDo logo on question cards (the site logo, scaled down) */
.card-logo { display: block; width: 61px; height: 24px; }

/* ---------- Photo CTA card ---------- */
.photo-card {
  position: relative;
  isolation: isolate;
  flex: 1 0 0;
  min-width: 1px;
  aspect-ratio: 300 / 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-10) var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-photo-card);
  overflow: clip;
}
.photo-card__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  border-radius: var(--radius-xl);
}
.photo-card__media img { position: absolute; }
.photo-card__scrim {
  position: absolute;
  top: 0.26px; left: 0;
  width: 100%;
  height: 250px;
  z-index: -1;
  background: var(--scrim-photo);
}
.photo-card .section-title { gap: var(--space-4); }

/* ---------- Background-video toggle (icon-only play/pause, Figma icons) ---------- */
/* The 24px icon sits 16px from the card's corner; the 44px button around it is the tap area. */
.media-toggle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
}
.media-toggle[hidden] { display: none; }
.media-toggle { color: var(--white); }            /* over video */
.media-toggle--ink { color: var(--text-primary); } /* over the cream page */
.media-toggle__icon { width: 24px; height: 24px; } /* icons carry their own 50% opacity */
.media-toggle__icon--play { display: none; }
.media-toggle.is-paused .media-toggle__icon--play { display: block; }
.media-toggle.is-paused .media-toggle__icon--pause { display: none; }
.media-toggle:focus-visible { outline-color: currentColor; outline-offset: -4px; }

/* ---------- Video (Vimeo embed; poster until a video ID is set) ---------- */
.video {
  position: relative;
  width: 100%;
  aspect-ratio: 300 / 400;
  overflow: hidden;
  isolation: isolate;
  border: 0.5px solid var(--darken-100);
  border-radius: var(--radius-xl); /* like the photo cards */
  box-shadow: var(--shadow-video);
  background: var(--neutral-900);
}
.video__poster {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.video__poster img { position: absolute; }
/* Play button over the thumbnail: the whole video is the target, with a frosted circle in the middle. */
.video__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--darken-100);
  color: var(--white);
  cursor: pointer;
}
.video__play-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: var(--lighten-400);
  /* No backdrop-filter blur: in Safari a blurred layer inside this rounded, clipped box made the rest of the box
     (thumbnail and all) vanish after it scrolled out of view and back. */
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.video__play:hover .video__play-circle,
.video.is-armed:hover .video__play-circle { transform: scale(1.06); background: var(--lighten-500); }
.video__play:focus-visible { outline: 2px solid var(--white); outline-offset: -4px; border-radius: inherit; }
.video__play-icon { width: 20px; height: 20px; }
.video__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
/* The Vimeo player loads underneath the thumbnail (js/main.js). Once it's ready, taps pass through the
   thumbnail to it (so phones play with sound); once it plays, the thumbnail fades away. */
.video.is-armed .video__poster,
.video.is-armed .video__play { pointer-events: none; }
.video__poster,
.video__play { transition: opacity 0.3s ease, visibility 0s; }
.video.is-playing .video__poster,
.video.is-playing .video__play { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; }

/* ---------- Invite card ---------- */
.invite-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 334px;
  padding: var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  filter: drop-shadow(var(--shadow-card));
}
.invite-card__quote {
  width: 100%;
  text-align: center;
  color: var(--text-primary);
}

/* ---------- Footer link ---------- */
.footer-link {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text-primary);
}
.footer-link img { width: 20px; height: 20px; }

/* Release mode (see the top of index.html): before launch, the "Nudge me when it’s ready" button stands in
   for every row of store badges. */
.notify-button { display: none; }
[data-release="prerelease"] .notify-button { display: inline-flex; }
[data-release="prerelease"] .store-badges { display: none; }

/* ---------- Text field (floating label, Figma "Form") ---------- */
.field {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 60px;
  padding: 0 var(--space-4) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  cursor: text;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field.is-invalid { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
/* The label rests inside the empty field at full size, like placeholder text, then shrinks up to the top
   once the field has focus, or a value (typed or autofilled). The input's placeholder is a single space
   only so CSS can tell when it's empty (:placeholder-shown). */
.field__label {
  position: absolute;
  top: 17.8px; /* centered: (58px inside the border − 22.4px line) / 2 */
  left: 15px;
  font: var(--type-sans-small);
  color: var(--text-tertiary);
  pointer-events: none;
  transition: top 0.18s ease, font-size 0.18s ease, line-height 0.18s ease;
}
.field:focus-within .field__label,
.field:has(.field__input:not(:placeholder-shown)) .field__label,
.field:has(.field__input:autofill) .field__label {
  top: 7px;
  font: var(--type-sans-xs-bold);
}
@media (prefers-reduced-motion: reduce) {
  .field__label { transition: none; }
}
.field__input {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  outline: none;
}

/* ---------- Sign-up dialog (pre-release) ---------- */
/* The dialog covers the visible part of the screen: js/main.js keeps --visible-top/--visible-height matched
   to it, so with the iPhone keyboard up the card centers above the keyboard instead of behind it. The card
   centers with auto margins, so if it doesn't fit, it scrolls inside the dialog rather than off the top. */
.notify-dialog {
  position: fixed;
  inset: auto 0;
  top: var(--visible-top, 0px);
  width: 100%;
  max-width: 100%;
  height: var(--visible-height, 100dvh);
  max-height: none;
  margin: 0;
  padding: 20px var(--page-gutter); /* room for the close button on the card's corner */
  border: 0;
  background: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.notify-dialog[open] { display: flex; flex-direction: column; align-items: center; }
/* Behind the dialog: a 25% black tint over the page, blurred 8px. */
.notify-dialog::backdrop {
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
/* In: fade and slide up. Out (js/main.js adds .is-closing, then closes when it's done): the reverse. */
.notify-dialog[open] { animation: dialog-in 0.32s cubic-bezier(0.2, 0.8, 0.25, 1); }
.notify-dialog[open]::backdrop { animation: backdrop-in 0.32s ease; }
.notify-dialog.is-closing { animation: dialog-out 0.24s cubic-bezier(0.4, 0, 0.8, 0.6) forwards; }
.notify-dialog.is-closing::backdrop { animation: backdrop-out 0.24s ease forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(24px); } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .notify-dialog[open], .notify-dialog[open]::backdrop,
  .notify-dialog.is-closing, .notify-dialog.is-closing::backdrop { animation: none; }
}
.notify-dialog__card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  max-width: 342px;
  margin: auto 0;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-6) var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  filter: drop-shadow(var(--shadow-card));
}
.notify-dialog__intro,
.notify-dialog__done {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: center;
  color: var(--text-primary);
}
.notify-dialog__intro[hidden],
.notify-dialog__done[hidden],
.notify-form[hidden] { display: none; }
.notify-dialog h2:focus { outline: none; }
.notify-dialog__sub { color: var(--text-secondary); }
.notify-dialog__close {
  position: absolute;
  top: -16px;
  right: -16px; /* centered on the card's corner */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--taupe-400);
  color: var(--white);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.16);
}
/* A 44px tap area around the smaller circle. */
.notify-dialog__close::after { content: ""; position: absolute; inset: -6px; }
.notify-dialog__close .icon { width: 24px; height: 24px; }
.notify-form { display: flex; flex-direction: column; gap: var(--space-4); }
.button.notify-form__submit { height: 56px; } /* taller than the standard button, per Figma */
.notify-form__submit[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.notify-form__error { margin-top: calc(-1 * var(--space-2)); color: var(--error); }
.notify-form__error[hidden] { display: none; }

/* No scrolling behind an open dialog. js/main.js also pins the page in place (position: fixed at the
   current scroll), which is what stops iPhone Safari scrolling it while the keyboard is up. */
html.is-modal-open,
html.is-modal-open body { overflow: hidden; }
html.is-modal-open body { position: fixed; left: 0; right: 0; }

/* ---------- Desktop header bar ---------- */
/* Desktop only: css/responsive.css shows it from 1024px, and js/main.js pins it once the hero is scrolled past. */
.site-bar { display: none; }
