/* =========================================================
   Cutting Room — Premiere Pro Masterclass
   Design tokens (from the brief) + layout. RTL handled with logical properties.
   ========================================================= */
:root {
  --bg: #08090C; --bg2: #11141A; --bg3: #171B23; --bg4: #1D222C; --line: #232A36; --line2: #2E3746;
  --blue: #168BFF; --blue-d: #0E5FB0; --cyan: #3FD6E0; --text: #E9EEF5; --muted: #8A93A3; --dim: #5D6676;
  --ok: #3CCB7F; --warn: #F2C94C; --bad: #EB5757; --violet: #9B7BFF;
  --f-latin: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --side: 312px; --top: 64px; --read: 46rem;
  --r1: 6px; --r2: 10px; --r3: 16px;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(var(--top) + 16px + env(safe-area-inset-top, 0px)); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--f-latin); font-stretch: 100%; min-height: 100vh; }
body.lang-ar { font-family: var(--f-ar); }
[lang="ar"] { font-family: var(--f-ar); line-height: 1.95; }
img { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--f-mono); font-feature-settings: "zero"; letter-spacing: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; z-index: 100; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: var(--r1); }
.skip:focus { inset-inline-start: 8px; }

/* Subtle film grain over everything (static, cheap) */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: .055; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- bilingual display ---------- */

.bi { display: inline-flex; flex-direction: column; gap: .1em; vertical-align: top; }
html[dir="ltr"] .bi > span { text-align: left; } html[dir="rtl"] .bi > span { text-align: right; }
.bi > .sec { color: var(--muted); font-size: .92em; }
.bi.stack { display: flex; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50; height: calc(var(--top) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  display: flex; align-items: center; gap: 14px; padding-inline: 18px;
  background: rgba(8, 9, 12, .78); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-t { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; font-stretch: 80%; font-size: 1.1rem; }
.brand-t small { font-weight: 400; font-stretch: 100%; font-size: .72rem; color: var(--muted); }
.search { position: relative; flex: 1; max-width: 460px; margin-inline-start: auto; }
.search input, .field {
  width: 100%; height: 38px; padding-inline: 12px 34px; border-radius: var(--r1); border: 1px solid var(--line2);
  background: var(--bg2); color: var(--text); font: inherit; font-size: .92rem;
}
.field { padding-inline-end: 12px; max-width: 420px; margin-top: 12px; }
.search input:focus, .field:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(22, 139, 255, .2); }
.search-k { position: absolute; inset-inline-end: 8px; top: 9px; font: 600 .7rem var(--f-mono); color: var(--dim); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; }
.search-results {
  position: absolute; top: 44px; inset-inline: 0; max-height: 60vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: var(--r2); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7); padding: 6px; z-index: 60;
}
.sr { display: flex; gap: 12px; padding: 9px 10px; border-radius: var(--r1); color: var(--text); font-size: .92rem; }
.sr:hover, .sr:focus { background: var(--bg4); text-decoration: none; }
.sr .mono { color: var(--blue); font-size: .78rem; min-width: 3.2em; padding-top: 2px; }
.sr.is-planned { opacity: .6; }
.both { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.both input { accent-color: var(--blue); }
.ring { position: relative; width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; color: var(--text); }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg, .ring-fg { fill: none; stroke-width: 3; }
.ring-bg { stroke: var(--line2); } .ring-fg { stroke: var(--blue); stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring span { font-size: .62rem; }
.iconbtn { background: none; border: 0; cursor: pointer; padding: 8px; }
.menu-btn { display: none; flex-direction: column; gap: 4px; }
.menu-btn span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s; }
body.menu-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
body.menu-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--r1); border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: .95rem; transition: background .2s, border-color .2s; text-decoration: none !important; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .85rem; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2e98ff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn-ghost:hover { border-color: var(--blue); background: rgba(22, 139, 255, .08); }
.btn .bi { flex-direction: row; gap: .5em; } .btn .bi > span { font-size: inherit !important; }
.lang-btn { font-family: var(--f-ar); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: calc(var(--top) + env(safe-area-inset-top, 0px)); bottom: 0; inset-inline-start: 0; width: var(--side); z-index: 40;
  overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-inline-end: 1px solid var(--line); padding: 18px 12px calc(40px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
}
.sidebar ul, .sidebar ol { list-style: none; margin: 0; padding: 0; }
.nav-top { padding-bottom: 14px; margin-bottom: 14px !important; border-bottom: 1px solid var(--line); }
.nav-top a { display: block; padding: 7px 10px; border-radius: var(--r1); color: var(--muted); font-size: .92rem; }
.nav-top a:hover, .nav-top a.is-active { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-mod-link { position: relative; display: grid; grid-template-columns: 2.2em 1fr; gap: 6px 8px; padding: 10px; border-radius: var(--r1); color: var(--text); font-size: .9rem; line-height: 1.35; }
.nav-mod-link:hover, .nav-mod-link.is-active { background: var(--bg3); text-decoration: none; }
.nav-num { font: 600 .78rem var(--f-mono); color: var(--blue); padding-top: 2px; }
.nav-mod.is-planned .nav-num { color: var(--dim); }
.nav-mod.is-planned .nav-title { opacity: .72; }
.nav-prog { grid-column: 2; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.nav-prog::before { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--blue); transition: width .5s; }
.nav-lessons { display: none; padding: 4px 0 10px; margin-inline-start: 1.5em !important; border-inline-start: 1px solid var(--line); }
.nav-mod.is-open .nav-lessons { display: block; }
.nav-lessons a { position: relative; display: flex; gap: 8px; padding: 5px 10px 5px 14px; padding-inline: 14px 10px; color: var(--muted); font-size: .84rem; line-height: 1.35; border-radius: 0 var(--r1) var(--r1) 0; }
.nav-lessons a:hover { color: var(--text); text-decoration: none; background: var(--bg2); }
.nav-lessons a.is-active { color: var(--text); background: var(--bg3); box-shadow: inset 2px 0 0 var(--blue); }
html[dir="rtl"] .nav-lessons a.is-active { box-shadow: inset -2px 0 0 var(--blue); }
.nav-lnum { font: .72rem var(--f-mono); color: var(--dim); padding-top: 3px; flex-shrink: 0; }
.nav-lessons a.is-done .nav-lnum { color: var(--ok); }
.nav-lessons a.is-done::after { content: ""; position: absolute; inset-inline-end: 8px; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.scrim { display: none; }

/* ---------- main view ---------- */
.view { margin-inline-start: var(--side); padding: calc(var(--top) + env(safe-area-inset-top, 0px) + 40px) clamp(18px, 4vw, 56px) 96px; min-height: 100vh; outline: none; }
.view > * { max-width: 1120px; }
h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 700; }

/* ---------- hero: the course as a timeline ---------- */
.hero { padding-bottom: 40px; }
.hero-tc { display: flex; align-items: baseline; gap: 14px; font-family: var(--f-mono); margin-bottom: 18px; }
.hero-tc #heroTc { font-size: clamp(1.4rem, 3vw, 2.1rem); color: var(--blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-fps { color: var(--dim); font-size: .8rem; }
.hero-title { font-size: clamp(2.3rem, 5.6vw, 4.8rem); font-stretch: 72%; font-weight: 800; letter-spacing: -.01em; line-height: 1; max-width: 15ch; }
.hero-title .sec { font-stretch: 100%; font-weight: 500; font-size: .42em; line-height: 1.6; margin-top: .5em; color: var(--muted); letter-spacing: 0; }
.hero-title .pri[lang="ar"] { font-stretch: 100%; line-height: 1.3; max-width: 18ch; }
.hero-sub { max-width: 40rem; color: var(--muted); font-size: 1.08rem; margin: 22px 0 34px; }
.hero-sub .bi > span { font-size: 1em !important; }
.hero-timeline {
  position: relative; direction: ltr; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: 26px 112px 34px; gap: 6px 8px;
  padding: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r3); overflow-x: auto; overflow-y: hidden;
  box-shadow: 0 40px 80px -40px rgba(22, 139, 255, .25);
}
.hero-timeline > * { min-width: 0; }
.ruler { grid-column: 2; grid-row: 1; display: flex; justify-content: space-between; font: .68rem var(--f-mono); color: var(--dim); border-bottom: 1px solid var(--line2); min-width: 900px; direction: ltr; }
.track-label { grid-column: 1; grid-row: 2; display: grid; place-items: center; font: 700 .75rem var(--f-mono); background: var(--blue); color: #fff; border-radius: 4px; }
.track-label.a { grid-row: 3; background: var(--bg4); color: var(--muted); }
.clips { grid-column: 2; grid-row: 2; display: flex; gap: 3px; min-width: 900px; direction: ltr; }
.clip {
  flex: 1 1 0; min-width: 72px; position: relative; display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border-radius: 5px; overflow: hidden; color: var(--text);
  background: repeating-linear-gradient(135deg, #1a2030 0 8px, #161b27 8px 16px); border: 1px solid var(--line2); transition: border-color .2s;
}
.clip.is-live { background: linear-gradient(180deg, #1F6FD0, #164E94); border-color: #3b8fe8; }
.clip:hover { border-color: var(--cyan); text-decoration: none; }
html[dir="rtl"] .clip { direction: rtl; }
.clip-n { font: 700 .75rem var(--f-mono); color: var(--cyan); }
.clip.is-live .clip-n { color: #d7ecff; }
.clip-t { font-size: .74rem; line-height: 1.25; font-weight: 600; overflow: hidden; max-height: 3.75em; }
.clip-t .bi { display: block; } .clip-t .bi > span:nth-child(2) { display: none; }
.clip-t .sec { display: none; }
.clip-meta { margin-top: auto; font-size: .64rem; color: rgba(233, 238, 245, .65); }
.wave { grid-column: 2; grid-row: 3; min-width: 900px; border-radius: 4px; background:
  radial-gradient(ellipse at center, rgba(60, 203, 127, .55) 0 30%, transparent 31%) 0 50% / 7px 100%,
  linear-gradient(#123a2c, #123a2c); opacity: .85;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px); }
.hp-wrap { grid-column: 2; grid-row: 1 / 4; position: relative; pointer-events: none; min-width: 900px; }
.hero-playhead { position: absolute; top: -4px; bottom: -4px; left: 0; width: 2px; margin-left: -1px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.hero-playhead::before { content: ""; position: absolute; top: -2px; left: -6px; border: 7px solid transparent; border-top: 9px solid var(--cyan); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); padding: 22px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.panel h2 .sec { font-weight: 500; }
.bigbar, .modbar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 10px; }
.bigbar span, .modbar span { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .6s ease; }
html[dir="rtl"] .bigbar span, html[dir="rtl"] .modbar span { background: linear-gradient(-90deg, var(--blue), var(--cyan)); }

/* ---------- module page ---------- */
.mod-head { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); max-width: 56rem; }
.mod-head .tc { color: var(--blue); font-size: .82rem; margin: 0 0 10px; }
.mod-head h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-stretch: 78%; font-weight: 800; }
.mod-head h1 .sec { font-weight: 500; font-stretch: 100%; font-size: .55em; margin-top: .35em; }
.mod-head h1 .pri[lang="ar"] { font-stretch: 100%; line-height: 1.3; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 44rem; margin: 14px 0 6px; }
.lesson-list { list-style: none; padding: 0; margin: 0; max-width: 56rem; }
.lesson { border-bottom: 1px solid var(--line); }
.lesson-toggle { width: 100%; display: grid; grid-template-columns: 3.6em 1fr auto 20px; align-items: center; gap: 14px; padding: 18px 6px; background: none; border: 0; cursor: pointer; text-align: start; }
.lesson-toggle:hover .ltitle { color: #fff; }
.lnum { color: var(--blue); font-size: .85rem; }
.ltitle { font-weight: 600; font-size: 1.05rem; }
.ldone { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line2); }
.ldone.is-done { background: var(--ok); border-color: var(--ok); }
.chev { width: 10px; height: 10px; border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .25s; margin-top: -4px; }
.lesson.is-open .chev { transform: rotate(-135deg); margin-top: 4px; }
.lesson.is-open { background: linear-gradient(180deg, rgba(22, 139, 255, .04), transparent 240px); }
.lesson-body { padding: 4px 6px 40px; }
.lesson-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg2); margin-bottom: 26px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ok); }
.ltitles { margin-bottom: 26px; }
.ltitles h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-stretch: 82%; }
.ltitles .ar-title { font-stretch: 100%; font-size: clamp(1.25rem, 2.4vw, 1.6rem); color: var(--muted); font-weight: 600; margin-top: 6px; }
.lsec { margin: 0 0 34px; max-width: var(--read); }
.lsec h3 { font-size: .95rem; font-weight: 700; color: var(--text); padding-inline-start: 12px; border-inline-start: 3px solid var(--blue); margin-bottom: 14px; }

.explain { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); padding: 22px 24px; max-width: 52rem; }
.explain h3 { border-color: var(--cyan); }
.explain-ar h3 { border-inline-start: 0; border-right: 3px solid var(--cyan); padding-inline-start: 0; padding-right: 12px; }
.prose p { margin: 0 0 1em; } .prose p:last-child { margin-bottom: 0; }
.prose strong { color: #fff; font-weight: 600; }
.prose code, .lsec code { font-family: var(--f-mono); font-size: .86em; background: var(--bg4); border: 1px solid var(--line2); border-radius: 4px; padding: .05em .35em; color: var(--cyan); unicode-bidi: isolate; direction: ltr; display: inline-block; }
.bi-list { margin: 0; padding-inline-start: 1.3em; }
.bi-list li { margin-bottom: 10px; padding-inline-start: 4px; }
.bi-list li::marker { color: var(--blue); }
.steps .bi-list { list-style: none; counter-reset: s; padding: 0; }
.steps .bi-list li { counter-increment: s; position: relative; padding-inline-start: 46px; min-height: 32px; }
.steps .bi-list li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--blue); color: var(--blue); font: 600 .8rem var(--f-mono); }
.steps .bi-list li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 15px; top: 32px; bottom: -10px; width: 1px; background: var(--line2); }
.warn .bi-list li::marker { color: var(--bad); } .tip .bi-list li::marker { color: var(--ok); }
.terms { margin: 0; display: grid; gap: 10px; }
.terms > div { display: grid; grid-template-columns: minmax(110px, 13em) 1fr; gap: 14px; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r1); }
.terms dt { font-weight: 700; color: var(--cyan); font-family: var(--f-latin); }
.terms dd { margin: 0; }
.callout { margin: 0; padding: 16px 18px; border-radius: var(--r2); background: rgba(22, 139, 255, .07); border: 1px solid rgba(22, 139, 255, .3); }
.callout.ex { background: rgba(63, 214, 224, .06); border-color: rgba(63, 214, 224, .3); }

/* figures */
.fig { margin: 0 0 22px; max-width: 64rem; }
.lsec:has(.fig) { max-width: 64rem; }
.fig-link img, .fig .ba { border-radius: var(--r2); border: 1px solid var(--line2); width: 100%; background: var(--bg); }
.fig-link:hover img { border-color: var(--blue); }
.fig figcaption { margin-top: 10px; font-size: .9rem; color: var(--text); }
.illus { margin: 4px 0 0; font-size: .75rem; color: var(--dim); }
.reveal { opacity: 1; }
.js-anim .reveal:not(.in) { opacity: 0; transform: translateY(24px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; }

/* before / after slider */
.ba { position: relative; overflow: hidden; user-select: none; direction: ltr; aspect-ratio: 1000 / 560; }
.ba > img, .ba-before img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--x)) 0 0); }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--x); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); pointer-events: none; }
.ba-line::after { content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: #000; font-size: 10px; padding: 6px 8px; border-radius: 20px; white-space: nowrap; }
.ba-tag { position: absolute; top: 12px; padding: 4px 10px; border-radius: 20px; background: rgba(0, 0, 0, .6); font: 600 .78rem var(--f-mono); pointer-events: none; }
.ba-tag.l { left: 12px; } .ba-tag.r { right: 12px; }
.ba input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba input:focus-visible + .ba-line, .ba:focus-within .ba-line { background: var(--cyan); }

/* interactive timeline demo */
.tldemo { background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r2); padding: 14px; }
.tl-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tl-tc { font-size: 1.35rem; color: var(--blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-prog { color: var(--muted); font-size: .9rem; } .tl-prog strong { color: var(--text); }
.tl-area { position: relative; touch-action: none; cursor: ew-resize; }
.tl-ruler { position: relative; height: 18px; margin-inline-start: 44px; border-bottom: 1px solid var(--line2); margin-left: 44px; }
.tl-ruler span { position: absolute; font: .65rem var(--f-mono); color: var(--dim); }
.tl-ruler span:last-child { transform: translateX(-100%); }
.tl-track { display: flex; gap: 6px; margin-top: 5px; }
.tl-name { width: 38px; flex-shrink: 0; display: grid; place-items: center; font: 700 .7rem var(--f-mono); background: var(--bg4); border-radius: 3px; color: var(--muted); }
.tl-lane { position: relative; flex: 1; height: 30px; background: var(--bg); border-radius: 3px; }
.tl-clip { position: absolute; top: 2px; bottom: 2px; background: var(--c); border-radius: 3px; font-size: .7rem; padding: 6px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .55; transition: opacity .15s, box-shadow .15s; }
.tl-clip.on { opacity: 1; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); outline-offset: 4px; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top: 9px solid var(--cyan); }
.tl-hint { margin: 10px 0 0; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r2); margin-top: 14px; max-width: 56rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--bg3); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.itable thead button { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; display: inline-flex; gap: 6px; text-align: start; }
.itable thead button::after { content: "↕"; color: var(--dim); font-size: .8em; }
.itable thead button[data-dir="asc"]::after { content: "↑"; color: var(--cyan); }
.itable thead button[data-dir="desc"]::after { content: "↓"; color: var(--cyan); }
.itable tbody tr { cursor: pointer; transition: background .15s; }
.itable tbody tr:hover, .sctable tbody tr:hover { background: var(--bg3); }
tr.hl { background: rgba(22, 139, 255, .14) !important; box-shadow: inset 3px 0 0 var(--blue); }
.settings { border: 1px solid var(--line2); border-radius: var(--r2); overflow: hidden; max-width: 40rem; }
.settings-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg3); }
.settings th { width: 45%; font-weight: 500; color: var(--muted); }
.settings td { color: var(--cyan); }

/* quiz */
.quiz { padding: 18px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); margin-bottom: 14px; }
.q { margin: 0 0 12px; font-weight: 600; }
.opts { display: grid; gap: 8px; }
.opt { text-align: start; padding: 11px 14px; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r1); cursor: pointer; transition: border-color .15s, background .15s; }
.opt:hover:not(:disabled) { border-color: var(--blue); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); background: rgba(60, 203, 127, .1); }
.opt.wrong { border-color: var(--bad); background: rgba(235, 87, 87, .1); }
.why { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r1); font-size: .92rem; }
.why.ok { background: rgba(60, 203, 127, .08); } .why.no { background: rgba(235, 87, 87, .08); }
.why strong { margin-inline-end: 6px; }
.score { color: var(--cyan); }
.lnav, .pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 30px; max-width: 56rem; }
.pager .bi { flex-direction: row; gap: .5em; }

/* planned module + lists */
.planned > p { color: var(--muted); margin-top: 0; }
.plan-list { list-style: none; padding: 0; margin: 0; columns: 2 18rem; column-gap: 28px; }
.plan-list li { break-inside: avoid; display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.plan-list a { display: flex; gap: 12px; color: var(--text); }
.plan-list .mono { color: var(--dim); font-size: .78rem; padding-top: 3px; min-width: 3em; }

/* glossary + shortcuts */
.glossary { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.gitem { padding: 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); }
.gitem dt { font-weight: 700; color: var(--cyan); margin-bottom: 6px; }
.gitem dd { margin: 0; font-size: .92rem; }
.sc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.sc-bar .field { margin: 0; max-width: 260px; }
.chips, .os { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line2); background: transparent; cursor: pointer; font-size: .85rem; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.os { padding-inline-start: 10px; border-inline-start: 1px solid var(--line2); }
.sctable td:last-child { width: 1%; white-space: nowrap; }
kbd { font: 600 .82rem var(--f-mono); padding: 3px 8px; border-radius: 5px; background: var(--bg4); border: 1px solid var(--line2); border-bottom-width: 2px; color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .menu-btn { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform .3s ease; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.menu-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); }
  body.menu-open .scrim { display: block; }
  .view { margin-inline-start: 0; }
}
@media (max-width: 720px) {
  .brand-t small, .search-k { display: none; }
  .both span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar { gap: 8px; padding-inline: 10px; }
  .brand-t { font-size: .95rem; }
  .lesson-toggle { grid-template-columns: 3em 1fr auto 14px; gap: 10px; }
  .terms > div { grid-template-columns: 1fr; gap: 4px; }
  .explain { padding: 18px 16px; }
  .ba-line::after { padding: 4px 6px; }
}
@media (max-width: 480px) {
  .brand-t { display: none; }
  .lang-btn { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .sidebar, .scrim, .lesson-tools, .lnav, .pager, body::after { display: none !important; }
  .view { margin: 0; padding: 0; } body { background: #fff; color: #000; }
}

/* =========================================================
   5-DAY TRAINING ADDITIONS
   ========================================================= */
.nav-num { font-size: .7rem; white-space: nowrap; color: var(--dc, var(--blue)); }
.nav-mod-link { grid-template-columns: 3.8em 1fr; }
.nav-prog::before { background: var(--dc, var(--blue)); }

/* week grid hero: five days as timeline tracks */
.week { position: relative; display: grid; gap: 6px; padding: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r3); direction: ltr; box-shadow: 0 40px 80px -40px rgba(22, 139, 255, .25); overflow-x: auto; }
.week-head { display: flex; justify-content: space-between; margin-left: 96px; margin-right: 92px; font: .68rem var(--f-mono); color: var(--dim); border-bottom: 1px solid var(--line2); padding-bottom: 4px; min-width: 640px; }
.week-row { display: grid; grid-template-columns: 90px 1fr 86px; align-items: center; gap: 6px; color: var(--text); min-width: 820px; }
.week-row:hover { text-decoration: none; }
.week-row:hover .week-clip { border-color: var(--dc); }
.week-day { height: 46px; display: grid; place-items: center; border-radius: 5px; background: var(--dc); color: #05070a; font-size: .8rem; }
.week-track { display: flex; gap: 3px; height: 46px; }
.week-clip { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 4px; background: color-mix(in srgb, var(--dc) 22%, var(--bg3)); border: 1px solid color-mix(in srgb, var(--dc) 40%, transparent); font-size: .7rem; line-height: 1.2; overflow: hidden; transition: border-color .2s; }
html[dir="rtl"] .week-clip { direction: rtl; }
.week-clip .sec { display: none; }
.week-clip.is-done { background: color-mix(in srgb, var(--dc) 55%, var(--bg3)); }
.week-meta { font-size: .68rem; color: var(--muted); text-align: right; }
.week-playhead { position: absolute; top: 8px; bottom: 8px; left: 0; width: 2px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); pointer-events: none; }

/* day cards */
.day-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 34px 0 20px; }
.day-card { display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; color: var(--text); transition: border-color .2s; }
.day-card:hover { border-color: var(--dc); text-decoration: none; }
.day-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-bottom: 3px solid var(--dc); background: var(--bg); }
.day-card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.dc { color: var(--dc); font-size: .78rem; }
.day-card strong { font-size: 1.05rem; line-height: 1.25; }
.progress-panel { margin-top: 10px; max-width: 760px; }

/* day header + schedule */
.mod-head .tc { color: var(--dc, var(--blue)); }
.modbar span { background: var(--dc, var(--blue)) !important; }
.schedule { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.schedule a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r1); color: var(--text); font-size: .9rem; line-height: 1.35; }
.schedule a:hover { border-color: var(--dc); text-decoration: none; }
.schedule .mono { color: var(--dc); font-size: .78rem; padding-top: 2px; }
.schedule .ldone { margin-inline-start: auto; flex-shrink: 0; margin-top: 4px; }

/* session */
.session { padding: 38px 0 30px; border-top: 1px solid var(--line); max-width: 1120px; }
.session-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 18px; margin-bottom: 18px; }
.stime { color: var(--dc); font-size: .95rem; padding: 4px 10px; border: 1px solid var(--dc); border-radius: 20px; }
.session-head h2 { flex: 1 1 320px; font-size: clamp(1.35rem, 2.6vw, 1.9rem); font-stretch: 82%; }
.session-head h2 .sec { font-size: .62em; font-weight: 500; font-stretch: 100%; margin-top: .3em; }
.session-head h2 .pri[lang="ar"], .ltitle .pri[lang="ar"] { font-stretch: 100%; }
.session-head .check { padding: 7px 12px; border: 1px solid var(--line2); border-radius: var(--r1); background: var(--bg2); }
.session-text { max-width: 46rem; }
.brief { font-size: 1.08rem; margin: 0 0 18px; }
.session h3 { font-size: .92rem; padding-inline-start: 12px; border-inline-start: 3px solid var(--dc); margin: 0 0 12px; }
.steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 40px; margin-bottom: 10px; min-height: 26px; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--dc); color: var(--dc); font: 600 .75rem var(--f-mono); }
.settings { margin-bottom: 16px; }
.recipes { display: grid; gap: 10px; margin-bottom: 10px; }
.recipe { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; }
.recipe-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip-s { font: .78rem var(--f-mono); padding: 3px 8px; border-radius: 4px; background: var(--bg4); border: 1px solid var(--line2); color: var(--cyan); }

/* gallery: big pictures, 2 columns */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 18px; margin-top: 22px; }
.gallery.one { grid-template-columns: minmax(0, 860px); }
.pic { margin: 0; }
.pic.wide { margin: 22px 0 0; max-width: 980px; }
.pic-btn { display: block; width: 100%; padding: 0; border: 1px solid var(--line2); border-radius: var(--r2); overflow: hidden; background: var(--bg); cursor: zoom-in; }
.pic-btn img { width: 100%; height: auto; transition: transform .35s ease; }
.pic-btn:hover { border-color: var(--dc); }
.pic-btn:hover img { transform: scale(1.015); }
.pic figcaption { margin-top: 8px; font-size: .88rem; }
.pic.wide > img { border-radius: var(--r2); border: 1px solid var(--line2); }
.ba-tag { font-size: .75rem; }
.wrap-up h2 { font-size: 1.2rem; margin: 0 0 12px; }
.wrap-up .callout { margin-bottom: 26px; max-width: 46rem; }
.wrap-up .quiz { max-width: 46rem; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(4, 5, 7, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: grid; grid-template-rows: 1fr auto; padding: calc(56px + env(safe-area-inset-top, 0px)) 64px calc(16px + env(safe-area-inset-bottom, 0px)); }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; border-radius: 8px; align-self: center; justify-self: center; min-height: 0; }
.lb-cap { text-align: center; padding: 12px; color: var(--text); max-width: 900px; margin: 0 auto; }
.lb-cap .mono { color: var(--cyan); margin-inline-end: 8px; font-size: .8rem; }
.lb-btn { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { border-color: var(--cyan); }
#lbClose { top: calc(10px + env(safe-area-inset-top, 0px)); right: 14px; }
#lbPrev { left: 10px; top: 50%; } #lbNext { right: 10px; top: 50%; }
body.lb-open { overflow: hidden; }
@media (max-width: 720px) {
  .lightbox { padding-inline: 8px; }
  #lbPrev, #lbNext { top: auto; bottom: 70px; }
  .session-head .check { width: 100%; }
}

.hero-title { font-size: clamp(2rem, 4.2vw, 3.4rem); max-width: 22ch; }
.hero-sub { margin: 16px 0 26px; }

/* language switcher */
.langs { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--r1); overflow: hidden; flex-shrink: 0; }
.langs button { background: transparent; border: 0; padding: 7px 11px; font: 600 .85rem var(--f-latin); color: var(--muted); cursor: pointer; min-height: 34px; }
.langs button[lang="ar"] { font-family: var(--f-ar); }
.langs button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.langs button:not([aria-pressed="true"]):hover { color: var(--text); background: var(--bg3); }
.sec-box { display: flex; flex-direction: column; gap: 6px; padding: 4px 10px 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.secsel { width: 100%; height: 34px; border-radius: var(--r1); border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); font: .82rem var(--f-latin); padding: 0 6px; }
.secsel:focus { outline: none; border-color: var(--blue); }
.menu-note { font-size: .78rem; color: var(--dim); margin-top: 8px; }
@media (max-width: 720px) { .langs button { padding: 6px 8px; } }
