/* ═══ ATLAS v24.4 (« v27 ») — structure lisible et pages soignées ═══ */

/* ── 1. Pôles à sous-onglets regroupés ───────────────────────────────── */
.v27-hub .v27-hub-groups { display: flex; flex-wrap: wrap; gap: .55rem .9rem; padding-bottom: .55rem; border-bottom: 1px solid var(--border); }
.v27-hg { display: flex; flex-direction: column; gap: .3rem; padding: .45rem .55rem .5rem; border-radius: 14px; border: 1px solid transparent; }
.v27-hg.is-on { background: var(--chip-bg); border-color: var(--border); }
.v27-hg-t { font: 650 .68rem/1.2 var(--font-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--dim); padding-left: .2rem; }
.v27-hg.is-on .v27-hg-t { color: var(--gold); }
.v27-hg-tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.v27-hg-tabs a { text-decoration: none !important; padding: .4rem .75rem; border-radius: 999px; border: 1px solid var(--border); color: var(--parch); font: 500 .84rem/1.2 var(--font-ui); background: var(--surface); white-space: nowrap; }
.v27-hg-tabs a:hover { border-color: var(--gold); }
.v27-hg-tabs a.is-on { background: var(--parch); border-color: var(--parch); color: var(--bg); font-weight: 700; }
.v27-hg-tabs a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) {
  .v27-hub .v27-hub-groups { flex-direction: column; gap: .25rem; }
  .v27-hg { flex-direction: row; align-items: flex-start; gap: .5rem; padding: .35rem .45rem; }
  .v27-hg-t { flex: 0 0 5.6rem; padding-top: .55rem; font-size: .62rem; }
  .v27-hg-tabs a { font-size: .8rem; padding: .38rem .65rem; white-space: normal; }
}
.v27-bc .v27-crumbs { margin: 0; }

/* ── 2. Pour aller plus loin ─────────────────────────────────────────── */
.v27-see { max-width: 1100px; margin: 1.6rem auto 1rem; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.v27-see h2 { font: 700 .74rem/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0 0 .7rem; }
.v27-see-l { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: .5rem; }
.v27-see-l a { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .65rem .8rem; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--parch); font: 550 .88rem/1.35 var(--font-ui); text-decoration: none !important; transition: border-color var(--dur, .18s), transform var(--dur, .18s); }
.v27-see-l a span { color: var(--gold); flex: none; }
.v27-see-l a:hover { border-color: var(--gold); transform: translateY(-1px); }
.v27-intro { max-width: 1000px; margin: 0 auto 1.4rem; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 14px; padding: 1rem 1.25rem; }
.v27-intro p { margin: 0; color: var(--parch); line-height: 1.65; }
.v27-intro a { color: var(--gold); }

/* ── 3. Arbre du vivant ──────────────────────────────────────────────── */
.v27-kings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: .6rem; margin: 1.1rem 0 .9rem; }
.v27-king { display: flex; align-items: center; gap: .7rem; text-align: left; cursor: pointer; padding: .75rem .85rem; border-radius: 14px; border: 1px solid var(--border); border-left: 4px solid var(--k); background: var(--card); color: var(--parch); font: inherit; transition: transform var(--dur, .18s), border-color var(--dur, .18s); }
.v27-king:hover { transform: translateY(-1px); border-color: var(--k); }
.v27-king .ic { font-size: 1.5rem; line-height: 1; }
.v27-king .t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.v27-king strong { font: 650 .92rem/1.25 var(--font-ui); }
.v27-king em { font: italic 400 .8rem/1.2 var(--font-body); color: var(--dim); }
.v27-king .n { font: 700 1.05rem var(--font-ui); color: var(--parch); font-variant-numeric: tabular-nums; }
.v27-tree-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .2rem 0 .6rem; }
.v27-filt { display: flex; flex-wrap: wrap; gap: .3rem; }
.v27-filt button { cursor: pointer; padding: .4rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--parch); font: 500 .82rem var(--font-ui); }
.v27-filt button[aria-pressed="true"] { background: var(--parch); color: var(--bg); border-color: var(--parch); font-weight: 700; }
.v27-arbre .tol-wrap > .phylo-intro { margin-top: 0 !important; padding: .7rem .9rem; border-radius: 14px; }
.v27-arbre .tol-wrap > .phylo-intro > .phylo-title,
.v27-arbre .tol-wrap > .phylo-intro > .phylo-sub,
.v27-arbre .tol-wrap > .phylo-intro > p:not(.tol-source),
.v27-arbre .tol-wrap > .phylo-intro > .phylo-legend { display: none !important; }
.v27-arbre .tol-tree { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: .4rem .2rem; }
.v27-flash { animation: v27flash 1.6s ease; border-radius: 8px; }
@keyframes v27flash { 0%, 60% { background: var(--chip-bg); box-shadow: 0 0 0 2px var(--gold) inset; } 100% { background: transparent; box-shadow: none; } }
.v27-cta { display: flex; align-items: center; gap: .9rem; margin: 1.2rem 0; padding: 1rem 1.15rem; border-radius: 16px; border: 1px solid var(--border); border-left: 4px solid #4a9d5e; background: var(--card); text-decoration: none !important; color: var(--parch); }
.v27-cta:hover { border-color: #4a9d5e; }
.v27-cta .ic { font-size: 2rem; }
.v27-cta .t { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.v27-cta strong { font: 700 1.05rem var(--font-title); color: var(--gold); }
.v27-cta .t span { font: 400 .88rem/1.45 var(--font-ui); color: var(--dim); }
.v27-cta .go { font-size: 1.3rem; color: var(--gold); }

/* ── 4. Pages de discipline ──────────────────────────────────────────── */
.v27-disc { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; }
.v27-toc { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 1.2rem; padding: .7rem .8rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); position: sticky; top: calc(var(--header-h, 64px) + 4px); z-index: 3; }
.v27-toc span { font: 650 .68rem var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-right: .2rem; }
.v27-toc a { padding: .3rem .65rem; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--parch); font: 500 .8rem var(--font-ui); text-decoration: none !important; }
.v27-toc a:hover { border-color: var(--gold); }
@media (max-width: 640px) { .v27-toc { position: static; } }
.v27-s { margin: 0 0 1.5rem !important; padding: 0 !important; border: 0 !important; }
.v27-s > h4 { display: flex; align-items: center; gap: .45rem; font: 700 1.15rem/1.3 var(--font-title) !important; color: var(--parch) !important; margin: 0 0 .7rem !important; padding: 0 0 .45rem !important; border-bottom: 1px solid var(--border) !important; scroll-margin-top: 90px; }
.v27-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: .6rem; }
.v27-it { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .75rem .85rem; position: relative; overflow: hidden; }
.v27-it::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--disc-c, var(--gold)); opacity: .75; }
.v27-it-t { font: 650 .95rem/1.3 var(--font-ui); color: var(--gold); margin: 0 0 .3rem; }
.v27-it-d { font: 400 .92rem/1.55 var(--font-body); color: var(--parch); }
.v26-disc[data-k="bio"] { --disc-c: #4a9d5e; } .v26-disc[data-k="chim"] { --disc-c: #6aa8e8; } .v26-disc[data-k="phys"] { --disc-c: #8a6fc0; }
.v26-disc[data-k="alim"] { --disc-c: #e0a53a; } .v26-disc[data-k="sante"] { --disc-c: #e06a8a; } .v26-disc[data-k="agri"] { --disc-c: #c8841a; }
.v27-case { margin: 0 0 1.5rem !important; }
.v27-case > div { background: var(--card) !important; border: 1px solid var(--border) !important; border-left: 4px solid #2e9e7a !important; border-radius: 14px !important; padding: 1rem 1.15rem !important; }
.v27-case > div > div:first-child { font: 700 1rem/1.35 var(--font-title); color: var(--parch); margin-bottom: .4rem; }
.v27-case > div > div:last-child { font: 400 .95rem/1.6 var(--font-body); color: var(--parch); }
.v27-refs ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.v27-refs li { padding: .5rem .7rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font: 400 .88rem/1.45 var(--font-body); color: var(--parch); }
.v27-rel { margin-top: .4rem; padding: .7rem .85rem !important; border-radius: 12px; background: var(--surface); border: 1px solid var(--border) !important; font: 500 .85rem/1.5 var(--font-ui) !important; color: var(--dim) !important; }
/* précédent / suivant côte à côte, même sur téléphone */
.v26-pn { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: .6rem !important; }
.v26-pn a { min-width: 0; }
.v26-pn small { display: block; }

/* ── 5. Simulateurs ──────────────────────────────────────────────────── */
.v27-theory { margin: 1.4rem 0 .6rem; border: 1px solid var(--border); border-radius: 16px; background: var(--card); overflow: hidden; }
.v27-theory > summary { cursor: pointer; list-style: none; padding: .9rem 1.1rem; font: 700 1rem var(--font-title); color: var(--parch); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.v27-theory > summary::-webkit-details-marker { display: none; }
.v27-theory > summary::after { content: "▾"; margin-left: auto; color: var(--gold); transition: transform var(--dur, .18s); }
.v27-theory[open] > summary::after { transform: rotate(180deg); }
.v27-theory > summary small { font: 400 .8rem var(--font-ui); color: var(--dim); }
.v27-theory-b { padding: 0 1.1rem 1.1rem; border-top: 1px solid var(--border); }
.v26-tool-body h3 { scroll-margin-top: 90px; }
/* en-tête de section sans pastille : le titre prend toute la largeur (« Autres outils du thème » coupé lettre à lettre) */
.v24s-sec-hd > div:first-child:not(.v24s-badge) { grid-column: 1 / -1; }
.v26-tool-body input[type=range] { accent-color: var(--gold); }
.v26-tool-body canvas { max-width: 100%; }
@media (max-width: 640px) {
  .v26-tool-body .msci-grid, .v26-tool-body .lab-body { grid-template-columns: 1fr !important; }
  .v26-tool-body table { font-size: .82rem; }
}

/* ── 6. Préférences de lecture ───────────────────────────────────────── */
html[data-v27-font="sans"] body, html[data-v27-font="sans"] .modal, html[data-v27-font="sans"] p, html[data-v27-font="sans"] li, html[data-v27-font="sans"] td, html[data-v27-font="sans"] dd { font-family: var(--font-ui) !important; }
html[data-v27-img="off"] #app-main img, html[data-v27-img="off"] .modal img, html[data-v27-img="off"] .fiche-gallery, html[data-v27-img="off"] .gal-item { display: none !important; }
html[data-v27-links="underline"] #app-main a:not(.a20-btn):not(.v24s-card):not(.v27-king), html[data-v27-links="underline"] .modal a:not(.a20-btn) { text-decoration: underline !important; text-underline-offset: 2px; }
.v27-kj { color: var(--dim); font-weight: 400; }
.v27-set-io { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.v27-kbd { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: .4rem 0 0; font: 400 .9rem var(--font-ui); }
.v27-kbd kbd { background: var(--kbd-bg); border: 1px solid var(--border); border-radius: 6px; padding: .1rem .45rem; font: 600 .8rem var(--font-mono); }

/* ── 7. Tableaux empilés sur téléphone ── */
@media (max-width: 640px) {
  table.v27-stack, table.v27-stack tbody { display: block; width: 100%; }
  table.v27-stack thead { display: none; }
  table.v27-stack tr { display: block; margin: 0 0 .6rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  table.v27-stack td { display: grid; grid-template-columns: 38% 1fr; gap: .6rem; padding: .3rem 0 !important; border: 0 !important; text-align: left !important; word-break: normal; overflow-wrap: anywhere; }
  table.v27-stack td::before { content: attr(data-label); font: 600 .72rem/1.4 var(--font-ui); letter-spacing: .04em; text-transform: uppercase; color: var(--dim); }
  table.v27-stack td:first-child { font-weight: 700; color: var(--gold); }
}
.v27-arbre #v24-tree-sci { display: none !important; }

/* ── 8. Accueil : pôles groupés comme le menu ── */
.v27-home-hubs { max-width: 1200px; margin: 0 auto 2.4rem; display: grid; gap: 1.3rem; }
.v27-hgrp h3 { font: 650 .72rem/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0 0 .55rem; padding-left: .2rem; }
.v27-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: .55rem; }
.v27-tile.hub-card { display: grid !important; grid-template-columns: 2.4rem 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center; text-align: left !important; padding: .75rem .85rem !important; min-height: 0 !important; }
.v27-tile .hub-icon { grid-row: 1 / 3; font-size: 1.45rem !important; margin: 0 !important; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 10px; background: var(--chip-bg); }
.v27-tile .hub-label { margin: 0 !important; font-size: 1rem !important; }
.v27-tile .hub-count { margin: 0 !important; font-size: .8rem !important; line-height: 1.35 !important; }
@media (max-width: 520px) {
  .v27-tiles { grid-template-columns: 1fr 1fr; }
  .v27-tile.hub-card { grid-template-columns: 1fr; padding: .65rem .7rem !important; }
  .v27-tile .hub-icon { grid-row: auto; width: 2rem; height: 2rem; font-size: 1.15rem !important; margin-bottom: .3rem !important; }
  .v27-tile .hub-label { font-size: .9rem !important; }
  .v27-tile .hub-count { font-size: .74rem !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ── 9. Barre de recherche des catégories : plus de grand vide sur téléphone ── */
.ctrl-bar .srch-wrap { flex-basis: auto !important; min-height: 0 !important; position: relative; }
@media (max-width: 760px) {
  .ctrl-bar { flex-direction: column; align-items: stretch !important; gap: .5rem !important; }
  .ctrl-bar .srch-wrap { flex: 0 0 auto !important; height: auto !important; }
  .ctrl-bar .srch-wrap .srch-icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); }
}

/* accessibilité : discipline courante lisible (contraste AA) */
.v26-sci-nav li a[aria-current="page"] { color: #10140f !important; }

/* v24.4 — disciplines : le simulateur intégré (canvas 702 px) ne doit plus élargir la page sur téléphone */
.v26-sci-layout > .v26-sci-main{min-width:0;max-width:100%;flex:1 1 0}
.v26-sci-main canvas{max-width:100%;height:auto}
.v26-sci-main .sim-ct,.v26-sci-main .sim-cw{max-width:100%;overflow-x:auto}

/* v24.4 — accessibilité : contrastes restants relevés par axe-core */
.risk-b.is-off{opacity:1;filter:grayscale(1);background:transparent;border-style:dashed;font-weight:600}
.v26-sci-nav li a[aria-current="page"]{background:#256f46 !important;color:#fff !important}
html.theme-is-light .tol-name{color:color-mix(in srgb,var(--tc) 70%,#000) !important}
html.theme-is-light .pedago-label{color:#7a4500 !important;font-size:.62rem}
html.theme-is-light .quiz-h{color:#5c3700 !important}
html.theme-is-light .ref-doi{color:#7a4500 !important}
.breadcrumb a,.v27-crumbs a{text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}
