/**
 * Demo section — ala.menu-style dashboard showcase.
 * Mobile: centered head → phase pills → mock → caption → bullets.
 * Desktop: copy left (head + bullets), pills + mock + caption right.
 */

.section-demo {
  --lm-demo-phone-w: clamp(10.75rem, 56vw, 13.25rem);
  --lm-demo-safari-w: min(100%, 19.5rem);
  --lm-demo-stage-h: clamp(15.5rem, 46vw, 17.75rem);
  --lm-demo-desktop-phone-scale: 0.66;
  overflow: visible;
  padding-block: clamp(2.25rem, 5.5vh, 3.75rem);
  scroll-margin-top: var(--landing-header-offset);
}

.section-demo .landing-container {
  padding-inline: max(var(--lm-space-container-x, 1.25rem), clamp(1.25rem, 4vw, 2.5rem));
}

/* —— Page grid (copy + stage column) —— */
.section-demo .demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.15rem, 3.2vw, 1.65rem);
  align-items: start;
  max-width: min(100%, 68rem);
  margin-inline: auto;
}

.section-demo .demo-section-head.landing-section-head {
  margin-bottom: 0;
  text-align: center;
}

.section-demo .demo-section-head .landing-section-title {
  font-family: var(--lm-font-display);
  font-size: clamp(1.55rem, 6.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: wrap;
}

.section-demo .demo-lead {
  color: #44403c;
  font-size: clamp(0.9375rem, 3.6vw, 1.0625rem);
  line-height: 1.58;
  max-width: 36rem;
  margin-inline: auto;
  text-wrap: wrap;
}

.section-demo .demo-copy {
  order: 3;
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
}

.section-demo .demo-stage-col {
  order: 2;
  width: 100%;
  min-width: 0;
}

/* —— Inner layout (pills → mock → caption) —— */
.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(0.85rem, 2.5vw, 1.25rem);
  max-width: min(100%, calc(var(--lm-demo-phone-w) + 1.75rem));
  margin-inline: auto;
}

.demo-visual-col {
  width: 100%;
  min-width: 0;
}

.demo-visual {
  width: 100%;
  overflow: visible;
}

/* —— Phase pills (unified tabs) —— */
.demo-phases {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0 0.15rem;
}

.demo-phase {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.52rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(231, 229, 228, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--lm-ala-shadow-card, 0 2px 8px rgba(28, 25, 23, 0.08));
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--lm-ala-stone-600, #57534e);
  text-align: center;
  cursor: pointer;
  transition:
    background 0.28s ease,
    border-color 0.28s ease,
    color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease;
}

.demo-phase span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-phase .lm-icon {
  flex-shrink: 0;
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.85;
}

.demo-layout[data-active-demo] .demo-phase:not(.is-active) {
  opacity: 0.62;
  filter: saturate(0.9);
}

.demo-phase.is-active {
  background: var(--lm-ala-stone-900, #1c1917);
  border-color: var(--lm-ala-stone-900, #1c1917);
  color: #fff;
  box-shadow: var(--lm-ala-shadow-pill, 0 8px 22px rgba(28, 25, 23, 0.12));
  opacity: 1;
  filter: none;
  transform: translateY(-1px);
}

.demo-phase.is-active .lm-icon {
  opacity: 1;
}

.demo-phase:focus-visible {
  outline: 2px solid rgba(5, 150, 105, 0.45);
  outline-offset: 2px;
}

/* —— Bullets —— */
.section-demo .demo-bullets {
  margin-top: 0;
  gap: 0.35rem;
}

.section-demo .demo-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(28, 25, 23, 0.06);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.8125rem;
  line-height: 1.42;
  color: #334155;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s var(--lm-mock-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.section-demo .demo-bullets li:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(5, 150, 105, 0.14);
  transform: translateX(3px);
}

.section-demo .demo-bullets li .lm-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--lm-accent-deep, #059669);
}

/* —— Captions —— */
.demo-caption {
  position: relative;
  display: grid;
  grid-template-areas: 'stack';
  width: 100%;
  max-width: min(100%, 22rem);
  min-height: clamp(4.5rem, 16vw, 5.75rem);
  margin-inline: auto;
  padding: 0 0.5rem;
  text-align: center;
  overflow: visible;
  flex-shrink: 0;
}

.demo-caption__panel {
  grid-area: stack;
  position: relative;
  width: 100%;
  margin: 0;
  opacity: 0;
  transition: opacity var(--lm-mock-exit-ms, 340ms) var(--lm-mock-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  pointer-events: none;
}

.demo-caption__panel[hidden] {
  display: none !important;
}

.demo-caption__panel.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.demo-caption__panel.is-exiting {
  opacity: 0;
  z-index: 0;
}

.demo-caption__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--lm-ala-stone-900, #1c1917);
  text-wrap: wrap;
}

.demo-caption__text {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--lm-ala-stone-500, #78716c);
  text-wrap: wrap;
}

/* Legacy tab rows — retired */
.demo-devices-desktop__tabs,
.demo-devices-mobile__tabs,
.demo-devices-caption--desktop,
.demo-devices-caption--mobile {
  display: none !important;
}

@media (max-width: 1023px) {
  .demo-devices-desktop {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .demo-devices-mobile {
    display: none !important;
  }
}

/* —— Device stage —— */
.demo-devices-desktop__orbit {
  position: relative;
  width: 100%;
}

.demo-devices-desktop__stage {
  width: 100%;
  max-width: var(--lm-demo-safari-w);
  margin-inline: auto;
}

.demo-device-fit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.section-demo .demo-devices-desktop__phone.lm-ala-phone {
  width: var(--lm-demo-phone-w);
  max-width: 100%;
  flex-shrink: 0;
  transform: scale(var(--lm-demo-desktop-phone-scale));
  transform-origin: center center;
}

.section-demo .demo-devices-desktop__phone .lm-ala-phone__ground,
.section-demo .demo-devices-desktop__phone .lm-ala-phone__halo {
  display: none;
}

.section-demo .demo-devices-desktop__safari {
  width: 100%;
  max-width: var(--lm-demo-safari-w);
  margin-inline: auto;
}

.section-demo .demo-devices-desktop__safari .lm-safari__content {
  min-height: 0 !important;
  max-height: 12.5rem;
  overflow: hidden;
}

.section-demo .demo-devices-desktop__safari .lm-mock-fidelity--dashboard {
  font-size: 0.74em;
}

.section-demo.is-motion-active .demo-devices-desktop__stage.lm-mock-tilt-host .lm-mock-tilt__inner,
.demo-devices-mobile__orbit.is-live .demo-devices-mobile__panel.is-active .lm-ala-phone__shell {
  animation: none;
}

/* Unified panel heights — clipped stage, same footprint for every tab */
.section-demo .demo-devices-mobile__panels,
.section-demo[data-active-demo='dashboard'] .demo-devices-mobile__panels,
.section-demo[data-active-demo='storefront'] .demo-devices-mobile__panels,
.section-demo[data-active-demo='checkout'] .demo-devices-mobile__panels {
  min-height: var(--lm-demo-stage-h);
  height: var(--lm-demo-stage-h);
}

.section-demo .demo-devices-desktop__panels,
.section-demo[data-active-demo='dashboard'] .demo-devices-desktop__panels,
.section-demo[data-active-demo='storefront'] .demo-devices-desktop__panels,
.section-demo[data-active-demo='checkout'] .demo-devices-desktop__panels {
  position: relative;
  width: 100%;
  height: var(--lm-demo-stage-h);
  min-height: var(--lm-demo-stage-h);
  overflow: hidden;
  border-radius: 1rem;
  background:
    radial-gradient(ellipse 80% 70% at 50% 35%, rgba(236, 253, 245, 0.45), transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 250, 249, 0.92));
  box-shadow: inset 0 0 0 1px rgba(231, 229, 228, 0.65);
}

.section-demo .demo-devices-desktop__panel {
  margin: 0;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.section-demo .demo-devices-desktop__panel.is-active {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
  overflow: hidden;
  padding: 0.65rem 0.5rem;
  box-sizing: border-box;
}

.section-demo .demo-devices-desktop__panel.is-exiting {
  opacity: 0;
  z-index: 1;
}

.section-demo .demo-devices-desktop__panel[hidden] {
  display: none !important;
}

.section-demo .demo-devices-desktop__orbit,
.section-demo .demo-devices-mobile__orbit {
  padding-block: 0.35rem;
  padding-inline: 0;
}

.section-demo .lm-ala-phone--tilt-right .lm-ala-phone__shell,
.section-demo .lm-ala-phone--tilt-left .lm-ala-phone__shell,
.section-demo .demo-devices-desktop__stage.lm-mock-tilt-host .lm-mock-tilt__inner {
  transform: none !important;
}

.section-demo .demo-devices-desktop__phone .lm-mock-fidelity--store,
.section-demo .demo-devices-desktop__phone .lm-mock-fidelity--checkout,
.section-demo .demo-devices-mobile__phone .lm-mock-fidelity--store,
.section-demo .demo-devices-mobile__phone .lm-mock-fidelity--checkout,
.section-demo .demo-devices-mobile__phone .lm-mock-fidelity--dashboard {
  font-size: 0.86em;
}

.demo-visual-col,
.demo-visual,
.demo-devices-desktop {
  min-width: 0;
  max-width: 100%;
}

/* —— Mobile mock stage —— */
@media (max-width: 1023px) {
  .demo-layout {
    max-width: min(100%, calc(var(--lm-demo-phone-w) + 1.25rem));
  }

  .demo-phases {
    gap: 0.3rem;
  }

  .demo-phase {
    font-size: 0.625rem;
    padding: 0.48rem 0.42rem;
  }

  .demo-devices-mobile {
    width: 100%;
    margin-inline: auto;
  }

  .demo-devices-mobile__orbit {
    padding: 0.15rem 0 0.25rem;
    overflow: visible;
  }

  .demo-devices-mobile__panels {
    position: relative;
    overflow: visible;
    transition: none;
  }

  .demo-devices-mobile__stage {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    height: 100%;
    padding: 0;
  }

  .demo-devices-mobile__phone,
  .demo-devices-mobile .lm-ala-phone {
    width: var(--lm-demo-phone-w);
    max-width: 100%;
    margin-inline: auto;
  }

  .section-demo .demo-devices-mobile__stage--storefront .lm-ala-phone__screen,
  .section-demo .demo-devices-mobile__stage--dashboard .lm-ala-phone__screen,
  .section-demo .demo-devices-mobile__stage--checkout .lm-ala-phone__screen {
    display: flex;
    flex-direction: column;
  }

  .section-demo .demo-devices-mobile__stage--checkout .lm-mock-fidelity--checkout {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 0.2rem;
  }

  .section-demo .demo-devices-mobile__stage--checkout .lm-checkout {
    transform: none;
  }

  .section-demo .demo-bullets li {
    padding: 0.48rem 0.55rem;
    font-size: 0.78125rem;
  }
}

/* —— Desktop two-column —— */
@media (min-width: 1024px) {
  .section-demo {
    --lm-demo-safari-w: min(100%, 20.5rem);
    --lm-demo-phone-w: 11.5rem;
    --lm-demo-stage-h: 17.5rem;
    --lm-demo-desktop-phone-scale: 0.68;
  }

  .section-demo .demo-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    grid-template-rows: auto 1fr;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: center;
  }

  .section-demo .demo-section-head.landing-section-head {
    grid-column: 1;
    grid-row: 1;
    text-align: start;
    margin-bottom: 0.35rem;
  }

  .section-demo .demo-section-head .landing-section-title {
    font-size: clamp(1.85rem, 3.4vw, 2.5rem);
  }

  .section-demo .demo-lead {
    margin-inline: 0;
  }

  .section-demo .demo-copy {
    grid-column: 1;
    grid-row: 2;
    order: unset;
    max-width: 36rem;
    margin-inline: 0;
  }

  .section-demo .demo-stage-col {
    grid-column: 2;
    grid-row: 1 / span 2;
    order: unset;
    align-self: center;
    width: 100%;
    max-width: 24rem;
    margin-inline: auto;
  }

  .demo-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    width: 100%;
    max-width: 24rem;
    margin-inline: auto;
  }

  .demo-phases {
    flex-shrink: 0;
    justify-content: flex-start;
    gap: 0.4rem;
  }

  .demo-visual-col {
    width: 100%;
    overflow: hidden;
  }

  .demo-devices-desktop {
    width: 100%;
  }

  .demo-devices-desktop__orbit {
    padding: 0;
    overflow: hidden;
  }

  .demo-devices-desktop__stage {
    max-width: 100%;
  }

  .section-demo .demo-devices-desktop__panels {
    height: var(--lm-demo-stage-h);
    min-height: var(--lm-demo-stage-h);
  }

  .demo-caption {
    min-height: clamp(4.75rem, 12vw, 5.75rem);
    max-width: 100%;
    padding-inline: 0.15rem;
  }

  .demo-phase {
    flex: 0 1 auto;
    min-width: 5.5rem;
    font-size: 0.72rem;
    padding: 0.52rem 0.75rem;
  }

  .demo-phase span {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section-demo .demo-bullets li:hover {
    transform: none;
  }

  .demo-phase.is-active {
    transform: none;
  }
}
