Unify navbar, fonts, and styles across book, kits, and collabs

- Add Google Fonts loading (Inter, JetBrains Mono) to all projects
- Align typography and navbar styling across ecosystem
- Update _brand/base.scss as canonical reference for shared styles
- Update _brand/tokens.scss to match book crimson accent
- Add consistent mobile responsive styles to collabs
- Document architecture for maintaining style consistency
This commit is contained in:
Vijay Janapa Reddi
2025-12-30 21:41:48 -05:00
parent c88f92d718
commit fc971d47d3
8 changed files with 543 additions and 13 deletions

View File

@@ -1,12 +1,21 @@
// =============================================================================
// MLSYSBOOK SHARED BASE STYLES
// MLSYSBOOK SHARED BASE STYLES - CANONICAL REFERENCE
// =============================================================================
// Base stylesheet shared across all MLSysBook ecosystem projects.
// Each project imports this and sets its own $accent-color before importing.
// This is the SINGLE SOURCE OF TRUTH for shared styles across the ecosystem.
//
// Usage in project stylesheet:
// $accent-color: #148F77; // Project's accent (teal for kits, crimson for book)
// @import "../../_brand/base.scss";
// Due to Quarto's SCSS format limitations (can't use @import between
// /*-- scss:defaults --*/ and /*-- scss:rules --*/), this file cannot be
// directly imported. Instead, it serves as the REFERENCE TEMPLATE.
//
// ARCHITECTURE:
// - book/quarto/assets/styles/style.scss -> Uses $crimson (#A51C30)
// - kits/assets/styles/style.scss -> Uses $kits-accent (#148F77)
// - collabs/assets/styles/style.scss -> Uses $colabs-accent (#7D3C98)
//
// Each project file should MIRROR the patterns in this file, only changing
// the accent color variable. When updating shared styles:
// 1. Update this file first
// 2. Copy the changes to book, kits, and collabs stylesheets
// =============================================================================
// Default accent color (override in project before importing)
@@ -146,6 +155,30 @@ a {
}
}
// =============================================================================
// DARK MODE TOGGLE
// =============================================================================
.quarto-color-scheme-toggle {
color: #6c757d !important;
&:hover {
color: $accent-color !important;
}
}
// Moon icon in light mode (indicates "switch to dark mode")
.quarto-color-scheme-toggle:not(.alternate) .bi::before {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%234a5568" class="bi bi-moon-stars-fill" viewBox="0 0 16 16"><path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"/><path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z"/></svg>') !important;
background-size: contain !important;
background-repeat: no-repeat !important;
background-position: center !important;
content: "" !important;
display: inline-block !important;
width: 1em !important;
height: 1em !important;
}
// =============================================================================
// NAVIGATION STYLES
// =============================================================================
@@ -175,6 +208,20 @@ a {
font-weight: 400 !important;
}
}
// Subscribe button - match other nav items (gray, not special colored)
&[href*="subscribe"],
&[href="#subscribe"] {
color: #6c757d !important;
&:visited, &:focus, &:active {
color: #6c757d !important;
}
&:hover {
color: $accent-color !important;
}
}
}
// =============================================================================

View File

@@ -12,7 +12,7 @@ $brand-light: #f8f9fa;
$brand-white: #ffffff;
// Product Accent Colors
$textbook-accent: #1B4F72; // Navy - academic, serious
$textbook-accent: #A51C30; // Harvard crimson - academic, brand
$kits-accent: #148F77; // Teal - hardware, practical
$tinytorch-accent: #D4740C; // Amber - builder, warm
$colabs-accent: #7D3C98; // Purple - exploratory

View File

@@ -1,8 +1,22 @@
/*-- scss:defaults --*/
// =============================================================================
// TEXTBOOK STYLES - BASELINE
// =============================================================================
// Main textbook styles with Harvard crimson theme.
// This is the BASELINE for the ecosystem. Shared patterns are also defined
// in _brand/base.scss as the canonical reference.
//
// Accent: CRIMSON (#A51C30) - Harvard brand, academic authority
// =============================================================================
// Color variables - Harvard Crimson Theme
$crimson: #A51C30;
// Typography (shared across all ecosystem projects)
$font-family-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
$font-family-monospace: 'JetBrains Mono', 'Fira Code', monospace;
// Unified Harvard crimson theme for callouts and UI elements
$callout-primary: $crimson; // #A51C30 - Harvard crimson (brand)
$callout-info: #4f7396; // Muted steel blue - for notes/general info

View File

@@ -526,6 +526,9 @@ format:
include-in-header:
text: |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<script type="module" src="/tools/scripts/socratiQ/bundle.js" defer></script>
<script src="/assets/scripts/sidebar-auto-collapse.js" defer></script>

View File

@@ -1,11 +1,48 @@
/*-- scss:defaults --*/
// Brand colors matching MLSysBook ecosystem
$primary: #2563eb;
// =============================================================================
// CO-LABS STYLES
// =============================================================================
// Mirrors shared patterns from _brand/base.scss with PURPLE accent color.
// See _brand/base.scss for the canonical reference of shared styles.
//
// IMPORTANT: When updating shared styles (callouts, navbar, sidebar, headers,
// TOC, tables, figures, mobile), update _brand/base.scss first, then sync here.
// =============================================================================
// Brand colors (from _brand/tokens.scss)
$brand-crimson: #A51C30;
$colabs-accent: #7D3C98; // Purple - exploratory
$textbook-accent: #A51C30; // Crimson - academic (matches book)
// Set the accent color for this project
$accent-color: $colabs-accent;
// Override Bootstrap/Quarto primary colors
$primary: $colabs-accent;
$secondary: #64748b;
$success: #22c55e;
$warning: #f59e0b;
$accent: #e94560;
$link-color: $colabs-accent;
// Typography (matching book and kits exactly)
$font-family-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
$font-family-monospace: 'JetBrains Mono', 'Fira Code', monospace;
// Callout colors (unified theme with purple primary)
$callout-primary: $colabs-accent;
$callout-info: #4f7396;
$callout-success: #4a7c59;
$callout-caution: #b8860b;
$callout-secondary: #64748b;
// Light background tints for callouts
$callout-primary-bg: rgba($callout-primary, 0.08);
$callout-info-bg: rgba($callout-info, 0.08);
$callout-success-bg: rgba($callout-success, 0.08);
$callout-caution-bg: rgba($callout-caution, 0.08);
$callout-secondary-bg: rgba($callout-secondary, 0.08);
/*-- scss:rules --*/
@@ -32,10 +69,140 @@ $accent: #e94560;
height: 1em !important;
}
// ============================================================================
// CALLOUT STYLING (matching book exactly, with purple accent)
// ============================================================================
.callout {
margin: 1.25rem 0 !important;
border-radius: 0.5rem !important;
border-left-width: 5px !important;
font-size: 0.9rem !important;
box-shadow: 0 2px 8px rgba(125, 60, 152, 0.1) !important;
.callout-header {
padding: 0.5rem 0.85rem !important;
font-weight: 400 !important;
font-size: 0.9rem !important;
line-height: 1.3 !important;
}
.callout-title-container {
font-weight: bold !important;
}
.callout-body {
padding: 0.75rem 0.85rem !important;
line-height: 1.5 !important;
}
}
.callout-note,
.callout.callout-style-default.callout-note {
border-left-color: $callout-info !important;
.callout-icon .bi,
.callout-icon i {
color: $callout-info !important;
}
.callout-header {
background-color: $callout-info-bg !important;
}
}
.callout-tip,
.callout.callout-style-default.callout-tip {
border-left-color: $callout-success !important;
.callout-icon .bi,
.callout-icon i {
color: $callout-success !important;
}
.callout-header {
background-color: $callout-success-bg !important;
}
}
.callout-important,
.callout.callout-style-default.callout-important {
border-left-color: $callout-primary !important;
.callout-icon .bi,
.callout-icon i {
color: $callout-primary !important;
}
.callout-header {
background-color: $callout-primary-bg !important;
}
}
.callout-caution,
.callout-warning,
.callout.callout-style-default.callout-caution,
.callout.callout-style-default.callout-warning {
border-left-color: $callout-caution !important;
.callout-icon .bi,
.callout-icon i {
color: $callout-caution !important;
}
.callout-header {
background-color: $callout-caution-bg !important;
}
}
// ============================================================================
// LINK STYLES
// ============================================================================
a {
color: $colabs-accent;
text-decoration: none;
&:hover {
color: darken($colabs-accent, 15%);
text-decoration: underline;
}
&:visited {
color: darken($colabs-accent, 10%);
}
}
// ============================================================================
// NAVBAR STYLING
// ============================================================================
.navbar .nav-link {
.navbar-nav .nav-link {
color: #6c757d !important;
font-weight: 400;
&:hover {
color: $colabs-accent !important;
}
&.active:not(.dropdown-toggle) {
color: $colabs-accent !important;
font-weight: 500 !important;
}
&:visited {
color: #6c757d !important;
}
&.dropdown-toggle {
color: #6c757d !important;
&:visited, &:focus, &.active {
color: #6c757d !important;
font-weight: 400 !important;
}
}
// Subscribe button - match other nav items (gray, not special colored)
&[href*="subscribe"],
&[href="#subscribe"] {
@@ -46,11 +213,296 @@ $accent: #e94560;
}
&:hover {
color: $primary !important;
color: $colabs-accent !important;
}
}
}
// ============================================================================
// SIDEBAR STYLES
// ============================================================================
.sidebar-navigation .sidebar-item a {
color: #495057;
font-weight: 400;
display: block;
padding: 2px 6px;
margin: 0.5px 0;
border-radius: 3px;
transition: all 0.15s ease;
&:hover {
color: $colabs-accent;
background-color: rgba($colabs-accent, 0.08);
font-weight: 500;
text-decoration: none;
transform: translateX(2px);
}
&.active,
&[aria-current="page"] {
color: $colabs-accent;
font-weight: 500;
background-color: rgba($colabs-accent, 0.12);
}
}
.sidebar-navigation .sidebar-item a[data-bs-toggle="collapse"] {
font-weight: 500;
color: #2c3e50;
font-size: 0.9rem;
letter-spacing: 0.01em;
&:hover {
color: $colabs-accent;
background-color: rgba($colabs-accent, 0.08);
font-weight: 600;
text-decoration: none;
transform: translateX(2px);
}
}
// ============================================================================
// HEADER STYLES (matching book with purple accent)
// ============================================================================
.content h2,
main h2,
article h2,
#quarto-content h2 {
border-left: 5px solid $colabs-accent;
border-bottom: 1px solid rgba($colabs-accent, 0.3);
padding-left: 16px;
padding-bottom: 8px;
margin-top: 2rem;
margin-bottom: 1rem;
}
.content h3,
main h3,
article h3,
#quarto-content h3 {
border-left: 4px solid $colabs-accent;
border-bottom: 1px solid rgba($colabs-accent, 0.25);
padding-left: 14px;
padding-bottom: 6px;
margin-top: 1.5rem;
margin-bottom: 0.75rem;
color: #2c3e50;
}
.content h4,
main h4,
article h4,
#quarto-content h4 {
border-left: 3px solid $colabs-accent;
border-bottom: 1px solid rgba($colabs-accent, 0.2);
padding-left: 12px;
padding-bottom: 4px;
margin-top: 1.25rem;
margin-bottom: 0.5rem;
color: #34495e;
font-weight: 500;
}
.content h5,
main h5,
article h5,
#quarto-content h5 {
border-left: 2px solid $colabs-accent;
border-bottom: 1px solid rgba($colabs-accent, 0.15);
padding-left: 10px;
padding-bottom: 3px;
margin-top: 1rem;
margin-bottom: 0.4rem;
color: #5a6c7d;
font-weight: 500;
}
// ============================================================================
// TABLE OF CONTENTS (Right sidebar)
// ============================================================================
.table-of-contents,
#TOC,
.quarto-toc,
nav[role="doc-toc"] {
font-size: 0.85rem;
line-height: 1.6;
border-left: 3px solid $colabs-accent;
padding-left: 1.5rem;
margin-left: 0.5rem;
h2, h3, h4, h5, h6 {
border-left: none !important;
padding-left: 0 !important;
}
a,
.nav-link {
color: #495057;
font-weight: 400;
text-decoration: none;
display: block;
padding: 0.2rem 0;
transition: all 0.15s ease;
border: none !important;
&:hover {
color: $colabs-accent;
font-weight: 500;
}
}
> ul > li > a {
font-weight: 500;
color: #2c3e50;
font-size: 0.9rem;
}
ul ul a {
font-size: 0.8rem;
color: #6c757d;
}
.active,
.nav-link.active {
color: $colabs-accent !important;
font-weight: 500 !important;
}
}
// ============================================================================
// BUTTON STYLES
// ============================================================================
.btn-primary {
background-color: $colabs-accent;
border-color: $colabs-accent;
&:hover {
background-color: darken($colabs-accent, 15%);
border-color: darken($colabs-accent, 15%);
}
}
// ============================================================================
// TABLE STYLES
// ============================================================================
table {
border-collapse: collapse;
width: 100%;
margin: 1.5rem 0;
font-size: 0.9rem;
th {
background-color: #f8f9fa;
font-weight: 600;
text-align: left;
padding: 12px 16px;
border-bottom: 2px solid #e9ecef;
}
td {
text-align: left;
padding: 10px 16px;
border-bottom: 1px solid #e9ecef;
vertical-align: top;
}
tbody tr:nth-child(even) {
background-color: #f8f9fa;
}
tbody tr:hover {
background-color: #e9ecef;
}
}
// ============================================================================
// FIGURE STYLES
// ============================================================================
figure {
margin-top: 2rem !important;
margin-bottom: 1.5rem !important;
}
.figure-caption,
.caption,
figure figcaption {
margin-top: 1rem !important;
font-size: 0.9rem !important;
color: #666 !important;
line-height: 1.4 !important;
text-align: left !important;
}
// Image styling
.quarto-figure img {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
// ============================================================================
// MOBILE RESPONSIVE STYLES (matching book and kits)
// ============================================================================
@media (max-width: 768px) {
.navbar {
padding: 0.5rem 0.75rem !important;
min-height: 60px !important;
}
.navbar-brand {
font-size: 1rem !important;
font-weight: 500 !important;
img {
height: 32px !important;
width: auto !important;
margin-right: 0.5rem !important;
}
}
.navbar-toggler {
padding: 0.5rem !important;
border: none !important;
min-width: 44px !important;
min-height: 44px !important;
}
.navbar-nav .nav-link {
padding: 0.75rem 1rem !important;
font-size: 1rem !important;
}
.sidebar {
font-size: 0.9rem;
.sidebar-item a {
padding: 0.5rem 0.75rem !important;
}
}
}
@media (max-width: 576px) {
.navbar {
padding: 0.25rem 0.5rem !important;
}
.content {
padding: 0.75rem;
}
table,
.table-responsive {
overflow-x: auto !important;
display: block !important;
}
}
// ============================================================================
// HERO SECTION
// ============================================================================

View File

@@ -112,6 +112,11 @@ format:
link-external-icon: false
link-external-newwindow: true
anchor-sections: true
include-in-header:
- text: |
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
include-after-body:
- text: |
<script src="assets/scripts/subscribe-modal.js" defer></script>

View File

@@ -3,13 +3,17 @@
// =============================================================================
// HARDWARE KITS STYLES
// =============================================================================
// Uses shared base styles from _brand/ with teal accent color
// Mirrors shared patterns from _brand/base.scss with TEAL accent color.
// See _brand/base.scss for the canonical reference of shared styles.
//
// IMPORTANT: When updating shared styles (callouts, navbar, sidebar, headers,
// TOC, tables, figures, mobile), update _brand/base.scss first, then sync here.
// =============================================================================
// Brand colors (from _brand/tokens.scss)
$brand-crimson: #A51C30;
$kits-accent: #148F77; // Teal - hardware/practical
$textbook-accent: #1B4F72; // Navy - academic
$textbook-accent: #A51C30; // Crimson - academic (matches book)
// Set the accent color for this project (used by base.scss)
$accent-color: $kits-accent;

View File

@@ -182,6 +182,11 @@ format:
link-external-icon: false
link-external-newwindow: true
anchor-sections: true
include-in-header:
- text: |
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
include-after-body:
- text: |
<script src="assets/scripts/subscribe-modal.js" defer></script>