/* App Landing Template — original design, configurable via config.json */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --border: #e1e3e8;
  --text: #1f2328;
  --text-soft: #5a6270;
  --text-muted: #8a93a3;
  --accent: #0f766e;          /* configurable via JS */
  --accent-hover: #115e59;
  --on-accent: #ffffff;
  --amber: #f59e0b;
  --danger: #b42318;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
  --max: 1180px;
  --gap: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
img { max-width: 100%; display: block; }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: 17px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 6px;
  background: var(--on-accent);
  clip-path: polygon(35% 20%, 85% 50%, 35% 80%);
}
.topnav { display: flex; gap: 18px; margin-left: 12px; flex: 1; }
.topnav a { color: var(--text-soft); font-size: 14px; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.icon-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--text-soft); padding: 8px; border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }

/* ── Page layout ───────────────────────────────────────── */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 48px;
  align-items: start;
  margin-bottom: 40px;
}
.app-name {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.publisher {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.iap {
  margin: 4px 0 18px;
  color: var(--text-muted);
  font-size: 13px;
}
.stat-row {
  display: flex; gap: 28px;
  padding: 18px 0;
  margin: 4px 0 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat { min-width: 80px; }
.stat-value {
  font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 4px;
}
.star { color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.rating-badge {
  display: inline-flex; padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 6px; font-size: 12px;
}

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-primary {
  background: var(--accent); color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); }

.hero-icon {
  justify-self: end;
  width: 220px; height: 220px;
  border-radius: 28px;
  background: var(--surface);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-icon img { width: 100%; height: 100%; object-fit: cover; }

/* ── Screenshots ───────────────────────────────────────── */
.screens {
  margin-bottom: 48px;
}
.screens-track {
  display: flex; gap: 14px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.screens-track::-webkit-scrollbar { height: 8px; }
.screens-track::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }
.shot {
  flex: 0 0 auto;
  width: 188px; height: 334px;
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }

/* ── Grid: about + sidebar ─────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
}
.section-title {
  font-size: 20px; font-weight: 600;
  margin: 12px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.about-text {
  white-space: pre-wrap;
  color: var(--text);
  margin: 0 0 22px;
}
.meta-list {
  list-style: none; padding: 0; margin: 0 0 36px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px;
}
.meta-list li { display: flex; flex-direction: column; }
.meta-key { color: var(--text-muted); font-size: 12px; }

/* Ratings */
.ratings {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px;
  margin-bottom: 28px; align-items: center;
}
.ratings-score { text-align: center; }
.big-score { font-size: 48px; font-weight: 600; line-height: 1; }
.big-stars { color: var(--amber); margin: 6px 0; font-size: 16px; letter-spacing: 1px; }
.big-count { color: var(--text-muted); font-size: 12px; }
.ratings-bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: center; font-size: 12px; color: var(--text-muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.reviews { display: grid; gap: 14px; margin-bottom: 28px; }
.review {
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.review-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-soft);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.review-name { font-weight: 600; font-size: 13px; }
.review-stars { color: var(--amber); font-size: 11px; letter-spacing: 1px; }
.review-text { font-size: 14px; color: var(--text); margin: 0; }

/* ── Sidebar cards ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 8px;
  margin-bottom: 18px;
}
.card-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.contact-list, .similar-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.contact-list li:first-child { border-top: 0; }
.contact-list .ico {
  width: 22px; height: 22px; color: var(--text-soft); flex: 0 0 22px;
}

.similar-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.similar-list li:first-child { border-top: 0; }
.similar-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2);
  overflow: hidden; flex: 0 0 44px;
}
.similar-meta { display: flex; flex-direction: column; min-width: 0; }
.similar-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.similar-dev { font-size: 12px; color: var(--text-muted); }
.similar-rating { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px;
  display: grid;
  gap: 16px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.footer-nav a { color: var(--text-soft); font-size: 13px; }
.footer-copy { color: var(--text-muted); font-size: 12px; margin: 0; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-icon { width: 140px; height: 140px; justify-self: start; border-radius: 22px; }
  .grid { grid-template-columns: 1fr; gap: 32px; }
  .ratings { grid-template-columns: 1fr; }
  .meta-list { grid-template-columns: 1fr; }
  .topnav { display: none; }
}
@media (max-width: 520px) {
  .stat-row { gap: 18px; }
  .shot { width: 154px; height: 274px; }
}

/* Hidden when not relevant */
[hidden] { display: none !important; }
