/* ================================================================
   biomultimedia.pro — Portail principal (home.css)
   Dépendance : theme.css doit être chargé avant ce fichier.
   ================================================================ */

/* ─────────────────────────────────────────────────
   1. VARIABLES DU PORTAIL
   Aliases vers les tokens de theme.css (noms courts)
   + tokens spécifiques au portail (catégories)
───────────────────────────────────────────────── */
:root {
  /* Aliases raccourcis → tokens theme.css */
  --bg:        var(--bm-bg);
  --surface:   var(--bm-surface);
  --surface2:  var(--bm-surface2);
  --border:    var(--bm-border);
  --text:      var(--bm-text);
  --text2:     var(--bm-text2);
  --primary:   var(--bm-primary);
  --primary-d: var(--bm-primary-dark);
  --shadow:    var(--bm-shadow);
  --shadow-h:  var(--bm-shadow-h);
  --radius:    14px; /* Portail : coins plus grands que le défaut (10px) */

  /* Couleurs par catégorie */
  --cat-snpden: #eff6ff; --cat-snpden-b: #2563eb;
  --cat-ecole:  #f0fdf4; --cat-ecole-b:  #16a34a;
  --cat-outils: #fefce8; --cat-outils-b: #ca8a04;
  --cat-ia:     #fdf4ff; --cat-ia-b:     #9333ea;
  --cat-perso:  #fff7ed; --cat-perso-b:  #ea580c;
}

/* Mode sombre — seuls les tokens spécifiques au portail ;
   les aliases --bg, --text, etc. héritent automatiquement de theme.css */
[data-theme="dark"] {
  --cat-snpden: #1e3a6e;
  --cat-ecole:  #14532d;
  --cat-outils: #713f12;
  --cat-ia:     #4a1d96;
  --cat-perso:  #7c2d12;
}

/* ─────────────────────────────────────────────────
   2. BASE
───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  transition: background .3s, color .3s;
}

/* ─────────────────────────────────────────────────
   3. HEADER (portail)
───────────────────────────────────────────────── */
header {
  background: var(--primary);
  color: #fff;
  padding: 0 clamp(16px, 4vw, 48px);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -.02em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.header-right { display: flex; align-items: center; gap: 10px; }

/* ─────────────────────────────────────────────────
   4. HERO
───────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: #fff;
  padding: clamp(20px, 6vw, 20px) clamp(16px, 4vw, 48px);
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: 12px;
}

.hero p {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  opacity: .85;
  max-width: 560px;
  margin: 0 auto 28px;
}

/* ─────────────────────────────────────────────────
   5. BARRE DE RECHERCHE
───────────────────────────────────────────────── */
.search-wrap {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
}

#search {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border-radius: 50px;
  border: none;
  font-size: 1rem;
  background: rgba(255,255,255,.97);
  color: #111;
  outline: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  transition: box-shadow .2s;
}

#search:focus { box-shadow: 0 4px 20px rgba(0,0,0,.25); }

#search-count {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  color: var(--text2);
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ─────────────────────────────────────────────────
   6. MAIN / LAYOUT
───────────────────────────────────────────────── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px);
}

/* ─────────────────────────────────────────────────
   7. SECTIONS / CATÉGORIES
───────────────────────────────────────────────── */
.section { margin-bottom: 44px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.section-head h2 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
}

.section-head .count {
  margin-left: auto;
  font-size: .75rem;
  color: var(--text2);
  background: var(--surface2);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* Icônes de section par catégorie */
.sec-snpden .section-icon { background: var(--cat-snpden); color: var(--cat-snpden-b); }
.sec-ecole  .section-icon { background: var(--cat-ecole);  color: var(--cat-ecole-b); }
.sec-outils .section-icon { background: var(--cat-outils); color: var(--cat-outils-b); }
.sec-ia     .section-icon { background: var(--cat-ia);     color: var(--cat-ia-b); }
.sec-perso  .section-icon { background: var(--cat-perso);  color: var(--cat-perso-b); }

/* ─────────────────────────────────────────────────
   8. GRILLE DE CARTES
───────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .22s, box-shadow .22s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--primary));
  opacity: 0;
  transition: opacity .2s;
}

.card:hover        { transform: translateY(-4px); box-shadow: var(--shadow-h); }
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.card-head  { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }

.card-emoji {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface2);
}

.card-title  { font-size: .85rem; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.card-desc   { font-size: .76rem; color: var(--text2); line-height: 1.5; flex: 1; margin-bottom: 8px; }
.card-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }

/* Accent par catégorie */
.sec-snpden .card { --accent: var(--cat-snpden-b); }
.sec-ecole  .card { --accent: var(--cat-ecole-b); }
.sec-outils .card { --accent: var(--cat-outils-b); }
.sec-ia     .card { --accent: var(--cat-ia-b); }
.sec-perso  .card { --accent: var(--cat-perso-b); }

/* ─────────────────────────────────────────────────
   9. BADGES
───────────────────────────────────────────────── */
.badge-php   { background: #ede9fe; color: #5b21b6; }
.badge-js    { background: #fef9c3; color: #713f12; }
.badge-mysql { background: #dbeafe; color: #1e40af; }
.badge-new   { background: #d1fae5; color: #065f46; }

.badge-auth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}

/* ─────────────────────────────────────────────────
   10. BOUTON ICÔNE (header)
───────────────────────────────────────────────── */
.btn-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  cursor: pointer;
  transition: background .2s;
}
.btn-icon:hover { background: rgba(255,255,255,.3); }

/* ─────────────────────────────────────────────────
   11. AUCUN RÉSULTAT
───────────────────────────────────────────────── */
#no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}
#no-results svg { margin-bottom: 12px; opacity: .4; }

/* Masquage pour filtrage */
.card.hidden     { display: none; }
.section.all-hidden { display: none; }

/* ─────────────────────────────────────────────────
   12. FOOTER
───────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 28px 16px;
  font-size: .8rem;
  color: var(--text2);
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────
   13. RESPONSIVE
───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .logo span { display: none; }
  .grid      { grid-template-columns: 1fr; }
}
