/* Maquette Maths. Le cadre, le contenu et les autres navigations gardent leurs styles de page. */
#menu-maths {
    grid-column: 1 / -1;
    grid-row: 5;
    order: 7;
    align-self: start;
    justify-self: start;
    width: min(100%, 100vw);
    min-width: 0;
    position: relative;
    z-index: 12;
    background: linear-gradient(#79653a, #46391e);
    color: white;
    font: 15px/1.35 Arial, Helvetica, sans-serif;
    text-align: left;
}
#menu-maths, #menu-maths * { box-sizing: border-box; }
#menu-maths ul { list-style: none; padding: 0; margin: 0; text-align: left; font: inherit; }
#menu-maths li { padding: 0; margin: 0; }
#menu-maths [hidden] { display: none; }
#menu-maths summary, #menu-maths .maths-toggle {
    display: flex;
    align-items: center;
    gap: .55em;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 7px 12px;
    border: 0;
    color: white;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    list-style: none;
}
#menu-maths .maths-toggle[hidden] { display: none; }
#menu-maths summary::-webkit-details-marker { display: none; }
#menu-maths summary span { font: inherit; white-space: nowrap; }
#menu-maths summary::after, #menu-maths .maths-toggle::after {
    content: "";
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
}
#menu-maths details[open] > summary::after, #menu-maths .maths-toggle[aria-expanded="true"]::after {
    transform: translateY(2px) rotate(225deg);
}
#menu-maths details[open] > summary, #menu-maths summary:hover { background: #f8f5eb; color: #382e19; }
#menu-maths :focus-visible { outline: 3px solid #1b5d98; outline-offset: -3px; }
#menu-maths .maths-panel {
    background: #f8f5eb;
    color: #312a20;
    padding: 12px;
    border: 1px solid #ada48d;
    border-radius: 0 0 6px 6px;
    text-align: left;
}
#menu-maths .maths-title {
    margin: 0 0 10px;
    padding: 0 0 7px;
    border-bottom: 1px solid #d6cdb8;
    color: #812d23;
    font: bold 15px/1.35 Arial, sans-serif;
    text-align: left;
}
#menu-maths .maths-links {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(var(--cols, 1), minmax(0, auto));
    grid-template-rows: repeat(var(--rows, 1), auto);
    gap: 5px 8px;
}
#menu-maths .maths-column { display: contents; }
/* Dès que les colonnes d'origine tiennent, conserver leurs groupes de notions. */
#menu-maths .maths-links.source-columns { grid-auto-flow: row; grid-template-rows: auto; align-items: start; }
#menu-maths .source-columns > .maths-column { display: grid; gap: 5px; }
#menu-maths:not(.enhanced) .maths-links { display: flex; flex-wrap: wrap; }
#menu-maths .maths-links a {
    display: block;
    height: 100%;
    padding: 8px 10px;
    border: 1px solid #d6cebf;
    border-radius: 4px;
    background: #fff;
    color: #3b3224;
    font: 15px/20px Arial, Helvetica, sans-serif;
    text-align: left;
    overflow-wrap: anywhere;
    text-decoration: none;
}
#menu-maths .maths-links a:hover, #menu-maths .maths-links a:focus-visible {
    color: #71261d;
    background: #fff3d4;
    text-decoration: underline;
}
#menu-maths sup { font-size: .72em; line-height: 0; }
#menu-maths.enhanced:not(.compact) .maths-levels { display: flex; }
#menu-maths.enhanced:not(.compact) .maths-levels > li { flex: 1 0 auto; }
#menu-maths.enhanced:not(.compact) summary { justify-content: center; padding-inline: 5px; }
#menu-maths.enhanced:not(.compact) .maths-panel {
    position: absolute;
    inset-block-start: 100%;
    left: var(--panel-x, 0px);
    width: max-content;
    max-width: var(--available, 100%);
    box-shadow: 0 5px 12px #241b1933;
}
#menu-maths.compact .maths-toggle { font-weight: bold; }
#menu-maths .maths-toggle-icon { font: 22px/1 Arial, sans-serif; }
#menu-maths .maths-toggle::after { margin-inline-start: auto; }
#menu-maths.compact summary { justify-content: space-between; border-top: 1px solid #ffffff32; }
#menu-maths.compact .maths-links a { min-height: 44px; padding-block: 11px; }
#menu-maths.compact .maths-panel { width: 100%; }
#menu-maths .maths-panel.measuring {
    position: absolute !important;
    visibility: hidden;
    width: max-content !important;
    max-width: none !important;
}
@media print { #menu-maths { display: none; } }

