/* SdmApk public styles. Light by default, dark via system setting or the theme button. */
:root {
  --bg: #f5f7fd;
  --surface: #ffffff;
  --surface-2: #eef1fb;
  --ink: #0c1330;
  --muted: #55607f;
  --line: #e0e5f2;
  --brand: #3b4dff;
  --brand-hover: #2a3bea;
  --brand-ink: #ffffff;
  --brand-soft: #e8ebff;
  --brand-text: #2536d6;
  --danger: #b3263e;
  --shadow: 0 1px 2px rgba(12, 19, 48, 0.06), 0 8px 24px -12px rgba(12, 19, 48, 0.18);
  --grid-dot: rgba(59, 77, 255, 0.1);
  --radius: 20px;
  --radius-sm: 12px;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f22;
    --surface: #121933;
    --surface-2: #19224a;
    --ink: #eef1ff;
    --muted: #9aa5c8;
    --line: #232c52;
    --brand: #4f62ff;
    --brand-hover: #6475ff;
    --brand-soft: #1b2459;
    --brand-text: #a9b4ff;
    --danger: #ff8fa3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    --grid-dot: rgba(120, 140, 255, 0.12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f22;
  --surface: #121933;
  --surface-2: #19224a;
  --ink: #eef1ff;
  --muted: #9aa5c8;
  --line: #232c52;
  --brand: #4f62ff;
  --brand-hover: #6475ff;
  --brand-soft: #1b2459;
  --brand-text: #a9b4ff;
  --danger: #ff8fa3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  --grid-dot: rgba(120, 140, 255, 0.12);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-text); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--brand); color: var(--brand-ink); padding: 10px 14px; border-radius: 10px; z-index: 100; text-decoration: none; }
.skip:focus { top: 12px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 800 1.35rem/1 var(--font-display); letter-spacing: -0.03em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav-links { display: flex; gap: 4px; margin-inline: auto 8px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--brand-text); background: var(--brand-soft); }
.tools { display: flex; gap: 6px; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; cursor: pointer; text-decoration: none; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand-text); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn { display: none; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  .tools { margin-left: auto; }
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; margin: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font: 700 0.95rem/1 var(--font-body); text-decoration: none; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, transform 0.15s; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-text); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.02rem; }

/* Hero: an app-icon grid fades in behind the search */
.hero { position: relative; padding: 64px 0 40px; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Crect x='8' y='8' width='56' height='56' rx='16' fill='none' stroke='%233b4dff' stroke-opacity='.2' stroke-width='2'/%3E%3C/svg%3E"); -webkit-mask-image: linear-gradient(100deg, transparent 38%, #000 100%), linear-gradient(180deg, #000 0, transparent 92%); mask-image: linear-gradient(100deg, transparent 38%, #000 100%), linear-gradient(180deg, #000 0, transparent 92%); -webkit-mask-composite: source-in; mask-composite: intersect; pointer-events: none; }
@media (max-width: 760px) { .hero::before { opacity: 0.35; -webkit-mask-image: linear-gradient(180deg, #000 0, transparent 70%); mask-image: linear-gradient(180deg, #000 0, transparent 70%); } }
.hero .wrap { position: relative; }
.hero-brand { font: 700 1.05rem/1 var(--font-display); color: var(--brand-text); margin-bottom: 10px; }
.hero-tag { color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.75rem); font-weight: 800; max-width: 13ch; }
.hero-copy { max-width: 56ch; margin-top: 18px; color: var(--muted); font-size: 1.1rem; }
.search-form { display: flex; gap: 8px; margin-top: 30px; max-width: 640px; padding: 8px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.search-form:focus-within { border-color: var(--brand); }
.search-form input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 500 1.05rem var(--font-body); padding: 0 16px; outline: none; }
.search-form input::placeholder { color: var(--muted); }
.search-form .btn { min-height: 48px; }
.hero-count { margin-top: 14px; color: var(--muted); font-size: 0.95rem; min-height: 1.5em; }
@media (prefers-reduced-motion: no-preference) {
  .hero .wrap > * { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero .wrap > *:nth-child(2) { animation-delay: 0.05s; }
  .hero .wrap > *:nth-child(3) { animation-delay: 0.1s; }
  .hero .wrap > *:nth-child(4) { animation-delay: 0.15s; }
  .hero .wrap > *:nth-child(5) { animation-delay: 0.2s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Sections */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 750; }
.section-head p { color: var(--muted); margin-top: 6px; }

/* Categories */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.cat { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.cat:hover { border-color: var(--brand); }
.cat[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.cat-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; flex: none; }
.cat-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat b { display: block; font-weight: 700; }
.cat small { color: var(--muted); }

/* App cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s; }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.card-top { display: flex; gap: 14px; align-items: center; }
.card h3 { font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--brand-text); }
.card-desc { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 4.8em; font-size: 0.97rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); font-size: 0.8rem; font-weight: 700; }
.chip-plain { background: var(--surface-2); color: var(--muted); }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; }
.icon-tile, .app-icon { width: 60px; height: 60px; border-radius: 16px; flex: none; object-fit: cover; background: var(--surface-2); }
.icon-tile { display: grid; place-items: center; font: 800 1.6rem/1 var(--font-display); color: #fff; background: #3b4dff; }
.icon-tile[data-tint="1"] { background: #0f8b6d; }
.icon-tile[data-tint="2"] { background: #c2410c; }
.icon-tile[data-tint="3"] { background: #8a2be2; }
.icon-tile[data-tint="4"] { background: #0e7490; }
.icon-tile[data-tint="5"] { background: #be185d; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field input, .field select { min-height: 46px; padding: 0 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); font: 500 1rem var(--font-body); }
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.toolbar .grow { flex: 1 1 240px; }
.status-line { color: var(--muted); margin-bottom: 14px; min-height: 1.6em; }

/* States */
.state { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.state h3 { font-size: 1.3rem; margin-bottom: 8px; }
.state p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }
.skeleton { height: 232px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; border: 1px solid var(--line); }
@media (prefers-reduced-motion: no-preference) { .skeleton { animation: shimmer 1.2s linear infinite; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* App details */
.crumbs { padding-top: 26px; font-size: 0.95rem; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; padding: 22px 0 48px; align-items: start; }
.detail-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.detail-head .icon-tile, .detail-head .app-icon { width: 96px; height: 96px; border-radius: 24px; font-size: 2.6rem; }
.detail h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); font-weight: 800; overflow-wrap: anywhere; }
.prose { white-space: pre-line; overflow-wrap: anywhere; max-width: 68ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.2rem; margin-bottom: 14px; }
.panel dl { margin: 0 0 18px; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.panel .btn { width: 100%; }
.note { margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.shots { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 12px; margin-top: 8px; scroll-snap-type: x proximity; }
.shots img { height: 340px; width: auto; max-width: none; border-radius: 16px; border: 1px solid var(--line); scroll-snap-align: start; background: var(--surface-2); }
.block + .block { margin-top: 30px; }
.block h2 { font-size: 1.35rem; margin-bottom: 10px; }
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .detail-head .icon-tile, .detail-head .app-icon { width: 72px; height: 72px; font-size: 2rem; border-radius: 18px; }
  .shots img { height: 280px; }
}

/* Text pages */
.page { padding: 48px 0 64px; }
.page h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; margin-bottom: 8px; }
.page .lede { color: var(--muted); margin-bottom: 30px; font-size: 1.08rem; max-width: 62ch; }
.page h2 { font-size: 1.4rem; margin: 30px 0 8px; }
.page p, .page li { max-width: 68ch; }
.page p + p { margin-top: 12px; }
.page ul { padding-left: 1.2rem; }

/* Footer */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); padding: 34px 0 40px; }
.foot { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; }
.foot p { color: var(--muted); margin-top: 8px; max-width: 34ch; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: start; }
.foot nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 4px 0; }
.foot nav a:hover { color: var(--brand-text); text-decoration: underline; }
.copy { width: 100%; color: var(--muted); font-size: 0.92rem; padding-top: 18px; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

.grid > .state { grid-column: 1 / -1; }

[hidden] { display: none !important; }
.foot .copy { max-width: none; margin-top: 0; }
