/* ═══════════════════════════════════════════════════════
   IB MYP Study Hub — Shared Stylesheet
   ═══════════════════════════════════════════════════════ */

:root {
  --navy:        #1a2744;
  --navy-light:  #243260;
  --navy-dark:   #0f1a2e;
  --amber:       #f0b429;
  --amber-light: #fdd663;
  --amber-dim:   #c8941f;
  --white:       #ffffff;
  --off-white:   #f8f9fc;
  --gray-100:    #eef0f5;
  --gray-200:    #d8dce8;
  --gray-400:    #8896b3;
  --gray-600:    #4a5578;
  --green:       #22c55e;
  --green-light: #dcfce7;
  --red:         #ef4444;
  --red-light:   #fee2e2;
  --blue-accent: #3b82f6;
  --sidebar-w:   240px;
  --font-mono:   'Courier New', Courier, monospace;
  --font-sans:   'Georgia', 'Times New Roman', serif;

  /* Subject colours */
  --sub-math:    #f0b429;
  --sub-sci:     #22c55e;
  --sub-lit:     #8b5cf6;
  --sub-lang:    #ec4899;
  --sub-is:      #f97316;
  --sub-arts:    #14b8a6;
  --sub-phe:     #3b82f6;
  --sub-design:  #ef4444;
  --sub-proj:    #d97706;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--off-white);
  color: var(--navy-dark);
  line-height: 1.7;
}

/* ── SIDEBAR (study pages) ── */
.study-layout { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,.25);
}
.sidebar-header { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header .logo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-decoration: none;
  display: block;
}
.sidebar-header .logo:hover { color: var(--amber-light); }
.sidebar-header h2 { font-size: 15px; color: var(--white); font-weight: 700; line-height: 1.3; }
.sidebar-back {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: var(--gray-400);
  text-decoration: none;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .5px;
  transition: color .2s;
}
.sidebar-back:hover { color: var(--amber); }

/* ── SIDEBAR BREADCRUMB ── */
.sidebar-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
}
.sidebar-breadcrumb a {
  color: var(--gray-400);
  text-decoration: none;
  transition: color .2s;
  white-space: nowrap;
}
.sidebar-breadcrumb a:hover { color: var(--amber); }
.sidebar-breadcrumb a:last-child { color: var(--amber); pointer-events: none; }
.bc-sep { color: rgba(255,255,255,.2); padding: 0 2px; }

.progress-bar-wrap { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.progress-label {
  font-size: 10px; color: var(--gray-400);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.progress-label span { color: var(--amber); font-weight: 700; }
.progress-track { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--amber); border-radius: 2px; transition: width .5s ease; width: 0%; }

nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gray-400); padding: 12px 20px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 13px;
  font-family: var(--font-sans);
  transition: all .2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.05); }
.nav-link.active { color: var(--amber); border-left-color: var(--amber); background: rgba(240,180,41,.07); }
.nav-link .check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--gray-400);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; cursor: pointer;
}
.nav-link.done .check { background: var(--amber); border-color: var(--amber); }
.nav-link.done .check::after { content: '✓'; font-size: 10px; color: var(--navy); font-weight: 900; }
.nav-link.done { opacity: .75; }

/* Mark Complete button */
.section-complete-wrap {
  display: flex; justify-content: flex-end;
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,.08);
}
.btn-complete {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 8px;
  border: 2px solid var(--amber); background: transparent;
  color: var(--amber); font-size: 13px; font-weight: 700;
  font-family: var(--font-sans); letter-spacing: .5px;
  cursor: pointer; transition: all .2s;
}
.btn-complete:hover { background: rgba(251,191,36,.12); }
.btn-complete.is-done { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.btn-complete.is-done:hover { background: #f59e0b; border-color: #f59e0b; }

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1);
  font-size: 11px; color: var(--gray-400);
}

/* ── STUDY MAIN ── */
.study-layout main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.section { max-width: 860px; margin: 0 auto; padding: 60px 40px; }
.section + .section { border-top: 1px solid var(--gray-200); }

.section-tag {
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--amber-dim); font-family: var(--font-mono); margin-bottom: 8px;
}
h1.section-title { font-size: 36px; color: var(--navy); font-weight: 700; line-height: 1.2; margin-bottom: 6px; }
h2.sub-title {
  font-size: 22px; color: var(--navy); font-weight: 700;
  margin: 40px 0 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--amber); display: inline-block;
}
h3.topic-title { font-size: 17px; color: var(--navy-light); font-weight: 700; margin: 28px 0 10px; }
.section-intro { font-size: 15px; color: var(--gray-600); margin-bottom: 28px; max-width: 680px; }

/* Cards */
.card {
  background: var(--white); border-radius: 12px;
  padding: 24px 28px; margin: 16px 0;
  box-shadow: 0 2px 12px rgba(26,39,68,.07);
  border: 1px solid var(--gray-200);
}
.card-accent { border-left: 4px solid var(--amber); }
.card-navy { background: var(--navy); color: var(--white); border: none; }
.card-navy h3, .card-navy p, .card-navy li { color: var(--white); }

/* Formula box */
.formula-box {
  background: var(--navy-dark); color: var(--amber-light);
  font-family: var(--font-mono); font-size: 15px;
  padding: 14px 20px; border-radius: 8px;
  margin: 12px 0; letter-spacing: .5px;
  border-left: 4px solid var(--amber);
}
.formula-box .formula-label {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gray-400); margin-bottom: 4px; font-family: var(--font-sans);
}

/* Alert */
.alert {
  background: #fff8e1; border: 1.5px solid var(--amber);
  border-radius: 8px; padding: 14px 18px; font-size: 14px;
  margin: 12px 0; display: flex; gap: 10px; align-items: flex-start;
}
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert strong { color: var(--amber-dim); }

/* Collapsible Q&A */
.qa-item {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 10px; margin: 12px 0; overflow: hidden;
  box-shadow: 0 1px 4px rgba(26,39,68,.05); transition: box-shadow .2s;
}
.qa-item:hover { box-shadow: 0 4px 16px rgba(26,39,68,.1); }
.qa-question {
  padding: 16px 20px; cursor: pointer;
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px;
  font-weight: 700; color: var(--navy); font-size: 15px; user-select: none;
}
.q-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  color: var(--amber-dim); font-weight: 400; margin-bottom: 3px; display: block;
}
.qa-toggle {
  width: 28px; height: 28px; background: var(--gray-100);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px; transition: transform .25s, background .2s;
  color: var(--navy); margin-top: 2px;
}
.qa-item.open .qa-toggle { transform: rotate(45deg); background: var(--amber); color: var(--navy); }
.qa-answer { display: none; padding: 0 20px 18px; border-top: 1px solid var(--gray-100); }
.qa-answer .ans-label {
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--amber-dim); font-family: var(--font-mono); margin: 14px 0 6px;
}
.qa-item.open .qa-answer { display: block; }
.oral-answer {
  border-left: 4px solid var(--amber); background: #fffbee;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  font-style: italic; color: var(--navy-dark);
  font-size: 14px; line-height: 1.7; margin: 10px 0;
}
.oral-answer strong { font-style: normal; color: var(--navy); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 14px 0; }
.data-table th {
  background: var(--navy); color: var(--amber);
  padding: 10px 14px; text-align: left;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  font-family: var(--font-mono); font-weight: 600;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: top; color: var(--navy-dark); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--off-white); }
.data-table tr:nth-child(even) td { background: #fafbfe; }

/* Flashcard grid */
.flashcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.flashcard {
  background: var(--navy); border-radius: 12px;
  padding: 20px; cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  min-height: 100px;
  display: flex; flex-direction: column; justify-content: center;
}
.flashcard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,39,68,.2); }
.flashcard .fc-q { color: var(--amber); font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.flashcard .fc-a { color: var(--gray-400); font-size: 12px; display: none; line-height: 1.5; }
.flashcard .fc-hint { color: var(--gray-400); font-size: 11px; font-family: var(--font-mono); margin-top: 8px; }
.flashcard.revealed .fc-a { display: block; color: var(--white); }
.flashcard.revealed .fc-hint { display: none; }
.flashcard.revealed { background: var(--navy-light); }

/* Steps list */
.steps-list { list-style: none; counter-reset: steps; padding: 0; }
.steps-list li {
  counter-increment: steps;
  padding: 10px 0 10px 44px; position: relative;
  font-size: 14px; border-bottom: 1px solid var(--gray-100);
}
.steps-list li:last-child { border-bottom: none; }
.steps-list li::before {
  content: counter(steps); position: absolute; left: 0; top: 8px;
  width: 28px; height: 28px; background: var(--navy); color: var(--amber);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}

/* Rules list */
.rules-list { list-style: none; padding: 0; }
.rules-list li {
  padding: 10px 0 10px 36px; position: relative;
  border-bottom: 1px solid var(--gray-100); font-size: 14px; color: var(--navy-dark);
}
.rules-list li:last-child { border-bottom: none; }
.rules-list li::before { content: '→'; position: absolute; left: 0; color: var(--amber); font-weight: 900; font-size: 16px; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.info-cell { background: var(--gray-100); border-radius: 8px; padding: 14px 16px; font-size: 13px; }
.info-cell strong { display: block; color: var(--navy); margin-bottom: 4px; font-size: 14px; }

/* MCQ section */
.mcq-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--navy); color: var(--white);
  padding: 20px 28px; border-radius: 12px 12px 0 0;
}
.score-display { font-family: var(--font-mono); font-size: 28px; color: var(--amber); font-weight: 700; }
.score-display small { font-size: 13px; color: var(--gray-400); display: block; }
.mcq-progress-track { flex: 1; margin: 0 24px; height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.mcq-progress-fill { height: 100%; background: var(--amber); border-radius: 3px; transition: width .4s ease; width: 0%; }
.mcq-body { background: var(--white); border: 1px solid var(--gray-200); border-top: none; border-radius: 0 0 12px 12px; padding: 28px; }
.mcq-question-card { display: none; }
.mcq-question-card.active { display: block; }
.mcq-qnum { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; color: var(--amber-dim); text-transform: uppercase; margin-bottom: 8px; }
.mcq-qtext { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 20px; line-height: 1.45; }
.mcq-options { display: flex; flex-direction: column; gap: 10px; }
.mcq-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px; border: 2px solid var(--gray-200);
  border-radius: 10px; cursor: pointer; transition: all .2s;
  font-size: 14px; color: var(--navy-dark);
}
.mcq-option:hover:not(.disabled) { border-color: var(--navy); background: var(--off-white); }
.opt-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-100); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  flex-shrink: 0; transition: all .2s;
}
.mcq-option.correct { border-color: var(--green); background: var(--green-light); }
.mcq-option.correct .opt-letter { background: var(--green); color: var(--white); }
.mcq-option.wrong { border-color: var(--red); background: var(--red-light); }
.mcq-option.wrong .opt-letter { background: var(--red); color: var(--white); }
.mcq-option.disabled { cursor: default; }
.mcq-explanation { display: none; margin-top: 16px; padding: 14px 18px; background: #f0f9ff; border: 1px solid #93c5fd; border-radius: 8px; font-size: 13.5px; color: var(--navy-dark); line-height: 1.6; }
.mcq-explanation.show { display: block; }
.mcq-explanation strong { color: var(--blue-accent); }
.mcq-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gray-100); }
.mcq-dots { display: flex; gap: 6px; }
.mcq-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-200); cursor: pointer; transition: all .2s; }
.mcq-dot.answered-correct { background: var(--green); }
.mcq-dot.answered-wrong { background: var(--red); }
.mcq-dot.current { background: var(--amber); transform: scale(1.3); }
.mcq-results { display: none; text-align: center; padding: 40px 20px; }
.mcq-results.show { display: block; }
.result-score-big { font-size: 72px; font-weight: 700; color: var(--navy); font-family: var(--font-mono); line-height: 1; }
.result-score-big span { color: var(--amber); }
.result-msg { font-size: 18px; color: var(--gray-600); margin: 12px 0 28px; }
.result-breakdown { display: flex; justify-content: center; gap: 24px; margin-bottom: 32px; }
.result-stat { background: var(--off-white); border-radius: 10px; padding: 16px 24px; text-align: center; }
.result-stat .stat-num { font-size: 28px; font-weight: 700; font-family: var(--font-mono); }
.result-stat .stat-num.green { color: var(--green); }
.result-stat .stat-num.red { color: var(--red); }
.result-stat small { color: var(--gray-400); font-size: 12px; display: block; margin-top: 2px; }

/* Buttons */
.btn { padding: 11px 24px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-family: var(--font-sans); font-weight: 700; transition: all .2s; }
.btn-primary { background: var(--navy); color: var(--amber); }
.btn-primary:hover { background: var(--navy-light); transform: translateY(-1px); }
.btn-secondary { background: var(--gray-100); color: var(--navy); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-amber { background: var(--amber); color: var(--navy); }
.btn-amber:hover { background: var(--amber-light); }
.btn:disabled { opacity: .4; cursor: default; transform: none !important; }

/* Back to top */
#back-to-top {
  position: fixed; bottom: 32px; right: 32px;
  width: 44px; height: 44px;
  background: var(--navy); color: var(--amber);
  border: none; border-radius: 50%; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  font-size: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transition: all .2s; z-index: 50;
}
#back-to-top:hover { transform: translateY(-2px); background: var(--navy-light); }
#back-to-top.visible { display: flex; }

/* ═══════════════════════════════════════════════════════
   INDEX PAGE
   ═══════════════════════════════════════════════════════ */
.site-logo {
  position: fixed;
  top: 20px;
  left: 28px;
  z-index: 200;
  font-family: var(--font-mono);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  line-height: 1;
}
.logo-ib    { color: var(--amber); font-weight: 700; font-size: 18px; letter-spacing: -0.5px; }
.logo-ready { color: var(--white); font-weight: 700; font-size: 18px; letter-spacing: -0.5px; transition: color .2s; }
.logo-tld   { color: var(--amber-dim); font-weight: 400; font-size: 12px; letter-spacing: 0.5px; margin-left: 2px; align-self: flex-end; margin-bottom: 2px; }

/* Dark-background switch — toggled by JS on scroll / applied statically on light pages */
.site-logo--dark .logo-ready { color: var(--navy-dark); }
.site-logo--dark .logo-ib    { color: var(--amber-dim); }
.site-logo--dark .logo-tld   { color: var(--gray-600); }

.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, #1e3a6e 100%);
  padding: 80px 48px 70px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 30%, rgba(240,180,41,.08) 0%, transparent 60%);
  pointer-events: none;
}
.hero-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--amber); letter-spacing: 3px; text-transform: uppercase; margin-bottom: 16px; }
.hero h1 { font-size: 52px; color: var(--white); font-weight: 700; line-height: 1.1; margin-bottom: 16px; }
.hero h1 span { color: var(--amber); }
.hero-sub { font-size: 18px; color: var(--gray-400); max-width: 600px; margin: 0 auto 40px; line-height: 1.6; }
.hero-cta { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.btn-outline-white { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,0.45); }
.btn-outline-white:hover { background: rgba(255,255,255,0.1); border-color: var(--white); transform: translateY(-1px); }
.hero-stats { display: flex; justify-content: center; gap: 48px; margin-top: 0; }
.hero-stat { text-align: center; }
.hero-stat .num { font-family: var(--font-mono); font-size: 36px; color: var(--amber); font-weight: 700; }
.hero-stat .lbl { font-size: 12px; color: var(--gray-400); letter-spacing: 1px; margin-top: 2px; }

.index-main { max-width: 1100px; margin: 0 auto; padding: 64px 48px; }
.section-heading {
  font-size: 13px; font-family: var(--font-mono); letter-spacing: 2px;
  text-transform: uppercase; color: var(--amber-dim); margin-bottom: 8px;
}
.section-title-lg { font-size: 28px; color: var(--navy); font-weight: 700; margin-bottom: 32px; }

/* Grade cards */
.grade-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-bottom: 64px; }
.grade-card {
  background: var(--white); border-radius: 16px;
  border: 2px solid var(--gray-200);
  padding: 28px 20px; text-decoration: none;
  transition: all .25s; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.grade-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: var(--amber);
  transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
.grade-card:hover { border-color: var(--amber); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(26,39,68,.12); }
.grade-card:hover::before { transform: scaleX(1); }
.grade-card .grade-num { font-family: var(--font-mono); font-size: 11px; color: var(--amber-dim); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; }
.grade-card .grade-title { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.grade-card .grade-year { font-size: 12px; color: var(--gray-400); margin-bottom: 16px; }
.grade-card .grade-meta { font-size: 12px; color: var(--gray-600); line-height: 1.6; flex: 1; }
.grade-card .grade-band {
  display: none;
}
.grade-card.g10 .grade-band { background: var(--amber); color: var(--navy); }

.grade-card--demo { position: relative; }
.grade-demo-badge {
  display: inline-block;
  background: var(--amber);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

/* Subject feature strip */
.subject-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 48px; }

.subjects-explainer {
  max-width: 760px;
  margin: 0 auto;
  color: var(--gray-600);
  line-height: 1.75;
  font-size: 15px;
  background: var(--white);
  border-radius: 16px;
  border: 2px solid var(--gray-200);
  padding: 36px 40px;
  margin-bottom: 64px;
}
.subjects-explainer h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin: 36px 0 10px;
}
.subjects-explainer h3:first-child { margin-top: 0; }
.subjects-explainer p { margin: 0 0 14px; }
.subjects-explainer ul {
  margin: 0 0 14px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subjects-explainer li { padding-left: 4px; }
.subject-strip-item {
  background: var(--white); border-radius: 12px; padding: 20px;
  border: 1px solid var(--gray-200); display: flex; align-items: center; gap: 14px;
}
.sub-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sub-icon.math    { background: rgba(240,180,41,.15); }
.sub-icon.sci     { background: rgba(34,197,94,.15); }
.sub-icon.lit     { background: rgba(139,92,246,.15); }
.sub-icon.lang    { background: rgba(236,72,153,.15); }
.sub-icon.is      { background: rgba(249,115,22,.15); }
.sub-icon.arts    { background: rgba(20,184,166,.15); }
.sub-icon.phe     { background: rgba(59,130,246,.15); }
.sub-icon.design  { background: rgba(239,68,68,.15); }
.sub-text .sub-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.sub-text .sub-desc { font-size: 12px; color: var(--gray-400); }

/* Site footer */
.site-footer {
  background: var(--navy-dark); padding: 36px 48px;
  text-align: center; color: var(--gray-400); font-size: 12px;
}
.site-footer a { color: var(--amber); text-decoration: none; }

/* ═══════════════════════════════════════════════════════
   GRADE HUB PAGE
   ═══════════════════════════════════════════════════════ */
.hub-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  padding: 60px 48px 50px;
}
.hub-back { display: inline-flex; align-items: center; gap: 6px; color: var(--gray-400); text-decoration: none; font-size: 12px; font-family: var(--font-mono); margin-bottom: 28px; transition: color .2s; }
.hub-back:hover { color: var(--amber); }
.hub-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--amber); letter-spacing: 3px; text-transform: uppercase; margin-bottom: 10px; }
.hub-title { font-size: 44px; color: var(--white); font-weight: 700; line-height: 1.1; margin-bottom: 10px; }
.hub-subtitle { font-size: 16px; color: var(--gray-400); max-width: 560px; }
.hub-band {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; padding: 6px 16px;
  font-size: 12px; color: var(--amber); font-family: var(--font-mono);
  margin-top: 20px; letter-spacing: .5px;
}

.hub-main { max-width: 1100px; margin: 0 auto; padding: 56px 48px 80px; }
.subject-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.subject-card {
  background: var(--white); border-radius: 16px;
  border: 2px solid var(--gray-200); padding: 28px 24px;
  text-decoration: none; display: flex; flex-direction: column;
  transition: all .25s; position: relative; overflow: hidden;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(26,39,68,.12); }
.subject-card .card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.subject-card .s-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.subject-card .s-meta .s-num { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; }
.subject-card .s-meta .s-name { font-size: 17px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.subject-card .s-desc { font-size: 13px; color: var(--gray-600); line-height: 1.6; flex: 1; }
.subject-card .s-topics { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.s-topic-chip {
  font-size: 10px; font-family: var(--font-mono);
  padding: 3px 10px; border-radius: 12px;
  background: var(--gray-100); color: var(--gray-600);
  letter-spacing: .3px;
}
.subject-card .s-arrow { margin-top: 20px; font-size: 18px; color: var(--gray-200); transition: color .2s, transform .2s; align-self: flex-end; }
.subject-card:hover .s-arrow { color: var(--amber); transform: translateX(4px); }

/* Subject-specific border/icon colours */
.subject-card.math  { border-top: 4px solid var(--sub-math); }
.subject-card.sci   { border-top: 4px solid var(--sub-sci); }
.subject-card.lit   { border-top: 4px solid var(--sub-lit); }
.subject-card.lang  { border-top: 4px solid var(--sub-lang); }
.subject-card.is    { border-top: 4px solid var(--sub-is); }
.subject-card.arts  { border-top: 4px solid var(--sub-arts); }
.subject-card.phe   { border-top: 4px solid var(--sub-phe); }
.subject-card.design { border-top: 4px solid var(--sub-design); }
.subject-card.proj  { border-top: 4px solid var(--sub-proj); }

.s-icon.math    { background: rgba(240,180,41,.15); }
.s-icon.sci     { background: rgba(34,197,94,.15); }
.s-icon.lit     { background: rgba(139,92,246,.15); }
.s-icon.lang    { background: rgba(236,72,153,.15); }
.s-icon.is      { background: rgba(249,115,22,.15); }
.s-icon.arts    { background: rgba(20,184,166,.15); }
.s-icon.phe     { background: rgba(59,130,246,.15); }
.s-icon.design  { background: rgba(239,68,68,.15); }
.s-icon.proj    { background: rgba(217,119,6,.15); }

.s-meta .s-num.math   { color: var(--sub-math); }
.s-meta .s-num.sci    { color: var(--sub-sci); }
.s-meta .s-num.lit    { color: var(--sub-lit); }
.s-meta .s-num.lang   { color: var(--sub-lang); }
.s-meta .s-num.is     { color: var(--sub-is); }
.s-meta .s-num.arts   { color: var(--sub-arts); }
.s-meta .s-num.phe    { color: var(--sub-phe); }
.s-meta .s-num.design { color: var(--sub-design); }
.s-meta .s-num.proj   { color: var(--sub-proj); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grade-grid { grid-template-columns: repeat(3, 1fr); }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  #sidebar { width: 100%; height: auto; position: relative; }
  .study-layout main { margin-left: 0; }
  .section { padding: 30px 20px; }
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .hub-title { font-size: 30px; }
  .hero-stats { gap: 28px; }
  .index-main, .hub-main { padding: 40px 24px; }
  .hero, .hub-header { padding: 48px 24px 40px; }
  .site-header { padding: 16px 24px; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   MATH ENHANCEMENTS — Fractions · Worked Solutions · SVG Diagrams
   ═══════════════════════════════════════════════════════ */

/* Vertical fraction — currentColor inherits amber inside .formula-box, navy in body text */
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  font-family: var(--font-mono);
  line-height: 1.1;
}
.frac .num {
  border-bottom: 1.5px solid currentColor;
  padding: 0 4px 2px;
  text-align: center;
  font-size: 0.92em;
}
.frac .den {
  padding: 2px 4px 0;
  text-align: center;
  font-size: 0.92em;
}

/* Worked solution — notebook paper aesthetic */
.worked-solution {
  background: #fffef5;
  border: 1.5px solid #d4c89a;
  border-radius: 4px;
  padding: 0;
  margin: 20px 0;
  position: relative;
  overflow: hidden;
  box-shadow: 2px 3px 10px rgba(26,39,68,.08);
}
/* Red margin line, like a ruled exercise book */
.worked-solution::before {
  content: '';
  position: absolute;
  left: 40px;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(220,80,80,.25);
}
.ws-header {
  background: var(--navy);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 7px 16px 7px 52px;
  border-bottom: 2px solid var(--amber);
}
.ws-body {
  padding: 16px 20px 20px 52px;
}
.ws-step {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(180,170,130,.3);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--navy-dark);
  line-height: 1.6;
}
.ws-step:last-of-type {
  border-bottom: none;
}
.ws-step .ws-note {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
  white-space: nowrap;
}
.ws-answer {
  display: inline-block;
  background: rgba(240,180,41,.15);
  border: 2px solid var(--amber);
  border-radius: 4px;
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 12px;
}
.ws-answer::before {
  content: '∴ ';
  color: var(--amber-dim);
  font-size: 13px;
}
.ws-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 10px 0;
}

/* SVG diagram wrapper */
.svg-diagram {
  margin: 20px 0;
  text-align: center;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}
.svg-diagram figcaption {
  font-size: 12px;
  color: var(--gray-400);
  font-family: var(--font-mono);
  letter-spacing: .5px;
  margin-top: 10px;
}
.svg-diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .ws-step { grid-template-columns: 1fr; }
  .ws-step .ws-note { display: none; }
}

/* ═══════════════════════════════════════════════════════
   Auth — Logout Button
   ═══════════════════════════════════════════════════════ */

.btn-logout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--white);
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s;
  margin-left: 12px;
}
.btn-logout:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.6);
}

/* sidebar variant (topic pages) */
.sidebar-footer .btn-logout,
#sidebar .btn-logout {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--gray-400);
  text-align: center;
  font-size: 0.78rem;
}
.sidebar-footer .btn-logout:hover,
#sidebar .btn-logout:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
}

/* ═══════════════════════════════════════════════════════
   Auth — Login Page
   ═══════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--off-white);
}

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(10, 20, 50, 0.10);
  padding: 44px 40px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  line-height: 1;
  margin-bottom: 6px;
}
.auth-logo .logo-ib    { color: var(--amber-dim); font-size: 14px; }
.auth-logo .logo-ready { color: var(--navy);      font-size: 14px; }
.auth-logo .logo-tld   { color: var(--gray-400);  font-size: 9px; margin-bottom: 1px; }

.auth-card h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 0 0 24px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
  letter-spacing: 0.03em;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--navy-dark);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--navy);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}

.auth-submit:hover  { background: var(--navy-light); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-error {
  background: var(--red-light);
  color: var(--red);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 0.87rem;
  font-weight: 500;
  display: none;
}

.auth-error.visible { display: block; }

.auth-captcha { margin-top: 4px; }

.auth-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-top: 24px;
}

.auth-footer a { color: var(--navy); }

@media (max-width: 480px) {
  .auth-card { padding: 32px 22px 28px; }
}

/* ═══════════════════════════════════════════════════════
   Profile Icon (fixed, all pages)
   ═══════════════════════════════════════════════════════ */

.profile-icon-btn {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 9000;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.profile-icon-btn:hover {
  background: var(--navy-light);
  transform: scale(1.08);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════
   Profile Page
   ═══════════════════════════════════════════════════════ */

.profile-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(10, 20, 50, 0.10);
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 480px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--gray-100);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 6px 0 0;
  word-break: break-all;
}

.profile-section {
  margin-bottom: 28px;
}

.profile-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 14px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 16px;
}

.profile-label {
  font-size: 0.85rem;
  color: var(--gray-400);
  white-space: nowrap;
}

.profile-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy-dark);
  text-align: right;
}

.profile-sub-card {
  border-radius: 10px;
  padding: 18px 20px;
}

.profile-sub-active {
  background: var(--green-light);
  border: 1px solid #bbf7d0;
}

.profile-sub-inactive {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

.sub-status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--green);
  color: var(--white);
  margin-bottom: 14px;
}

.sub-status-inactive {
  background: var(--gray-400);
}

.sub-inactive-msg {
  font-size: 0.87rem;
  color: var(--gray-600);
  margin: 0 0 14px;
  line-height: 1.5;
}

.profile-sub-loading {
  font-size: 0.87rem;
  color: var(--gray-400);
  padding: 12px 0;
}

.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
  margin-top: 4px;
}

.profile-back-link {
  font-size: 0.85rem;
  color: var(--gray-400);
  text-decoration: none;
}

.profile-back-link:hover { color: var(--navy); }

.btn-logout-profile {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-logout-profile:hover {
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 480px) {
  .profile-card { padding: 32px 22px 28px; }
}
