.homepage-demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 1fr);
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
  min-width: 0;
}

.demo-player { min-width: 0; margin: 0; }

@media (min-width: 541px) {
  .homepage-demo { row-gap: 0; }

  .demo-player {
    display: grid;
    grid-column: 1;
    grid-row: 1 / span 2;
    grid-template-rows: subgrid;
    align-self: stretch;
    align-items: center;
  }

  .demo-picker { grid-area: 1 / 2; }
}

.demo-phone {
  position: relative;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1350 / 2760;
  margin: 0 auto;
}

.demo-display {
  position: absolute;
  inset: 0;
  mask: url("./iphone-17-display-mask.png") 0 0 / 100% 100% no-repeat;
}

.demo-screen {
  position: absolute;
  left: 5.1852%;
  top: 2.4275%;
  width: 89.6296%;
  height: 95.1449%;
  display: block;
  object-fit: cover;
}

.demo-bezel {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.demo-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.demo-toggle {
  border: 0;
  background: transparent;
  padding: 5px 2px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.demo-error:not([hidden]) { display: block; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.demo-moments-caption { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.demo-moments { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.demo-moments li { position: relative; min-width: 0; }

.demo-moment {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 1px solid #e9e7e2;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.demo-moment:hover { background: var(--cream); }
.demo-moment[aria-pressed="true"] { background: #fff6eb; border-color: #f6b872; }

.demo-moment[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #ffe1be;
  transform: scaleX(var(--clip-fill, 0));
  transform-origin: left center;
  transition: transform 180ms linear;
  pointer-events: none;
}

.demo-moment img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.demo-moment strong { display: block; font-size: 15px; line-height: 1.2; }
.demo-takeaway { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.demo-progress { display: none; }

.demo-moment[aria-pressed="true"] + .demo-progress {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (max-width: 1050px) and (min-width: 901px) {
  .homepage-demo { gap: 12px; }
  .demo-moment { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .demo-moment img { width: 34px; height: 38px; }
}

@media (min-width: 761px) and (max-width: 900px) {
  .hero:has(.homepage-demo) { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .homepage-demo { max-width: 565px; width: 100%; margin-inline: auto; }
}

@media (max-width: 540px) {
  .homepage-demo { grid-template-columns: minmax(0, 1fr); max-width: 360px; gap: 14px; }
  .demo-phone { max-width: min(63vw, 218px); }
}

@media (prefers-reduced-motion: reduce) {
  .demo-moment[aria-pressed="true"]::before { transition: none; }
}
