:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #171a1f;
  --surface: #20242a;
  --surface-2: #292e35;
  --surface-glass: rgba(35, 40, 47, .78);
  --text: #f3f6f9;
  --muted: #aeb8c4;
  --accent: #68d8ff;
  --accent-strong: #8ce3ff;
  --line: rgba(255,255,255,.09);
  --radius: 20px;
  --page: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { margin: 0; min-width: 280px; color: var(--text); background: var(--bg); overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, select { font: inherit; }

/* Navigation cohérente avec l'accueil */
.site-nav { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--line); background: rgba(17,20,24,.86); backdrop-filter: blur(18px); }
.nav-shell { width: min(100%, var(--page)); min-height: 68px; margin: auto; padding: 0 clamp(16px, 4vw, 56px); display: flex; align-items: center; gap: 28px; }
.nav-brand { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.nav-brand img { width: 132px; height: 42px; object-fit: contain; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-links a { padding: 10px 13px; border-radius: 10px; color: #d8e0e9; text-decoration: none; font-size: .93rem; font-weight: 650; transition: .2s ease; }
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateY(-1px); }
.nav-links .nav-cta { color: #07151b; background: var(--accent); }
.nav-toggle { display: none; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: #fff; background: rgba(255,255,255,.05); cursor: pointer; }
.nav-toggle span, .nav-toggle::before, .nav-toggle::after { content:""; display:block; width:20px; height:2px; margin:4px auto; border-radius:3px; background:currentColor; transition:.25s ease; }
.nav-toggle[aria-expanded="true"] span { opacity: 0; }
.nav-toggle[aria-expanded="true"]::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"]::after { transform: translateY(-6px) rotate(-45deg); }

/* Hero */
.summary-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 330px; padding: clamp(58px, 8vw, 100px) clamp(18px, 4vw, 56px); display: grid; place-items: center; text-align: center; background: radial-gradient(circle at 50% 35%, rgba(104,216,255,.13), transparent 34%), linear-gradient(145deg,#24272c,#0e1013 72%); }
.summary-hero::before { content:""; position:absolute; inset: 12% 22%; z-index:-2; background:url("../images/ico_electrotechnique.svg") center/contain no-repeat; opacity:.12; filter: grayscale(1) brightness(2.2); }
.summary-hero::after { content:""; position:absolute; inset:0; z-index:-1; background:linear-gradient(180deg,rgba(0,0,0,.04),rgba(0,0,0,.42)); }
.hero-inner { width:min(100%, 860px); }
.hero-kicker { margin:0 0 12px; color:var(--accent); font-size:.78rem; font-weight:800; letter-spacing:.18em; text-transform:uppercase; }
.hero-title { margin:0; font-size:clamp(2.2rem,7vw,5rem); line-height:1; letter-spacing:-.045em; }
.hero-intro { max-width:680px; margin:20px auto 0; color:#bdc6d0; font-size:clamp(1rem,2vw,1.15rem); line-height:1.7; }

/* Layout */
.main { width:min(calc(100% - 32px), var(--page)); margin:0 auto; padding:clamp(30px,5vw,68px) 0; }
.container20 { display:grid; grid-template-columns:minmax(190px, 240px) minmax(0,1fr); grid-template-areas:"tabs toolbar" "tabs content"; gap:clamp(16px,2.4vw,30px); align-items:start; }
.tabs { grid-area:tabs; position:sticky; top:92px; display:flex; flex-direction:column; gap:8px; padding:14px; border:1px solid var(--line); border-radius:var(--radius); background:linear-gradient(145deg,#282d34,#20242a); box-shadow:0 18px 36px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.05); }
.tabs::before { content:"Catégories"; padding:8px 10px 12px; color:var(--muted); font-size:.76rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
.tab { width:100%; padding:12px 14px; border:1px solid transparent; border-radius:12px; color:#d8e0e9; background:transparent; text-align:left; font-weight:700; cursor:pointer; transition:.2s ease; }
.tab:hover { background:rgba(255,255,255,.06); color:#fff; }
.tab.active { color:#07151b; border-color:rgba(104,216,255,.5); background:var(--accent); }
.summary-toolbar { grid-area:toolbar; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface-glass); backdrop-filter:blur(14px); box-shadow:0 14px 30px rgba(0,0,0,.16); }
.toolbar-left,.toolbar-right { display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.toolbar-right label { color:var(--muted); font-size:.9rem; font-weight:700; }
.view-btn,.sort-select { min-height:42px; border:1px solid var(--line); border-radius:12px; color:var(--text); background:rgba(255,255,255,.055); }
.view-btn { width:44px; display:grid; place-items:center; cursor:pointer; }
.view-btn svg { width:20px; height:20px; fill:currentColor; }
.view-btn:hover,.sort-select:hover { border-color:rgba(104,216,255,.35); background:rgba(255,255,255,.08); }
.view-btn.active { color:#07151b; background:var(--accent); }
.sort-select { max-width:220px; padding:0 38px 0 13px; cursor:pointer; }
.sort-select option { color:#111; }
.tab-content { grid-area:content; min-width:0; }

/* Cartes */
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:clamp(16px,2vw,26px); }
.card { position:relative; min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:var(--radius); background:linear-gradient(145deg,#282d34,#20242a); box-shadow:0 12px 28px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.05); transition:transform .24s ease,border-color .24s ease,box-shadow .24s ease; }
.card:hover { transform:translateY(-5px); border-color:rgba(104,216,255,.34); box-shadow:0 20px 40px rgba(0,0,0,.28); }
.card > a { display:flex; height:100%; flex-direction:column; text-decoration:none; }
.card img { width:100%; height:clamp(145px,16vw,190px); object-fit:cover; background:#121419; }
.card-body { flex:1; padding:18px; }
.card-title { margin:0 0 8px; font-size:1.08rem; font-weight:800; line-height:1.25; }
.card-text { color:var(--muted); font-size:.92rem; line-height:1.5; }
.youtube-badge { position:absolute; top:12px; right:12px; z-index:2; width:34px; height:24px; display:grid; place-items:center; border-radius:8px; color:#fff; background:#e62117; box-shadow:0 6px 16px rgba(0,0,0,.35); pointer-events:none; }
.youtube-badge::before { content:"▶"; font-size:.72rem; transform:translateX(1px); }
.grid.list-mode { display:flex; flex-direction:column; gap:14px; }
.grid.list-mode .card > a { min-height:128px; flex-direction:row; }
.grid.list-mode .card img { width:210px; height:auto; flex:0 0 auto; }
.grid.list-mode .card-body { display:flex; flex-direction:column; justify-content:center; }

/* Aperçu retardé: bureau uniquement */
.hover-menu { position:fixed; display:none; z-index:200; width:min(320px,calc(100vw - 32px)); padding:12px; border:1px solid var(--line); border-radius:16px; background:rgba(27,31,37,.96); box-shadow:0 22px 55px rgba(0,0,0,.4); backdrop-filter:blur(16px); pointer-events:none; opacity:0; transform:translateY(8px) scale(.98); transition:opacity .22s ease, transform .22s ease; }
.hover-menu.visible { display:block; opacity:1; transform:none; }
.hover-menu img { width:100%; max-height:170px; object-fit:cover; border-radius:11px; }
.hover-menu p { margin:10px 4px 2px; color:#d7dee6; line-height:1.45; }

/* Footer */
.summary-footer { margin-top:clamp(40px,7vw,80px); border-top:1px solid var(--line); background:#111419; }
.footer-shell { width:min(calc(100% - 32px),var(--page)); margin:auto; min-height:92px; display:flex; align-items:center; justify-content:space-between; gap:20px; color:var(--muted); }
.breadcrumbs { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:.9rem; }
.breadcrumbs a { color:#dce4ec; text-decoration:none; }
.breadcrumbs a:hover { color:var(--accent); }
.breadcrumbs span { opacity:.5; }
.footer-home { padding:10px 14px; border:1px solid var(--line); border-radius:12px; color:#dce4ec; text-decoration:none; }
.footer-home:hover { border-color:rgba(104,216,255,.35); color:#fff; }

:focus-visible { outline:3px solid rgba(104,216,255,.65); outline-offset:3px; }

@media (max-width:900px) {
  .container20 { grid-template-columns:1fr; grid-template-areas:"tabs" "toolbar" "content"; }
  .tabs { position:static; flex-direction:row; overflow-x:auto; scrollbar-width:thin; }
  .tabs::before { display:none; }
  .tab { width:auto; flex:0 0 auto; text-align:center; }
}
@media (max-width:780px) {
  .nav-shell { min-height:62px; padding-inline:16px; flex-wrap:wrap; gap:0; }
  .nav-brand img { width:112px; }
  .nav-toggle { display:block; }
  .nav-links { display:none; width:100%; margin:0; padding:10px 0 16px; flex-direction:column; align-items:stretch; }
  .nav-links.is-open { display:flex; }
  .nav-links a { width:100%; padding:12px 14px; }
  .nav-links .nav-cta { text-align:center; margin-top:4px; }
}
@media (max-width:620px) {
  .main { width:min(calc(100% - 22px),var(--page)); padding-block:24px 42px; }
  .summary-hero { min-height:270px; padding:48px 16px; }
  .summary-toolbar { align-items:stretch; flex-direction:column; }
  .toolbar-left,.toolbar-right { justify-content:center; }
  .sort-select { flex:1; max-width:none; }
  .grid { grid-template-columns:1fr; }
  .grid.list-mode .card > a { flex-direction:column; }
  .grid.list-mode .card img { width:100%; height:170px; }
  .hover-menu { display:none!important; }
  .footer-shell { min-height:120px; padding-block:24px; flex-direction:column; justify-content:center; text-align:center; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; } }

/* Compatibility layer for all legacy subject summaries */
body.summary-modern { min-height: 100vh; overflow-x: hidden; }
.summary-modern .main { min-height: 50vh; }
.summary-modern .container20 { width: min(96vw, 1680px); margin: 0 auto; }
.summary-modern .tab-content { min-width: 0; }
.summary-modern .grid { align-items: stretch; }
.summary-modern .card > a { color: inherit; text-decoration: none; height: 100%; display: flex; flex-direction: column; }
.summary-modern .card img { width: 100%; object-fit: cover; }
.summary-modern .card-body { flex: 1; }
.summary-modern .hover-menu { z-index: 100; }
.summary-modern .summary-hero { min-height: clamp(190px, 26vw, 310px); }
.summary-modern .summary-hero .hero-inner { width: min(96vw, 1680px); }
.summary-modern .summary-footer { margin-top: clamp(24px, 4vw, 56px); }
@media (max-width: 760px) {
  .summary-modern .container20 { width: min(100% - 20px, 1680px); }
  .summary-modern .summary-hero .hero-inner { width: min(100% - 24px, 1680px); }
  .summary-modern .hover-menu { display: none !important; }
}
