/* AlignED Paper Site — Unified Stylesheet
 * Warm parchment palette inspired by claude.ai and Financial Times.
 * Inter headings + Georgia body text. Academic paper layout.
 */

/* ── Custom Properties ── */
:root {
  --background: #F4F1EB;
  --surface: #FEFDFB;
  --text: #2D3748;
  --text-muted: #6B7280;
  --primary: #3B6B9A;
  --secondary: #7096B8;
  --accent: #B67D5C;
  --border: #E8E4DF;
  --dark-header: #1A2B3C;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: Georgia, 'Times New Roman', Times, ui-serif, serif;
  --font-mono: Consolas, Monaco, 'Courier New', monospace;

  --max-width: 960px;
  --wide-width: 1100px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.7;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--primary);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.625rem; margin-top: 2.5rem; }
h3 { font-size: 1.25rem; margin-top: 2rem; }
h4 { font-size: 1.1rem; }

p {
  margin-bottom: 1rem;
}

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

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

strong {
  font-weight: 600;
}

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

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 1.5rem 0;
}

/* ── Layout ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Wider container for charts and tables that need more room */
.container-wide {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Header / Navigation ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  max-width: var(--wide-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
  color: var(--primary);
}

nav {
  display: flex;
  gap: 1.75rem;
}

nav a {
  font-family: var(--font-sans);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

nav a:hover,
nav a.active {
  color: var(--primary);
  text-decoration: none;
  border-bottom-color: var(--primary);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: 0.3s;
}

/* ── Page Header ── */
.page-header {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  font-family: var(--font-serif);
  color: var(--text-muted);
  font-size: 1.15rem;
  font-style: italic;
}

/* ── Sections ── */
section {
  padding: 3rem 0;
}

.content-section {
  padding: 3rem 0;
}

/* ── Prose Content ── */
.prose {
  max-width: var(--max-width);
}

.prose h2 {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.prose h2:first-child,
.prose > :first-child + h2 {
  border-top: none;
  padding-top: 0;
}

.prose h3 {
  margin-top: 2rem;
  color: var(--text);
}

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

/* ── Section Numbering (CSS counters) ── */
body {
  counter-reset: section-counter;
}

/* Numbered headings — add class 'numbered' to h2 elements that should be auto-numbered */
h2.numbered::before {
  counter-increment: section-counter;
  content: counter(section-counter) ". ";
}

/* ── Cover / Abstract Page ── */
.cover-title {
  text-align: center;
  padding: 5rem 0 2rem;
}

.cover-title h1 {
  font-size: 2.5rem;
  max-width: 700px;
  margin: 0 auto 1rem;
  line-height: 1.2;
}

.cover-title .authors {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.cover-title .date {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.abstract {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.abstract h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.abstract p {
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ── Metric Cards ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.metric-value {
  font-family: var(--font-sans);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.metric-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Navigation Cards (for Abstract page) ── */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  display: block;
}

.nav-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(59,107,154,0.1);
  text-decoration: none;
}

.nav-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.nav-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ── In-page Jump Links ── */
.jump-links {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.jump-links h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.jump-links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.jump-links li {
  margin-bottom: 0;
}

.jump-links a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── Charts ── */
.chart-section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.chart-header {
  margin-bottom: 1rem;
}

.chart-title {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.chart-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--surface);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
}

/* Provider Legend */
.provider-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Section Divider (for Results sub-groups) ── */
.section-divider {
  padding: 2.5rem 0 0.5rem;
  border-top: 3px solid var(--primary);
  margin-top: 1rem;
}

.section-divider h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.section-divider p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

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

th {
  font-family: var(--font-sans);
  background: var(--background);
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

tr:hover td {
  background: var(--background);
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ── Grid ── */
.grid {
  display: grid;
  gap: 1.5rem;
}

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

/* ── Buttons ── */
.btn {
  font-family: var(--font-sans);
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #2d5577;
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.btn-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Citation Block ── */
.citation {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  line-height: 1.6;
}

/* ── Note / Callout ── */
.note {
  background: #F0EDE7;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}

.note strong {
  color: var(--primary);
}

/* ── Pilot Badge ── */
.pilot-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── Collapsible Sections ── */
details {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1rem 0;
  background: var(--surface);
}

details summary {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  color: var(--primary);
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.7rem;
  transition: transform 0.2s;
}

details[open] summary::before {
  transform: rotate(90deg);
}

details .details-content {
  padding: 0 1.25rem 1rem;
}

/* ── Blockquotes ── */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.5rem 1.5rem;
  color: var(--text);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ── Footer ── */
footer {
  background: var(--dark-header);
  color: white;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

footer .container {
  max-width: var(--wide-width);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  flex: 1;
  min-width: 200px;
}

.footer-brand p {
  font-family: var(--font-sans);
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.footer-links {
  min-width: 140px;
}

.footer-links h4 {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.5);
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: white;
}

.copyright {
  font-family: var(--font-sans);
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
}

/* ── Utility Classes ── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .nav-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .cover-title h1 { font-size: 2rem; }
  .cover-title { padding: 3rem 0 1.5rem; }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 0;
    border-bottom: 1px solid var(--border);
  }

  nav.active {
    display: flex;
  }

  nav a {
    padding: 0.75rem 0;
    border-bottom: none;
  }

  .nav-toggle {
    display: block;
  }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-cards { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-content { flex-direction: column; }

  table {
    display: block;
    overflow-x: auto;
  }

  .chart-container { height: 280px; }

  .jump-links ul {
    flex-direction: column;
    gap: 0.25rem;
  }

  .provider-legend {
    gap: 0.75rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .container, .container-wide { padding: 0 1rem; }
  h1 { font-size: 1.75rem; }
  .cover-title { padding: 2rem 0 1rem; }
  .cover-title h1 { font-size: 1.75rem; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Reading Guide ── */
.reading-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.reading-guide h3 {
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

/* ── Dumbbell Chart (pure HTML/CSS) ── */

/* Legend row above the chart */
.dumbbell-legend {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
}

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

.dumbbell-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dumbbell-legend-line {
  display: inline-block;
  width: 20px;
  height: 3px;
  background: #C0BDB7;
  border-radius: 2px;
}

.dumbbell-legend-highlight {
  display: inline-block;
  width: 16px;
  height: 12px;
  background: rgba(254, 243, 199, 0.7);
  border: 1px solid #E8E4DF;
}

/* Chart wrapper */
.dumbbell-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem 0.75rem;
}

/* Model group header (e.g. "Claude Opus 4.6") */
.dumbbell-group-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0 0.15rem;
}

/* Separator line between model groups */
.dumbbell-separator {
  border-top: 1px solid var(--border);
  margin: 0.5rem 0 0.25rem;
}

/* Each data row: label | track | values */
.dumbbell-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  align-items: center;
  padding: 0.45rem 0;
  gap: 0.75rem;
  border-radius: 4px;
}

/* Highlighted Condition B rows */
.dumbbell-row-highlight {
  background: rgba(254, 243, 199, 0.5);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Row label (condition name) */
.dumbbell-label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* The track area where dots and connector live */
.dumbbell-track {
  position: relative;
  height: 24px;
  /* Inset the usable area so dots don't get clipped at 0% and 100% */
  margin: 0 8px;
}

/* Faint vertical gridlines at 0, 1, 2 */
.dumbbell-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(0, 0, 0, 0.06);
}

/* Connecting line between the two dots */
.dumbbell-connector {
  position: absolute;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: #C0BDB7;
  border-radius: 2px;
}

/* Dots */
.dumbbell-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: -7px;
  margin-left: -7px;
  z-index: 2;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.dumbbell-dot-output {
  background: #3B6B9A;
}

.dumbbell-dot-trace {
  background: #B67D5C;
}

/* Numeric values column (output / trace) */
.dumbbell-values {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.dumbbell-values .val-output {
  color: #3B6B9A;
  font-weight: 600;
}

.dumbbell-values .val-trace {
  color: #B67D5C;
  font-weight: 600;
}

/* Axis header row (score tick labels) */
.dumbbell-axis-header {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.dumbbell-axis-header .dumbbell-track {
  height: 16px;
}

.dumbbell-axis-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Axis footer label ("Score (0-2)") */
.dumbbell-axis-footer {
  padding-top: 0.15rem;
}

.dumbbell-track-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

/* Responsive: stack labels above tracks on narrow screens */
@media (max-width: 520px) {
  .dumbbell-row {
    grid-template-columns: 1fr 50px;
    grid-template-rows: auto auto;
  }

  .dumbbell-label {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }

  .dumbbell-track {
    grid-column: 1;
  }

  .dumbbell-values {
    grid-column: 2;
  }

  .dumbbell-axis-header {
    grid-template-columns: 1fr;
  }

  .dumbbell-axis-header .dumbbell-label {
    display: none;
  }
}

/* ── Observations list (for Results page) ── */
.observations {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.observations strong {
  font-family: var(--font-sans);
}

.observations ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.observations li {
  margin-bottom: 0.35rem;
}
