/* Joyboy Origin store-style download pages (/android, /ios) - shared base, mobile-first.
   Skin tokens (font, store accent, surfaces, radii) come from store-play.css / store-appstore.css.
   BRAND accents below are hex literals equal to role values in tools/theme-pipeline/themes/<id>/theme.json
   "colors": this file is listed in the manifest "cssFiles", so the pipeline remaps them on a theme switch.
   Keep every other colour out of this file (store colours must never equal a theme role). */
:root {
  --brand-ink: #061426;      /* role ink-900 */
  --brand-ink-2: #12294a;    /* role ink-700-home */
  --brand-ember: #f07a1e;    /* role ember */
  --brand-gold: #ffd166;     /* role gold */
  --brand-red: #2068b8;      /* role accent-red (AA on white) */
  --brand-cream: #fff6e4;    /* role cream */
  --page-max: 1120px;
  --pad: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--brand-red); text-underline-offset: 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; padding: 10px 14px; background: var(--surface); color: var(--text); border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- brand top bar ("Joyboy Origin · Official Download") ---------- */
.topbar { background: var(--brand-ink); color: var(--brand-cream); border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--brand-red), var(--brand-ember), var(--brand-gold)) 1; }
.topbar__inner { display: flex; align-items: center; gap: 12px; max-width: var(--page-max); margin: 0 auto; padding: 8px var(--pad); min-height: 56px; }
.topbar__brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none; }
.topbar__brand img { width: 32px; height: 32px; border-radius: 8px; }
.topbar__name { font-weight: 700; letter-spacing: .01em; }
.topbar__tag { color: var(--brand-gold); font-size: 13px; }
.topbar__alt { margin-left: auto; color: var(--brand-cream); font-size: 13px; padding: 12px 0 12px 8px; }

/* ---------- page grid: hero full width; main + side columns on desktop ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: 20px var(--pad) calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
.page__main, .page__side { display: grid; gap: 28px; align-content: start; }
/* grid children must not grow to the carousel's max-content width */
.page__main, .page__side, .section, .card { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.section { display: grid; gap: 12px; }
.section__title { font-size: 20px; line-height: 1.3; font-weight: var(--heading-weight, 600); }
.section p + p { margin-top: 10px; }
.muted { color: var(--muted); }

/* ---------- app header ---------- */
.app-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 18px; align-items: center; }
.app-hero__icon { width: 84px; height: 84px; border-radius: var(--radius-icon); box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 4px 14px rgba(0, 0, 0, .12); }
.app-hero__title { font-size: 26px; line-height: 1.15; font-weight: var(--title-weight, 600); letter-spacing: -.01em; }
.app-hero__tagline { margin-top: 4px; color: var(--accent-text, var(--accent)); font-weight: 500; }
.app-hero__cta { grid-column: 1 / -1; display: grid; gap: 8px; }
.app-hero__note { color: var(--muted); font-size: 13px; }

/* ---------- download buttons (class btn-download = tracking contract, do not rename) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 24px; border: 0; border-radius: var(--radius-btn); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: filter .15s ease, transform .15s ease; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn.is-coming-soon { background: var(--surface-2); color: var(--muted); cursor: not-allowed; filter: none; transform: none; }

/* ---------- info stats strip (only verified facts) ---------- */
.stats { grid-column: 1 / -1; display: flex; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 4px var(--pad); }
.stats::-webkit-scrollbar { display: none; }
.stats li { flex: 1 0 auto; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 14px; text-align: center; scroll-snap-align: start; }
.stats li + li { border-left: 1px solid var(--line); }
.stats__value { font-weight: 600; font-size: 15px; color: var(--text); }
.stats__label { font-size: 12px; color: var(--muted); }

/* ---------- screenshots (landscape 16:9): native scroll-snap, buttons added by store-page.js on >=768px ----------
   Phone: one big shot + a ~20px peek of the next (scroll hint). >=768px: fixed 440px = ~1.5-1.6 shots per view. */
.carousel { position: relative; --shot-w: min(88vw, 440px); }
.carousel__viewport { overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: thin; margin: 0 calc(var(--pad) * -1); padding: 4px var(--pad) 10px; scroll-padding: 0 var(--pad); border-radius: 4px; }
.carousel__track { display: flex; gap: 10px; width: max-content; }
.carousel__track li { scroll-snap-align: start; }
.carousel__track img { width: var(--shot-w); height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-shot); background: var(--surface-2); border: 1px solid var(--line); }
.carousel__btn { display: none; }

/* ---------- features ---------- */
.features { display: grid; gap: 14px; }
.feature { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; }
.feature__icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-ink-2), var(--brand-ink)); display: grid; place-items: center; }
.feature__icon::before { content: ""; width: 24px; height: 24px; background: linear-gradient(160deg, var(--brand-gold), var(--brand-ember)); -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.feature h3 { font-size: 15px; font-weight: 600; line-height: 1.35; }
.feature p { color: var(--muted); font-size: 14px; }
.i-crown { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 7.5l4.6 3.8L12 4l4.4 7.3L21 7.5 19.3 18H4.7zM5 19.5h14V21H5z'/%3E%3C/svg%3E"); }
.i-calendar { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7 2h2v2h6V2h2v2h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2zM5 9v11h14V9zm2 3h4v4H7z'/%3E%3C/svg%3E"); }
.i-spark { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2l2.3 6.2L18.5 10.5l-6.2 2.3L10 19l-2.3-6.2L1.5 10.5l6.2-2.3zM18.5 14l1.1 2.9 2.9 1.1-2.9 1.1-1.1 2.9-1.1-2.9-2.9-1.1 2.9-1.1z'/%3E%3C/svg%3E"); }
.i-shield { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l8 3v6c0 5.2-3.4 9.5-8 11-4.6-1.5-8-5.8-8-11V5zm-1 5v4H7v2h4v4h2v-4h4v-2h-4V7z'/%3E%3C/svg%3E"); }
.i-chart { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 20h4v-7H3zm7 0h4V9h-4zm7 0h4V4h-4z'/%3E%3C/svg%3E"); }
.i-chat { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4V5a2 2 0 0 1 2-2zm3 6v2h2V9zm4 0v2h2V9zm4 0v2h2V9z'/%3E%3C/svg%3E"); }

/* ---------- side cards: install steps, data note, cross-link ---------- */
.card { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.steps { counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.steps li::before { content: counter(step); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-ink); color: var(--brand-gold); font-weight: 700; font-size: 14px; }
.steps strong { display: block; font-weight: 600; }
.steps p { color: var(--muted); font-size: 14px; }
.steps .btn { margin-top: 8px; }
.link-cta { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.facts { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.facts li { padding-left: 18px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-ember); }
.crosslink { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-weight: 600; text-decoration: none; }
.crosslink::after { content: "\2192"; font-size: 18px; }


/* ---------- tablet / desktop ---------- */
@media (min-width: 768px) {
  :root { --pad: 28px; }
  .page { padding-top: 32px; gap: 36px; }
  .app-hero { grid-template-columns: auto minmax(0, 1fr); gap: 20px 28px; }
  .app-hero__icon { width: 128px; height: 128px; grid-row: 1 / span 3; align-self: start; }
  .app-hero__title { font-size: 36px; }
  .app-hero__cta { grid-column: 2; grid-template-columns: auto; justify-items: start; }
  .app-hero__cta .btn { min-width: 220px; }
  .stats { grid-column: 2; margin: 0; padding: 4px 0; }
  .stats li:first-child { padding-left: 0; }
  .carousel { --shot-w: 440px; }
  .carousel__viewport { margin: 0; padding: 4px 0 10px; scroll-padding: 0; }
  .carousel__btn:not([hidden]) { display: grid; place-items: center; position: absolute; top: calc(50% - 26px); z-index: 2; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
  .carousel__btn--prev { left: -12px; }
  .carousel__btn--next { right: -12px; }
  .carousel__btn:disabled { opacity: 0; pointer-events: none; }
  .features { grid-template-columns: 1fr 1fr; gap: 18px 24px; }
}
@media (min-width: 1024px) {
  .page { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 48px; align-items: start; }
  .app-hero { grid-column: 1 / -1; }
  .page__main { gap: 36px; }
  .page__side { gap: 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  .carousel__viewport { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
/* every download button is "Coming soon" (store-page.js) -> hide install steps that no longer apply */
.is-download-unavailable [data-hide-when-unavailable] { display: none; }
.whatsnew__meta { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
