/* ============================================
   Engineering Blog - WSJ-Inspired Theme
   Matches main site styling
   ============================================ */

:root {
  /* WSJ-Inspired Color Palette */
  --wsj-tan: #f5f1eb;
  --wsj-cream: #faf8f5;
  --wsj-dark: #1a1a1a;
  --wsj-nav: #352a21;
  --wsj-brown: #6b5b4f;
  --wsj-gold: #c4a35a;
  --wsj-blue: #0274b6;
  --wsj-red: #b71c1c;
  --wsj-green: #2e7d32;
  --wsj-border: #d4c8b8;

  /* Semantic Colors */
  --bg: var(--wsj-tan);
  --bg-elevated: var(--wsj-cream);
  --bg-code: #fefcf9;
  --text: var(--wsj-dark);
  --text-dim: var(--wsj-brown);
  --accent: var(--wsj-blue);
  --success: var(--wsj-green);
  --warning: var(--wsj-gold);
  --error: var(--wsj-red);
  --border: var(--wsj-border);

  /* Shadows */
  --elev-1: 0 1px 3px rgba(107, 91, 79, 0.08),
    0 4px 12px rgba(107, 91, 79, 0.04);

  /* Typography */
  --font-serif: "Libre Baskerville", Georgia, serif;
  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, Segoe UI,
    Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper texture overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.025;
  z-index: 1000;
}

/* ============================================
   Navigation
   ============================================ */
.main-nav {
  background: var(--wsj-nav);
  border-bottom: 1px solid #453931;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-brand-link {
  text-decoration: none;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: white;
  padding: 14px 0;
  margin-right: 32px;
  white-space: nowrap;
}

.nav-sections {
  display: flex;
  align-items: center;
  flex: 1;
}

.nav-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-section-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.7);
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
  border-bottom: 2px solid transparent;
}

.nav-dropdown-trigger:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown-trigger.open {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-trigger svg {
  transition: transform 200ms ease;
  opacity: 0.6;
}

.nav-dropdown-trigger.open svg {
  transform: rotate(180deg);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

.nav-dropdown.open {
  display: block;
}

.nav-dropdown-item {
  display: block;
  padding: 14px 18px;
  text-decoration: none;
  border-bottom: 1px solid #f0ece6;
  transition: background 100ms ease;
}

.nav-dropdown-item:last-child {
  border-bottom: none;
}

.nav-dropdown-item:hover {
  background: var(--wsj-cream);
}

.nav-dropdown-item.active {
  background: var(--wsj-cream);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}

.nav-dropdown-item-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.nav-dropdown-item-desc {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 20px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 150ms ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-color: var(--wsj-gold);
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    padding: 12px 16px;
    gap: 8px;
  }

  .nav-brand {
    margin-right: 0;
    padding: 0;
  }

  .nav-sections {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .nav-section {
    flex-direction: column;
    width: 100%;
    gap: 4px;
  }

  .nav-dropdown-trigger {
    width: 100%;
    justify-content: center;
  }

  .nav-divider {
    width: 100%;
    height: 1px;
    margin: 4px 0;
  }

  .nav-link {
    padding: 10px 14px;
    font-size: 11px;
  }
}

/* Inline code */
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--wsj-cream);
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
}

/* Header */
header {
  background: var(--wsj-cream);
  border-bottom: 3px double var(--wsj-border);
  padding: 48px 24px 40px;
}

.blog-header {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.blog-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--wsj-brown);
  margin-bottom: 16px;
}

.blog-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.blog-subtitle {
  font-family: var(--font-serif);
  font-size: 18px;
  color: #555;
  line-height: 1.6;
}

/* Matching priority list */
ol.matching-priority {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 24px 24px 24px 48px;
  margin: 24px 0;
}

ol.matching-priority li {
  margin-bottom: 12px;
  padding-left: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
}

ol.matching-priority li:last-child {
  margin-bottom: 0;
}

ol.matching-priority strong {
  color: var(--accent);
}

/* Main Content */
.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

/* Article Header */
.article-header {
  text-align: center;
  padding-top: 48px;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.article-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--wsj-brown);
  margin-bottom: 16px;
}

.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 6vw, 44px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
}

.article-subtitle {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--wsj-brown);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  margin: 48px 0 20px;
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}

h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: var(--text);
}

p {
  margin-bottom: 20px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}

em {
  font-style: italic;
}

strong {
  font-weight: 700;
  color: var(--wsj-dark);
}

/* Stats Bar */
.stats-bar {
  margin: 32px 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}

.stats-caption {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin-top: 12px;
}

.stat {
  background: var(--wsj-cream);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Code Blocks */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  margin: 24px 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--wsj-tan);
}

.code-content {
  padding: 16px 20px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}

.code-content pre {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow-x: auto;
}

.code-content code {
  display: block;
  white-space: pre;
  background: transparent;
  padding: 0;
  border: none;
}

/* Code syntax highlighting */
.code-comment {
  color: var(--wsj-brown);
  font-style: italic;
}

.code-new {
  color: var(--wsj-green);
  font-weight: 500;
}

.code-error {
  color: var(--wsj-red);
}

.code-keyword {
  color: var(--wsj-blue);
  font-weight: 500;
}

/* Interactive Demo */
.demo-container {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  margin: 32px 0;
  overflow: hidden;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--wsj-tan);
}

.demo-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.demo-controls {
  display: flex;
  gap: 8px;
}

.demo-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  background: var(--wsj-dark);
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demo-btn:hover {
  background: #333;
}

.demo-btn:active {
  background: #000;
}

.demo-body {
  padding: 20px;
}

.demo-line {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  padding: 12px 16px;
  padding-right: 150px;
  margin-bottom: 8px;
  background: var(--bg);
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.demo-line.highlight-speaker {
  background: rgba(2, 116, 182, 0.1);
  border-left-color: var(--accent);
}

.demo-line.highlight-scan {
  background: var(--wsj-cream);
  border-left-color: var(--text-dim);
}

.demo-line.highlight-state {
  background: rgba(46, 125, 50, 0.1);
  border-left-color: var(--success);
}

.demo-line.highlight-error {
  background: rgba(183, 28, 28, 0.1);
  border-left-color: var(--error);
}

.demo-line .annotation {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  padding: 4px 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.demo-line.highlight-speaker .annotation {
  background: var(--accent);
  color: white;
  opacity: 1;
}

.demo-line.highlight-scan .annotation {
  background: var(--wsj-cream);
  color: var(--text-dim);
  opacity: 1;
}

.demo-line.highlight-state .annotation {
  background: var(--success);
  color: white;
  opacity: 1;
}

.demo-line.highlight-error .annotation {
  background: var(--error);
  color: white;
  opacity: 1;
}

.speaker-name {
  color: var(--accent);
  font-weight: 600;
}
.state-name {
  color: var(--success);
  font-weight: 600;
}
.error-text {
  color: var(--error);
}

/* Progressive Shortening Section */

/* Constraint Cards */
.constraint-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.constraint-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: var(--wsj-cream);
  border: 1px solid var(--border);
}

.constraint-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.constraint-content {
  flex: 1;
}

.constraint-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.constraint-desc {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* Common Phrases */
.common-phrases {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
  padding: 20px;
  background: var(--wsj-cream);
  border: 1px solid var(--border);
}

.phrase-group-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.phrase-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.phrase-list li {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.phrase-list li:last-child {
  border-bottom: none;
}

/* Target/Transcript sentences */
.target-sentence {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  border-left: 3px solid var(--wsj-gold);
}

.transcript-sentence {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  border-left: 3px solid var(--wsj-blue);
  color: var(--text-dim);
}

/* Shortening Attempts */
.shortening-attempts {
  margin: 20px 0;
  border: 1px solid var(--border);
  background: var(--bg);
}

.attempt-row {
  display: grid;
  grid-template-columns: 32px 1fr 120px;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.attempt-row:last-child {
  border-bottom: none;
}

.attempt-row.dim {
  opacity: 0.5;
}

.attempt-row.final {
  background: var(--wsj-cream);
}

.attempt-num {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.attempt-query {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attempt-result {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.attempt-result.fail {
  color: var(--wsj-red);
}

.attempt-result.success {
  color: var(--wsj-green);
}

.attempt-result.escalate {
  color: var(--wsj-blue);
}

/* h3 and h4 styling */
h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 16px;
}

h4 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 28px 0 12px;
}

/* Progressive Shortening Animated Demos */
.shorten-demo-body {
  padding: 0;
}

.shorten-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  border-bottom: 1px solid var(--border);
}

.shorten-row:last-child {
  border-bottom: none;
}

.shorten-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 16px;
  background: var(--wsj-tan);
  border-right: 1px solid var(--border);
}

.shorten-content {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 14px 16px;
  background: var(--bg);
}

.shorten-content.transcript-text {
  /* Text color controlled by child spans */
}

.shorten-content .ts {
  font-size: 10px;
  color: var(--wsj-blue);
  margin-left: 8px;
}

.search-attempt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  opacity: 0.4;
  transition: all 0.3s ease;
}

.search-attempt:last-child {
  border-bottom: none;
}

.search-attempt.active {
  opacity: 1;
  background: rgba(196, 163, 90, 0.1);
  margin: 0 -16px;
  padding: 8px 16px;
}

.search-attempt.done {
  opacity: 1;
}

.search-attempt.dim {
  opacity: 0.5;
  font-style: italic;
}

.search-attempt .attempt-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px;
}

.search-attempt .attempt-result {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
}

.search-attempt .attempt-result.fail {
  color: var(--wsj-red);
}

.search-attempt .attempt-result.success {
  color: var(--wsj-green);
}

/* Single-line animated search */
.search-line-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-query {
  flex: 1;
  transition: all 0.3s ease;
}

.search-query .word {
  display: inline;
}

.search-query .word-deleting {
  display: inline;
  color: var(--error);
  border: 2px solid var(--error);
  border-radius: 3px;
  padding: 0 4px;
  margin: 0 2px;
  background: rgba(211, 47, 47, 0.1);
  animation: pulse-red 0.5s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.search-query.matched {
  color: var(--wsj-green);
  font-weight: 500;
}

/* Transcript styling - text vs timestamps */
.transcript-format {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.8;
}

.transcript-words {
  color: var(--text);
  transition: all 0.5s ease;
}

.transcript-words .matched-portion {
  background: rgba(46, 125, 50, 0.2);
  border: 2px solid var(--wsj-green);
  border-radius: 4px;
  padding: 2px 6px;
  display: inline;
}

.transcript-ts {
  color: #9a8b7a;
  font-size: 0.85em;
  opacity: 0.8;
}

.ts-value {
  transition: all 0.5s ease;
}

.ts-value.highlight {
  color: var(--wsj-green);
  font-weight: 600;
  background: rgba(46, 125, 50, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulse-green 1s ease-in-out 2;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(46, 125, 50, 0); }
}

/* Fuzzy demo styles */
.fuzzy-scanning {
  background: rgba(255, 193, 7, 0.2);
  border-left: 3px solid var(--wsj-gold);
  transition: all 0.3s ease;
}

.fuzzy-match {
  background: rgba(46, 125, 50, 0.15);
  border-left: 3px solid var(--wsj-green);
  transition: all 0.3s ease;
}

.fuzzy-low-score {
  opacity: 0.5;
  transition: all 0.3s ease;
}

.fuzzy-context {
  background: rgba(2, 116, 182, 0.1);
  border-left: 3px solid var(--wsj-blue);
  transition: all 0.3s ease;
}

.fuzzy-llm-thinking {
  animation: thinking-pulse 1s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.snippet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.snippet-box {
  border: 1px solid var(--wsj-border);
  border-radius: 8px;
  background: #fffdf9;
  padding: 10px 12px;
  min-height: 80px;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.snippet-box.active {
  opacity: 1;
  border-color: var(--wsj-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.snippet-union.active {
  border-color: var(--wsj-green);
  background: rgba(46, 125, 50, 0.06);
}

.snippet-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wsj-brown);
  margin-bottom: 6px;
}

.snippet-body {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--wsj-dark);
}

.search-status {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  min-width: 100px;
  text-align: right;
}

.search-status.fail {
  color: var(--wsj-red);
}

.search-status.success {
  color: var(--wsj-green);
}

.result-row {
  display: none;
}

.result-row.visible {
  display: grid;
}

.result-row .shorten-content {
  font-family: var(--font-sans);
  font-weight: 600;
}

.result-row .shorten-content.success {
  color: var(--wsj-green);
  background: rgba(46, 125, 50, 0.08);
}

.success-check,
.success-value {
  color: var(--wsj-green);
  font-weight: 600;
}

.result-row .shorten-content.fail {
  color: var(--wsj-blue);
  background: rgba(2, 116, 182, 0.08);
}

/* Disambiguation Demo */
.disambig-line {
  background: var(--bg);
  padding: 16px;
  margin-bottom: 12px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.disambig-line.active {
  border-left-color: var(--accent);
  background: rgba(2, 116, 182, 0.08);
}

.disambig-line.matched {
  border-left-color: var(--success);
  background: rgba(46, 125, 50, 0.08);
}

.disambig-text {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.disambig-match {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.disambig-line.matched .disambig-match {
  opacity: 1;
}

.match-arrow {
  color: var(--success);
  font-weight: bold;
}

.match-result {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
}

/* Line Scan Demo */
.line-scan-body {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
}

.scan-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin: 4px 0;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.5;
}

.scan-line .line-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.scan-line .scan-result {
  margin-left: 16px;
  font-size: 12px;
  min-width: 100px;
  text-align: right;
}

.scan-line.scanning {
  opacity: 1;
  background: rgba(2, 116, 182, 0.1);
  border-left-color: var(--accent);
}

.scan-line.scanned {
  opacity: 1;
  background: rgba(2, 116, 182, 0.1);
  border-left-color: var(--accent);
}

.scan-line.speaker-found {
  opacity: 1;
  background: rgba(46, 125, 50, 0.1);
  border-left-color: var(--success);
}

.scan-line.speaker-found .scan-result {
  color: var(--success);
  font-weight: 600;
}

.scan-line.processed {
  opacity: 0.5;
  background: transparent;
  border-left-color: transparent;
}

.scan-line.processed .scan-result {
  color: var(--text-dim);
}

.scan-line:not(.speaker-found):not(.scanned):not(.processed) .scan-result {
  color: var(--text-dim);
}

.scan-output {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.output-section {
  min-height: 100px;
}

.output-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.output-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  min-height: 80px;
  transition: all 0.3s ease;
}

.output-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 116, 182, 0.1);
}

.output-card.saving {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.output-speaker {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
}

.output-text {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.saved-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 12px;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.saved-speaker {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.saved-text {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  display: block;
  white-space: pre-wrap;
}

/* Nickname Demo */
.nickname-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
}

.nickname-step {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px 20px;
  width: 100%;
  max-width: 400px;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.nickname-step.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 116, 182, 0.1);
}

.nickname-step.active.skipped {
  border-color: var(--text-dim);
  box-shadow: none;
  opacity: 0.6;
}

.nickname-step.active.matched {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.nickname-step .step-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.nickname-step .step-content {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.nickname-arrow {
  font-size: 20px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nickname-arrow.visible {
  opacity: 1;
  color: var(--accent);
}

.lookup-key {
  color: var(--accent);
}

.lookup-result {
  margin-left: 16px;
  padding: 4px 8px;
  background: var(--bg);
}

.lookup-result.success {
  background: rgba(46, 125, 50, 0.15);
  color: var(--success);
}

.nickname-highlight {
  background: rgba(2, 116, 182, 0.2);
  padding: 2px 4px;
  color: var(--accent);
}

.step-content.matched {
  color: var(--success);
}

/* Animated Parser */
.parser-animation {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 24px;
  margin: 32px 0;
}

.parser-input {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  padding: 16px;
  background: var(--bg);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.parser-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--accent);
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.parser-output {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.parser-field {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px;
}

.parser-field-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.parser-field-value {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
  min-height: 1.5em;
}

.parser-field-value.success {
  color: var(--success);
}
.parser-field-value.error {
  color: var(--error);
}

/* File Chain Animation */
.file-chain {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 24px;
  margin: 32px 0;
}

.file-chain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.file-chain-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.file-boxes {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 8px;
}

.file-box {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px;
  min-width: 150px;
  flex-shrink: 0;
  transition: all 0.3s;
}

.file-box.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 116, 182, 0.1);
}

.file-name {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.file-speaker {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.file-speaker.inherited {
  color: var(--warning);
}

.file-speaker.detected {
  color: var(--success);
}

.file-arrow {
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.file-chain-legend {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
}

.legend-dot.detected {
  background: var(--success);
}
.legend-dot.inherited {
  background: var(--warning);
}

/* Progress bar for parsing animation */
.parse-progress {
  height: 4px;
  background: var(--border);
  margin-top: 16px;
  overflow: hidden;
}

.parse-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

/* Callout */
.callout {
  background: var(--wsj-cream);
  border-left: 4px solid var(--wsj-gold);
  padding: 20px 24px;
  margin: 32px 0;
}

.callout p {
  margin: 0;
  color: var(--text);
  font-family: var(--font-serif);
}

/* Timestamp identification demos */
.shorten-stack .demo-line {
  margin-bottom: 12px;
}

.algo-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.algo-step {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 14px 18px;
  width: 100%;
  max-width: 520px;
  opacity: 0.45;
  transition: all 0.3s ease;
}

.algo-step.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 116, 182, 0.1);
}

.algo-step.matched {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.algo-step .step-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.algo-step .step-content {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.algo-arrow {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.paper-callout {
  display: block;
  margin: 32px 0;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paper-callout:hover {
  transform: translateY(-2px);
}

.paper-callout-inner {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 24px 28px;
  position: relative;
}

.paper-callout:hover .paper-callout-inner {
  box-shadow: var(--elev-1);
}

.paper-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.paper-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-head);
  margin-bottom: 6px;
}

.paper-meta {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.paper-abstract-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.paper-abstract {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-body);
  margin: 0 0 12px 0;
}

.paper-abstract:last-of-type {
  margin-bottom: 16px;
}

.paper-link {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 28px 0;
}

.comparison-card {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
}

.comparison-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 16px;
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--border);
}

.comparison-row {
  display: flex;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-source {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  flex-shrink: 0;
  width: 70px;
  padding-top: 2px;
}

.comparison-text {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
}

.comparison-text .diff {
  background: rgba(196, 163, 90, 0.25);
  padding: 1px 4px;
  border-radius: 2px;
}

.guardrail-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 12px;
}

.guardrail-item {
  background: var(--wsj-cream);
  border: 1px solid var(--border);
  padding: 16px 18px;
}

.guardrail-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.guardrail-text {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text);
}

/* Footer */
footer {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
  font-size: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
}

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

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Accuracy Chart (Custom CSS Bar Chart)
   ============================================ */

.accuracy-chart-figure {
  margin: 2rem 0;
}

.accuracy-chart {
  padding: 1.5rem;
  background: transparent;
}

.chart-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-family: var(--font-sans);
  font-size: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.legend-color.json {
  background: #e8a99a;
}

.legend-color.text {
  background: #4a9b9b;
}

.chart-container {
  display: flex;
  gap: 0.5rem;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 280px;
  padding-right: 0.5rem;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.chart-bars {
  display: flex;
  flex: 1;
  gap: 0.75rem;
  align-items: flex-end;
  height: 280px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 50px;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: opacity 0.2s;
}

.bar.json {
  background: #e8a99a;
}

.bar.text {
  background: #4a9b9b;
}

.bar-group.best .bar {
  background: #3d8585;
}

.bar::after {
  content: attr(data-value);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.bar-label {
  margin-top: 0.75rem;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
}

.bar-group:hover .bar {
  opacity: 0.85;
}

/* Progression Chart (Horizontal Bars) */

.progression-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}

.progression-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progression-label {
  flex: 0 0 180px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  text-align: right;
}

.progression-bar-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 28px;
}

.progression-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
}

.progression-bar.baseline {
  background: #a8a8a8;
}

.progression-bar.worse {
  background: #e8a99a;
}

.progression-bar.improved {
  background: #7cb8b8;
}

.progression-bar.best {
  background: #3d8585;
}

.progression-value {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.progression-value.negative {
  color: var(--wsj-red);
}

/* Responsive */
@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .parser-output {
    grid-template-columns: 1fr;
  }

  .scan-output {
    grid-template-columns: 1fr;
  }

  header {
    padding: 32px 16px;
  }

  .content {
    padding: 32px 16px 60px;
  }

  h2 {
    font-size: 22px;
    margin: 36px 0 16px;
  }

  h3 {
    font-size: 17px;
  }
}
