/* ========================================
   Marty64 Knowledge Base - Main Styles
   ======================================== */

:root {
  /* Colors - academic textbook palette */
  --bg: #faf8f0;
  --bg-alt: #f0ece0;
  --text: #2c2c2c;
  --text-muted: #5a5a5a;
  --border: #d5cdb8;
  --link: #1e3a5f;
  --link-hover: #152d4a;

  /* Register colors - adapted to academic palette */
  --pedagogy-bg: #eef3e8;
  --pedagogy-border: #2d6a4f;
  --pedagogy-text: #1a4035;

  --philosophy-bg: #f5eef0;
  --philosophy-border: #7c3043;
  --philosophy-text: #4a1c28;

  /* Academic accents */
  --accent-gold: #c49a2e;
  --accent-burgundy: #7c3043;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Lora', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  
  /* Layout */
  --content-width: 720px;
  --sidebar-width: 260px;
}

/* ========================================
   Reset & Base
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   Layout
   ======================================== */

.site-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #f5f2e8;
  border-right: 1px solid var(--border);
  padding: var(--space-lg);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-2xl);
  max-width: calc(var(--content-width) + var(--space-2xl) * 2 + var(--sidebar-width));
}

.content-wrapper {
  max-width: var(--content-width);
}

/* ========================================
   VG101 Splash Banner
   ======================================== */

.vg101-splash {
  margin: var(--space-xl) 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.vg101-splash img {
  width: 100%;
  display: block;
}

/* ========================================
   Sidebar Navigation
   ======================================== */

.site-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: var(--space-xs);
}

.nav-home {
  display: block;
  padding: 0.5rem 1rem;
  margin: 0.5rem 0 1rem 0;
  color: #1e3a5f;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid #1e3a5f;
  border-radius: 4px;
  text-align: center;
}

.nav-home:hover {
  background: #1e3a5f;
  color: #faf8f0;
}

.site-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.search-box {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
}

.search-box:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.nav-section {
  margin-bottom: var(--space-lg);
}

.nav-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.nav-section-title:hover {
  color: var(--text);
}

.nav-section-title::after {
  content: '\25BC';
  font-size: 0.6em;
  transition: transform 0.2s;
}

.nav-section.collapsed .nav-section-title::after {
  transform: rotate(-90deg);
}

.nav-section .nav-list {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.25s ease;
}

.nav-section.collapsed .nav-list {
  max-height: 0;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: var(--space-xs);
}

.nav-link {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  border-radius: 4px;
  transition: background 0.15s;
}

.nav-link:hover {
  background: var(--bg-alt);
  color: var(--link);
}

.nav-link.active {
  background: var(--bg-alt);
  font-weight: 500;
  color: var(--link);
}

/* ========================================
   Typography
   ======================================== */

h1 {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--accent-gold);
}

h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: var(--space-md);
  border-radius: 6px;
  overflow-x: auto;
  margin: var(--space-md) 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: var(--text-sm);
}

/* Collapsible code blocks */
details.code-block {
  margin: var(--space-md) 0;
  border-radius: 6px;
  overflow: hidden;
}

details.code-block summary {
  background: #2d2d2d;
  color: #d4d4d4;
  padding: 0.75rem 1rem;
  padding-right: 5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
  border-radius: 6px;
  position: relative;
}

.code-copy-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: #3d3d3d;
  border: none;
  color: #a0a0a0;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.code-copy-btn:hover {
  background: #4d4d4d;
  color: #d4d4d4;
}

.code-copy-btn.copied {
  background: #2d6a4f;
  color: white;
}

.code-copy-btn svg {
  width: 14px;
  height: 14px;
}

details.code-block[open] summary {
  border-radius: 6px 6px 0 0;
}

details.code-block summary:hover {
  background: #3d3d3d;
}

details.code-block summary::before {
  content: '▶';
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

details.code-block[open] summary::before {
  transform: rotate(90deg);
}

details.code-block summary::-webkit-details-marker {
  display: none;
}

details.code-block pre {
  margin: 0;
  border-radius: 0 0 6px 6px;
  max-height: 400px;
  overflow-y: auto;
}

/* Custom scrollbar for code blocks */
details.code-block pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

details.code-block pre::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 0 0 6px 0;
}

details.code-block pre::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border-radius: 4px;
}

details.code-block pre::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

blockquote {
  border-left: 3px solid var(--accent-burgundy);
  padding-left: var(--space-md);
  color: var(--text-muted);
  font-style: italic;
  margin: var(--space-md) 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* ========================================
   Lists
   ======================================== */

ul, ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-xs);
}

/* ========================================
   Tables
   ======================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: var(--text-sm);
}

th, td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background: var(--bg-alt);
}

/* ========================================
   Meta & Breadcrumbs
   ======================================== */

.breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--link);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.tag {
  display: inline-block;
  background: var(--bg-alt);
  padding: 0.1em 0.5em;
  border-radius: 4px;
  font-size: var(--text-sm);
}

/* ========================================
   Register Legend
   ======================================== */

.register-legend {
  display: flex;
  gap: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.legend-swatch.student {
  background: #fdfcf7;
  border: 1px solid var(--border);
}

.legend-swatch.pedagogy {
  background: var(--pedagogy-bg);
  border-left: 3px solid var(--pedagogy-border);
}

.legend-swatch.philosophy {
  background: var(--philosophy-bg);
  border-left: 3px solid var(--philosophy-border);
}

/* ========================================
   Three Registers
   ======================================== */

/* Pedagogy Register */
.pedagogy {
  background: var(--pedagogy-bg);
  border-left: 4px solid var(--pedagogy-border);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  border-radius: 0 8px 8px 0;
}

.pedagogy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: var(--space-md);
  user-select: none;
}

.pedagogy-label {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pedagogy-border);
}

.pedagogy .toggle-icon {
  color: var(--pedagogy-border);
  font-size: var(--text-sm);
}

.pedagogy-content {
  color: var(--pedagogy-text);
}

.pedagogy-content.collapsed {
  display: none;
}

.pedagogy h3 {
  color: var(--pedagogy-border);
  margin-top: var(--space-lg);
}

.pedagogy h3:first-child {
  margin-top: 0;
}

/* Philosophy Register */
.philosophy {
  font-family: var(--font-serif);
  background: var(--philosophy-bg);
  border-left: 4px solid var(--philosophy-border);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  border-radius: 0 8px 8px 0;
  line-height: 1.8;
}

.philosophy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: var(--space-md);
  user-select: none;
  font-family: var(--font-sans);
}

.philosophy-label {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--philosophy-border);
  font-family: var(--font-sans);
}

.philosophy .toggle-icon {
  color: var(--philosophy-border);
  font-size: var(--text-sm);
}

.philosophy-content {
  color: var(--philosophy-text);
}

.philosophy-content.collapsed {
  display: none;
}

.philosophy h3 {
  color: var(--philosophy-border);
  font-family: var(--font-sans);
  margin-top: var(--space-lg);
}

.philosophy h3:first-child {
  margin-top: 0;
}

/* ========================================
   See Also / Related Links
   ======================================== */

.see-also {
  background: var(--bg-alt);
  border-left: 3px solid var(--accent-gold);
  padding: var(--space-lg);
  border-radius: 0 8px 8px 0;
  margin: var(--space-xl) 0;
}

.see-also h3 {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.see-also ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.see-also li {
  margin-bottom: var(--space-sm);
}

.see-also .arrow {
  color: var(--text-muted);
  margin-right: var(--space-sm);
}

/* ========================================
   Exercises Box
   ======================================== */

.exercises {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
}

.exercises h2 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* ========================================
   Search Results
   ======================================== */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fdfcf7;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-alt);
}

.search-result-title {
  font-weight: 500;
}

.search-result-section {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.search-wrapper {
  position: relative;
}

/* ========================================
   Mobile Navigation
   ======================================== */

.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  width: 44px;
  height: 44px;
  background: #f5f2e8;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.mobile-nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.mobile-nav-overlay.active {
  display: block;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-lg);
    padding-top: calc(var(--space-lg) + 60px);
  }
}

@media (min-width: 901px) {
  .mobile-nav-toggle,
  .mobile-nav-overlay {
    display: none !important;
  }
}

/* ========================================
   Index Page Specific
   ======================================== */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.section-card {
  background: #fdfcf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.section-card:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
  text-decoration: none;
}

.section-card h3 {
  margin: 0 0 var(--space-sm) 0;
  color: var(--link);
}

.section-card p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========================================
   Print Styles
   ======================================== */

/* ========================================
   Three-Register System (shared)
   ======================================== */

.register {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
}

.register-header {
  padding: 1rem 1.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.register-header::after {
  content: '\25BC';
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.register.collapsed .register-header::after {
  transform: rotate(-90deg);
}

.register-content {
  padding: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.register.collapsed .register-content {
  display: none;
}

.register-content h3 {
  margin-top: 0;
}

.register-content h3:not(:first-child) {
  margin-top: 1.5rem;
}

.register-label {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

/* Practice register - forest green */
.register--practice {
  background: #eef3e8;
  border: 2px solid #2d6a4f;
}

.register--practice .register-header {
  background: #2d6a4f;
  color: #fff;
}

.register--practice .register-content {
  border-color: #a8d5b8;
}

/* Craft register - deep navy */
.register--craft {
  background: #eef2f7;
  border: 2px solid #1e3a5f;
}

.register--craft .register-header {
  background: #1e3a5f;
  color: #fff;
}

.register--craft .register-content {
  border-color: #a8c4e0;
}

/* Theory register - burgundy */
.register--theory {
  background: #f5eef0;
  border: 2px solid #7c3043;
}

.register--theory .register-header {
  background: #7c3043;
  color: #fff;
}

.register--theory .register-content {
  border-color: #d4a0b0;
}

/* Glossary term links */
.term {
  color: #c49a2e;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.term:hover {
  color: #d97706;
}

/* ========================================
   VG101 Example Figures
   ======================================== */

.vg-figure {
  margin: 1.5rem 0;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f2e8;
  border: 1px solid var(--border);
}

.vg-figure img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s;
}

.vg-figure img:hover {
  opacity: 0.92;
}

/* Placeholder when image hasn't loaded */
.vg-figure__placeholder {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #f0ece0 0%, #e8e3d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 1.5rem;
  text-align: center;
}

.vg-figure__placeholder-title {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text);
}

.vg-figure figcaption {
  padding: 0.625rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

.vg-figure figcaption .vg-credit {
  font-style: italic;
}

.vg-figure figcaption em {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
}

/* Right-side figure - full-width on mobile */
.vg-figure--right {
  width: 100%;
  margin: 1rem 0;
}

/* Inline figure - centered in content flow */
.vg-figure--inline {
  max-width: 560px;
}

/* Full-width figure */
.vg-figure--wide {
  max-width: 100%;
}

/* Clear float after register sections */
.register::after {
  content: '';
  display: table;
  clear: both;
}

/* Medium screens: big centered figures */
@media (min-width: 900px) {
  .vg-figure--right {
    width: 480px;
    margin: 1.5rem auto;
  }

  .vg-figure--inline {
    max-width: 640px;
  }
}

/* Wide screens: big figures float into the right margin and stick on scroll */
@media (min-width: 1400px) {
  .vg-figure--right {
    width: 500px;
    float: right;
    clear: right;
    margin: 0 calc(-500px - 2rem) 1rem 1.5rem;
    position: sticky;
    top: 1rem;
  }
}

/* Large screens: even bigger */
@media (min-width: 1800px) {
  .vg-figure--right {
    width: 640px;
    margin: 0 calc(-640px - 2rem) 1rem 1.5rem;
    position: sticky;
    top: 1rem;
  }

  .vg-figure--inline {
    max-width: 800px;
  }
}

/* ========================================
   Lightbox (click-to-expand on images)
   ======================================== */

.vg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: pointer;
}

.vg-lightbox.active {
  display: flex;
}

.vg-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  object-fit: contain;
}

.vg-lightbox__caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #e5e5e5;
  font-size: 0.85rem;
  text-align: center;
  max-width: 80vw;
  background: rgba(0,0,0,0.6);
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.vg-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: #fff;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  line-height: 1;
}

.vg-lightbox__close:hover {
  opacity: 1;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .pedagogy-content,
  .philosophy-content {
    display: block !important;
  }

  .register-content {
    display: block !important;
  }

  .vg-lightbox {
    display: none !important;
  }
}

/* Under Construction Badge */
.wip-badge {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
  background: var(--bg);
  border: 1px solid var(--accent-gold);
  border-radius: 4px;
  z-index: 1000;
  opacity: 0.85;
  pointer-events: none;
}

/* ========================================
   Landing Page - Hero Zone
   ======================================== */

.landing-tagline {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.landing-tagline em {
  font-style: italic;
}

.landing-cta {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--link);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
  margin-bottom: var(--space-md);
}

.landing-cta:hover {
  background: var(--link-hover);
  text-decoration: none;
}

/* ========================================
   Landing Page - Core Framework Grid
   ======================================== */

.framework-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.fw-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: var(--space-md);
  background: #fdfcf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fw-tile:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(196, 154, 46, 0.12);
  text-decoration: none;
}

.fw-tile strong {
  display: block;
  color: var(--link);
  margin-bottom: 0.15rem;
}

.fw-tile span {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.fw-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  margin-top: 2px;
}

.fw-badge--gold     { background: #c49a2e; }
.fw-badge--green    { background: #2d6a4f; }
.fw-badge--navy     { background: #1e3a5f; }
.fw-badge--burgundy { background: #7c3043; }

@media (max-width: 560px) {
  .framework-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Landing Page - Explore Grid
   ======================================== */

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.explore-card {
  background: #fdfcf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.explore-card:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
  text-decoration: none;
}

.explore-card h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--text-base);
  color: var(--link);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explore-card p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.explore-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(196, 154, 46, 0.1);
  padding: 0.1em 0.5em;
  border-radius: 10px;
  white-space: nowrap;
}

/* ========================================
   Landing Page - Philosophy Blocks
   ======================================== */

.philosophy-blocks {
  margin: var(--space-lg) 0;
}

.phil-block {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.phil-block:last-child {
  border-bottom: none;
}

.phil-block strong {
  display: block;
  margin-bottom: 0.2rem;
}

.phil-block span {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========================================
   Landing Page - Register Guide
   ======================================== */

.register-guide {
  margin: var(--space-lg) 0;
}

.register-guide-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: var(--space-sm) 0;
}

.register-guide-row + .register-guide-row {
  border-top: 1px solid var(--border);
}

.register-guide-row strong {
  display: block;
  margin-bottom: 0.1rem;
}

.register-guide-row span {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.register-swatch {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  margin-top: 2px;
}

.register-swatch--practice {
  background: #2d6a4f;
}

.register-swatch--craft {
  background: #1e3a5f;
}

.register-swatch--theory {
  background: #7c3043;
}

/* ========================================
   Prev / Next Page Navigation
   ======================================== */

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.page-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  background: #fdfcf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 48%;
}

.page-nav-btn:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(196, 154, 46, 0.12);
  text-decoration: none;
}

.page-nav-btn--next {
  margin-left: auto;
  text-align: right;
}

.page-nav-dir {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.page-nav-title {
  font-weight: 600;
  color: var(--link);
}

@media (max-width: 560px) {
  .page-nav {
    flex-direction: column;
  }

  .page-nav-btn {
    max-width: 100%;
  }
}

/* ========================================
   Continue Reading Bookmark Banner
   ======================================== */

.continue-reading {
  display: inline-block;
  margin-left: var(--space-md);
  padding: 0.5rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.continue-reading:hover {
  border-color: var(--accent-gold);
  color: var(--text);
  text-decoration: none;
}

.continue-reading strong {
  color: var(--link);
}

@media (max-width: 560px) {
  .continue-reading {
    display: block;
    margin-left: 0;
    margin-top: var(--space-sm);
  }
}

/* ========================================
   Accessibility
   ======================================== */

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: var(--space-md) var(--space-xl);
  background: var(--link);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  top: 0;
}

/* Focus indicators for keyboard navigation */
:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Search box focus-visible override */
.search-box:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: 2px;
  border-color: var(--link);
  box-shadow: none;
}

/* Lightbox focus styles */
.vg-lightbox__close:focus-visible {
  outline-color: #fff;
}

/* Code copy button focus */
.code-copy-btn:focus-visible {
  outline-color: #8fb1ff;
}

/* Register header keyboard focus */
.register-header:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: -3px;
}

/* Nav section title keyboard focus */
.nav-section-title:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: 2px;
}

/* Search results keyboard navigation */
.search-result-item.focused {
  background: var(--bg-alt);
  outline: 2px solid var(--accent-gold);
  outline-offset: -2px;
}

/* ARIA live region for search announcements */
.search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }

  .sidebar {
    transition: none;
  }

  .nav-section .nav-list {
    transition: none;
  }

  .nav-section-title::after {
    transition: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: more) {
  :root {
    --text-muted: #3a3a3a;
    --border: #888;
  }

  .register {
    border-width: 3px;
  }

  .section-card,
  .fw-tile,
  .explore-card,
  .page-nav-btn {
    border-width: 2px;
  }

  a {
    text-decoration: underline;
  }

  .nav-link,
  .site-title,
  .nav-home,
  .section-card,
  .fw-tile,
  .explore-card,
  .landing-cta,
  .page-nav-btn {
    text-decoration: none;
  }

  .term {
    text-decoration-thickness: 2px;
  }
}
