/* ───────────────────────────────────────────────────────
   Stratégies Pédagogiques — HEC Montréal
   Redesign — DM Serif Display + DM Sans
   ─────────────────────────────────────────────────────── */

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

:root {
  --navy:        #002855;
  --blue:        #0072ce;
  --accent:      #0072ce;
  --bg:          #eef2f7;
  --surface:     #ffffff;
  --border:      #d9d9d6;
  --border-soft: #e8edf4;
  --text:        #002855;
  --text-2:      #002855;
  --text-3:      #888b8d;
  --text-4:      #d9d9d6;
  --sidebar-w:   288px;
  --header-h:    62px;
  --radius:      0px;
  --radius-sm:   2px;
  --radius-xs:   2px;
  --shadow:      0 2px 8px rgba(0,40,85,.08);
  --shadow-md:   0 4px 20px rgba(0,40,85,.13);
}

html, body { height: 100%; font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── HEADER ─────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 60;
  background: var(--navy);
  border-bottom: 3px solid var(--blue);
  height: var(--header-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.header-inner {
  height: 100%;
  padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}

/* Brand */
.brand { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 2px;
  background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.8);
  cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.brand-logo {
  height: 46px;          /* < 62 px (hauteur de l'en-tête) : pas de débordement */
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-title { font-size: .9rem; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.brand-sub { font-size: .68rem; color: rgba(255,255,255,.5); font-weight: 400; white-space: nowrap; }

/* Search */
.search-wrap {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 2px;
  padding: 0 .875rem;
  transition: background .15s, border-color .15s;
}
.search-wrap:focus-within {
  background: rgba(255,255,255,.13);
  border-color: var(--blue);
}
.search-icon { flex-shrink: 0; color: rgba(255,255,255,.4); }
.search-wrap input {
  flex: 1; background: none; border: none; outline: none;
  font: 500 .875rem/1 'DM Sans', sans-serif;
  color: #fff; height: 36px;
}
.search-wrap input::placeholder { color: rgba(255,255,255,.35); }
.search-kbd {
  font-size: .65rem; font-weight: 600; color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 2px; padding: 2px 5px;
}
.clear-btn {
  background: none; border: none; color: rgba(255,255,255,.4); cursor: pointer;
  display: flex; align-items: center; padding: 0; transition: color .15s;
}
.clear-btn:hover { color: #fff; }

/* Right */
.header-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-shrink: 0; }

.pill-count { display: none; }

.filter-toggle {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem; border-radius: 2px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.85); font: 600 .78rem 'DM Sans', sans-serif;
  cursor: pointer; transition: background .15s, border-color .15s; position: relative;
  text-transform: uppercase; letter-spacing: .04em;
}
.filter-toggle:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: #fff; }
.active-badge {
  position: absolute; top: -4px; right: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #f3d03e; border: 2px solid var(--navy);
}

/* Mobile menu btn hidden on desktop */
@media (min-width: 769px) { .brand .icon-btn { display: none; } }

/* ── LAYOUT ─────────────────────────────────────────── */
.layout {
  display: flex; flex: 1;
  width: 100%;
  position: relative;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width .25s cubic-bezier(.4,0,.2,1), opacity .25s;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  opacity: 0;
  border-right: none;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 70;
    width: var(--sidebar-w); transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-md);
    opacity: 1 !important;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); opacity: 1; transform: translateX(-100%); }
}

.sidebar-inner { padding: 1.25rem 1rem; position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; }

.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.375rem; padding-bottom: .75rem;
  border-bottom: 2px solid var(--navy);
}
.sidebar-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--navy);
}

/* Only show close on mobile */
.sidebar-top .icon-btn {
  display: none;
  background: var(--bg); color: var(--text-3);
  border-radius: 2px;
}
.sidebar-top .icon-btn:hover { background: var(--border); color: var(--text); }
@media (max-width: 768px) { .sidebar-top .icon-btn { display: flex; } }

.filter-group { margin-bottom: 1.5rem; }
.filter-group-header {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .625rem;
}
.group-dot { width: 3px; height: 14px; border-radius: 0; flex-shrink: 0; }
.filter-group-header span {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--navy);
}

.filter-list { display: flex; flex-direction: column; gap: 1px; }

.filter-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .5rem; border-radius: 0;
  cursor: pointer; transition: background .12s;
}
.filter-item:hover { background: var(--bg); }
.filter-item input[type=checkbox] {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--blue); flex-shrink: 0;
}
.filter-chip {
  flex: 1; font-size: .74rem; font-weight: 600;
  padding: .2rem .45rem; border-radius: 0; border: 1px solid;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filter-count {
  font-size: .7rem; font-weight: 700; min-width: 22px; text-align: center;
  padding: .15rem .35rem; border-radius: 0; flex-shrink: 0;
}

.show-more-btn {
  margin-top: .375rem; display: flex; align-items: center; gap: .3rem;
  background: none; border: none; cursor: pointer;
  font-size: .72rem; font-weight: 700; color: var(--text-3);
  padding: .25rem .5rem; border-radius: 0;
  text-transform: uppercase; letter-spacing: .04em;
  transition: color .15s, background .15s;
}
.show-more-btn:hover { color: var(--blue); background: #e0eef9; }

.reset-btn {
  width: 100%; margin-top: .5rem;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem .75rem; border-radius: 2px;
  background: #fff0f0; border: 1px solid #ffd0d0;
  color: #cc0000; font: 700 .75rem 'DM Sans', sans-serif;
  cursor: pointer; transition: background .15s;
  text-transform: uppercase; letter-spacing: .04em;
}
.reset-btn:hover { background: #ffe0e0; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,40,85,.3); z-index: 65;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* ── MAIN ─────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.results-bar {
  padding: 1.125rem 1.25rem .5rem;
  font-size: .82rem; color: var(--text-3);
}
.results-bar strong { color: var(--navy); font-size: .95rem; font-weight: 700; }

/* Active filter chips */
.active-filters {
  display: flex; flex-wrap: wrap; gap: .375rem;
  padding: 0 1.25rem .75rem;
}
.active-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .5rem .25rem .625rem;
  border-radius: 2px; font-size: .72rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s;
  border: 1px solid; user-select: none;
}
.active-chip:hover { opacity: .75; }
.active-chip svg { flex-shrink: 0; }

/* Cards grid */
.cards {
  flex: 1; padding: 0 1.25rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .625rem;
  align-content: start;
}

/* ── STRATEGY CARD ────────────────────────────────── */
.s-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  transition: box-shadow .18s;
  opacity: 0;
  animation: fadeUp .25s ease-out forwards;
}
.s-card:hover {
  box-shadow: var(--shadow);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Re-rendu sans rejouer l'animation (épinglage, dépliage des types) */
.s-card--still { opacity: 1; animation: none; }

.s-bar { display: none; }

.s-body {
  flex: 1; padding: 1rem 1rem .875rem;
  display: flex; flex-direction: column; gap: .5rem;
  min-width: 0;
}

.s-header { display: flex; align-items: flex-start; gap: .5rem; }

.s-types { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.s-type-tag {
  font-size: .7rem; font-weight: 600;
  padding: .18rem .45rem; border-radius: 0; border: 1px solid;
}

.s-text {
  font-size: .855rem; line-height: 1.65; color: var(--navy);
  flex: 1;
}

.s-contextes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; padding-top: .375rem; border-top: 1px solid var(--border-soft); }
.s-ctx-tag {
  font-size: .7rem; font-weight: 500;
  padding: .18rem .45rem; border-radius: 0;
  background: #e8edf4; color: var(--navy);
  border: 1px solid #cdd6e4;
}

/* ── CARD TITLE ───────────────────────────────────── */
.s-title {
  flex: 1;
  font: 400 1.02rem/1.3 'DM Serif Display', serif;
  color: var(--navy);
  letter-spacing: .005em;
}

/* ── "+N" TYPES TOGGLE ────────────────────────────── */
.more-types {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 700;
  padding: .18rem .5rem;
  border: 1px solid #cdd6e4;
  border-radius: 0;
  background: #e8edf4;
  color: var(--navy);
  font-family: 'DM Sans', sans-serif;
  line-height: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.more-types:hover { background: #dbe4f0; border-color: var(--navy); }
.more-types:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.more-types--open {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .62rem;
}

/* ── IAG TAG (card) ───────────────────────────────── */
.s-iag-tag {
  font-size: .7rem; font-weight: 700;
  padding: .18rem .45rem; border-radius: 0;
  background: #e8edf4; color: var(--navy);
  border: 1px solid var(--navy);
}

/* ── IAG FILTER CHIPS (sidebar) ───────────────────── */
.iag-chip--avec {
  background: var(--navy) !important; color: #fff !important;
  border-color: var(--navy) !important;
}
.iag-chip--sans {
  background: #fff !important; color: var(--navy) !important;
  border-color: var(--navy) !important;
}
.iag-chip--mixte {
  background: #e8edf4 !important; color: var(--navy) !important;
  border-color: #cdd6e4 !important;
}
.iag-count { background: #e8edf4 !important; color: var(--navy) !important; }
.iag-count--avec { background: var(--navy) !important; color: #fff !important; }

.active-chip-iag {
  background: var(--navy) !important; color: #fff !important;
  border-color: var(--navy) !important;
}

.ctx-chip {
  background: #e8edf4 !important; color: var(--navy) !important;
  border-color: #cdd6e4 !important;
}
.ctx-count {
  background: #e8edf4 !important; color: var(--navy) !important;
}
.active-chip-ctx {
  background: #e8edf4 !important; color: var(--navy) !important;
  border-color: #cdd6e4 !important;
}

/* ── PIN BUTTON ───────────────────────────────────── */
.pin-btn {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--text-4);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
  margin-left: auto;
}
.pin-btn:hover {
  background: #fef3c7;
  color: #b8960c;
  border-color: #f3d03e;
}
.pin-btn--active {
  background: #fef3c7;
  color: #b8960c;
  border-color: #f3d03e;
}
.pin-btn--active:hover {
  background: #fff0f0;
  color: #cc0000;
  border-color: #ffa0a0;
}

/* Pinned card accent */
.s-card--pinned {
  border-color: #f3d03e;
  box-shadow: 0 2px 8px rgba(243,208,62,.2);
}

/* Favoris button states */
.fav-toggle { position: relative; }

.fav-count-badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 18px; height: 16px;
  padding: 0 4px;
  border-radius: 2px;
  background: #f3d03e;
  color: var(--navy);
  font-size: .62rem; font-weight: 800;
  line-height: 1;
}

.fav-active {
  background: rgba(243,208,62,.2) !important;
  border-color: #f3d03e !important;
  color: #f3d03e !important;
}
.fav-active:hover {
  background: rgba(243,208,62,.3) !important;
}

/* ── EMPTY STATE ──────────────────────────────────── */
.empty {
  text-align: center; padding: 5rem 1.5rem;
  background: var(--surface); border-radius: 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  margin: 0 1.25rem;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty h3 { font: 700 1rem/1.3 'DM Sans', sans-serif; color: var(--navy); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .04em; }
.empty p { font-size: .84rem; color: var(--text-3); margin-bottom: 1.5rem; }
.empty-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.25rem; border-radius: 2px;
  background: var(--blue); color: #fff;
  font: 700 .78rem 'DM Sans', sans-serif;
  border: none; cursor: pointer; transition: background .15s;
  text-transform: uppercase; letter-spacing: .05em;
}
.empty-btn:hover { background: #005ba5; }

/* ── ABOUT DIALOG ─────────────────────────────────── */
.about-dialog {
  max-width: 520px;
  width: calc(100vw - 2.5rem);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: 0;
  padding: 1.5rem 1.625rem 1.625rem;
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow-md);
}
.about-dialog::backdrop {
  background: rgba(0,40,85,.45);
  backdrop-filter: blur(2px);
}
.about-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem; padding-bottom: .625rem;
  border-bottom: 2px solid var(--navy);
}
.about-head h2 {
  font-size: .8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--navy);
}
.about-close {
  background: var(--bg); color: var(--text-3);
}
.about-close:hover { background: var(--border); color: var(--text); }
.about-text {
  font-size: .9rem; line-height: 1.7; color: var(--navy);
  margin-bottom: 1rem;
}
.about-credit {
  font-size: .78rem; line-height: 1.6; color: var(--text-3);
}
.about-credit a { color: var(--blue); text-decoration: none; }
.about-credit a:hover { text-decoration: underline; }

/* ── FOOTER ─────────────────────────────────────────── */
.site-footer {
  border-top: 3px solid var(--navy);
  background: var(--surface);
  padding: 1.25rem 1.5rem;
}
.footer-container {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
}
.footer-text {
  font-size: .78rem; color: var(--text-3); line-height: 1.5;
}
.footer-text a {
  color: var(--blue); text-decoration: none;
}
.footer-text a:hover { text-decoration: underline; }

.footer-license a.license-link {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--text-3);
  font-size: .75rem;
  transition: color .15s;
}
.footer-license a.license-link:hover { color: var(--text-2); }
.license-icon { height: 20px; display: block; }

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
  .filter-toggle { display: none; }
  .about-toggle { display: flex; padding: .45rem .55rem; }
  .about-toggle .about-label { display: none; }
  .search-kbd { display: none; }
  .brand-sub { display: none; }
  .brand-logo { height: 36px; }
  .header-inner { gap: .625rem; }
  .cards {
    padding: 0 .75rem 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .5rem;
  }
  .results-bar { padding: .875rem .75rem .375rem; }
  .active-filters { padding: 0 .75rem .5rem; }
}
