/*
 * Home page: cinematic hero (living-room TV, console, casting phone) and rotating App Store reviews.
 * Written mobile-first: base rules target a ~375px phone, min-width queries add the desktop layout.
 * Loaded after styles.css, darkstyles.css and store-buttons.css, and only by index.pug.
 */
:root {
  --home-ink: #f5f1e8;
  --home-dim: rgba(245, 241, 232, 0.66);
  --home-faint: rgba(245, 241, 232, 0.42);
  --home-hairline: rgba(245, 241, 232, 0.08);
  --home-orange: #ff8a2a;
  --home-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.home-stars {
  color: #ffc35a;
  letter-spacing: 1px;
}

/* ---------- Hero ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 30px;
  padding: 28px 16px 44px;
  color: var(--home-ink);
}

.home-hero::after {
  /* "House lights dim" on load: a warm wash fades out while the screen brightens */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 214, 160, 0.2), rgba(60, 46, 34, 0.5));
  opacity: 0;
  animation: home-lights 1.8s var(--home-ease);
}

@keyframes home-lights {
  from { opacity: 1; }
  to { opacity: 0; }
}

.home-stage {
  position: relative;
  padding-bottom: 64px;
}

/* TV: 16:9 panel with the 2.35:1 film letterboxed inside, ambient light spilling onto the wall */
.home-tv {
  position: relative;
  aspect-ratio: 16 / 9;
}

.home-tv::before {
  content: "";
  position: absolute;
  inset: -14% -10%;
  border-radius: 50%;
  background: url("/assets/hero/sintel-glow.jpg") center / cover;
  filter: blur(42px) saturate(1.4);
  opacity: 0.5;
}

.home-tv-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
  box-shadow: 0 0 0 1.5px #1c1d22, 0 0 0 3px #0b0b0d, 0 30px 60px -20px rgba(0, 0, 0, 0.9);
}

.home-tv-panel img {
  width: 100%;
  height: auto;
  animation: home-screen-on 1.6s ease 0.3s both;
}

@keyframes home-screen-on {
  from { filter: brightness(0.15); }
  to { filter: none; }
}

/* Living-room hint: a low fluted walnut console with a soundbar, lit by the screen above it */
.home-console {
  position: relative;
  height: 32px;
  margin: 20px -16px 0;
  border-radius: 2px;
  background:
    radial-gradient(45% 140% at 50% 0%, rgba(255, 160, 100, 0.16), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 2px, rgba(0, 0, 0, 0.22) 2px 3px, transparent 3px 7px),
    linear-gradient(180deg, #2b2019, #1a130f 60%, #120d0a);
  box-shadow: 0 22px 34px -12px rgba(0, 0, 0, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}

.home-console::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(255, 190, 140, 0.06), rgba(255, 190, 140, 0.32) 50%, rgba(255, 190, 140, 0.06));
}

.home-soundbar {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 44%;
  max-width: 340px;
  height: 7px;
  border-radius: 4px 4px 1px 1px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 0.6px, transparent 0.8px) 0 0 / 3px 3px,
    linear-gradient(180deg, #2c2d33, #141519);
  box-shadow: inset 0 1px 0 rgba(255, 200, 160, 0.25), 0 2px 4px rgba(0, 0, 0, 0.6);
}

.home-credit {
  position: absolute;
  left: 0;
  bottom: 0;
  margin: 0;
  color: rgba(245, 241, 232, 0.42);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.home-credit a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Phone: drawn in HTML/CSS and sized in em, so one font-size scales the whole device */
.home-phone {
  position: absolute;
  top: 40px;
  right: 2px;
  z-index: 2;
  width: 15em;
  aspect-ratio: 9 / 19.5;
  padding: 0.55em;
  border-radius: 2.4em;
  font-size: 7.8px;
  line-height: 1.3;
  background: linear-gradient(145deg, #3a3b40, #141518 40%, #26272b);
  box-shadow:
    inset 0 0 0 0.08em #55565c,
    inset 0.12em 0 0 rgba(255, 180, 130, 0.28),
    0 0 0 0.06em #000,
    0 1.2em 1.6em rgba(0, 0, 0, 0.55),
    0 3.5em 6em -0.5em rgba(0, 0, 0, 0.95),
    -2em 2.5em 5em -1em rgba(0, 0, 0, 0.7);
}

.home-phone-island {
  position: absolute;
  top: 1.15em;
  left: 50%;
  z-index: 3;
  width: 4.6em;
  height: 1.35em;
  border-radius: 1em;
  background: #000;
  transform: translateX(-50%);
}

.home-phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 1.9em;
  background: #0d0e12;
}

.home-phone-status {
  flex: none;
  height: 2.6em;
}

.home-phone-url {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  height: 1.9em;
  margin: 0 0.8em;
  border-radius: 0.6em;
  background: #1b1d23;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.68em;
}

.home-phone-url::before {
  content: "";
  width: 0.6em;
  height: 0.7em;
  border-radius: 0.15em;
  background: rgba(255, 255, 255, 0.45);
}

.home-phone-video {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 9;
  margin-top: 0.8em;
  overflow: hidden;
  background: #000;
}

.home-phone-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-phone-cast {
  position: absolute;
  top: 0.55em;
  right: 0.55em;
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
}

.home-phone-cast svg {
  width: 1.15em;
  height: 1.15em;
}

.home-phone-title {
  padding: 0.75em 0.9em 0;
  color: #fff;
  font-size: 0.95em;
  font-weight: 700;
}

.home-phone-meta {
  padding: 0.15em 0.9em 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.68em;
}

.home-phone-rows {
  display: grid;
  gap: 0.55em;
  padding: 0.9em 0.9em 0;
}

.home-phone-rows i {
  display: block;
  height: 0.5em;
  border-radius: 0.3em;
  background: #1d1f26;
}

.home-phone-rows i:nth-child(2) { width: 70%; }
.home-phone-rows i:nth-child(3) { width: 84%; }

/* Now-playing sheet: the "it just works" moment, styled like native iOS chrome */
.home-phone-sheet {
  position: absolute;
  left: 0.45em;
  right: 0.45em;
  bottom: 0.45em;
  z-index: 2;
  padding: 0.9em 0.95em 1em;
  border-radius: 1.5em;
  background: rgba(32, 33, 40, 0.92);
  box-shadow: 0 -0.5em 2em rgba(0, 0, 0, 0.5), inset 0 0 0 0.05em rgba(255, 255, 255, 0.08);
}

.home-phone-grab {
  width: 2.2em;
  height: 0.25em;
  margin: -0.3em auto 0.7em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.25);
}

.home-phone-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-phone-device {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-top: 0.35em;
  color: #fff;
  font-size: 0.86em;
  font-weight: 700;
}

.home-phone-device small {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.78em;
  font-weight: 500;
}

.home-phone-device-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 0.5em;
  background: var(--home-orange);
}

.home-phone-device-icon svg {
  width: 1.1em;
  height: 1.1em;
}

.home-phone-scrub {
  height: 0.28em;
  margin-top: 0.85em;
  overflow: hidden;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.16);
}

.home-phone-scrub i {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.home-phone-times {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4em;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.56em;
  font-variant-numeric: tabular-nums;
}

.home-phone-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6em;
  margin-top: 0.4em;
}

.home-phone-controls svg {
  width: 1.2em;
  height: 1.2em;
  fill: #fff;
}

.home-phone-controls .home-phone-pause {
  width: 1.6em;
  height: 1.6em;
}

/* Copy */
.home-copy {
  display: grid;
  gap: 14px;
}

.home-copy h1 {
  margin: 0;
  color: var(--home-ink);
  font-size: clamp(2.3rem, 10.6vw, 3.6rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.home-kicker {
  display: block;
  margin-bottom: 14px;
  color: var(--home-orange);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.home-sub {
  margin: 0;
  color: var(--home-dim);
  font-size: 1.02rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.home-copy .store-buttons {
  --store-badge-height: 44px;
  gap: 10px;
  margin-top: 6px;
}

.home-trust {
  margin: 0;
  color: var(--home-dim);
  font-size: 0.84rem;
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.home-trust b {
  color: var(--home-ink);
  font-weight: 700;
}

.home-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--home-faint);
}

/* Key selling points as a quiet list, not boxed cards */
.home-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
  margin: 10px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--home-hairline);
  list-style: none;
}

.home-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--home-dim);
  font-size: 0.86rem;
  line-height: 1.35;
}

.home-points b {
  display: block;
  color: var(--home-ink);
  font-weight: 650;
}

.home-points img {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  filter: invert(66%) sepia(79%) saturate(1196%) hue-rotate(337deg) brightness(103%) contrast(101%);
}

/* ---------- Rotating App Store reviews ---------- */
.home-reviews {
  display: grid;
  gap: 28px;
  padding: 56px 16px 64px;
  border-top: 1px solid var(--home-hairline);
  color: var(--home-ink);
}

.home-score {
  display: flex;
  align-items: center;
  gap: 16px;
}

.home-score-num {
  margin: 0;
  font-size: 3.4rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
}

.home-score-meta {
  display: grid;
  gap: 2px;
  margin: 0;
  color: var(--home-dim);
  font-size: 0.86rem;
}

.home-score-meta .home-stars {
  font-size: 1rem;
  letter-spacing: 2px;
}

/* Without JavaScript the reviews simply stack */
.home-quotes {
  display: grid;
  gap: 36px;
}

.home-quote {
  display: grid;
  align-content: start;
  gap: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.home-quote-title {
  margin: 0;
  color: var(--home-orange);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-quote blockquote {
  margin: 0;
  color: var(--home-ink);
  font-size: clamp(1.45rem, 6.4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.22;
  text-wrap: balance;
}

.home-quote figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--home-dim);
  font-size: 0.84rem;
}

.home-quote figcaption .home-stars {
  font-size: 0.74rem;
}

/* With JavaScript: every quote shares one grid cell, so the block keeps the tallest quote's height */
.home-quotes.is-carousel {
  gap: 0;
  touch-action: pan-y;
}

.home-quotes.is-carousel .home-quote {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  filter: blur(4px);
  transition: opacity 0.7s var(--home-ease), transform 0.7s var(--home-ease), filter 0.7s var(--home-ease), visibility 0s linear 0.7s;
}

.home-quotes.is-carousel .home-quote.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  transition-delay: 0.15s, 0.15s, 0.15s, 0s;
}

.home-reviews-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-reviews-controls[hidden] {
  display: none;
}

.home-reviews-toggle {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--home-dim);
  cursor: pointer;
}

.home-reviews-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.home-reviews-toggle .home-icon-play,
.home-reviews.is-paused .home-reviews-toggle .home-icon-pause {
  display: none;
}

.home-reviews.is-paused .home-reviews-toggle .home-icon-play {
  display: block;
}

/* Stories-style progress bars: thin visually, 44px tall to tap */
.home-progress {
  display: flex;
  flex: 1;
  gap: 6px;
}

.home-progress button {
  display: grid;
  flex: 1;
  align-items: center;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.home-progress span {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(245, 241, 232, 0.14);
}

.home-progress span::after {
  content: "";
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--home-ink);
}

.home-progress .is-done span::after {
  width: 100%;
}

.home-progress .is-current span::after {
  animation: home-fill var(--home-dwell, 6s) linear forwards;
}

.home-reviews.is-paused .home-progress .is-current span::after {
  animation-play-state: paused;
}

@keyframes home-fill {
  to { width: 100%; }
}

.home-reviews-note {
  margin: 0;
  color: var(--home-faint);
  font-size: 0.74rem;
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .home-hero {
    width: min(100% - 96px, 1240px);
    margin: 0 auto;
    padding: 72px 0 96px;
    grid-template-columns: 5fr 7fr;
    align-items: center;
    gap: 64px;
  }

  .home-copy {
    order: -1;
    gap: 18px;
  }

  .home-stage {
    padding-bottom: 130px;
  }

  .home-console {
    height: 44px;
    margin: 26px -8% 0;
  }

  .home-phone {
    top: 30%;
    right: 0;
    font-size: 11px;
  }

  .home-copy .store-buttons {
    --store-badge-height: 50px;
  }

  .home-reviews {
    width: min(100% - 96px, 1240px);
    margin: 0 auto;
    padding: 96px 0 112px;
    grid-template-columns: 4fr 8fr;
    align-items: start;
    column-gap: 64px;
  }

  .home-score {
    grid-row: 1 / span 4;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .home-score-num {
    font-size: 5rem;
  }

  .home-quote blockquote {
    font-size: 2.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero::after,
  .home-tv-panel img {
    animation: none;
  }

  .home-quotes.is-carousel .home-quote {
    transition: none;
  }

  .home-progress .is-current span::after {
    width: 100%;
    animation: none;
  }
}
