/**
 * Unified Monospace CSS Framework
 * By Oskar Wickström (monospace-web)
 * Licensed under the MIT License (https://github.com/owickstrom/the-monospace-web/blob/main/LICENSE.md)
 * 
 * Extended with expressive components for sales and marketing pages
 */

/* ============================================
   FONTS & ROOT VARIABLES
   ============================================ */

@font-face {
  font-family: 'Berkeley Mono Fallback';
  src: local('Courier New'), local('Courier'), local('monospace');
  size-adjust: 95%;
  ascent-override: 105%;
  descent-override: 35%;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Oblique.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Bold-Oblique.woff2') format('woff2');
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-family: "Berkeley Mono", "Berkeley Mono Fallback", monospace;
  --line-height: 1.20rem;
  --border-thickness: 2px;
  --text-color: #000;
  --text-color-alt: #666;
  --background-color: #fff;
  --background-color-alt: #eee;

  --font-weight-normal: 500;
  --font-weight-medium: 600;
  --font-weight-bold: 800;

  /* Layout Width Custom Properties */
  --max-width-content: 80ch;
  --max-width-wide: 100ch;
  --max-width-full: 100%;

  /* Validation & Feedback Colors */
  --color-success: #4CAF50;
  --color-info: #2196F3;
  --color-muted: #999;
  --color-error: #b71c1c;
  --color-error-bg: #ffebee;

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: var(--font-weight-normal);
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #fff;
    --text-color-alt: #aaa;
    --background-color: #000;
    --background-color-alt: #111;
    --color-error: #ef5350;
    --color-error-bg: #b71c1c;
  }
}

/* ============================================
   BASE RESETS & TYPOGRAPHY
   ============================================ */

* {
  box-sizing: border-box;
}

* + * {
  margin-top: var(--line-height);
}

html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  color: var(--text-color);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height);
  line-height: var(--line-height);
}

h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  margin-bottom: calc(var(--line-height) * 2);
  text-transform: uppercase;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  line-height: calc(1.5 * var(--line-height));
  text-transform: uppercase;
  margin-bottom: var(--line-height);
  text-align: center;
}

h3 {
  font-size: 1.25rem;
  line-height: calc(1.5 * var(--line-height));
  margin-bottom: var(--line-height);
}

h4 {
  font-size: 1rem;
  line-height: var(--line-height);
  margin-bottom: var(--line-height);
}

h5 {
  font-size: 0.875rem;
  line-height: var(--line-height);
  margin-bottom: var(--line-height);
}

h6 {
  font-size: 0.875rem;
  line-height: var(--line-height);
  margin-bottom: var(--line-height);
}

hr {
  position: relative;
  display: block;
  height: var(--line-height);
  margin: calc(var(--line-height) * 1.5) 0;
  border: none;
  color: var(--text-color);
}

hr:after {
  display: block;
  content: "";
  position: absolute;
  top: calc(var(--line-height) / 2 - var(--border-thickness));
  left: 0;
  width: 100%;
  border-top: var(--border-thickness) solid var(--text-color);
  height: 0;
}

a {
  text-decoration-thickness: var(--border-thickness);
  transition: text-decoration-color 0.2s ease;
}

a:link, a:visited {
  color: var(--text-color);
}

a:hover {
  text-decoration-color: var(--text-color-alt);
}

p {
  margin-bottom: var(--line-height);
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

strong {
  font-weight: var(--font-weight-bold);
}

em {
  font-style: italic;
}

sub {
  position: relative;
  display: inline-block;
  margin: 0;
  vertical-align: sub;
  line-height: 0;
  width: calc(1ch / 0.75);
  font-size: .75rem;
}

pre {
  white-space: pre;
  overflow-x: auto;
  margin: var(--line-height) 0;
  overflow-y: hidden;
}

figure pre {
  margin: 0;
}

pre, code {
  font-family: var(--font-family);
}

code {
  font-weight: var(--font-weight-medium);
}

/* ============================================
   LAYOUT & CONTAINER WIDTHS
   ============================================ */

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--line-height) 2ch;
  max-width: var(--max-width-content);
  line-height: var(--line-height);
  overflow-x: hidden;
  scroll-padding-top: calc(var(--line-height) * 3.5);
}

/* Layout Width Hooks */
body.layout-wide,
body.expressive,
body.sales {
  max-width: var(--max-width-content);
}

body.layout-full {
  max-width: var(--max-width-full);
}

/* Container Options */
.expressive-container,
.sales-container {
  max-width: var(--max-width-wide);
  margin: 0 auto;
}

.expressive-container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--line-height) 2ch;
}

/* ============================================
   PHASE SECTION STYLES (Figma-inspired)
   ============================================ */

.phase-header {
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 2) 1ch;
  text-align: center;
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height) 0;
}

.phase-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--line-height) * 1);
  margin: var(--line-height) 0;
}

.phase-box {
  border: var(--border-thickness) solid var(--text-color);
  padding: var(--line-height) 1ch;
}

.phase-box h4 {
  margin: 0 0 calc(var(--line-height) / 2) 0;
  font-weight: var(--font-weight-bold);
}

/* Phases Section Container */
.phases-section {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  padding: calc(var(--line-height) * 2) 2ch;
  margin: calc(var(--line-height) * 3) 0;
}

/* Interactive Phase Selector */
/* Phase buttons now use inline grid styles in HTML for precise control */

.phase-content-block {
  display: none;
}

.phase-content-block.active {
  display: block;
}

/* Remove margin-top from phase-content div (override * + * selector) */
#phase-content {
  margin-top: 0 !important;
}

/* Remove ALL spacing from phase blocks and their grid containers */
.phase-content-block,
.phase-content-block > div {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
}

/* Restore line-height and font-size for text content only */
.phase-content-block div[style*="flex-direction: column"] {
  line-height: var(--line-height) !important;
  font-size: 1rem !important;
}

/* Ensure phase images are flush to top of container */
.phase-content-block img[data-no-grid] {
  align-self: start !important;
  object-position: top left !important;
  line-height: 0 !important;
  font-size: 0 !important;
}

/* Disable hover effect on phase images */
.phase-content-block img[data-no-grid]:hover {
  transform: none !important;
}

/* Container for phase images - no overflow hidden needed without hover effect */
.phase-content-block > div {
  overflow: visible;
}

/* Mobile responsive styles for phase switcher */
@media (max-width: 768px) {
  /* Prevent horizontal overflow on mobile */
  body {
    overflow-x: hidden !important;
  }

  /* Make phase buttons fit on one row with reduced padding */
  #phase-selector .phase-button {
    padding: calc(var(--line-height) * 0.75) 0.5ch !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.03em !important;
  }

  /* Fix border misalignment on middle button - hide right border on mobile */
  #phase-selector .phase-button[data-phase="ops"] {
    border-right: none !important;
  }

  /* Stack image and text vertically on mobile */
  .phase-content-block.active > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    height: auto !important;
    gap: var(--line-height) !important;
    padding: calc(var(--line-height) * 1) 1ch !important;
  }

  /* Make images full width and adjust height on mobile */
  .phase-content-block img[data-no-grid] {
    width: 100% !important;
    height: auto !important;
    max-height: 300px !important;
    object-fit: cover !important;
  }

  /* Add padding to phase content text so it doesn't touch edges */
  .phase-content-block div[style*="flex-direction: column"] {
    padding: calc(var(--line-height) * 1) 2ch !important;
  }

  /* Prevent stats grid overflow on mobile */
  .stats-grid {
    max-width: 100% !important;
    overflow: hidden !important;
  }
}

.phase-box p {
  margin: 0;
}

@media (max-width: 768px) {
  .phase-boxes {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SITE HEADER & NAVIGATION
   ============================================ */

.site-header {
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) * 0.75) 0;
  text-align: center;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(var(--line-height) * -1);
  margin-bottom: calc(var(--line-height) * 1.5);
}

/* Fixed header on desktop only */
@media (min-width: 769px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
    margin: 0;
  }

  /* Add top padding to body to prevent content from hiding under fixed header */
  body {
    padding-top: calc(var(--line-height) * 4);
  }

  /* When header is fixed, remove it from grid flow */
  @media (min-width: 1400px) {
    body:has(.sidebar-toc) > header {
      grid-column: auto;
      grid-row: auto;
    }

    /* Add extra top padding for grid layout to create clear space below fixed header */
    body:has(.sidebar-toc) {
      padding-top: calc(var(--line-height) * 8);
    }
  }
}

.site-header h1 {
  font-size: 1rem;
  line-height: var(--line-height);
  margin: 0;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-header a {
  text-decoration: none;
  color: var(--background-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.site-header .header-logo {
  height: 1.75rem;
  width: auto;
  display: block;
}

.site-header .header-text {
  display: block;
}

.site-header a:hover {
  text-decoration: underline;
}

/* Hide old header components - kept for backwards compatibility */
.site-header-left,
.site-logo-link,
.header-logo-light,
.header-logo-dark,
.site-branding,
.main-nav,
.mobile-menu-toggle,
.mobile-menu {
  display: none;
}

.main-nav a:hover {
  text-decoration: underline;
}

.nav-separator {
  color: var(--text-color);
}

.contact-button {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 4) calc(var(--line-height) / 2);
  margin-left: calc(var(--line-height) * 0.25);
}

.contact-button:hover {
  background: var(--background-color-alt);
  text-decoration: none;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 4) calc(var(--line-height) / 2);
  font-size: 16px;
  cursor: pointer;
  color: var(--text-color);
  font-family: var(--font-family);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height);
  height: auto;
  text-transform: none;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--background-color);
  border: var(--border-thickness) solid var(--text-color);
  border-top: none;
  z-index: 1000;
  flex-direction: column;
  margin-top: 0;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  display: block;
  padding: var(--line-height) 2ch;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: var(--border-thickness) solid var(--text-color);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

.mobile-menu a:hover {
  background: var(--background-color-alt);
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */

/* Main Content */
.main-content {
  margin-bottom: calc(2 * var(--line-height));
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 14px;
  line-height: var(--line-height);
  margin-bottom: calc(var(--line-height) * 2);
  color: var(--text-color-alt);
}

.breadcrumbs a {
  color: var(--text-color);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Hero Section */
.hero-section {
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) * 3) calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 3);
  text-align: center;
  max-width: 80ch;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% + 4ch);
  margin-left: -2ch;
}

.hero-section h1 {
  font-size: 48px;
  line-height: calc(var(--line-height) * 2.5);
  margin: 0 0 var(--line-height) 0;
  color: var(--background-color);
  letter-spacing: 0.1em;
}

.hero-section p {
  font-size: 18px;
  line-height: calc(var(--line-height) * 1.5);
  margin: 0 0 calc(var(--line-height) * 2) 0;
  color: var(--background-color);
}

.hero-button {
  display: inline-block;
  background: var(--background-color);
  border: var(--border-thickness) solid var(--background-color);
  padding: calc(var(--line-height) / 2) calc(var(--line-height) * 1);
  text-decoration: none;
  color: var(--text-color);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.hero-button:hover {
  background: transparent;
  color: var(--background-color);
}

/* Campaign Boxes */
.campaign-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 3);
}

.campaign-box {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) * 2) calc(var(--line-height) * 1.5);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.campaign-box:hover {
  transform: translateY(-4px);
  box-shadow: 4px 4px 0 var(--text-color);
}

.campaign-box h3 {
  font-size: 18px;
  line-height: var(--line-height);
  margin: 0 0 var(--line-height) 0;
  text-transform: uppercase;
  font-weight: var(--font-weight-bold);
}

.campaign-box p {
  margin: 0;
  font-size: 14px;
  line-height: var(--line-height);
  color: var(--text-color-alt);
}

/* Article Page Layout */
.article-header .article-title {
  font-size: 28px;
  line-height: calc(1.5 * var(--line-height));
  margin: 0 0 var(--line-height) 0;
  font-weight: var(--font-weight-bold);
}

.article-header .article-subtitle {
  font-size: 16px;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height);
  color: var(--text-color-alt);
  margin: 0 0 var(--line-height) 0;
}

.article-header .article-byline {
  font-size: 14px;
  color: var(--text-color-alt);
  margin: 0 0 calc(2 * var(--line-height)) 0;
}

/* Product Page Layout */
.product-header .product-title {
  font-size: 32px;
  line-height: calc(2 * var(--line-height));
  margin: 0 0 var(--line-height) 0;
  font-weight: var(--font-weight-bold);
}

.product-header .product-subtitle {
  font-size: 18px;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height);
  color: var(--text-color-alt);
  margin: 0 0 calc(2 * var(--line-height)) 0;
}

/* Enhanced Typography Scale */
.expressive-title {
  font-size: 3rem;
  line-height: calc(3 * var(--line-height));
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height) 0;
  text-transform: uppercase;
}

.expressive-subtitle {
  font-size: 1.5rem;
  line-height: calc(2 * var(--line-height));
  font-weight: var(--font-weight-bold);
  margin: var(--line-height) 0;
}

.expressive-large {
  font-size: 1.25rem;
  line-height: calc(1.5 * var(--line-height));
}

.expressive-small {
  font-size: 0.875rem;
  line-height: var(--line-height);
  color: var(--text-color-alt);
}

/* Expressive Sections */
.expressive-section,
.sales-section {
  margin: calc(var(--line-height) * 4) 0;
}

.expressive-section-bordered {
  border-top: calc(var(--border-thickness) * 3) double var(--text-color);
  padding-top: calc(var(--line-height) * 2);
  margin: calc(var(--line-height) * 4) 0;
}

.expressive-section h2 {
  margin-top: 0;
}

/* Split Layout - Two column content */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--line-height) * 3);
  margin: calc(var(--line-height) * 2) 0;
  align-items: start;
}

.split-layout-60-40 {
  display: grid;
  grid-template-columns: 60fr 40fr;
  gap: calc(var(--line-height) * 3);
  margin: calc(var(--line-height) * 2) 0;
  align-items: start;
}

.split-layout-40-60 {
  display: grid;
  grid-template-columns: 40fr 60fr;
  gap: calc(var(--line-height) * 3);
  margin: calc(var(--line-height) * 2) 0;
  align-items: start;
}

.split-column {
  min-width: 0;
}

/* ============================================
   GRID SYSTEMS
   ============================================ */

/* Basic Grid */
.grid {
  --grid-cells: 0;
  display: flex;
  gap: 1ch;
  width: 100%;
  margin-bottom: var(--line-height);
}

.grid > *,
.grid > input {
  flex: 1 1 0;
}

.grid:has(> :last-child:nth-child(1)) { --grid-cells: 1; }
.grid:has(> :last-child:nth-child(2)) { --grid-cells: 2; }
.grid:has(> :last-child:nth-child(3)) { --grid-cells: 3; }
.grid:has(> :last-child:nth-child(4)) { --grid-cells: 4; }
.grid:has(> :last-child:nth-child(5)) { --grid-cells: 5; }
.grid:has(> :last-child:nth-child(6)) { --grid-cells: 6; }
.grid:has(> :last-child:nth-child(7)) { --grid-cells: 7; }
.grid:has(> :last-child:nth-child(8)) { --grid-cells: 8; }
.grid:has(> :last-child:nth-child(9)) { --grid-cells: 9; }

/* Multi-Column Grid System */
.multi-column-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 2);
}

.multi-column-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 2);
}

.multi-column-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 2);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: calc(var(--line-height) * 2);
  margin: calc(var(--line-height) * 2) 0;
}

.stat-box {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: auto;
  overflow: visible;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-4px);
  box-shadow: 4px 4px 0 var(--text-color);
  overflow: visible;
}

/* Clickable enrollment cards */
.stat-box.enrollment-card {
  cursor: pointer;
  user-select: none;
}

.stat-box.enrollment-card:hover {
  transform: translateY(-4px);
  box-shadow: 4px 4px 0 var(--text-color);
  background-color: var(--text-color);
  color: var(--background-color);
}

/* Invert child text colors on hover */
.stat-box.enrollment-card:hover .stat-label,
.stat-box.enrollment-card:hover p {
  color: var(--background-color);
}

/* Ensure links inside enrollment cards have proper contrast on hover */
.stat-box.enrollment-card:hover a {
  color: var(--background-color) !important;
  opacity: 1 !important;
}

.stat-box.enrollment-card.selected {
  background-color: var(--text-color);
  color: var(--background-color);
}

.stat-box.enrollment-card.selected:hover {
  /* Keep inverted state on hover when selected */
  background-color: var(--text-color);
  color: var(--background-color);
}

/* Invert child text colors when card is selected */
.stat-box.enrollment-card.selected .stat-label,
.stat-box.enrollment-card.selected p {
  color: var(--background-color);
}

/* Ensure links inside selected enrollment cards have proper contrast */
.stat-box.enrollment-card.selected a {
  color: var(--background-color) !important;
  opacity: 1 !important;
}

/* Force buttons inside enrollment cards to maintain distinct styling and proper size */
.stat-box.enrollment-card .cta-button {
  width: 100%;
  padding: calc(var(--line-height) * 0.75) 3ch !important;
  font-size: 1.1rem !important;
  font-weight: var(--font-weight-bold) !important;
  letter-spacing: 0.1em !important;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

/* Ensure buttons always have contrasting colors from their container */
/* In light mode, buttons are always black-on-white */
@media (prefers-color-scheme: light) {
  .stat-box.enrollment-card .cta-button,
  .stat-box.enrollment-card.selected .cta-button {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
  }

  .stat-box.enrollment-card .cta-button:hover,
  .stat-box.enrollment-card.selected .cta-button:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
  }
}

/* In dark mode, buttons are always white-on-black */
@media (prefers-color-scheme: dark) {
  .stat-box.enrollment-card .cta-button,
  .stat-box.enrollment-card.selected .cta-button {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
  }

  .stat-box.enrollment-card .cta-button:hover,
  .stat-box.enrollment-card.selected .cta-button:hover {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
  }
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  line-height: calc(3 * var(--line-height));
  font-weight: var(--font-weight-bold);
  color: var(--text-color);
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--text-color-alt);
  margin-top: calc(var(--line-height) / 2);
}

/* Make enrollment card labels bigger and bolder */
.enrollment-card .stat-label {
  font-size: 1.75rem;
  line-height: calc(var(--line-height) * 1.5);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.15em;
}

/* MM01 Basics box - spans full width on desktop but matches phase boxes style */
.mm01-basics-box {
  grid-column: 1 / -1;
  text-align: center;
}

/* Project Grid - For Logos/Cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: calc(var(--line-height) * 2);
  margin: calc(var(--line-height) * 2) 0;
}

.project-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.project-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.project-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.project-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.project-card {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--line-height) * 8);
  transition: all 0.2s ease;
}

.project-card:hover {
  background: var(--background-color-alt);
  transform: translateY(-2px);
}

.project-card img {
  max-width: 100%;
  height: auto;
  max-height: calc(var(--line-height) * 6);
  object-fit: contain;
  margin: 0;
}

.project-card h3,
.project-card h4 {
  margin: var(--line-height) 0 0 0;
  font-size: 0.875rem;
}

/* Logo Grid - Simple grid for logos */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: calc(var(--line-height) * 1.5);
  margin: calc(var(--line-height) * 2) 0;
  align-items: center;
}

.logo-grid img {
  max-width: 100%;
  height: auto;
  max-height: calc(var(--line-height) * 4);
  object-fit: contain;
  margin: 0;
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.2s ease;
}

.logo-grid img:hover {
  filter: grayscale(0%);
  opacity: 1;
}

/* Override child margin rules for grid layouts */
.multi-column-2 > *,
.multi-column-3 > *,
.multi-column-4 > *,
.project-grid > *,
.logo-grid > *,
.split-layout > *,
.stats-grid > *,
.objective-grid-3 > *,
.qualification-cards > * {
  margin-top: 0;
}

/* Also reset first child top margin inside grid items */
.multi-column-2 > * > *:first-child,
.multi-column-3 > * > *:first-child,
.multi-column-4 > * > *:first-child,
.split-layout > * > *:first-child,
.objective-grid-3 > * > *:first-child,
.qualification-cards > * > *:first-child {
  margin-top: 0;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* Campaign Intro Section */
.campaign-intro {
  max-width: 68ch;
  margin: 0 auto calc(var(--line-height) * 3) auto;
}

.campaign-intro .tagline {
  font-size: 1.2rem;
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0;
  line-height: calc(var(--line-height) * 1.5);
}

.campaign-intro .lead {
  font-size: 1.05rem;
  line-height: calc(var(--line-height) * 1.5);
  margin-bottom: calc(var(--line-height) * 1.5);
}

/* Objective Cards Grid */
.objective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: calc(var(--line-height) * 1.5);
  margin: calc(var(--line-height) * 2) 0;
  align-items: stretch;
}

/* Objective Cards Grid - 3 Column Version */
.objective-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--line-height) * 2);
  margin: calc(var(--line-height) * 2) 0;
  align-items: start;  /* Align from top, not stretch */
}

@media (max-width: 900px) {
  .objective-grid-3 {
    grid-template-columns: 1fr;
  }
}

.objective-card {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: stretch;  /* Ensure children don't shift horizontally */
  justify-content: flex-start;  /* Align content from top */
  height: 100%;
}

.objective-card:hover {
  transform: translateY(-4px);
  border-color: var(--text-color);
}

.objective-card h3 {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  margin: 0 0 calc(var(--line-height) / 2) 0;
  margin-top: 0 !important;  /* Prevent margin collapse */
  line-height: var(--line-height);
  letter-spacing: 0.05em;
  text-align: left;
}

.objective-card p {
  font-size: 0.95rem;
  line-height: calc(var(--line-height) * 1.25);
  margin: 0;
  color: var(--text-color-alt);
  flex-grow: 1;
}

/* Qualification Cards */
.qualification-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--line-height) * 2);
  margin: calc(var(--line-height) * 2) 0;
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.qualification-card {
  border: calc(var(--border-thickness) * 3) solid var(--text-color);
  padding: calc(var(--line-height) * 2) 2ch;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.qualification-card.for-you {
  background: var(--text-color);
  color: var(--background-color);
}

.qualification-card.not-for-you {
  background: var(--background-color);
  color: var(--text-color);
}

.qualification-card h3 {
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  margin: 0 0 var(--line-height) 0;
  letter-spacing: 0.05em;
}

.qualification-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.qualification-card li {
  margin: calc(var(--line-height) / 2) 0;
  padding-left: 2ch;
  position: relative;
  line-height: calc(var(--line-height) * 1.25);
}

.qualification-card.for-you li::before {
  content: "✓";
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-bold);
}

.qualification-card.not-for-you li::before {
  content: "×";
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-bold);
  font-size: 1.2rem;
}

/* Instructor Showcase */
.instructor-showcase {
  margin: calc(var(--line-height) * 3) 0;
}

.instructor-showcase h2 {
  text-align: center;
  margin-bottom: calc(var(--line-height) * 2);
}

.instructor-intro {
  max-width: 68ch;
  margin: 0 auto calc(var(--line-height) * 2) auto;
  text-align: center;
  font-size: 1.05rem;
}

.instructor-showcase table {
  table-layout: fixed;
  width: 100%;
}

.instructor-showcase table th:first-child,
.instructor-showcase table td:first-child {
  width: 80px;
}

.instructor-showcase table th:nth-child(2),
.instructor-showcase table td:nth-child(2) {
  width: 180px;
}

.instructor-showcase table img {
  display: block;
  max-width: 100%;
  height: auto;
}

@media (max-width: 900px) {
  .instructor-showcase table {
    table-layout: auto;
  }

  .instructor-showcase table,
  .instructor-showcase thead,
  .instructor-showcase tbody,
  .instructor-showcase th,
  .instructor-showcase td,
  .instructor-showcase tr {
    display: block;
  }

  .instructor-showcase thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .instructor-showcase tr {
    border: calc(var(--border-thickness) * 2) solid var(--text-color);
    margin-bottom: calc(var(--line-height) * 2);
    padding: calc(var(--line-height) * 1.5) 2ch;
  }

  .instructor-showcase td {
    border: none;
    position: relative;
    padding: 0;
    margin-bottom: calc(var(--line-height));
  }

  .instructor-showcase td:first-child {
    text-align: center;
    margin-bottom: calc(var(--line-height));
  }

  .instructor-showcase td:first-child img {
    width: 80px;
    height: 80px;
    margin: 0 auto;
  }

  .instructor-showcase td:nth-child(2) {
    font-weight: var(--font-weight-bold);
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: calc(var(--line-height));
  }

  .instructor-showcase td:nth-child(3) {
    text-align: left;
    margin-bottom: 0;
  }
}

/* Rhythm Callout */
.rhythm-callout {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color-alt);
}

.rhythm-callout .rhythm-title {
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  margin: 0 0 calc(var(--line-height) / 2) 0;
}

.rhythm-callout p {
  margin: 0;
  font-size: 0.95rem;
  line-height: calc(var(--line-height) * 1.25);
}

/* Callout Box */
.callout-box {
  border-left: calc(var(--border-thickness) * 3) solid var(--text-color);
  padding-left: 2ch;
  margin: calc(var(--line-height) * 2) 0;
  color: var(--text-color-alt);
  transition: padding-left 0.2s ease, border-left-width 0.2s ease;
}

.callout-box:hover {
  padding-left: 3ch;
  border-left-width: calc(var(--border-thickness) * 4);
}

.callout-box strong,
.callout-box em {
  color: var(--text-color);
}

/* Callout Box with Titled Header */
.callout-box-titled {
  border: var(--border-thickness) solid var(--text-color);
  padding: 0;
  margin: calc(var(--line-height) * 2) 0;
}

.callout-box-titled .callout-title {
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 2) 2ch;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  font-size: 0.875rem;
  margin: 0;
}

.callout-box-titled .callout-content {
  padding: calc(var(--line-height) * 1) 2ch;
  color: var(--text-color-alt);
}

.callout-box-titled .callout-content strong,
.callout-box-titled .callout-content em {
  color: var(--text-color);
}

/* Quote Block */
.quote-block {
  border: var(--border-thickness) solid var(--text-color);
  border-left: calc(var(--border-thickness) * 4) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  margin: calc(var(--line-height) * 2) 0;
  font-style: italic;
}

.quote-block cite {
  display: block;
  margin-top: var(--line-height);
  font-style: normal;
  font-weight: var(--font-weight-medium);
  font-size: 0.875rem;
  text-align: right;
}

.quote-block cite::before {
  content: "— ";
}

/* Large Quote Block for Testimonials */
.quote-block-large {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  padding: calc(var(--line-height) * 3) 3ch;
  margin: calc(var(--line-height) * 3) 0;
  font-style: italic;
  font-size: 1.5rem;
  line-height: calc(2 * var(--line-height));
  text-align: left;
}

.quote-block-large p {
  margin: 0 0 var(--line-height) 0;
  font-weight: var(--font-weight-bold);
}

.quote-block-large cite {
  display: block;
  margin-top: calc(var(--line-height) * 1.5);
  font-style: normal;
  font-weight: var(--font-weight-medium);
  font-size: 1rem;
  line-height: var(--line-height);
  text-align: right;
}

.quote-block-large cite::before {
  content: "— ";
}

.quote-block-large .quote-attribution {
  display: block;
  margin-top: calc(var(--line-height) / 2);
  font-size: 0.875rem;
  color: var(--text-color-alt);
}

/* Testimonial Feature */
.testimonial-feature {
  position: relative;
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  border-left: calc(var(--border-thickness) * 8) solid var(--text-color);
  padding: calc(var(--line-height) * 2) 3ch;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color-alt);
}

.testimonial-badge {
  position: absolute;
  top: calc(var(--line-height) * -1);
  left: 4ch;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 4) 2ch;
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
}

.testimonial-feature blockquote {
  border: none;
  padding: 0;
  margin: 0;
  font-size: 1.125rem;
  line-height: calc(var(--line-height) * 1.5);
  font-style: italic;
}

.testimonial-feature blockquote p {
  margin: 0;
}

.testimonial-attribution {
  margin-top: calc(var(--line-height) * 2);
  padding-top: calc(var(--line-height) * 1.5);
  border-top: var(--border-thickness) solid var(--text-color);
  font-style: normal;
  font-size: 0.875rem;
  text-align: right;
}

.testimonial-attribution strong {
  font-weight: var(--font-weight-bold);
}

/* Testimonial Feature with Corner Badge */
.testimonial-corner-badge {
  position: relative;
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  border-left: calc(var(--border-thickness) * 8) solid var(--text-color);
  padding: calc(var(--line-height) * 2) 3ch;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color-alt);
}

.testimonial-corner-badge .testimonial-badge {
  position: absolute;
  top: 0;
  left: calc(-1 * calc(var(--border-thickness) * 8));
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 4) 1ch;
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.testimonial-corner-badge blockquote {
  border: none;
  padding: 0;
  margin: 0;
  font-size: 1.125rem;
  line-height: calc(var(--line-height) * 1.5);
  font-style: italic;
}

.testimonial-corner-badge blockquote p {
  margin: 0;
}

.testimonial-corner-badge .testimonial-attribution {
  margin-top: calc(var(--line-height) * 2);
  padding-top: calc(var(--line-height) * 1.5);
  border-top: var(--border-thickness) solid var(--text-color);
  font-style: normal;
  font-size: 0.875rem;
  text-align: right;
}

.testimonial-corner-badge .testimonial-attribution strong {
  font-weight: var(--font-weight-bold);
}

/* Banner/Announcement Styles */
.banner-announcement {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  border-left: none;
  border-right: none;
  padding: calc(var(--line-height) * 2) 2ch;
  margin: calc(var(--line-height) * 3) 0;
  text-align: left;
  background: var(--background-color);
  position: relative;
}

.banner-announcement-prominent {
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) * 2) 2ch;
  margin: 0 0 calc(var(--line-height) * 3) 0;
  text-align: center;
  border: none;
}

.banner-announcement h2,
.banner-announcement h3 {
  margin-top: 0;
  font-size: 1.5rem;
  line-height: calc(2 * var(--line-height));
}

.banner-announcement p:last-child {
  margin-bottom: 0;
}

.banner-announcement-prominent p {
  margin: calc(var(--line-height) / 2) 0;
}

.banner-announcement-prominent strong {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

/* CTA buttons in banner sections get extra emphasis */
.banner-announcement .cta-button,
.banner-announcement-prominent .cta-button {
  font-size: 1.1rem !important;
  padding: calc(var(--line-height) * 0.75) 3ch !important;
  font-weight: var(--font-weight-bold) !important;
  letter-spacing: 0.1em !important;
  box-shadow: 0 4px 0 var(--text-color) !important;
  transition: all 0.2s ease !important;
}

.banner-announcement .cta-button:hover,
.banner-announcement-prominent .cta-button:hover {
  transform: translateY(2px) !important;
  box-shadow: 0 2px 0 var(--text-color) !important;
}

/* Philosophy Box - Bordered Container with List Items */
.philosophy-box {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) * 1.5) 2ch;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color);
}

.philosophy-box h2,
.philosophy-box h3 {
  margin-top: 0;
  margin-bottom: var(--line-height);
  text-transform: uppercase;
  font-size: 1rem;
  border-bottom: var(--border-thickness) solid var(--text-color);
  padding-bottom: calc(var(--line-height) / 2);
}

.philosophy-box ul,
.philosophy-box ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.philosophy-box li {
  border-bottom: 1px solid var(--text-color-alt);
  padding: calc(var(--line-height) / 2) 1ch;
  margin: 0;
}

.philosophy-box li:last-child {
  border-bottom: none;
}

.philosophy-box li:hover {
  background: var(--background-color-alt);
}

/* Compact philosophy box without borders between items */
.philosophy-box-compact {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) * 1) 2ch;
  margin: calc(var(--line-height) * 1.5) 0;
}

.philosophy-box-compact li {
  border-bottom: none;
  padding: calc(var(--line-height) / 4) 0;
}

/* Philosophy Box with Full-Width Header */
.philosophy-box-header {
  border: var(--border-thickness) solid var(--text-color);
  padding: 0;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color);
}

.philosophy-box-header h2,
.philosophy-box-header h3 {
  margin: 0;
  text-transform: uppercase;
  font-size: 1rem;
  border-bottom: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 2) 2ch;
  background: var(--background-color);
}

.philosophy-box-header ul,
.philosophy-box-header ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.philosophy-box-header li {
  border-bottom: 1px solid var(--text-color-alt);
  padding: calc(var(--line-height) / 2) 2ch;
  margin: 0;
}

.philosophy-box-header li:last-child {
  border-bottom: none;
}

.philosophy-box-header li:hover {
  background: var(--background-color-alt);
}

/* Philosophy Box with Inverted Header */
.philosophy-box-inverted {
  border: var(--border-thickness) solid var(--text-color);
  padding: 0;
  margin: calc(var(--line-height) * 2) 0;
  background: var(--background-color);
}

.philosophy-box-inverted h2,
.philosophy-box-inverted h3 {
  margin: 0;
  text-transform: uppercase;
  font-size: 1rem;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 2) 2ch;
}

.philosophy-box-inverted ul,
.philosophy-box-inverted ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.philosophy-box-inverted li {
  border-bottom: 1px solid var(--text-color-alt);
  padding: calc(var(--line-height) / 2) 2ch;
  margin: 0;
}

.philosophy-box-inverted li:last-child {
  border-bottom: none;
}

.philosophy-box-inverted li:hover {
  background: var(--background-color-alt);
}

/* Sales Highlight */
.sales-highlight {
  background: var(--background-color-alt);
  padding: calc(var(--line-height) * 1.5) 2ch;
  border: var(--border-thickness) solid var(--text-color);
  margin: calc(var(--line-height) * 2) 0;
}

/* Badge Components */
.badge-new {
  display: inline-block;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 4) 1ch;
  font-weight: var(--font-weight-bold);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-right: 1ch;
  vertical-align: middle;
  position: relative;
}

.badge-new::before,
.badge-new::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
}

.badge-new::before {
  left: -0.5ch;
  border-width: calc(var(--line-height) / 2) 0.5ch calc(var(--line-height) / 2) 0;
  border-color: transparent var(--text-color) transparent transparent;
}

.badge-new::after {
  right: -0.5ch;
  border-width: calc(var(--line-height) / 2) 0 calc(var(--line-height) / 2) 0.5ch;
  border-color: transparent transparent transparent var(--text-color);
}

/* Starburst badge */
.badge-starburst {
  display: inline-block;
  position: relative;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 2) 1.5ch;
  font-weight: var(--font-weight-bold);
  font-size: 0.875rem;
  text-transform: uppercase;
  margin-right: 1ch;
  clip-path: polygon(
    50% 0%, 61% 35%, 98% 35%, 68% 57%,
    79% 91%, 50% 70%, 21% 91%, 32% 57%,
    2% 35%, 39% 35%
  );
  min-width: calc(var(--line-height) * 4);
  min-height: calc(var(--line-height) * 4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* Large Badge for More Text */
.badge-large {
  display: inline-block;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) / 2) 2ch;
  font-weight: var(--font-weight-bold);
  font-size: 0.875rem;
  text-transform: uppercase;
  margin-right: 1ch;
  vertical-align: middle;
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
}

/* Details/Summary */
details {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
  margin-bottom: var(--line-height);
}

summary {
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

details[open] summary {
  margin-bottom: var(--line-height);
}

details ::marker {
  display: inline-block;
  content: '▶';
  margin: 0;
}

details[open] ::marker {
  content: '▼';
}

details :last-child {
  margin-bottom: 0;
}

/* Tables inside details should have proper margins on desktop */
details table {
  margin-left: 1ch !important;
  margin-right: 1ch !important;
  width: calc(100% - 2ch) !important;
  position: static !important;
  top: auto !important;
  margin-top: var(--line-height) !important;
  margin-bottom: var(--line-height) !important;
}

/* On mobile, override the margin constraints to allow full width */
@media (max-width: 768px) {
  details table {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: calc(100% + 2ch) !important;
    max-width: calc(100% + 2ch) !important;
    margin-left: -1ch !important;
  }

  /* Tip paragraph should align with text above */
  details p[style*="border-left"] {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 1ch !important;
  }
}

/* Tree Structure */
.tree, .tree ul {
  position: relative;
  padding-left: 0;
  list-style-type: none;
  line-height: var(--line-height);
}

.tree ul {
  margin: 0;
}

.tree ul li {
  position: relative;
  padding-left: 1.5ch;
  margin-left: 1.5ch;
  border-left: var(--border-thickness) solid var(--text-color);
}

.tree ul li:before {
  position: absolute;
  display: block;
  top: calc(var(--line-height) / 2);
  left: 0;
  content: "";
  width: 1ch;
  border-bottom: var(--border-thickness) solid var(--text-color);
}

.tree ul li:last-child {
  border-left: none;
}

.tree ul li:last-child:after {
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  content: "";
  height: calc(var(--line-height) / 2);
  border-left: var(--border-thickness) solid var(--text-color);
}

/* ============================================
   TABLES & MEDIA
   ============================================ */

table {
  position: relative;
  top: calc(var(--line-height) / 2);
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
}

th, td {
  border: var(--border-thickness) solid var(--text-color);
  padding: 
    calc((var(--line-height) / 2))
    calc(1ch - var(--border-thickness) / 2)
    calc((var(--line-height) / 2) - (var(--border-thickness)))
  ;
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}

table tbody tr:first-child > * {
  padding-top: calc((var(--line-height) / 2) - var(--border-thickness));
}

th {
  font-weight: 700;
}

.width-min {
  width: 0%;
}

.width-auto {
  width: 100%;
}

.header {
  margin-bottom: calc(var(--line-height) * 2);
}

.header h1 {
  margin: 0;
}

.header tr td:last-child {
  text-align: right;
}

/* Enhanced Table Styling */
.expressive-table,
body.expressive table,
body.sales table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
  margin: calc(var(--line-height) * 2) 0;
  table-layout: auto;
}

.expressive-table th,
.expressive-table td,
body.expressive table th,
body.expressive table td,
body.sales table th,
body.sales table td {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 2) 1ch;
  text-align: left;
}

.expressive-table thead th,
body.expressive table thead th,
body.sales table thead th {
  background: var(--text-color);
  color: var(--background-color);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
}

.expressive-table tbody tr:nth-child(even),
body.expressive table tbody tr:nth-child(even),
body.sales table tbody tr:nth-child(even) {
  background: var(--background-color-alt);
}

.expressive-table tbody tr:hover,
body.expressive table tbody tr:hover,
body.sales table tbody tr:hover {
  background: var(--background-color-alt);
}

/* Simple bordered table */
.table-bordered {
  border: calc(var(--border-thickness) * 2) solid var(--text-color);
  width: 100%;
}

.table-bordered th,
.table-bordered td {
  border: var(--border-thickness) solid var(--text-color);
}

/* Table with Emphasized Header */
.table-header-emphasis {
  border-collapse: collapse;
  width: 100%;
  margin: calc(var(--line-height) * 2) 0;
}

.table-header-emphasis thead {
  background: var(--text-color);
  color: var(--background-color);
}

.table-header-emphasis thead th {
  background: var(--text-color);
  color: var(--background-color);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  padding: calc(var(--line-height) / 2) 1ch;
  text-align: left;
  border: none;
  border-bottom: calc(var(--border-thickness) * 2) solid var(--text-color);
}

.table-header-emphasis tbody td {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 2) 1ch;
  text-align: left;
}

.table-header-emphasis tbody tr:nth-child(even) {
  background: var(--background-color-alt);
}

.table-header-emphasis tbody tr:hover {
  background: var(--background-color-alt);
}

/* Images & Video */
img, video {
  display: block;
  width: 100%;
  object-fit: contain;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

img:hover {
  transform: scale(1.02);
}

img {
  font-style: italic;
  color: var(--text-color-alt);
}

/* Phase/Section Images */
.phase-image {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Figures */
figure {
  margin: calc(var(--line-height) * 2) 3ch;
  overflow-x: auto;
  overflow-y: hidden;
}

figcaption {
  display: block;
  font-style: italic;
  margin-top: var(--line-height);
}

/* Inline Icons for Social/Website Links */
.inline-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
  margin: 0 2px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.inline-icon:hover {
  opacity: 1;
}

/* Ensure icons are visible in both light and dark modes */
a .inline-icon {
  filter: brightness(0) invert(var(--invert-icon, 0));
}

@media (prefers-color-scheme: dark) {
  a .inline-icon {
    filter: brightness(0) invert(1);
  }
}

@media (prefers-color-scheme: light) {
  a .inline-icon {
    filter: brightness(0) invert(0);
  }
}

/* ============================================
   BUTTONS & CTAS
   ============================================ */

/* Standard Buttons */
input, button, textarea {
  border: var(--border-thickness) solid var(--text-color);
  padding: 
    calc(var(--line-height) / 2 - var(--border-thickness))
    calc(1ch - var(--border-thickness));
  margin: 0;
  font: inherit;
  font-weight: inherit;
  height: calc(var(--line-height) * 2);
  width: auto;
  overflow: visible;
  background: var(--background-color);
  color: var(--text-color);
  line-height: normal;
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;
  -webkit-appearance: none;
}

input[type=checkbox],
input[type=radio] {
  display: inline-grid;
  place-content: center;
  vertical-align: top;
  width: 2ch;
  height: var(--line-height);
  cursor: pointer;
}

input[type=checkbox]:checked:before,
input[type=radio]:checked:before {
  content: "";
  width: 1ch;
  height: calc(var(--line-height) / 2);
  background: var(--text-color);
}

input[type=radio],
input[type=radio]:before {
  border-radius: 100%;
}

button:focus, input:focus {
  --border-thickness: 3px;
  outline: none;
}

input {
  width: 100%;
}

::placeholder {
  color: var(--text-color-alt);
  opacity: 1;
}

::-ms-input-placeholder {
  color: var(--text-color-alt);
}

button::-moz-focus-inner {
  padding: 0;
  border: 0
}

button {
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

button:hover {
  background: var(--background-color-alt);
}

button:active {
  transform: translate(2px, 2px);
}

label {
  display: block;
  width: 100%;
  height: auto;
  line-height: var(--line-height);
  font-weight: var(--font-weight-medium);
  margin: 0;
}

label input {
  width: 100%;
}

/* Expressive Buttons */
.expressive-button {
  display: inline-block;
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 2) 2ch;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  text-decoration: none;
  background: var(--background-color);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.expressive-button:hover {
  background: var(--text-color);
  color: var(--background-color);
}

.expressive-button:active {
  transform: translate(2px, 2px);
}

.expressive-button-large {
  padding: var(--line-height) 3ch;
  font-size: 1.125rem;
}

.expressive-button-primary {
  background: var(--text-color) !important;
  color: var(--background-color) !important;
}

.expressive-button-primary:hover {
  background: var(--background-color) !important;
  color: var(--text-color) !important;
  border-color: var(--text-color) !important;
}

/* CTA Button */
.cta-button {
  display: inline-block;
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) / 2) 2ch;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  text-decoration: none;
  background: var(--text-color);
  color: var(--background-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cta-button:hover {
  background: var(--background-color);
  color: var(--text-color);
  border-color: var(--text-color);
}

/* Ensure CTA buttons always have good contrast in both light and dark modes */
@media (prefers-color-scheme: light) {
  .cta-button {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
  }

  .cta-button:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
  }

  /* Banner buttons get drop shadow effect */
  .banner-announcement .cta-button,
  .banner-announcement-prominent .cta-button {
    box-shadow: 0 4px 0 #000000 !important;
  }

  .banner-announcement .cta-button:hover,
  .banner-announcement-prominent .cta-button:hover {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #000000 !important;
  }
}

@media (prefers-color-scheme: dark) {
  .cta-button {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
  }

  .cta-button:hover {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
  }

  /* Banner buttons get drop shadow effect */
  .banner-announcement .cta-button,
  .banner-announcement-prominent .cta-button {
    box-shadow: 0 4px 0 #ffffff !important;
  }

  .banner-announcement .cta-button:hover,
  .banner-announcement-prominent .cta-button:hover {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #ffffff !important;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

/* Spacing Utilities */
.expressive-mt-0 { margin-top: 0 !important; }
.expressive-mt-1 { margin-top: var(--line-height) !important; }
.expressive-mt-2 { margin-top: calc(var(--line-height) * 2) !important; }
.expressive-mt-3 { margin-top: calc(var(--line-height) * 3) !important; }
.expressive-mt-4 { margin-top: calc(var(--line-height) * 4) !important; }

.expressive-mb-0 { margin-bottom: 0 !important; }
.expressive-mb-1 { margin-bottom: var(--line-height) !important; }
.expressive-mb-2 { margin-bottom: calc(var(--line-height) * 2) !important; }
.expressive-mb-3 { margin-bottom: calc(var(--line-height) * 3) !important; }
.expressive-mb-4 { margin-bottom: calc(var(--line-height) * 4) !important; }

.expressive-pt-0 { padding-top: 0 !important; }
.expressive-pt-1 { padding-top: var(--line-height) !important; }
.expressive-pt-2 { padding-top: calc(var(--line-height) * 2) !important; }
.expressive-pt-3 { padding-top: calc(var(--line-height) * 3) !important; }
.expressive-pt-4 { padding-top: calc(var(--line-height) * 4) !important; }

.expressive-pb-0 { padding-bottom: 0 !important; }
.expressive-pb-1 { padding-bottom: var(--line-height) !important; }
.expressive-pb-2 { padding-bottom: calc(var(--line-height) * 2) !important; }
.expressive-pb-3 { padding-bottom: calc(var(--line-height) * 3) !important; }
.expressive-pb-4 { padding-bottom: calc(var(--line-height) * 4) !important; }

/* Text Alignment Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display Utilities */
.expressive-block { display: block; }
.expressive-inline-block { display: inline-block; }
.expressive-flex { display: flex; }
.expressive-grid { display: grid; }

/* Flex Utilities */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 { gap: var(--line-height); }
.gap-2 { gap: calc(var(--line-height) * 2); }
.gap-3 { gap: calc(var(--line-height) * 3); }

/* ============================================
   PAGE-SPECIFIC STYLES
   ============================================ */

/* Feature List */
.feature-list {
  list-style: none;
  padding: 0;
  margin: calc(var(--line-height) * 2) 0;
}

.feature-list li {
  padding-left: 3ch;
  position: relative;
  margin-bottom: var(--line-height);
}

.feature-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-bold);
}

/* Checkmark List */
.checkmark-list {
  list-style: none;
  padding: 0;
  margin: calc(var(--line-height) * 2) 0;
}

/* Crew Pricing Examples - simple dash list */
.crew-pricing-examples {
  list-style: none !important;
  padding-left: 0 !important;
  margin: calc(var(--line-height) / 2) 0;
  font-size: 0.9rem;
}

.crew-pricing-examples li {
  margin: 0;
  padding-left: 2ch;
  position: relative;
}

.crew-pricing-examples li::before {
  content: "–" !important;
  position: absolute;
  left: 0;
}

.checkmark-list li {
  padding-left: 2.5ch;
  position: relative;
  margin-bottom: calc(var(--line-height) / 2);
  line-height: var(--line-height);
}

.checkmark-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-bold);
  color: var(--text-color);
}

/* Lists */
ul, ol {
  padding: 0;
  margin: 0 0 var(--line-height);
}

ul {
  list-style-type: square;
  padding: 0 0 0 2.5ch;
}

ol {
  list-style-type: none;
  counter-reset: item;
  padding: 0;
}

ol ul,
ol ol,
ul ol,
ul ul {
  padding: 0 0 0 3ch;
  margin: 0;
}

ol li:before { 
  content: counters(item, ".") ". ";
  counter-increment: item;
  font-weight: var(--font-weight-medium);
}

li {
  margin: 0;
  padding: 0;
}

li::marker {
  line-height: 0;
}

/* Dotted Pattern Background */
.dotted-pattern-background {
  background-image: radial-gradient(circle, var(--text-color) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  opacity: 0.4;
}

.dotted-pattern-background > * {
  opacity: 1;
  position: relative;
  z-index: 1;
}

/* Textured Header (grainy/halftone effect) */
.textured-header {
  position: relative;
  background: var(--text-color);
  color: var(--background-color);
  padding: calc(var(--line-height) * 1.5) 2ch calc(var(--line-height) * 1) 2ch;
  overflow: hidden;
  margin-bottom: calc(var(--line-height) * 1.5);
}

.textured-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    );
  opacity: 0.5;
  pointer-events: none;
}

.textured-header-label {
  display: inline-block;
  background: var(--background-color);
  color: var(--text-color);
  padding: calc(var(--line-height) / 4) 1ch;
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  margin-bottom: calc(var(--line-height) / 2);
  position: relative;
  z-index: 1;
}

.textured-header > * {
  position: relative;
  z-index: 1;
}

/* Pricing Accordion */
.pricing-accordion {
  margin: calc(var(--line-height) * 2) 0;
}

.pricing-accordion details {
  border: var(--border-thickness) solid var(--text-color);
  margin-bottom: calc(var(--line-height) * 1);
  padding: 0;
}

.pricing-accordion summary {
  padding: calc(var(--line-height) * 1) 2ch;
  cursor: pointer;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  background: var(--background-color);
  border: none;
  user-select: none;
}

.pricing-accordion summary:hover {
  background: var(--background-color-alt);
}

.pricing-accordion details > *:not(summary) {
  padding: 0 2ch calc(var(--line-height) * 1) 2ch;
  margin: 0;
}

/* Footer Styles */
.site-footer {
  margin-top: calc(var(--line-height) * 3);
  padding-top: calc(var(--line-height) * 2);
  border-top: var(--border-thickness) solid var(--text-color-alt);
}

.footer-table {
  width: 100%;
  border: none;
}

.footer-table td {
  border: none;
  vertical-align: middle;
  padding: 0;
}

.footer-logo {
  width: calc(var(--line-height) * 6);
  text-align: left;
  padding-right: calc(var(--line-height) * 1);
  vertical-align: top;
}

.footer-logo-light, .footer-logo-dark {
  height: calc(var(--line-height) * 3);
  width: auto;
  max-width: 100%;
}

.footer-logo-light {
  display: block;
}

.footer-logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .footer-logo-light {
    display: none;
  }
  
  .footer-logo-dark {
    display: block;
  }
}

.footer-text {
  font-size: 0.9rem;
  line-height: var(--line-height);
  color: var(--text-color-alt);
}

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

/* Scrollbar */
::-webkit-scrollbar {
    height: var(--line-height);
}

/* ============================================
   DEBUG UTILITIES
   ============================================ */

.debug .debug-grid {
  --color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background-image:
    repeating-linear-gradient(var(--color) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%);
  background-size: 1ch var(--line-height);
  margin: 0;
}

.debug .off-grid {
  background: rgba(255, 0, 0, 0.1);
}

.debug-toggle-label {
  text-align: right;
}

/* ============================================
   RESPONSIVE MEDIA QUERIES
   ============================================ */

@media screen and (max-width: 768px) {
  .main-nav {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .site-logo-link {
    height: 20px;
  }

  .site-branding h1 {
    font-size: 20px;
  }

  .campaign-boxes {
    grid-template-columns: 1fr;
    gap: var(--line-height);
  }

  .multi-column-2,
  .multi-column-3,
  .multi-column-4 {
    grid-template-columns: 1fr;
    gap: var(--line-height);
  }

  .split-layout,
  .split-layout-60-40,
  .split-layout-40-60 {
    grid-template-columns: 1fr;
    gap: var(--line-height);
  }

  .project-grid,
  .project-grid-2,
  .project-grid-3,
  .project-grid-4,
  .project-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--line-height);
  }

  /* Disable image hover effects on mobile (no hover state) */
  img:hover {
    transform: none;
  }

  /* Make ALL tables horizontally scrollable on mobile */
  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Improve table readability on mobile */
  th, td {
    min-width: 100px;
    white-space: normal;
  }

  /* But first column (images) stays narrow */
  th:first-child, td:first-child {
    min-width: 50px;
  }

  /* Stack stats grid on mobile for better readability */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Stack enrollment cards vertically on mobile */
  .stats-grid:has(.enrollment-card) {
    grid-template-columns: 1fr !important;
    gap: var(--line-height) !important;
  }

  /* Larger touch targets for buttons */
  button, .cta-button, .expressive-button {
    min-height: calc(var(--line-height) * 2.5);
    padding: calc(var(--line-height) * 0.75) 2ch;
  }

  /* Improve form input touch targets */
  input[type="email"],
  input[type="text"],
  textarea {
    min-height: calc(var(--line-height) * 2.5);
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .multi-column-3,
  .multi-column-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-grid-4,
  .project-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (max-width: 480px) {
  :root {
    font-size: 14px;
  }

  body {
    padding: var(--line-height) 1ch;
  }

  .site-header {
    gap: calc(var(--line-height) * 0.5);
  }

  .site-logo-link {
    height: 18px;
  }

  .site-branding h1 {
    font-size: 18px;
  }

  .hero-section {
    padding: calc(var(--line-height) * 2) calc(var(--line-height) * 1);
    width: calc(100% + 2ch);
    margin-left: -1ch;
  }

  .hero-section h1 {
    font-size: 32px;
    line-height: calc(var(--line-height) * 2);
  }

  .hero-section p {
    font-size: 16px;
    line-height: var(--line-height);
  }

  /* Make banner announcements mobile-friendly */
  .banner-announcement,
  .banner-announcement-prominent {
    padding: var(--line-height) 1ch;
    margin-left: -1ch;
    margin-right: -1ch;
    width: calc(100% + 2ch);
  }

  /* Ensure CTA buttons are full-width on small screens */
  .cta-button {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  /* Single column for project grids on very small screens */
  .project-grid,
  .project-grid-2,
  .project-grid-3,
  .project-grid-4,
  .project-grid-5 {
    grid-template-columns: 1fr;
  }

  /* Reduce padding on boxes for more content space */
  .stat-box,
  .campaign-box {
    padding: var(--line-height) 1ch;
  }

  /* Smaller table cells on mobile */
  th, td {
    min-width: 80px;
    font-size: 0.85rem;
    padding: calc(var(--line-height) / 2) 0.5ch;
  }

  /* But first column (images) stays narrow */
  th:first-child, td:first-child {
    min-width: 50px;
  }

  /* On mobile, make images smaller but keep them visible */
  table thead tr th:first-child img,
  table tbody tr td:first-child img {
    width: 40px;
    height: 40px;
    object-fit: cover;
  }

  /* Reduce first column width on mobile */
  table thead tr th:first-child,
  table tbody tr td:first-child {
    width: 50px;
    padding: calc(var(--line-height) / 4) 0.25ch;
  }

  .footer-table {
    display: block;
  }

  .footer-table td {
    display: block;
    text-align: center;
  }

  .footer-logo {
    width: 100%;
    padding-right: 0;
    margin-bottom: var(--line-height);
  }

  .footer-text {
    text-align: center;
  }
}

/* ============================================
   SIDEBAR LAYOUT (Desktop Only)
   ============================================ */

/* Three-column layout: TOC | Main Content | CTA */
@media (min-width: 1400px) {
  /* Only apply grid if sidebars exist - override max-width constraint */
  body:has(.sidebar-toc) {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr) 15rem;
    grid-template-rows: auto 1fr auto;
    gap: 2rem;
    max-width: 1800px !important;
    margin: 0 auto;
    padding: 0 1rem;
  }

  body:has(.sidebar-toc) > header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  body:has(.sidebar-toc) > .breadcrumbs {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body:has(.sidebar-toc) > main {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    /* Add top margin to align with sidebar TOC position (8 line-heights from top) */
    /* Letter inside has 3 line-height top margin, so we add 5 here for total of 8 */
    margin-top: calc(var(--line-height) * 5);
  }

  body:has(.sidebar-toc) > footer {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /* TOC in left sidebar - sticky positioning below fixed header
   * IMPORTANT: Positioning is controlled here, NOT in sidebar-toc.js
   * The JavaScript creates the element but does NOT apply position/top inline styles
   * This allows responsive units to work correctly without inline style overrides
   * To adjust vertical position: Change the 'top' calc() value below
   */
  .sidebar-toc {
    grid-column: 1;
    grid-row: 2;
    padding: 0;
    font-size: 0.9rem;
    position: sticky;
    top: calc(var(--line-height) * 9);  /* Offset below fixed header */
    max-height: calc(100vh - var(--line-height) * 10);
    overflow-y: auto;
    z-index: 90;
  }

  /* Tree structure for TOC */
  .sidebar-toc ul {
    position: relative;
    padding-left: 0;
    list-style-type: none;
    line-height: var(--line-height);
    margin: 0;
  }

  .sidebar-toc ul ul {
    margin: 0;
  }

  .sidebar-toc ul ul li {
    position: relative;
    padding-left: 1.5ch;
    margin-left: 1.5ch;
    border-left: var(--border-thickness) solid var(--text-color);
  }

  .sidebar-toc ul ul li:before {
    position: absolute;
    display: block;
    top: calc(var(--line-height) / 2);
    left: 0;
    content: "";
    width: 1ch;
    border-bottom: var(--border-thickness) solid var(--text-color);
  }

  .sidebar-toc ul ul li:last-child {
    border-left: none;
  }

  .sidebar-toc ul ul li:last-child:after {
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    content: "";
    height: calc(var(--line-height) / 2);
    border-left: var(--border-thickness) solid var(--text-color);
  }

  .sidebar-toc a {
    text-decoration: none;
    transition: text-decoration 0.1s ease;
  }

  .sidebar-toc a:hover {
    text-decoration: underline;
  }

  /* CTA in right sidebar - sticky positioning below fixed header
   * IMPORTANT: Positioning is controlled here, NOT in sidebar-cta.js
   * The JavaScript creates the element but does NOT apply position/top inline styles
   * This allows responsive units to work correctly without inline style overrides
   * To adjust vertical position: Change the 'top' calc() value below
   * Note: Should match .sidebar-toc top value for aligned appearance
   */
  .sidebar-cta {
    grid-column: 3;
    grid-row: 2;
    padding: 0;
    position: sticky;
    top: calc(var(--line-height) * 9);  /* Offset below fixed header (matches TOC) */
    z-index: 90;
  }
}

/* Hide sidebars on narrower screens */
@media (max-width: 1399px) {
  .sidebar-toc {
    display: none;
  }

  /* On mobile, show CTA at bottom of viewport */
  /* Button-only implementation - no container styling */
  .sidebar-cta {
    position: fixed;
    bottom: calc(var(--line-height) / 2);
    left: 1ch;
    right: 1ch;
    z-index: 1000;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .sidebar-cta .cta-button {
    width: 100%;
    display: block;
    text-align: center;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  @media (prefers-color-scheme: dark) {
    .sidebar-cta .cta-button {
      box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    }
  }

  /* ALTERNATIVE VERSION: Container with dynamic styling
   * To use this instead, comment out the above and uncomment below:
   *
   * .sidebar-cta {
   *   position: fixed;
   *   bottom: 0;
   *   left: 0;
   *   right: 0;
   *   z-index: 1000;
   *   padding: 0;
   *   background: transparent;
   *   border: none;
   *   box-shadow: none;
   *   transition: all 0.3s ease;
   * }
   *
   * .sidebar-cta:has(.cta-button[style*="visibility: visible"]) {
   *   padding: calc(var(--line-height) / 2) 1ch;
   *   background: var(--background-color);
   *   border-top: var(--border-thickness) solid var(--text-color);
   *   box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
   * }
   *
   * @media (prefers-color-scheme: dark) {
   *   .sidebar-cta:has(.cta-button[style*="visibility: visible"]) {
   *     box-shadow: 0 -4px 12px rgba(255, 255, 255, 0.1);
   *   }
   * }
   *
   * .sidebar-cta .cta-button {
   *   width: 100%;
   *   display: block;
   *   text-align: center;
   *   margin: 0;
   * }
   */
}

/* Mobile breadcrumb TOC dropdown styling */
.breadcrumb-toc-expand {
  border: none;
  background: none;
}

.breadcrumb-toc-expand summary {
  font-weight: var(--font-weight-normal);
  outline: none;
}

.breadcrumb-toc-expand summary::-webkit-details-marker {
  display: none;
}

.breadcrumb-toc-expand[open] summary .toc-triangle {
  transform: rotate(180deg);
  display: inline-block;
}


.breadcrumb-toc-dropdown .tree {
  margin: 0;
  list-style: none;
}

.breadcrumb-toc-dropdown .tree li {
  list-style: none;
}

.breadcrumb-toc-dropdown .tree li::marker {
  display: none;
  content: none;
}

.breadcrumb-toc-dropdown .tree > li {
  margin: calc(var(--line-height) / 2) 0;
}

.breadcrumb-toc-dropdown .tree ul li {
  margin: calc(var(--line-height) / 4) 0;
}

.breadcrumb-toc-dropdown .toc-link {
  text-decoration: none;
  display: block;
}

.breadcrumb-toc-dropdown .toc-link:hover {
  text-decoration: underline;
}

/* Sidebar TOC styling */
.sidebar-toc .tree {
  margin: 0;
}

.sidebar-toc .toc-link {
  text-decoration: none;
}

.sidebar-toc .toc-link:hover {
  text-decoration: underline;
}

/* ============================================
   COURSE LOGIN FORM STYLES
   ============================================ */

.course-login-form {
  max-width: 60ch;
  margin: calc(var(--line-height) * 2) auto;
  padding: calc(var(--line-height) * 2);
  border: var(--border-thickness) solid var(--text-color);
}

.course-login-form label {
  display: block;
  font-weight: var(--font-weight-medium);
  margin-bottom: calc(var(--line-height) / 2);
}

.course-login-form input[type="email"] {
  width: 100%;
  padding: calc(var(--line-height) / 2);
  border: var(--border-thickness) solid var(--text-color);
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 1rem;
  margin-top: calc(var(--line-height) / 2);
}

.course-login-form input[type="email"]:focus {
  outline: var(--border-thickness) solid var(--text-color);
  outline-offset: 2px;
}

.course-login-form button[type="submit"] {
  width: 100%;
  padding: calc(var(--line-height) / 2);
  margin-top: var(--line-height);
  border: var(--border-thickness) solid var(--text-color);
  background-color: var(--text-color);
  color: var(--background-color);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.2s ease;
}

.course-login-form button[type="submit"]:hover:not(:disabled) {
  background-color: var(--background-color);
  color: var(--text-color);
}

.course-login-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-message {
  margin-top: var(--line-height);
  padding: calc(var(--line-height) / 2);
  border: var(--border-thickness) solid transparent;
  font-weight: var(--font-weight-medium);
  text-align: center;
}

.form-message.success {
  border-color: #2d5f2e;
  background-color: #e8f5e9;
  color: #2d5f2e;
}

.form-message.error {
  border-color: #b71c1c;
  background-color: #ffebee;
  color: #b71c1c;
}

@media (prefers-color-scheme: dark) {
  .form-message.success {
    border-color: #66bb6a;
    background-color: #1b5e20;
    color: #a5d6a7;
  }

  .form-message.error {
    border-color: #ef5350;
    background-color: #b71c1c;
    color: #ffcdd2;
  }
}

/* Error Boundary - JavaScript Error Display */
.error-boundary {
  margin: var(--line-height) auto;
  padding: var(--line-height);
  max-width: 60ch;
  border: var(--border-thickness) solid #b71c1c;
  background-color: #ffebee;
  color: #b71c1c;
  text-align: center;
}

.error-boundary strong {
  display: block;
  margin-bottom: calc(var(--line-height) / 2);
  font-weight: var(--font-weight-bold);
}

.error-boundary p {
  margin: 0;
  color: #d32f2f;
}

@media (prefers-color-scheme: dark) {
  .error-boundary {
    border-color: #ef5350;
    background-color: #b71c1c;
    color: #ffcdd2;
  }

  .error-boundary p {
    color: #ffcdd2;
  }
}

/* ============================================
   ENROLLMENT ERROR ANIMATIONS
   ============================================ */

/* Enrollment error message slideIn animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   VIDEO LIGHTBOX
   ============================================ */

.video-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: var(--line-height);
}

.video-lightbox.video-lightbox-open {
  opacity: 1;
}

.video-lightbox.video-lightbox-closing {
  opacity: 0;
}

.video-lightbox-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.video-lightbox-close {
  position: absolute;
  top: calc(var(--line-height) * -2);
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: calc(var(--line-height) * 2);
  height: calc(var(--line-height) * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
  font-family: var(--font-family);
  font-weight: var(--font-weight-normal);
}

.video-lightbox-close:hover {
  opacity: 0.7;
  background: transparent;
  transform: none;
}

.video-lightbox-video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  background: #000;
  border: var(--border-thickness) solid #fff;
}

.video-lightbox-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Mobile adjustments for video lightbox */
@media (max-width: 768px) {
  .video-lightbox {
    padding: calc(var(--line-height) / 2);
  }

  .video-lightbox-close {
    top: calc(var(--line-height) * -1.5);
    font-size: 2rem;
  }
}

/* ============================================
   FLIP-CARD COUNTDOWN TIMER (Train Station Style)
   ============================================ */

.flip-countdown-label {
  text-align: center;
  font-size: 0.9rem;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--line-height);
  opacity: 0.8;
}

.flip-countdown-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: calc(var(--line-height) * 1.5);
  flex-wrap: wrap;
}

.flip-card-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--line-height) / 4);
}

.flip-card {
  position: relative;
  width: 5.5ch;
  height: calc(var(--line-height) * 3.5);
  background: var(--text-color);
  color: var(--background-color);
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 2.8rem;
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.flip-card-top,
.flip-card-bottom {
  display: none;
}

.flip-card-label {
  font-size: 0.75rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.1em;
  opacity: 0.7;
  text-align: center;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .flip-card {
    background: var(--text-color);
    color: var(--background-color);
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
  }

  .flip-card-top {
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .flip-countdown-container {
    gap: 1ch;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .flip-card-group {
    gap: calc(var(--line-height) / 6);
  }

  .flip-card {
    width: 3.5ch;
    height: calc(var(--line-height) * 2);
    font-size: 1.8rem;
  }

  .flip-card-top,
  .flip-card-bottom {
    font-size: 1.5rem;
  }

  .flip-card-label {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }
}

/* Desktop enhancements for larger screens */
@media (min-width: 1024px) {
  h2 {
    font-size: 2rem;
    line-height: calc(2 * var(--line-height));
    margin-bottom: calc(var(--line-height) * 1.5);
  }
}
