/* =========================================================
   HCIA-Storage bilingual study site — style.css
   Palette: navy #021e47 · orange #fc8503 · light theme
   ========================================================= */
:root{
  --navy:#021e47;
  --navy-2:#0b3270;
  --ink-soft:#4a5b78;
  --orange:#fc8503;
  --orange-soft:#fff1e0;
  --paper:#f4f6f9;
  --surface:#ffffff;
  --line:#d9e0ea;
  --line-soft:#e9edf3;
  --ok:#1f8a5b;
  --ok-soft:#e5f4ec;
  --bad:#c62f2f;
  --bad-soft:#fbe9e9;
  --radius-s:6px;
  --radius-m:10px;
  --radius-l:16px;
  --fs:1rem;
  --en:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  --ar:"Rubik","Segoe UI",Tahoma,sans-serif;
  --sidebar:300px;
}
html{scroll-behavior:smooth;font-size:calc(16px * var(--scale,1))}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{animation:none!important;transition:none!important}}
body{background:var(--paper);color:var(--navy);font-family:var(--en);line-height:1.6;-webkit-font-smoothing:antialiased}
[lang=ar],.ar{font-family:var(--ar);line-height:1.9}
a{color:var(--navy-2)}
:focus-visible{outline:3px solid var(--orange);outline-offset:2px;border-radius:4px}
b,strong{font-weight:650}
code{background:var(--line-soft);color:var(--navy);padding:.05rem .35rem;border-radius:4px;font-size:.9em;direction:ltr;unicode-bidi:embed}
::selection{background:var(--orange);color:#fff}

/* language modes */
body.mode-en .ar{display:none!important}
body.mode-ar .en{display:none!important}

/* ---------- top bar ---------- */
.topbar{position:sticky;top:0;z-index:1030;background:var(--navy);color:#fff;height:60px;display:flex;align-items:center;gap:.75rem;padding:0 1rem}
.topbar .brand{display:flex;align-items:center;gap:.6rem;color:#fff;text-decoration:none;font-weight:700;letter-spacing:-.01em;white-space:nowrap}
.brand-mark{width:30px;height:30px;border-radius:7px;background:#fff;display:grid;grid-template-rows:repeat(3,1fr);gap:3px;padding:5px}
.brand-mark i{display:block;background:var(--navy);border-radius:2px;position:relative}
.brand-mark i::after{content:"";position:absolute;right:2px;top:50%;width:3px;height:3px;margin-top:-1.5px;border-radius:50%;background:var(--orange)}
.brand small{display:block;font-weight:400;font-size:.72rem;opacity:.75;font-family:var(--ar);line-height:1.2}
.topbar .spacer{flex:1}
.topbar .btn-icon{background:transparent;border:1px solid rgba(255,255,255,.22);color:#fff;border-radius:8px;height:38px;min-width:38px;padding:0 .6rem;display:inline-flex;align-items:center;justify-content:center;gap:.4rem;font-size:.9rem}
.topbar .btn-icon:hover{background:rgba(255,255,255,.1)}
.lang-switch{display:inline-flex;border:1px solid rgba(255,255,255,.22);border-radius:8px;overflow:hidden}
.lang-switch button{background:transparent;border:0;color:#fff;padding:0 .7rem;height:36px;font-size:.85rem}
.lang-switch button[aria-pressed=true]{background:var(--orange);color:var(--navy);font-weight:700}
.search-wrap{position:relative;max-width:340px;flex:1}
.search-wrap input{width:100%;height:38px;border-radius:8px;border:0;padding:0 .75rem 0 2.1rem;background:rgba(255,255,255,.12);color:#fff}
.search-wrap input::placeholder{color:rgba(255,255,255,.65)}
.search-wrap input:focus{background:#fff;color:var(--navy);outline:none}
.search-wrap .fa-magnifying-glass{position:absolute;left:.7rem;top:50%;transform:translateY(-50%);opacity:.7;pointer-events:none}
.search-results{position:absolute;top:44px;left:0;right:0;background:#fff;color:var(--navy);border-radius:10px;box-shadow:0 14px 40px rgba(2,30,71,.25);max-height:65vh;overflow:auto;display:none}
.search-results.show{display:block}
.search-results a{display:block;padding:.6rem .85rem;text-decoration:none;color:var(--navy);border-bottom:1px solid var(--line-soft)}
.search-results a:hover,.search-results a:focus{background:var(--orange-soft)}
.search-results .where{font-size:.75rem;color:var(--ink-soft)}
.read-progress{position:fixed;top:60px;left:0;height:3px;background:var(--orange);width:0;z-index:1031;transition:width .1s linear}

/* ---------- layout ---------- */
.shell{display:flex;min-height:calc(100vh - 60px)}
.sidebar{width:var(--sidebar);flex:0 0 var(--sidebar);background:var(--surface);border-right:1px solid var(--line);position:sticky;top:60px;height:calc(100vh - 60px);overflow:auto;padding:1rem .75rem 2rem}
.main{flex:1;min-width:0;padding:1.5rem clamp(1rem,3vw,2.5rem) 5rem}
.content{max-width:1180px;margin:0 auto}
@media (max-width:991.98px){
  .sidebar{position:fixed;left:0;top:60px;z-index:1040;transform:translateX(-100%);transition:transform .25s ease;box-shadow:0 0 40px rgba(2,30,71,.25)}
  .sidebar.open{transform:none}
  .search-wrap{display:none}
  .search-wrap.mobile-open{display:block;position:fixed;top:66px;left:.75rem;right:.75rem;max-width:none;z-index:1050}
  .search-wrap.mobile-open input{background:#fff;color:var(--navy);box-shadow:0 8px 30px rgba(2,30,71,.3)}
}
.backdrop{position:fixed;inset:60px 0 0 0;background:rgba(2,30,71,.35);z-index:1035;display:none}
.backdrop.show{display:block}

/* sidebar nav */
.nav-group-title{font-size:.78rem;color:var(--ink-soft);margin:.9rem .5rem .35rem;font-weight:600}
.side-link{display:flex;align-items:center;gap:.6rem;padding:.5rem .6rem;border-radius:8px;color:var(--navy);text-decoration:none;font-size:.92rem}
.side-link:hover{background:var(--paper)}
.side-link.active{background:var(--navy);color:#fff}
.side-link .fa-fw{opacity:.85}
.side-ch{margin-bottom:.15rem}
.side-ch > .side-link .num{width:24px;height:24px;flex:0 0 24px;border-radius:6px;border:1.5px solid currentColor;display:grid;place-items:center;font-size:.75rem;font-weight:700}
.side-ch > .side-link .meta{margin-left:auto;font-size:.72rem;opacity:.75;white-space:nowrap}
.side-ch .led{width:8px;height:8px;border-radius:50%;background:var(--line);flex:0 0 8px}
.side-ch .led.on{background:var(--orange);box-shadow:0 0 0 3px rgba(252,133,3,.2)}
.side-secs{list-style:none;margin:.1rem 0 .4rem 2.15rem;padding:0;border-left:1px solid var(--line)}
.side-secs a{display:flex;gap:.45rem;align-items:flex-start;padding:.28rem .6rem;font-size:.83rem;color:var(--ink-soft);text-decoration:none;line-height:1.35}
.side-secs a:hover{color:var(--navy)}
.side-secs a.current{color:var(--navy);font-weight:600;box-shadow:inset 2px 0 0 var(--orange)}
.side-secs .fa-circle-check{color:var(--ok)}
.side-secs .fa-circle{color:var(--line)}

/* ---------- generic ---------- */
.page-title{font-size:clamp(1.6rem,3.2vw,2.35rem);font-weight:800;letter-spacing:-.025em;line-height:1.15;margin:0}
.page-title .ar{display:block;font-size:.72em;font-weight:600;color:var(--navy-2);letter-spacing:0;margin-top:.25rem}
.lead-bi{color:var(--ink-soft);max-width:78ch}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-l);padding:1.25rem 1.35rem}
.btn-navy{background:var(--navy);color:#fff;border:0;border-radius:9px;padding:.6rem 1.05rem;font-weight:600}
.btn-navy:hover{background:var(--navy-2);color:#fff}
.btn-orange{background:var(--orange);color:var(--navy);border:0;border-radius:9px;padding:.6rem 1.05rem;font-weight:700}
.btn-orange:hover{background:#ff9a2a;color:var(--navy)}
.btn-line{background:var(--surface);color:var(--navy);border:1px solid var(--line);border-radius:9px;padding:.55rem .95rem;font-weight:600}
.btn-line:hover{border-color:var(--navy)}
.btn-line.on{background:var(--ok-soft);border-color:var(--ok);color:var(--ok)}
.chip{display:inline-flex;align-items:center;gap:.35rem;font-size:.78rem;padding:.2rem .6rem;border-radius:999px;background:var(--paper);border:1px solid var(--line);color:var(--ink-soft);white-space:nowrap}
.chip.orange{background:var(--orange-soft);border-color:#ffd3a0;color:#8a4600}
.chip.ok{background:var(--ok-soft);border-color:#b8e1cb;color:var(--ok)}

/* bilingual blocks */
.bi{display:grid;grid-template-columns:1fr;gap:.15rem}
body.mode-both .bi.cols{grid-template-columns:1fr 1fr;gap:1.5rem}
@media (max-width:767.98px){body.mode-both .bi.cols{grid-template-columns:1fr;gap:.25rem}}
.bi .ar{direction:rtl;text-align:right}
body.mode-both .bi .ar{color:var(--navy-2)}

/* ---------- home hero: storage enclosure ---------- */
.hero{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:2rem;align-items:center;margin-bottom:2rem}
@media (max-width:991.98px){.hero{grid-template-columns:1fr}}
.hero h1{font-size:clamp(2rem,4.6vw,3.25rem);font-weight:800;letter-spacing:-.035em;line-height:1.05;margin:0 0 .5rem}
.hero h1 .ar{display:block;font-size:.62em;letter-spacing:0;color:var(--navy-2);margin-top:.4rem;line-height:1.4}
.hero p{max-width:60ch;color:var(--ink-soft)}
.enclosure{background:var(--navy);border-radius:var(--radius-l);padding:14px;box-shadow:0 18px 40px rgba(2,30,71,.22)}
.enclosure-head{display:flex;justify-content:space-between;align-items:center;color:#c7d3e8;font-size:.78rem;padding:2px 6px 10px}
.enclosure-head .pwr{display:flex;align-items:center;gap:.4rem}
.enclosure-head .pwr i{width:8px;height:8px;border-radius:50%;background:#37d08a}
.bays{display:grid;grid-template-columns:1fr 1fr;gap:8px}
@media (max-width:420px){.bays{grid-template-columns:1fr}}
.bay{display:flex;align-items:center;gap:.65rem;background:#0d2b5c;border:1px solid #1d3f78;border-radius:8px;padding:.55rem .7rem;color:#e6edf8;text-decoration:none;position:relative;min-height:54px}
.bay:hover,.bay:focus-visible{background:#123670;color:#fff}
.bay .slot-no{font-weight:800;font-size:.95rem;color:#8fa6cc;width:1.6rem}
.bay .bay-txt{flex:1;min-width:0;font-size:.82rem;line-height:1.25}
.bay .bay-txt .ar{display:block;font-size:.78rem;color:#9fb4d8}
.bay .bar{position:absolute;left:.7rem;right:.7rem;bottom:5px;height:3px;background:#1d3f78;border-radius:2px;overflow:hidden}
.bay .bar i{display:block;height:100%;background:var(--orange);width:0;transition:width .6s ease}
.bay .bay-led{width:10px;height:10px;border-radius:50%;background:#26487f;flex:0 0 10px}
.bay .bay-led.on{background:var(--orange);box-shadow:0 0 10px var(--orange)}
.bay .bay-led.part{background:#ffd08a}
.bays.boot .bay-led{animation:boot .35s ease both}
@keyframes boot{0%{background:#26487f}50%{background:#fff;box-shadow:0 0 12px #fff}100%{}}

.stats{display:flex;flex-wrap:wrap;gap:.75rem;margin:1.25rem 0}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-m);padding:.7rem 1rem;min-width:140px}
.stat .v{font-size:1.5rem;font-weight:800;letter-spacing:-.02em}
.stat .l{font-size:.8rem;color:var(--ink-soft)}

.path{list-style:none;padding:0;margin:0;counter-reset:p}
.path li{display:grid;grid-template-columns:44px 1fr auto;gap:1rem;align-items:center;padding:.85rem 0;border-bottom:1px solid var(--line-soft)}
.path li:last-child{border-bottom:0}
.path .step{width:40px;height:40px;border-radius:10px;border:2px solid var(--navy);display:grid;place-items:center;font-weight:800}
.path li.done .step{background:var(--navy);color:#fff}
.path h3{font-size:1.02rem;margin:0;font-weight:700}
.path h3 .ar{font-size:.92rem;font-weight:500;color:var(--navy-2)}
.path .sub{font-size:.82rem;color:var(--ink-soft)}
@media (max-width:575.98px){.path li{grid-template-columns:40px 1fr}.path li > :last-child{grid-column:2}}

/* ---------- chapter view ---------- */
.ch-head{display:grid;grid-template-columns:auto 1fr;gap:1.25rem;align-items:start;margin-bottom:1.25rem}
.ch-num{width:72px;height:72px;border-radius:16px;background:var(--navy);color:#fff;display:grid;place-items:center;font-size:2rem;font-weight:800;position:relative}
.ch-num::after{content:"";position:absolute;right:9px;bottom:9px;width:9px;height:9px;border-radius:50%;background:var(--orange)}
@media (max-width:575.98px){.ch-head{grid-template-columns:1fr}.ch-num{width:56px;height:56px;font-size:1.5rem}}
.ch-meta{display:flex;flex-wrap:wrap;gap:.5rem;margin:.75rem 0}
.objectives{margin:0;padding-left:1.2rem}
.objectives li{margin:.2rem 0}

/* mini mind map of chapter */
.mind{display:flex;gap:.75rem;overflow-x:auto;padding:.25rem 0 .5rem;scrollbar-width:thin}
.mind-col{flex:0 0 220px;border-top:3px solid var(--navy);background:var(--surface);border-radius:0 0 10px 10px;border-left:1px solid var(--line);border-right:1px solid var(--line);border-bottom:1px solid var(--line);padding:.6rem .75rem}
.mind-col h4{font-size:.88rem;font-weight:700;margin:0 0 .4rem}
.mind-col h4 a{color:var(--navy);text-decoration:none}
.mind-col ul{list-style:none;padding:0;margin:0;font-size:.78rem;color:var(--ink-soft)}
.mind-col li{padding:.15rem 0 .15rem .8rem;position:relative;line-height:1.35}
.mind-col li::before{content:"";position:absolute;left:0;top:.62em;width:5px;height:5px;border-radius:50%;background:var(--orange)}

/* section */
.sec{margin-top:2.5rem;scroll-margin-top:80px}
.sec-head{display:flex;flex-wrap:wrap;align-items:flex-end;gap:.75rem 1rem;padding-bottom:.8rem;border-bottom:2px solid var(--navy);margin-bottom:1.25rem}
.sec-head .idx{font-size:.85rem;font-weight:700;color:var(--orange);background:var(--navy);border-radius:6px;padding:.15rem .5rem}
.sec-head h2{font-size:clamp(1.3rem,2.4vw,1.7rem);font-weight:800;letter-spacing:-.02em;margin:0;flex:1 1 320px;line-height:1.2}
.sec-head h2 .ar{display:block;font-size:.8em;font-weight:600;color:var(--navy-2);letter-spacing:0}
.sec-tools{display:flex;gap:.5rem;flex-wrap:wrap}

/* topic */
.topic{background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--navy);border-radius:var(--radius-m);padding:1.1rem 1.25rem;margin-bottom:1rem;scroll-margin-top:80px}
.topic-head{display:flex;gap:.75rem;align-items:flex-start;margin-bottom:.6rem}
.topic-head h3{font-size:1.15rem;font-weight:750;margin:0;flex:1;letter-spacing:-.01em}
.topic-head h3 .ar{font-size:1.02rem;font-weight:600}
.topic-head .speak{border:1px solid var(--line);background:var(--paper);border-radius:8px;width:34px;height:34px;flex:0 0 34px;color:var(--navy)}
.topic-head .speak:hover{border-color:var(--navy)}
.topic-head .speak.on{background:var(--orange);border-color:var(--orange)}
.points{list-style:none;padding:0;margin:0}
.points > li{padding:.5rem 0;border-top:1px dashed var(--line-soft)}
.points > li:first-child{border-top:0}
.points .en{position:relative;padding-left:1rem}
.points .en::before{content:"";position:absolute;left:0;top:.62em;width:6px;height:6px;border-radius:2px;background:var(--orange)}
.points .ar{position:relative;padding-right:1rem}
.points .ar::before{content:"";position:absolute;right:0;top:.85em;width:6px;height:6px;border-radius:2px;background:var(--navy)}
body.mode-ar .points .ar::before{background:var(--orange)}

.tip{display:flex;gap:.75rem;background:var(--orange-soft);border:1px solid #ffd3a0;border-radius:var(--radius-m);padding:.75rem .9rem;margin-top:.85rem}
.tip > .fa-solid{color:#c16400;margin-top:.3rem}
.tip .bi{flex:1}

/* flow diagram */
.flow{display:flex;flex-wrap:wrap;align-items:stretch;gap:.35rem;margin:.9rem 0 .3rem}
.flow .node{background:var(--paper);border:1.5px solid var(--navy);border-radius:8px;padding:.4rem .7rem;font-size:.85rem;font-weight:600;text-align:center;min-width:80px;display:flex;flex-direction:column;justify-content:center}
.flow .node .ar{font-weight:500;font-size:.8rem}
body.mode-both .flow .node .ar{border-top:1px solid var(--line);margin-top:.2rem;padding-top:.1rem}
.flow .arr{display:flex;align-items:center;color:var(--orange);font-size:1rem}
body.mode-ar .flow{direction:rtl}
body.mode-ar .flow .arr .fa-arrow-right{transform:scaleX(-1)}

/* timeline */
.tl{display:flex;gap:0;overflow-x:auto;margin:1rem 0 .3rem;padding-bottom:.3rem}
.tl-item{flex:1 0 120px;position:relative;padding:1.6rem .5rem 0;border-top:3px solid var(--navy);min-width:120px}
.tl-item::before{content:"";position:absolute;top:-8px;left:.5rem;width:13px;height:13px;border-radius:50%;background:var(--orange);border:3px solid var(--surface);box-shadow:0 0 0 1.5px var(--navy)}
.tl-item .yr{position:absolute;top:.25rem;left:.5rem;font-weight:800;font-size:.85rem}
.tl-item .en,.tl-item .ar{font-size:.8rem;line-height:1.35}

/* tree */
.tree,.tree ul{list-style:none;margin:0;padding:0}
.tree{margin:.9rem 0 .2rem;font-size:.9rem}
.tree ul{margin-left:1.1rem;border-left:1.5px solid var(--line);padding-left:.9rem}
.tree li{position:relative;padding:.2rem 0}
.tree ul > li::before{content:"";position:absolute;left:-.9rem;top:1rem;width:.75rem;border-top:1.5px solid var(--line)}
.tree .tn{display:inline-flex;flex-wrap:wrap;gap:.1rem .5rem;align-items:baseline;background:var(--paper);border:1px solid var(--line);border-radius:7px;padding:.2rem .55rem}
.tree > li > .tn{background:var(--navy);color:#fff;border-color:var(--navy)}
.tree > li > .tn .ar{color:#c9d6ee}
.tree .tn .ar{font-size:.85em}

/* tables */
.tbl-wrap{overflow-x:auto;margin:.85rem 0 .2rem;border:1px solid var(--line);border-radius:var(--radius-m)}
.tbl{width:100%;border-collapse:collapse;font-size:.88rem;min-width:520px}
.tbl th{background:var(--navy);color:#fff;font-weight:650;text-align:left;padding:.55rem .7rem;vertical-align:bottom}
.tbl th .ar{color:#c9d6ee;font-weight:500}
.tbl td{padding:.5rem .7rem;border-top:1px solid var(--line-soft);vertical-align:top}
.tbl tr:nth-child(even) td{background:#fafbfd}
.tbl td:first-child{font-weight:650}
.tbl .ar{display:block;font-size:.92em;color:var(--navy-2)}
body.mode-ar .tbl{direction:rtl}
body.mode-ar .tbl th,body.mode-ar .tbl td{text-align:right}

.chart-box{position:relative;height:240px;margin:1rem 0 .2rem;background:var(--paper);border-radius:var(--radius-m);padding:.6rem}

/* widgets */
.widget{margin:1rem 0 .2rem;border:1.5px dashed var(--navy);border-radius:var(--radius-m);padding:.9rem;background:#fbfcfe}
.widget-title{display:flex;align-items:center;gap:.5rem;font-weight:700;font-size:.92rem;margin-bottom:.6rem}
.widget-title .fa-solid{color:var(--orange)}
.w-row{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center}
.disks{display:flex;gap:.6rem;flex-wrap:wrap;margin:.6rem 0}
.disk{width:96px;border-radius:9px;border:2px solid var(--navy);background:var(--surface);padding:.35rem;cursor:pointer;text-align:center;transition:transform .15s}
.disk:hover{transform:translateY(-2px)}
.disk .dname{font-size:.72rem;font-weight:700;margin-bottom:.2rem}
.disk .blk{font-size:.75rem;padding:.2rem;margin:.15rem 0;border-radius:4px;background:var(--paper);font-weight:600}
.disk .blk.p{background:var(--orange-soft);color:#8a4600}
.disk .blk.m{background:#e7eefb}
.disk.failed{border-color:var(--bad);background:var(--bad-soft);opacity:.75}
.disk.failed .blk{text-decoration:line-through;opacity:.5}
.disk.pairA{box-shadow:0 0 0 3px #e7eefb}
.status-pill{font-weight:700;padding:.25rem .7rem;border-radius:999px;font-size:.85rem}
.status-pill.ok{background:var(--ok-soft);color:var(--ok)}
.status-pill.warn{background:var(--orange-soft);color:#8a4600}
.status-pill.bad{background:var(--bad-soft);color:var(--bad)}
.bitgrid{display:grid;grid-template-columns:auto repeat(4,40px);gap:.3rem;align-items:center;font-size:.85rem}
.bit{width:40px;height:34px;border-radius:7px;border:1.5px solid var(--navy);background:#fff;font-weight:800;cursor:pointer}
.bit.one{background:var(--navy);color:#fff}
.bit.par{border-color:var(--orange);background:var(--orange-soft);cursor:default}
.bit.par.one{background:var(--orange);color:var(--navy)}
.bit.lost{border-style:dashed;color:var(--bad)}
.stripe-grid{display:inline-grid;grid-template-columns:repeat(3,70px);gap:4px;margin:.5rem 0}
.stripe-grid div{border:1.5px solid var(--navy);border-radius:5px;text-align:center;padding:.3rem 0;font-size:.8rem;font-weight:700;background:#fff;transition:background .2s}
.stripe-grid div.hl{background:var(--orange);color:var(--navy)}
.stripe-grid .hdr{border:0;background:none;font-weight:600;color:var(--ink-soft)}
.maptbl{font-size:.82rem;border-collapse:collapse}
.maptbl td,.maptbl th{border:1px solid var(--line);padding:.25rem .5rem;text-align:center}
.maptbl th{background:var(--paper)}
.maptbl td.new{background:var(--orange-soft);font-weight:700}
.maptbl td.free{color:var(--ink-soft);text-decoration:line-through}
.bucket{width:70px;height:120px;border:2px solid var(--navy);border-top:0;border-radius:0 0 10px 10px;position:relative;overflow:hidden;background:#fff}
.bucket i{position:absolute;left:0;right:0;bottom:0;background:var(--navy);transition:height .3s}
.bucket.e i{background:var(--orange)}
.w-log{font-size:.85rem;color:var(--ink-soft);margin-top:.5rem;min-height:1.5em}

/* notes */
.notes-box{margin-top:1rem;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-m);padding:.9rem 1rem}
.notes-box textarea{width:100%;min-height:110px;border:1px solid var(--line);border-radius:8px;padding:.6rem .7rem;font-family:inherit;resize:vertical;background:#fffdf8}
.notes-box textarea:focus{outline:2px solid var(--orange);border-color:transparent}
.notes-box .saved{font-size:.78rem;color:var(--ok);opacity:0;transition:opacity .3s}
.notes-box .saved.show{opacity:1}

/* quiz */
.quiz{background:var(--surface);border:2px solid var(--navy);border-radius:var(--radius-l);padding:1.1rem 1.25rem;margin-top:1.25rem}
.quiz-head{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin-bottom:.6rem}
.quiz-head h3{font-size:1.1rem;font-weight:800;margin:0;flex:1}
.q{padding:1rem 0;border-top:1px solid var(--line-soft)}
.q:first-of-type{border-top:0}
.q-text{font-weight:650;margin-bottom:.55rem;display:flex;gap:.6rem}
.q-text .qn{flex:0 0 auto;background:var(--paper);border:1px solid var(--line);border-radius:6px;padding:0 .45rem;height:1.6rem;font-size:.82rem;display:grid;place-items:center}
.q-text .bi{flex:1}
.q-hint{font-size:.78rem;color:var(--ink-soft);margin:-.25rem 0 .4rem 2.3rem}
.opts{display:grid;gap:.45rem}
.opt{display:flex;gap:.65rem;align-items:flex-start;border:1.5px solid var(--line);border-radius:9px;padding:.55rem .7rem;cursor:pointer;background:#fff;transition:border-color .15s,background .15s}
.opt:hover{border-color:var(--navy-2)}
.opt input{margin-top:.35rem;accent-color:var(--navy);flex:0 0 auto;width:1.05rem;height:1.05rem}
.opt .letter{font-weight:800;color:var(--ink-soft);width:1.2rem}
.opt .bi{flex:1}
.opt.sel{border-color:var(--navy);background:#f2f6fd}
.opt.correct{border-color:var(--ok);background:var(--ok-soft)}
.opt.wrong{border-color:var(--bad);background:var(--bad-soft)}
.opt.missed{border-color:var(--ok);border-style:dashed}
.q.locked .opt{cursor:default}
.explain{margin-top:.55rem;padding:.6rem .8rem;border-radius:8px;font-size:.9rem;display:none}
.explain.show{display:block;animation:pop .25s ease}
.explain.good{background:var(--ok-soft);color:#155c3d}
.explain.bad{background:var(--bad-soft);color:#8f2020}
@keyframes pop{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.score-card{display:flex;gap:1rem;align-items:center;flex-wrap:wrap;padding:.9rem 1rem;border-radius:var(--radius-m);background:var(--paper);margin-top:.75rem}
.score-ring{--p:0;width:74px;height:74px;border-radius:50%;background:conic-gradient(var(--orange) calc(var(--p)*1%),var(--line) 0);display:grid;place-items:center;flex:0 0 74px}
.score-ring span{width:58px;height:58px;border-radius:50%;background:var(--paper);display:grid;place-items:center;font-weight:800}

/* summary & cards */
.recap{background:var(--navy);color:#fff;border-radius:var(--radius-l);padding:1.25rem 1.35rem;margin-top:2.5rem}
.recap h2{font-size:1.35rem;font-weight:800;margin:0 0 .8rem}
.recap .points > li{border-top-color:rgba(255,255,255,.15)}
.recap .points .ar{color:#c9d6ee!important}
.recap .points .ar::before{background:var(--orange)}
.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:.85rem}
.flip{perspective:900px;height:170px;cursor:pointer}
.flip-inner{position:relative;width:100%;height:100%;transition:transform .5s;transform-style:preserve-3d}
.flip.flipped .flip-inner{transform:rotateY(180deg)}
.flip-face{position:absolute;inset:0;backface-visibility:hidden;border-radius:var(--radius-m);padding:.9rem;display:flex;flex-direction:column;justify-content:center;text-align:center;border:1px solid var(--line)}
.flip-front{background:var(--surface)}
.flip-front .term{font-size:1.35rem;font-weight:800;letter-spacing:-.01em}
.flip-front .hint{font-size:.75rem;color:var(--ink-soft);margin-top:.4rem}
.flip-back{background:var(--navy);color:#fff;transform:rotateY(180deg);font-size:.9rem}
.flip-back .ar{color:#ffd29b;margin-top:.35rem}
.flip.known .flip-front{border-color:var(--ok);box-shadow:inset 0 -4px 0 var(--ok)}
.card-actions{display:flex;gap:.4rem;justify-content:center;margin-top:.35rem}
.card-actions button{font-size:.75rem;padding:.2rem .55rem;border-radius:6px;border:1px solid var(--line);background:#fff}

/* chapter footer nav */
.pager{display:flex;justify-content:space-between;gap:1rem;margin-top:2rem;flex-wrap:wrap}
.pager a{flex:1 1 240px;text-decoration:none;border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-m);padding:.8rem 1rem;color:var(--navy)}
.pager a:hover{border-color:var(--navy)}
.pager .dir{font-size:.78rem;color:var(--ink-soft)}
.pager a.next{text-align:right}

/* concept map */
.map-wrap{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-l);padding:.5rem;overflow:hidden}
#mapSvg{width:100%;height:auto;display:block}
#mapSvg .link{stroke:var(--line);stroke-width:2}
#mapSvg .xlink{stroke:var(--orange);stroke-width:2;stroke-dasharray:6 6;fill:none;opacity:.25;transition:opacity .2s}
#mapSvg .xlink.hot{opacity:1;stroke-width:3}
#mapSvg .node{cursor:pointer}
#mapSvg .node circle{fill:var(--surface);stroke:var(--navy);stroke-width:2.5;transition:fill .2s}
#mapSvg .node.done circle{fill:var(--orange-soft);stroke:var(--orange)}
#mapSvg .node:hover circle,#mapSvg .node.sel circle,#mapSvg .node:focus circle{fill:var(--navy)}
#mapSvg .node:hover text.n,#mapSvg .node.sel text.n,#mapSvg .node:focus text.n{fill:#fff}
#mapSvg .node text.n{font-weight:800;font-size:20px;fill:var(--navy);text-anchor:middle;dominant-baseline:central;pointer-events:none}
#mapSvg .lbl{font-size:13px;fill:var(--navy);font-weight:600;pointer-events:none}
#mapSvg .lbl-ar{font-family:var(--ar);font-size:12px;fill:var(--navy-2);pointer-events:none}
#mapSvg .core circle{fill:var(--navy)}
#mapSvg .core text{fill:#fff;font-weight:800;text-anchor:middle}
.links-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:.75rem}
.link-item{border:1px solid var(--line);border-left:4px solid var(--orange);background:var(--surface);border-radius:var(--radius-m);padding:.75rem .9rem;cursor:pointer}
.link-item:hover,.link-item.hot{border-color:var(--orange)}
.link-item .pair{font-weight:700;font-size:.9rem;margin-bottom:.25rem}
.map-detail{min-height:120px}

/* exam */
.exam-bar{position:sticky;top:68px;z-index:5;display:flex;gap:1rem;align-items:center;background:var(--navy);color:#fff;border-radius:var(--radius-m);padding:.6rem 1rem;margin-bottom:1rem}
.exam-bar .timer{font-variant-numeric:tabular-nums;font-weight:800;font-size:1.1rem}
.exam-bar .prog{flex:1;height:6px;background:rgba(255,255,255,.2);border-radius:3px;overflow:hidden}
.exam-bar .prog i{display:block;height:100%;background:var(--orange);width:0;transition:width .2s}
.form-check-input:checked{background-color:var(--navy);border-color:var(--navy)}
.form-select:focus,.form-control:focus{border-color:var(--navy);box-shadow:0 0 0 .2rem rgba(252,133,3,.25)}

.glossary-tbl td:first-child{white-space:nowrap}
.toast-lite{position:fixed;bottom:1.25rem;left:50%;transform:translateX(-50%) translateY(20px);background:var(--navy);color:#fff;padding:.6rem 1.1rem;border-radius:10px;opacity:0;transition:all .25s;z-index:2000;pointer-events:none;box-shadow:0 10px 30px rgba(2,30,71,.3)}
.toast-lite.show{opacity:1;transform:translateX(-50%)}
.to-top{position:fixed;right:1rem;bottom:1rem;width:46px;height:46px;border-radius:12px;border:0;background:var(--orange);color:var(--navy);display:none;z-index:1020;box-shadow:0 8px 20px rgba(2,30,71,.2)}
.to-top.show{display:grid;place-items:center}
.view{animation:viewIn .3s ease}
@keyframes viewIn{from{opacity:0}to{opacity:1}}
.empty{padding:2rem;text-align:center;color:var(--ink-soft)}
footer.foot{font-size:.8rem;color:var(--ink-soft);text-align:center;margin-top:4rem}
@media print{.topbar,.sidebar,.sec-tools,.quiz,.notes-box,.to-top,.pager{display:none!important}.main{padding:0}.topic{break-inside:avoid}}

/* ---------- inline bilingual pairs ---------- */
body.mode-both span.en + span.ar{margin-left:.5em;padding-left:.5em;border-left:1.5px solid rgba(252,133,3,.75)}
body.mode-both .side-link span.en + span.ar,
body.mode-both .side-secs span.en + span.ar,
body.mode-both .mind-col span.en + span.ar,
body.mode-both .pager span.en + span.ar,
body.mode-both .stat .l span.en + span.ar,
body.mode-both .search-results span.en + span.ar,
body.mode-both .bay-txt span.en + span.ar,
body.mode-both .ch-head span.en + span.ar,
body.mode-both .path .sub span.en + span.ar,
body.mode-both .flip span.en + span.ar,
body.mode-both .hero h1 span.en + span.ar,
body.mode-both .page-title span.en + span.ar{display:block;margin-left:0;padding-left:0;border-left:0}
body.mode-both .side-link span.ar,body.mode-both .side-secs span.ar{font-size:.86em;opacity:.85;line-height:1.5;text-align:left}
body.mode-both .mind-col h4 span.ar{font-weight:500}
.side-link > span:not(.num):not(.led):not(.meta){min-width:0;flex:1}
.same{font-weight:inherit}
body.mode-both .sec-head h2 .ar,body.mode-both .topic-head h3 .ar,body.mode-both .path h3 .ar,body.mode-both .recap h2 .ar,body.mode-both .map-detail h3 .ar{text-align:left}
.widget .btn-line,.widget .btn-navy{padding:.3rem .7rem;font-size:.84rem;border-radius:7px}
body.mode-both .opt .bi.cols,body.mode-both .q-text .bi.cols{gap:1rem}
.sec-head .idx{align-self:flex-start;margin-top:.35rem}

/* ---------- full RTL layout in Arabic-only mode ---------- */
html[dir=rtl] body{font-family:var(--ar)}
html[dir=rtl] .sidebar{border-right:0;border-left:1px solid var(--line)}
html[dir=rtl] .topic{border-left:1px solid var(--line);border-right:4px solid var(--navy)}
html[dir=rtl] .tip,html[dir=rtl] .link-item{text-align:right}
html[dir=rtl] .link-item{border-left:1px solid var(--line);border-right:4px solid var(--orange)}
html[dir=rtl] .side-ch > .side-link .meta{margin-left:0;margin-right:auto}
html[dir=rtl] .side-secs{margin:.1rem 2.15rem .4rem 0;border-left:0;border-right:1px solid var(--line)}
html[dir=rtl] .side-secs a.current{box-shadow:inset -2px 0 0 var(--orange)}
html[dir=rtl] .objectives{padding-left:0;padding-right:1.2rem}
html[dir=rtl] .search-wrap input{padding:0 2.1rem 0 .75rem}
html[dir=rtl] .search-wrap .fa-magnifying-glass{left:auto;right:.7rem}
html[dir=rtl] .pager a.next{text-align:left}
html[dir=rtl] .to-top{right:auto;left:1rem}
html[dir=rtl] .tree ul{margin-left:0;margin-right:1.1rem;border-left:0;border-right:1.5px solid var(--line);padding-left:0;padding-right:.9rem}
html[dir=rtl] .tree ul > li::before{left:auto;right:-.9rem}
html[dir=rtl] .tl-item::before,html[dir=rtl] .tl-item .yr{left:auto;right:.5rem}
html[dir=rtl] .mind-col li{padding:.15rem .8rem .15rem 0}
html[dir=rtl] .mind-col li::before{left:auto;right:0}
html[dir=rtl] .q-hint{margin:-.25rem 2.3rem .4rem 0}
html[dir=rtl] .read-progress{left:auto;right:0}
html[dir=rtl] .tbl th,html[dir=rtl] .tbl td{text-align:right}
html[dir=rtl] .flow .arr .fa-arrow-right{transform:scaleX(-1)}
html[dir=rtl] .me-1{margin-right:0!important;margin-left:.25rem!important}
html[dir=rtl] .me-2{margin-right:0!important;margin-left:.5rem!important}
@media (max-width:991.98px){html[dir=rtl] .sidebar{left:auto;right:0;transform:translateX(100%)}html[dir=rtl] .sidebar.open{transform:none}}
@media (max-width:575.98px){
  .topbar{gap:.4rem;padding:0 .5rem}
  .brand small{display:none}
  .brand{font-size:.92rem}
  .lang-switch button{padding:0 .45rem;font-size:.8rem}
  .topbar .btn-icon{min-width:34px;height:34px;padding:0 .4rem}
  .main{padding:1rem .8rem 4rem}
  .topic{padding:.9rem .9rem}
}
body{overflow-x:hidden}
#mapSvg .lbl{font-size:16px}
#mapSvg .lbl-ar{font-size:15px}
.map-wrap{max-width:1000px;margin:0 auto}
.link-item .pair .bi{display:inline-grid;vertical-align:middle}
body.mode-both .widget .w-log span.en + span.ar,
body.mode-both .widget label span.en + span.ar,
body.mode-both .widget small span.en + span.ar,
body.mode-both .explain span.en + span.ar{display:block;margin-left:0;padding-left:0;border-left:0}
@media (max-width:420px){.brand > span:last-child{display:none}}
