/* ═══════════════════════════════
   TOKENS
═══════════════════════════════ */
:root {
  --bg:       #0d0f1a;
  --surface:  #13172a;
  --surface2: #1b2040;
  --border:   #252a48;
  --text:     #dde1f5;
  --muted:    #5e6699;
  --link:     #7eb8ff;
  --link-h:   #aaceff;
  --accent:   #5c7fff;
  --star:     #fbbf24;
  --r:        10px;
  --nav-h:    62px;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: var(--nav-h);
}
@media (min-width: 600px) { body { padding-bottom: 0; } }


/* ═══════════════════════════════
   STICKY TOP WRAPPER (desktop only)
═══════════════════════════════ */
@media (min-width: 600px) {
  .top-sticky {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
}


/* ═══════════════════════════════
   SEARCH
═══════════════════════════════ */
.search-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
@media (min-width: 600px) {
  .search-header {
    position: static;
    border-bottom: none;
    padding: 16px 24px 10px;
  }
}

.search-wrap {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
}
.search-wrap::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.6;
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 127, 255, 0.15);
}
#search::placeholder { color: var(--muted); }


/* ═══════════════════════════════
   NAV BAR — fixe en bas (mobile) / sticky en haut (desktop)
═══════════════════════════════ */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (min-width: 600px) {
  .nav-bar {
    position: static;
    height: auto;
    border-top: none;
    justify-content: center;
    padding: 0;
  }
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  padding: 6px 8px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--accent); border-top-color: var(--accent); }
.nav-btn:hover  { color: var(--text); }

.nav-icon  { font-size: 20px; line-height: 1; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

@media (min-width: 600px) {
  .nav-btn {
    flex: 0;
    flex-direction: row;
    gap: 7px;
    padding: 13px 28px;
    border-top: none;
    border-bottom: 2px solid transparent;
  }
  .nav-btn.active { border-bottom-color: var(--accent); }
  .nav-icon  { font-size: 17px; }
  .nav-label { font-size: 15px; text-transform: none; letter-spacing: normal; font-weight: 500; }
}


/* ═══════════════════════════════
   MAIN
═══════════════════════════════ */
main {
  padding: 20px 16px;
  max-width: 900px;
  margin: 0 auto;
}
@media (min-width: 600px) { main { padding: 24px; } }

.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tab-content,
#search-results { animation: fadeIn 0.18s ease; }


/* ═══════════════════════════════
   CATÉGORIES
═══════════════════════════════ */
.category { margin-bottom: 28px; }

.cat-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}


/* ═══════════════════════════════
   PILLS
═══════════════════════════════ */
.link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--link);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.pill:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--link-h);
  box-shadow: 0 2px 12px rgba(92, 127, 255, 0.14);
  text-decoration: none;
}
.pill.starred {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.05);
}
.pill.starred::before {
  content: "⭐";
  font-size: 11px;
  margin-right: 6px;
}
.pill.starred:hover {
  border-color: var(--star);
  box-shadow: 0 2px 12px rgba(251, 191, 36, 0.15);
}


/* ═══════════════════════════════
   BLOGS
═══════════════════════════════ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 480px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px) { .blog-grid { grid-template-columns: repeat(4, 1fr); } }

.blog-card {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--link);
  font-size: 14px;
  text-decoration: none;
  min-height: 48px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.blog-card:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--link-h);
}


/* ═══════════════════════════════
   POSTS
═══════════════════════════════ */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-left-color 0.15s;
}
.post-card:hover { border-left-color: var(--accent); }
.post-card.starred {
  border-left-color: var(--star);
  background: rgba(251, 191, 36, 0.04);
}

.post-title {
  display: block;
  color: var(--link);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  word-break: break-word;
  transition: color 0.12s;
}
.post-title:hover { color: var(--link-h); }

.post-comment {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}


/* ═══════════════════════════════
   RÉSULTATS DE RECHERCHE
═══════════════════════════════ */
.search-group { margin-bottom: 24px; }

.search-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 16px;
}
