/* Custom modern look for ThinkIA */
:root {
  --accent: #4F46E5;
  --bg: #0B1020;
  --card: #121a33;
  --text: #e8ecff;
  --muted: #aab3d1;
  --link: #8B5CF6;
  --border: #223058;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #55607a;
    --border: #e2e8f0;
    --accent: #4F46E5;
    --link: #6D28D9;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.65;
}
.site-header, .site-footer {
  background: transparent !important;
  border: none !important;
}
.wrapper { max-width: 1100px; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- SIDEBAR (base desktop) --- */
.sidebar {
  position: sticky;
  top: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.sidebar h3 { margin-top: 0; font-size: 1.1rem; letter-spacing: .2px; }
.theme-list { list-style: none; padding: 0; margin: 0; }
.theme-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: .4rem .2rem; border-bottom: 1px dashed var(--border);
}
.theme-list li:last-child { border-bottom: none; }
.badge {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  font-size: .75rem;
  padding: .1rem .5rem;
}

/* --- CARDS / POSTS --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.post-title { margin: 0 0 .2rem; font-size: 1.3rem; }
.post-meta { color: var(--muted); font-size: .9rem; margin-bottom: .6rem; }
.btn {
  display: inline-block; padding: .6rem .9rem; border-radius: 12px;
  border: 1px solid var(--border); background: transparent; color: var(--text);
}
.btn:hover { border-color: var(--accent); }

/* --- LAYOUT GRID --- */
.grid {
  display: grid;
  grid-template-columns: 260px 1fr; /* sidebar à gauche sur desktop */
  gap: 1.2rem;
}

/* --- LIENS LISTE THÈMES --- */
.theme-link {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-list li { gap: .6rem; }

/* --- TOGGLE de la sidebar (cache par défaut sur desktop) --- */
.sidebar-toggle { display: none; }
body.sidebar-open { overflow: hidden; }

/* --- MOBILE: tiroir latéral + bouton --- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; } /* une seule colonne */

  .sidebar-wrap { position: relative; }

  /* Bouton ☰ Thèmes */
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .5rem .9rem;
    box-shadow: 0 4px 15px rgba(0,0,0,.25);
    transition: background .2s ease, transform .15s ease, border-color .2s ease;
    margin-bottom: .6rem;
  }
  .sidebar-toggle:hover { background: var(--accent); color: #fff; transform: translateY(-1px); border-color: var(--accent); }
  .sidebar-toggle:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .sidebar-toggle:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Tiroir */
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0; left: 0;
    height: 100vh;
    width: 80%;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    background: var(--card);
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: 4rem 1.2rem 1.2rem; /* place en haut pour respirer */
    box-shadow: 8px 0 25px rgba(0,0,0,.4);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  /* Overlay obscurci quand ouvert */
  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
  }
}