/* ─── Reset & Base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0e0e0f;
  --bg2:        #161618;
  --bg3:        #1e1e21;
  --border:     #2a2a2e;
  --accent:     #e8832a;
  --accent2:    #f5a623;
  --text:       #e2e2e6;
  --text-dim:   #8a8a96;
  --text-muted: #555560;
  --tag-bg:     #252528;
  --card-hover: #202024;
  --radius:     10px;
  --key-bg:     #2b2b30;
  --key-border: #3d3d45;
  --key-text:   #f0c060;
}

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ──────────────────────────────────── */
.header {
  position: fixed;
  top: 80px; /* clears site nav */
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  backdrop-filter: blur(12px);
  text-align: center;
}

/* Centred column layout */
.header-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.header-text .subtitle {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 1px;
  white-space: nowrap;
}

/* ─── Search ──────────────────────────────────── */
.search-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 11px 44px 11px 38px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

#search::placeholder { color: var(--text-muted); }

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 131, 42, 0.15);
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  display: none;
  transition: color 0.15s, background 0.15s;
}
.clear-btn:hover  { color: var(--text); background: var(--bg3); }
.clear-btn.visible { display: block; }

/* ─── Filters ─────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--tag-bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ─── Main Content ─────────────────────────────── */
.main {
  flex: 1;
  padding: 220px 20px 60px; /* 220px = 80px site nav + ~130px app header; JS refines this */
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Stats ─────────────────────────────────────── */
.stats {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  min-height: 18px;
}

/* ─── Group Headers ──────────────────────────────── */
.group-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.group-header:first-child { margin-top: 0; }

.group-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.group-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
}

/* ─── Results Grid ─────────────────────────────── */
.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ─── Shortcut Card ─────────────────────────────── */
.card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  cursor: default;
}

.card:hover {
  background: var(--card-hover);
  border-color: #3d3d45;
  transform: translateY(-1px);
}

.card-keys {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 140px;
  max-width: 200px;
  align-items: center;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--key-text);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.key-plus {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 400;
  padding: 0 1px;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-action {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
}

.card-action mark {
  background: rgba(232, 131, 42, 0.25);
  color: var(--accent2);
  border-radius: 2px;
  padding: 0 1px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Page-based tag colors */
.tag-edit      { background: rgba(88,  150, 236, 0.18); color: #6eaaff; }
.tag-cut       { background: rgba(80,  200, 120, 0.18); color: #5dd68a; }
.tag-color     { background: rgba(200, 80,  80,  0.18); color: #e06060; }
.tag-fairlight { background: rgba(160, 100, 220, 0.18); color: #c07af0; }
.tag-fusion    { background: rgba(200, 160, 60,  0.18); color: #e0b840; }
.tag-deliver   { background: rgba(60,  180, 200, 0.18); color: #40c8e0; }
.tag-media     { background: rgba(200, 120, 60,  0.18); color: #e08040; }
.tag-photo     { background: rgba(220, 80,  140, 0.18); color: #f070aa; }
.tag-general   { background: rgba(130, 130, 140, 0.18); color: #9090a0; }

.card-category {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── No results ─────────────────────────────────── */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-dim); }
.no-results p  { font-size: 0.82rem; }

/* ─── Footer ─────────────────────────────────────── */
.footer {
  margin-top: 40px;
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 2;
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ─── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a42; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #505060; }

/* ═══════════════════════════════════════════════════
   TABLET — ≤ 960px: single column
   ═══════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .results { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   MOBILE — ≤ 600px
   ═══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  html { font-size: 14px; }

  .header { padding: 12px 12px 10px; }

  /* Stack header vertically on mobile */
  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-wrap { max-width: 100%; }

  .logo { width: 36px; height: 36px; }

  .header-text h1        { font-size: 0.95rem; }
  .header-text .subtitle { font-size: 0.68rem; }

  #search { font-size: 1rem; padding: 11px 40px 11px 36px; }

  .filters {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .filter-btn {
    padding: 7px 14px;
    font-size: 0.78rem;
  }

  /* Stack card: keys on top, action below */
  .card {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .card-keys {
    min-width: 0;
    max-width: 100%;
    gap: 6px;
  }

  .key {
    font-size: 0.9rem;
    padding: 5px 12px;
    border-radius: 7px;
    border-bottom-width: 3px;
  }

  .key-plus {
    font-size: 0.85rem;
    padding: 0 2px;
  }

  .card-action   { font-size: 0.92rem; }
  .card-category { font-size: 0.72rem; }

  .main { padding: 12px 10px 36px; }
}
