:root {
  /* Colors - Apple Liquid Glass Dark Theme */
  --bg-color: #000000;
  --text-primary: #f5f5f7;
  --text-secondary: #86868b;
  --accent-color: #0071e3;
  --accent-glow: rgba(0, 113, 227, 0.4);

  /* Glass Variables */
  --glass-bg: rgba(28, 28, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: 20px;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Code Blocks */
  --code-bg: rgba(0, 0, 0, 0.3);
  --code-border: rgba(255, 255, 255, 0.05);

  /* Spacing */
  --section-gap: 8rem;
  --content-width: 800px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  width: 100%;
  overflow-x: hidden;
  /* Critical for preventing scroll */
}

html {
  width: 100%;
  overflow-x: hidden;
}

/* Abstract Background */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Use right: 0 instead of width: 100vw */
  bottom: 0;
  height: 100vh;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
  filter: blur(100px);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  margin-top: 2.5rem;
}

h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 0;
}

h2 {
  font-size: 2rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
}

p,
li,
td {
  color: #d1d1d6;
  font-size: 1.0625rem;
  margin-bottom: 1.2rem;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Layout */
.container {
  display: grid;
  grid-template-columns: 250px 1fr;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  gap: 3rem;
  position: relative;
  align-items: start;
  /* Critical for sticky sidebar */
  width: 100%;
  box-sizing: border-box;
}

/* Sidebar TOC - Glass Style */
.toc-sidebar {
  /* Width handled by Grid Column */
  position: sticky;
  top: 2rem;
  height: calc(100vh - 4rem);
  overflow-y: auto;

  /* Glassmorphism */
  background: rgba(30, 30, 30, 0.4);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.toc-sidebar h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-top: 0;
  margin-bottom: 1rem;
}

.toc-link {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
  /* For Arrow positioning */
  padding-right: 20px;
  /* Make space for arrow */
}

.toc-link:hover,
.toc-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.toc-link.active {
  border-left: none;
  /* No Border */
  background: rgba(0, 113, 227, 0.15);
}

/* Arrow Logic */
/* Arrow Logic - ONLY for Active state */
.toc-link.active::after {
  content: "←";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-color);
  font-weight: bold;
  animation: slideInArrow 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

/* ... existing keyframes ... */

/* Special Featured Link (Passive State) */
.toc-link.toc-highlight {
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 0.5rem;
  border-left: none;
}

/* Active State for Featured Link */
.toc-link.toc-highlight.active {
  background: rgba(0, 113, 227, 0.15);
}

@keyframes slideInArrow {
  from {
    opacity: 0;
    transform: translate(5px, -50%);
  }

  to {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: var(--content-width);
  min-width: 0;
  /* Prevent flex item from overflowing */
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0 6rem 0;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 4rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-weight: 300;
}

.hero-image {
  margin: 3rem auto 2rem;
  width: 100%;
  max-width: 100%;
  height: 300px;
  /* Fixed height ~50% of original aspect */
  object-fit: cover;
  /* Full Width */
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--glass-border);
  transform: perspective(1000px) rotateY(-5deg);
  transition: transform 0.5s ease;
  box-sizing: border-box;
}

.hero-image:hover {
  transform: perspective(1000px) rotateY(0deg) scale(1.02);
}

/* Author Showcase */
.author-bio {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  /* Increased padding */
  margin: 2rem auto 4rem;
  width: 100%;
  /* Full Width */
  backdrop-filter: blur(10px);
  text-align: center;
}

.author-bio p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.author-bio strong {
  color: var(--text-primary);
  font-weight: 600;
}

.role-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}

.role-container span {
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-right: 1px solid var(--glass-border);
  padding-right: 0.75rem;
  height: 1.2rem;
  line-height: 1.2rem;
}

.company-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.company-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: all 0.2s ease;
  filter: grayscale(100%) brightness(2.5);
  /* Bright Silver for visibility */
}

/* Handle both SVG and IMG */
.company-logo img,
.company-logo svg {
  height: 24px;
  width: auto;
  object-fit: contain;
  transition: all 0.2s ease;
}

/* Specific Adjustments */
.company-logo[title="Meta"] img {
  height: 28px;
  /* Larger to match visual weight */
  margin-top: -2px;
}

.company-logo:hover {
  opacity: 1;
  filter: grayscale(0%) brightness(1.2);
  /* Restore color */
  transform: scale(1.1);
}

/* Boost Meta Color Brightness on Hover */
.company-logo[title="Meta"]:hover {
  filter: grayscale(0%) brightness(1.5);
}

.ceo-tag {
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.company-link {
  color: var(--accent-color);
  font-weight: 500;
  text-decoration: none;
}

.company-link:hover {
  text-decoration: underline;
}

.author-mission {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.95rem;
  /* Slightly smaller than body text */
  color: var(--text-secondary);
  line-height: 1.7;
  /* Increased for readability */
  text-align: left;
  /* Better for long text */
}

.author-mission p {
  margin-bottom: 1rem;
}

.author-mission p:last-child {
  margin-bottom: 0;
}

/* Components */
blockquote {
  border-left: 3px solid var(--accent-color);
  padding: 1rem 1.5rem;
  background: rgba(0, 113, 227, 0.1);
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-primary);
}

/* Tables - Liquid Glass */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.4);
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
  box-sizing: border-box;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
  /* Force scroll */
  border: none;
  background: transparent;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Code Blocks */
pre {
  background: rgba(0, 0, 0, 0.95) !important;
  padding: 1.5rem;
  padding-bottom: 3.5rem;
  /* Reserve space for copy button */
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin: 1.5rem 0;
  white-space: pre-wrap;
  /* Wrap text */
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
  color: #fff !important;
  text-align: left !important;
  /* Force Left Alignment */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

pre code {
  background: transparent !important;
  color: inherit !important;
  display: block;
  /* Ensure it behaves as a block */
  text-align: left !important;
  white-space: pre-wrap !important;
}

code {
  font-family: "SF Mono", Monaco, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: #ff9f0a;
  /* Default to generic code color, syntax highlighting would need JS lib or manual spans */
}

/* Inline code */
p code,
li code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: #ff9f0a;
}

/* Images in content */
.content-image-container {
  margin: 2rem 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.content-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  box-sizing: border-box;
}

.hero-crop {
  height: 300px !important;
  object-fit: cover;
}

.image-caption {
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--glass-border);
}

/* Analogy Cards */
.analogy-card {
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 4px 20px rgba(255, 159, 10, 0.1);
  transition: transform 0.2s ease;
}

.analogy-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 159, 10, 0.15);
}

.analogy-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.analogy-content strong {
  display: block;
  color: #ff9f0a;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analogy-content p {
  color: var(--text-primary);
  margin-bottom: 0;
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 900px) {
  .container {
    display: flex;
    flex-direction: column;
    padding: 1rem;
  }

  .toc-sidebar {
    width: 100%;
    height: auto;
    max-height: 200px;
    position: relative;
    top: 0;
  }

  h1 {
    font-size: 2.5rem;
  }
}

/* Tab Interface */
.tab-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  padding: 0.5rem;
  background: rgba(44, 44, 46, 0.4);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.tab-button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.8rem 1.5rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.tab-button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Motion Lab */
.motion-lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.motion-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.motion-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

.motion-card h4 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.motion-card p code {
  font-size: 0.75rem;
  white-space: pre-wrap;
  /* Allow wrapping if needed */
  display: inline-block;
  text-align: center !important;
  color: var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

.badg {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  color: var(--text-secondary);
}

/* 1. Apple Smooth */
.smooth-vibe:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.08);
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.3s ease;
}

/* 2. Spring Pop */
.spring-vibe:hover {
  animation: springPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  background: rgba(255, 255, 255, 0.08);
}

@keyframes springPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1.05);
  }
}

/* 3. Glass Fade */
.glass-vibe .motion-icon {
  transition: all 0.5s ease;
}

.toc-link.toc-highlight {
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 0.5rem;
  border-left: none;
  /* Remove Border */
}

/* Reveal on Scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: blur(10px);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Stagger delays for children */
.reveal-stagger>*:nth-child(1) {
  transition-delay: 0.1s;
}

/* Prompt Dojo (Interactive Game) */
.dojo-container {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.dojo-header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

.dojo-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.dojo-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dojo-btn {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.dojo-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: var(--accent-color);
}

.dojo-btn strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.dojo-result {
  background: #000;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.dojo-result-content {
  width: 100%;
  padding: 1rem;
  text-align: center;
}

/* Configurator Styles */
.config-container {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  padding-top: 2rem;
  margin-top: 2rem;
  position: relative;
}

.config-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.config-group h4 {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.checkbox-label input {
  accent-color: var(--accent-color);
}

.config-help {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 1.8rem;
  margin-top: -0.25rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

/* Context Inputs */
.config-context {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-field label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-input,
.config-textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.8rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.config-input:focus,
.config-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
}

.config-textarea {
  font-family: inherit;
  /* Ensure font matches */
  min-height: 80px;
  resize: vertical;
}

.full-width {
  grid-column: 1 / -1;
}

/* Usage Guide */
.usage-guide {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
}

.usage-guide summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-primary);
  list-style: none;
  /* Hide default triangle */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.usage-guide summary::after {
  content: "▼";
  font-size: 0.7rem;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.usage-guide[open] summary::after {
  transform: rotate(180deg);
}

.usage-content {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--glass-border);
}

.usage-content ol {
  margin-left: 1.5rem;
  margin-top: 1rem;
}

.usage-content li {
  margin-bottom: 0.5rem;
}

.copy-btn {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(30, 30, 30, 0.9);
  /* More solid background */
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: #34c759;
  border-color: #34c759;
  color: #fff;
}

.reveal-stagger>*:nth-child(2) {
  transition-delay: 0.2s;
}

.reveal-stagger>*:nth-child(3) {
  transition-delay: 0.3s;
}

.reveal-stagger>*:nth-child(4) {
  transition-delay: 0.4s;
}

.glass-vibe:hover {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.glass-vibe:hover .motion-icon {
  opacity: 0.5;
  filter: blur(2px);
  transform: scale(0.9);
}

/* 4. Punch Click */
.punch-vibe:active {
  transform: scale(0.92);
  background: rgba(255, 59, 48, 0.1);
  transition: transform 0.1s cubic-bezier(0, 0, 0.2, 1);
}

/* --- TABLET (LANDSCAPE) & COMPACT LAPTOP (768px - 1100px) --- */
@media (min-width: 768px) and (max-width: 1100px) {
  .container {
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 100%;
  }

  /* Sidebar width handled by grid */

  /* Ensure code blocks don't overflow */
  pre {
    max-width: calc(100vw - 280px);
    /* 200px sidebar + gaps */
  }
}

/* Contact Button */
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.contact-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- MOBILE MENU UTILS --- */
.menu-toggle {
  display: none;
  /* Hidden on desktop */
}

/* --- MOBILE & TABLET PORTRAIT (< 768px) --- */
@media (max-width: 767px) {

  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  .container {
    display: flex;
    /* Revert to flex for mobile stack */
    flex-direction: column;
    padding: 1rem 24px;
    /* Increased side padding */
    gap: 2rem;
    padding-top: 5rem;
    /* More top space for menu button */
    width: 100%;
    max-width: 100%;
    /* Ensure container takes full width but padding constrains content */
    box-sizing: border-box;
    /* Critical for padding to not overflow width */
    align-items: stretch;
    /* Ensure content stretches to full width */
    overflow-x: hidden;
  }

  .main-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Prevent overflow for most elements, but allow tables to scroll */
  img,
  video,
  iframe,
  pre,
  code,
  blockquote,
  .analogy-card,
  .author-bio,
  .hero-image,
  .content-image-container {
    max-width: 100%;
    box-sizing: border-box;
  }

  img,
  video {
    height: auto;
  }

  /* Ensure table-wrapper can scroll horizontally */
  .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
  }

  /* 1. The Toggle Button */
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: #fff;
    font-size: 1.5rem;
    z-index: 2000;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
  }

  .menu-toggle:active {
    transform: scale(0.9);
  }

  /* 2. The Glass Drawer (Sidebar) */
  .toc-sidebar {
    position: fixed;
    inset: 0;
    /* Full screen */
    width: 100%;
    height: 100vh;
    max-height: none;
    /* Override previous */
    margin: 0;
    border-radius: 0;

    /* Animation State */
    transform: translateX(-100%);
    /* Hidden Left */
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;

    /* Super Glass */
    background: rgba(10, 10, 10, 0.95);
    /* Darker for legibility */
    backdrop-filter: blur(20px);
    z-index: 1000;

    padding: 5rem 2rem 2rem 2rem;
    /* Top padding for close button space */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center content */
  }

  .toc-sidebar.active {
    transform: translateX(0);
    opacity: 1;
  }

  /* Larger links for touch targets */
  .toc-link {
    font-size: 1.2rem;
    padding: 1rem;
    text-align: center;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Main Content Adjustments */
  .content-wrapper {
    width: 100%;
    padding: 0;
  }

  h1 {
    font-size: 2.2rem;
  }

  /* Stack Configurator */
  .config-options {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* Fixed App Layout for Desktop */
@media (min-width: 900px) {

  html,
  body {
    height: 100%;
    overflow: hidden;
    /* Lock window scroll */
  }

  .container {
    height: 100vh;
    align-items: stretch;
    /* Columns fill height */
    padding-bottom: 0;
    /* Remove bottom padding so scroll goes to bottom */
    overflow: hidden;
  }

  .toc-sidebar {
    position: relative;
    /* Sticky not needed in fixed layout */
    top: 0;
    height: calc(100vh - 4rem);
    /* Fit within top padding */
    margin-bottom: 0;
    overflow-y: auto;
    /* Internal scroll */
  }

  .main-content {
    height: calc(100vh - 4rem);
    /* Fit within top padding */
    overflow-y: auto;
    /* Independent scroll */
    padding-right: 1rem;
    scroll-behavior: smooth;
  }
}