/* The home page: always dark, with a 3D phone, pinned scroll scenes and a
   viewfinder cursor. Without site.js (or with Reduce Motion on) every scene
   falls back to an ordinary stacked section. */

body:has(.hero) {
  --bg: #08090D;
  --ink: #F5F4FA;
  --ink-2: #A3A1B2;
  --line: rgba(245, 244, 250, 0.13);
  --accent: #8B94FF;
  --soft: #14151C;
  --mint: #5CFFB0;
  color-scheme: dark;
}
body:has(.hero) main.wide { max-width: none; padding: 0; }

body:has(.hero) .band, .story, .closing { max-width: 1080px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
body:has(.hero) .band { padding-top: 96px; padding-bottom: 40px; }
body:has(.hero) .band > h2 { font-size: clamp(30px, 4.4vw, 52px); letter-spacing: -0.025em; max-width: 16em; }

/* Other apps by the same developer. The panel borrows Billboard's own look:
   an indigo to sky blue gradient, white type, and tilted screens. */
body:has(.hero) .more-apps { padding-top: 72px; padding-bottom: 110px; }
body:has(.hero) .more-apps > h2 { font-size: clamp(24px, 3vw, 34px); }
.app-card {
  position: relative;
  display: block;
  overflow: hidden;
  margin-top: 32px;
  padding: 84px 40px 96px;
  border-radius: 40px;
  background: linear-gradient(160deg, #4B45DE 0%, #3A5FE6 48%, #56B8EA 100%);
  color: #FFFFFF;
  text-align: center;
  text-decoration: none;
  perspective: 1200px;
  box-shadow: 0 50px 110px -50px rgba(58, 95, 230, 0.8);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-card:hover { transform: translateY(-6px); }
.app-main { position: relative; display: flex; flex-direction: column; align-items: center; }
.app-brand { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.app-brand img { width: 52px; height: 52px; filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.35)); }
.app-card strong { margin-top: 26px; max-width: 13em; font-size: clamp(32px, 4.6vw, 60px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 600; color: #FFFFFF; text-wrap: balance; }
.app-sub { margin-top: 18px; font-size: clamp(17px, 1.7vw, 20px); color: rgba(255, 255, 255, 0.86); max-width: 26em; }
/* The button matches Billboard's own: its blue gradient with a fine grain
   blended in, and a light ring so it stands off the panel. */
.app-card b {
  position: relative;
  isolation: isolate;
  margin-top: 32px;
  padding: 15px 30px;
  border-radius: 999px;
  background: linear-gradient(160deg, #4B45DE 0%, #3A5FE6 55%, #4F8FEA 100%);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 18px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 18px 36px -12px rgba(15, 23, 42, 0.6);
  transition: transform 0.25s ease;
}
.app-card b::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background-image: url("images/billboard-grain.png");
  background-size: 64px 64px;
  opacity: 0.2;
  mix-blend-mode: overlay;
}
.app-card:hover b { transform: scale(1.05); }
.app-points { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 34px; max-width: 640px; }
.app-points > span { padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 500; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.34); }

/* Tilted Billboard screens in the corners. */
.bb-screen {
  position: absolute;
  width: 27%;
  max-width: 300px;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.6);
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.bb-screen.s1 { left: -8%; top: 5%; width: 23%; transform: rotateY(24deg) rotateZ(-7deg); }
.bb-screen.s2 { right: -7%; top: 14%; width: 22%; transform: rotateY(-24deg) rotateZ(6deg); }
.bb-screen.s3 { left: -6%; bottom: 7%; width: 22%; transform: rotateY(22deg) rotateZ(5deg); }
.bb-screen.s4 { right: -9%; bottom: 6%; width: 26%; transform: rotateY(-22deg) rotateZ(-5deg); }
.app-card:hover .s4 { transform: rotateY(-11deg) rotateZ(-2deg) translate(-18px, -6px) scale(1.05); }
.motion .bb-screen.s4 { animation: drift 9.5s ease-in-out -4.5s infinite; }
.app-card:hover .s1 { transform: rotateY(12deg) rotateZ(-4deg) translate(18px, 6px) scale(1.05); }
.app-card:hover .s2 { transform: rotateY(-12deg) rotateZ(3deg) translate(-18px, -6px) scale(1.05); }
.app-card:hover .s3 { transform: rotateY(11deg) rotateZ(2deg) translate(18px, -6px) scale(1.05); }
.motion .bb-screen.s1 { animation: drift 8s ease-in-out infinite; }
.motion .bb-screen.s2 { animation: drift 9s ease-in-out -3s infinite; }
.motion .bb-screen.s3 { animation: drift 10s ease-in-out -6s infinite; }
@keyframes drift { 50% { translate: 0 -12px; } }
@media (max-width: 860px) {
  .app-card { padding: 140px 20px 150px; border-radius: 30px; }
  .bb-screen { width: 52%; }
  .bb-screen.s1 { left: -12%; top: 2%; }
  .bb-screen.s4 { right: -12%; bottom: 2%; width: 52%; }
  .bb-screen.s2, .bb-screen.s3 { display: none; }
}

.eyebrow { text-transform: none; }

/* The hero slides up behind the top bar, so the bar must stay on top of it
   or its links can't be clicked. */
body:has(.hero) .site-header { position: relative; z-index: 5; }

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative;
  min-height: 100svh;
  margin: -78px 0 0;
  padding: 120px max(24px, calc(50% - 596px)) 64px;
  /* The glow and the 3D phone reach past the screen edge. They are trimmed
     here, on the hero alone. Trimming the whole page instead made the pinned
     scenes further down shudder on phones. */
  overflow-x: clip;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
  align-items: center;
}
.hero h1 { font-size: clamp(42px, 6.4vw, 88px); line-height: 0.98; letter-spacing: -0.035em; margin-bottom: 28px; }
.hero .lede { font-size: clamp(19px, 1.7vw, 23px); max-width: 30em; }
.hero-glow {
  position: absolute;
  inset: -20% -30%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at var(--gx, 70%) var(--gy, 45%), rgba(61, 72, 240, 0.42), transparent 70%),
    radial-gradient(30% 34% at 82% 78%, rgba(255, 127, 182, 0.16), transparent 70%),
    radial-gradient(28% 30% at 58% 12%, rgba(47, 180, 255, 0.16), transparent 70%);
}
.status strong { background: var(--ink); color: var(--bg); }
.status a { text-decoration: none; }
/* Apple's own badge, at the size and clear space its guidelines ask for. */
.status img { height: 54px; width: auto; max-width: none; vertical-align: middle; margin-right: 16px; transition: transform 0.2s ease; }
.status a:hover img { transform: translateY(-2px); }
.status a strong { transition: background 0.2s ease, transform 0.2s ease; }
.status a:hover strong { background: var(--mint); transform: translateY(-2px); }
.scroll-cue {
  position: absolute;
  left: max(24px, calc(50% - 596px));
  bottom: 28px;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.scroll-cue::after { content: ""; display: inline-block; width: 44px; height: 1px; margin-left: 12px; vertical-align: middle; background: var(--ink-2); }

/* The 3D rig: two glass cards from the icon behind a tilted phone. */
.stage { perspective: 1500px; display: flex; justify-content: center; align-items: center; min-height: 560px; }
.rig {
  position: relative;
  width: min(300px, 62vw);
  transform-style: preserve-3d;
  transform: rotateX(calc(9deg + var(--rx, 0deg))) rotateY(calc(-24deg + var(--ry, 0deg) + var(--sy, 0deg)));
}
.phone { position: relative; transform-style: preserve-3d; }
.phone img, .phones img {
  display: block;
  width: 100%;
  border: 6px solid #1C1D25;
  border-radius: 13% / 6%;
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.glass {
  position: absolute;
  inset: 6% -4%;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.g1 { background: linear-gradient(135deg, #FFB98C, #FF7FB6); transform: translate3d(70px, -34px, -90px); opacity: 0.9; }
.g2 { background: linear-gradient(135deg, #7FE6FF, #2FB4FF); transform: translate3d(140px, -68px, -180px); opacity: 0.85; }
.tag {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  font: 600 15px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: #14131A;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #fff;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
}
.tag i { width: 10px; height: 10px; border-radius: 50%; background: #19C37D; }
.t1 { left: -34%; top: 24%; transform: translateZ(110px); }
.t2 { right: -30%; bottom: 20%; transform: translateZ(150px); font-family: inherit; }
.beam {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 8%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
  box-shadow: 0 0 22px 3px rgba(92, 255, 176, 0.75);
  transform: translateZ(2px);
  opacity: 0;
}

/* ---------------------------------------------------------------- Problem */
.problem { position: relative; background: #050609; border-block: 1px solid var(--line); }
.problem .pin-inner { position: relative; overflow: hidden; padding: 96px 24px; }
.problem-copy { position: relative; max-width: 860px; margin: 0 auto; text-align: center; }
.problem h2 { font-size: clamp(34px, 6vw, 84px); line-height: 1; letter-spacing: -0.035em; margin: 0 0 24px; }
.count { font: 500 clamp(16px, 2vw, 22px)/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--mint); margin-bottom: 36px; }
.pains { list-style: none; padding: 0; margin: 0 auto; max-width: 620px; text-align: left; }
.pains li { margin: 0; padding: 14px 0; border-top: 1px solid var(--line); }
.rows { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-around; pointer-events: none; opacity: 0.5; }
.rows div {
  white-space: nowrap;
  font: 600 clamp(22px, 3.4vw, 46px)/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  color: rgba(245, 244, 250, 0.09);
  will-change: transform;
}
.rows b { font-weight: 600; color: #FF5B6B; text-decoration: line-through; }

/* ---------------------------------------------------------------- Story */
.story { padding-top: 140px; padding-bottom: 140px; max-width: 980px; }
.story .quote { font-size: clamp(26px, 3.6vw, 46px); line-height: 1.22; letter-spacing: -0.02em; font-weight: 600; color: var(--ink); margin-bottom: 0.8em; text-wrap: pretty; }
.story .byline { color: var(--ink-2); font-size: 17px; margin-top: 40px; }
.byline a { display: inline-flex; align-items: center; gap: 16px; color: var(--ink-2); text-decoration: none; }
.byline img { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--line); transition: border-color 0.2s ease, transform 0.2s ease; }
.byline a:hover img { border-color: var(--accent); transform: scale(1.06); }
.byline span { display: flex; flex-direction: column; line-height: 1.4; }
.byline strong { font-size: 19px; }
.byline em { font-style: normal; color: var(--accent); font-weight: 600; font-size: 15px; margin-top: 2px; }

/* ---------------------------------------------------------------- Plan */
.plan { border-block: 1px solid var(--line); background: #0B0C12; }
.plan .pin-inner { overflow: hidden; max-width: 1240px; margin: 0 auto; padding: 96px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.plan h2 { font-size: clamp(34px, 5vw, 68px); line-height: 1; letter-spacing: -0.035em; margin: 0 0 40px; }
.plan-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.plan-steps li { counter-increment: step; margin: 0; padding: 22px 0 22px 64px; border-top: 1px solid var(--line); position: relative; }
.plan-steps li::before { content: counter(step); position: absolute; left: 0; top: 20px; font: 600 15px/34px ui-monospace, "SF Mono", Menlo, monospace; width: 34px; text-align: center; border-radius: 50%; border: 1px solid var(--line); color: var(--ink-2); }
.plan-steps h3 { margin: 0 0 4px; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.015em; }
.plan-steps p { margin: 0; max-width: 28em; }
.phones { display: flex; gap: 20px; justify-content: center; }
.phones figure { margin: 0; flex: 0 1 220px; }

/* Commands: copy beside the console screen. */
body:has(.hero) .commands-band { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 48px; align-items: center; }
.commands-band .shot img { max-width: 300px; border-color: #1C1D25; box-shadow: 0 40px 90px -30px rgba(139, 148, 255, 0.45); }
@media (max-width: 860px) { body:has(.hero) .commands-band { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Closing */
.closing { text-align: center; padding-top: 160px; padding-bottom: 150px; }
.closing > p:not(.status):not(.eyebrow) { max-width: 34em; margin-inline: auto; }
.closing h2 { font-size: clamp(44px, 9vw, 132px); line-height: 0.95; letter-spacing: -0.045em; margin: 0 0 28px; }
.closing p { font-size: clamp(18px, 2vw, 22px); }

/* ================================================================ Motion */
.pins .pin { height: var(--len); }
.pins .pin-inner { position: sticky; top: 0; height: 100svh; display: grid; align-content: center; }
.pins .problem { --len: 260vh; }
.pins .plan { --len: 360vh; }
.pins .plan .pin-inner { align-items: center; }

/* The serial rows slide with the scroll bar itself where the browser allows,
   so they never trail a frame behind the page. site.js covers the rest. */
@supports (animation-timeline: view()) {
  .motion .problem { view-timeline: --problem block; }
  .motion .rows div { animation: rows-left linear both; animation-timeline: --problem; animation-range: contain 0% contain 100%; }
  .motion .rows div:nth-child(even) { animation-name: rows-right; }
}
/* Without pinning the rows slide for as long as the section is on screen. */
@supports (animation-timeline: view()) {
  .motion:not(.pins) .rows div { animation-range: cover 0% cover 100%; }
}
@keyframes rows-left { from { transform: translate3d(-40px, 0, 0); } to { transform: translate3d(-560px, 0, 0); } }
@keyframes rows-right { from { transform: translate3d(-620px, 0, 0); } to { transform: translate3d(-100px, 0, 0); } }

.motion .rig { animation: float 7s ease-in-out infinite; }
/* Only a mouse leans the phone, so only a mouse needs the easing. On a touch
   screen it made the phone lag behind the page. */
@media (hover: hover) and (pointer: fine) { .motion .rig { transition: transform 0.25s ease-out; } }
/* The phone turns and fades with the scroll bar itself where the browser
   allows. The fade sits on the stage, because fading the rig would flatten
   its 3D layers the moment the page moved. */
@supports (animation-timeline: scroll()) {
  .motion .rig { animation: float 7s ease-in-out infinite, turn linear both; animation-timeline: auto, scroll(root block); animation-range: normal, 0px 100vh; }
  .motion .stage { animation: fade linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
}
@keyframes turn { to { rotate: y 18deg; } }
@keyframes fade { to { opacity: 0.1; } }
/* The running totals keep their final width, so the line can't shuffle
   sideways or re-wrap as the digits grow. */
.motion [data-count] { display: inline-block; text-align: right; }
@keyframes float { 50% { translate: 0 -16px; } }
.motion .beam { animation: beam 4.8s ease-in-out 1.2s infinite; }
@keyframes beam {
  0% { top: 8%; opacity: 0; }
  10% { opacity: 1; }
  45% { top: 90%; opacity: 1; }
  55%, 100% { top: 90%; opacity: 0; }
}
.motion .tag { opacity: 0; animation: pop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.motion .t1 { animation-delay: 1.3s; }
.motion .t2 { animation-delay: 2.6s; }
@keyframes pop { from { opacity: 0; scale: 0.7; } to { opacity: 1; scale: 1; } }
.motion .scroll-cue::after { animation: cue 2.2s ease-in-out infinite; transform-origin: left; }
@keyframes cue { 0%, 100% { transform: scaleX(0.3); } 50% { transform: scaleX(1); } }

.pins .pains li { opacity: 0.16; transition: opacity 0.5s ease; }
.pins .pains li.on { opacity: 1; }

/* Plan: one phone that turns as the steps change. */
.pins .phones { position: relative; perspective: 1500px; height: min(72svh, 640px); display: block; }
.pins .phones figure {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: rotateY(55deg) translateX(80px) scale(0.9);
  transition: opacity 0.6s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.pins .phones figure.past { transform: rotateY(-55deg) translateX(-80px) scale(0.9); }
.pins .phones figure.on { opacity: 1; transform: rotateY(-14deg) rotateX(5deg); }
.pins .phones img { height: 100%; width: auto; }
.pins .plan-steps li { opacity: 0.28; transition: opacity 0.5s ease; }
.pins .plan-steps li.on { opacity: 1; }
.pins .plan-steps li.on::before { background: var(--accent); border-color: var(--accent); color: #08090D; }

/* Viewfinder cursor, for mouse users only. */
.cursor, .cursor-dot { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; display: none; }
@media (hover: hover) and (pointer: fine) {
  .motion.has-cursor, .motion.has-cursor a, .motion.has-cursor summary { cursor: none; }
  .motion .cursor, .motion .cursor-dot { display: block; }
}
.cursor {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, opacity 0.3s ease;
  background:
    linear-gradient(var(--c), var(--c)) left top / 12px 2px,
    linear-gradient(var(--c), var(--c)) left top / 2px 12px,
    linear-gradient(var(--c), var(--c)) right top / 12px 2px,
    linear-gradient(var(--c), var(--c)) right top / 2px 12px,
    linear-gradient(var(--c), var(--c)) left bottom / 12px 2px,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 12px,
    linear-gradient(var(--c), var(--c)) right bottom / 12px 2px,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 12px;
  background-repeat: no-repeat;
  --c: #F5F4FA;
}
.cursor.over { width: 72px; height: 72px; margin: -36px 0 0 -36px; --c: #5CFFB0; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #5CFFB0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 110px; }
  .stage { min-height: 480px; order: 2; }
  .rig { width: min(230px, 56vw); }
  .t1 { left: -26%; }
  .t2 { right: -22%; }
  .scroll-cue { display: none; }
  .status strong { display: table; margin: 0 0 10px; }
  .closing .status strong { margin-inline: auto; }
  .status img { display: block; margin: 0 0 12px; }
  .closing .status img { margin-inline: auto; }
  .plan .pin-inner { grid-template-columns: 1fr; gap: 20px; padding: 72px 20px 24px; }
  .phones { flex-wrap: wrap; }
  .pins .plan .pin-inner { align-content: start; }
  .pins .plan h2 { margin-bottom: 14px; font-size: 32px; }
  .pins .plan .eyebrow { margin-bottom: 8px; }
  /* The steps share one spot, so the phone below never moves when they swap. */
  .pins .plan-steps { display: grid; }
  .pins .plan-steps li { grid-area: 1 / 1; visibility: hidden; opacity: 0; border-top: 0; padding: 0 0 0 48px; }
  .pins .plan-steps li::before { top: 0; }
  .pins .plan-steps li.on { visibility: visible; opacity: 1; }
  .pins .plan-steps p { font-size: 16px; }
  .pins .phones { height: 52svh; }
  .problem .pin-inner { padding: 72px 20px; }
  /* Touch screens don't pin the plan. Each step sits above its own screen. */
  html:not(.pins) .plan .pin-inner { display: flex; flex-direction: column; gap: 0; }
  html:not(.pins) .plan-copy, html:not(.pins) .plan-steps, html:not(.pins) .phones { display: contents; }
  html:not(.pins) .plan-steps li:nth-child(1) { order: 1; }
  html:not(.pins) .phones figure:nth-child(1) { order: 2; }
  html:not(.pins) .plan-steps li:nth-child(2) { order: 3; }
  html:not(.pins) .phones figure:nth-child(2) { order: 4; }
  html:not(.pins) .plan-steps li:nth-child(3) { order: 5; }
  html:not(.pins) .phones figure:nth-child(3) { order: 6; }
  html:not(.pins) .phones figure { flex: none; width: min(250px, 68%); margin: 8px auto 44px; }
  html:not(.pins) .phones figure:last-child { margin-bottom: 48px; }
  .story { padding-top: 96px; padding-bottom: 96px; }
  .closing { padding-top: 110px; padding-bottom: 100px; }
}
