/* ═══════════════════════════════════════════════════════════════
   Pikumo — Warm Native Design System
   Complete rewrite for full website application
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ─────────────────────────────────────────────────── */

:root {
  --coral:        #ff5a6e;
  --coral-hover:  #ef5065;
  --coral-soft:   #fff0f2;
  --coral-dim:    rgba(255,90,110,0.10);
  --ink:          #161616;
  --ink-2:        #3a3a3a;
  --muted:        #6c6c72;
  --faint:        #a0a0a8;
  --stone:        #f7f4f2;
  --warm-white:   #fffdfc;
  --surface:      #ffffff;
  --line:         rgba(17,17,17,0.07);
  --line-md:      rgba(17,17,17,0.12);

  --r-sm:   10px;
  --r-md:   16px;
  --r-lg:   22px;
  --r-xl:   28px;
  --r-pill: 999px;

  --sh-xs: 0 1px 4px rgba(17,17,17,0.04);
  --sh-sm: 0 3px 12px rgba(17,17,17,0.06);
  --sh-md: 0 6px 24px rgba(17,17,17,0.08);
  --sh-lg: 0 12px 40px rgba(17,17,17,0.10);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", monospace;

  --header-h: 68px;
  --wizard-footer-h: 72px;
  --container-w: 1160px;
  --section-pad: 96px;
}

/* ── 2. Reset + base ───────────────────────────────────────────── */

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--stone);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.025em; line-height: 1.14; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid rgba(255,90,110,0.55);
  outline-offset: 2px;
}

/* ── 3. Container ──────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
}

/* ── 4. Buttons ────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--coral);
  border: 1.5px solid var(--coral);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, transform 80ms ease;
}
.btn-primary:hover { background: var(--coral); color: #fff; }
.btn-primary:active { transform: scale(0.97); }

.btn-primary-lg {
  height: 52px;
  padding: 0 28px;
  font-size: 16px;
  border-radius: var(--r-pill);
  background: var(--coral);
  color: #fff;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 160ms ease, transform 80ms ease;
}
.btn-primary-lg:hover { background: var(--coral-hover); }
.btn-primary-lg:active { transform: scale(0.97); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 120ms;
}
.btn-ghost:hover { color: var(--ink); }

/* ── 5. Site header ────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(247,244,242,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.site-logo-icon { color: var(--coral); flex-shrink: 0; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 120ms;
}
.site-nav-link:hover { color: var(--ink); }

/* Hamburger button — only visible on mobile */
.site-nav-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.site-nav-menu-btn:hover { background: var(--stone); }

@media (max-width: 640px) {
  .site-header-inner,
  .wizard-bar-inner { padding: 0 16px; }

  .site-nav-menu-btn { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: calc(var(--header-h) - 6px);
    right: 12px;
    left: auto;
    z-index: 199;
    width: 220px;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    border-radius: var(--r-md);
    box-shadow: 0 14px 32px rgba(17, 17, 17, 0.12), 0 0 0 1px var(--line);
    transform-origin: top right;
    transform: scale(0.96) translateY(-4px);
    opacity: 0;
    pointer-events: none;
    transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), opacity 160ms ease;
  }
  .site-header.menu-open .site-nav {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Items — same treatment for <a> and <button>; .site-nav .site-nav-link
     beats .site-nav-link--button { padding: 0 } (equal specificity, source order). */
  .site-nav .site-nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    text-align: left;
    border: none;
    border-radius: var(--r-sm);
    background: none;
    font-family: inherit;
    cursor: pointer;
  }
  .site-nav .site-nav-link[hidden] { display: none; }
  .site-nav .site-nav-link:hover,
  .site-nav .site-nav-link:active { background: var(--stone); }

  .site-nav .btn-primary {
    width: 100%;
    height: 40px;
    margin-top: 6px;
    font-size: 14px;
  }
}

/* ── 6. Landing — Hero ─────────────────────────────────────────── */

.page-landing {
  min-height: 100dvh;
}

.hero {
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(255,90,110,0.13) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(127,169,201,0.10) 0%, transparent 50%),
    var(--stone);
  overflow: hidden;
  padding: 60px 0 80px;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 64px;
}

.hero-copy { max-width: 520px; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding: 0;
  color: var(--coral);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(36px, 4.5vw, 58px);
  font-weight: 750;
  line-height: 1.10;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 20px;
}

.hero-title em {
  font-style: normal;
  color: var(--coral);
}

.hero-sub {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 36px;
  max-width: 420px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-note {
  font-size: 13px;
  color: var(--faint);
}

/* Hero visual: overlapping memory cards */
.hero-visual {
  position: relative;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-cards {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-card {
  position: absolute;
  width: 220px;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-lg);
  transition: transform 300ms ease;
}

.hero-card:hover { transform: translateY(-4px) !important; }

.hero-card--1 { top: 24px;  left: 10%;  transform: rotate(-4deg); }
.hero-card--2 { top: 60px;  left: 35%;  transform: rotate(2deg); z-index: 2; }
.hero-card--3 { top: 30px;  right: 0%;  transform: rotate(-2deg); }
.hero-card--4 { top: 240px; left: 20%;  transform: rotate(3deg); z-index: 1; }

/* The whole card is now the 1:1 image; the title sits as an overlay at the
   bottom with a soft dark-to-transparent scrim for legibility. */
.hero-card-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
}

.hero-card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.30) 55%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.hero-card-title {
  font-size: 13px;
  font-weight: 650;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
/* Meta line removed from the hero cards — keep only the title. */
.hero-card-meta { display: none; }

@media (max-width: 900px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .hero-visual { height: 280px; }
  .hero-card { width: 150px; }
  .hero-card--1 { top: 16px; left: 5%; }
  .hero-card--2 { top: 40px; left: 30%; }
  .hero-card--3 { top: 20px; right: 2%; }
  .hero-card--4 { display: none; }
}

@media (max-width: 640px) {
  .hero { min-height: auto; padding: 40px 0 60px; }
  .hero-visual { height: 200px; }
}

/* ── 7. Landing — How it works ─────────────────────────────────── */

.how-it-works {
  padding: var(--section-pad) 0;
  background: var(--surface);
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}
.section-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.section-sub {
  margin-top: 14px;
  font-size: 17px;
  color: var(--muted);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  position: relative;
}

/* Connector line — runs through the vertical center of the 48px circles
   (top: 24px) and is covered by the dots where they overlap. Insets pin
   the line ends to the inner edges of the outer circles:
   col width = (100% - 80px) / 3  →  half-col = (100% - 80px) / 6
   plus 24px (half the circle) reaches the first circle's right edge. */
.steps-grid::before {
  content: "";
  position: absolute;
  top: 24px;
  left: calc((100% - 80px) / 6 + 24px);
  right: calc((100% - 80px) / 6 + 24px);
  height: 1px;
  background: var(--line-md);
}

.step {
  text-align: center;
  padding: 0 16px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(var(--coral-dim), var(--coral-dim)) var(--stone);
  color: var(--coral);
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.step-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.step-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 640px) {
  .steps-grid { grid-template-columns: 1fr; gap: 32px; }
  .steps-grid::before { display: none; }
  .step              { padding: 0 8px; }
  .step-num          { width: 40px; height: 40px; font-size: 16px; margin-bottom: 14px; }
  .step-title        { font-size: 17px; }
  .step-desc         { font-size: 14px; }
}

/* ── 8. Landing — Examples ─────────────────────────────────────── */

.examples {
  padding: var(--section-pad) 0;
  background: var(--stone);
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.example-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  background: var(--surface);
  transition: transform 200ms ease, box-shadow 200ms ease;
  aspect-ratio: 1 / 1;
}
.example-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-md);
}
.example-card-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
}
/* Body is now an overlay at the bottom of the 1:1 image with a soft
   dark-to-transparent scrim for legibility. */
.example-card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 18px 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.36) 50%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.example-card-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0.85;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.example-card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.example-card-place {
  font-size: 12.5px;
  color: #fff;
  opacity: 0.78;
  margin-top: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

@media (max-width: 900px) {
  .examples-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .examples-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ── 9. Landing — Features ─────────────────────────────────────── */

.features {
  padding: var(--section-pad) 0;
  background: var(--surface);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (min-width: 768px) {
  .features-grid { grid-template-columns: repeat(4, 1fr); }
}

.feature-card {
  padding: 28px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--warm-white);
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--coral-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--coral);
}
.feature-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.feature-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── 10. Landing — Final CTA ───────────────────────────────────── */

.final-cta {
  padding: 120px 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255,90,110,0.12) 0%, transparent 60%),
    var(--stone);
  text-align: center;
}
.final-cta-title {
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 750;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
}
.final-cta-sub {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ── 11. Landing — Footer ──────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  background: var(--stone);
}
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}
.site-footer-copy {
  font-size: 13px;
  color: var(--faint);
}

/* ── 12. Wizard layout ─────────────────────────────────────────── */

.page-create {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.wizard-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(247,244,242,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
}

.wizard-bar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

.wizard-progress-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}
.wizard-progress-segment {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line-md);
  transition: background 260ms ease;
}
.wizard-progress-segment.is-active {
  background: var(--coral);
}

.wizard-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.wizard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wizard-step {
  display: none;
  flex-direction: column;
  flex: 1;
}

.wizard-step.is-active {
  display: flex;
}

.step-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px 120px;
  gap: 32px;
}

@media (max-width: 640px) {
  .step-inner { padding: 32px 16px 100px; }
}

/* Step 7 reveal: keep padding-top at the default (48px) so the step-copy
   eyebrow/title align with every other step. Only the footer clearance
   and inter-row gap are tightened. */
[data-step="generating"] .step-inner {
  /* Reclaim the 120px wizard-footer clearance — the footer is hidden on
     this step, so we don't need the buffer. */
  padding-bottom: 32px;
  gap: 20px;
}

.step-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--coral);
}

.step-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 8px;
}

.step-sub {
  font-size: 16px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* Wizard sticky footer */
.wizard-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(247,244,242,1) 60%, rgba(247,244,242,0));
}

/* Mirror .wizard-bar-inner so Back / Next align with the progress bar's
   left and right edges. */
.wizard-footer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

.wizard-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

@media (max-width: 640px) {
  .wizard-footer-inner { padding: 0 16px; }
}

/* ── 13. Type card grid ────────────────────────────────────────── */

.type-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--sh-xs);
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
  cursor: pointer;
}
.type-card:hover {
  border-color: rgba(255,90,110,0.25);
  box-shadow: var(--sh-sm);
}
.type-card.is-selected {
  border-color: var(--coral);
  background: var(--coral-soft);
  box-shadow: 0 0 0 1px var(--coral), var(--sh-sm);
}
.type-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,90,110,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
}
.type-card-icon svg { width: 18px; height: 18px; }
.type-card strong { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; }
.type-card small { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ── 14. Context inputs ────────────────────────────────────────── */

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.context-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
}
.context-field + .context-field {
  border-top: 1px solid var(--line);
}

.context-field-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--muted);
}
.context-field-icon svg { width: 16px; height: 16px; }

.context-field-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.context-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  padding: 0;
  outline: none;
  line-height: 1.45;
}
.context-input::placeholder { color: var(--faint); }

/* ── 15. Story screen ──────────────────────────────────────────── */

.story-input-panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.story-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--stone);
}
.story-mode-btn {
  flex: 1;
  height: 34px;
  /* Inner radius = panel radius (22px) − padding (6px) so the active pill's
     corners nest cleanly against the panel's outer curve. */
  border-radius: 16px;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  transition: all 120ms ease;
}
.story-mode-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: var(--sh-xs);
}
.story-mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mic button area. Locked to a stable height across pre/recording/done
   states; mic+ring vertically centered. The Cancel link's slot is reserved
   via `visibility: hidden` (not `display: none`) so the mic doesn't shift
   between pre-recording (no cancel) and recording (cancel visible). */
.story-mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 24px;
  min-height: 300px;
}

.story-timer-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-hero-mic {
  position: relative;
  z-index: 2;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms, transform 80ms, box-shadow 160ms;
  box-shadow: 0 0 0 6px rgba(255,90,110,0.08), var(--sh-sm);
}
.voice-hero-mic:hover {
  background: rgba(255,90,110,0.18);
  box-shadow: 0 0 0 8px rgba(255,90,110,0.10), var(--sh-sm);
}
.voice-hero-mic:active { transform: scale(0.95); }
.voice-hero-mic.is-recording { background: var(--coral); color: white; box-shadow: var(--sh-md); }
.voice-hero-mic.is-done { background: var(--coral-soft); color: var(--coral); }
.voice-hero-mic.is-transcribing { cursor: progress; }
.voice-hero-mic.is-transcribing .voice-hero-icon-mic { opacity: 0.4; }
/* Spinning ring around the mic during transcription — visible motion so
   "something is happening" is unmistakable even with the button disabled. */
.voice-hero-mic.is-transcribing::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--coral);
  border-right-color: rgba(255, 90, 110, 0.35);
  animation: mic-spin 0.85s linear infinite;
  pointer-events: none;
}
@keyframes mic-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .voice-hero-mic.is-transcribing::after { animation: none; border-top-color: rgba(255,90,110,0.5); }
}

.voice-hero-mic-icon { width: 28px; height: 28px; }
.voice-hero-icon-mic   { display: block; }
.voice-hero-icon-stop  { display: none; }
.voice-hero-icon-done  { display: none; }
.voice-hero-mic.is-recording .voice-hero-icon-mic  { display: none; }
.voice-hero-mic.is-recording .voice-hero-icon-stop { display: block; }
.voice-hero-mic.is-done .voice-hero-icon-mic  { display: none; }
.voice-hero-mic.is-done .voice-hero-icon-done { display: block; }

/* Timer ring dots: default=visible track, is-active=coral drain */
.story-timer-dot { r: 3.5px; fill: rgba(17,17,17,0.14); transition: fill 120ms; }
.story-timer-dot.is-active { fill: var(--timer-color, var(--coral)); }

.story-timer-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  pointer-events: none;
}
.story-timer-inline {
  color: var(--coral);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.voice-hero-helper {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.45;
  /* Reserve two lines so the mic doesn't shift when the helper wraps to 2
     lines in one state and 1 line in another (e.g. the post-recording
     "Tap to record again — or edit the text" can wrap on narrow screens). */
  min-height: 42px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-cancel-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--coral);
  cursor: pointer;
}
.story-cancel-link:hover { text-decoration: underline; }

.story-cancel-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  transition: background 120ms;
}
.story-cancel-btn:hover { background: rgba(17,17,17,0.05); }

.story-text-wrap {
  padding: 16px 18px 18px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}
.story-text-input {
  width: 100%;
  flex: 1;
  min-height: 140px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  resize: none;
  outline: none;
  line-height: 1.6;
}
.story-text-input::placeholder { color: var(--faint); }

/* ── 16. Review screen ─────────────────────────────────────────── */

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.review-memory-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--coral);
}
.review-title-sep { color: var(--faint); }
.review-title-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  padding: 0;
  letter-spacing: -0.01em;
}
.review-title-input::placeholder { color: var(--faint); font-weight: 400; }

.review-starring-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.review-starring-label {
  font-size: 13px;
  color: var(--muted);
}
.review-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.review-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(255,90,110,0.08);
  color: var(--coral);
  font-size: 13px;
  font-weight: 550;
}
.review-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  color: rgba(255,90,110,0.55);
  background: transparent;
  transition: background 100ms, color 100ms;
}
.review-chip-x:hover {
  background: rgba(255,90,110,0.15);
  color: var(--coral);
}
.review-chip-add {
  font-size: 13px;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  border: 1.5px dashed var(--line-md);
  transition: all 120ms;
}
.review-chip-add:hover { border-color: var(--coral); color: var(--coral); }
.review-chip-input {
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  width: 120px;
}

.moments-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Moment cards */
.memory-card {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--sh-xs);
}
.moment-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.moment-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--coral);
}
.moment-title-input {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.015em;
  outline: none;
  padding: 0;
  margin-bottom: 8px;
}
.moment-details-input {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  outline: none;
  resize: none;
  padding: 0;
}

/* ── 17. People screen ─────────────────────────────────────────── */

.people-all-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Wrapper divs must be transparent to the grid so .person-slot children flow in directly */
#personSlots,
#petSlot {
  display: contents;
}

.person-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative; /* anchors the remove button */
}

.person-add-card {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  border: 2px dashed var(--line-md);
  background: rgba(255,255,255,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 120ms, background 120ms;
}
.person-add-card:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
}
.person-add-plus { color: var(--muted); }
.person-add-plus svg { width: 24px; height: 24px; }

.person-filled-card {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--sh-sm);
}
.person-avatar-wrap {
  width: 100%;
  height: 100%;
  display: block;
}
.person-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.person-slot-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(17,17,17,0.3));
  pointer-events: none;
}

/* Camera overlay — appears on hover to signal "click to replace" */
.person-slot-replace {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17,17,17,0.38);
  color: #fff;
  opacity: 0;
  transition: opacity 140ms;
  pointer-events: none;
}
.person-avatar-wrap:hover .person-slot-replace { opacity: 1; }

/* Remove (×) button — top-right corner of the slot */
.person-slot-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 120ms;
}
.person-slot-remove:hover { background: #dc2626; }
.person-slot-name {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pet slot */
.person-slot.is-pet .person-add-card {
  border-style: dashed;
  border-color: rgba(127,169,201,0.35);
}
.person-slot.is-optional .person-slot-name { color: var(--muted); }
.person-slot.is-optional .person-slot-name::after {
  content: " (optional)";
  font-weight: 400;
  color: var(--faint);
}

.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── 18. Style screen ──────────────────────────────────────────── */

.style-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.section-helper {
  font-size: 13px;
  color: var(--muted);
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  /* Slight breakout from .step-inner's 640px cap — room for the previews. */
  width: calc(100vw - 48px);
  max-width: 720px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.style-card {
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 160ms, box-shadow 160ms;
}
.style-card:hover { border-color: rgba(255,90,110,0.3); }
.style-card.is-selected {
  border-color: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}
.style-card-preview { width: 100%; aspect-ratio: 4/3; }
.style-card-label {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.style-card-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.option-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.option-chip {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: all 120ms;
}
.option-chip:hover { border-color: rgba(255,90,110,0.3); }
.option-chip[aria-pressed="true"],
.option-chip.is-selected {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 600;
}

/* ── 19. Generating state ──────────────────────────────────────── */

.story-generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
}
.voice-polishing--simple { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.voice-polishing-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--coral-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
  animation: pulse 1.4s ease-in-out infinite;
}
.voice-polishing-label { font-size: 14px; color: var(--muted); }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* ── 20. Results page ──────────────────────────────────────────── */

.page-results {
  min-height: 100dvh;
  background: var(--stone);
}

.results-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(247,244,242,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.results-bar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-display);
}
.results-bar-logo svg { color: var(--coral); }

.results-body {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}
.results-headline {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.results-subline {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 48px;
}

.generating-gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 263px);
  justify-content: center;
  gap: 20px;
  /* Gap to the completion-actions row is owned by step-inner's `gap: 20px`
     ([data-step="generating"] .step-inner) — adding a margin-bottom here
     would double-count. */
  margin-bottom: 0;
  /* Break out of .step-inner's 640px cap to match .container (1112px).
     With 4 cards + 20px gaps, the gallery fills 1112px exactly; with
     fewer cards the row centers. */
  width: calc(100vw - 48px);
  max-width: 1112px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
@media (max-width: 500px) {
  .generating-gallery {
    grid-auto-flow: row;
    grid-template-columns: 1fr 1fr;
    grid-auto-columns: auto;
    gap: 12px;
    width: 100%;
    max-width: none;
    left: auto;
    transform: none;
  }
}

/* Gallery cards (generated) */
.gallery-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-sm);
  animation: fadeUp 400ms ease both;
}
/* Stagger card entrances so they don't all pop in simultaneously */
.gallery-card:nth-child(2) { animation-delay: 60ms; }
.gallery-card:nth-child(3) { animation-delay: 120ms; }
.gallery-card:nth-child(4) { animation-delay: 180ms; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* Revealed gradient image fades in smoothly */
.gallery-card-img {
  animation: fadeIn 300ms ease both;
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}
.gallery-card-body { padding: 16px 18px 18px; }
.gallery-card-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.gallery-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Email capture */
.results-email {
  max-width: 520px;
}
.results-email-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}
.results-email-sub {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}
.email-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.email-input {
  flex: 1;
  min-width: 220px;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-md);
  background: var(--surface);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms;
}
.email-input:focus { border-color: var(--coral); }
.email-input::placeholder { color: var(--faint); }
.email-legal {
  font-size: 12px;
  color: var(--faint);
  margin-top: 12px;
}

.email-success {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: rgba(22,163,74,0.08);
  border: 1px solid rgba(22,163,74,0.2);
}
.email-success-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(22,163,74,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  flex-shrink: 0;
}
.email-success-text strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}
.email-success-text p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── 21. Quick picks ───────────────────────────────────────────── */

/* Quick picks — lives inside .context-panel, below the WHAT row */
#quickPicks {
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#quickPicks[hidden] { display: none; }
/* Divider between Quick Picks and the WHERE row below it */
#quickPicks + .context-field { border-top: 1px solid var(--line); }

.quick-picks-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  margin: 0;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip, .quick-pick-chip {
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--stone);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: all 120ms;
}
.chip:hover, .quick-pick-chip:hover {
  border-color: rgba(255,90,110,0.3);
  background: var(--coral-soft);
  color: var(--coral);
}

/* ── 22. Error messages ────────────────────────────────────────── */

.field-error {
  font-size: 13px;
  color: #dc2626;
  min-height: 18px;
}

/* ── 23. Cast photo sheet ──────────────────────────────────────── */

.cast-photo-sheet {
  position: fixed;
  inset: 0;
  z-index: 500;
}
.cast-photo-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17,17,17,0.4);
}
.cast-photo-sheet-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  padding: 16px 0 calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--sh-lg);
}
.cast-photo-sheet-title {
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.cast-photo-sheet-list {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
}
.cast-photo-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  transition: background 100ms;
}
.cast-photo-row:hover { background: var(--stone); }
.cast-photo-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--stone);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── 24. Motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Step 7: completion-actions container ── */

/* Spacing between gallery and the actions row is owned by step-inner's
   `gap: 20px` ([data-step="generating"] .step-inner). No divider. */
#genEmailSection {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.gen-email-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.gen-email-sub {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.gen-restart-btn {
  display: block;
  margin-top: 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 120ms;
}
.gen-restart-btn:hover { color: var(--ink); }

/* ── Toast / error banner ─────────────────────────────────────── */

.wizard-toast {
  position: fixed;
  top: calc(var(--header-h) * 2 + 10px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 480px;
  width: calc(100% - 48px);
  background: #1c1c1e;
  color: #fff;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--sh-lg);
  z-index: 1000;
  cursor: pointer;
  animation: toastIn 180ms ease;
  transition: opacity 360ms ease, transform 360ms ease;
  opacity: 1;
}
.wizard-toast.is-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}
.wizard-toast-icon { flex-shrink: 0; color: #fbbf24; }
.wizard-toast-close {
  margin-left: auto;
  flex-shrink: 0;
  color: rgba(255,255,255,0.45);
  padding: 2px;
  transition: color 120ms;
}
.wizard-toast-close:hover { color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Optional field label ─────────────────────────────────────── */

.field-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ── Moment detail overlay ─────────────────────────────────────── */

.moment-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(17,17,17,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* Top-anchored layout: the image always starts at the same Y across
     moments (no jump on prev/next), and content sits high in the viewport
     instead of being vertically centered. Description length below can
     vary freely — only the bottom of the content changes. */
  padding: 64px 24px 64px;
  overflow-y: auto;
  /* Always reserve scrollbar space so swapping moments with different body
     lengths never causes a horizontal jump. */
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  animation: fadeIn 180ms ease;
}

/* No white card — content floats on the dark overlay */
.moment-detail-card {
  background: transparent;
  max-width: 480px;
  width: 100%;
  animation: cardFloat 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.moment-detail-image {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: var(--r-lg);
  overflow: hidden;
}

.moment-detail-body {
  padding: 14px 4px 0;
}

.moment-detail-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  color: #fff;
}

.moment-detail-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.60);
  line-height: 1.6;
}

.moment-detail-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms;
  backdrop-filter: blur(4px);
}
.moment-detail-close:hover { background: rgba(255,255,255,0.28); }

/* Revealed gallery cards become clickable */
.gallery-card.is-revealed { cursor: pointer; }
.gallery-card.is-revealed:hover { transform: translateY(-3px); transition: transform 160ms ease; }

/* ── Moment detail — navigation and counter ───────────────────── */

/* Frame: same max-width as card. Image position is pinned via the overlay's
   padding-top, so the frame itself doesn't need to be the positioning anchor. */
.moment-detail-frame {
  max-width: 480px;
  width: 100%;
}

/* Wraps the image and anchors the chevrons so they always sit at the image's
   vertical center, regardless of how long the description below is. */
.moment-detail-image-wrap {
  position: relative;
  width: 100%;
}

.moment-detail-nav {
  position: absolute;
  left: -68px;
  right: -68px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.moment-detail-nav-btn {
  pointer-events: all;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms;
  backdrop-filter: blur(4px);
}
.moment-detail-nav-btn:hover { background: rgba(255,255,255,0.28); }
.moment-detail-nav-btn:disabled { visibility: hidden; pointer-events: none; background: transparent; }

.moment-detail-counter {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 16px;
  display: block;
}

/* ── Example cards — clickable ─────────────────────────────────── */

.example-card[data-demo-id] {
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.example-card[data-demo-id]:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-md);
}
.example-card[data-demo-id]:focus-visible {
  outline: 2px solid rgba(255,90,110,0.55);
  outline-offset: 3px;
}

/* ── Exit confirmation dialog ──────────────────────────────────── */

.exit-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(17,17,17,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 160ms ease;
}

.exit-confirm-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--sh-lg);
  animation: cardFloat 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.exit-confirm-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  color: var(--ink);
}

.exit-confirm-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.exit-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exit-confirm-leave {
  height: 46px;
  border-radius: var(--r-pill);
  background: #dc2626;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: background 120ms;
}
.exit-confirm-leave:hover { background: #b91c1c; }

.exit-confirm-cancel {
  height: 46px;
  border-radius: var(--r-pill);
  background: var(--stone);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: background 120ms;
}
.exit-confirm-cancel:hover { background: var(--line-md); }

/* ── Example memory gallery overlay ───────────────────────────── */

.example-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(17,17,17,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 24px 64px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fadeIn 180ms ease;
}

.example-detail-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 120ms;
}
.example-detail-close:hover { background: rgba(255,255,255,0.28); }

/* No white card — content floats directly on the dark overlay */
.example-detail-modal {
  background: transparent;
  max-width: 480px;
  width: 100%;
  animation: cardFloat 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.example-detail-header {
  padding: 0 0 24px;
}

.example-detail-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--coral);
  margin-bottom: 6px;
}

.example-detail-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
}

.example-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.example-moment-card { }

.example-moment-image {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
}

.example-moment-body {
  padding: 12px 4px 0;
}

.example-moment-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 5px;
  color: #fff;
}

.example-moment-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.60);
  line-height: 1.55;
}
