/* Marketplace template – base styles.
   Brand colours come from theme.css (--primary, --accent, --on-primary, --on-accent),
   generated from site.config.json. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f7f8;
  --surface: #ffffff;
  --text: #14181b;
  --muted: #5b646b;
  --border: #e2e6e9;
  --link: var(--primary);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .06);
  --radius: 14px;
  --radius-sm: 10px;
  --container: 1160px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1214;
    --bg-alt: #151a1d;
    --surface: #182024;
    --text: #e8ecee;
    --muted: #9aa5ab;
    --border: #283237;
    --link: color-mix(in srgb, var(--primary) 40%, #ffffff);
    --primary-soft: color-mix(in srgb, var(--primary) 30%, transparent);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--bg); overflow-x: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw + 1rem, 3rem); }
h2 { font-size: clamp(1.35rem, 1.5vw + 1rem, 1.85rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }
.narrow { max-width: 820px; }
.center { text-align: center; }
.center .icon-xl { margin: 0 auto 1rem; }
.small { font-size: .875rem; color: var(--muted); }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--link); margin-bottom: .5rem; }
.visually-hidden { 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-link { position: absolute; left: 16px; top: -100px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: .5rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* Icons */
.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; }
.icon-lg { width: 2rem; height: 2rem; color: var(--link); }
.icon-xl { width: 3.5rem; height: 3.5rem; color: var(--link); }
.star { color: var(--accent); fill: var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.2rem; border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; transition: transform .1s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand img { border-radius: 9px; }
.nav-toggle { display: inline-flex; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: .45rem; cursor: pointer; }
.nav-toggle .icon { width: 1.4rem; height: 1.4rem; }
.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--border); padding: .5rem 16px 1rem; box-shadow: var(--shadow); }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
.site-nav li a { display: block; padding: .65rem .25rem; color: var(--text); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--border); }
.site-nav a[aria-current="page"] { color: var(--link); font-weight: 700; }
@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; position: static; align-items: center; gap: 1.25rem; padding: 0; background: none; border: 0; box-shadow: none; }
  .site-nav ul { display: flex; gap: .25rem; margin: 0; }
  .site-nav li a { border: 0; padding: .4rem .7rem; border-radius: 999px; }
  .site-nav li a:hover { background: var(--bg-alt); }
  .site-nav a[aria-current="page"] { background: var(--primary-soft); }
}

/* Sections */
.section { padding: clamp(2.5rem, 5vw, 4.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.page-head { padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.5rem, 3vw, 2rem); background: linear-gradient(180deg, var(--primary-soft), transparent); border-bottom: 1px solid var(--border); }
.page-head h1 { margin-bottom: .35em; }
.page-head .lead { margin: 0; }

/* Hero */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 2.5rem; background: radial-gradient(1200px 500px at 85% -10%, var(--accent-soft), transparent), linear-gradient(180deg, var(--primary-soft), transparent 70%); }
.hero-inner { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.2fr .8fr; } }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0; }
.center-actions { justify-content: center; }
.hero-search { position: relative; max-width: 520px; }
.hero-search .icon, .search-field .icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.hero-search input, .search-field input { width: 100%; padding: .85rem 1rem .85rem 2.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow); }
.hero-art { display: none; justify-content: center; }
@media (min-width: 900px) { .hero-art { display: flex; } }
.phone { width: 280px; padding: 14px; border-radius: 40px; background: #0b0f11; box-shadow: 0 30px 60px rgb(0 0 0 / .25); }
.phone-screen { border-radius: 28px; background: var(--surface); padding: 1.5rem 1rem; display: grid; gap: .75rem; min-height: 460px; align-content: start; }
.phone-row { display: flex; align-items: center; gap: .75rem; padding: .6rem; border-radius: 14px; background: var(--bg-alt); }
.phone-row img { border-radius: 11px; }
.phone-row span { display: grid; line-height: 1.3; }
.phone-row b { font-size: .95rem; }
.phone-row i { font-style: normal; font-size: .8rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stats strong { display: block; font-size: 1.6rem; color: var(--link); }
.stats span { color: var(--muted); font-size: .95rem; }

/* App cards */
.app-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.app-card a { display: flex; gap: 1rem; align-items: center; padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; height: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-card a:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow); transform: translateY(-2px); }
.app-card img { border-radius: 16px; flex: none; }
.app-card-body { display: grid; gap: .15rem; min-width: 0; }
.app-card-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card-dev { font-size: .875rem; color: var(--muted); }
.app-card-meta { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .85rem; color: var(--muted); align-items: center; }
.rating { display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; color: var(--text); }
.price { font-weight: 700; color: var(--link); }

/* Categories */
.cat-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.cat-tile { display: flex; gap: .85rem; align-items: center; padding: .9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; height: 100%; }
.cat-tile:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.cat-tile span:last-child { display: grid; }
.cat-tile small { color: var(--muted); }
.cat-emoji { font-size: 1.6rem; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); flex: none; }

/* Features */
.feature-grid { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.feature { padding: 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature .icon-lg { margin-bottom: .75rem; }
.feature p { color: var(--muted); margin: 0; }

/* FAQ */
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: .75rem; }
.faq summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--link); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 1.25rem 1rem; margin: 0; color: var(--muted); }

/* CTA */
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 2rem; border-radius: calc(var(--radius) * 1.5); background: var(--primary); color: var(--on-primary); }
.cta h2 { margin-bottom: .25rem; }
.cta p { margin: 0; opacity: .9; }
.cta .btn-primary { background: var(--accent); color: var(--on-accent); }

/* Filters */
.filters { display: grid; gap: .75rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 640px) { .filters { grid-template-columns: 1fr 240px; } }
.search-field { position: relative; }
.filters select, .field input, .field select, .field textarea { width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.filters select { border-radius: 999px; }
.result-count { color: var(--muted); font-size: .9rem; min-height: 1.5em; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

/* App detail */
.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: 1.5rem; }
.app-hero { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.app-hero img { border-radius: 26px; box-shadow: var(--shadow); width: 96px; height: 96px; }
@media (min-width: 640px) { .app-hero img { width: 120px; height: 120px; } }
.app-hero > div { flex: 1 1 280px; min-width: 0; }
.app-hero h1 { margin-bottom: .2em; }
.app-dev { color: var(--link); font-weight: 600; margin: 0 0 .4rem; }
.app-meta { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .95rem; margin: 0; }
.screenshots { display: flex; gap: 1rem; overflow-x: auto; padding: .5rem 0 1rem; margin: 1rem 0 2rem; scroll-snap-type: x mandatory; }
.screenshots img { width: 180px; height: auto; flex: none; border-radius: 16px; border: 1px solid var(--border); scroll-snap-align: start; }
.app-layout { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .app-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 1.2rem; }
.card h3 { font-size: 1rem; margin-top: 1.25rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.prose .facts dd { text-align: left; }
.check-list { list-style: none; padding: 0; }
.check-list li { display: flex; gap: .6rem; align-items: center; padding: .4rem 0; }
.check-list .icon { color: var(--link); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li a { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.steps li { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step-num { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; margin-bottom: .75rem; }
.steps p { color: var(--muted); margin: 0; }

/* Forms */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters select:focus, .search-field input:focus, .hero-search input:focus { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
.form .btn { justify-self: start; }
.checksum { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* Prose & legal */
.prose { max-width: 75ch; min-width: 0; overflow-wrap: break-word; }
.prose h2 { margin-top: 2rem; scroll-margin-top: 90px; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .4rem; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0 1.5rem; }
.legal-dates { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; color: var(--muted); margin: 0; font-size: .95rem; }
.toc { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.toc h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.25rem; columns: 2 240px; }
.toc li { margin-bottom: .3rem; break-inside: avoid; }
.legal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.legal-list a { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.legal-list a:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.legal-list .icon { color: var(--link); margin-top: .2rem; }
.legal-list span { display: grid; }
.legal-list small { color: var(--muted); }
.table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--bg-alt); }

/* Footer */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; margin-top: 2rem; font-size: .95rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1.3fr; } }
.footer-brand p { color: var(--muted); max-width: 40ch; }
.footer-brand .brand { margin-bottom: .75rem; }
.site-footer h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer li a, .site-footer .link-btn { color: var(--text); text-decoration: none; }
.site-footer li a:hover, .site-footer .link-btn:hover { color: var(--link); text-decoration: underline; }
.social { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 2rem; padding-top: 1.25rem; color: var(--muted); font-size: .85rem; }
.footer-bottom p { margin: 0 0 .35rem; }

/* Cookie banner */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 30px rgb(0 0 0 / .12); padding: 1rem 0; }
.cookie-banner[hidden] { display: none; }
.cookie-inner { display: grid; gap: .75rem; }
.cookie-inner p { margin: 0; font-size: .95rem; }
.cookie-prefs { display: flex; flex-wrap: wrap; gap: 1rem; }
.cookie-prefs[hidden] { display: none; }
.cookie-prefs label { display: inline-flex; gap: .4rem; align-items: center; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.cookie-actions [hidden] { display: none; }
@media (min-width: 900px) { .cookie-inner { grid-template-columns: 1fr auto; align-items: center; } .cookie-prefs { grid-column: 1 / -1; } }

@media print {
  .site-header, .site-footer, .cookie-banner, .toc { display: none; }
  body { color: #000; background: #fff; }
}
