/* SPD Tools – app catalog styles */
:root {
  --bg: #0d0f12;
  --panel: #15181d;
  --panel-2: #1b1f25;
  --line: #262b33;
  --text: #e9ecf1;
  --muted: #8f98a6;
  --accent: #f5a623;
  --ready: #2ec27e;
  --beta: #f5a623;
  --dev: #8f98a6;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
img { display: block; max-width: 100%; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(13, 15, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px max(20px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; max-width: 1200px; margin: 0 auto; }
.brand-mark {
  background: var(--accent); color: var(--bg);
  font-weight: 800; font-size: 13px; letter-spacing: 0.04em;
  border-radius: 9px; padding: 8px 9px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 13px; }

/* ---------- Layout ---------- */
.view { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 48px; }
.loading, .empty { color: var(--muted); }
.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 24px; border-top: 1px solid var(--line); }

/* ---------- Catalog toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.search {
  flex: 1 1 240px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; font: inherit;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }

/* ---------- App cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: var(--app-color, var(--accent)); outline: none; }
.thumb { aspect-ratio: 16 / 9; background: var(--panel-2); overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.thumb-empty {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--app-color) 35%, transparent), transparent 60%), var(--panel-2);
}
.thumb-empty span { font-size: 56px; font-weight: 800; color: var(--app-color); letter-spacing: -0.02em; }
.card-body { padding: 16px 18px 18px; display: flex; gap: 14px; align-items: flex-start; }
.card-text { min-width: 0; }
.card h2 { font-size: 18px; margin: 0 0 2px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.icon {
  flex: none; width: 48px; height: 48px; border-radius: 12px;
  background: var(--app-color, var(--accent)); color: var(--bg);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; overflow: hidden;
}
.icon img { width: 100%; height: 100%; object-fit: cover; }
.icon.big { width: 84px; height: 84px; border-radius: 20px; font-size: 30px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.badge.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ready { color: var(--ready); }
.badge.beta { color: var(--beta); }
.badge.dev { color: var(--dev); }

/* ---------- Detail page ---------- */
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 20px; font-size: 15px; }
.back:hover { color: var(--text); }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start; margin-bottom: 32px; }
.hero-main { display: flex; gap: 20px; align-items: flex-start; }
.hero h1 { margin: 0 0 4px; font-size: 32px; line-height: 1.15; }
.hero .tagline { color: var(--muted); margin: 0 0 14px; font-size: 17px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: 15px;
  text-decoration: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--app-color, var(--accent)); border-color: transparent; color: var(--bg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.qr-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; width: 172px; }
.qr-box svg { width: 144px; height: 144px; display: block; margin: 0 auto 8px; border-radius: 6px; }
.qr-box small { color: var(--muted); font-size: 12px; line-height: 1.3; display: block; }

.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; font-weight: 700; }

.gallery { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 36px; scroll-snap-type: x mandatory; }
.shot { flex: 0 0 min(560px, 85%); scroll-snap-align: start; margin: 0; cursor: zoom-in; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.shot span { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.no-shots { color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 22px; margin-bottom: 36px; }

.columns { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; }
.prose p { margin: 0 0 14px; }
.features { list-style: none; padding: 0; margin: 0 0 24px; }
.features li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px solid var(--line); }
.features li::before { content: "✓"; position: absolute; left: 2px; color: var(--app-color, var(--accent)); font-weight: 700; }
.install { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--app-color, var(--accent)); border-radius: 10px; padding: 14px 16px; margin-bottom: 24px; }
.install p { margin: 0; }

.info { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; margin: 0; }
.info div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.info div:last-child { border-bottom: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; text-align: right; }
.links { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.links a { color: var(--text); text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.links a:hover { border-color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.92); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 90vh; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 8px; margin: 0 auto; }
.lightbox figcaption { color: var(--muted); text-align: center; margin-top: 10px; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, 0.08); color: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 28px; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, 0.18); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .qr-box { display: none; } /* on a phone you are already on the device */
  .columns { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .icon.big { width: 64px; height: 64px; font-size: 24px; border-radius: 16px; }
}
