@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --page: #f7f8fc;
  --ink: #19182d;
  --muted: #575a72;
  --line: #e1e3ef;
  --accent: #5140cb;
  --title: Manrope, 'Segoe UI', sans-serif;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #907efe; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1192px, calc(100% - 104px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 3; top: 12px; left: 12px; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; background: white; }
.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 0; font: 800 25px var(--title); letter-spacing: -.075em; }
.brand > span:last-child { color: var(--accent); }
.brand-icon { width: 38px; height: 38px; margin-right: 10px; display: grid; place-items: center; border-radius: 12px; background: #eeeaff; color: var(--accent); }
.brand-icon svg { width: 24px; height: 24px; }
nav { display: flex; align-items: center; gap: 29px; font-weight: 700; font-size: 14px; }
.header-inner nav a:hover { color: var(--accent); }
.nav-lab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: #4939bb; background: #f2efff; border-radius: 9px; }
.nav-lab:hover { background: #eae4ff; }
.status-dot, .eyebrow span { display: inline-block; width: 7px; height: 7px; border-radius: 100%; background: #8b73fb; }
.hero {
  display: grid;
  grid-template-columns: minmax(0,1.08fr) minmax(0,1fr);
  gap: clamp(28px,4vw,58px);
  align-items: center;
  margin-block: 30px 42px;
  padding: clamp(26px,4.2vw,60px);
  border: 1px solid #e9e3fb;
  border-radius: 30px;
  background: radial-gradient(ellipse at 7% 2%, #fff 0, transparent 54%), linear-gradient(120deg, #f3eeff, #eee9fc 55%, #e6e5ff);
}
.eyebrow { display: flex; align-items: center; gap: 8px; color: #5141be; font-size: 11px; line-height: 1.4; font-weight: 800; letter-spacing: .125em; }
.hero-kicker { color: #4c426c; }
.hero-kicker .tunisia-mark { width: 10px; height: 10px; background: #cf2444; box-shadow: 0 0 0 4px #cf244419; margin-inline: 4px; }
.hero h1 { margin-block: 17px 19px; font: 800 clamp(44px,5.4vw,78px)/1.01 var(--title); letter-spacing: -.073em; }
.hero h1 em { display: block; font-style: normal; color: var(--accent); }
.hero-description { max-width: 420px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 27px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; padding: 12px 16px; min-height: 46px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 700; }
.primary { color: white; background: var(--accent); box-shadow: 0 4px 12px #5746d833; }
.primary:hover { background: #4834c6; }
.quiet { color: #332c61; background: #fff; border-color: #dedfee; }
.quiet:hover { border-color: #afa5ec; background: #f8f6ff; }
.scene { overflow: hidden; isolation: isolate; position: relative; min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-height: 350px; height: 372px; padding: 18px 21px 15px; border-radius: 23px; color: #e1dcfa; background: radial-gradient(ellipse at 52% 50%, #302158 0%, #1b163a 53%, #13122d 100%); border: 1px solid #382e60; box-shadow: 0 14px 26px #20174024; }
.scene::before { content: ''; z-index: -1; position: absolute; inset: 0; background-image: radial-gradient(#aa9aef42 1px,transparent 1px); background-size: 19px 19px; mask-image: radial-gradient(ellipse,#000,#0004); }
.hero-scene { border-radius: 20px; height: clamp(320px,32vw,390px); }
.scene-top, .scene-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #c3b9e0; gap: 8px; }
.scene-top { font-weight: 700; letter-spacing: .105em; }
.scene-label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #a38beb57; background: #a38beb19; padding: 8px 10px; border-radius: 6px; color: #e3daff; }
.scene-label .status-dot { background: #b49bff; box-shadow: 0 0 10px #b49bff; }
.scene canvas { width: 100%; height: 100%; min-height: 0; display: block; cursor: grab; touch-action: none; }
.scene canvas:active { cursor: grabbing; }
.scene-reset { color: #e3daff; background: #ad98f31c; border: 1px solid #a38beb57; border-radius: 8px; width: 33px; height: 32px; font-size: 19px; line-height: 1; }
.scene-reset:hover { background: #ad98f34b; }
.program { padding-bottom: 42px; scroll-margin-top: 20px; }
.program-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.program-heading p { color: var(--muted); line-height: 1.5; }
.text-link { display: inline-flex; align-items: center; gap: 9px; color: #4b37b9; font-weight: 800; font-size: 14px; }
.text-link:hover { text-decoration: underline; }
.section-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: stretch; gap: 12px; }
.section-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto auto;
  align-items: start;
  gap: 7px 8px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.section-card:hover { border-color: #8c78e8; box-shadow: 0 7px 18px #34235a10; transform: translateY(-2px); }
.section-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 5px; border-radius: 12px; background: var(--tile); color: var(--tile-ink); font: 800 20px var(--title); }
.section-arrow { justify-self: end; color: #655a83; font-size: 17px; }
.section-name, .section-arabic, .section-count { grid-column: 1 / -1; }
.section-name { align-self: end; font: 800 16px/1.28 var(--title); letter-spacing: -.025em; }
.section-arabic { justify-self: start; color: var(--muted); font-weight: 600; line-height: 1.4; }
.section-count { margin-top: 2px; color: var(--tile-ink); font-size: 12px; }
.tone-violet { --tile: #eee8ff; --tile-ink: #5133b1; }
.tone-mint { --tile: #def5ec; --tile-ink: #19664f; }
.tone-amber { --tile: #fff0d9; --tile-ink: #854601; }
.tone-blue { --tile: #e5eeff; --tile-ink: #2855a0; }
.tone-rose { --tile: #fce7ef; --tile-ink: #9a2c57; }
.tone-lavender { --tile: #f1e9fb; --tile-ink: #6f3896; }
.tone-lime { --tile: #edf3d9; --tile-ink: #465d24; }
.section-page { padding-top: 30px; }
.section-heading { padding: clamp(22px, 4vw, 46px); border-radius: 23px; background: linear-gradient(115deg, #f2ecff, #e8e5ff); }
.section-heading h1 { margin-block: 8px; font: 800 clamp(33px, 6vw, 64px)/1.08 var(--title); letter-spacing: -.065em; }
.section-heading p[lang="ar"] { width: fit-content; color: #5140aa; font-size: 20px; }
.annales { margin-block: 18px; padding: clamp(18px, 3vw, 30px); border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.annales summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; list-style: none; border-radius: 8px; }
.annales summary::-webkit-details-marker { display: none; }
.annales summary::after { content: ""; flex: 0 0 9px; height: 9px; margin-inline: 4px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-3px); }
.annales details[open] > summary::after { transform: rotate(225deg); }
.annales h2 { margin: 0; font-size: clamp(25px, 3vw, 36px); }
.annales-subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); align-items: start; gap: 10px; margin: 20px 0 14px; padding: 0; list-style: none; }
.annales-subjects > li { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--page); }
.annales-subjects > li > details > summary { padding: 12px 14px; font-weight: 700; }
.annales-subjects summary:hover { color: var(--accent); }
.annales-sessions { display: grid; gap: 8px; padding: 0 10px 10px; }
.annales-sessions details { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.annales-sessions summary { min-height: 44px; padding: 9px 11px; font-size: 14px; font-weight: 700; }
.annales-year { display: grid; gap: 5px; padding: 0 11px 11px; color: var(--muted); font-size: 13px; font-weight: 700; }
.annales-year select { width: 100%; min-width: 0; min-height: 44px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); font: inherit; }
.annales-sessions p:not(:empty) { padding: 0 11px 11px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.annales-links:not(:empty) { display: grid; gap: 8px; padding: 0 11px 11px; }
.annales-3d { border-radius: 8px; background: #f2efff; color: #4b37b9; padding: 9px 10px; font-size: 13px; }
span.annales-3d { color: var(--muted); }
.catalog { padding-block: 29px 51px; border-top: 1px solid var(--line); scroll-margin-top: 18px; }
.catalog-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
h2 { font: 800 clamp(28px,3.3vw,44px)/1.15 var(--title); letter-spacing: -.058em; margin-block: 7px 9px; }
.catalog-heading p:not(.eyebrow) { color: var(--muted); font-size: 15px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 12px; width: 280px; height: 45px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #686c87; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 20px; flex: none; stroke: currentColor; stroke-width: 1.7; }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-block: 23px 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filters button { border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #494c65; padding: 7px 11px; font-size: 13px; font-weight: 700; }
.filters button[aria-pressed="true"] { background: #ece8ff; border-color: #ded5fd; color: #4937b8; }
#result-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; }
.card { display: flex; flex-direction: column; min-width: 0; padding: 17px 18px 15px; border: 1px solid var(--line); background: #fff; border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: #bcb1f3; box-shadow: 0 6px 17px #35226b0d; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.card-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #5746d8; background: #f0ebff; font: 700 24px var(--title); }
.card-icon.blue { background: #e8f2ff; color: #2768b8; }
.card-icon.green { background: #e1f7f2; color: #19735e; }
.badge { border-radius: 5px; color: #4e37bd; background: #f0ebff; padding: 4px 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.subject { color: var(--muted); font-size: 12px; font-weight: 700; }
.card h3 { margin: 4px 0 7px; font: 800 19px/1.25 var(--title); letter-spacing: -.035em; }
.card p:not(.subject) { color: var(--muted); line-height: 1.45; font-size: 14px; margin-bottom: 14px; }
.card-link { display: flex; justify-content: space-between; gap: 9px; padding-top: 12px; margin-top: auto; border-top: 1px solid var(--line); color: #4e3cc7; font-size: 13px; font-weight: 800; }
.empty { grid-column: 1 / -1; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.section-empty { margin-top: 18px; }
.section-empty .text-link { margin-top: 9px; }
.detail { padding-block: 34px 52px; }
.detail h1 { margin-block: 9px 11px; font: 800 clamp(34px,5vw,62px)/1.08 var(--title); letter-spacing: -.065em; }
.back { display: inline-block; margin-bottom: 23px; color: #4b3abf; font-size: 14px; font-weight: 800; }
.detail-header { margin-bottom: 29px; }
.detail-header p:last-child, .exercise-panel p, .exercise-panel li { color: #4e5670; line-height: 1.65; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.95fr); gap: 23px; align-items: start; }
.detail-grid.text-only { grid-template-columns: minmax(0,740px); }
.exercise-panel { padding: 21px 24px; border: 1px solid var(--line); background: #fff; border-radius: 14px; }
.exercise-panel + .exercise-panel { margin-top: 14px; }
.exercise-panel h2 { font-size: 24px; margin-top: 0; }
.exercise-panel ol { padding-left: 19px; margin: 10px 0 0; }
.exercise-panel li + li { margin-top: 5px; }
.step-body { min-height: 112px; }
.step-body h3 { margin-bottom: 6px; font: 800 17px var(--title); }
.step-number { margin-bottom: 7px; color: #5442c6 !important; font-size: 13px; font-weight: 800; }
.step-nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.step-nav button:disabled { opacity: .46; cursor: default; }
.detail .scene { height: 420px; }
.figure-note { margin-top: 11px; color: var(--muted); font-size: 13px; }
.figure-fallback { position: absolute; inset: 38% 18px auto; text-align: center; line-height: 1.55; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-block: 18px; color: var(--muted); font-size: 13px; }
.footer-brand { font-size: 19px; color: var(--ink); }
@media (max-width: 980px) {
  .shell { width: calc(100% - 58px); }
  .hero { gap: 28px; }
  .hero h1 { font-size: clamp(40px,6.3vw,63px); }
  .section-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 36px); }
  .hero, .detail-grid { grid-template-columns: 1fr; }
  .hero { margin-block: 18px 26px; padding: 22px; border-radius: 23px; }
  .hero h1 { font-size: clamp(42px,9vw,64px); }
  .section-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .catalog-heading { align-items: start; flex-direction: column; }
  .search { width: min(100%,360px); }
  .cards { grid-template-columns: repeat(2,1fr); }
  .detail .scene { height: 360px; }
}
@media (max-width: 470px) {
  nav { gap: 12px; font-size: 13px; }
  .brand { font-size: 22px; }
  .brand-icon { width: 32px; height: 32px; margin-right: 6px; }
  .nav-lab { padding: 8px; }
  .nav-catalog { display: none; }
  .header-inner { min-height: 63px; }
  .scene { height: 319px; min-height: 0; padding-inline: 12px; }
  .hero-scene { height: 260px; }
  .program-heading { flex-direction: column; align-items: start; gap: 10px; }
  .section-card { padding: 12px; }
  .section-name { font-size: 14px; }
  .cards { grid-template-columns: 1fr; }
  .filter-row { align-items: start; flex-direction: column; }
  .exercise-panel { padding: 17px; }
  .footer { align-items: start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .section-card { transition: none; }
  .section-card:hover { transform: none; }
}
