Files
cs249r_book/_brand/base.scss
Vijay Janapa Reddi 34b350dbec refactor: rename collabs to labs
- Rename collabs/ directory to labs/
- Rename workflow files: collabs-publish-*.yml → labs-publish-*.yml
- Update all paths in workflows, Quarto configs, and navbars
- Update cross-references in book, kits, and dev-landing
- Update site-url to mlsysbook.ai/labs/

Note: GitHub repo variable DEV_COLLABS_PATH needs to be renamed
to DEV_LABS_PATH in repository settings.
2026-01-05 18:45:50 -05:00

511 lines
13 KiB
SCSS

// =============================================================================
// MLSYSBOOK SHARED BASE STYLES - CANONICAL REFERENCE
// =============================================================================
// This is the SINGLE SOURCE OF TRUTH for shared styles across the ecosystem.
//
// 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)
// - labs/assets/styles/style.scss -> Uses $labs-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 labs stylesheets
// =============================================================================
// Default accent color (override in project before importing)
$accent-color: #A51C30 !default; // Harvard crimson as default
// Brand colors (shared across all projects)
$brand-crimson: #A51C30;
$brand-dark: #1a1a1a;
$brand-light: #f8f9fa;
$brand-white: #ffffff;
// Derived colors from accent
$link-color: $accent-color;
$link-hover-color: darken($accent-color, 15%);
// Callout colors (unified theme)
$callout-primary: $accent-color;
$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);
// Typography
$font-family-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
$font-family-monospace: 'JetBrains Mono', 'Fira Code', monospace;
/*-- scss:rules --*/
// =============================================================================
// CALLOUT STYLING
// =============================================================================
.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(0, 0, 0, 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: $link-color;
text-decoration: none;
&:hover {
color: $link-hover-color;
text-decoration: underline;
}
&:visited {
color: darken($accent-color, 10%);
}
}
// =============================================================================
// 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
// =============================================================================
.navbar-nav .nav-link {
color: #6c757d !important;
font-weight: 400;
&:hover {
color: $accent-color !important;
}
&.active:not(.dropdown-toggle) {
color: $accent-color !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"] {
color: #6c757d !important;
&:visited, &:focus, &:active {
color: #6c757d !important;
}
&:hover {
color: $accent-color !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: $accent-color;
background-color: rgba($accent-color, 0.08);
font-weight: 500;
text-decoration: none;
transform: translateX(2px);
}
&.active,
&[aria-current="page"] {
color: $accent-color;
font-weight: 500;
background-color: rgba($accent-color, 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: $accent-color;
background-color: rgba($accent-color, 0.08);
font-weight: 600;
text-decoration: none;
transform: translateX(2px);
}
}
// =============================================================================
// HEADER STYLES
// =============================================================================
.content h2,
main h2,
article h2,
#quarto-content h2 {
border-left: 5px solid $accent-color;
border-bottom: 1px solid rgba($accent-color, 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 $accent-color;
border-bottom: 1px solid rgba($accent-color, 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 $accent-color;
border-bottom: 1px solid rgba($accent-color, 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 $accent-color;
border-bottom: 1px solid rgba($accent-color, 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 $accent-color;
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: $accent-color;
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: $accent-color !important;
font-weight: 500 !important;
}
}
// =============================================================================
// BUTTON STYLES
// =============================================================================
.btn-primary {
background-color: $accent-color;
border-color: $accent-color;
&:hover {
background-color: darken($accent-color, 15%);
border-color: darken($accent-color, 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
// =============================================================================
@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;
}
}