/* Zaid Berjis — lesson pages, subject pages and self-study components */

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Subject tags ---------- */
.tag-sat::before { background: var(--sat); }
.tag-calc::before { background: var(--calc); }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 0.92rem; color: var(--text-muted); margin-bottom: 14px; }
.crumbs a { color: var(--text-muted); }
.crumbs span[aria-hidden] { color: var(--border); }

/* ---------- Lessons index ---------- */
.subject-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px;
}
.subject-card a {
  display: flex; flex-direction: column; gap: 8px; height: 100%;
  padding: 22px 22px 20px; border: 1px solid var(--border); border-radius: 14px;
  color: var(--ink); text-decoration: none; position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.subject-card a::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 6px; background: var(--accent);
}
.subject-card a:hover { border-color: var(--ink); transform: translateY(-2px); }
.sc-name { font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; letter-spacing: -0.01em; margin-top: 4px; }
.sc-blurb { color: var(--text-muted); font-size: 0.98rem; flex: 1; }
.sc-count { font-family: var(--font-head); font-weight: 600; font-size: 0.92rem; color: var(--accent-ink, var(--accent)); }

.subject-math { --accent: var(--math); }
.subject-physics { --accent: var(--physics); }
.subject-sat { --accent: var(--sat); --accent-ink: #4F7A0C; }
.subject-calc { --accent: var(--calc); }

.how-steps { margin: 0 0 18px; padding-left: 1.3em; max-width: 72ch; color: var(--text-soft); }
.how-steps li { margin: 0 0 8px; }

/* ---------- Subject page ---------- */
.subject-head h1 { position: relative; padding-left: 22px; }
.subject-head h1::before {
  content: ""; position: absolute; left: 0; top: 0.12em; bottom: 0.12em; width: 8px; border-radius: 4px; background: var(--accent);
}
.unit { padding: 36px 0 8px; }
.unit h2 { font-size: 1.55rem; margin-bottom: 6px; }
.unit-intro { color: var(--text-muted); margin-bottom: 14px; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-item {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px;
  padding: 18px 0; border-top: 1px solid var(--panel-head);
}
.lesson-item:last-child { border-bottom: 1px solid var(--panel-head); }
.li-num {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; color: var(--text-soft);
}
.lesson-item.is-done .li-num { background: var(--accent, var(--ink)); border-color: var(--accent, var(--ink)); color: #fff; font-size: 0; }
.lesson-item.is-done .li-num::after { content: "✓"; font-size: 1rem; }
.lesson-item h3 { margin: 4px 0; }
.lesson-item h3 a { color: var(--ink); text-decoration: none; }
.lesson-item h3 a:hover { text-decoration: underline; }
.lesson-item p { margin: 0; color: var(--text-muted); }
.li-top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 0.86rem; }
.li-kind { font-weight: 700; color: var(--ink); background: var(--tint-yellow); padding: 1px 8px; border-radius: 999px; }
.li-time { color: var(--text-muted); }
.li-done { color: #2F7D32; font-weight: 700; }

.progress { margin-top: 18px; max-width: 420px; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--panel-head); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent, var(--ink)); border-radius: 4px; transition: width .4s; }
.progress-text { font-size: 0.9rem; color: var(--text-muted); margin: 6px 0 0; }

.coming-soon { padding: 32px 0 56px; }
.coming-soon .wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px; align-items: center; }
.coming-soon img { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 10px 30px rgba(29,29,27,.18), 0 2px 6px rgba(29,29,27,.12); }
@media (max-width: 760px) { .coming-soon .wrap { grid-template-columns: 1fr; } .coming-soon img { max-width: 220px; } }

/* ---------- Lesson article ---------- */
.lesson .wrap { max-width: 780px; }
.lesson.wide .wrap { max-width: 1280px; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }
.lesson-meta .done-flag { color: #2F7D32; font-weight: 700; }
.lesson h1 { margin-bottom: 0.4em; }
.lesson .lede { font-size: 1.18rem; color: var(--text-soft); }
.lesson h2 { scroll-margin-top: 20px; }
.lesson h3 { font-size: 1.15rem; margin-top: 1.6em; }
.lesson ul, .lesson ol { padding-left: 1.3em; }
.lesson li { margin-bottom: 6px; }
.lesson table { border-collapse: collapse; margin: 14px 0 22px; font-size: 0.97rem; width: 100%; max-width: 100%; }
.lesson th, .lesson td { border-bottom: 1px solid var(--panel-head); padding: 8px 10px; text-align: left; vertical-align: top; }
.lesson th { font-family: var(--font-head); font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--border); }
.table-scroll { overflow-x: auto; }
.label {
  font-family: var(--font-head); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; margin: 0 0 6px; color: var(--ink);
}

.lesson-toc {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px 10px; margin: 18px 0 8px;
}
.lesson-toc ol { margin: 0; padding-left: 1.3em; columns: 2 220px; column-gap: 28px; }
.lesson-toc li { margin: 0 0 6px; break-inside: avoid; color: var(--text-muted); }
.lesson-toc a { color: var(--ink); text-decoration: none; }
.lesson-toc a:hover { text-decoration: underline; }

/* Goals */
.goals { background: var(--tint-lavender); border-radius: var(--radius); padding: 16px 22px 8px; margin: 22px 0; }
.goals ul { margin: 0 0 8px; }
.goals li { color: var(--ink); }

/* Generic callouts */
.box { border-radius: var(--radius); padding: 16px 20px 6px; margin: 22px 0; }
.box p, .box li { color: var(--text-soft); }
.box > :last-child { margin-bottom: 10px; }

.key { background: var(--tint-butter); border-left: 5px solid var(--pair4-a); border-radius: 0 var(--radius) var(--radius) 0; }
.define { background: var(--paper); border: 1px solid var(--border); border-left: 5px solid var(--physics); border-radius: 0 var(--radius) var(--radius) 0; }
.define dfn { font-style: normal; font-weight: 700; color: var(--ink); }
.formula { background: var(--tint-yellow); border: 1px solid #FCDD51; text-align: left; }
.formula .katex-display { margin: 6px 0 10px; }
.mistake { background: #FDECEC; border-left: 5px solid #C62828; border-radius: 0 var(--radius) var(--radius) 0; }
.mistake .label { color: #9B1C1C; }
.aside { background: var(--tint-sky); border-radius: var(--radius); }

/* Think first: question, then a reveal */
.think { border: 2px dashed var(--pair6-b); border-radius: var(--radius); padding: 16px 20px 12px; margin: 22px 0; }
.think .label { color: var(--pair6-a); }
.think > p { color: var(--ink); }

details.reveal { margin: 4px 0 6px; }
details.reveal > summary {
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 600; font-size: 0.95rem; color: var(--link);
  list-style: none; padding: 4px 0;
}
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.9rem; line-height: 1;
}
details.reveal[open] > summary::before { content: "–"; }
details.reveal > div { padding: 8px 0 2px 14px; border-left: 3px solid var(--panel-head); margin: 6px 0 4px 9px; }
details.reveal > div > :last-child { margin-bottom: 0; }

/* Demo panel */
.demo {
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px; margin: 30px 0;
  background: var(--paper);
}
.demo-wide { width: min(1040px, calc(100vw - 56px)); margin-left: calc(50% - min(520px, calc(50vw - 28px))); }
.demo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.demo-title { font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; margin: 0; }
.demo-kind { font-size: 0.8rem; font-weight: 700; color: var(--pair2-b); text-transform: uppercase; letter-spacing: 0.08em; }
.try { background: var(--tint-sky); border-radius: var(--radius); padding: 12px 18px 6px; margin-top: 14px; }
.try ol, .try ul { margin: 0 0 8px; }
.try li { color: var(--ink); font-size: 0.97rem; }
.demo .scroll-hint { display: none; font-size: 0.82rem; color: var(--text-muted); margin: 6px 0 0; }
.demo.is-scaled-min .scroll-hint { display: block; }

/* Worked example with step-by-step reveal */
.example { border: 1px solid var(--border); border-radius: var(--radius); margin: 26px 0; overflow: hidden; }
.example > .ex-head { background: var(--tint-lavender); padding: 14px 20px 10px; }
.example > .ex-head .label { color: var(--physics); }
.example > .ex-head p { color: var(--ink); margin-bottom: 6px; }
.example .steps { list-style: none; margin: 0; padding: 6px 20px 4px; counter-reset: step; }
.example .steps > li {
  counter-increment: step; position: relative; padding: 12px 0 10px 42px; margin: 0;
  border-bottom: 1px dotted var(--border); color: var(--text-soft);
}
.example .steps > li:last-child { border-bottom: 0; }
.example .steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--physics); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 0.9rem;
  display: grid; place-items: center;
}
.example .steps > li > b:first-child { color: var(--ink); }
.example .steps > li.step-hidden { display: none; }
.example .steps > li.step-new { animation: stepIn .35s ease; }
@keyframes stepIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.example .answer { background: #E8F5E9; border-radius: 8px; padding: 8px 12px; margin-top: 8px; color: #1B5E20; font-weight: 700; }
.ex-controls { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--panel-head); align-items: center; }
.ex-controls .count { font-size: 0.88rem; color: var(--text-muted); margin-left: auto; }

.btn-sm { padding: 8px 16px; font-size: 0.92rem; }
.btn-soft { background: var(--paper); color: var(--ink); border-color: var(--border); }
.btn-soft:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .45; cursor: default; }

/* Practice questions */
.practice { margin: 22px 0; }
.q {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px 10px; margin: 0 0 16px;
}
.q > .q-num { font-family: var(--font-head); font-weight: 700; font-size: 0.82rem; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.q > p { color: var(--ink); }

/* Multiple choice */
.choices { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 8px; }
.choices li { margin: 0; }
.choice {
  width: 100%; text-align: left; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start;
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer;
}
.choice:hover { border-color: var(--ink); }
.choice .letter {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 0.85rem;
}
.choice.is-right { border-color: #2F7D32; background: #E8F5E9; }
.choice.is-right .letter { background: #2F7D32; border-color: #2F7D32; color: #fff; }
.choice.is-wrong { border-color: #C62828; background: #FDECEC; }
.choice.is-wrong .letter { background: #C62828; border-color: #C62828; color: #fff; }
.choice[disabled] { cursor: default; }
.feedback { font-weight: 700; margin: 4px 0 8px; min-height: 1.4em; }
.feedback.ok { color: #2F7D32; }
.feedback.no { color: #C62828; }

/* Numeric answer */
.num-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 8px; }
.num-row input {
  font: inherit; width: 150px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
}
.num-row input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--tint-sky); }
.num-row .unit { color: var(--text-soft); }
.num-row input.ok { border-color: #2F7D32; background: #F1F8F1; }
.num-row input.no { border-color: #C62828; background: #FFF6F6; }

/* Summary */
.summary { background: var(--tint-lavender); border-radius: var(--radius); padding: 18px 22px 8px; margin: 28px 0; }
.summary ul { margin: 0 0 10px; }
.summary li { color: var(--ink); }

/* Finish and prev/next */
.finish {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  border-top: 1px solid var(--panel-head); margin-top: 48px; padding-top: 28px;
}
.finish h2 { margin: 0 0 4px; font-size: 1.3rem; }
.finish p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.finish .btn.is-done { background: #2F7D32; border-color: #2F7D32; }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.pn { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.pn:hover { border-color: var(--ink); }
.pn-next { text-align: right; grid-column: 2; }
.pn-dir { font-size: 0.82rem; color: var(--text-muted); }
.pn-title { font-family: var(--font-head); font-weight: 600; }
@media (max-width: 560px) { .prevnext { grid-template-columns: 1fr; } .pn-next { grid-column: 1; } }

/* Small figures drawn in SVG */
.fig { margin: 22px 0; }
.fig svg { width: 100%; height: auto; max-width: 640px; margin: 0 auto; }
.fig figcaption { font-size: 0.9rem; color: var(--text-muted); text-align: center; margin-top: 6px; }
.fig text { font-family: var(--font-body); }

@media print {
  .site-header, .site-footer, .finish, .prevnext, .ex-controls { display: none; }
  .example .steps > li.step-hidden { display: block; }
}

/* ---------- Books page: featured title ---------- */
.book-feature .wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 56px; align-items: start; }
.book-cover { margin: 0; }
.book-cover img { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 14px 36px rgba(29,29,27,.2), 0 2px 6px rgba(29,29,27,.12); }
.book-status { display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: 0.85rem; color: var(--calc); background: #FCE4F1; padding: 3px 12px; border-radius: 999px; margin-bottom: 14px; }
.book-sub { font-family: var(--font-head); font-weight: 600; color: var(--text-muted); margin-top: -4px; }
.book-points { padding-left: 1.2em; color: var(--text-soft); margin: 0 0 8px; }
.book-points li { margin-bottom: 6px; }
@media (max-width: 760px) { .book-feature .wrap { grid-template-columns: 1fr; gap: 28px; } .book-cover { max-width: 240px; } }
