/* Tokens lifted from ~/code/canele-platform/frontend/src/app/globals.css */
:root {
  --background: oklch(0.9745 0.0079 253.8524);
  --foreground: oklch(0.1443 0.0191 261.1564);
  --muted:      oklch(0.4500 0.0200 260.0000);
  --border:     oklch(0.9013 0.0156 257.2001);
  --destructive:oklch(0.5770 0.2450 27.3250);

  --font-sans:  'Nunito', -apple-system, system-ui, sans-serif;
  --font-serif: 'PT Serif', Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Fixed type scale — do not add new sizes. */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 32px;

  --measure: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.2292 0.0304 259.0329);
    --foreground: oklch(0.9392 0.0101 238.5151);
    --muted:      oklch(0.7000 0.0200 240.0000);
    --border:     oklch(0.3299 0.0322 257.6775);
  }
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

main#app {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5.5rem 1.75rem 7rem;
}

.loading { color: var(--muted); font-size: var(--fs-sm); padding: 4rem 0; text-align: center; }

/* Typography */
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.15; font-weight: 700; letter-spacing: -0.005em; }
h1 { font-size: var(--fs-xl); margin: 0 0 0.75rem; letter-spacing: -0.015em; }
h2 {
  font-size: var(--fs-lg);
  margin: 4rem 0 1rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
h3 { font-size: var(--fs-md); margin: 2rem 0 0.5rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--foreground); text-decoration: none; border-bottom: 1px solid var(--border); transition: border-color 120ms ease; }
a:hover { border-bottom-color: var(--foreground); }
code, .mono, .metric {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: "tnum" 1, "zero" 1;
}
small, .meta {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Hero */
.hero .problem {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  line-height: 1.45;
  color: var(--foreground);
  margin: 1.25rem 0 2.5rem;
  max-width: 60ch;
}
.hero .stats {
  display: flex;
  gap: 3.5rem;
  align-items: baseline;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
  margin: 0 0 1rem;
}
.hero .stats .stat small {
  display: block;
  margin-bottom: 0.35rem;
}
.hero .stats .stat .value {
  display: block;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1, "zero" 1;
  font-size: var(--fs-lg);
  font-weight: 400;
  color: var(--foreground);
  letter-spacing: -0.01em;
}

/* DAG — only full-width break-out. Faint dot graticule for canvas texture. */
#dag {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  height: 780px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
  background-image: radial-gradient(
    circle,
    color-mix(in oklch, var(--foreground) 6%, transparent) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
  background-position: 10px 10px;
}

/* DAG zoom hint */
.dag-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
  user-select: none;
  z-index: 10;
  opacity: 0.6;
}

/* DAG tooltip */
.dag-tooltip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-8px);
  background: var(--foreground);
  color: var(--background);
  font-size: var(--fs-xs);
  line-height: 1.45;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  max-width: 280px;
  z-index: 1000;
  transition: opacity 120ms ease;
  font-family: var(--font-sans);
}
.dag-tooltip.visible { opacity: 1; }
.dag-tooltip strong {
  font-family: var(--font-mono);
  font-size: 0.95em;
  display: block;
  margin-bottom: 0.15rem;
}
.dag-tooltip .tip-strategy {
  font-size: 11px;
  opacity: 0.85;
}
.dag-tooltip .tip-metric {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
}
.dag-tooltip .tip-parents {
  font-size: 10px;
  opacity: 0.6;
}

/* Progress chart */
.progress-charts {
  margin: 1rem 0 2rem;
}
.progress-charts .chart-wrap {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  height: 340px;
  position: relative;
}

/* Leaderboard */
table.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin: 1.25rem 0 2.5rem;
}
table.leaderboard th,
table.leaderboard td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}
table.leaderboard thead th {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--foreground);
  padding-bottom: 0.5rem;
}
table.leaderboard td:first-child {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--foreground);
  width: 10em;
}
table.leaderboard td.metric {
  text-align: right;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1, "zero" 1;
  font-size: 0.92em;
  width: 7em;
}
table.leaderboard tr.dead-end td { opacity: 0.38; }
table.leaderboard tr.winner td { font-weight: 600; }
table.leaderboard tr.winner td:first-child::before {
  content: "★";
  color: var(--destructive);
  margin-right: 0.4em;
  display: inline-block;
}
table.leaderboard tbody tr { cursor: pointer; transition: background-color 80ms ease; }
table.leaderboard tbody tr:hover td {
  background: color-mix(in oklch, var(--foreground) 4%, transparent);
}

/* Timeline — changelog/update-log style */
.timeline-log {
  margin: 1.25rem 0 2.5rem;
}
.tl-entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.tl-entry:first-child { padding-top: 0; }
.tl-entry:last-child { border-bottom: none; }
.tl-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tl-date {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  font-feature-settings: "tnum" 1;
}
.tl-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tl-tag-result { color: var(--foreground); border-color: var(--foreground); opacity: 0.7; }
.tl-tag-milestone { color: var(--foreground); border-color: var(--foreground); font-weight: 600; }
.tl-tag-debate { opacity: 0.6; }
.tl-body {
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.tl-body p { margin: 0.4rem 0; }
.tl-body h1, .tl-body h2, .tl-body h3, .tl-body h4 {
  font-size: var(--fs-sm);
  font-weight: 700;
  font-family: var(--font-sans);
  margin: 0.75rem 0 0.35rem;
  line-height: 1.3;
}
.tl-body table {
  border-collapse: collapse;
  font-size: var(--fs-xs);
  margin: 0.5rem 0;
  width: 100%;
}
.tl-body th, .tl-body td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: left;
}
.tl-body th { font-weight: 600; }
.tl-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: color-mix(in oklch, var(--foreground) 6%, transparent);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
.tl-body pre {
  background: color-mix(in oklch, var(--foreground) 5%, transparent);
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: var(--fs-xs);
  margin: 0.5rem 0;
}
.tl-body pre code { background: none; padding: 0; }
.tl-body ul, .tl-body ol { padding-left: 1.25rem; margin: 0.3rem 0; }
.tl-body li { margin-bottom: 0.15rem; }
.tl-body strong { font-weight: 700; }
.tl-body a { color: var(--foreground); }
.tl-body img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 3px; margin: 0.5rem 0; }

/* Orbit detail */
.orbit-detail .back { font-size: var(--fs-sm); color: var(--muted); }
.orbit-detail .frontmatter {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  margin: 1rem 0 2rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1.5rem;
}
.orbit-detail .frontmatter dt { color: var(--muted); }
.orbit-detail .frontmatter dd { margin: 0; color: var(--foreground); }

.figures { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin: 1rem 0 2rem; }
.figures figure { margin: 0; }
.figures img { width: 100%; height: auto; display: block; border: 1px solid var(--border); }
.figures figcaption { font-size: var(--fs-xs); color: var(--muted); margin-top: 0.5rem; }

.links { list-style: none; padding: 0; margin: 0 0 2rem; }
.links li { font-size: var(--fs-sm); padding: 0.25rem 0; border-bottom: 1px dotted var(--border); }

/* Side panel (slides in from right on node click) */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 680px;
  height: 100vh;
  background: var(--background);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px color-mix(in oklch, var(--foreground) 6%, transparent);
  z-index: 2000;
  overflow-y: auto;
  padding: 2rem 1.75rem 3rem;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.detail-panel.open {
  transform: translateX(0);
}
.detail-panel.closing {
  transform: translateX(100%);
}
.detail-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  z-index: 1;
  transition: color 120ms ease, border-color 120ms ease;
}
.detail-close:hover { color: var(--foreground); border-color: var(--foreground); }
.detail-header { margin-top: 0.5rem; }
.detail-header small { display: block; margin-bottom: 0.35rem; }
.detail-header h3 {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}
.detail-strategy {
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin: 0 0 1.25rem;
  color: var(--foreground);
}
.detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  font-size: var(--fs-sm);
  margin-bottom: 1.25rem;
}
.detail-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.detail-grid a { color: var(--foreground); }
.detail-figs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}
.detail-figs img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.detail-links {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.8;
}
.detail-links a {
  color: var(--foreground);
  font-size: var(--fs-sm);
  display: block;
}

/* Issue comments in side panel */
.issue-comments {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.issue-comments h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.75rem;
}
.issue-comment {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dotted var(--border);
}
.issue-comment:last-child { border-bottom: none; }
.comment-meta {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.3rem;
}
.comment-author {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--foreground);
}
.comment-date {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.comment-body {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--foreground);
  overflow-wrap: break-word;
}
.comment-body p { margin: 0.4rem 0; }
.comment-body h1, .comment-body h2, .comment-body h3, .comment-body h4 {
  font-size: var(--fs-sm);
  font-weight: 700;
  margin: 0.75rem 0 0.25rem;
  font-family: var(--font-sans);
  line-height: 1.3;
}
.comment-body ul, .comment-body ol {
  padding-left: 1.25rem;
  margin: 0.3rem 0;
}
.comment-body li { margin-bottom: 0.15rem; }
.comment-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: color-mix(in oklch, var(--foreground) 6%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.comment-body pre {
  background: color-mix(in oklch, var(--foreground) 5%, transparent);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin: 0.5rem 0;
}
.comment-body pre code { background: none; padding: 0; }
.comment-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--muted);
}
.comment-body table {
  border-collapse: collapse;
  font-size: var(--fs-xs);
  margin: 0.5rem 0;
  width: 100%;
}
.comment-body th, .comment-body td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: left;
}
.comment-body th { font-weight: 600; }
.comment-body a { color: var(--foreground); }
.comment-body strong { font-weight: 700; }
.comment-body hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.comment-images {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.comment-images img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* Ancestry trace label */
.detail-ancestry {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.detail-ancestry h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
}
.detail-ancestry .path {
  font-size: var(--fs-sm);
  line-height: 1.7;
}
.detail-ancestry .path .step {
  display: inline;
}
.detail-ancestry .path .arrow {
  color: var(--muted);
  margin: 0 0.25rem;
}

/* Methodology */
.methodology {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--foreground);
}
.methodology .metric-desc {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  margin-bottom: 1rem;
}
.methodology .metric-desc strong { font-weight: 700; }
.methodology .stages {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}
.methodology .stages li {
  margin-bottom: 0.35rem;
  color: var(--foreground);
}
.methodology .baseline {
  color: var(--foreground);
  margin: 0.75rem 0 0.25rem;
}
.methodology .eval-params {
  color: var(--muted);
  margin-top: 0.25rem;
}

/* References */
ul.references {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 2.5rem;
  columns: 2;
  column-gap: 2.5rem;
}
ul.references li {
  font-size: var(--fs-sm);
  padding: 0.3rem 0;
  break-inside: avoid;
  border-bottom: 1px dotted var(--border);
}
.ref-cite {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--foreground);
}
.ref-note {
  color: var(--muted);
  font-size: 0.92em;
}

/* Footer */
footer.site {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* Empty state */
.empty {
  color: var(--muted);
  font-size: var(--fs-sm);
  padding: 2rem 0;
  text-align: center;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
