/* P355 landing: put it on your phone (round 3 frame). Laptop: steps | phone | QR, perks and Mac; narrower, one column.
   install.ts adds .is-tabbed and plays the phone; without it the phone holds K4 and both phones' steps show.
   Hidden start states sit under html.lp-motion only, as in motion.css. */

.lp-app { overflow-x: clip; }

.lp-app__grid {
  display: grid;
  grid-template-columns: minmax(0, 420fr) 320px minmax(0, 300fr);
  grid-template-areas:
    "head  stage aside"
    "tabs  stage aside"
    "steps stage aside"
    "foot  stage aside";
  grid-template-rows: auto auto auto 1fr;
  gap: 16px 40px;
  align-items: start;
}

.lp-app__head { grid-area: head; }
.lp-app__tabs { grid-area: tabs; }
.lp-app__steps { grid-area: steps; }
.lp-app__foot { grid-area: foot; }
.lp-app__stage { grid-area: stage; }
.lp-app__aside { grid-area: aside; }
.lp-app__open { grid-area: open; display: none; }

.lp-app__head .lp-eyebrow { margin: 0 0 16px; letter-spacing: 1.5px; }
.lp-app__title { font-size: clamp(56px, 10vw - 44px, 84px); }
.lp-app__note { font-size: 26px; }
.lp-app__title + .lp-app__note { margin-top: 24px; }

.lp-app svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Tabs: a pill of two equal segments, sized to them ---- */

.lp-app__tabs {
  display: inline-grid;
  grid-auto-columns: 116px;
  grid-auto-flow: column;
  justify-self: start;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--lp-surface);
  box-shadow: inset 0 0 0 1px var(--lp-line);
}

.lp-app__tabs[hidden] { display: none; }

.lp-app__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lp-ink-2);
  font: 600 16px/1 var(--lp-font);
  cursor: pointer;
  transition: background-color 200ms, color 200ms;
}

.lp-app__tab svg { width: 17px; height: 17px; }
.lp-app__tab[aria-selected="true"] { background: #fff; color: var(--lp-paper-ink); }
.lp-app__tab:focus-visible { outline: 2px solid var(--lp-gold); outline-offset: 3px; }

/* ---- Steps ---- */

.lp-app__steps { display: grid; gap: 24px; }
.lp-app__flow[hidden] { display: none; }
.lp-app__flow-title { margin: 0 0 8px; font: 600 15px/1.2 var(--lp-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lp-ink-3); }
.lp-app.is-tabbed .lp-app__flow-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* A timeline: markers joined by a line, then each step's content: its verb in one column so every chip starts at the
   same x, its tip under the chip. Every content block keeps the lit box's padding and border, so lighting a step moves
   nothing and the marker column (and its line) runs straight through it. --box-y centres a marker on its chip. */
.lp-app__list {
  --num: 32px; --pad-x: 16px; --pad-y: 10px; --gap: 10px; --verb: 56px; --box: 4px 10px; --box-y: 5px;
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lp-app__step {
  position: relative;
  display: grid;
  grid-template-columns: var(--num) minmax(0, 1fr);
  align-items: start;
  column-gap: 14px;
  padding: var(--pad-y) var(--pad-x);
  color: var(--lp-ink-2);
  font-size: 15px;
}

/* The line, from this marker's centre to the next one's, behind both: green once this step is done. */
.lp-app__step:not(:last-child)::after {
  position: absolute;
  top: calc(var(--pad-y) + var(--box-y) + var(--num) / 2);
  bottom: calc(-1 * (var(--gap) + var(--pad-y) + var(--box-y) + var(--num) / 2));
  left: calc(var(--pad-x) + var(--num) / 2 - 1px);
  width: 2px;
  background: var(--lp-line-strong);
  content: '';
  transition: background-color 300ms;
}

.lp-app__step.is-done::after { background: #22c55e; }

/* A tap on a step jumps the loop, so only a playing loop points at it. */
.lp-motion .lp-app.is-tabbed .lp-app__step { cursor: pointer; }

.lp-app__do {
  display: grid;
  grid-template-columns: var(--verb) auto;
  justify-content: start;
  align-items: center;
  column-gap: 10px;
  padding: var(--box);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background-color 300ms, border-color 300ms, color 300ms;
}

.lp-app__step.is-lit .lp-app__do { background: #e0184f1f; border-color: var(--lp-red); color: var(--lp-ink); }

.lp-app__num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--num);
  height: var(--num);
  margin-top: var(--box-y);
  border-radius: 50%;
  background: var(--lp-bg);
  box-shadow: inset 0 0 0 1.5px var(--lp-line-strong);
  color: var(--lp-ink-2);
  font: 600 14px/1 var(--lp-font);
}

.lp-app__step.is-lit .lp-app__num { background: var(--lp-red); box-shadow: none; color: #fff; }
/* Done: the Studio's done-step green (--st-ok-strong), a white check drawn by a mask so it sits dead centre. */
.lp-app__step.is-done .lp-app__num { font-size: 0; background: #22c55e; box-shadow: 0 0 0 4px #22c55e1f, 0 0 14px #22c55e59; }
.lp-app__step.is-done .lp-app__num::after {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56%;
  height: 56%;
  background: #fff;
  content: '';
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
  .lp-motion .lp-app__step.is-done .lp-app__num { animation: lp-app-pop 420ms cubic-bezier(0.34, 1.56, 0.64, 1); }
  .lp-motion .lp-app__step.is-done .lp-app__num::after { animation: lp-app-tick 420ms 80ms ease-out backwards; }
}

@keyframes lp-app-pop { from { scale: 0.6; } }
@keyframes lp-app-tick { from { scale: 0.3; opacity: 0; } }

.lp-app__chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--lp-surface-2);
  color: var(--lp-ink);
  font: 600 14.5px/18px var(--lp-font);
  white-space: nowrap;
}

.lp-app__chip svg { width: 15px; height: 15px; }

.lp-app__hint { display: flex; grid-column: 2; align-items: center; gap: 6px; margin-top: 6px; color: var(--lp-ink-3); font-size: 12.5px; line-height: 1.3; }
.lp-app__hint svg { flex: none; width: 13px; height: 13px; }

/* ---- Notes, and the phone's button ---- */

.lp-app__foot { align-self: end; }
.lp-app__notes[hidden], .lp-app__other[hidden], .lp-app__safari[hidden], .lp-app__open[hidden] { display: none; }
.lp-app__notes + .lp-app__notes { margin-top: 16px; }

.lp-app__safari {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--lp-surface);
  box-shadow: inset 0 0 0 1px var(--lp-line);
  color: var(--lp-ink-2);
  font-size: 13px;
  line-height: 1.5;
}

.lp-app__safari > span > span { display: block; }
.lp-app__safari svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--lp-gold); }
.lp-app__safari--warn { padding: 16px 18px; border-radius: 14px; background: #3a2a0a; box-shadow: none; color: var(--lp-ink); }
.lp-app__copy { width: 100%; margin-top: 14px; }
.lp-app__copy svg, .lp-app__open svg { width: 20px; height: 20px; }

/* ---- The phone ---- */

.lp-app__stage { margin: 0; display: grid; justify-items: center; gap: 14px; }

.lp-app__phone { width: min(100%, 320px); }

/* One bar per scene, filled as the loop plays (install.ts sets --fill). */
.lp-app__bars { display: flex; gap: 8px; margin: 0; }
.lp-app__bars i { width: 54px; height: 4px; border-radius: 2px; background: #ffffff26 linear-gradient(var(--lp-hot), var(--lp-hot)) left / calc(var(--fill, 0) * 100%) 100% no-repeat; }

/* ---- QR, perks and the Mac card ---- */

.lp-app__aside { display: grid; gap: 16px; }

.lp-app__scan {
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: 24px;
  background: var(--lp-surface);
  box-shadow: inset 0 0 0 1px var(--lp-line);
  text-align: center;
}

.lp-app__scan-title { margin: 0; font: 500 11px/1.2 var(--lp-mono); letter-spacing: 0.16em; text-transform: uppercase; text-wrap: balance; color: var(--lp-ink-2); }
.lp-app__scan-body { margin: 0; color: var(--lp-ink-2); font-size: 13px; line-height: 1.5; }

/* The code at 208 inside a 236 ring; narrower cards shrink both. */
.lp-app__qr { position: relative; display: grid; place-items: center; width: min(208px, 100% - 28px); margin: 14px 0; }
.lp-app__qr > img:first-of-type { width: 100%; height: auto; border-radius: 14px; }
/* The icon covers under 22% of the code, which its high error correction reads through. */
.lp-app__qr-icon { position: absolute; width: 17%; height: auto; border-radius: 22%; box-shadow: 0 0 0 3px #fff; }

.lp-app__pulse {
  position: absolute;
  inset: -14px;
  border-radius: 26px;
  box-shadow: 0 0 0 1.5px var(--lp-hot);
  opacity: 0.6;
}

.lp-app__pulse + .lp-app__pulse { opacity: 0; }

/* Two rings pulse outward every two bars (8 beats). */
@media (prefers-reduced-motion: no-preference) {
  .lp-app__pulse { animation: lp-app-pulse calc(var(--lp-beat) * 8) var(--lp-ease-out) infinite; }
  .lp-app__pulse + .lp-app__pulse { animation-delay: calc(var(--lp-beat) * 2); }
  .lp-motion .lp-app__phone.is-waiting:not(.is-in),
  .lp-motion .lp-app__aside.is-waiting:not(.is-in) { opacity: 0; }
  .lp-motion .lp-app__phone.is-in { animation: lp-app-rise 800ms var(--lp-ease-out) backwards; }
  .lp-motion .lp-app__aside.is-in > * { animation: lp-app-rise 700ms var(--lp-ease-out) backwards; }
  .lp-motion .lp-app__aside.is-in > :nth-child(2) { animation-delay: 120ms; }
  .lp-motion .lp-app__aside.is-in > :nth-child(3) { animation-delay: 240ms; }
}

@keyframes lp-app-pulse { from { scale: 1; opacity: 0.8; } to { scale: 1.1; opacity: 0; } }
@keyframes lp-app-rise { from { opacity: 0; translate: 0 40px; } }

/* Without the loop (reduced motion, or no JS), no progress bars. */
html:not(.lp-motion) .lp-app__bars { display: none; }

.lp-app__perks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }

/* Three chips, each an icon over a short label; the plan badge sits inside its chip, under the label. */
.lp-app__perks li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 16px;
  background: var(--lp-surface);
  box-shadow: inset 0 0 0 1px var(--lp-line);
  text-align: center;
}

.lp-app__perks svg { box-sizing: border-box; width: 32px; height: 32px; padding: 8px; border-radius: 50%; background: var(--lp-surface-2); }
.lp-app__perks b { font-size: 12px; font-weight: 600; line-height: 1.3; }

.lp-app__mac {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--lp-surface);
  box-shadow: inset 0 0 0 1px var(--lp-line);
  color: var(--lp-ink);
  text-decoration: none;
  transition: box-shadow 200ms;
}

.lp-app__mac:hover { box-shadow: inset 0 0 0 1px var(--lp-line-strong); }
.lp-app__mac > svg:first-child { box-sizing: border-box; flex: none; width: 32px; height: 32px; padding: 8px; border-radius: 50%; background: var(--lp-surface-2); }
.lp-app__mac b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
.lp-app__mac small { display: block; color: var(--lp-ink-2); font-size: 12px; line-height: 1.4; }
.lp-app__go { flex: none; width: 18px; height: 18px; margin-left: auto; color: var(--lp-ink-2); }
.lp-app__mac:focus-visible, .lp-app__open:focus-visible, .lp-app__copy:focus-visible { outline: 2px solid var(--lp-gold); outline-offset: 3px; }

/* ---- A laptop: the frame's 96 / 80 padding ---- */

@media (min-width: 1100px) {
  .lp-app { --lp-pad: 96px; --lp-gutter: clamp(20px, 6.25vw, 80px); }
}

/* ---- Narrower than a laptop: one column, the phone under the tabs, no QR, the button instead ---- */

@media (max-width: 1099px) {
  .lp-app__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "tabs" "stage" "steps" "open" "foot" "aside";
    grid-template-rows: none;
  }

  .lp-app__title { font-size: clamp(56px, 6vw, 84px); }
  .lp-app__open { display: flex; }
  .lp-app__scan, .lp-app__mac { display: none; }
}

/* A phone: one 16 px rhythm, the 210 px phone, a tighter timeline, the button, one note line, the perks 2-up. */
@media (max-width: 599px) {
  .lp-app { --lp-pad: 48px; --lp-gutter: 20px; }
  .lp-app__head .lp-eyebrow { font-size: 12px; }
  .lp-app__title { font-size: 56px; }
  .lp-app__note { font-size: 20px; }
  .lp-app__title + .lp-app__note { margin-top: 20px; }
  .lp-app__tabs { grid-auto-columns: 104px; }
  .lp-app__tab { height: 36px; font-size: 15px; }
  .lp-app__tab svg { width: 16px; height: 16px; }
  .lp-app__stage { gap: 12px; }
  /* The 320 laptop mockup shown at 210; without zoom it stays 320 wide. */
  @supports (zoom: 0.65625) {
    .lp-app__phone { zoom: 0.65625; }
  }
  .lp-app__list { --num: 30px; --pad-x: 12px; --pad-y: 2px; --gap: 6px; --verb: 52px; --box: 3px 8px; --box-y: 4px; }
  .lp-app__step { column-gap: 12px; font-size: 14px; }
  .lp-app__do { column-gap: 8px; }
  .lp-app__num { font-size: 13px; }
  .lp-app__chip { gap: 6px; padding: 6px 10px; font-size: 13.5px; }
  .lp-app__chip svg { width: 14px; height: 14px; }
  .lp-app__hint { margin-top: 4px; font-size: 12px; }
  .lp-app__open { min-height: 48px; padding-block: 0; box-shadow: 0 8px 24px #e0184f4d; }
  .lp-app__safari { gap: 8px; padding: 0 0 0 4px; background: none; box-shadow: none; }
  .lp-app__safari > span > span { display: inline; }
  .lp-app__wide { display: none; }
  /* Outside Safari: the warning and Copy link share one box, in the button's place. */
  .lp-app__other { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 14px; background: #3a2a0a; }
  .lp-app__safari--warn { margin: 0; padding: 0; background: none; color: var(--lp-ink); }
  .lp-app__copy { width: auto; min-height: 44px; margin: 0; padding: 0 16px; font-size: 14px; }
  .lp-app__perks li { padding: 12px 4px; }
  .lp-app__perks b { font-size: 13px; }
}
