Files
cs249r_book/shared/styles/partials/_sidebar.scss
Vijay Janapa Reddi 44baf0c757 polish(tinytorch): sidebar titles + HTML milestone removal + flat tier
cards + header decoration + PDF milestone transitions

Polishes several rough edges in the TinyTorch site surfaced by a visual
walkthrough. Six independent fixes in one PR because they all landed on
the same mental pass:

HTML SIDEBAR
  - Rename two sections so their titles don't wrap on the 250px sidebar:
      "Capstone Competition"  -> "Capstone"
      "TITO CLI Reference"    -> "TITO CLI"
      (navbar link "TITO CLI Reference" -> "TITO CLI" too, for
       consistency)
  - Remove all three milestone sections ("Foundation Milestones",
    "Architecture Milestones", "Optimization Milestones") from the HTML
    sidebar. They interleaved between tiers and broke the
    Foundation -> Architecture -> Optimization -> Capstone flow the
    sidebar is meant to communicate. Milestones stay fully accessible
    via the navbar's "Historical Milestones" entry, and the PDF build
    (which has its own _quarto.yml) is untouched -- interleaved
    milestones are the correct reading experience in print.
  - YAML comment added where the milestone sections used to live so a
    future contributor knows the removal was intentional.

SIDEBAR SCROLL
  - shared/styles/partials/_sidebar.scss: add
    `overscroll-behavior: contain` to #quarto-sidebar and
    .sidebar-navigation. Before: hovering-and-scrolling over the sidebar
    chained the scroll to the body the moment the sidebar hit a
    boundary -- so scrolling the sidebar felt like it was never actually
    engaging. After: the sidebar's scroll stays in the sidebar.
  - Single-source-of-truth win: this improves every Quarto site in the
    ecosystem (book/kits/labs/mlsysim/tinytorch/site), not just tinytorch.

H2 L-SHAPE DECORATION (TINYTORCH ONLY)
  - shared/styles/partials/_headers.scss decorates H2-H6 with a thick
    accent left-border + thin accent bottom line -- an "L-shape" that
    reads well in long-form textbook prose. For tinytorch (framework
    docs with code blocks, comparison grids, card-based layouts) the
    decoration felt heavy and competed with the content itself.
  - tinytorch/quarto/assets/styles/style.scss: add a local override
    that strips border-left/border-bottom/padding-left/padding-bottom
    from H2-H6. Scoped to tinytorch -- book/kits/labs/mlsysim keep the
    decoration.

TIER CARDS
  - index.qmd's .tier-foundation / .tier-architecture /
    .tier-optimization / .tier-olympics cards used four different
    gradient fills (blue/purple/orange/pink). Visually loud; fought
    the comparison grid and hero on the same page; tier-optimization
    read as specifically orange-heavy.
  - Flatten to the same neutral #fafafa fill the .audience-card and
    preface.qmd cards use, with just a 4px colored left-border carrying
    the tier's identity. Each tier still has its distinct color cue;
    the page calms down.

PDF NARRATIVE TRANSITIONS
  Milestones appeared suddenly in the PDF when a tier ended. Readers
  lost context for why they were there and which just-built modules
  they were about to exercise. Six short transition paragraphs added
  via the narrative-flow-analyzer subagent:

    modules/08_training.qmd    forward-hook into Foundation Milestones
    modules/13_transformers.qmd forward-hook into Architecture Milestones
    modules/19_benchmarking.qmd forward-hook into Optimization Milestone
    milestones/01_perceptron.qmd tier-components open
                                 (Tensor/Linear/BCELoss/SGD/Trainer)
    milestones/04_cnn.qmd       first-Architecture-Milestone framing +
                                 three-tier arc explanation
    milestones/06_mlperf.qmd    sole-Optimization-Milestone +
                                 "third act" framing

  Files left as-is because the transitions were already good:
    milestones/index.qmd, milestones/02_xor.qmd, milestones/03_mlp.qmd,
    milestones/05_transformer.qmd.

DRIVE-BY FIX
  modules/13_transformers.qmd had four lines of pre-existing corrupted
  trailing content after the last callout (duplicate sentence,
  orphan "44B parameters |" table row, orphan Capstone row). Removed
  since this PR was already editing the file.

Verification (Playwright against local preview):
  - Sidebar section labels: ["Getting Started", "Foundation Tier",
    "Architecture Tier", "Optimization Tier", "Capstone",
    "Conclusion", "TITO CLI", "Reference", "Community"] -- no
    wrapping, no milestones.
  - #quarto-sidebar overscroll-behavior: "contain"
  - H2 "Don't import it. Build it." computed border-left-width: 0px,
    border-bottom-width: 0px, padding-left: 0px
  - .tier-card backgrounds: all rgb(250, 250, 250);
    border-lefts: 4px solid {tier-color} each.
2026-04-24 16:01:11 -04:00

88 lines
3.3 KiB
SCSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// =============================================================================
// SIDEBAR STYLES — Navigation sidebar links and section headers
// =============================================================================
//
// Single source of truth for sidebar spacing across every Quarto site in the
// ecosystem. Kept deliberately compact — the book's sidebar carries 60+ items
// per volume and needs every vertical pixel for scanability. Horizontal
// padding (68px) is still comfortable for mouse/touch targeting; it's the
// vertical rhythm that has to stay tight. Previously this file padded links
// more generously (4px top/bottom + explicit margin-top on section headers),
// which left TinyTorch and the landing site looking airier than the book,
// kits, labs, and mlsysim. Consolidated to the tight baseline on 2026-04-24
// for a uniform look across all Quarto sites.
//
// Site-specific accent colors come from `$accent` defined in each site's
// theme SCSS before this partial is imported.
// When the sidebar has its own scroll container (Quarto sets this up once
// the content exceeds the viewport), confine wheel-scroll inside it so
// reaching the sidebar's top or bottom does NOT chain-scroll the body.
// Without this, hovering-and-scrolling over the sidebar feels like you
// were scrolling the page the whole time — which is exactly what the
// reader is trying to avoid by engaging the sidebar in the first place.
#quarto-sidebar,
.sidebar-navigation {
overscroll-behavior: contain;
}
.sidebar-navigation .sidebar-item a {
color: #495057; // Readable but not competing with main content
font-weight: 400; // Normal weight — supportive not dominant
display: block;
padding: 2px 6px; // Tight vertical rhythm, comfortable horizontal target
margin: 0.5px 0; // Minimal vertical separation between consecutive items
border-radius: 3px;
transition: all 0.15s ease;
&:hover {
color: $accent; // Accent hover for interaction
background-color: rgba($accent, 0.08);
font-weight: 500; // Medium weight on hover
text-decoration: none;
transform: translateX(2px);
}
// Clear active state without overpowering
&.active,
&[aria-current="page"] {
color: $accent;
font-weight: 500; // Medium weight for active state
background-color: rgba($accent, 0.12);
}
}
// Section headers — clear hierarchy, same vertical rhythm as the items they
// group so the sidebar reads as one continuous column (not as stacked cards).
.sidebar-navigation .sidebar-item a[data-bs-toggle="collapse"] {
font-weight: 500; // Medium weight — clear but supportive
color: #2c3e50; // Dark but not competing with main content
font-size: 0.9rem; // Slightly larger for hierarchy
letter-spacing: 0.01em; // Subtle spacing for readability
&:hover {
color: $accent; // Accent hover
background-color: rgba($accent, 0.08);
font-weight: 600; // Bold on hover but not excessive
text-decoration: none;
transform: translateX(2px);
}
}
// Part divider styling — applied by JavaScript
.part-divider {
font-size: 0.7rem;
font-weight: 600;
color: $accent; // Use accent color
text-transform: uppercase;
letter-spacing: 0.8px;
margin: 16px 0 4px 0;
padding: 0 6px;
border-top: 1px solid #dee2e6;
padding-top: 12px;
&.part-labs {
color: #6c757d; // Gray for labs section
}
}