/*
Theme Name: BestCours Atlas
Description: A lightweight Arabic-first resource directory for BestCours.ma.
Version: 1.2.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: bestcours-atlas
*/
:root {
    color-scheme: light;
    --ink: #171d34;
    --muted: #4d5870;
    --line: #dce2ef;
    --blue: #263fb6;
    --night: #151e43;
    --paper: #f7f8fc;
    --white: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.75 system-ui, "Segoe UI", Tahoma, Arial, sans-serif; }
img, video, iframe { max-width: 100%; }
img, video { height: auto; }
input, textarea, select, button { font: inherit; max-width: 100%; }
a { color: var(--blue); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: 3px solid #b94a16; outline-offset: 4px; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.screen-reader-text, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; inset-inline-start: 12px; z-index: 99; padding: 8px 16px; background: white; }
.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar { min-height: 77px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.brand { display: inline-flex; gap: 9px; align-items: center; width: fit-content; color: inherit; text-decoration: none; font-size: 1.25rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: white; background: var(--blue); font-size: 1.12rem; }
.brand-domain { color: #5264d2; }
.custom-logo-link { display: flex; align-items: center; }
.custom-logo { width: auto; max-width: 180px; max-height: 50px; object-fit: contain; }
.main-nav ul, .site-footer ul { list-style: none; padding: 0; margin: 0; }
.main-nav > ul, .site-footer nav > ul { display: flex; flex-wrap: wrap; gap: 0 20px; }
.main-nav > ul > li { position: relative; }
.main-nav a, .header-link, .site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 3px; color: inherit; text-decoration: none; font-weight: 640; font-size: .92rem; }
.main-nav a[aria-current], .main-nav a:hover { color: var(--blue); text-decoration: underline; }
.main-nav .sub-menu { position: absolute; visibility: hidden; z-index: 5; min-width: 12rem; background: white; color: var(--ink); border: 1px solid var(--line); padding: 8px 12px; border-radius: 10px; inset-inline-start: 0; }
.main-nav .sub-menu .sub-menu { position: static; }
.main-nav li:hover > .sub-menu, .main-nav li:focus-within > .sub-menu { visibility: visible; }
.header-link { padding: 3px 15px; gap: 8px; border-radius: 9px; background: #edf0ff; color: var(--blue); }
.hero { background: var(--night); color: white; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 5%; min-height: 420px; padding-block: 49px 55px; }
.eyebrow { color: #b9c8ff; margin: 0 0 10px; font-size: .95rem; font-weight: 700; }
.hero h1 { margin: 0; font-size: clamp(2.65rem, 5.5vw, 4.65rem); line-height: 1.12; letter-spacing: -.035em; }
.hero h1 span { color: #bdebd7; }
.hero-intro { color: #dce3fc; font-size: 1.1rem; margin: 22px 0; }
.site-search { display: flex; align-items: stretch; gap: 8px; padding: 6px; width: min(100%, 580px); background: white; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); }
.site-search input { flex: 1; width: 0; min-width: 0; min-height: 46px; border: 0; padding: 6px 12px; border-radius: 7px; background: white; color: var(--ink); }
.site-search input:placeholder-shown { text-align: right; }
.site-search button, .comment-form .submit { border: 0; border-radius: 8px; background: var(--blue); color: white; cursor: pointer; min-height: 46px; padding: 6px clamp(12px, 2vw, 24px); font-weight: 700; }
.site-search button:hover, .comment-form .submit:hover { background: #192c8d; }
.hero-art { height: 298px; position: relative; width: min(100%, 395px); margin-inline: auto; border: 1px solid #41517c; border-radius: 30px; background-color: #1a2652; background-image: radial-gradient(#4f608b 1px, transparent 1px); background-size: 18px 18px; }
.sheet { position: absolute; width: 49%; height: 78%; top: 10%; left: 27%; border-radius: 13px; }
.sheet-back { background: #bac8ff; transform: translate(-17%, 3%) rotate(-16deg); }
.sheet-front { background: #fbfaff; transform: rotate(9deg); padding: 15px 13px; color: #263d8d; box-shadow: 0 10px 35px #0a102b66; }
.sheet-label { font-size: .65rem; font-weight: 800; letter-spacing: .13em; }
.sheet-graph { display: flex; justify-content: space-around; align-items: end; gap: 4px; height: 48%; margin-top: 9px; padding: 0 8px 5px; border-left: 1px solid #9ca9ce; border-bottom: 1px solid #9ca9ce; background: repeating-linear-gradient(to top, transparent 0 19px, #e1e6f5 19px 20px); }
.sheet-graph i { width: 12%; background: #5269d7; border-radius: 4px 4px 0 0; }
.sheet-graph i:nth-child(1) { height: 16%; }.sheet-graph i:nth-child(2) { height: 24%; }.sheet-graph i:nth-child(3) { height: 37%; }.sheet-graph i:nth-child(4) { height: 55%; }.sheet-graph i:nth-child(5) { height: 67%; }.sheet-graph i:nth-child(6) { height: 92%; }
.sheet-rule { background: #dce3f9; height: 5px; margin-top: 9px; border-radius: 3px; }
.sheet-rule.short { width: 66%; }
.sheet-formula { font: 700 .9rem/1 monospace; display: inline-block; margin-top: 10px; }
.art-star { position: absolute; top: 13%; right: 8%; color: #ffdd93; font-size: 2rem; line-height: 1; }
.section { padding-block: 45px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.28; }
.level-grid, .post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.level-card { position: relative; display: block; border: 1px solid #171d3423; border-radius: 17px; color: var(--ink); padding: 20px 22px 23px; padding-inline-end: 55px; text-decoration: none; }
.level-card:hover h3, .resource-card a:hover, .site-footer a:hover { text-decoration: underline; }
.mint { background: #e3f3eb; }.sand { background: #fff1d5; }.lavender { background: #edebfc; }
.level-code { display: inline-block; font: 700 .78rem/1 monospace; background: #ffffffb5; border: 1px solid #171d3423; border-radius: 7px; padding: 7px 9px; }
.level-card h3 { margin: 12px 0 3px; font-size: 1.28rem; line-height: 1.35; }
.level-card p { margin: 0; color: var(--muted); font-size: .94rem; }
.level-arrow { position: absolute; inset-inline-end: 15px; bottom: 18px; display: grid; place-items: center; border: 1px solid #171d3430; border-radius: 50%; width: 32px; height: 32px; }
.library { border-block: 1px solid var(--line); background: white; }
.section-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.section-card { position: relative; display: grid; align-content: start; gap: 4px; padding: 16px; padding-inline-end: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; }
.section-card:hover { background: #edf0ff; }
.section-card:hover .section-card-title { text-decoration: underline; }
.section-card-title { font-weight: 750; line-height: 1.45; }
.section-card-description { font-size: .9rem; color: var(--muted); }
.section-card-arrow { position: absolute; inset-inline-end: 13px; top: 14px; color: var(--blue); }
.library-grid, .footer-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 25px; }
.library-grid h3 { margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; min-height: 44px; align-items: center; padding: 4px 13px; border: 1px solid var(--line); background: white; border-radius: 9px; text-decoration: none; overflow-wrap: anywhere; }
.chips a:hover { background: #edf0ff; text-decoration: underline; }
.directory, .resource-card, .empty-state, .single-resource, .comments-area { background: white; border: 1px solid var(--line); border-radius: 15px; padding: clamp(16px, 3vw, 30px); overflow-wrap: anywhere; }
.directory { padding: 0 16px; }
.directory summary { display: list-item; min-height: 44px; padding-block: 8px; cursor: pointer; font-weight: 700; }
.directory li { margin-block: 8px; }
.resource-card h2, .resource-card h3 { font-size: 1.15rem; margin: 9px 0; line-height: 1.42; }
.resource-card h2 a, .resource-card h3 a { text-decoration: none; color: var(--ink); }
.resource-category, .resource-excerpt, .article-meta, .breadcrumbs { color: var(--muted); font-size: .9rem; }
.resource-excerpt p:last-child { margin-bottom: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 9px; margin-bottom: 12px; }
.breadcrumbs a { padding-block: 10px; }
.archive-head { margin-bottom: 25px; }
.archive-head h1, .article-head h1, .empty-state h1 { margin: 0 0 15px; font-size: clamp(1.8rem, 4.5vw, 3.25rem); line-height: 1.2; overflow-wrap: anywhere; }
.category-children { margin-top: 20px; }
.level-subjects { padding-bottom: 12px; }
.article-head:empty { display: none; }
.single-wrap { max-width: 1010px; }
.single-resource { padding: clamp(16px, 5vw, 58px); }
.article-meta, .nav-links { display: flex; flex-wrap: wrap; gap: 9px 18px; }
.entry-content { overflow-wrap: anywhere; }
.single-resource .entry-content { margin-top: 24px; }
.entry-content h2, .entry-content h3 { line-height: 1.35; margin-top: 1.7em; }
.entry-content :is(table, pre) { display: block; max-width: 100%; overflow-x: auto; }
.entry-content table { border-collapse: collapse; }
.entry-content :is(th, td) { padding: .45em .75em; border: 1px solid var(--line); }
.entry-content th { background: var(--paper); }
.entry-content figure { max-width: 100%; margin-inline: 0; }
.entry-content :is(object, embed) { max-width: 100%; }
.entry-content .aligncenter { display: block; margin-inline: auto; }
.entry-content .alignleft { float: left; margin: 0 1rem 1rem 0; }
.entry-content .alignright { float: right; margin: 0 0 1rem 1rem; }
.entry-content::after { content: ""; display: block; clear: both; }
.resource-taxonomy { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 12px; }
.navigation, .comments-area { margin-top: 25px; }
.page-numbers, .post-navigation a { display: inline-block; padding: 7px 12px; min-height: 44px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.page-numbers.current { background: var(--blue); color: white; }
.site-footer { background: #11182f; color: #e2e8ff; padding-block: 32px 18px; }
.site-footer .brand-domain { color: #b9c8ff; }
.site-footer p { color: #c6cfe8; }
.footer-legal { border-top: 1px solid #394464; padding-top: 12px; margin-top: 12px; font-size: .87rem; }
@media (max-width: 850px) {
    .section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-nav { order: 3; width: 100%; }
    .topbar { padding-top: 10px; }
    .hero-inner { min-height: 350px; grid-template-columns: 1.35fr 1fr; }
    .hero-art { height: 240px; }
    .level-card { padding-inline-start: 15px; }
}
@media (max-width: 640px) {
    .wrap { width: calc(100% - 32px); }
    .hero-inner, .library-grid, .footer-grid, .level-grid, .post-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-inner { min-height: 0; padding-block: 32px; }
    .hero-art { display: none; }
    .section { padding-block: 30px; }
    .main-nav > ul { gap: 0 10px; }
    .main-nav a { font-size: .84rem; }
    .main-nav .sub-menu { position: static; visibility: visible; border: 0; border-inline-start: 1px solid var(--line); min-width: 0; padding: 0 8px; }
    .directory ul, .comment-list { padding-inline-start: 17px; }
}
@media (max-width: 360px) {
    .section-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile : plus de largeur pour les simulations et les exercices */
@media (max-width: 640px) {
    .wrap { width: calc(100% - 24px); }
    .single-resource { padding: 16px 12px; }
    .single-resource .entry-content { margin-top: 16px; }
}
