/* ════════════════════════════════════════
   SENCE — graph.css
   Rendu des graphiques (graph.js) + page Graphothèque
   ════════════════════════════════════════ */

/* ─── Rendu des graphiques ─────────────────────────────── */
.sg-wrap { position: relative; width: 100%; font-family: var(--font-body, 'Inter', sans-serif); }
.sg-wrap--side { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.sg-wrap--side .sg-legend { flex-direction: column; align-items: flex-start; margin-top: 0; flex: 1; min-width: 140px; }
.sg-svg { display: block; overflow: visible; font-family: inherit; }
.sg-svg text { font-family: inherit; }
.sg-loading { min-height: 180px; background: linear-gradient(90deg, rgba(0,0,0,.03), rgba(0,0,0,.07), rgba(0,0,0,.03)); background-size: 200% 100%; animation: sgPulse 1.2s infinite; border-radius: 6px; }
@keyframes sgPulse { to { background-position: -200% 0; } }

.sg-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: #3A3A36; }
.sg-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.sg-legend-item i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sg-legend-item b { font-weight: 700; color: #1A1A18; }
.sg-legend--scale { align-items: center; gap: 10px; }
.sg-gradient { display: inline-block; width: 120px; height: 8px; border-radius: 4px; }
.sg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.sg-empty { font-size: 13px; color: #6B6B66; padding: 32px 0; text-align: center; }

.sg-tip {
  position: fixed; z-index: 9999; pointer-events: none; opacity: 0;
  background: #111; color: #fff; font: 12px/1.45 'Inter', system-ui, sans-serif;
  padding: 7px 10px; border-radius: 6px; max-width: 240px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: opacity .12s;
}
.sg-tip b { font-weight: 700; }

/* Comparaison côte à côte */
.sg-compare { display: grid; gap: 16px; align-items: start; }
.sg-compare-cell { min-width: 0; padding-left: 14px; border-left: 1px solid rgba(26,26,24,.12); }
.sg-compare-cell:first-child { padding-left: 0; border-left: none; }
.sg-compare-title { font: 600 13px/1.3 'Inter', sans-serif; color: #1A1A18; margin: 0 0 8px; }
.sg-compare-note { font-size: 11px; color: #6B6B66; margin: 10px 0 0; }
@media (max-width: 640px) {
  .sg-compare { grid-template-columns: 1fr !important; }
  .sg-compare-cell { padding-left: 0; border-left: none; border-top: 1px solid rgba(26,26,24,.12); padding-top: 12px; }
  .sg-compare-cell:first-child { border-top: none; padding-top: 0; }
}

/* ─── Carte graphique (page + aperçu admin) ────────────── */
.gp-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gp-chip {
  font: 700 10px/1 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 4px; background: #1A5CFF; color: #fff;
}
.gp-chip--pouvoirs { background: #C9D6FF; color: #1238B0; }
.gp-chip--monde    { background: #EBF59A; color: #4A5200; }
.gp-chip--societe  { background: #FFE2A3; color: #7A5000; }
.gp-chip--sciences { background: #B9EFD3; color: #00663A; }
.gp-chip--culture  { background: #E6C7FA; color: #5E0090; }
.gp-time { font-size: 12px; color: #6B6B66; }
.gp-card-title {
  font-family: 'Barlow Condensed', 'Impact', sans-serif; font-weight: 800;
  font-size: 26px; line-height: 1.05; color: #1A1A18; margin: 0 0 6px;
}
.gp-card-sub { font-size: 13px; line-height: 1.45; color: #3A3A36; margin: 0 0 14px; }
.gp-card-source { font-size: 11px; color: #6B6B66; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════
   PAGE GRAPHOTHÈQUE
   ═══════════════════════════════════════════════════════ */
.gp-page { background: #F4F2EC; color: #1A1A18; }
.gp-wrap { max-width: var(--max, 1440px); margin: 0 auto; padding: 0 var(--pad, 32px); }

/* Fonds pastel par thématique */
.gp-bg--pouvoirs { background: #E8EDFF; }
.gp-bg--monde    { background: #F5F8D6; }
.gp-bg--societe  { background: #FFF2D9; }
.gp-bg--sciences { background: #E0F6EA; }
.gp-bg--culture  { background: #F4E6FD; }

/* ─── Hero ─── */
.gp-hero {
  position: relative; overflow: hidden; color: #F8F7F2;
  padding: calc(var(--nav-h, 98px) + 56px) 0 64px;
  background: #0B1022;
}
.gp-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(11,16,34,.96) 0%, rgba(11,16,34,.82) 45%, rgba(11,16,34,.45) 100%),
    url('/pouvoirs.jpg') center / cover no-repeat;
  filter: saturate(.8);
}
.gp-hero .gp-wrap { position: relative; }
.gp-eyebrow { font: 600 12px/1 'Inter', sans-serif; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; color: rgba(248,247,242,.85); }
.gp-hero h1 {
  font-family: 'Barlow Condensed', 'Impact', sans-serif; font-weight: 900; text-transform: uppercase;
  font-size: clamp(52px, 7vw, 96px); line-height: .92; margin: 0 0 18px; letter-spacing: -.01em;
}
.gp-hero p { font-size: clamp(16px, 1.4vw, 19px); line-height: 1.5; max-width: 560px; color: rgba(248,247,242,.92); margin: 0 0 28px; }
.gp-btn {
  display: inline-flex; align-items: center; gap: 12px;
  font: 700 13px/1 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase;
  padding: 15px 22px; border-radius: 4px; background: #F6EF7B; color: #111; border: none; cursor: pointer;
  transition: transform .15s, background .15s;
}
.gp-btn:hover { background: #fff; transform: translateY(-1px); }
.gp-note {
  position: absolute; right: 6%; top: 18%;
  font-family: 'Caveat', cursive; font-size: 30px; line-height: 1.1; transform: rotate(-8deg); color: #F8F7F2;
}
.gp-note svg { position: absolute; left: -44px; top: -30px; }

/* ─── Barre de filtres ─── */
.gp-filters { padding: 22px 0; border-bottom: 1px solid rgba(26,26,24,.1); }
.gp-filters .gp-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gp-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(26,26,24,.3); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: #1A1A18;
}
.gp-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.gp-fchip {
  font: 500 13px/1 'Inter', sans-serif; padding: 11px 18px; border-radius: 999px;
  border: 1px solid rgba(26,26,24,.25); background: transparent; color: #1A1A18; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.gp-fchip:hover { border-color: #1A1A18; }
.gp-fchip.is-active { background: #111; color: #fff; border-color: #111; }
.gp-select {
  font: 500 13px/1 'Inter', sans-serif; padding: 11px 34px 11px 14px; border-radius: 6px;
  border: 1px solid rgba(26,26,24,.25); color: #1A1A18; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231A1A18' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
}

/* ─── En-têtes de section ─── */
.gp-section { padding: clamp(40px, 5vw, 64px) 0 0; }
.gp-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 24px; align-items: end; margin-bottom: 26px; }
.gp-head-title { border-left: 5px solid #1A5CFF; padding-left: 18px; }
.gp-kicker { display: block; font: 600 12px/1 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #1A5CFF; margin-bottom: 10px; }
.gp-head h2 {
  font-family: 'Barlow Condensed', 'Impact', sans-serif; font-weight: 900; text-transform: uppercase;
  font-size: clamp(30px, 3.4vw, 42px); line-height: .95; margin: 0;
}
.gp-head p { font-size: 14px; line-height: 1.5; color: #3A3A36; margin: 0; max-width: 460px; }
.gp-link { font: 700 12px/1 'Inter', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: #1A5CFF; white-space: nowrap; }
.gp-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.gp-arrows { display: flex; gap: 10px; }
.gp-arrow-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid #1A1A18; background: transparent; color: #1A1A18;
  display: grid; place-items: center; cursor: pointer; font-size: 18px; transition: background .15s, color .15s;
}
.gp-arrow-btn:hover { background: #1A1A18; color: #fff; }

/* ─── Cartes graphiques ─── */
.gp-featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gp-card {
  position: relative; border-radius: 10px; padding: 20px 20px 54px; min-width: 0;
  cursor: pointer; transition: transform .2s, box-shadow .2s; text-align: left; border: none; color: inherit; font: inherit;
}
.gp-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(26,26,24,.08); }
.gp-card:focus-visible { outline: 2px solid #1A5CFF; outline-offset: 3px; }
.gp-grid .gp-card { padding: 16px 16px 50px; }
.gp-grid .gp-card-title { font-size: 21px; }
.gp-card-open {
  position: absolute; right: 16px; bottom: 14px; width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid #1A1A18; display: grid; place-items: center; font-size: 15px; transition: background .15s, color .15s;
}
.gp-card:hover .gp-card-open { background: #1A1A18; color: #fff; }
.gp-empty-msg { grid-column: 1 / -1; font-size: 14px; color: #6B6B66; padding: 24px 0; }

/* ─── Thématiques ─── */
.gp-themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.gp-theme {
  border-radius: 8px; overflow: hidden; cursor: pointer; text-align: left; border: none; padding: 0; color: inherit; font: inherit;
  display: flex; flex-direction: column; transition: transform .2s;
}
.gp-theme:hover { transform: translateY(-3px); }
.gp-theme-img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.gp-theme-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); mix-blend-mode: multiply; }
.gp-theme-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; position: relative; }
.gp-theme-name { font: 700 15px/1.2 'Inter', sans-serif; }
.gp-theme-desc { font-size: 12px; line-height: 1.4; color: #4A4A45; }
.gp-theme-count { font-size: 12px; color: #6B6B66; margin-top: auto; padding-top: 10px; }
.gp-theme .gp-card-open { width: 26px; height: 26px; font-size: 12px; right: 12px; bottom: 12px; }
.gp-theme--pouvoirs .gp-theme-img { background: #6E8DFF; }
.gp-theme--monde .gp-theme-img    { background: #E2EE57; }
.gp-theme--societe .gp-theme-img  { background: #FFC84D; }
.gp-theme--sciences .gp-theme-img { background: #4FD99A; }
.gp-theme--culture .gp-theme-img  { background: #C783F5; }
.gp-theme.is-active { box-shadow: 0 0 0 2px #1A1A18; }

/* ─── Grands sujets (dossiers) ─── */
.gp-topics { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 32px) / 3); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gp-topics::-webkit-scrollbar { display: none; }
.gp-topic { scroll-snap-align: start; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.gp-topic-cover { position: relative; aspect-ratio: 16 / 7.5; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 18px; }
.gp-topic-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gp-topic-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(11,16,34,.85), rgba(11,16,34,.2) 70%); }
.gp-topic-cover > * { position: relative; z-index: 1; }
.gp-topic-title { font-family: 'Barlow Condensed', 'Impact', sans-serif; font-weight: 800; font-size: 28px; line-height: 1; }
.gp-topic-sub { font: 600 13px/1.3 'Inter', sans-serif; margin-top: 4px; }
.gp-topic-list { list-style: none; margin: 0; padding: 12px 18px 16px; flex: 1; position: relative; }
.gp-topic-list li button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 40px 8px 0; background: none; border: none;
  font: 13px/1.35 'Inter', sans-serif; color: #1A1A18; text-align: left; cursor: pointer;
}
.gp-topic-list li button:hover { text-decoration: underline; text-underline-offset: 3px; }
.gp-topic-icon { width: 22px; flex-shrink: 0; text-align: center; font-size: 15px; opacity: .75; }
.gp-topic-more { position: absolute; right: 16px; bottom: 16px; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #1A1A18; display: grid; place-items: center; }
.gp-topic-more:hover { background: #1A1A18; color: #fff; }

/* ─── Tous les graphiques : outils ─── */
.gp-tools { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr) auto; gap: 10px; margin-bottom: 18px; }
.gp-search { position: relative; }
.gp-search input {
  width: 100%; font: 14px/1 'Inter', sans-serif; padding: 12px 14px 12px 38px; border-radius: 6px;
  border: 1px solid rgba(26,26,24,.25); background: #fff; color: #1A1A18;
}
.gp-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #6B6B66; }
.gp-tools .gp-select { width: 100%; background-color: #fff; }
.gp-reset { font: 600 13px/1 'Inter', sans-serif; padding: 12px 18px; border-radius: 999px; border: 1px solid rgba(26,26,24,.25); background: #fff; cursor: pointer; }
.gp-reset:hover { border-color: #1A1A18; }
.gp-more { display: block; margin: 24px auto 0; }

/* ─── Soutien ─── */
.gp-support { margin-top: clamp(48px, 6vw, 80px); background: #0B1022; color: #F8F7F2; padding: 44px 0; position: relative; overflow: hidden; }
.gp-support .gp-wrap { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.gp-support h2 { font-family: 'Barlow Condensed', 'Impact', sans-serif; font-weight: 900; text-transform: uppercase; font-size: clamp(28px, 3vw, 40px); line-height: .95; margin: 6px 0 12px; }
.gp-support p { font-size: 14px; line-height: 1.55; max-width: 520px; color: rgba(248,247,242,.85); margin: 0; }

/* ─── Fenêtre de détail ─── */
.gp-modal { position: fixed; inset: 0; z-index: 500; display: none; }
.gp-modal.is-open { display: block; }
.gp-modal-overlay { position: absolute; inset: 0; background: rgba(8,8,8,.6); backdrop-filter: blur(3px); }
.gp-modal-panel {
  position: relative; margin: 5vh auto; width: min(920px, 94vw); max-height: 90vh; overflow-y: auto;
  border-radius: 12px; padding: 28px 30px; color: #1A1A18;
  animation: gpIn .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes gpIn { from { opacity: 0; transform: translateY(16px); } }
.gp-modal-close { position: absolute; right: 16px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(26,26,24,.08); font-size: 20px; cursor: pointer; }
.gp-modal .gp-card-title { font-size: clamp(28px, 3vw, 40px); padding-right: 40px; }
.gp-modal .gp-card-sub { font-size: 15px; }
.gp-modal-chart { margin: 8px 0 18px; }
.gp-modal-desc { font-size: 15px; line-height: 1.65; color: #2A2A27; border-top: 1px solid rgba(26,26,24,.12); padding-top: 16px; margin: 0 0 14px; white-space: pre-line; }
.gp-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #6B6B66; }
.gp-modal-foot a { color: #1A1A18; text-decoration: underline; }
.gp-modal-actions { display: flex; gap: 8px; }
.gp-modal-actions button { font: 600 12px/1 'Inter', sans-serif; padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(26,26,24,.3); background: transparent; cursor: pointer; }
.gp-modal-actions button:hover { background: #1A1A18; color: #fff; }

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .gp-featured { grid-template-columns: 1fr 1fr; }
  .gp-grid { grid-template-columns: 1fr 1fr; }
  .gp-themes { grid-template-columns: repeat(3, 1fr); }
  .gp-topics { grid-auto-columns: calc((100% - 16px) / 2); }
  .gp-tools { grid-template-columns: 1fr 1fr; }
  .gp-head { grid-template-columns: 1fr; gap: 12px; }
  .gp-note { display: none; }
}
@media (max-width: 640px) {
  .gp-featured, .gp-grid { grid-template-columns: 1fr; }
  .gp-themes { grid-template-columns: 1fr 1fr; }
  .gp-topics { grid-auto-columns: 88%; }
  .gp-tools { grid-template-columns: 1fr; }
  .gp-modal-panel { padding: 22px 18px; margin: 3vh auto; }
}
