/* =====================================================================
   StudyHub — HSC_Subjects / subject-theme.css
   Per-subject theming + long-form study-guide components.
   Layered ON TOP of ../style.css so new pages stay visually consistent
   with the rest of the site while every subject gets its own identity.
   ===================================================================== */

/* ---------- 1. SUBJECT THEMES -------------------------------------
   Apply by putting the class on <body>, e.g. <body class="theme-maths">
   Each theme re-skins the hero gradient, headings, buttons, table
   headers, callouts, TOC and pull-quote rule.                      */

body.theme-maths { --brand:#2b3a8f; --brand-dark:#151c4a; --brand-soft:#e8eaf8; --accent:#f07f1a; --accent-soft:#fff1e0; }
body.theme-ext1  { --brand:#5b2d8e; --brand-dark:#2a1247; --brand-soft:#f0e8fa; --accent:#12a0a8; --accent-soft:#e2f6f7; }
body.theme-ext2  { --brand:#8e1b4b; --brand-dark:#3d0a20; --brand-soft:#fae7ef; --accent:#c9a227; --accent-soft:#fbf3dd; }
body.theme-bio   { --brand:#1f7a4d; --brand-dark:#0d3d26; --brand-soft:#e4f4ec; --accent:#d94f1a; --accent-soft:#ffece4; }
body.theme-chem  { --brand:#0b6fa4; --brand-dark:#053349; --brand-soft:#e2f0f8; --accent:#e8590c; --accent-soft:#fff0e4; }
body.theme-phys  { --brand:#4c2f8f; --brand-dark:#231147; --brand-soft:#ece7fa; --accent:#0b7285; --accent-soft:#e0f2f5; }
body.theme-econ  { --brand:#a86500; --brand-dark:#4a2e00; --brand-soft:#fdf0d8; --accent:#1d6f42; --accent-soft:#e6f4ec; }
body.theme-biz   { --brand:#a63030; --brand-dark:#4d1111; --brand-soft:#fbe8e8; --accent:#1f5fa8; --accent-soft:#e7f0fa; }
body.theme-mhist { --brand:#7b241c; --brand-dark:#3a0f0b; --brand-soft:#f8e7e4; --accent:#b9770e; --accent-soft:#fdf1dd; }
body.theme-ahist { --brand:#8a5a2b; --brand-dark:#3d2510; --brand-soft:#f8efe2; --accent:#2f6f4f; --accent-soft:#e6f2ec; }
body.theme-geo   { --brand:#2f6f4f; --brand-dark:#123324; --brand-soft:#e6f2ec; --accent:#0b6fa4; --accent-soft:#e3f0f8; }
body.theme-legal { --brand:#1f3864; --brand-dark:#0b1730; --brand-soft:#e6ebf5; --accent:#a63030; --accent-soft:#fbe8e8; }
body.theme-psych { --brand:#9c1f66; --brand-dark:#450c2c; --brand-soft:#fae6f1; --accent:#1d6f9c; --accent-soft:#e5f1f8; }
body.theme-soc   { --brand:#5c6b1f; --brand-dark:#262d0a; --brand-soft:#eef1de; --accent:#a86500; --accent-soft:#fdf0d8; }
body.theme-hub   { --brand:#481e2a; --brand-dark:#2a0f18; --brand-soft:#f3e7ea; --accent:#008464; --accent-soft:#e5f2ee; }

/* ---------- 2. LAYOUT / TYPE ---------------------------------------- */
.guide-wrap { max-width: 900px; margin: 0 auto; padding: 30px 22px 70px; }
.guide-wrap.narrow { max-width: 860px; }
h2.sec { scroll-margin-top: 70px; }
h2.sec::after { width: 64px; }
.lead { font-size: 1.08rem; color: #333; }
.small { font-size: 0.9rem; color: var(--muted); }
.center { text-align: center; }

/* Section opener: numbered chip + rule */
.sec-head { display: flex; align-items: baseline; gap: 14px; margin: 52px 0 16px; flex-wrap: wrap; }
.sec-head .num { font-size: 0.78rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: #fff; background: var(--brand); padding: 5px 12px; border-radius: 6px; }
.sec-head h2 { margin: 0; }
.sec-head h2::after { display: none; }

/* ---------- 3. HERO EXTRAS ----------------------------------------- */
.hero h1 { text-transform: none; }
.hero .sub { max-width: 780px; margin: 0 auto; opacity: 0.95; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 26px auto 0; max-width: 860px; }
.hero-stats .st { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28);
  border-radius: 10px; padding: 10px 16px; min-width: 120px; }
.hero-stats .st b { display: block; font-size: 1.25rem; font-weight: 800; }
.hero-stats .st span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.4px; opacity: 0.9; }

.pdf-btn { display: inline-block; margin-top: 20px; background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4); color: #fff; font-weight: 700; font-size: 0.9rem;
  padding: 9px 18px; border-radius: 24px; cursor: pointer; }
.pdf-btn:hover { background: rgba(255,255,255,0.3); }

.nav { background: var(--brand-dark); padding: 12px 24px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav a { color: #fff; font-weight: 600; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav .logo { color: #fff; font-weight: 800; margin-right: 6px; }

/* ---------- 4. TABLE OF CONTENTS ----------------------------------- */
.toc { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--brand);
  border-radius: 0 14px 14px 0; padding: 22px 26px; margin: 30px 0 10px; }
.toc h4 { color: var(--brand-dark); margin: 0 0 12px; font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; }
.toc ol { columns: 2; column-gap: 30px; padding-left: 20px; margin: 0; }
.toc li { margin: 6px 0; break-inside: avoid; font-size: 0.95rem; }
.toc a { color: var(--brand); font-weight: 600; }
@media (max-width: 720px) { .toc ol { columns: 1; } }

/* ---------- 5. PULL-QUOTE (verbatim NESA text) --------------------- */
.pullquote { position: relative; background: #fff; border: 1px solid var(--line);
  border-left: 6px solid var(--accent); border-radius: 0 14px 14px 0; padding: 26px 30px; margin: 26px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.pullquote p { font-size: 1.03rem; line-height: 1.8; margin: 0 0 12px; }
.pullquote p:last-of-type { margin-bottom: 0; }
.pullquote .src { font-size: 0.85rem; color: var(--muted); font-style: normal; border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 16px; }
.pullquote .src b { color: var(--brand-dark); }

/* ---------- 6. CITATIONS ------------------------------------------- */
sup.cite { font-size: 0.68em; font-weight: 800; color: var(--accent); vertical-align: super;
  line-height: 0; padding-left: 1px; }
.cite-note { font-size: 0.85rem; color: var(--muted); font-style: italic; margin: -6px 0 18px; }
.refs { counter-reset: ref; list-style: none; padding: 0; margin: 14px 0 0; }
.refs li { counter-increment: ref; position: relative; padding-left: 38px; margin: 12px 0; font-size: 0.93rem; color: #333; }
.refs li::before { content: "[" counter(ref) "]"; position: absolute; left: 0; top: 0;
  font-weight: 800; color: var(--brand); font-size: 0.85rem; }
.refs li em { color: var(--ink); }
.refs a { word-break: break-word; }

/* ---------- 7. WORKED EXAMPLE CARD --------------------------------- */
.worked { background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--brand);
  border-radius: 0 0 14px 14px; padding: 24px 28px; margin: 26px 0; box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.worked > h4 { color: var(--brand-dark); margin: 0 0 4px; font-size: 1.15rem; }
.worked .q { background: var(--panel); border-left: 4px solid var(--muted); padding: 14px 18px;
  border-radius: 0 8px 8px 0; margin: 14px 0; }
.worked .q b { color: var(--brand-dark); }
.worked .marks { font-size: 0.82rem; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent); margin-top: 4px; }
.worked .ans { border-left: 5px solid var(--brand); background: var(--brand-soft);
  padding: 16px 20px; border-radius: 0 10px 10px 0; margin: 16px 0; }
.worked .ans h5 { margin: 0 0 8px; color: var(--brand-dark); font-size: 0.95rem; }
.worked .ans p { margin: 10px 0; }
.mt-why { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.92rem; }
.mt-why th { background: var(--brand-dark); color: #fff; text-align: left; padding: 9px 12px; font-size: 0.85rem; letter-spacing: 0.6px; }
.mt-why td { border: 1px solid var(--line); padding: 9px 12px; vertical-align: top; }
.mt-why tr:nth-child(even) td { background: #fafbfb; }

/* ---------- 8. RUBRIC / DESCRIPTOR DECODE -------------------------- */
.rubric { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.95rem; }
.rubric th { background: var(--brand); color: #fff; text-align: left; padding: 11px 14px; }
.rubric td { border: 1px solid var(--line); padding: 11px 14px; vertical-align: top; }
.rubric tr:nth-child(even) td { background: var(--brand-soft); }
.rubric td:first-child { font-weight: 700; color: var(--brand-dark); width: 30%; }

/* ---------- 9. CALLOUTS -------------------------------------------- */
.tip, .warn, .key, .box { padding: 16px 20px; border-radius: 0 10px 10px 0; margin: 20px 0; }
.tip { background: var(--brand-soft); border-left: 5px solid var(--brand); }
.warn { background: #fff6f6; border-left: 5px solid #c92a2a; }
.key { background: var(--accent-soft); border-left: 5px solid var(--accent); }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.box.warn-box { background: #fff6f6; border-color: #f3c6c6; }
.pitfall { background: #fff5f5; border: 1px solid #f1c9c9; border-left: 6px solid #c92a2a;
  border-radius: 0 12px 12px 0; padding: 18px 22px; margin: 22px 0; }
.pitfall h4 { color: #9c1c1c; margin: 0 0 8px; font-size: 1rem; letter-spacing: 0.4px; text-transform: uppercase; }
.pitfall ul { margin-bottom: 0; }

/* ---------- 10. MARK-LOSER CARDS ----------------------------------- */
.losers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin: 24px 0; }
.loser { background: #fff; border: 1px solid #edd4d4; border-top: 4px solid #c92a2a; border-radius: 0 0 12px 12px; padding: 18px 20px; }
.loser .rank { display: inline-block; background: #c92a2a; color: #fff; font-size: 0.72rem; font-weight: 800;
  padding: 3px 9px; border-radius: 12px; letter-spacing: 1px; margin-bottom: 8px; }
.loser h4 { color: #9c1c1c; margin: 0 0 6px; font-size: 1.02rem; }
.loser p { margin: 8px 0 0; font-size: 0.95rem; }
.loser .fix { margin-top: 10px; font-size: 0.92rem; background: #eaf7ee; border-left: 4px solid #2b8a3e;
  padding: 8px 12px; border-radius: 0 6px 6px 0; }
.loser .fix b { color: #1d6f32; }

/* ---------- 11. STUDY PLAN GRID ------------------------------------ */
.plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 24px 0; }
.wk { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 0 12px 12px 0; padding: 16px 18px; }
.wk .w { font-size: 0.72rem; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); }
.wk h4 { color: var(--brand-dark); margin: 4px 0 6px; font-size: 1rem; }
.wk p { margin: 6px 0; font-size: 0.92rem; }
.wk .hrs { font-size: 0.8rem; color: var(--muted); font-weight: 700; border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }

/* ---------- 12. CHECKLIST ------------------------------------------ */
.checklist { background: #fff; border: 2px dashed var(--brand); border-radius: 14px; padding: 24px 28px; margin: 24px 0; }
.checklist h4 { color: var(--brand-dark); margin: 0 0 4px; }
.checklist ul { list-style: none; padding: 0; margin: 14px 0 0; columns: 2; column-gap: 34px; }
.checklist li { position: relative; padding-left: 30px; margin: 9px 0; font-size: 0.95rem; break-inside: avoid; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px;
  border: 2px solid var(--brand); border-radius: 4px; background: #fff; }
@media (max-width: 720px) { .checklist ul { columns: 1; } }

/* ---------- 13. STAT / FACT STRIP ---------------------------------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 24px 0; }
.fact { background: var(--brand-soft); border: 1px solid var(--line); border-top: 4px solid var(--brand);
  border-radius: 0 0 12px 12px; padding: 14px 16px; text-align: center; }
.fact b { display: block; font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); line-height: 1.2; }
.fact span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }

/* ---------- 14. HUB CARDS ------------------------------------------ */
.grid-sub { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin: 26px 0; }
.sub-card { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--brand);
  border-radius: 0 14px 14px 0; padding: 20px 24px; box-shadow: 0 3px 12px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; }
.sub-card .tag { align-self: flex-start; font-size: 0.7rem; font-weight: 800; letter-spacing: 1.4px;
  text-transform: uppercase; color: #fff; background: var(--brand); padding: 3px 10px; border-radius: 10px; margin-bottom: 8px; }
.sub-card h3 { color: var(--brand-dark); margin: 0 0 8px; font-size: 1.15rem; }
.sub-card p { margin: 8px 0; font-size: 0.94rem; flex: 1; }
.sub-card .meta { font-size: 0.8rem; color: var(--muted); font-weight: 700; margin: 6px 0 12px; }

/* ---------- 15. MISC ------------------------------------------------ */
.kbd { font-family: Consolas, 'Courier New', monospace; font-size: 0.88em; background: var(--panel);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }
.accordion { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; overflow: hidden; }
.accordion summary { cursor: pointer; padding: 14px 20px; font-weight: 700; color: var(--brand-dark);
  background: var(--brand-soft); list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::before { content: "\25B8 "; color: var(--accent); }
.accordion[open] summary::before { content: "\25BE "; }
.accordion .acc-body { padding: 16px 20px 20px; }
.accordion .acc-body p:first-child { margin-top: 0; }

.pager { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 40px 0 10px; }
.pager a { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px;
  font-weight: 700; font-size: 0.92rem; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.pager a:hover { border-color: var(--brand); text-decoration: none; }

.navidir { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 20px 0; }
.navidir a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.navidir a:hover { border-color: var(--brand); }

blockquote.q { margin: 24px 0; padding: 18px 24px; background: var(--accent-soft);
  border-left: 5px solid var(--accent); border-radius: 0 12px 12px 0; font-style: italic; }
blockquote.q cite { display: block; margin-top: 8px; font-size: 0.88rem; font-style: normal; color: var(--muted); }

/* ---------- 16. PRINT ----------------------------------------------- */
@media print {
  .nav, .pdf-btn, .pager, .hero-stats, .noprint { display: none !important; }
  .hero { background: #fff !important; color: #000 !important; padding: 0 0 18px;
    border-bottom: 3px solid #000; text-align: left; }
  .hero .eyebrow { background: none; color: #000; padding: 0; letter-spacing: 2px; }
  .hero h1, .hero p { color: #000; }
  .toc { page-break-after: always; }
  .pullquote, .worked, .wk, .sub-card, .loser { box-shadow: none; page-break-inside: avoid; }
  h2.sec, .sec-head { page-break-after: avoid; }
  a { color: #000; }
}

/* ---------- 17. RESPONSIVE ------------------------------------------ */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 40px 16px; }
  .guide-wrap { padding: 22px 14px 50px; }
  .pullquote { padding: 20px; }
  .worked { padding: 18px; }
}