/* gils studio, concept "swipe": one card at a time, toys you can play with. */

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-standard-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-ext-standard-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  /* The table the cards lie on, the cards, and their thickness. */
  --bg: light-dark(#e6e1d8, #0e0e10);
  --card: light-dark(#fbfaf7, #1c1c1f);
  --card-line: light-dark(#e3ddd2, #2c2c31);
  --tint: light-dark(#efe9e0, #2a2a2f);
  --edge: light-dark(#cbc3b5, #050506);
  --ink: light-dark(#19191b, #f2f0eb);
  --muted: light-dark(#55524c, #b1ada5);
  --line: light-dark(#d5cec2, #3a3a40);
  --line-strong: light-dark(#8d877c, #77757d);
  --focus: light-dark(#1d5fd1, #8ab4ff);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.3, 1.45, .5, 1);
  --radius: 28px;
  /* Studio default for app roles (overridden per app). */
  --a: var(--ink);
  --a-btn: var(--ink);
  --a-btn-ink: var(--card);
  --a-edge: light-dark(#000, #8d877c);
  --a-text: var(--ink);
  --a-ui: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  /* The table takes on the colour world of the app on top (set per card or per app page). */
  --world-mix: 0%;
  background: color-mix(in oklab, var(--world, var(--bg)) var(--world-mix), var(--bg));
  transition: background-color .7s var(--ease);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
body[data-world="app"] { --world-mix: 26%; }
body[data-page="app"] { --world: var(--a); --world-mix: 16%; }
@media (prefers-color-scheme: dark) {
  body[data-world="app"] { --world-mix: 16%; }
  body[data-page="app"] { --world-mix: 10%; }
}
img, video, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 12px; }
main:focus { outline: none; }

[hidden], .optional.is-dropped { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -80px; z-index: 50; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--card); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.eyebrow { font-size: .8125rem; font-weight: 600; letter-spacing: .01em; color: var(--muted); }
.lead { color: var(--muted); font-size: 1.0625rem; line-height: 1.45; text-wrap: pretty; }

/* ---------- Keys: buttons that press down like a key cap ---------- */
.key {
  --key-bg: var(--card);
  --key-ink: var(--ink);
  --key-line: var(--line-strong);
  --key-edge: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 18px; margin-bottom: 4px;
  border: 1.5px solid var(--key-line); border-radius: 14px;
  background: var(--key-bg); color: var(--key-ink);
  box-shadow: 0 4px 0 var(--key-edge);
  font-weight: 600; font-size: 1rem; line-height: 1.15; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform .09s ease-out, box-shadow .09s ease-out, background-color .2s;
}
.key:hover { --key-bg: var(--tint); }
.key:active, .key[aria-current="page"] { transform: translateY(3px); box-shadow: 0 1px 0 var(--key-edge); }
.key[aria-current="page"] { --key-bg: var(--tint); }
.key:disabled { opacity: .38; cursor: default; transform: none; box-shadow: 0 4px 0 var(--key-edge); }
.key--accent { --key-bg: var(--a-btn); --key-ink: var(--a-btn-ink); --key-line: var(--a-btn); --key-edge: var(--a-edge); }
.key--accent:hover { --key-bg: var(--a-btn); filter: brightness(1.06); }
.key--small { min-height: 44px; padding: 0 14px; font-size: .9375rem; border-radius: 12px; }
.key--round { width: 48px; padding: 0; flex: none; }
.key .icon { flex: none; }

/* ---------- Header ---------- */
.bar {
  view-transition-name: bar;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
  min-height: 64px;
}
.bar-start, .bar-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-end { flex: none; }
.bar-end .key { margin-bottom: 4px; }
.wordmark {
  font-size: 1.875rem; font-weight: 700; font-stretch: 78%; letter-spacing: -.03em; line-height: 1;
  text-decoration: none; padding: 6px 4px; display: inline-flex; align-items: baseline;
}
.wordmark::after { content: ''; width: .22em; height: .22em; background: currentColor; border-radius: 2px; margin-left: .06em; }
.bar-app { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-app .app-icon { width: 32px; height: 32px; border-radius: 9px; }
.bar-app-name { font-weight: 700; font-stretch: 80%; font-size: 1.375rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 370px) {
  .bar-end .key--small:not(.lang-switch) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bar-end .key--small:not(.lang-switch) { width: 44px; padding: 0; }
}

/* ---------- Deck ---------- */
main { min-height: 0; min-width: 0; }
.deck { min-width: 0; }
.deck-page { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.deck { position: relative; min-height: 0; }
.deck-track {
  position: relative;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.deck-track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  padding: 6px 14px 14px;
  display: flex;
  min-width: 0;
}
.slide:focus { outline: none; }
.slide:focus-visible > .card { outline: 3px solid var(--focus); outline-offset: 3px; }

.card {
  container-type: size;
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge), 0 26px 50px -34px rgb(0 0 0 / .5);
  overflow: hidden;
}
.card-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: auto;
  padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.card-title { font-size: clamp(1.875rem, 9cqw, 3.25rem); font-weight: 700; font-stretch: 82%; line-height: 1.02; letter-spacing: -.02em; text-wrap: balance; }

/* Cards lean away as they leave, like a card pushed off a pile. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .slide { view-timeline: --slide inline; }
    .slide > .card {
      transform-origin: 50% 115%;
      animation: lean linear both;
      animation-timeline: view(inline);
    }
    @keyframes lean {
      0% { transform: translateY(14px) rotate(5deg) scale(.94); }
      50% { transform: none; }
      100% { transform: translateY(14px) rotate(-5deg) scale(.94); }
    }
  }
}

.deck-nav {
  view-transition-name: deck-nav;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 14px;
  padding: 2px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.deck-progress { display: grid; gap: 7px; min-width: 0; }
.deck-caption {
  text-align: center; font-size: .875rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.deck-ticks { display: flex; gap: 4px; justify-content: center; }
.tick { height: 6px; flex: 0 1 18px; border-radius: 3px; background: color-mix(in oklab, var(--ink) 20%, transparent); transition: flex-basis .3s var(--ease), background-color .3s; }
.tick.is-on { flex-basis: 36px; background: var(--ink); }

/* Desktop and wide tablets: the current card in front, neighbours peeking at the sides. */
@media (min-width: 1000px) and (min-height: 600px) {
  .deck-track { padding-inline: calc((100% - min(1160px, 100% - 260px)) / 2); scroll-padding-inline: 0; }
  .slide { flex-basis: min(1160px, 100vw - 260px); padding: 10px 14px 22px; }
  .slide[inert] > .card { cursor: pointer; }
  .slide[inert] { opacity: .55; transition: opacity .3s; }
  .deck-nav { max-width: 640px; width: 100%; margin: 0 auto; }
}

/* ---------- Status, meta ---------- */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .875rem; font-weight: 600; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.status-mark { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.status-live .status-mark { background: currentColor; }
.status-beta .status-mark { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* ---------- Intro card ---------- */
.card-intro .card-scroll { justify-content: space-between; gap: 20px; }
.intro-text { display: grid; gap: 14px; }
.intro-title { font-size: clamp(2.125rem, 10.5cqw, 4.75rem); font-weight: 700; font-stretch: 78%; line-height: .98; letter-spacing: -.03em; text-wrap: balance; }
.fan { container-type: size; flex: 1 1 0; min-height: 150px; display: flex; justify-content: center; align-items: center; padding: 10px 0 6px; }
.fan-card {
  --w: min(20cqw, 48cqh, 168px);
  --tilt: calc((var(--i) - (var(--n) - 1) / 2) * 7deg);
  --drop: calc(var(--d) * var(--d) * 4cqh);
  position: relative; flex: none;
  width: var(--w); height: calc(var(--w) * 16 / 9); margin-inline: calc(var(--w) * -.1);
  padding: 0; border-radius: calc(var(--w) * .16); overflow: hidden;
  background: var(--tint); border: 3px solid light-dark(#19191b, #000);
  box-shadow: 0 5px 0 var(--edge);
  cursor: pointer;
  transform: translateY(var(--drop)) rotate(var(--tilt));
  transform-origin: 50% 120%;
  transition: transform .35s var(--spring), box-shadow .2s;
  touch-action: manipulation;
}
.fan-cover, .fan-cover img { position: absolute; inset: 0; width: 100%; height: 100%; }
.fan-cover img { object-fit: cover; object-position: top; }
.fan-id { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 6px; background: var(--card); border-top: 1.5px solid var(--line); }
.fan-card .app-icon { width: min(28px, 40%); height: auto; aspect-ratio: 1; border-radius: 7px; }
.fan-card:hover, .fan-card:focus-visible { transform: translateY(calc(var(--drop) - 14px)) rotate(var(--tilt)); z-index: 2; }
.fan-card:focus-visible { outline-offset: 4px; border-radius: calc(var(--w) * .16); }
.fan-card:active { transform: translateY(calc(var(--drop) + 2px)) rotate(var(--tilt)); box-shadow: 0 2px 0 var(--edge); }
.fan-name { font-size: .8125rem; font-weight: 700; font-stretch: 78%; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 520px) {
  .fan-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fan-id { justify-content: center; background: transparent; border: 0; }
  .fan-card .app-icon { width: min(30px, 46%); box-shadow: 0 2px 0 rgb(0 0 0 / .25); }
}
@container (min-width: 521px) { .fan-name { font-size: .9375rem; } }
@media (prefers-reduced-motion: no-preference) {
  .card-intro .fan-card { animation: deal .6s var(--spring) both; animation-delay: calc(var(--i) * 60ms + 120ms); }
  @keyframes deal { from { opacity: 0; transform: translateY(70px) rotate(0deg); } }
}
@container (min-width: 860px) {
  .card-intro .card-scroll { flex-direction: row; align-items: center; padding: 40px 48px; gap: 40px; }
  .intro-text { flex: 1 1 46%; }
  .fan { flex: 1 1 54%; align-self: stretch; }
}

/* ---------- Statement card: the inverted card in the pile ---------- */
.card-statement { background: var(--ink); border-color: var(--ink); color: var(--card); }
/* In the dark theme the inverted card is a light slab; while it only peeks in
   at the side it stays a dark card and turns over when it comes to the front. */
@media (prefers-color-scheme: dark) and (min-width: 1000px) and (min-height: 600px) {
  .card-statement { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease); }
  .slide[inert] > .card-statement { background: var(--card); border-color: var(--card-line); color: var(--muted); }
}
.card-statement .card-scroll { justify-content: center; }
.statement { font-size: clamp(2.25rem, 13.5cqw, 6rem); font-weight: 700; font-stretch: 76%; line-height: 1; letter-spacing: -.03em; text-wrap: balance; }

/* ---------- Principles, about ---------- */
.card-principles .card-scroll, .card-about .card-scroll { gap: 16px; }
.principles { display: grid; gap: 14px; }
@container (min-width: 720px) { .principles { grid-template-columns: 1fr 1fr; gap: 22px 28px; } }
/* Wide cards: the principles become four key-cap tiles that fill the card. */
@container (min-width: 720px) and (min-height: 460px) {
  .card-principles .card-scroll, .card-about .card-scroll { padding: 40px 48px 36px; gap: 26px; }
  .card-principles .card-title, .card-about .card-title { font-size: clamp(2.5rem, 5.5cqw, 4.25rem); }
  .card-principles .card-scroll { justify-content: center; }
  .card-principles .principles { flex: none; height: clamp(260px, 56cqh, 440px); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); grid-auto-rows: 1fr; gap: 16px; }
  .card-principles .principles li {
    grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 18px; align-content: stretch;
    padding: 22px 22px 24px; border-radius: 20px; background: var(--tint);
    border: 1.5px solid var(--line); box-shadow: 0 4px 0 var(--line);
  }
  .card-principles .principles li > div { display: grid; gap: 8px; align-content: end; }
  .card-principles .principle-no { width: 48px; height: 48px; border-radius: 13px; font-size: 1.375rem; background: var(--card); }
  .card-principles .principles h3 { font-size: clamp(1.25rem, 2.2cqw, 1.625rem); font-stretch: 85%; letter-spacing: -.01em; }
  .card-principles .principles p { font-size: 1.0625rem; line-height: 1.45; }
  .card-about .card-scroll {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 56px;
    grid-template-rows: auto auto 1fr auto; align-items: start;
  }
  .card-about .founders { grid-column: 1; grid-row: 1; }
  .card-about .card-title { grid-column: 1; grid-row: 2; }
  .card-about .about-text { grid-column: 1; grid-row: 3; font-size: clamp(1.125rem, 1.7cqw, 1.375rem); color: var(--ink); gap: 16px; }
  .card-about .contact { grid-column: 2; grid-row: 1 / 4; align-self: end; margin: 0; border-top: 0; border-left: 1.5px solid var(--line); padding: 4px 0 4px 28px; gap: 8px; }
  .card-about .contact h3 { font-size: 1.375rem; }
  .card-about .contact p { font-size: 1.0625rem; }
  .card-about .footer-note { grid-column: 1 / -1; grid-row: 4; padding-top: 14px; border-top: 1.5px solid var(--line); }
  .card-about .founders span { width: 80px; height: 80px; font-size: 2.5rem; border-radius: 18px; }
}
.principles li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.principle-no {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 1.5px solid var(--line-strong); box-shadow: 0 3px 0 var(--line-strong);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.principles h3 { font-size: 1.0625rem; line-height: 1.25; }
.principles p { color: var(--muted); font-size: .9375rem; line-height: 1.4; }
.about-text { display: grid; gap: 10px; color: var(--muted); font-size: 1.0625rem; max-width: 60ch; }
.founders { display: flex; gap: 8px; margin-bottom: 4px; }
.founders span {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px;
  border: 1.5px solid var(--line-strong); box-shadow: 0 5px 0 var(--line-strong); background: var(--card);
  font-size: 2rem; font-weight: 700; font-stretch: 80%;
}
.founders span:nth-child(2) { transform: translateY(3px); box-shadow: 0 2px 0 var(--line-strong); }
.contact { display: grid; gap: 4px; padding-top: 14px; border-top: 1.5px solid var(--line); margin-top: auto; }
.contact h3 { font-size: 1.0625rem; }
.contact p { color: var(--muted); }
.footer-note { font-size: .8125rem; color: var(--muted); }

/* ---------- App card (home) ---------- */
.app-icon { border-radius: 12px; flex: none; }
.app-grid { gap: 10px; }
.app-top { display: flex; align-items: center; gap: 12px; }
.app-top .app-icon { width: 44px; height: 44px; }
.app-name { font-size: clamp(2.75rem, 17cqw, 6.25rem); font-weight: 700; font-stretch: 76%; line-height: .9; letter-spacing: -.035em; }
.tagline { font-size: 1.125rem; line-height: 1.3; font-weight: 500; text-wrap: balance; }
.app-more, .clip-slot { display: none; }
.summary { color: var(--muted); text-wrap: pretty; }
.highlights { display: grid; gap: 6px; }
.highlights li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: baseline; }
.highlights li::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--a-ui); transform: translateY(1px); }
.toy-stage {
  container-type: size;
  flex: 1 1 auto; min-height: 168px;
  display: grid; place-items: center;
  border-radius: 20px;
  --stage-mix: 13%;
  background: color-mix(in oklab, var(--a) var(--stage-mix), var(--card));
  border: 1.5px solid color-mix(in oklab, var(--a) calc(var(--stage-mix) * 2.3), var(--card));
  overflow: hidden;
  position: relative;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .key { flex: 1 1 auto; }

/* Dark theme: a lighter touch of the accent, so the stage does not turn muddy. */
@media (prefers-color-scheme: dark) { .toy-stage { --stage-mix: 7%; } }

/* Tall tablets: room for the summary and the clip next to the toy. */
@container (min-width: 600px) and (min-height: 760px) {
  .app-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top top" "name name" "tag tag" "more more" "toy clip" "act act";
    column-gap: 18px;
  }
  .app-grid > .app-top { grid-area: top; } .app-name { grid-area: name; } .tagline { grid-area: tag; }
  .app-grid > .app-more { grid-area: more; display: grid; gap: 10px; }
  .app-grid > .toy-stage { grid-area: toy; min-height: 0; }
  .app-grid > .clip-slot { grid-area: clip; display: block; min-height: 0; height: 100%; }
  .app-grid > .actions { grid-area: act; }
}
/* Desktop: words left, toy in the middle, the real app on the right. */
@container (min-width: 860px) {
  .app-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top toy clip" "name toy clip" "tag toy clip" "more toy clip" "act toy clip";
    gap: 12px 26px;
    padding: 30px;
  }
  .app-grid > .app-top { grid-area: top; } .app-name { grid-area: name; } .tagline { grid-area: tag; }
  .app-grid > .app-more { grid-area: more; display: grid; gap: 14px; align-content: start; }
  .app-grid > .toy-stage { grid-area: toy; min-height: 0; }
  .app-grid > .clip-slot { grid-area: clip; display: block; min-height: 0; height: 100%; }
  .app-grid > .actions { grid-area: act; }
  .app-name { font-size: clamp(3.5rem, 7cqw, 6.5rem); }
}

/* The clip column is a size container: the phone or screen fits its box, never wider. */
.app-grid > .clip-slot { container-type: size; }
.app-grid > .clip-slot .clip-screen { height: auto; width: min(100cqw, 100cqh * var(--r)); }

/* ---------- Clips ---------- */
.clip { display: flex; gap: 16px; min-height: 0; }
.clip-screen {
  position: relative; flex: none;
  aspect-ratio: var(--ratio);
  border-radius: 16px; overflow: hidden;
  background: var(--tint);
  box-shadow: 0 0 0 1.5px var(--line);
}
.clip-screen.is-phone { border-radius: 26px; border: 6px solid light-dark(#19191b, #000); box-shadow: 0 5px 0 var(--edge); }
.clip-video { width: 100%; height: 100%; object-fit: cover; }
.clip-toggle { position: absolute; left: 10px; bottom: 6px; z-index: 2; }
.clip-toggle::after {
  content: ''; position: absolute; inset: -7px; border-radius: 20px; pointer-events: none;
  border: 3px solid transparent; opacity: 0; transition: opacity .2s;
}
.is-buffering .clip-toggle::after { opacity: 1; border-color: var(--card) var(--ink) var(--card) var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .is-buffering .clip-toggle::after { animation: spin .9s linear infinite; }
  @keyframes spin { to { rotate: 1turn; } }
}
@media (prefers-reduced-motion: reduce) {
  .is-buffering .clip-toggle::after { border-style: dotted; border-color: var(--ink); }
}
.clip-caption { min-width: 0; }
.clip-desc { font-size: .9375rem; line-height: 1.42; color: var(--muted); text-wrap: pretty; }

/* Home: the phone fills the card height; the description opens on demand. */
.clip--home { height: 100%; flex-direction: column; align-items: center; justify-content: center; }
.clip--home .clip-screen { height: 100%; width: auto; }

/* App page: the phone on top of its description (narrow), side by side (wide). */
.card-clip .card-scroll, .card-showcase .card-scroll { justify-content: center; }
.clip--visible, .clip--auto, .media-row { flex: 1; min-height: 0; flex-direction: column; align-items: center; gap: 14px; }
.clip--visible .clip-screen, .clip--auto .clip-screen, .media-row .still { flex: 1 1 0; min-height: 0; width: auto; max-width: 100%; }
.clip--visible .clip-caption, .clip--auto .clip-caption, .media-row .media-text { flex: none; width: 100%; display: grid; gap: 6px; }
/* Narrow cards: the phone gets the room; the description is one tap away. */
.clip--auto { position: relative; gap: 4px; container-type: size; width: 100%; }
.clip--auto .clip-screen { flex: none; height: auto; width: min(100cqw, (100cqh - 48px) * var(--r)); }
.clip--auto .clip-label { display: none; }
.clip--auto .clip-caption { justify-items: center; }
.clip-more {
  min-height: 44px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  font-weight: 600; font-size: .9375rem; color: var(--muted);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.clip-more[aria-expanded="true"] { color: var(--ink); }
.clip--auto .clip-desc { display: none; }
.clip--auto.is-described .clip-desc {
  display: block; position: absolute; inset: auto 0 52px; z-index: 3; padding: 14px 16px; border-radius: 16px;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); box-shadow: 0 4px 0 var(--edge);
}
.clip--visible .clip-desc { font-size: .9375rem; }
@container (min-width: 700px) {
  .clip--visible, .clip--auto, .media-row { flex-direction: row; justify-content: center; gap: 44px; padding: 8px 16px; }
  .clip--visible .clip-screen, .clip--auto .clip-screen, .media-row .still { flex: none; height: 100%; width: auto; }
  .clip--visible .clip-screen:not(.is-phone), .clip--auto .clip-screen:not(.is-phone) { height: auto; width: min(58%, calc((100cqh - 60px) * 720 / 780)); }
  .clip--visible .clip-caption, .clip--auto .clip-caption, .media-row .media-text { flex: 0 1 36ch; width: auto; }
  .clip--visible .clip-desc, .clip--auto .clip-desc { font-size: 1.1875rem; color: var(--ink); }
  .clip--auto .clip-caption { justify-items: start; }
  .clip--auto .clip-label { display: block; }
  .clip--auto .clip-more { display: none; }
  .clip--auto .clip-desc, .clip--auto.is-described .clip-desc { display: block; position: static; padding: 0; border: 0; box-shadow: none; background: none; }
  .card-showcase .lead { font-size: 1.1875rem; }
}

/* ---------- App page ---------- */
.app-page .card { border-top: 6px solid var(--a); }
.hero-grid { gap: 14px; }
.hero-text { display: grid; gap: 12px; align-content: start; }
.hero-title { font-size: clamp(2rem, 10cqw, 4.25rem); font-weight: 700; font-stretch: 78%; line-height: .98; letter-spacing: -.03em; text-wrap: balance; }
.platforms { font-size: .9375rem; }
.card-hero .toy-stage { min-height: 150px; }
@container (min-height: 600px) { .card-hero .toy-stage { min-height: 200px; } }
@container (min-width: 860px) {
  .hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; padding: 32px; }
  .hero-text { align-content: center; }
  .card-hero .toy-stage { display: grid; min-height: 0; }
}

.step-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.step-tab {
  width: 52px; height: 52px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line-strong); box-shadow: 0 4px 0 var(--line-strong);
  font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums;
  transition: transform .09s, box-shadow .09s, background-color .2s;
}
.step-tab[aria-selected="true"] { background: var(--a-btn); color: var(--a-btn-ink); border-color: var(--a-btn); box-shadow: 0 1px 0 var(--a-edge); transform: translateY(3px); }
.step-panels { flex: 1; min-height: 0; }
@container (min-height: 560px) {
  .card-steps .card-scroll { justify-content: center; gap: 20px; }
  .card-steps .step-panels { flex: none; }
  .card-steps .step-panel { padding: 24px; gap: 12px; min-height: 12em; }
  .card-steps .step-panel h3 { font-size: clamp(1.5rem, 4.4cqw, 2.25rem); font-stretch: 85%; letter-spacing: -.01em; }
  .card-steps .step-panel p { font-size: clamp(1.0625rem, 2.4cqw, 1.3125rem); max-width: 52ch; }
}
@container (min-width: 700px) and (min-height: 460px) {
  .card-steps .card-scroll { padding: 40px 48px; justify-content: center; gap: 24px; }
  .card-steps .card-title { font-size: clamp(2.5rem, 5.5cqw, 4.25rem); }
  .step-tab { width: 60px; height: 60px; font-size: 1.5rem; }
  .card-steps .step-panel { padding: 32px 36px; min-height: 13em; }
}
.step-panel { display: grid; gap: 10px; align-content: start; padding: 18px; border-radius: 18px; background: var(--tint); }
.step-panel h3 { font-size: 1.375rem; line-height: 1.2; }
.step-panel p { color: var(--ink); font-size: 1.0625rem; text-wrap: pretty; }
@media (prefers-reduced-motion: no-preference) {
  .step-panel:not([hidden]) { animation: rise .32s var(--ease); }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}

.media-text .card-title { font-size: clamp(1.5rem, 7cqw, 2.75rem); }
.card-showcase .lead { font-size: 1rem; }
.still { aspect-ratio: var(--ratio); border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1.5px var(--line); }
.still.is-phone { border-radius: 24px; border: 6px solid light-dark(#19191b, #000); box-shadow: 0 5px 0 var(--edge); }
.still img { width: 100%; height: 100%; object-fit: cover; }
.feature-tiles { flex: 1; max-height: 620px; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px; padding-bottom: 4px; }
@container (min-width: 700px) { .feature-tiles { grid-template-columns: repeat(3, 1fr); } }
.feature-tiles li { display: flex; }
.feature-tile {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 14px;
  min-height: 88px; padding: 14px; border-radius: 16px; text-align: left; cursor: pointer;
  background: color-mix(in oklab, var(--a) 10%, var(--card)); border: 1.5px solid var(--line-strong); box-shadow: 0 4px 0 var(--line-strong);
  transition: transform .09s, box-shadow .09s;
  font-weight: 600; font-size: 1.0625rem; line-height: 1.2;
}
.feature-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-strong); }
.feature-tile .icon { color: var(--a-text); }
.feature-text { display: none; font-weight: 400; color: var(--muted); font-size: 1rem; line-height: 1.4; }
@container (min-width: 700px) and (min-height: 520px) {
  .feature-tiles { flex: none; grid-auto-rows: minmax(190px, auto); }
  .card-features .card-scroll { justify-content: center; padding: 32px; gap: 20px; }
  .feature-tile { justify-content: flex-start; gap: 10px; padding: 20px; }
  .feature-tile .feature-name { font-size: 1.25rem; }
  .feature-text { display: block; }
  .feature-tile .icon { margin-top: auto; }
}

.card-facts .card-scroll { justify-content: center; gap: 22px; }
.facts { display: grid; gap: 16px; }
.fact { display: flex; flex-direction: column-reverse; gap: 2px; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.fact dd { font-size: clamp(2.25rem, 13cqw, 4.5rem); font-weight: 700; font-stretch: 76%; line-height: 1; letter-spacing: -.03em; color: var(--a-text); font-variant-numeric: tabular-nums; }
.fact dt { color: var(--muted); font-weight: 500; }
@container (min-width: 700px) { .facts { grid-template-columns: repeat(3, 1fr); gap: 28px; } }
.quote p { font-size: clamp(1.375rem, 6cqw, 2.25rem); font-weight: 600; font-stretch: 85%; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.quote { padding-left: 16px; border-left: 5px solid var(--a); }
.only-quote .quote p { font-size: clamp(2rem, 8.5cqw, 4.5rem); font-weight: 700; font-stretch: 78%; line-height: 1.02; letter-spacing: -.025em; }
@container (min-width: 700px) { .card-facts .card-scroll { padding: 40px 48px; } }

.card-final .card-scroll { gap: 16px; }
.final-main { display: grid; gap: 12px; justify-items: start; margin-block: auto; }
.final-main .app-icon { width: 64px; height: 64px; border-radius: 16px; }
@container (min-width: 700px) and (min-height: 460px) {
  .card-final .card-scroll { padding: 40px 48px 32px; }
  .card-final .card-title { font-size: clamp(2.75rem, 6cqw, 4.75rem); }
  .card-final .lead { font-size: 1.25rem; max-width: 46ch; }
  .final-main .app-icon { width: 88px; height: 88px; border-radius: 22px; }
}
.final-extra { display: flex; flex-wrap: wrap; gap: 10px; }
.next-app {
  margin-top: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 14px 16px; border-radius: 18px; text-decoration: none;
  background: var(--card); border: 1.5px solid var(--line-strong); box-shadow: 0 5px 0 var(--line-strong);
  transition: transform .09s, box-shadow .09s;
}
.next-app:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line-strong); }
.next-app .eyebrow { grid-column: 1 / -1; }
.next-app-id { display: flex; align-items: center; gap: 12px; }
.next-app-name { font-size: 1.5rem; font-weight: 700; font-stretch: 80%; letter-spacing: -.02em; }
.next-app .app-icon { width: 40px; height: 40px; border-radius: 11px; }

.missing { display: grid; place-content: center; justify-items: start; gap: 16px; padding: 24px; height: 100%; }

/* ---------- Loading and error states ---------- */
.state { height: 100%; display: grid; place-items: center; padding: 6px 14px 14px; }
.state-loading { grid-template-rows: minmax(0, 1fr) auto; gap: 14px; place-items: stretch; }
.ghost-pile { position: relative; }
.ghost-pile span {
  position: absolute; inset: 0; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--card-line); box-shadow: 0 6px 0 var(--edge);
}
.ghost-pile span:nth-child(1) { transform: rotate(-2.5deg) translateY(6px) scale(.97); opacity: .55; }
.ghost-pile span:nth-child(2) { transform: rotate(1.8deg) translateY(3px) scale(.985); opacity: .8; }
.state-text { text-align: center; font-weight: 600; color: var(--muted); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: no-preference) {
  .ghost-pile span:nth-child(3) { animation: breathe 1.6s ease-in-out infinite alternate; }
  @keyframes breathe { to { opacity: .72; } }
}
.state-card {
  width: min(100%, 560px); display: grid; gap: 14px; padding: 28px 24px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: 0 6px 0 var(--edge);
}
.state-card .page-title { font-size: clamp(2rem, 8vw, 3rem); text-wrap: balance; }

/* ---------- Apps overview: a shelf of cartridges ---------- */
.apps-page { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 4px max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
.apps-head { display: grid; gap: 6px; max-width: 60ch; padding: 0 4px; }
.page-title { font-size: clamp(2.25rem, 9vw, 4rem); font-weight: 700; font-stretch: 78%; line-height: 1; letter-spacing: -.03em; }
.apps-head .lead { font-size: 1rem; }
.shelf-scroll { overflow-y: auto; padding: 6px 2px max(18px, env(safe-area-inset-bottom)); }
.shelf { display: grid; gap: 12px; }
.cartridge {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  padding: 12px 14px; border-radius: 20px; text-decoration: none;
  background: var(--card); border: 1px solid var(--card-line);
  box-shadow: 0 5px 0 var(--edge);
  transition: transform .1s ease-out, box-shadow .1s ease-out;
}
.cartridge:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge); }
.cartridge-cover { display: none; }
.cartridge-id { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.cartridge-text { display: grid; min-width: 0; }
.cartridge-name { font-size: 1.5rem; font-weight: 700; font-stretch: 80%; letter-spacing: -.02em; line-height: 1.05; }
.cartridge-cat { font-size: .9375rem; color: var(--muted); }
.cartridge-tagline { display: none; }
.cartridge .status { font-size: .875rem; font-weight: 600; padding-left: 60px; }
@media (prefers-reduced-motion: no-preference) {
  .shelf li { animation: slot-in .5s var(--spring) both; animation-delay: calc(var(--i) * 50ms); }
  @keyframes slot-in { from { opacity: 0; transform: translateY(24px); } }
}
@media (min-height: 760px) and (max-width: 999px) {
  .cartridge-tagline { display: block; color: var(--muted); font-size: .9375rem; padding-left: 60px; }
}
@media (min-width: 1000px) and (min-height: 600px) {
  .apps-page { padding: 8px 40px 0; gap: 22px; }
  .shelf-scroll { padding-bottom: 32px; }
  .shelf { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; height: 100%; }
  .shelf li { display: flex; min-height: 0; }
  .cartridge {
    flex: 1; grid-template-rows: minmax(0, 1fr) auto auto auto; gap: 12px; padding: 14px 14px 16px;
  }
  .cartridge-cover { display: block; min-height: 0; border-radius: 14px; overflow: hidden; background: var(--tint); }
  .cartridge-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s var(--ease); }
  .cartridge:hover .cartridge-cover img { transform: scale(1.04); }
  .cartridge-tagline { display: block; color: var(--muted); font-size: .9375rem; line-height: 1.4; min-height: 2.8em; }
  .cartridge .status { padding-left: 0; }
  .cartridge-id .icon { display: none; }
}

/* ---------- Sheet ---------- */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; padding: 0; border: 0; background: transparent;
  width: 100%; max-width: 620px; max-height: 88dvh; overflow: visible; color: var(--ink);
}
.sheet::backdrop { background: rgb(10 10 12 / .45); }
.sheet-panel {
  background: var(--card); border-radius: 26px 26px 0 0; border: 1px solid var(--card-line); border-bottom: 0;
  padding: 8px 20px max(22px, env(safe-area-inset-bottom));
  max-height: 88dvh; display: flex; flex-direction: column;
  transition: transform .32s var(--ease);
  touch-action: none;
}
.sheet-panel.is-dragging { transition: none; }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title { font-size: 1.75rem; font-weight: 700; font-stretch: 82%; letter-spacing: -.02em; line-height: 1.05; padding-top: 6px; }
.sheet-body { overflow-y: auto; padding-top: 10px; touch-action: pan-y; }
.sheet-body .lead { color: var(--ink); font-size: 1.125rem; }
.sheet-text { display: grid; gap: 10px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] .sheet-panel { animation: sheet-up .38s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet.is-closing .sheet-panel { transform: translateY(100%); }
  .sheet::backdrop { transition: opacity .3s; }
  .sheet.is-closing::backdrop { opacity: 0; }
  .sheet[open]::backdrop { animation: fade .3s; }
  @keyframes fade { from { opacity: 0; } }
}
@media (min-width: 700px) {
  .sheet { inset: 0; margin: auto; height: fit-content; }
  .sheet-panel { border-radius: 26px; border-bottom: 1px solid var(--card-line); box-shadow: 0 6px 0 var(--edge); }
}

/* ---------- Page transitions (cross-document) ---------- */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: var(--ease); }
::view-transition-old(root) { animation: .34s var(--ease) both deal-out; }
::view-transition-new(root) { animation: .42s var(--ease) both deal-in; }
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: deal-out-back; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: deal-in-back; }
@keyframes deal-out { to { opacity: 0; transform: translateX(-10%) rotate(-2deg) scale(.96); } }
@keyframes deal-in { from { opacity: 0; transform: translateX(14%) rotate(2deg) scale(.98); } }
@keyframes deal-out-back { to { opacity: 0; transform: translateX(10%) rotate(2deg) scale(.96); } }
@keyframes deal-in-back { from { opacity: 0; transform: translateX(-14%) rotate(-2deg) scale(.98); } }
::view-transition-old(bar), ::view-transition-new(bar), ::view-transition-old(deck-nav), ::view-transition-new(deck-nav) { animation-duration: .25s; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Short phones (e.g. 360x640): tighten the app card so nothing scrolls. */
@container (max-height: 540px) {
  .card-scroll { padding: 16px 18px 14px; gap: 8px; }
  .app-name { font-size: clamp(2.5rem, 15cqw, 3.25rem); }
  .tagline { font-size: 1.0625rem; }
  .toy-stage { min-height: 120px; }
  .app-top .app-icon { width: 38px; height: 38px; }
  .founders { display: none; }
  .fan { min-height: 112px; padding-top: 8px; }
  .intro-title { font-size: 2rem; }
  .principles { gap: 10px; }
  .principles p { font-size: .875rem; }
  .feature-tiles { gap: 10px; }
  .feature-tile { min-height: 64px; padding: 12px; gap: 8px; }
  .final-main .app-icon { width: 48px; height: 48px; }
  .card-final .card-scroll { gap: 12px; }
  .about-text { font-size: 1rem; }
}
/* ---------- Phone composition ----------
   One focal point per card: on phones every app card is its name and the real app
   moving in its own colour; everything else waits on the app page. */
.toy-stage .clip-toggle { display: none; }
@container (max-width: 859px) and ((max-width: 599px) or (max-height: 759px)) {
  .card-app .app-top, .card-app .toy-stage { display: none; }
  .card-app .app-grid { gap: 6px; padding-bottom: 18px; }
  .card-app .tagline { margin-bottom: 8px; }
  .card-app .clip-slot {
    display: block; flex: 1 1 0; min-height: 0; position: relative;
    container-type: size;
    border-radius: 22px;
    background: color-mix(in oklab, var(--a) 16%, var(--card));
    border: 1.5px solid color-mix(in oklab, var(--a) 30%, var(--card));
    padding: 16px 0;
    overflow: hidden;
  }
  .card-app .clip--home .clip-screen { height: auto; width: min(92cqw, 100cqh * var(--r)); }
  .card-app .actions { margin-top: 8px; }
  .card-app .actions .key:not(.key--accent) { display: none; }
}
@media (prefers-color-scheme: dark) {
  .card-app .clip-slot { background: color-mix(in oklab, var(--a) 9%, var(--card)); border-color: color-mix(in oklab, var(--a) 22%, var(--card)); }
}

/* App page hero on narrow cards: headline, one paragraph, the toy, one button. */
.wide-only { display: none; }
@container (min-width: 860px), ((min-width: 600px) and (min-height: 760px)) {
  .wide-only { display: block; }
  .highlights.wide-only { display: grid; }
}
@container (max-width: 859px) {
  .hero-grid { gap: 12px; }
  .hero-text { display: contents; }
  .card-hero .meta { display: none; }
  .card-hero .toy-stage { order: 2; flex: 1 1 0; min-height: 132px; }
  .card-hero .actions { order: 3; }
  .card-hero .lead { font-size: 1rem; }
}

/* Steps: the card centres on the open step instead of hanging from the top. */
.card-steps .card-scroll { justify-content: center; }

/* Features on narrow cards: a quiet list, big names, one tap opens the detail. */
@container (max-width: 699px) {
  .card-features .card-scroll { justify-content: center; gap: 14px; }
  .feature-tiles { flex: none; display: flex; flex-direction: column; gap: 0; max-height: none; border-top: 1.5px solid var(--line); }
  .feature-tiles li { border-bottom: 1.5px solid var(--line); }
  .feature-tile {
    flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 56px; padding: 10px 4px; border: 0; border-radius: 10px; background: none; box-shadow: none;
    font-size: 1.1875rem; font-stretch: 88%; letter-spacing: -.01em;
  }
  .feature-tile:active { transform: none; box-shadow: none; background: var(--tint); }
  .feature-tile .icon { rotate: 45deg; flex: none; }
}

/* Facts: the numbers are the picture. */
@container (max-width: 699px) {
  .card-facts .card-scroll { justify-content: center; }
  .fact dd { font-size: clamp(3rem, 21cqw, 5.5rem); }
  .fact dt { font-size: 1.0625rem; }
}

/* The final card: one big invitation. */
.card-final .card-title { font-size: clamp(2.25rem, 11cqw, 3.5rem); }

/* Phones: the progress ticks say where you are; the running caption repeated the card title. */
@media (max-width: 699px) { .deck-caption { display: none; } .deck-progress { gap: 0; } }

/* Handover: while a card slides, its picture trails a little behind the card,
   so the eye rides along with the phone into the next card. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .card-app .clip--home .clip-screen,
    .card-clip .clip-screen,
    .card-showcase .still {
      animation: trail linear both;
      animation-timeline: --slide;
    }
    .card-app .app-name, .card-hero .hero-title, .card-statement .statement {
      animation: trail-text linear both;
      animation-timeline: --slide;
    }
    .card-intro .fan {
      animation: trail linear both;
      animation-timeline: --slide;
    }
    @keyframes trail {
      0% { transform: translateX(34%) rotate(7deg); }
      50% { transform: none; }
      100% { transform: translateX(-34%) rotate(-7deg); }
    }
    @keyframes trail-text {
      0% { transform: translateX(16%); }
      50% { transform: none; }
      100% { transform: translateX(-16%); }
    }
  }
}

/* ---------- Apps shelf on phones: every row shows the real app ---------- */
@media (max-width: 999px), (max-height: 599px) {
  .shelf { gap: 14px; }
  .cartridge {
    position: relative; overflow: hidden; isolation: isolate;
    grid-template-columns: minmax(0, 1fr) clamp(84px, 26vw, 140px); grid-template-rows: auto auto 1fr; gap: 6px 14px;
    min-height: 132px; padding: 16px 0 14px 16px;
  }
  .cartridge-id { grid-column: 1; grid-template-columns: auto minmax(0, 1fr); }
  .cartridge-id .icon, .cartridge-cat { display: none; }
  .cartridge-tagline { display: block; grid-column: 1; color: var(--muted); font-size: .9375rem; line-height: 1.35; padding-left: 0; text-wrap: pretty; }
  .cartridge .status { grid-column: 1; align-self: end; padding-left: 0; }
  .cartridge-cover {
    display: block; grid-column: 2; grid-row: 1 / 4; align-self: stretch;
    margin: -2px 0 -14px; position: relative;
    background: color-mix(in oklab, var(--a) 24%, var(--card));
  }
  .cartridge-cover img {
    position: absolute; left: 14px; top: 8px; width: calc(100% - 2px); height: auto;
    border-radius: 14px; border: 3px solid light-dark(#19191b, #000);
    transform: rotate(4deg); transform-origin: 0 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    @media (max-width: 999px), (max-height: 599px) {
      .shelf li { animation: shelf-in linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; animation-delay: 0s; }
      .cartridge-cover img { animation: cover-in linear both; animation-timeline: view(); animation-range: entry 10% cover 50%; }
      @keyframes shelf-in { from { opacity: 0; transform: translateY(28px) scale(.97); } }
      @keyframes cover-in { from { transform: translateY(26px) rotate(10deg); } to { transform: rotate(3deg); } }
    }
  }
}

/* The narrow clip card is its own size container (44px narrower than the card):
   keep its own direction in step with the breakpoint its children see. */
@container (max-width: 749px) { .clip--auto { flex-direction: column; justify-content: center; padding: 0; gap: 4px; } }
@media (min-width: 1000px) and (min-height: 600px) { .deck-caption { color: var(--ink); } }
@container (max-width: 699px) and (max-height: 520px) { .fact dd { font-size: clamp(2.5rem, 15cqw, 3.5rem); } .facts { gap: 10px; } .fact { padding-bottom: 10px; } }
.card-principles .card-scroll { justify-content: center; }
