/* ============================================================
   incus-scripts — site.css
   Professional dark theme, real logo, modern typography.
   Hand-tuned, no framework. Mobile-first.
   ============================================================ */

:root {
  /* Palette */
  --bg:           #0b0f17;
  --bg-2:         #0f1420;
  --bg-3:         #161c2c;
  --surface:      #1a2236;
  --surface-2:    #232c45;
  --border:       #2a3550;
  --border-soft:  #1f2638;

  --text:         #e8ecf4;
  --text-2:       #a3acc2;
  --text-3:       #6b7591;

  --primary:      #5b8def;   /* logo blue */
  --primary-2:    #7ba3ff;
  --accent:       #5ec27a;   /* logo green */
  --accent-2:     #7cd896;
  --warn:         #f0b545;
  --error:        #ef5b6e;

  --code-bg:      #0a0e16;
  --code-border:  #1a2030;
  --code-text:    #d6dbe8;

  --radius:       10px;
  --radius-lg:    14px;
  --radius-sm:    6px;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.3);
  --shadow:       0 4px 20px rgba(0,0,0,.4);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.5);

  --font-sans:    -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-2); text-decoration: none; }

code, pre {
  font-family: var(--font-mono);
  font-size: 13px;
}

code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  position: relative;
}

pre code { background: transparent; padding: 0; color: var(--code-text); }

/* Container helper */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 23, 0.85);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.navbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.navbar-brand img,
.navbar-brand svg {
  height: 32px;
  width: auto;
}

.navbar-brand .brand-text { display: flex; align-items: baseline; gap: 6px; }
.navbar-brand .brand-text .accent { color: var(--text-2); font-weight: 400; }

.navbar-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.navbar-nav a {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}

.navbar-nav a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-search {
  position: relative;
  width: 280px;
}

.navbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color .15s, background .15s;
}

.navbar-search input:focus {
  border-color: var(--primary);
  background: var(--bg-3);
}

.navbar-search input::placeholder { color: var(--text-3); }

.navbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-3);
  pointer-events: none;
}

.navbar-search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.provider-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
}
.provider-select:hover { color: var(--text); border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn:hover { background: var(--primary-2); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--primary); color: var(--text); }

/* ============================================================
   HERO
   ============================================================ */

.hero {
  position: relative;
  padding: 80px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(91, 141, 239, 0.12), transparent),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(94, 194, 122, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
}

.hero-logo {
  width: 280px;
  height: auto;
  margin: 0 auto 32px;
  display: block;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text);
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 19px;
  color: var(--text-2);
  max-width: 620px;
  margin: 0 auto 36px;
  line-height: 1.5;
}

.hero-install {
  max-width: 620px;
  margin: 0 auto 32px;
  text-align: left;
}

.hero-install-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
  text-align: center;
}

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--code-border);
  font-size: 12px;
  color: var(--text-2);
}

.code-block-header .dots {
  display: flex;
  gap: 6px;
}
.code-block-header .dots span {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.code-block-header .dots span:nth-child(1) { background: #ef5b6e; }
.code-block-header .dots span:nth-child(2) { background: #f0b545; }
.code-block-header .dots span:nth-child(3) { background: #5ec27a; }

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all .15s;
}
.copy-btn:hover { background: var(--surface); color: var(--text); }
.copy-btn.copied { background: var(--accent); color: #0b0f17; border-color: var(--accent); }

.code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 16px 18px;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--code-text);
}

.code-block pre .comment { color: var(--text-3); }
.code-block pre .prompt  { color: var(--accent); user-select: none; }
.code-block pre .url     { color: var(--primary-2); }

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-top: 36px;
  flex-wrap: wrap;
}

.hero-stat { text-align: center; }
.hero-stat .num {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  display: block;
  font-variant-numeric: tabular-nums;
}
.hero-stat .num .gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stat .label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* ============================================================
   FEATURE STRIP (3-up)
   ============================================================ */

.features {
  padding: 40px 0 20px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 0 24px;
}

.feature {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s, transform .2s;
}
.feature:hover { border-color: var(--border); transform: translateY(-2px); }

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.15), rgba(94, 194, 122, 0.15));
  color: var(--primary-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 18px;
}
.feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.feature p {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */

.section {
  padding: 32px 0 60px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 24px;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

.section-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.section-head .count {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   FILTERS
   ============================================================ */

.filters-wrap {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(11, 15, 23, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 28px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: center;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-right: 6px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.filter-btn:hover {
  color: var(--text);
  border-color: var(--primary);
  background: var(--bg-2);
}
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.filter-btn .filter-count {
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 100px;
  font-weight: 600;
}
.filter-btn.active .filter-count {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* ============================================================
   APP GRID
   ============================================================ */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.app-card {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: all .15s;
  position: relative;
  overflow: hidden;
  min-height: 130px;
}
.app-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.04), transparent 60%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.app-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.app-card:hover::before { opacity: 1; }

.app-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.app-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.app-card-icon .fallback {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-2);
  text-transform: uppercase;
}

.app-card-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.app-card-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.app-card-meta .cat {
  color: var(--text-2);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.app-card-meta .installs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* Empty state */
.app-grid-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  max-width: 400px;
  margin: 0 auto;
}
.app-grid-empty h3 {
  color: var(--text-2);
  font-size: 16px;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ============================================================
   PER-APP PAGE
   ============================================================ */

.app-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.app-page-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.app-page-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.app-page-icon img { width: 100%; height: 100%; object-fit: contain; }
.app-page-icon .fallback { font-size: 32px; font-weight: 700; color: var(--primary-2); }

.app-page-title { flex: 1; min-width: 0; }
.app-page-title h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: 4px;
  line-height: 1.2;
}
.app-page-title .subtitle {
  color: var(--text-2);
  font-size: 14px;
}
.app-page-title .badge-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-primary { background: rgba(91, 141, 239, 0.12); color: var(--primary-2); border-color: rgba(91, 141, 239, 0.25); }
.badge-accent  { background: rgba(94, 194, 122, 0.12); color: var(--accent-2); border-color: rgba(94, 194, 122, 0.25); }

.app-section {
  margin-bottom: 28px;
}

.app-section h2 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.app-section p {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.spec {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.spec .spec-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  margin-bottom: 4px;
}
.spec .spec-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}
.spec .spec-value small {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  margin-left: 2px;
}

.app-vars {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  overflow-x: auto;
}
.app-vars .var-row { display: flex; gap: 10px; align-items: baseline; }
.app-vars .var-name { color: var(--primary-2); flex-shrink: 0; }
.app-vars .var-default { color: var(--accent-2); }
.app-vars .var-desc { color: var(--text-3); margin-left: auto; font-size: 11.5px; }

.app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.app-tag {
  background: var(--surface);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 18px;
}
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--text-3); }

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-soft);
  padding: 40px 24px 30px;
  background: var(--bg-2);
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-brand img,
.footer-brand svg { height: 28px; width: auto; }
.footer-brand p { color: var(--text-3); font-size: 13px; max-width: 320px; line-height: 1.55; }

.footer h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer ul a {
  color: var(--text-2);
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer ul a:hover { color: var(--text); }

.footer-bottom {
  max-width: 1240px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ============================================================
   MOBILE COMPONENTS
   ============================================================ */

/* Hamburger button — hidden on desktop */
.navbar-burger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: var(--text);
}
.navbar-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.navbar-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.navbar-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.navbar-icon-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  padding: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.navbar-icon-btn:hover { color: var(--text); border-color: var(--primary); }
.navbar-icon-btn svg { width: 18px; height: 18px; }

/* Filter button (mobile only) */
.filter-mobile-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.filter-mobile-btn svg { width: 14px; height: 14px; }
.filter-mobile-count {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
}
.filter-mobile-count:empty { display: none; }

/* Drawer (slide-out nav) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 200;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  z-index: 210;
  transform: translateX(-100%);
  transition: transform .25s ease-out;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-header .navbar-brand img { height: 28px; }

.drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.drawer-close:hover { color: var(--text); border-color: var(--primary); }
.drawer-close svg { width: 18px; height: 18px; }

.drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.drawer-nav a {
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s;
}
.drawer-nav a:active { background: var(--surface); }

.drawer-section {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
}
.drawer-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}
.drawer-provider {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
}

.drawer-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
}
.drawer-search-btn:hover { color: var(--text); border-color: var(--primary); }
.drawer-search-btn svg { width: 16px; height: 16px; }

/* Search overlay (full-screen mobile search) */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 220;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.search-overlay.open { opacity: 1; pointer-events: auto; }

.search-overlay-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-2);
}
.search-overlay-bar svg {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  flex-shrink: 0;
}
.search-overlay-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-family: var(--font-sans);
  padding: 6px 0;
  min-width: 0;
}
.search-overlay-bar input::placeholder { color: var(--text-3); }
.search-overlay-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}
.search-overlay-close:hover { color: var(--text); border-color: var(--primary); }

.search-overlay-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.search-overlay-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .1s;
}
.search-overlay-result:hover, .search-overlay-result:active {
  border-color: var(--primary);
  text-decoration: none;
}
.search-overlay-result-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.search-overlay-result-icon img { width: 100%; height: 100%; object-fit: contain; }
.search-overlay-result-icon .fallback {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-2);
  text-transform: uppercase;
}
.search-overlay-result-text { flex: 1; min-width: 0; }
.search-overlay-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-overlay-result-cat {
  font-size: 12px;
  color: var(--text-3);
}
.search-overlay-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.search-overlay-empty h3 { color: var(--text-2); font-size: 16px; margin-bottom: 4px; }

/* Bottom sheet (mobile filter sheet) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 200;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 80vh;
  background: var(--bg-2);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-top: 1px solid var(--border);
  z-index: 210;
  transform: translateY(100%);
  transition: transform .25s ease-out;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.sheet-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.sheet-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
}
.sheet-close:hover { color: var(--text); border-color: var(--primary); }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
  -webkit-overflow-scrolling: touch;
}

.sheet-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sheet-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.sheet-cat:active { transform: scale(0.98); }
.sheet-cat.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.sheet-cat-count {
  font-size: 11px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex-shrink: 0;
}
.sheet-cat.active .sheet-cat-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Bottom action bar (per-app pages) */
.action-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  gap: 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.action-bar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 6px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  min-height: 56px;
}
.action-bar-btn:active { transform: scale(0.97); }
.action-bar-btn svg { width: 18px; height: 18px; }
.action-bar-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.action-bar-primary.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0f17;
}

@media (max-width: 900px) {
  .features-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .hero { padding: 50px 20px 40px; }
  .hero-logo { width: 200px; }
  .hero-stats { gap: 24px; }
}

/* ── Tablet ── */
@media (max-width: 768px) {
  .navbar-search { display: none; }            /* hide full search bar */
  .navbar-icon-btn { display: flex; }          /* show search icon */
  .navbar-burger { display: flex; }            /* show hamburger */
  .navbar-nav { display: none; }               /* hide desktop nav */
  .filters-wrap { top: 56px; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
}

/* ── Phone ── */
@media (max-width: 480px) {
  /* Hero */
  .hero { padding: 36px 16px 32px; }
  .hero-logo { width: 180px; margin-bottom: 24px; }
  .hero h1 { font-size: 30px; letter-spacing: -1px; }
  .hero-tagline { font-size: 15px; line-height: 1.5; }
  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 14px 0;
    margin-top: 28px;
  }
  .hero-stat .num { font-size: 24px; }
  .hero-stat .label { font-size: 10.5px; }

  /* Hero code block — smaller padding, hide dots on tiny screens */
  .code-block pre { font-size: 12px; padding: 14px; }
  .code-block pre code { font-size: 12px; }
  .code-block-header .dots { display: none; }

  /* Features — single col on phone, more compact */
  .features { padding: 24px 0 8px; }
  .feature { padding: 20px; }
  .feature h3 { font-size: 14px; }
  .feature p { font-size: 13px; }

  /* Section heads */
  .section-head h2 { font-size: 19px; }
  .section-head .count { font-size: 12px; }
  .section { padding: 24px 0 48px; }

  /* Filters — hide the long pill list, show mobile button */
  .filter-btn { display: none; }
  .filter-label { display: none; }
  .filter-mobile-btn { display: inline-flex; }

  /* App grid — 2 cols on phone, larger tap targets */
  .app-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 12px;
  }
  .app-card {
    padding: 12px;
    min-height: 0;
  }
  .app-card-icon { width: 36px; height: 36px; border-radius: 7px; }
  .app-card-name { font-size: 13.5px; }
  .app-card-desc {
    font-size: 11.5px;
    -webkit-line-clamp: 2;
  }
  .app-card-meta { font-size: 10.5px; gap: 6px; }

  /* Footer */
  .footer { padding: 32px 16px 24px; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 6px; align-items: flex-start; }

  /* Per-app page */
  .app-page { padding: 24px 16px 110px; }   /* extra bottom for action bar (79px + safety) */
  .app-page-header { flex-direction: row; align-items: center; gap: 14px; padding-bottom: 20px; }
  .app-page-icon { width: 56px; height: 56px; border-radius: 12px; }
  .app-page-icon .fallback { font-size: 22px; }
  .app-page-title h1 { font-size: 22px; }
  .app-page-title .subtitle { font-size: 13px; }
  .badge-row .badge { font-size: 10px; padding: 2px 7px; }

  .spec-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .spec { padding: 12px 14px; }
  .spec .spec-label { font-size: 10px; }
  .spec .spec-value { font-size: 16px; }

  .app-section h2 { font-size: 11px; }
  .app-section p { font-size: 14px; line-height: 1.55; }

  .crumbs { font-size: 12px; margin-bottom: 14px; }

  /* Bottom action bar visible only on phone */
  .action-bar { display: flex; }
  /* Pad footer so it's not covered by action bar */
  .app-page + .action-bar + .footer { padding-bottom: 110px; }
}
