/* ═══════════════════════════════════════════════════════════════
   CS7 — Assignment Pages Stylesheet
   Uses the same design tokens as cs7.css (loaded before this).
   Covers: lab, hw, and proj pages.
   ═══════════════════════════════════════════════════════════════ */

/* ── Assignment badge (Lab / HW / Project) ────────────────────── */
.asgn-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.2rem 0.625rem;
  border-radius: 4px;
  margin-bottom: 0.375rem;
}
.asgn-badge-lab  { background: var(--brand-bg);  color: var(--brand-fg);  border: 1px solid var(--brand-border); }
.asgn-badge-hw   { background: var(--amber-bg);  color: var(--amber-fg);  border: 1px solid #f0d898; }
.asgn-badge-proj { background: var(--accent-bg); color: var(--accent-fg); border: 1px solid #e8c5ad; }

/* ── Two-column layout ────────────────────────────────────────── */
.asgn-layout {
  display: flex;
  align-items: flex-start;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  gap: 2.5rem;
}

.asgn-content { flex: 1; min-width: 0; }

.asgn-sidebar {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* ── Sidebar navigation ───────────────────────────────────────── */
.asgn-sidebar ul { list-style: none; padding: 0; margin: 0; }
.asgn-sidebar > ul {
  border-left: 2px solid var(--brand-bg);
  padding-left: 0.75rem;
}
.asgn-sidebar ul ul { padding-left: 0.875rem; margin-top: 0.2rem; }
.asgn-sidebar a {
  display: block;
  font-size: 0.775rem;
  color: var(--ink-3);
  padding: 0.175rem 0;
  line-height: 1.4;
  transition: color 0.12s;
}
.asgn-sidebar a:hover,
.asgn-sidebar a.active { color: var(--brand-fg); text-decoration: none; }
.asgn-sidebar a.active { font-weight: 600; }

/* ── Content headings ─────────────────────────────────────────── */
.asgn-content h1 {
  font-family: var(--font-display);
  font-size: 1.4375rem;
  font-weight: 400;
  color: var(--brand-fg);
  font-variation-settings: 'opsz' 36, 'SOFT' 30;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brand-bg);
}
.asgn-content h1:first-child { margin-top: 0; }

.asgn-content h2 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--ink);
  font-variation-settings: 'opsz' 24, 'SOFT' 30;
  margin: 2rem 0 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
}

.asgn-content h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.5rem 0 0.5rem;
}

.asgn-content h3.question {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--brand-fg);
  font-variation-settings: 'opsz' 24, 'SOFT' 40;
  margin: 2rem 0 0.625rem;
  padding: 0.5rem 0.875rem;
  background: var(--brand-bg);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.asgn-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  margin: 1.25rem 0 0.375rem;
}

/* ── Body text ────────────────────────────────────────────────── */
.asgn-content p { color: var(--ink-2); margin-bottom: 0.875rem; line-height: 1.65; }
.asgn-content ul,
.asgn-content ol { color: var(--ink-2); margin: 0.5rem 0 0.875rem 1.5rem; line-height: 1.65; }
.asgn-content li { margin-bottom: 0.25rem; }

/* ── Code ─────────────────────────────────────────────────────── */
.asgn-content pre {
  margin: 0.75rem 0 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

.asgn-content pre code.hljs {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  border-radius: var(--radius);
}

/* Fallback for pre/code when hljs doesn't apply */
.asgn-content pre code:not(.hljs) {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  display: block;
  padding: 1rem 1.25rem;
  background: #282c34;
  color: #abb2bf;
  border-radius: var(--radius);
}

/* Inline code */
.asgn-content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg-2);
  color: var(--accent-fg);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── Blockquotes ──────────────────────────────────────────────── */
.asgn-content blockquote {
  border-left: 3px solid var(--brand);
  margin: 1rem 0;
  padding: 0.625rem 1rem;
  background: var(--brand-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.asgn-content blockquote p { margin: 0; }
.asgn-content blockquote p + p { margin-top: 0.5rem; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.asgn-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0.75rem 0 1.25rem;
}
.asgn-content th {
  background: var(--ink);
  color: #c8c3bb;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.asgn-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
  background: var(--surface);
  color: var(--ink-2);
  line-height: 1.5;
}
.asgn-content tr:nth-child(even) td { background: var(--bg); }
.asgn-content tr th + th,
.asgn-content tr td + td { border-left: 1px solid var(--border); }

/* Ant/project image tables */
.asgn-content table.ant td,
.asgn-content table.ant th { text-align: center; }
.asgn-content table.ant img { margin: 0 auto 0.5rem; border: none; display: block; }

/* ── Toggle buttons ───────────────────────────────────────────── */
.toggle-btn {
  display: none; /* shown by JS */
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.875rem;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin: 0.5rem 0;
}
.toggle-btn:hover {
  border-color: var(--brand);
  color: var(--brand-fg);
  background: var(--brand-bg);
}
.toggle-btn.toggle-solution {
  background: var(--amber-bg);
  color: var(--amber-fg);
  border-color: #f0d898;
}
.toggle-btn.toggle-solution:hover { background: #fde8a0; border-color: var(--amber); }

/* ── Solution / blank inline divs (inside pre > code) ────────── */
.alt      { display: inline; color: var(--ink-4); font-style: italic; }
.solution { display: none; }

/* ── Images ───────────────────────────────────────────────────── */
.asgn-content img,
.img-responsive {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 1rem auto;
}
.asgn-content table img { border: none; margin: 0; }
.center-block { display: block; margin-left: auto; margin-right: auto; }

/* ── iframes (Python Tutor) ───────────────────────────────────── */
.asgn-content iframe {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0;
}

/* ── Project intro quote ──────────────────────────────────────── */
.proj-intro {
  text-align: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.proj-intro img { margin: 0 auto 1rem; border: none; max-height: 480px; width: auto; }
.proj-intro cite { font-style: italic; color: var(--ink-3); font-size: 0.9rem; line-height: 1.7; }

/* ── <solution> custom tag (hw pages) ────────────────────────── */
solution { display: block; }

/* ── Misc Bootstrap shims ─────────────────────────────────────── */
.inline-block { display: inline; }

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .asgn-layout { flex-direction: column; padding: 1.25rem 1rem 3rem; gap: 0; }

  .asgn-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    margin-bottom: 1.5rem;
    order: -1;
  }
  .asgn-sidebar > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.375rem;
    border-left: none;
    padding-left: 0;
  }
  .asgn-sidebar ul ul { display: none; }
  .asgn-sidebar a {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.2rem 0.5rem;
  }
}
