/* SPDX-License-Identifier: GPL-3.0-or-later
   Copyright (C) 2026 Stéphane FOSSE */
/* ==========================================================================
   Technology Radar — feuille de styles
   Personnalisation : modifiez les variables ci-dessous.
   ========================================================================== */

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #d9d5cf;
  --ring-fill-1: #ebe7e1;
  --ring-fill-2: #f1eee9;
  --ring-fill-3: #f6f4f0;
  --ring-fill-4: #fbfaf8;
  --accent: #1f8290;
  --new: #0f7a43;
  --in: #1f5fbf;
  --out: #b3471d;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(20, 20, 30, .12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: ui-serif, Georgia, "Times New Roman", serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15161a;
  --surface: #1e2026;
  --text: #ecebe8;
  --muted: #9c9ca3;
  --line: #3a3c44;
  --ring-fill-1: #2b2e36;
  --ring-fill-2: #252830;
  --ring-fill-3: #21232a;
  --ring-fill-4: #1c1e24;
  --new: #4cc38a;
  --in: #7aa7ff;
  --out: #ff9a6b;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --surface: #1e2026; --text: #ecebe8; --muted: #9c9ca3; --line: #3a3c44;
    --ring-fill-1: #2b2e36; --ring-fill-2: #252830; --ring-fill-3: #21232a; --ring-fill-4: #1c1e24;
    --new: #4cc38a; --in: #7aa7ff; --out: #ff9a6b; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font);
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--font-title); font-weight: 600; font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-family: var(--font-title); font-weight: 600; font-size: 1.5rem; margin-top: 2rem; }
code { font-size: .9em; background: color-mix(in srgb, var(--text) 8%, transparent); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--muted); margin: 0 0 .4rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- En-tête / pied ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { color: var(--muted); font-size: .78rem; }
.site-header nav { display: flex; align-items: center; gap: 1rem; }
.site-header nav a { text-decoration: none; font-weight: 500; }
.theme-toggle { background: none; border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; color: inherit; }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
main { max-width: 1320px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem; }
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem clamp(1rem, 4vw, 2.5rem); font-size: .875rem; text-align: center; }
.site-footer p { margin: .2rem 0; }

/* ---------- En-tête d'édition ---------- */
.edition-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.edition-head > div { max-width: 760px; }
.intro p { margin: .3rem 0; font-size: 1.05rem; }
.edition-select { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
.edition-select select, .toolbar input {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem .7rem; font-size: .95rem;
}
.archived-banner { background: color-mix(in srgb, var(--out) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--out) 40%, transparent); padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin: 1rem 0; }
.toolbar input { flex: 1 1 260px; max-width: 380px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .875rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .35rem .85rem; cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Radar ---------- */
.radar-area { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 2rem; align-items: start; }
.radar-wrap { position: relative; max-width: 860px; width: 100%; margin: 0 auto; padding: 2.4rem 0; }
.radar { width: 100%; height: auto; display: block; overflow: hidden; }
.quadrant-bg path { fill: var(--c); opacity: .045; transition: opacity .2s; }
.rings circle { stroke: var(--line); stroke-width: 1.2; }
.rings circle[data-ring-index="0"] { fill: var(--ring-fill-1); }
.rings circle[data-ring-index="1"] { fill: var(--ring-fill-2); }
.rings circle[data-ring-index="2"] { fill: var(--ring-fill-3); }
.rings circle[data-ring-index="3"], .rings circle[data-ring-index="4"], .rings circle[data-ring-index="5"] { fill: var(--ring-fill-4); }
.rings line { stroke: var(--bg); stroke-width: 22; }
.ring-labels text {
  font: 600 11px var(--font); text-anchor: middle; fill: var(--muted); text-transform: uppercase; letter-spacing: .03em;
  pointer-events: none;
}
.blip { cursor: pointer; text-decoration: none; }
.blip-dot { fill: var(--c); stroke: var(--surface); stroke-width: 1.5; transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.blip-ring { fill: none; stroke: var(--c); stroke-width: 2.2; }
.blip text { font: 700 10px var(--font); fill: #fff; text-anchor: middle; pointer-events: none; }
.blip:hover .blip-dot, .blip:focus .blip-dot, .blip.hl .blip-dot { transform: scale(1.35); }
.blip:focus { outline: none; }
.blip:focus-visible .blip-dot { stroke: var(--text); stroke-width: 2.5; }
.blip.dim { opacity: .13; }
.blip.dim:hover { opacity: .6; }
.blip { transition: opacity .2s; }

.q-label {
  position: absolute; font: 600 1rem var(--font-title); color: var(--c); background: none; border: 0; cursor: pointer;
  padding: .2rem .3rem; z-index: 2;
}
.q-label:hover { text-decoration: underline; }
.q-label.pos-top-left { top: 0; left: 0; }
.q-label.pos-top-right { top: 0; right: 0; }
.q-label.pos-bottom-left { bottom: 0; left: 0; }
.q-label.pos-bottom-right { bottom: 0; right: 0; }
.radar-wrap:not([data-zoom-state="all"]) .q-label { display: none; }
.zoom-out { position: absolute; top: 0; left: 0; font: inherit; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .3rem .7rem; cursor: pointer; color: inherit; z-index: 2; }

.tooltip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--text); color: var(--bg);
  padding: .35rem .6rem; border-radius: 6px; font-size: .85rem; white-space: nowrap; transform: translate(-50%, calc(-100% - 14px));
  box-shadow: var(--shadow);
}

/* ---------- Légende ---------- */
.radar-side { position: sticky; top: 5rem; }
.legend { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .3rem; }
.legend li { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.legend-icon { width: 26px; height: 26px; --c: var(--muted); }
.legend-icon .blip-dot { stroke: none; }
.ring-defs { margin: 0; font-size: .85rem; }
.ring-defs div { margin-bottom: .8rem; }
.ring-defs dt { font-weight: 700; }
.ring-defs dd { margin: 0; color: var(--muted); }

/* ---------- Listes par quadrant ---------- */
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.quadrant-list { background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.2rem; border-top: 4px solid var(--c); }
.quadrant-list h3 { display: flex; align-items: baseline; justify-content: space-between; font-family: var(--font-title); font-size: 1.25rem; }
.quadrant-list h3 .count { font: 500 .8rem var(--font); color: var(--muted); }
.zoom-link { font: inherit; color: var(--c); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.ring-group h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 1rem 0 .3rem; }
.ring-group ol { list-style: none; padding: 0; margin: 0; }
.ring-group li a { display: flex; align-items: center; gap: .55rem; padding: .28rem .35rem; border-radius: 6px; text-decoration: none; }
.ring-group li a:hover, .ring-group li.hl a { background: color-mix(in srgb, var(--c) 12%, transparent); }
.ring-group li.hidden, .ring-group.hidden, .quadrant-list.hidden { display: none; }
.num { flex: none; min-width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--c); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.name { flex: 1; }
.name .badge { margin-left: .35rem; }

.badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: .08rem .45rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.st-new { color: var(--new); background: color-mix(in srgb, var(--new) 14%, transparent); }
.st-moved-in { color: var(--in); background: color-mix(in srgb, var(--in) 14%, transparent); }
.st-moved-out { color: var(--out); background: color-mix(in srgb, var(--out) 14%, transparent); }
.removed { margin-top: 2rem; font-size: .95rem; }
.removed h2 { font-size: 1.1rem; }

/* ---------- Panneau de détail ---------- */
.panel {
  position: fixed; top: 0; right: 0; height: 100%; width: min(480px, 100%); background: var(--surface); z-index: 50;
  box-shadow: var(--shadow); transform: translateX(105%); transition: transform .25s ease; overflow-y: auto;
  padding: 2.2rem 1.8rem 2rem; border-left: 6px solid var(--c, var(--accent));
}
.panel.open { transform: none; }
.panel:focus { outline: none; }
.panel-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.8rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--muted); }
.panel h2 { margin-top: 0; font-size: 1.8rem; }
.panel .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel .nav-blips { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .9rem; }
.panel .nav-blips button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.panel-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 40; }
.q-pill, .ring-pill { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.q-pill { color: var(--c); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.tag { font-size: .8rem; color: var(--muted); }

/* ---------- Page technologie ---------- */
.blip-page { max-width: 760px; margin: 0 auto; }
.blip-page h1 { border-left: 6px solid var(--c); padding-left: .8rem; }
.blip-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.description { font-size: 1.07rem; }
.history { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.hist-item { position: relative; padding: 0 0 1.2rem 1.2rem; }
.hist-item::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.hist-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.hist-item details { margin-top: .3rem; font-size: .92rem; color: var(--muted); }
.hist-item summary { cursor: pointer; }

/* ---------- Page éditions ---------- */
.editions-page { max-width: 760px; margin: 0 auto; }
.edition-list { list-style: none; padding: 0; }
.edition-list li { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.edition-list li > a { font-size: 1.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .radar-area { grid-template-columns: 1fr; }
  .radar-side { position: static; }
  .legend { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .blip text { font-size: 11px; }
  .q-label { font-size: .85rem; }
}

/* ---------- Impression ---------- */
@media print {
  .site-header, .toolbar, .theme-toggle, .panel, .panel-backdrop, .edition-select, .zoom-out { display: none !important; }
  body { background: #fff; color: #000; }
  .radar-area { grid-template-columns: 1fr; }
  .quadrant-list { break-inside: avoid; border: 1px solid #ccc; }
  .radar-wrap { max-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
