/**
 * assets/css/components.css
 * ===========================================================================
 * Sitewide chrome: header nav, footer, and the global preview modal.
 * ===========================================================================
 *
 * These three blocks used to be printed inline on EVERY page load — ~11.3 KB
 * of identical CSS re-sent with every HTML response, uncacheable, and (for
 * the modal) emitted at wp_footer so it parsed after first paint.
 *
 * Extracted here they are fetched once, cached by the browser, and served
 * from the CDN/page cache like any other static asset. Enqueued in
 * functions.php with a filemtime() cache-buster, so an edit still busts
 * the cache immediately.
 *
 * Depends on the token layer in design-system.css — enqueued as a
 * dependency, so load order is guaranteed.
 */


/* ===========================================================================
   2026 REDESIGN — TOKENS AND SHARED PIECES (owner, 2026-10-20)
   ===========================================================================
   The approved mockup (maquettes/accueil/) keeps the identity — the navy and
   the coral red of the logo — and adds a display face (Bricolage Grotesque,
   loaded with the sitewide fonts) and a handwritten one for the teacher's
   red-pen notes (Shantell Sans, home page only). These tokens serve the
   header, the footer, the home page (home.css) and the lesson / teacher
   pages (hubs.css). Prefix mh- (« Madrasty home ») so nothing collides with
   the older .mad-* / .madrasti-* classes. */
:root {
    --mh-bg: #F6F7FB;
    --mh-surface: #FFFFFF;
    --mh-ink: #0E1A4F;
    --mh-ink-2: #3B4672;
    --mh-ink-3: #5C6690;
    --mh-line: #E2E6F2;
    --mh-line-2: #CDD3E6;
    --mh-navy: #0F1C55;
    --mh-navy-deep: #0A1340;
    --mh-navy-2: #1C2B78;
    --mh-coral: #D42F22;
    --mh-coral-bright: #F0473A;
    --mh-coral-text: #BD2517;
    --mh-coral-soft: #FDECEA;
    --mh-violet: #6030D8;
    --mh-violet-soft: #EFE9FD;
    --mh-sky: #2F7ED8;
    --mh-sky-soft: #E7F0FC;
    --mh-sun: #F5A524;
    --mh-sun-soft: #FFF4DE;
    --mh-mint: #0E9A7D;
    --mh-mint-soft: #DFF6F0;
    --mh-on-dark: #F3F5FF;
    --mh-on-dark-2: #BAC2E8;
    --mh-dark-line: rgba(255, 255, 255, .13);
    --mh-seyes: rgba(84, 124, 205, .13);
    --mh-seyes-strong: rgba(84, 124, 205, .27);
    --mh-margin-red: #F09B92;
    --mh-display: "Bricolage Grotesque", "Inter", ui-sans-serif, system-ui, sans-serif;
    --mh-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mh-hand: "Shantell Sans", "Segoe Print", "Comic Sans MS", cursive;
    --mh-fs-h2: clamp(2.05rem, 1.2rem + 3.1vw, 3.65rem);
    --mh-max: 1240px;
    --mh-gutter: clamp(16px, 4vw, 40px);
    --mh-ease: cubic-bezier(.16, 1, .3, 1);
    --mh-shadow-lg: 0 40px 80px -40px rgba(14, 26, 79, .42), 0 10px 24px -14px rgba(14, 26, 79, .16);
}
/* Arabic pages (TranslatePress /ar/): the display face has no Arabic letters. */
:root[dir="rtl"], [dir="rtl"] { --mh-display: "Cairo", "Tajawal", "Inter", sans-serif; --mh-hand: "Cairo", sans-serif; }

.mh-wrap { max-width: calc(var(--mh-max) + 2 * var(--mh-gutter)); margin-inline: auto; padding-inline: var(--mh-gutter); }
.mh-i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mh-i.is-fill { fill: currentColor; stroke: none; }
[dir="rtl"] .mh-i.mh-go, [dir="rtl"] .mh-go { transform: scaleX(-1); }

.mh-btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 50px; padding: 0 24px; border-radius: 999px; border: 1.5px solid transparent; font: 600 .98rem/1 var(--mh-body); text-decoration: none; cursor: pointer; white-space: nowrap; transition: translate .3s var(--mh-ease), box-shadow .3s var(--mh-ease), background-color .2s, color .2s, border-color .2s; }
.mh-btn .mh-go { transition: transform .3s var(--mh-ease); }
.mh-btn:hover .mh-go { transform: translateX(4px); }
[dir="rtl"] .mh-btn:hover .mh-go { transform: scaleX(-1) translateX(4px); }
.mh-btn-primary { background: var(--mh-coral); color: #fff; box-shadow: 0 10px 24px -12px rgba(212, 47, 34, .75); }
.mh-btn-primary:hover { translate: 0 -2px; color: #fff; box-shadow: 0 18px 34px -14px rgba(212, 47, 34, .75); }
.mh-btn-dark { background: var(--mh-navy); color: #fff; box-shadow: 0 10px 24px -14px rgba(14, 26, 79, .8); }
.mh-btn-dark:hover { translate: 0 -2px; color: #fff; background: var(--mh-navy-2); }
.mh-btn-ghost { background: transparent; color: var(--mh-ink); border-color: var(--mh-line-2); }
.mh-btn-ghost:hover { border-color: var(--mh-ink); color: var(--mh-ink); translate: 0 -2px; }
.mh-btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.mh-btn-outline-light:hover { border-color: #fff; color: #fff; translate: 0 -2px; }
.mh-btn-sm { min-height: 42px; padding: 0 18px; font-size: .92rem; }
.mh-btn:focus-visible, .mh-tab:focus-visible { outline: 3px solid var(--mh-coral-bright); outline-offset: 3px; }

.mh-eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 700 .78rem/1 var(--mh-body); letter-spacing: .11em; text-transform: uppercase; color: var(--mh-coral-text); }
.mh-eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: currentColor; }
.mh-h2 { margin: 0; font: 760 var(--mh-fs-h2)/1.03 var(--mh-display); letter-spacing: -.035em; color: var(--mh-ink); text-wrap: balance; }
.mh-lead { margin: 0; font-size: clamp(1.03rem, .96rem + .35vw, 1.2rem); line-height: 1.6; color: var(--mh-ink-2); max-width: 58ch; }
.mh-head { display: grid; gap: 18px; max-width: 760px; margin-bottom: clamp(40px, 5vw, 68px); }
.mh-head-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; max-width: none; }
.mh-hand { font-family: var(--mh-hand); font-weight: 600; color: var(--mh-coral-text); line-height: 1.15; }

.mh-tabs { display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px; background: #fff; border: 1px solid var(--mh-line); box-shadow: 0 8px 20px -16px rgba(14, 26, 79, .5); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mh-tabs::-webkit-scrollbar { display: none; }
.mh-tab { border: 0; background: transparent; border-radius: 999px; padding: 10px 18px; min-height: 40px; font: 600 .92rem/1 var(--mh-body); color: var(--mh-ink-3); cursor: pointer; white-space: nowrap; transition: background-color .25s, color .25s; }
.mh-tab:hover { color: var(--mh-ink); }
.mh-tab[aria-selected="true"] { background: var(--mh-navy); color: #fff; }

/* A document as a sheet of paper — the « paper » variant of
   template-parts/document-card.php (home page, lesson and teacher pages). */
.mh-doc { display: block; text-decoration: none; color: var(--mh-ink); }
.mh-doc-paper { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 10px; background: #fff; box-shadow: 0 1px 0 rgba(14, 26, 79, .05), 0 22px 34px -24px rgba(14, 26, 79, .6); rotate: var(--tilt, 0deg); transition: rotate .5s var(--mh-ease), translate .5s var(--mh-ease), box-shadow .5s; isolation: isolate; }
.mh-doc-paper::before, .mh-doc-paper::after { content: ""; position: absolute; inset: 0; border-radius: 10px; background: #fff; border: 1px solid var(--mh-line); z-index: -1; transition: transform .5s var(--mh-ease); }
.mh-doc-paper::before { transform: rotate(-2deg) translate(-3px, 3px); }
.mh-doc-paper::after { transform: rotate(2.5deg) translate(4px, 5px); }
.mh-doc:hover .mh-doc-paper, .mh-doc:focus-visible .mh-doc-paper { rotate: 0deg; translate: 0 -8px; box-shadow: 0 1px 0 rgba(14, 26, 79, .05), 0 34px 50px -28px rgba(14, 26, 79, .7); }
.mh-doc:hover .mh-doc-paper::before { transform: rotate(-6deg) translate(-12px, 6px); }
.mh-doc:hover .mh-doc-paper::after { transform: rotate(6deg) translate(12px, 8px); }
.mh-doc-paper img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 10px; display: block; }
.mh-doc-lines { position: absolute; inset: 18% 14% auto; display: grid; gap: 10px; }
.mh-doc-lines i { display: block; height: 7px; border-radius: 4px; background: #E7EAF4; }
.mh-doc-lines i:nth-child(2) { width: 80%; } .mh-doc-lines i:nth-child(4) { width: 64%; }
.mh-doc-type { position: absolute; inset-inline-start: 10px; top: 10px; padding: 6px 10px; border-radius: 999px; font: 700 .68rem/1 var(--mh-body); letter-spacing: .07em; text-transform: uppercase; color: #fff; background: var(--mh-navy); }
.mh-doc-type.is-serie { background: var(--mh-violet); }
.mh-doc-type.is-devoir { background: var(--mh-coral); }
.mh-doc-type.is-exam { background: var(--mh-sun); color: var(--mh-navy-deep); }
.mh-doc-body { display: block; padding: 16px 2px 0; }
.mh-doc-title { display: block; font: 700 1.02rem/1.25 var(--mh-display); color: var(--mh-ink); }
.mh-doc-meta { display: block; color: var(--mh-ink-3); font-size: .86rem; margin-top: 4px; }
.mh-doc:focus-visible { outline: 3px solid var(--mh-coral-bright); outline-offset: 6px; border-radius: 12px; }

/* The head of every inner page (template-parts/page-head.php, 2026-10-21):
   the home page's notebook grid fading out from the top corner, a
   breadcrumb, the eyebrow, a display title, a lead, fact chips and the
   page's buttons — so a visitor leaving the home page lands on the same
   design wherever they go. .is-center for the hub pages (Examens &
   Concours, Cours particuliers, account forms). */
.mh-pagehead { position: relative; isolation: isolate; padding-block: clamp(26px, 4.5vw, 60px) clamp(26px, 4vw, 48px); }
.mh-pagehead::before { content: ""; position: absolute; inset: -120px 0 0; z-index: -1; background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--mh-seyes-strong) 31px 32px), repeating-linear-gradient(to right, transparent 0 31px, var(--mh-seyes) 31px 32px); -webkit-mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000 10%, transparent 70%); opacity: .6; pointer-events: none; }
.mh-pagehead.is-center { text-align: center; }
.mh-pagehead.is-center::before { -webkit-mask-image: radial-gradient(ellipse 60% 90% at 50% 10%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse 60% 90% at 50% 10%, #000 10%, transparent 70%); }
.mh-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; font-size: .88rem; color: var(--mh-ink-3); }
.mh-crumbs a { color: var(--mh-ink-2); text-decoration: none; }
.mh-crumbs a:hover { color: var(--mh-coral-text); text-decoration: underline; }
.mh-pagehead.is-center .mh-crumbs { justify-content: center; }
.mh-pagehead-title { margin: 16px 0 0; max-width: 22ch; font: 800 clamp(2.1rem, 1.2rem + 3.8vw, 4.4rem)/1.02 var(--mh-display); letter-spacing: -.04em; color: var(--mh-ink); text-wrap: balance; }
.mh-pagehead-title.is-long { max-width: 30ch; font-size: clamp(1.75rem, 1.15rem + 2.4vw, 3rem); line-height: 1.08; letter-spacing: -.03em; }
.mh-pagehead.is-center .mh-pagehead-title { margin-inline: auto; }
.mh-pagehead-lead { margin: 18px 0 0; max-width: 62ch; font-size: clamp(1.03rem, .96rem + .35vw, 1.2rem); line-height: 1.6; color: var(--mh-ink-2); }
.mh-pagehead.is-center .mh-pagehead-lead { margin-inline: auto; }
.mh-pagehead-lead a { color: var(--mh-coral-text); text-decoration: underline; text-underline-offset: 3px; }
.mh-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.mh-facts > * { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--mh-line); font: 600 .88rem/1 var(--mh-body); color: var(--mh-ink-2); }
.mh-facts .mh-i, .mh-facts svg { width: 1.05em; height: 1.05em; color: var(--mh-coral-text); }
.mh-pagehead.is-center .mh-facts, .mh-pagehead.is-center .mh-pagehead-actions { justify-content: center; }
.mh-pagehead-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.mh-pagehead-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 20px; font-size: .9rem; color: var(--mh-ink-3); }
.mh-pagehead-meta > * { display: inline-flex; align-items: center; gap: 8px; }
.mh-pagehead-meta svg { width: 16px; height: 16px; flex: none; }
.mh-pagehead-meta a { color: var(--mh-ink); font-weight: 600; text-decoration: none; }
.mh-pagehead-meta a:hover { color: var(--mh-coral-text); text-decoration: underline; }
.mh-pagehead.is-center .mh-pagehead-meta { justify-content: center; }
:root[dir="rtl"] .mh-pagehead-title, [dir="rtl"] .mh-pagehead-title { letter-spacing: 0; line-height: 1.3; }
@media (max-width: 600px) {
    .mh-pagehead-actions .mh-btn { flex: 1 1 auto; }
}

/* A document card of the lists — the default variant of
   template-parts/document-card.php and its JS twin renderCards()
   (madrasti-ajax.js), on the library, the Espace Enseignant and the
   concours papers. Written once here since 2026-10-21 (each of those three
   templates carried its own copy), in the home page's design: the type
   badge coloured like the home page's sheets (.mh-doc-type), the title in
   the display face, a navy pill to open it — coral stays for the one action
   of a page (télécharger, rechercher). */
.madrasti-doc-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; transition: translate .45s var(--mh-ease), box-shadow .45s var(--mh-ease), border-color .2s; }
.madrasti-doc-card:hover, .madrasti-doc-card:focus-within { translate: 0 -5px; border-color: var(--mh-line-2); box-shadow: 0 30px 48px -32px rgba(14, 26, 79, .62); }
.madrasti-doc-card .madrasti-doc-thumb img { transition: transform .6s var(--mh-ease); }
.madrasti-doc-card:hover .madrasti-doc-thumb img { transform: scale(1.04); }
.madrasti-doc-thumb { position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--mh-bg); border-bottom: 1px solid var(--mh-line); }
.madrasti-doc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.madrasti-doc-thumb-icon { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: var(--mh-bg); color: var(--mh-line-2); }
.madrasti-doc-thumb-icon svg { width: 30%; height: 30%; max-width: 56px; max-height: 56px; }
.madrasti-doc-thumb-badge { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 20px); padding: 6px 11px; border-radius: 999px; background: var(--mh-navy); color: #fff; font: 700 .68rem/1 var(--mh-body); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.madrasti-doc-thumb-badge svg { display: none; }
.madrasti-doc-thumb-badge.is-serie { background: var(--mh-violet); }
.madrasti-doc-thumb-badge.is-devoir { background: var(--mh-coral); }
.madrasti-doc-thumb-badge.is-exam { background: var(--mh-sun); color: var(--mh-navy-deep); }
.madrasti-doc-content { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.madrasti-doc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.madrasti-doc-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 8px; font: 700 1.12rem/1.3 var(--mh-display); letter-spacing: -.015em; color: var(--mh-ink); }
.madrasti-doc-title a { color: inherit; text-decoration: none; }
.madrasti-doc-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.madrasti-doc-card { position: relative; }
.madrasti-doc-title a:hover { color: var(--mh-coral-text); }
.madrasti-doc-footer { margin-block-start: auto; padding-top: 14px; border-top: 1px solid var(--mh-line); }
.madrasti-doc-author { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.madrasti-doc-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--mh-violet-soft); color: var(--mh-violet); font-size: 11px; font-weight: 700; }
.madrasti-doc-author-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .82rem; font-weight: 600; color: var(--mh-ink-2); }
.madrasti-doc-stats { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.madrasti-doc-downloads, .madrasti-doc-meta { font-size: .8rem; color: var(--mh-ink-3); }
.madrasti-doc-cta { position: relative; z-index: 1; display: inline-flex; align-items: center; flex-shrink: 0; min-height: 36px; padding: 0 16px; border-radius: 999px; background: var(--mh-navy); color: #fff; font: 600 .82rem/1 var(--mh-body); text-decoration: none; transition: background-color .2s; }
.madrasti-doc-cta:hover { background: var(--mh-navy-2); color: #fff; }
.madrasti-doc-tags .mad-tag, .madrasti-doc-author { position: relative; z-index: 1; }


/* ===========================================================================
   HEADER / PRIMARY NAVIGATION — a floating capsule (2026 redesign)
   ===========================================================================
   Same markup and behaviour as before (header.php; the drop-downs of
   madrasti_nav_submenus(), the phone menu, the account zone — e2e-navmenu
   and e2e-accounts test them): only the look changed. The bar is a capsule
   floating over the page, more opaque once the page scrolls. */

/* .mad-skip-link itself is defined once, in design-system.css, with logical
   properties — do not redefine it here. */

/* Anchors land under the floating capsule, not behind it. */
html { scroll-padding-top: 96px; }

.madrasti-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: calc(var(--mad-z-nav) + 1); background: linear-gradient(90deg, var(--mh-coral-bright), var(--mh-sun)); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
[dir="rtl"] .madrasti-progress { transform-origin: 100% 50%; }

.madrasti-nav {
    position: sticky;
    top: 0;
    z-index: var(--mad-z-nav);
    padding: 12px var(--mh-gutter) 0;
    background: transparent;
    transition: padding .35s var(--mh-ease);
}
.madrasti-nav.is-scrolled { padding-top: 8px; }
.madrasti-nav-inner {
    max-width: 1340px;
    margin: 0 auto;
    height: 66px;
    padding: 0 8px 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(14, 26, 79, .08);
    box-shadow: 0 10px 30px -24px rgba(14, 26, 79, .5);
    transition: height .35s var(--mh-ease), box-shadow .35s, background-color .35s;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .madrasti-nav-inner { background: rgba(255, 255, 255, .74); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); }
    .madrasti-nav.is-scrolled .madrasti-nav-inner { background: rgba(255, 255, 255, .9); }
}
.madrasti-nav.is-scrolled .madrasti-nav-inner { height: 58px; box-shadow: 0 18px 40px -24px rgba(14, 26, 79, .45); }
.madrasti-nav-brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.madrasti-nav-logo-img { height: 48px; width: auto; flex-shrink: 0; display: block; transition: height .35s var(--mh-ease); }
.madrasti-nav.is-scrolled .madrasti-nav-logo-img { height: 42px; }

.madrasti-nav-links { display: flex; align-items: center; gap: 0; margin-inline: auto; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.madrasti-nav-links::-webkit-scrollbar { display: none; }
.madrasti-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 11px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--mh-ink-2);
    font: 500 .88rem/1 var(--mh-body);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color .2s, color .2s;
}
.madrasti-nav-links .madrasti-nav-link svg { display: none; }
.madrasti-nav-link:hover { background: rgba(14, 26, 79, .05); color: var(--mh-ink); }
.madrasti-nav-link.is-active { color: var(--mh-ink); font-weight: 600; }
.madrasti-nav-links .madrasti-nav-link.is-active::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--mh-coral-bright); }
.madrasti-nav-link.is-disabled { cursor: default; color: var(--mad-ink-400); }
.madrasti-nav-link.is-disabled:hover { background: transparent; color: var(--mad-ink-400); }
.madrasti-nav-link.is-disabled em { font-style: normal; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; background: var(--mad-ink-100); color: var(--mad-ink-500); padding: 2px 6px; border-radius: 999px; margin-inline-start: 2px; }
/* The bar was sized for seven plain pills: on the bar, « Bientôt » is a dot
   (title="Bientôt disponible" on the link); the word stays in the phone menu. */
.madrasti-nav-links .madrasti-nav-link.is-disabled em { width: 4px; height: 4px; padding: 0; border-radius: 50%; overflow: hidden; text-indent: -999px; background: var(--mad-ink-400); }

/* Account zone: « Se connecter » / « S'inscrire », or the bell and the initial. */
.madrasti-nav-account { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-inline-start: auto; }
.madrasti-nav-links + .madrasti-nav-account { margin-inline-start: 0; }
.madrasti-nav-account .mad-btn { white-space: nowrap; }
.madrasti-nav-login.mad-btn { min-height: 42px; border-radius: 999px; border: 1.5px solid var(--mh-line-2); background: transparent; color: var(--mh-ink); box-shadow: none; }
.madrasti-nav-login.mad-btn:hover { border-color: var(--mh-ink); background: transparent; color: var(--mh-ink); }
.madrasti-nav-join { display: none; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; background: var(--mh-coral); color: #fff; font: 600 .9rem/1 var(--mh-body); text-decoration: none; white-space: nowrap; box-shadow: 0 10px 24px -12px rgba(212, 47, 34, .75); transition: translate .3s var(--mh-ease); }
.madrasti-nav-join:hover { color: #fff; translate: 0 -1px; }
@media (min-width: 1360px) { .madrasti-nav-join { display: inline-flex; } }
.madrasti-nav-icon-btn { position: relative; width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 999px; color: var(--mh-ink-2); text-decoration: none; transition: background-color .2s, color .2s; }
.madrasti-nav-icon-btn:hover { background: rgba(14, 26, 79, .06); color: var(--mh-ink); }
.madrasti-nav-icon-btn svg { width: 21px; height: 21px; }
.madrasti-nav-badge { position: absolute; inset-block-start: 4px; inset-inline-end: 3px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--mh-coral); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 1; box-shadow: 0 0 0 2px #fff; }
.madrasti-nav-avatar { width: 40px; height: 40px; margin-inline: 2px; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--mh-navy-2), var(--mh-violet)); color: #fff; font: 800 15px/1 var(--mh-body); text-decoration: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--mh-line-2); transition: box-shadow .2s; }
.madrasti-nav-avatar:hover { color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--mh-coral-bright); }
.madrasti-nav-compact { display: none; }

.madrasti-nav-toggle { display: none; width: 48px; height: 48px; border-radius: 999px; border: 0; background: var(--mh-navy); color: #fff; cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; }
.madrasti-nav-toggle svg { width: 20px; height: 20px; color: #fff; }
.madrasti-nav-toggle[aria-expanded="true"] { background: var(--mh-coral); }

/* Drop-downs (header.php, madrasti_nav_submenus()): a few entries per section,
   on hover after 70 ms and on keyboard focus (Escape closes). */
.madrasti-nav-item { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.madrasti-nav-menu { position: absolute; top: 100%; inset-inline-start: -8px; z-index: 2; padding-top: 18px; opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); transform-origin: 20% 0; transition: opacity 110ms ease-in, transform 110ms ease-in, visibility 0s linear 110ms; }
.madrasti-nav-item.is-end .madrasti-nav-menu { inset-inline-start: auto; inset-inline-end: -8px; transform-origin: 80% 0; }
.madrasti-nav-item.has-menu:hover .madrasti-nav-menu,
.madrasti-nav-item.has-menu:focus-within .madrasti-nav-menu { opacity: 1; visibility: visible; transform: none; transition: opacity 180ms var(--mh-ease) 70ms, transform 260ms var(--mh-ease) 70ms, visibility 0s linear 70ms; }
.madrasti-nav-item.has-menu.is-closed .madrasti-nav-menu { opacity: 0; visibility: hidden; }
.madrasti-nav-item.has-menu:hover > .madrasti-nav-link,
.madrasti-nav-item.has-menu:focus-within > .madrasti-nav-link { background: rgba(14, 26, 79, .06); color: var(--mh-ink); }
.madrasti-nav-menu-box { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--mh-line); border-radius: 20px; box-shadow: 0 30px 60px -24px rgba(14, 26, 79, .38), 0 2px 8px rgba(14, 26, 79, .05); }
.madrasti-nav-menu-groups { display: flex; align-items: stretch; padding: 8px; }
.madrasti-nav-menu-group { min-width: 0; }
.madrasti-nav-menu-group.is-rich { width: 300px; }
.madrasti-nav-menu-group.is-list { width: 236px; }
.madrasti-nav-menu-group + .madrasti-nav-menu-group { margin-inline-start: 8px; padding-inline-start: 8px; border-inline-start: 1px solid var(--mh-line); }
.madrasti-nav-menu-heading { margin: 0; padding: 8px 12px 6px; font: 700 11px/1.2 var(--mh-body); letter-spacing: .08em; text-transform: uppercase; color: var(--mh-ink-3); }
.madrasti-nav-menu-items { list-style: none; margin: 0; padding: 0; }
.madrasti-nav-menu-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 14px; color: var(--mh-ink); text-decoration: none; transition: background-color 120ms ease, color 120ms ease; }
.madrasti-nav-menu-group.is-list .madrasti-nav-menu-item { gap: 10px; min-height: 40px; padding: 7px 12px; }
.madrasti-nav-menu-item:hover { background: var(--mh-bg); }
.madrasti-nav-menu-item:focus-visible { outline: 2px solid var(--mh-coral-bright); outline-offset: -2px; background: var(--mh-bg); }
.madrasti-nav-menu-badge, .madrasti-nav-menu-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; background: var(--mh-coral-soft); color: var(--mh-coral-text); transition: background-color 120ms ease, color 120ms ease; }
.madrasti-nav-menu-badge { padding: 0 3px; font: 800 11px/1.05 var(--mh-display); text-align: center; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.madrasti-nav-menu-icon svg { width: 19px; height: 19px; }
.madrasti-nav-menu-group.is-list .madrasti-nav-menu-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--mh-bg); color: var(--mh-ink-2); }
.madrasti-nav-menu-group.is-list .madrasti-nav-menu-icon svg { width: 16px; height: 16px; }
.madrasti-nav-menu-item:hover .madrasti-nav-menu-badge, .madrasti-nav-menu-item:hover .madrasti-nav-menu-icon,
.madrasti-nav-menu-item:focus-visible .madrasti-nav-menu-badge, .madrasti-nav-menu-item:focus-visible .madrasti-nav-menu-icon { background: var(--mh-coral); color: #fff; }
.madrasti-nav-menu-text { display: flex; flex-direction: column; min-width: 0; }
.madrasti-nav-menu-label { font: 650 14px/1.3 var(--mh-body); color: var(--mh-ink); }
.madrasti-nav-menu-group.is-list .madrasti-nav-menu-label { font-size: 13.5px; font-weight: 600; color: var(--mh-ink-2); }
.madrasti-nav-menu-item:hover .madrasti-nav-menu-label { color: var(--mh-coral-text); }
.madrasti-nav-menu-desc { margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: var(--mh-ink-3); }
.madrasti-nav-menu-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 20px; border-top: 1px solid var(--mh-line); background: var(--mh-bg); }
.madrasti-nav-menu-all { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; white-space: nowrap; font: 700 13px/1 var(--mh-body); color: var(--mh-coral-text); text-decoration: none; }
.madrasti-nav-menu-all svg { width: 15px; height: 15px; transition: transform 120ms ease; }
.madrasti-nav-menu-all:hover svg { transform: translateX(3px); }
[dir="rtl"] .madrasti-nav-menu-all svg { transform: scaleX(-1); }
[dir="rtl"] .madrasti-nav-menu-all:hover svg { transform: scaleX(-1) translateX(3px); }
.madrasti-nav-menu-cta { display: inline-flex; flex: 1 0 100%; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--mh-navy); color: #fff; font: 700 12.5px/1 var(--mh-body); text-decoration: none; white-space: nowrap; }
.madrasti-nav-menu-cta:hover { background: var(--mh-navy-2); color: #fff; }
.madrasti-nav-menu-cta svg { width: 15px; height: 15px; }
.madrasti-nav-menu-all:focus-visible, .madrasti-nav-menu-cta:focus-visible { outline: 2px solid var(--mh-coral-bright); outline-offset: 2px; border-radius: 8px; }
@media (min-width: 1201px) { .madrasti-nav-links { overflow: visible; } }

/* Phone menu: a card under the capsule, the same entries under a chevron. */
.madrasti-nav-mobile { display: none; flex-direction: column; gap: 4px; max-width: 1340px; margin: 10px auto 0; padding: 12px; border-radius: 24px; background: #fff; border: 1px solid var(--mh-line); box-shadow: var(--mh-shadow-lg); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.madrasti-nav-mobile.is-open { display: flex; animation: madrasti-menu-in 320ms var(--mh-ease) both; }
@keyframes madrasti-menu-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.madrasti-nav-mobile .madrasti-nav-link { border-radius: 14px; padding: 13px 14px; font: 650 1rem/1.2 var(--mh-display); color: var(--mh-ink); }
.madrasti-nav-mobile .madrasti-nav-link svg { width: 18px; height: 18px; color: var(--mh-coral-text); }
.madrasti-nav-mobile .madrasti-nav-link.is-active { background: var(--mh-coral-soft); }
.madrasti-nav-mobile-item { display: flex; align-items: center; gap: 6px; }
.madrasti-nav-mobile-item .madrasti-nav-link { flex: 1; min-width: 0; }
.madrasti-nav-mobile-more { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--mh-line); border-radius: 999px; background: #fff; color: var(--mh-ink-2); cursor: pointer; }
.madrasti-nav-mobile-more svg { width: 18px; height: 18px; transition: transform .25s var(--mh-ease); }
.madrasti-nav-mobile-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.madrasti-nav-mobile-sub { margin: 2px 0 8px; border: 1px solid var(--mh-line); border-radius: 16px; background: #fff; overflow: hidden; }
.madrasti-nav-mobile-sub[hidden] { display: none; }
.madrasti-nav-mobile-sub .madrasti-nav-menu-groups { flex-direction: column; padding: 6px; }
.madrasti-nav-mobile-sub .madrasti-nav-menu-group { width: auto; }
.madrasti-nav-mobile-sub .madrasti-nav-menu-group + .madrasti-nav-menu-group { margin: 6px 0 0; padding: 6px 0 0; border-inline-start: 0; border-top: 1px solid var(--mh-line); }
.madrasti-nav-mobile-sub .madrasti-nav-menu-foot { padding: 8px 14px; flex-wrap: wrap; }
.madrasti-nav-mobile-account { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-block-start: 8px; padding-block-start: 12px; border-block-start: 1px solid var(--mh-line); }
.madrasti-nav-mobile-account .mad-btn { border-radius: 999px; min-height: 48px; }

@media (max-width: 1200px) {
    .madrasti-nav-links, .madrasti-nav-cta, .madrasti-nav-login { display: none; }
    .madrasti-nav-toggle { display: inline-flex; }
    .madrasti-nav-compact { display: inline-grid; }
    .madrasti-nav-inner { padding-inline-start: 14px; }
}
@media (max-width: 480px) {
    .madrasti-nav { padding-top: 8px; }
    .madrasti-nav-inner { height: 60px; padding-inline-end: 6px; }
    .madrasti-nav-logo-img { height: 42px; }
}
@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: scroll()) {
        .madrasti-progress { animation: madrasti-progress linear both; animation-timeline: scroll(root); }
        @keyframes madrasti-progress { to { transform: scaleX(1); } }
    }
}
@media (prefers-reduced-motion: reduce) {
    .madrasti-nav-menu, .madrasti-nav-item.has-menu:hover .madrasti-nav-menu, .madrasti-nav-item.has-menu:focus-within .madrasti-nav-menu { transform: none; transition: none; }
    .madrasti-nav-mobile.is-open { animation: none; }
}


/* ===========================================================================
   SHORTCODE FALLBACK LINKS  (inc/shortcodes.php)
   =========================================================================== */
.madrasti-shortcode-link { margin-block: var(--mad-space-6); }

/* ===========================================================================
   FOOTER (2026 redesign): night navy, four columns, the brand as a giant
   outlined word under them.
   =========================================================================== */

.madrasti-footer { position: relative; overflow: hidden; margin-top: 0; background: var(--mh-navy-deep); color: var(--mh-on-dark-2); }
.madrasti-footer::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--mh-coral-bright), var(--mh-sun), var(--mh-violet)); }
.madrasti-footer a { color: var(--mh-on-dark-2); text-decoration: none; transition: color .2s; }
.madrasti-footer a:hover { color: #fff; }
.madrasti-footer-inner { position: relative; max-width: calc(var(--mh-max) + 2 * var(--mh-gutter)); margin: 0 auto; padding: clamp(56px, 8vw, 96px) var(--mh-gutter) 0; }
.madrasti-footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; }
@media (min-width: 760px) { .madrasti-footer-grid { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); } }
.madrasti-footer-brand { display: flex; align-items: center; margin-bottom: 16px; }
.madrasti-footer-logo-img { height: 64px; width: auto; display: block; }
.madrasti-footer-desc { margin: 0; max-width: 36ch; font-size: .95rem; line-height: 1.7; }
.madrasti-footer-heading { margin: 0 0 16px; font: 700 .78rem/1 var(--mh-body); letter-spacing: .1em; text-transform: uppercase; color: #fff; }
.madrasti-footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.madrasti-footer-links a { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; }
.madrasti-footer-links svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--mh-coral-bright); opacity: .85; }
.madrasti-footer-word { margin: clamp(40px, 6vw, 70px) 0 0; font: 800 clamp(4rem, 2rem + 13vw, 13rem)/.8 var(--mh-display); letter-spacing: -.06em; text-align: center; white-space: nowrap; color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .14); background: linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 80%); -webkit-background-clip: text; background-clip: text; user-select: none; }
.madrasti-footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 22px calc(22px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--mh-dark-line); font-size: .85rem; }
.madrasti-footer-bottom-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; list-style: none; margin: 0; padding: 0; font-size: .85rem; }


/* ===========================================================================
   GLOBAL DOCUMENT PREVIEW MODAL
   =========================================================================== */

.madrasti-preview-modal {
    position: fixed;
    inset: 0;
    z-index: var(--mad-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    font-family: var(--mad-font-latin);
}
.madrasti-preview-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.madrasti-preview-modal-backdrop {
    position: absolute;
    inset: 0;
    /* Fixed dark scrim, not a surface token — a modal backdrop is the same
       darkening layer regardless of site theme. */
    background: rgba(15, 23, 42, 0.6);
}
.madrasti-preview-modal-dialog {
    position: relative;
    background: var(--mad-surface);
    border-radius: var(--mad-r-xl);
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--mad-shadow-xl);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease;
    overflow: hidden;
}
.madrasti-preview-modal.is-open .madrasti-preview-modal-dialog {
    transform: translateY(0) scale(1);
}
.madrasti-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--mad-border);
    flex-shrink: 0;
}
.madrasti-preview-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--mad-text-strong);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 44x44 touch target (was 32x32) — the visible rounded-square glyph stays
   compact, centred inside the larger hit area via flex. */
.madrasti-preview-modal-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mad-r-md);
    border: none;
    background: var(--mad-surface-sunken);
    color: var(--mad-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.madrasti-preview-modal-close:hover {
    background: var(--mad-ink-200);
}
.madrasti-preview-modal-body {
    flex: 1;
    min-height: 0;
    background: var(--mad-surface-sunken);
}
.madrasti-preview-modal-iframe {
    width: 100%;
    height: 100%;
    min-height: 60vh;
    border: 0;
    display: block;
}
.madrasti-preview-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--mad-border);
    flex-shrink: 0;
}
.madrasti-preview-modal-btn {
    flex: 1;
    text-align: center;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.madrasti-preview-modal-btn-ghost {
    background: var(--mad-surface-sunken);
    color: var(--mad-text-default);
}
.madrasti-preview-modal-btn-ghost:hover {
    background: var(--mad-ink-200);
    color: var(--mad-text-default);
}
.madrasti-preview-modal-btn-solid {
    background: var(--mad-cta-bg);
    color: var(--mad-cta-text);
}
.madrasti-preview-modal-btn-solid:hover {
    background: var(--mad-cta-bg-hover);
    color: var(--mad-cta-text);
}
/* ID selector so this always wins over the per-template .btn-madrasti-download
   rules (each page defines its own — sidebar CTA, card footer button, etc.)
   regardless of CSS source order; the shared class stays only so the
   existing sitewide download-counter click listener still recognizes it. */
#madrasti-preview-modal-download {
    width: auto;
    padding: 11px 16px;
    font-size: 13px;
    border-radius: 10px;
    box-shadow: none;
    background: var(--mad-cta-bg);
    color: var(--mad-cta-text);
}
#madrasti-preview-modal-download:hover {
    background: var(--mad-cta-bg-hover);
    color: var(--mad-cta-text);
}
@media (max-width: 640px) {
    .madrasti-preview-modal-footer {
        flex-direction: column;
    }
    .madrasti-preview-modal-btn {
        width: 100%;
    }
}

/* ===========================================================================
   THIRD-PARTY PLUGIN COMPATIBILITY — TranslatePress language switcher
   ===========================================================================
   Not part of this theme's own markup — TranslatePress renders it on every
   front-end page as a `position:fixed; z-index:99999` box, positioned via
   inline custom properties the plugin writes from its own admin settings
   (currently --bottom:0px; --right:10vw, i.e. flush against the bottom
   edge with no gap). Left at its defaults this is a permanent, unstyled
   white box with default flag icons sitting on top of whatever real content
   is in that corner on EVERY page view — on mobile specifically, "flush
   with the bottom edge" also means it can sit under/behind iOS's home-
   indicator gesture bar or Android's nav bar, since nothing accounts for
   the safe-area inset. This overrides the plugin's own inline custom
   properties (a stylesheet rule needs `!important` to beat an inline
   style's non-important declaration — this is not fighting a hack, that's
   the normal way to override a plugin-injected inline style) rather than
   disabling the switcher: multilingual (FR/AR) access is a real, needed
   feature, it just needs to look like it belongs to this site and stay
   clear of real content and the device's own safe areas. */
.trp-floating-switcher {
    --bottom: max(16px, env(safe-area-inset-bottom)) !important;
    --right: 16px !important;
    --border-radius: 999px !important;
    --border: 1px solid var(--mad-border) !important;
    --bg: var(--mad-surface) !important;
    --bg-hover: var(--mad-surface-alt) !important;
    --text: var(--mad-text-strong) !important;
    --switcher-padding: 8px !important;
}
@media (max-width: 640px) {
    /* Smaller footprint specifically on mobile, where thumb-reachable
       screen space is scarce and this is the one page region most likely
       to also hold a real CTA (the hero's floating stat bar, a document
       card's own bottom edge) scrolling underneath it. */
    .trp-floating-switcher {
        --right: 12px !important;
        --flag-size: 16px !important;
        --font-size: 12.5px !important;
    }
}
/* Cours Interactif packs far more thumb-reachable interactive surface
   (phase tabs, answer options, "Valider" buttons, the lesson-launch CTA
   itself) into that same bottom-right corner than any other page in the
   site, so even the shrink above still left a ~120px-wide label sitting
   on top of real content on every scroll position. Only on this template,
   drop to a flag-only circular tap target: the label text is still
   removed via a plain CSS display:none (not JS), and --switcher-width is
   the same inline custom property already being overridden above, just
   forced smaller here too — same override mechanism, just page-scoped. */
@media (max-width: 640px) {
    body.page-template-page-cours-interactif-php .trp-floating-switcher {
        --switcher-width: 40px !important;
        --switcher-padding: 0 !important;
        height: 40px !important;
    }
    body.page-template-page-cours-interactif-php .trp-language-item-name {
        display: none !important;
    }
    body.page-template-page-cours-interactif-php .trp-language-item__current {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
    }
}

/* ===========================================================================
   COOKIE CONSENT BANNER (assets/js/madrasti-consent.js)
   position: fixed, so it never moves page content — zero layout shift.
   "Refuser" and "Accepter" share one size and weight on purpose: declining
   must be as easy as accepting.
   =========================================================================== */

.madrasti-consent {
    position: fixed;
    inset-inline: 16px;
    bottom: 16px;
    z-index: var(--mad-z-toast);
    max-width: 760px;
    margin-inline: auto;
    padding: 16px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    background: var(--mad-surface);
    color: var(--mad-ink-800);
    border: 1px solid var(--mad-border);
    border-radius: var(--mad-r-lg);
    box-shadow: var(--mad-shadow-lg);
}
.madrasti-consent-body { flex: 1 1 320px; min-width: 0; }
.madrasti-consent-title { margin: 0 0 4px; font-size: 14px; font-weight: 800; color: var(--mad-ink-950); }
.madrasti-consent-text { margin: 0 0 4px; font-size: 13px; line-height: 1.55; color: var(--mad-ink-600); }
.madrasti-consent-text-ar { font-family: 'Cairo', 'Tajawal', sans-serif; }
.madrasti-consent-link { font-size: 12.5px; font-weight: 700; color: var(--mad-brand-700); text-decoration: underline; }
.madrasti-consent-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.madrasti-consent-btn {
    min-width: 116px;
    min-height: 44px;
    padding: 10px 18px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mad-ink-800);
    background: var(--mad-surface);
    border: 1.5px solid var(--mad-border);
    border-radius: var(--mad-r-md);
    cursor: pointer;
    transition: background var(--mad-fast) var(--mad-ease), border-color var(--mad-fast) var(--mad-ease);
}
.madrasti-consent-btn:hover { border-color: var(--mad-brand-600); }
.madrasti-consent-btn.is-accept { background: var(--mad-cta-bg); border-color: var(--mad-cta-bg); color: var(--mad-cta-text); }
.madrasti-consent-btn.is-accept:hover { background: var(--mad-cta-bg-hover); border-color: var(--mad-cta-bg-hover); }
.madrasti-consent-btn:focus-visible,
.madrasti-consent-link:focus-visible { outline: 2px solid var(--mad-brand-600); outline-offset: 2px; }

@media (max-width: 520px) {
    .madrasti-consent-actions { width: 100%; }
    .madrasti-consent-btn { flex: 1 1 0; min-width: 0; }
}

/* Footer "Gérer mes cookies" — a <button> that reads like its sibling links. */
.madrasti-footer-linkbtn {
    padding: 0;
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.madrasti-footer-linkbtn:hover { opacity: .85; }
.madrasti-footer-linkbtn:focus-visible { outline: 2px solid var(--mad-brand-600); outline-offset: 3px; }

/* ==========================================================================
   Filter bar (.mad-fb) — the horizontal filter on top of the library pages
   (Documents, Espace Enseignant). One card: the search and « Réinitialiser »,
   the quick chips, then only the selects that are useful right now: a select
   that is disabled (Filière before a Niveau, Leçon before a Matière) is not
   shown at all. The controls keep the ids assets/js/madrasti-ajax.js listens
   to; a select that a row of chips already drives is hidden, never removed.
   On a phone the chips stay visible (they scroll sideways) and the selects
   open behind a « Filtres » button that shows how many are on.
   ========================================================================== */
.mad-fb {
    display: grid;
    gap: 14px;
    padding: 16px;
    margin-block-end: 28px;
    background: var(--mad-surface);
    border: 1px solid var(--mad-border);
    border-radius: var(--mad-r-lg);
    box-shadow: var(--mad-shadow-sm);
}
.mad-fb-top { display: flex; align-items: center; gap: 10px; }
.mad-fb-search { position: relative; flex: 1 1 auto; min-width: 0; }
.mad-fb-search svg {
    position: absolute;
    inset-inline-start: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--mad-ink-400);
    pointer-events: none;
}
.mad-fb-search input {
    width: 100%;
    min-height: 50px;
    padding-block: 12px;
    padding-inline: 46px 16px;
    border: 1.5px solid var(--mad-border);
    border-radius: var(--mad-r-full);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--mad-ink-800);
    background: var(--mad-surface-alt);
    transition: border-color var(--mad-fast) var(--mad-ease), background-color var(--mad-fast) var(--mad-ease), box-shadow var(--mad-fast) var(--mad-ease);
}
.mad-fb-search input::placeholder { color: var(--mad-ink-400); font-weight: 500; }
.mad-fb-search input:hover { border-color: var(--mad-border-strong); }
.mad-fb-search input:focus {
    outline: none;
    border-color: var(--mad-brand-500);
    background: var(--mad-surface);
    box-shadow: var(--mad-ring-brand);
}

.mad-fb-reset,
.mad-fb-toggle {
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    min-height: 50px;
    padding: 0 16px;
    border-radius: var(--mad-r-full);
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--mad-fast) var(--mad-ease), border-color var(--mad-fast) var(--mad-ease);
}
.mad-fb-reset svg,
.mad-fb-toggle svg { width: 16px; height: 16px; }
.mad-fb-reset {
    display: none;
    border: 1.5px solid var(--mad-red-100);
    background: var(--mad-surface);
    color: var(--mad-text-danger);
}
.mad-fb-reset:hover { background: var(--mad-red-50); }
.mad-fb.is-dirty .mad-fb-reset { display: inline-flex; }
.mad-fb-toggle {
    display: none;
    border: 1.5px solid var(--mad-border);
    background: var(--mad-surface);
    color: var(--mad-ink-800);
}
.mad-fb-toggle:hover { border-color: var(--mad-brand-500); }
.mad-fb-toggle[aria-expanded="true"] { border-color: var(--mad-brand-600); background: var(--mad-brand-50); color: var(--mad-brand-700); }
.mad-fb-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--mad-r-full);
    background: var(--mad-brand-600);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}
.mad-fb-count[hidden] { display: none; }
.mad-fb-reset:focus-visible,
.mad-fb-toggle:focus-visible { outline: 2px solid var(--mad-brand-600); outline-offset: 2px; }

.mad-fb-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mad-fb-label {
    flex: 0 0 auto;
    min-width: 68px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mad-ink-500);
}
.mad-fb .mad-fb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    -webkit-mask-image: none;
    mask-image: none;
}
.mad-fb .mad-chip { flex: 0 0 auto; }

.mad-fb-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.mad-fb-field { min-width: 0; }
.mad-fb-field label {
    display: block;
    margin-block-end: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--mad-ink-500);
}
.mad-fb-field:has(> select:disabled),
.mad-fb-field[hidden] { display: none; }

/* The Espace Enseignant's categories, drawn as pills inside the bar. */
.mad-fb .madrasti-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin: 0;
}
.mad-fb .madrasti-category-card {
    flex: 0 0 auto;
    gap: 8px;
    min-height: 42px;
    padding-block: 6px;
    padding-inline: 8px 16px;
    border-radius: var(--mad-r-full);
    background: var(--mad-surface);
    border-color: var(--mad-border);
}
.mad-fb .madrasti-category-card:hover { transform: none; box-shadow: none; border-color: var(--mad-brand-500); background: var(--mad-brand-50); }
.mad-fb .madrasti-category-card br { display: none; }
.mad-fb .madrasti-category-icon { width: 28px; height: 28px; border-radius: 50%; }
.mad-fb .madrasti-category-icon svg { width: 15px; height: 15px; }
.mad-fb .madrasti-category-name { font-size: 13px; color: var(--mad-ink-800); }
.mad-fb .madrasti-category-count {
    display: inline-block;
    min-width: 22px;
    margin-inline-start: 8px;
    padding: 1px 7px;
    border-radius: var(--mad-r-full);
    background: var(--mad-ink-100);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    color: var(--mad-ink-600);
}
.mad-fb .madrasti-category-card.is-active { background: var(--mad-brand-600); border-color: var(--mad-brand-600); }
.mad-fb .madrasti-category-card.is-active .madrasti-category-name { color: #ffffff; }
.mad-fb .madrasti-category-card.is-active .madrasti-category-count { background: rgba(255, 255, 255, .22); color: #ffffff; }
.mad-fb .madrasti-category-card.is-active .madrasti-category-icon { background: rgba(255, 255, 255, .2); color: #ffffff; }

@media (max-width: 720px) {
    .mad-fb { padding: 12px; gap: 12px; margin-block-end: 22px; }
    .mad-fb-top { flex-wrap: wrap; }
    .mad-fb-search { flex: 1 1 100%; }
    .mad-fb-toggle { display: inline-flex; flex: 1 1 0; justify-content: center; }
    .mad-fb-reset { min-height: 50px; padding: 0 16px; }
    .mad-fb-reset span { display: none; }
    .mad-fb-group { flex-direction: column; align-items: stretch; gap: 6px; }
    .mad-fb .mad-fb-chips,
    .mad-fb .madrasti-category-grid {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-block-end: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .mad-fb .mad-fb-chips::-webkit-scrollbar,
    .mad-fb .madrasti-category-grid::-webkit-scrollbar { display: none; }
    .mad-fb-fields { display: none; grid-template-columns: minmax(0, 1fr); }
    .mad-fb.is-open .mad-fb-fields { display: grid; }
}
@media (min-width: 480px) and (max-width: 720px) {
    .mad-fb-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
