/* History XXI — home showcase: a sticky device whose screen swaps as you scroll.
   The screens are HTML/CSS mocks (no PNGs) built from the same brand tokens as
   the app, so they follow the site's light/dark theme. iPhone frame on mobile;
   iPad frame on desktop, where the mock reflows to add the inspector column —
   the app's real adaptive "desk". */

/* ---- scrollytelling layout ---- */
/* Source order: intro · stage(device) · beats. On mobile that stacks so the
   sticky device pins right under the hero while the beats scroll beneath it
   (the onym pattern). On desktop a 2-column grid puts intro+beats on the left
   and the device sticky on the right, spanning both rows. */
.showcase { position: relative; }
@media (min-width: 900px) {
  .showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(500px, 58%);
    grid-template-rows: auto 1fr;
    column-gap: 44px;
    align-items: start;
  }
  .showcase .intro { grid-column: 1; grid-row: 1; }
  .showcase .beats { grid-column: 1; grid-row: 2; }
  .showcase .stage { grid-column: 2; grid-row: 1 / span 2; }
}

.stage { display: flex; justify-content: center; }
@media (min-width: 900px) {
  .stage { position: sticky; top: 92px; height: calc(100vh - 112px); align-items: center; }
}
@media (max-width: 899px) {
  /* Phone pins to the TOP band only; beat text reads in the clear zone below it
     and slides up behind it as the next beat arrives (the onym scroll effect).
     Keeping the phone short + bottom-aligning the text stops the two from
     overlapping — the earlier full-height sticky hid the text behind the phone. */
  .stage {
    position: sticky; top: 52px; z-index: 5; margin: 2px 0 0;
    align-items: flex-start; pointer-events: none;
    transition: opacity .3s ease;   /* smooth the JS-driven fade (home-mock.js) */
  }
  /* The phone keeps its real 9:19.5 aspect ratio (width + aspect-ratio from the
     base .device rule) — so it's tall, which is correct. Don't size it by height:
     the app UI's min-content width then stretches the frame squat. Each beat's
     text sits below the phone and reveals as you scroll it up (flex-end below). */
  /* fade the page into the sticky phone on mobile (onym trick) */
  .stage::before {
    content: ""; position: absolute; z-index: -1; inset: -18px -24px -56px;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 72%, transparent);
  }
}

.intro .lede { max-width: 34ch; }
@media (min-width: 900px) { .intro { align-self: center; } }
.beat { min-height: 84vh; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 899px) {
  /* Tall beats leave a comfortable phone-only stretch between them: you scroll,
     watch the device (and its screen swap), then the beat's text rises from
     below and the phone fades out for you to read (home-mock.js). */
  .beat { min-height: 145vh; justify-content: flex-end; padding-bottom: 9vh; }
  .beat:first-child { min-height: 96vh; }
  .beat:last-child { min-height: 104vh; }
}
.beat .b-kicker { margin-bottom: 10px; }
.beat h2 { font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.04; letter-spacing: -0.01em; margin: 0 0 14px; font-weight: 620; }
.beat p  { color: var(--muted); max-width: 34ch; margin: 0; }
.beat .b-num { color: var(--accent); font-weight: 600; }

/* ---- the device ---- */
.device {
  position: relative;
  width: min(300px, 74vw);
  aspect-ratio: 9 / 19.5;
  padding: 10px;
  border-radius: 46px;
  background: linear-gradient(158deg, #313135, #0b0b0d 62%);
  box-shadow: 0 34px 70px -28px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.35);
}
.device .island {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 32%; height: 17px; background: #060608; border-radius: 12px; z-index: 6;
}
.screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 37px; overflow: hidden; background: var(--bg);
  font-family: "Newsreader", Georgia, serif; font-size: 12.5px; color: var(--ink);
}
@media (min-width: 900px) {
  .device {
    width: 100%; max-width: 800px; aspect-ratio: 4 / 3;
    padding: 15px; border-radius: 28px;
  }
  .device .island { display: none; }
  .screen { border-radius: 15px; font-size: 13.5px; }
}

/* ---- screen swapping ---- */
.shot {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; transition: opacity .5s ease; overflow: hidden;
}
.shot.is-active { opacity: 1; }
@media (min-width: 900px) { .shot { flex-direction: row; } }
@media (prefers-reduced-motion: reduce) { .shot { transition: none; } }

/* main working column + (desktop) inspector */
.ui { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 0; overflow: hidden; }
.insp { display: none; }
@media (min-width: 900px) {
  .ui   { flex: 1.7; padding: 20px 18px; gap: 11px; }
  .insp { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 20px 18px; border-left: 1px solid var(--hairline); }
}

/* ---- mock UI atoms (brand-token driven → theme aware) ---- */
.st { display: flex; justify-content: space-between; align-items: center; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82em; font-weight: 600; opacity: .85; }
.st .sig { letter-spacing: .5px; }
.nav { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.nav .back { color: var(--accent); font-size: 1.3em; }
.nav .yr { font-size: 1.7em; font-weight: 620; letter-spacing: -.01em; }
.nav .acts { color: var(--accent); letter-spacing: 4px; }

.lab { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .68em; letter-spacing: .13em; text-transform: uppercase; color: var(--faint); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .7em; letter-spacing: .1em; text-transform: uppercase; }

.progress { display: flex; align-items: center; gap: 8px; }
.bar { flex: 1; height: 3px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 34%; background: var(--ink); }
.figure { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; font-size: 1.05em; }

.panel { background: var(--bg-panel); border: 1px solid var(--hairline-soft); border-radius: 14px; padding: 11px 12px; box-shadow: var(--shadow); }
.panel.accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 9%, var(--bg-panel)); }
.brief { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.brief .chev { margin-left: auto; color: var(--faint); }

.q-head { display: flex; justify-content: space-between; align-items: center; }
.q-title { font-size: 1.25em; font-weight: 620; margin: 6px 0 9px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--hairline); border-radius: 999px; padding: 5px 10px; font-weight: 600; }
.chip .flag { font-family: "Apple Color Emoji","Segoe UI Emoji", sans-serif; }
.row-in { display: flex; align-items: center; gap: 9px; }
.btns { display: flex; gap: 8px; margin-top: 10px; }
/* NB: style.css defines a global `.btn` (inline-flex, left-aligned, uppercase);
   these overrides re-center the label inside the pill and reset the padding. */
.btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; border-radius: 999px; padding: 10px 12px;
  font-weight: 600; font-size: .82em; letter-spacing: .02em; border: 1px solid transparent;
}
.btn.ghost { border-color: var(--hairline); color: var(--accent); background: var(--bg); }
.btn.fill  { background: var(--accent); color: #fff; }
.badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--faint); color: var(--faint); font-size: .62em; font-family: ui-monospace, Menlo, monospace; }

.wait { display: flex; align-items: center; gap: 10px; border: 1px solid var(--hairline); border-radius: 14px; padding: 9px 11px; color: var(--muted); }
.wait .n { flex: 1; }
.wait .w { font-family: ui-monospace, Menlo, monospace; font-size: .62em; letter-spacing: .1em; color: var(--faint); }

.commit { margin-top: auto; padding: 10px 0 12px; }
.commit .cta { display: flex; align-items: center; justify-content: center; gap: 7px; background: color-mix(in srgb, var(--accent) 22%, var(--bg-panel)); color: var(--muted); border-radius: 999px; padding: 11px; font-weight: 600; }
.commit .hint { text-align: center; color: var(--accent); margin-top: 7px; }

.driver { display: flex; align-items: center; gap: 10px; }
.driver .d-main { flex: 1; min-width: 0; }
.driver .d-t { font-weight: 600; }
.driver .d-s { font-family: ui-monospace, Menlo, monospace; font-size: .62em; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }
.delta { font-family: ui-monospace, Menlo, monospace; font-weight: 600; font-size: .82em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.delta.up   { color: var(--gain); background: color-mix(in srgb, var(--gain) 15%, transparent); }
.delta.down { color: var(--loss); background: color-mix(in srgb, var(--loss) 15%, transparent); }
.chev { color: var(--faint); }

.verdict { margin-top: auto; }
.verdict .v-row { display: flex; align-items: center; justify-content: space-between; }
.verdict .v-fig { font-family: ui-monospace, Menlo, monospace; font-size: 1.7em; font-weight: 600; }

.run { display: flex; align-items: center; gap: 10px; }
.run .rk { font-family: "Newsreader", serif; color: var(--faint); width: 18px; }
.run .r-main { flex: 1; min-width: 0; }
.run .r-t { font-weight: 620; }
.run .r-s { font-family: ui-monospace, Menlo, monospace; font-size: .58em; letter-spacing: .05em; color: var(--faint); }
.run.me { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.spark { width: 46px; height: 16px; }

.prose { font-family: "Newsreader", serif; color: var(--muted); line-height: 1.5; font-size: .96em; }
.big-flag { font-size: 1.6em; }

/* jurisdiction picker option rows + switch-cost badges */
.opt { display: flex; align-items: center; gap: 10px; padding: 9px 11px; }
.opt .o-main { flex: 1; min-width: 0; }
.opt .o-t { font-weight: 620; }
.opt .o-s { font-family: ui-mono, "SF Mono", Menlo, monospace; font-size: .6em; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-top: 1px; }
.cost { font-family: ui-mono, "SF Mono", Menlo, monospace; font-weight: 600; font-size: .68em; letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.cost.ok  { color: var(--gain); background: color-mix(in srgb, var(--gain) 15%, transparent); }
.cost.hot { color: var(--loss); background: color-mix(in srgb, var(--loss) 14%, transparent); }

/* bottom tab bar — only on the tab-root screens (Hall of Fame) */
.tabbar { margin-top: auto; display: flex; justify-content: space-around; align-items: flex-end;
  border-top: 1px solid var(--hairline); padding-top: 9px; padding-bottom: 4px; }
.tabbar .tab { display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--faint); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .58em; letter-spacing: .03em; }
.tabbar .tab .ic { font-size: 1.7em; line-height: 1; }
.tabbar .tab.on { color: var(--accent); }

/* App Store download — official Apple badge, unaltered per Marketing Guidelines */
.stores { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.appstore-badge { display: inline-block; line-height: 0; border-radius: 9px; transition: transform .15s ease, opacity .15s ease; }
.appstore-badge img { height: 48px; width: auto; display: block; }
.appstore-badge:hover { transform: translateY(-1px); opacity: .9; }
.appstore-badge:active { transform: translateY(0); }
.appstore-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
