/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #0e1116;
  --bg-elev: #161b22;
  --bg-elev-2: #1c2230;
  --border: #262d3a;
  --text: #e6edf3;
  --text-muted: #9aa7b6;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --android: #3ddc84;
  --ios: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(14, 17, 22, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 0.9rem;
}
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--text); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 64px 0 32px;
  background:
    radial-gradient(1200px 400px at 50% -100px, rgba(91, 140, 255, 0.18), transparent),
    radial-gradient(900px 300px at 80% 0, rgba(124, 91, 255, 0.14), transparent);
}
.hero-title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  margin: 0;
  max-width: 620px;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
}

/* ==========================================================================
   Toolbar / filters
   ========================================================================== */
.main { padding: 28px 20px 64px; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.filter:hover { color: var(--text); border-color: #384253; }
.filter.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.app-count { color: var(--text-muted); font-size: 0.9rem; }

/* ==========================================================================
   App grid + cards
   ========================================================================== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.app-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: #3a465c;
  box-shadow: var(--shadow);
}
.card-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(400px 200px at 50% 0, rgba(91, 140, 255, 0.12), transparent),
    var(--bg-elev-2);
  padding: 22px;
}
.card-logo,
.logo-img.card-logo {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.logo-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 2rem;
}
.card-logo.logo-placeholder { width: 88px; height: 88px; border-radius: 20px; }
.featured-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffd479;
  border: 1px solid rgba(255, 212, 121, 0.4);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { margin: 0; font-size: 1.15rem; }
.card-tagline { margin: 0; color: var(--text-muted); font-size: 0.9rem; flex: 1; }
.card-platforms { display: flex; gap: 6px; margin-top: 4px; }

/* Platform badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.badge-android { color: var(--android); border-color: rgba(61, 220, 132, 0.35); }
.badge-ios { color: var(--ios); border-color: rgba(255, 255, 255, 0.28); }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ==========================================================================
   Detail page
   ========================================================================== */
.back-link {
  display: inline-block;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.detail-header {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.detail-logo { flex-shrink: 0; }
.detail-logo-img,
.detail-logo .logo-placeholder {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: var(--shadow);
  font-size: 3rem;
}
.detail-heading { flex: 1; min-width: 0; }
.detail-category {
  display: inline-block;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.detail-title { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -0.02em; }
.detail-tagline { margin: 0 0 14px; color: var(--text-muted); font-size: 1.1rem; }
.detail-platforms { display: flex; gap: 8px; margin-bottom: 18px; }

/* Store buttons */
.store-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #000;
  border: 1px solid #333b49;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  min-width: 180px;
  transition: transform 0.15s, border-color 0.15s;
}
.store-btn:hover { transform: translateY(-2px); border-color: #4a5568; }
.store-icon { font-size: 1.6rem; line-height: 1; }
.store-apple .store-icon::before { content: ""; font-size: 1.7rem; }
.store-text { display: flex; flex-direction: column; line-height: 1.15; }
.store-text small { font-size: 0.68rem; color: #c7d0da; text-transform: uppercase; letter-spacing: 0.03em; }
.store-text strong { font-size: 1.12rem; font-weight: 600; }

/* "Upcoming" store button — targeted platform with no store link yet */
.store-btn.store-upcoming {
  font-family: inherit;
  cursor: pointer;
  background: #10141b;
  border-style: dashed;
  border-color: #3a465c;
  opacity: 0.8;
  text-align: left;
}
.store-btn.store-upcoming:hover { opacity: 1; transform: translateY(-2px); }
.store-btn.store-upcoming .store-text small { color: #ffd479; }

/* Transient toast message */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Sections */
.detail-section { margin-bottom: 40px; }
.section-title { font-size: 1.35rem; margin: 0 0 16px; }
.detail-description { color: var(--text-muted); font-size: 1.05rem; max-width: 780px; }

/* Video (responsive 16:9) */
.video-wrap {
  position: relative;
  width: 100%;
  max-width: 860px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Screenshots */
.screenshot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.screenshot {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  cursor: zoom-in;
  transition: transform 0.15s, border-color 0.15s;
}
.screenshot:hover { transform: scale(1.02); border-color: #3a465c; }

.detail-cta {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.not-found { text-align: center; padding: 60px 0; }
.not-found .btn {
  display: inline-block;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 22px;
  border-radius: 10px;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.9);
  display: grid;
  place-items: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 100%; max-height: 90vh; border-radius: 10px; }
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-links a { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
  .hero { padding: 40px 0 20px; }
  .detail-header { flex-direction: column; gap: 18px; align-items: flex-start; }
  .detail-logo-img,
  .detail-logo .logo-placeholder { width: 96px; height: 96px; border-radius: 22px; font-size: 2.4rem; }
  .store-btn { min-width: 0; flex: 1; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .card-logo, .card-logo.logo-placeholder { width: 68px; height: 68px; border-radius: 16px; }
  .site-nav { gap: 16px; }
}
