
/* ============================================================
   DESIGN TOKENS
   ============================================================ */
/* ============================================================
   CS9 UNIT PAGES — styles (loaded only on pages using the
   "CS9 Unit (Universal)" template).
   Colours & fonts are NOT set here: they come from theme.json
   (Appearance > Editor > Styles), so changing the brand there
   restyles the unit pages automatically.
   ============================================================ */
:root{
  --paper:var(--wp--preset--color--base, #F5F7FA);
  --panel:var(--wp--preset--color--base-2, #FFFFFF);
  --panel-alt:var(--wp--preset--color--surface, #ECEFF4);
  --ink:var(--wp--preset--color--contrast, #10182B);
  --body-text:var(--wp--preset--color--ink-soft, #33405C);
  --muted:var(--wp--preset--color--contrast-2, #6B7690);
  --line:var(--wp--preset--color--contrast-3, #DCE1EA);
  --blue:var(--wp--preset--color--accent, #2657D9);
  --blue-dark:var(--wp--preset--color--accent-5, #1B3FA0);
  --blue-soft:var(--wp--preset--color--accent-2, #E9EFFD);
  --amber:var(--wp--preset--color--accent-3, #C97A17);
  --amber-soft:var(--wp--preset--color--warning-soft, #FBEED9);
  --green:var(--wp--preset--color--success, #188A63);
  --green-soft:var(--wp--preset--color--success-soft, #E1F5EC);
  --red:var(--wp--preset--color--danger, #C6373B);
  --red-soft:var(--wp--preset--color--danger-soft, #FCE8E8);
  --dark-panel:var(--wp--preset--color--night, #101828);
  --mono-accent:var(--wp--preset--color--mint, #6FE0C4);
  --radius-s:8px;
  --radius-m:14px;
  --radius-l:22px;
  --shadow:0 1px 2px rgba(16,24,43,.04), 0 8px 24px rgba(16,24,43,.06);
  --maxw:740px;
  --f-body:var(--wp--preset--font-family--body, system-ui, sans-serif);
  --f-head:var(--wp--preset--font-family--heading, system-ui, sans-serif);
  --f-mono:var(--wp--preset--font-family--mono, ui-monospace, monospace);
}
html{scroll-behavior:smooth; scroll-padding-top:88px;}
.cs9-shell,.cs9-topbar{
  color:var(--body-text);
  font-family:var(--f-body);
  font-size:16.5px;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
}
.cs9-shell *,.cs9-shell *::before,.cs9-shell *::after,
.cs9-topbar *,.cs9-topbar *::before,.cs9-topbar *::after{box-sizing:border-box;}
.cs9-shell h1,.cs9-shell h2,.cs9-shell h3,.cs9-shell h4,
.cs9-topbar h1,.cs9-topbar h2{
  font-family:var(--f-head);
  font-weight:700;
  color:var(--ink);
  line-height:1.25;
  margin:0 0 .5em;
  letter-spacing:normal;
}
.cs9-shell p{margin:0 0 1em;}
.cs9-main ul,.cs9-main ol{margin:0 0 1em; padding-left:1.4em;}
.cs9-shell a{color:var(--blue);}
.cs9-shell img,.cs9-shell svg{max-width:100%;}
/* the block-editor wrapper around the pasted content must not add its own spacing/width rules */
.cs9-main .wp-block-post-content{max-width:none !important; padding:0; margin:0;}
.cs9-main .wp-block-post-content > *{margin-block-start:0 !important; max-width:none !important; margin-left:0 !important; margin-right:0 !important;}
.bincode{
  font-family:var(--f-mono);
  font-weight:600;
  background:var(--panel-alt);
  padding:.1em .45em;
  border-radius:6px;
  font-size:.92em;
}
.urdu-script{font-family:'Noto Nastaliq Urdu','Noto Sans Arabic',serif; font-size:1.2em; font-weight:500;}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.cs9-shell{display:flex; max-width:1180px; margin:0 auto; align-items:flex-start;}
.cs9-main{flex:1; min-width:0; padding:40px 32px 120px; max-width:var(--maxw); margin:0 auto;}

/* ---- Sidebar (desktop) ---- */
.cs9-sidebar{
  width:270px; flex-shrink:0; position:sticky; top:0;
  height:100vh; overflow-y:auto; padding:28px 22px 28px 32px;
  border-right:1px solid var(--line);
}
.cs9-brand{font-family:var(--f-head); font-weight:700; font-size:14px; color:var(--blue); letter-spacing:.02em; margin-bottom:2px;}
.cs9-brand-sub{font-size:13px; color:var(--muted); margin-bottom:18px;}
.cs9-progress-wrap{margin-bottom:22px;}
.cs9-progress-label{display:flex; justify-content:space-between; font-size:12.5px; color:var(--muted); margin-bottom:6px;}
.cs9-progress-track{height:7px; background:var(--panel-alt); border-radius:99px; overflow:hidden;}
.cs9-progress-fill{height:100%; width:0%; background:linear-gradient(90deg,var(--blue),var(--mono-accent)); border-radius:99px; transition:width .5s ease;}
.cs9-toc{list-style:none; margin:0; padding:0;}
.cs9-toc li{margin:1px 0;}
.cs9-toc a{
  display:flex; align-items:center; gap:9px;
  text-decoration:none; color:var(--body-text); font-size:14.5px;
  padding:8px 10px; border-radius:9px; font-weight:500;
  border-left:2px solid transparent;
}
.cs9-toc a:hover{background:var(--panel-alt);}
.cs9-toc a.is-active{background:var(--blue-soft); color:var(--blue-dark); border-left-color:var(--blue);}
.cs9-toc .chk{
  width:17px; height:17px; border-radius:50%; border:1.5px solid var(--line);
  flex-shrink:0; display:flex; align-items:center; justify-content:center;
  font-size:10px; color:transparent;
}
.cs9-toc a.is-done .chk{background:var(--green); border-color:var(--green); color:#fff;}

/* ---- Mobile topbar ---- */
.cs9-topbar{display:none; position:sticky; top:0; z-index:40; background:rgba(245,247,250,.92); backdrop-filter:blur(6px); border-bottom:1px solid var(--line); padding:12px 16px;}
.cs9-topbar-row{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.cs9-topbar button{font:inherit;}
#cs9-tocBtn{
  display:flex; align-items:center; gap:8px; background:var(--panel); border:1px solid var(--line);
  padding:8px 13px; border-radius:99px; font-weight:600; font-size:13.5px; color:var(--ink);
}
.cs9-topbar-progress{flex:1; height:6px; background:var(--panel-alt); border-radius:99px; overflow:hidden; margin-left:6px;}
.cs9-topbar-progress i{display:block; height:100%; width:0%; background:var(--blue); border-radius:99px; transition:width .5s ease;}
#cs9-mobileDrawer{display:none; background:var(--panel); border-bottom:1px solid var(--line); padding:10px 16px 18px;}
#cs9-mobileDrawer.open{display:block;}

/* ============================================================
   LANGUAGE TOGGLE
   ============================================================ */
.cs9-langtoggle{
  display:inline-flex; background:var(--panel-alt); border-radius:99px; padding:3px; gap:2px;
}
.cs9-langtoggle button{
  border:none; background:transparent; padding:7px 16px; border-radius:99px; font-family:var(--f-head);
  font-weight:600; font-size:13px; color:var(--muted); cursor:pointer;
}
.cs9-langtoggle button.active{background:var(--ink); color:#fff;}
.content-ur{display:none !important;}
body.lang-ur .content-ur{display:block !important;}
body.lang-ur .content-en{display:none !important;}
.ur-placeholder{
  border:1.5px dashed var(--amber); background:var(--amber-soft); color:#7A4E0E;
  border-radius:var(--radius-s); padding:14px 16px; font-size:14.5px; font-style:italic;
}

.cs9-crossnav{display:flex; align-items:center; gap:12px; font-size:13px; margin-bottom:20px; flex-wrap:wrap;}
.cs9-crossnav a{color:var(--muted); text-decoration:none; font-weight:600; padding:6px 12px; border-radius:99px; background:var(--panel-alt);}
.cs9-crossnav a:hover{color:var(--blue); background:var(--blue-soft);}
.cs9-crossnav .next-link{color:var(--blue-dark); background:var(--blue-soft);}

/* ============================================================
   HERO
   ============================================================ */
.cs9-hero{margin-bottom:8px;}
.cs9-unit-badge{
  display:inline-block; font-family:var(--f-head); font-weight:700; font-size:12.5px;
  letter-spacing:.03em; color:var(--blue-dark); background:var(--blue-soft);
  padding:5px 13px; border-radius:99px; margin-bottom:16px;
}
.cs9-hero h1{font-size:clamp(28px,4vw,38px); max-width:20ch;}
.cs9-hero .subtitle{font-size:17px; color:var(--muted); max-width:56ch; margin-bottom:22px;}
.cs9-outcomes{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-m);
  padding:20px 22px; margin:26px 0 8px;
}
.cs9-outcomes h4{font-size:14px; text-transform:none; margin-bottom:10px;}
.cs9-outcomes ul{margin:0; padding-left:20px;}
.cs9-outcomes li{margin-bottom:6px; font-size:15px;}
.cs9-hero-toggle-row{display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:14px; margin:22px 0 6px;}

/* ============================================================
   TOPIC SECTIONS
   ============================================================ */
.topic-section{padding:56px 0 8px; border-top:1px solid var(--line); scroll-margin-top:90px;}
.topic-section:first-of-type{border-top:none;}
.topic-kicker{font-family:var(--f-mono); font-size:13px; color:var(--blue); font-weight:600; margin-bottom:6px;}
.topic-section h2{font-size:26px; margin-bottom:18px;}
.topic-section h3{font-size:18px; margin-top:28px;}

.diagram-box{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-m);
  padding:22px 18px 16px; margin:24px 0; text-align:center; box-shadow:var(--shadow);
}
.diagram-box svg{max-width:100%; height:auto;}
.diagram-caption{font-size:13.5px; color:var(--muted); margin-top:10px; font-style:italic;}

.example-box{
  background:var(--amber-soft); border-left:4px solid var(--amber); border-radius:0 var(--radius-s) var(--radius-s) 0;
  padding:16px 20px; margin:22px 0;
}
.example-box .tag{font-family:var(--f-head); font-weight:700; font-size:12.5px; color:#7A4E0E; display:block; margin-bottom:6px;}

.workbox{
  background:var(--dark-panel); color:#DCE6F5; border-radius:var(--radius-m);
  padding:18px 20px; margin:20px 0; font-family:var(--f-mono); font-size:14px; line-height:1.9;
  overflow-x:auto;
}
.workbox .res{color:var(--mono-accent); font-weight:600;}

.def-table{width:100%; border-collapse:collapse; margin:20px 0; font-size:14.5px;}
.def-table th,.def-table td{border:1px solid var(--line); padding:9px 12px; text-align:left;}
.def-table th{background:var(--panel-alt); font-family:var(--f-head); font-size:13px;}

.ladder{display:flex; flex-direction:column; gap:7px; max-width:400px; margin:0 auto; text-align:left;}
.ladder-row{display:flex; justify-content:space-between; align-items:center; background:var(--panel-alt); padding:9px 15px; border-radius:8px;}
.ladder-row .rem{color:var(--blue-dark); font-weight:600; font-family:var(--f-mono); font-size:13px;}
.ladder-result{margin-top:16px; font-family:var(--f-mono); font-weight:700; font-size:15px; color:#0E5C42; background:var(--green-soft); display:inline-block; padding:10px 20px; border-radius:99px;}

/* ============================================================
   QUIZ ENGINE UI
   ============================================================ */
.quiz-block{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-l);
  padding:24px 24px 26px; margin:30px 0 10px; box-shadow:var(--shadow);
}
.quiz-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; flex-wrap:wrap; gap:8px;}
.quiz-head h4{font-size:15.5px; margin:0; display:flex; align-items:center; gap:8px;}
.quiz-score{font-family:var(--f-mono); font-size:13.5px; font-weight:600; color:var(--blue-dark); background:var(--blue-soft); padding:4px 11px; border-radius:99px;}
.quiz-stepbar{height:6px; background:var(--panel-alt); border-radius:99px; overflow:hidden; margin:14px 0 8px;}
.quiz-stepfill{height:100%; width:0%; background:linear-gradient(90deg,var(--blue),var(--mono-accent)); border-radius:99px; transition:width .35s ease;}
.quiz-step{font-size:12.5px; font-weight:600; color:var(--muted); letter-spacing:.02em;}
.quiz-q{display:none; margin-top:16px;}
.quiz-q.active{display:block;}
.quiz-nav{display:flex; justify-content:flex-end; margin-top:14px;}
.quiz-next{
  display:none; background:var(--blue); color:#fff; border:none; border-radius:99px;
  padding:11px 22px; font-family:var(--f-head); font-weight:700; font-size:14px; cursor:pointer;
  box-shadow:0 4px 14px rgba(38,87,217,.25);
}
.quiz-next.show{display:inline-block;}
.quiz-next:hover{background:var(--blue-dark);}
.quiz-result{display:none; text-align:center; padding:22px 8px 6px;}
.quiz-result.show{display:block;}
.quiz-result .big{font-family:var(--f-head); font-size:40px; font-weight:800; color:var(--blue-dark); line-height:1.1;}
.quiz-result .msg{font-weight:600; color:var(--ink); margin:10px 0 4px; font-size:16px;}
.quiz-result .sub{color:var(--muted); font-size:13.5px; margin:0 0 6px;}
.quiz-q p.qtext{font-weight:600; color:var(--ink); margin-bottom:12px; font-size:15.5px;}
.quiz-opt{
  display:flex; align-items:center; gap:10px; width:100%; text-align:left;
  background:var(--panel-alt); border:1px solid var(--line); border-radius:var(--radius-s);
  padding:11px 14px; margin-bottom:8px; font-family:var(--f-body); font-size:14.5px;
  color:var(--body-text); cursor:pointer; transition:background .15s, border-color .15s;
}
.quiz-opt:hover:not(:disabled){border-color:var(--blue);}
.quiz-opt .badge{
  width:22px; height:22px; border-radius:50%; background:#fff; border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0;
}
.quiz-opt.correct{background:var(--green-soft); border-color:var(--green); color:#0E5C42;}
.quiz-opt.correct .badge{background:var(--green); border-color:var(--green); color:#fff;}
.quiz-opt.wrong{background:var(--red-soft); border-color:var(--red); color:#8A2226;}
.quiz-opt.wrong .badge{background:var(--red); border-color:var(--red); color:#fff;}
.quiz-opt:disabled{cursor:default;}
.quiz-explain{
  display:none; margin-top:6px; background:var(--panel-alt); border-radius:var(--radius-s);
  padding:11px 14px; font-size:14px; color:var(--body-text);
}
.quiz-explain.show{display:block;}
.quiz-explain b{color:var(--ink);}
.quiz-reset{
  margin-top:20px; background:none; border:1px solid var(--line); border-radius:99px;
  padding:8px 16px; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer; font-family:var(--f-head);
}
.quiz-done-msg{display:none; margin-top:18px; background:var(--green-soft); color:#0E5C42; border-radius:var(--radius-s); padding:12px 15px; font-size:14.5px; font-weight:600;}
.quiz-done-msg.show{display:block;}

/* ============================================================
   PRACTICE / EXERCISE SECTION
   ============================================================ */
.practice-item{margin-bottom:18px;}
.practice-item .qn{font-weight:600; color:var(--ink);}
.reveal-btn{
  margin-top:8px; background:var(--blue-soft); color:var(--blue-dark); border:none; border-radius:99px;
  padding:7px 15px; font-size:13px; font-weight:700; cursor:pointer; font-family:var(--f-head);
}
.reveal-ans{display:none; margin-top:10px; background:var(--panel-alt); border-left:3px solid var(--blue); border-radius:0 var(--radius-s) var(--radius-s) 0; padding:12px 15px; font-size:14.5px;}
.reveal-ans.show{display:block;}

/* ============================================================
   FOOTER NOTE
   ============================================================ */
.cs9-footnote{margin-top:70px; padding-top:22px; border-top:1px solid var(--line); font-size:12.5px; color:var(--muted);}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1024px){
  .cs9-sidebar{display:none;}
  .cs9-topbar{display:block;}
  .cs9-main{padding:26px 20px 100px;}
}

/* ---- Theme integration ---- */
body.admin-bar .cs9-sidebar{top:32px; height:calc(100vh - 32px);}
body.admin-bar .cs9-topbar{top:32px;}
@media (max-width:782px){ body.admin-bar .cs9-topbar{top:46px;} }

/* ---- Language: only show what is really translated ---- */
/* an English block with no Roman Urdu twin stays visible in both modes */
body.lang-ur .content-en.en-only{display:revert !important;}

/* Roman Urdu hero title is a styled <div>, so each page has exactly ONE <h1> (SEO). */
.cs9-hero .cs9-h1{font-family:var(--f-head); font-weight:700; color:var(--ink); line-height:1.25; margin:0 0 .5em; font-size:clamp(28px,4vw,38px); max-width:20ch;}
