/* ============================================================================
   recode-install.css — install bar, sheet, and the app preview section.
   Same system as recode-ds.css: light surfaces only, sharp corners except
   pills, 2px hairlines, no shadows beyond the existing tokens.
   ==========================================================================*/

/* ── sticky install bar ──────────────────────────────────────────────────── */
.inst-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--color-surface);
  border-top: 2px solid var(--color-divider);
  transform: translateY(110%);
  transition: transform .26s cubic-bezier(.22,.61,.36,1);
}
.inst-bar.is-up { transform: translateY(0); }
.inst-bar[hidden] { display: none; }
.inst-bar-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inst-bar-txt strong { font-size: 14px; font-weight: 600; line-height: 1.25; }
.inst-bar-txt span { font-size: 12px; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.inst-bar .btn { flex-shrink: 0; }
.inst-bar-x {
  flex-shrink: 0; width: 28px; height: 28px; font-size: 22px; line-height: 1;
  background: none; border: 0; cursor: pointer;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
@media (max-width: 560px) {
  .inst-bar { gap: 10px; padding-left: 14px; padding-right: 12px; }
  .inst-bar-txt span { display: none; }   /* one line on small phones */
}

/* ── install sheet (iOS steps / desktop QR) ──────────────────────────────── */
.inst-sheet { position: fixed; inset: 0; z-index: 90; }
.inst-sheet[hidden] { display: none; }
.inst-scrim { position: absolute; inset: 0; background: rgba(32,30,29,.42); }
.inst-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(520px, 100%);
  background: var(--color-bg);
  border-top: 2px solid var(--color-text);
  padding: 28px 24px calc(30px + env(safe-area-inset-bottom));
  animation: inst-rise .28s cubic-bezier(.22,.61,.36,1);
}
@media (min-width: 700px) {
  .inst-panel {
    bottom: auto; top: 50%; transform: translate(-50%, -50%);
    border: 2px solid var(--color-text);
  }
}
@keyframes inst-rise { from { transform: translate(-50%, 16px); opacity: 0; } }
.inst-x {
  position: absolute; top: 12px; right: 16px;
  width: 32px; height: 32px; font-size: 26px; line-height: 1;
  background: none; border: 0; cursor: pointer;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.inst-kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--color-accent); margin: 0 0 8px;
}
.inst-h {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 21px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 18px; max-width: 22ch;
}
.inst-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.inst-steps li { font-size: 15px; line-height: 1.45; }
.inst-ico { vertical-align: -4px; margin-left: 4px; }
.inst-note {
  font-size: 13px; line-height: 1.5; margin: 18px 0 0;
  color: color-mix(in srgb, var(--color-text) 62%, transparent);
}
.inst-qr {
  display: flex; justify-content: center; padding: 18px;
  background: var(--color-surface); border: 1px solid var(--color-divider);
}
.inst-qr img { display: block; width: 170px; height: 170px; }
.inst-cta { margin-top: 18px; width: 100%; }

/* ── app preview section ─────────────────────────────────────────────────── */
.appx { padding: 8px 0 0; }
.appx-frames {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  margin-top: 34px; align-items: start;
}
@media (max-width: 860px) {
  /* Horizontal scroll beats a 3-wide squeeze on a phone — the frames stay
     legible at their intended size instead of shrinking to thumbnails. */
  .appx-frames {
    display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-inline: calc(var(--space-5) * -1); padding-inline: var(--space-5);
    padding-bottom: 8px; scrollbar-width: none;
  }
  .appx-frames::-webkit-scrollbar { display: none; }
  .appx-frame { flex: 0 0 76%; scroll-snap-align: center; }
}
.appx-frame { display: flex; flex-direction: column; gap: 12px; }
.appx-cap {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim);
}

/* Phone shell. Aspect ratio is the mockup's 402x874. */
.phone {
  position: relative; aspect-ratio: 402 / 874; width: 100%;
  background: var(--color-bg);
  border: 2px solid var(--color-text);
  border-radius: 30px; overflow: hidden;
  /* Everything inside is scaled from a fixed 402px design width via a CSS
     variable, so the preview is pixel-proportional to the real app rather
     than a separately hand-tuned layout that will drift from it. */
  container-type: inline-size;
}
.phone-in {
  position: absolute; inset: 0;
  width: 402px; height: 874px;
  transform: scale(calc(100cqw / 402)); transform-origin: top left;
  font-family: var(--font-body); color: var(--color-text);
  display: flex; flex-direction: column;
}
/* Notch */
.phone-notch {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 26px; background: var(--color-text); border-radius: 999px; z-index: 5;
}

/* The previews are display-only. Nothing inside a .phone is interactive —
   the strategy doc is explicit that the marketing site shows the product and
   does not contain it. pointer-events:none enforces that structurally rather
   than relying on nobody wiring up a handler later. */
.phone * { pointer-events: none; user-select: none; }

.px-pad { padding: 62px 18px 0; }
.px-search {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 2px solid var(--color-text); border-radius: 999px;
  padding: 6px 6px 6px 18px; margin-bottom: 12px;
}
.px-search span { font-size: 15px; font-weight: 500; opacity: .5; }
.px-search b {
  background: var(--color-accent); color: #fff; font-family: var(--font-heading);
  font-weight: 700; font-size: 14px; border-radius: 999px; padding: 9px 20px;
}
.px-stat { display: flex; align-items: center; justify-content: space-between; padding: 0 0 16px; }
.px-streak { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.px-drop { width: 13px; height: 13px; background: var(--color-accent); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.px-lvl { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 132px; }
.px-lvl i {
  font-style: normal; background: var(--color-surface); font-family: var(--font-heading);
  font-weight: 700; font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  border-radius: 999px; padding: 4px 12px;
}
.px-bar { width: 100%; height: 4px; background: var(--color-surface); border-radius: 999px; overflow: hidden; }
.px-bar u { display: block; height: 100%; width: 64%; background: var(--color-accent); }
.px-rule { height: 2px; background: var(--color-divider); }
.px-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; }
.px-head h4 { font-family: var(--font-heading); font-weight: 800; font-size: 21px; letter-spacing: -.3px; margin: 0; }
.px-ring {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--color-accent) 0% 60%, var(--color-surface) 60% 100%);
}
.px-ring em {
  width: 29px; height: 29px; border-radius: 50%; background: var(--color-bg);
  display: flex; align-items: center; justify-content: center; font-style: normal;
  font-family: var(--font-heading); font-weight: 800; font-size: 10px;
}
.px-cards { display: flex; flex-direction: column; gap: 10px; }
.px-card { background: var(--color-surface); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.px-card.done { opacity: .7; }
.px-card-top { display: flex; align-items: center; justify-content: space-between; }
.px-tag {
  background: var(--color-bg); font-family: var(--font-heading); font-weight: 700;
  font-size: 10px; letter-spacing: .5px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 10px;
}
.px-chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-text); }
.px-chk.on {
  width: 24px; height: 24px; border: 0; background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
}
.px-t { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.px-m { display: flex; gap: 10px; font-size: 12px; font-weight: 500; opacity: .6; }
.px-m .xp { color: var(--color-accent); font-weight: 700; }
.px-card.done .px-m .xp { color: inherit; font-weight: 500; }

.px-flip {
  flex: 1; margin: 24px 0; background: var(--color-surface); border: 2px solid var(--color-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 36px 28px;
}
.px-q { font-family: var(--font-heading); font-weight: 800; font-size: 30px; line-height: 1.15; letter-spacing: -.5px; }
.px-hint { margin-top: 20px; font-size: 13px; font-weight: 600; opacity: .5; }
.px-btn {
  background: var(--color-accent); color: #fff; font-family: var(--font-heading);
  font-weight: 700; font-size: 16px; border-radius: 999px; padding: 16px; text-align: center;
}
.px-xp {
  background: var(--color-accent); color: #fff; font-family: var(--font-heading);
  font-weight: 700; font-size: 13px; border-radius: 999px; padding: 6px 14px;
}
.px-name { font-size: 14px; font-weight: 600; opacity: .55; }
.px-level { font-family: var(--font-heading); font-weight: 900; font-size: 30px; letter-spacing: -.7px; margin-top: 2px; }
.px-total { font-size: 13px; font-weight: 600; opacity: .55; margin-top: 2px; }
.px-lbl {
  font-family: var(--font-heading); font-weight: 700; font-size: 12px; letter-spacing: .5px;
  text-transform: uppercase; opacity: .55; margin: 22px 0 10px;
}
.px-heat { display: flex; gap: 5px; }
.px-heat i { width: 19px; height: 19px; background: var(--color-text); }
.px-heat i.off { background: none; border: 2px solid rgba(32,30,29,.25); }
.px-badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.px-badge { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.px-badge div {
  width: 100%; aspect-ratio: 1; background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
}
.px-badge span { font-size: 9px; font-weight: 600; }
.px-badge.off { opacity: .45; }
.px-nav {
  margin-top: auto; display: flex; justify-content: space-around;
  border-top: 2px solid var(--color-divider); padding: 10px 8px 24px;
}
.px-nav div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; opacity: .45; }
.px-nav div.on { opacity: 1; color: var(--color-accent); font-weight: 700; }

/* Give the sticky bar room so it never covers the footer's last line. */
body.has-inst-bar { padding-bottom: 84px; }
