/* Claude Theme Colors */
:root {
  --claude-coral: #D97757;
  --claude-coral-dark: #C4684A;
  --claude-coral-light: #F0D5C9;
  --claude-cream: #FAF7F2;
  --claude-surface: #FFFFFF;
  --claude-text: #1C1917;
  --claude-text-secondary: #57534E;
  --claude-border: #E7E5E4;
  --claude-code-bg: #292524;
  --claude-blue: #3B82F6;
  --claude-green: #22C55E;
  --claude-purple: #8B5CF6;
  --claude-amber: #F59E0B;
  --claude-red: #EF4444;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--claude-cream);
  color: var(--claude-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--claude-cream); }
::-webkit-scrollbar-thumb { background: var(--claude-coral-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--claude-coral); }

/* Navigation */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(250, 247, 242, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--claude-border);
  padding: 0.75rem 2rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-logo {
  font-weight: 700; font-size: 1.1rem; color: var(--claude-coral);
  display: flex; align-items: center; gap: 0.5rem;
  white-space: nowrap;
}
.nav-logo svg { width: 24px; height: 24px; }
.nav-steps {
  display: flex; gap: 0.25rem; overflow-x: auto;
  scrollbar-width: none;
}
.nav-steps::-webkit-scrollbar { display: none; }
.nav-step {
  padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.75rem;
  font-weight: 500; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--claude-border); background: var(--claude-surface);
  color: var(--claude-text-secondary); transition: all 0.3s;
}
.nav-step:hover, .nav-step.active {
  background: var(--claude-coral); color: white; border-color: var(--claude-coral);
}

/* Hero */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 6rem 2rem 4rem; position: relative;
  background: linear-gradient(180deg, #FDF8F4 0%, var(--claude-cream) 100%);
}
.hero::before {
  content: ''; position: absolute; inset: 0; opacity: 0.03;
  background-image: radial-gradient(var(--claude-coral) 1px, transparent 1px);
  background-size: 30px 30px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800;
  line-height: 1.15; max-width: 800px; position: relative;
}
.hero h1 span { color: var(--claude-coral); }
.hero .subtitle {
  font-size: 1.15rem; color: var(--claude-text-secondary);
  max-width: 600px; margin-top: 1.25rem; position: relative;
}
.hero .dataset-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--claude-surface); border: 1px solid var(--claude-border);
  border-radius: 999px; padding: 0.5rem 1.25rem; margin-top: 2rem;
  font-size: 0.85rem; font-weight: 500; position: relative;
}
.hero .dataset-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--claude-green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero .scroll-hint {
  position: absolute; bottom: 2rem;
  animation: bounce 2s infinite;
  color: var(--claude-text-secondary); font-size: 0.8rem;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* Sections */
.section {
  max-width: 1100px; margin: 0 auto;
  padding: 5rem 2rem;
}
.section-header {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 2.5rem;
}
.step-number {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--claude-coral), var(--claude-coral-dark));
  color: white; font-weight: 800; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
}
.section-header h2 {
  font-size: 1.75rem; font-weight: 700; line-height: 1.3;
}
.section-header p {
  font-size: 0.95rem; color: var(--claude-text-secondary); margin-top: 0.25rem;
}

/* Cards */
.card {
  background: var(--claude-surface); border: 1px solid var(--claude-border);
  border-radius: 16px; padding: 1.75rem; margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-title {
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--claude-coral); margin-bottom: 1rem;
}

/* Data table */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.data-table th {
  text-align: left; padding: 0.75rem 1rem;
  background: var(--claude-cream); font-weight: 600;
  border-bottom: 2px solid var(--claude-border);
  color: var(--claude-text-secondary); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table td {
  padding: 0.6rem 1rem; border-bottom: 1px solid var(--claude-border);
}
.data-table tr:hover td { background: #FEFCF9; }

/* Highlighted changed cell */
.highlight-changed {
  background: #FEF3C7 !important;
  font-weight: 600;
}

/* Action chunk table */
.action-chunk-table td {
  padding: 0.4rem 0.75rem;
}
.table-scroll {
  overflow-x: auto;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

/* Code blocks */
.code-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; padding: 0.75rem 1rem; margin-top: 1rem;
  background: var(--claude-code-bg); color: #A8A29E;
  border-radius: 10px 10px 0 0; font-size: 0.8rem; font-weight: 500;
  border: none; width: 100%;
}
.code-toggle.collapsed { border-radius: 10px; }
.code-toggle .arrow { transition: transform 0.3s; font-size: 0.7rem; }
.code-toggle.collapsed .arrow { transform: rotate(-90deg); }
.code-block {
  background: var(--claude-code-bg); color: #E7E5E4;
  padding: 1.25rem; border-radius: 0 0 10px 10px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem; line-height: 1.7;
  overflow-x: auto; display: none;
}
.code-block.visible { display: block; }
.code-block .kw { color: #F97316; }
.code-block .fn { color: #60A5FA; }
.code-block .str { color: #34D399; }
.code-block .cm { color: #6B7280; }
.code-block .num { color: #C084FC; }

/* Charts */
.chart-container {
  position: relative; width: 100%; margin: 1rem 0;
}
.chart-container canvas { max-height: 350px; }

/* Pipeline diagram */
.pipeline {
  display: flex; flex-direction: column; gap: 0.5rem;
  align-items: center; padding: 1.5rem 0;
}
.pipeline-row {
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap; justify-content: center;
}
.pipe-box {
  padding: 0.6rem 1.25rem; border-radius: 10px; font-size: 0.8rem;
  font-weight: 600; text-align: center; min-width: 100px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.pipe-box:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pipe-input { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.pipe-process { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.pipe-encoder { background: #FCE7F3; color: #9D174D; border: 1px solid #F9A8D4; }
.pipe-output { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.pipe-loss { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.pipe-arrow {
  color: var(--claude-text-secondary); font-size: 1.25rem; font-weight: 300;
}
.pipe-arrow-down {
  color: var(--claude-text-secondary); font-size: 1.5rem;
}

/* Observation frames */
.frames-display {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
.frame-card {
  background: var(--claude-cream); border-radius: 12px;
  overflow: hidden; border: 2px solid var(--claude-border);
  transition: border-color 0.3s;
}
.frame-card.active { border-color: var(--claude-coral); }
.frame-card canvas {
  width: 100%; height: auto; display: block;
  background: #1a1a2e; aspect-ratio: 640 / 480;
}
.frame-info {
  padding: 0.75rem 1rem; font-size: 0.8rem;
  display: flex; justify-content: space-between;
}

/* Slider */
.slider-container { margin: 1.5rem 0; }
.slider-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem;
}
.slider-value {
  background: var(--claude-coral); color: white;
  padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem;
}
input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 6px;
  border-radius: 3px; background: var(--claude-border); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--claude-coral);
  cursor: pointer; border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Math */
.math-block {
  background: var(--claude-surface); border: 1px solid var(--claude-border);
  border-radius: 10px; padding: 1.25rem; text-align: center;
  margin: 1rem 0; overflow-x: auto;
}

/* Noise viz */
.noise-comparison {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}

/* ============ NEW STYLES ============ */

/* Step note / insight note */
.step-note {
  font-size: 0.85rem; color: var(--claude-text-secondary);
  margin-top: 1rem; padding: 1rem 1.25rem;
  background: var(--claude-cream); border-radius: 10px;
  border-left: 3px solid var(--claude-coral);
}
.insight-note {
  font-size: 0.85rem; color: var(--claude-text-secondary);
  margin-top: 1rem; padding: 1rem 1.25rem;
  background: #F0F9FF; border-radius: 10px;
  border-left: 3px solid var(--claude-blue);
  line-height: 1.7;
}

/* Computation box */
.computation-box {
  padding: 1.25rem;
  background: var(--claude-cream);
  border-radius: 12px;
  border: 1px solid var(--claude-border);
  margin: 0.75rem 0;
}
.comp-label {
  font-size: 0.8rem; font-weight: 600;
  color: var(--claude-text-secondary);
  margin-bottom: 0.35rem;
}
.comp-value {
  font-size: 0.9rem; color: var(--claude-text);
  line-height: 1.6;
}
.comp-row {
  display: flex; align-items: baseline; gap: 0.75rem;
  padding: 0.35rem 0;
}
.comp-row .comp-label {
  min-width: 120px; flex-shrink: 0; margin-bottom: 0;
}

/* Monospace box for computations */
.mono-box {
  margin: 1rem 0; padding: 1rem;
  background: var(--claude-cream);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem; line-height: 1.8;
}

/* Layer trace (ResNet, U-Net architecture) */
.layer-trace {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.25rem;
  padding: 1rem 0;
}
.layer-trace.compact {
  gap: 0.15rem;
}
.layer-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) 120px 1fr;
  gap: 1rem; width: 100%; max-width: 800px;
  padding: 0.6rem 1rem; border-radius: 8px;
  background: var(--claude-surface);
  border: 1px solid var(--claude-border);
  align-items: center;
}
.layer-row.highlight-layer {
  background: #FFF7ED;
  border-color: var(--claude-coral-light);
}
.layer-op {
  font-size: 0.8rem; font-weight: 600;
  color: var(--claude-text); font-family: 'JetBrains Mono', monospace;
}
.layer-shape {
  font-size: 0.8rem; font-weight: 700;
  color: var(--claude-coral);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  background: var(--claude-coral-light);
  padding: 0.2rem 0.5rem; border-radius: 6px;
}
.layer-desc {
  font-size: 0.75rem; color: var(--claude-text-secondary);
}
.layer-arrow {
  text-align: center; color: var(--claude-text-secondary);
  font-size: 1rem; padding: 0.1rem 0;
}

/* U-Net detail sections */
.unet-detail {
  display: flex; flex-direction: column; gap: 1.5rem;
}
.unet-section-title {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--claude-text-secondary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--claude-border);
}

/* Diagram containers */
.diagram-container {
  text-align: center; padding: 1rem 0;
}
.diagram-container img {
  max-width: 100%; height: auto; border-radius: 12px;
  border: 1px solid var(--claude-border);
}
.diagram-fallback {
  padding: 2rem; background: var(--claude-cream); border-radius: 12px;
  border: 2px dashed var(--claude-border); text-align: center;
  font-size: 0.9rem; color: var(--claude-text-secondary);
}

/* Pixel trace grid (Step 4) */
.pixel-trace-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  align-items: start;
}
.pixel-trace-card {
  padding: 0;
}
.pixel-trace-title {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--claude-text-secondary);
  margin-bottom: 0.5rem;
}

/* Video container (dataset overview) */
.video-container {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--claude-border); background: #000;
}
.video-container video {
  width: 100%; display: block; max-height: 360px; object-fit: contain;
}
.video-label {
  position: absolute; top: 0.75rem; left: 0.75rem;
  background: rgba(0,0,0,0.7); color: white;
  padding: 0.25rem 0.75rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
}

/* Stat grid */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem;
}
.stat {
  text-align: center; padding: 1.25rem 0.5rem;
  background: var(--claude-cream); border-radius: 12px;
}
.stat-value {
  font-size: 1.75rem; font-weight: 800; color: var(--claude-coral);
}
.stat-label {
  font-size: 0.75rem; color: var(--claude-text-secondary);
  margin-top: 0.25rem; font-weight: 500;
}

/* Card grid */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem;
}

/* Divider */
.divider {
  height: 1px; background: var(--claude-border); margin: 3rem auto;
  max-width: 200px;
}

/* Footer */
.footer {
  text-align: center; padding: 3rem 2rem;
  color: var(--claude-text-secondary); font-size: 0.8rem;
  border-top: 1px solid var(--claude-border);
}

/* Animations */
.fade-in {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s, transform 0.6s;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 768px) {
  .nav { padding: 0.5rem 1rem; }
  .section { padding: 3rem 1rem; }
  .frames-display { grid-template-columns: 1fr; }
  .noise-comparison { grid-template-columns: 1fr; }
  .pixel-trace-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
  .layer-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .layer-shape { text-align: left; width: fit-content; }
  .comp-row { flex-direction: column; gap: 0.25rem; }
  .comp-row .comp-label { min-width: unset; }
}
