/* AGI Timeline Tracker. Dark theme only, by design. */

:root {
  color-scheme: dark;

  --bg: #121212;
  --card: #1e1e1e;
  --card-raised: #262626;
  --navy: #1a2530;
  --navy-deep: #0f1923;
  --navy-light: #2c3e50;
  --accent: #ff6b1a;
  --accent-light: #ff8c4d;
  --accent-wash: rgba(255, 107, 26, 0.12);
  --text: #e0e0e0;
  --text-strong: #ffffff;
  --text-muted: #9e9e9e;
  --border: #333333;
  --border-soft: rgba(255, 255, 255, 0.1);
  --error: #f44336;

  /* Chart chrome, one step off the card surface. */
  --grid: #2e2e2e;
  --axis: #4a4a4a;
  --reference: #6e6e6e;

  --radius: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, blockquote { margin: 0; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3rem;
  z-index: 10;
  background: var(--accent);
  color: #141414;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */

.site-header {
  background: var(--navy);
  color: var(--text-strong);
  padding-block: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-inline: 2rem;
}

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

.brand-mark {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand h1 { font-size: 1.8rem; line-height: 1.2; color: var(--text-strong); }

.subtitle { font-size: 0.9rem; margin-top: 0.4rem; max-width: 600px; opacity: 0.85; }

.site-header nav ul { display: flex; list-style: none; padding: 0; gap: 1.5rem; }

.site-header nav a {
  display: inline-block;
  color: var(--text-strong);
  padding: 0.5rem;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.site-header nav a:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }

/* ---------- Headline figures ---------- */

main { padding-block: 2rem; }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.metric {
  background: var(--navy);
  color: var(--text-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.metric-label { font-size: 1rem; font-weight: 500; margin-bottom: 0.75rem; opacity: 0.85; }

.metric-value {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.countdown { color: var(--accent); }

.summary-basis,
.note {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.summary-basis { margin-bottom: 0.25rem; }

.note { font-style: italic; margin-bottom: 2rem; }

.noscript {
  background: var(--card);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.card h2 { font-size: 1.5rem; line-height: 1.3; color: var(--text-strong); }

.card-sub { color: var(--text-muted); margin-top: 0.5rem; max-width: 75ch; }

.card-flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1.25rem 1.5rem;
}

.card-foot {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 1.5rem 1.25rem;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented button {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button:hover { color: var(--text-strong); background: rgba(255, 255, 255, 0.04); }
.segmented button[aria-pressed="true"] { background: var(--navy-light); color: var(--text-strong); }

/* ---------- Table ---------- */

.table-scroll { overflow-x: auto; }

.predictions { width: 100%; border-collapse: collapse; }

.predictions thead th {
  background: var(--navy-light);
  color: var(--text-strong);
  text-align: left;
  padding: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.sort-button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.sort-button::after { content: "\2195"; margin-left: 0.35rem; opacity: 0.35; }
th[aria-sort="ascending"] .sort-button::after { content: "\2191"; opacity: 1; }
th[aria-sort="descending"] .sort-button::after { content: "\2193"; opacity: 1; }

.predictions tbody th,
.predictions td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.predictions tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.predictions tbody tr:last-child > * { border-bottom: 0; }

.expert { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; white-space: nowrap; }

.estimate { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.estimate-mid { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.cell-source { min-width: 9.5rem; }
.publisher { display: block; color: var(--text-muted); font-size: 0.85rem; }

.cell-definition { min-width: 13rem; }

.more-button {
  background: none;
  border: 0;
  padding: 0 0.15rem;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.more-button::before { content: "["; }
.more-button::after { content: "]"; }
.more-button:hover { color: var(--accent-light); text-decoration: underline; }

.loading,
.load-error { color: var(--text-muted); text-align: center; padding: 2rem 1rem; }

/* ---------- Series keys (legend, table, tooltip) ---------- */

.series-key { flex: none; overflow: visible; }
.series-key-line { stroke: var(--series); stroke-width: 2; stroke-linecap: round; }
.series-key-marker { fill: var(--series); stroke: var(--card); stroke-width: 3; paint-order: stroke; }

/* ---------- Chart ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0.75rem; }

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 0.3rem 0.75rem 0.3rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.legend-item:hover { border-color: var(--text-muted); }
.legend-item[aria-pressed="true"] { border-color: var(--text); background: var(--card-raised); }
.legend-item.is-dimmed { opacity: 0.45; }

.chart { position: relative; min-height: 360px; }

.chart-svg { display: block; overflow: visible; user-select: none; -webkit-user-select: none; }
.chart-svg.is-pointing { cursor: pointer; }

.chart-grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis .baseline,
.chart-axis .tick { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }

.tick-label { fill: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tick-y { text-anchor: end; dominant-baseline: middle; }
.tick-x { text-anchor: middle; }
.axis-title { fill: var(--text-muted); font-size: 12px; text-anchor: middle; }
.axis-title-y { text-anchor: start; }

.chart-today line { stroke: var(--reference); stroke-width: 1; shape-rendering: crispEdges; }
.today-label { fill: var(--text-muted); font-size: 11px; text-anchor: start; }

.series { transition: opacity 0.15s ease; }
.series-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: 0.55; }
/* Range bars stay faint until their expert is hovered, focused or selected. */
.series-span { fill: none; stroke: var(--series); stroke-width: 2; stroke-linecap: round; opacity: 0.2; transition: opacity 0.15s ease; }
.point { cursor: pointer; outline: none; }
.point-marker { fill: var(--series); stroke: var(--card); stroke-width: 4; paint-order: stroke; }
.point-halo { fill: transparent; stroke: none; }
.point.is-active .point-halo,
.point:focus-visible .point-halo { stroke: var(--text-strong); stroke-width: 1.5; }

.chart-svg.has-focus .series:not(.is-focused) { opacity: 0.14; }
.chart-svg.has-focus .series.is-focused .series-line,
.chart-svg.has-focus .series.is-focused .series-span { opacity: 0.9; }

.chart-tooltip {
  position: absolute;
  z-index: 2;
  max-width: 260px;
  pointer-events: none;
  background: var(--card-raised);
  border: 1px solid #3a3a3a;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  line-height: 1.45;
}
.tt-head { display: flex; align-items: center; gap: 0.4rem; color: var(--text); }
.tt-value { color: var(--text-strong); font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0.1rem 0; }
.tt-meta { color: var(--text-muted); }
.tt-hint { color: var(--text-muted); font-size: 0.75rem; font-style: italic; margin-top: 0.35rem; }

@media (hover: none) {
  .tt-hint { display: none; }
}

/* ---------- Related link ---------- */

.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  background: var(--card);
  border: 1px solid var(--navy-light);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.callout h2 { font-size: 1.2rem; color: var(--text-strong); margin-bottom: 0.35rem; }
.callout p { color: var(--text-muted); max-width: 70ch; }
.callout .button { flex: none; }

/* ---------- Support ---------- */

.support {
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1rem;
}
.support h2 { font-size: 1.2rem; color: var(--text); margin-bottom: 0.75rem; }
.support > p { color: var(--text-muted); margin-bottom: 1.5rem; }

.subscribe {
  max-width: 600px;
  margin: 1.5rem auto 0;
  padding: 1.5rem;
  background: #000000;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text-strong);
}
.subscribe h3 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.subscribe p { color: var(--text-muted); margin-bottom: 1.25rem; }

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  background: var(--accent);
  color: #141414;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 1.4rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.button:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #141414;
  text-decoration: none;
  transform: translateY(-2px);
}
.button:disabled { opacity: 0.7; cursor: progress; transform: none; }

.button-ghost { background: transparent; color: var(--accent); }
.button-ghost:hover { background: var(--accent-wash); color: var(--accent-light); }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy-deep);
  color: var(--text-strong);
  padding: 2rem 0;
  margin-top: 1rem;
  text-align: center;
}

.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }

.footer-col { flex: 1; min-width: 250px; }
.footer-col h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.footer-col p { color: var(--text); }
.footer-updated { margin-top: 0.5rem; font-size: 0.9rem; opacity: 0.75; }

.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 0.5rem; }

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.5rem 1rem 0;
  border-top: 1px solid var(--border-soft);
  font-size: 0.9rem;
  opacity: 0.7;
}

/* ---------- Dialogs ---------- */

.dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: min(88vh, 960px);
  padding: 0;
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog-wide { width: min(820px, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.65); }

.dialog-body { padding: 2rem; }
.dialog h2 { font-size: 1.5rem; color: var(--text-strong); margin-bottom: 1rem; }

.dialog-actions { display: flex; justify-content: flex-end; margin-top: 1.5rem; }

.prose p,
.prose ul { margin-bottom: 1rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose h3 { font-size: 1.05rem; color: var(--text-strong); margin: 1.5rem 0 0.75rem; }

.pd-expert { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.dialog .pd-estimate {
  font-family: var(--mono);
  font-size: 2.25rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0.25rem 0 0.25rem;
}
.pd-context { color: var(--text-muted); }
.pd-block h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.5rem 0 0.5rem;
}
.pd-quote { border-left: 3px solid var(--border); padding-left: 1rem; color: var(--text-strong); font-style: italic; quotes: '"' '"'; }
.pd-quote p::before { content: open-quote; }
.pd-quote p::after { content: close-quote; }
.pd-notes { margin-top: 1.25rem; padding: 0.75rem 1rem; background: var(--card-raised); border-radius: var(--radius); color: var(--text); font-size: 0.9rem; }
.pd-source { margin-top: 1.25rem; }
.pd-verified { margin-top: 0.35rem; color: var(--text-muted); font-size: 0.8rem; }

/* ---------- Suggest form ---------- */

.form-intro { margin-bottom: 1.5rem; }

.field { margin-bottom: 1.25rem; }
.field label { display: block; margin-bottom: 0.4rem; font-weight: 500; }
.required { color: var(--accent); }
.hint { display: block; font-weight: 400; font-size: 0.85rem; color: var(--text-muted); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid #3a3a3a;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.25);
}

.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }
.form-alt { margin-right: auto; font-size: 0.9rem; }

.form-status { margin-top: 1rem; }
.form-status.is-error {
  padding: 0.75rem 1rem;
  background: rgba(244, 67, 54, 0.1);
  border-left: 4px solid var(--error);
  border-radius: var(--radius);
}

.form-done { font-size: 1.1rem; padding: 1rem 0; }

/* ---------- 404 page ---------- */

.brand-name { font-size: 1.5rem; font-weight: 700; color: var(--text-strong); }
.not-found { text-align: center; margin-top: 1rem; }
.not-found h1 { font-size: 1.8rem; color: var(--text-strong); }
.not-found .card-sub { margin: 0.5rem auto 1.5rem; }

/* ---------- Small screens ---------- */

/* Six columns need ~1120px. Below that, drop Organization (it's also in each prediction's dialog). */
@media (min-width: 961px) and (max-width: 1120px) {
  .predictions tr > :nth-child(2) { display: none; }
}

/* Below ~960px the table becomes one card per prediction. */
@media (max-width: 960px) {
  .predictions thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .predictions,
  .predictions tbody,
  .predictions tr,
  .predictions tbody th,
  .predictions td { display: block; }
  .predictions tr { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-soft); }
  .predictions tbody tr:last-child { border-bottom: 0; }
  .predictions tbody th,
  .predictions td { padding: 0.2rem 0; border: 0; }
  .predictions tbody th { padding-bottom: 0.5rem; font-size: 1.05rem; }
  .predictions td[data-label] { display: grid; grid-template-columns: minmax(7.5rem, 28%) 1fr; gap: 0.75rem; }
  .predictions td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: 0.85rem; padding-top: 0.1rem; }
  .cell-source,
  .cell-definition { min-width: 0; }
}

@media (max-width: 760px) {
  .predictions tr { padding: 1rem; }
  .header-inner { flex-direction: column; align-items: flex-start; padding-inline: 1rem; gap: 0.75rem; }
  .brand h1 { font-size: 1.5rem; }
  .brand-mark { width: 40px; height: 40px; }
  .site-header nav ul { gap: 0.5rem; }
  .site-header nav a { padding: 0.35rem 0.5rem; margin-left: -0.5rem; }

  .metrics { grid-template-columns: 1fr; gap: 1rem; }
  .metric-value { font-size: 2.1rem; }

  .card { padding: 1.25rem 1rem; }
  .card-flush { padding: 0; }
  .card-head { padding: 1.25rem 1rem 1rem; }
  .card-foot { padding: 1rem; }
  .card h2 { font-size: 1.3rem; }

  .callout { flex-direction: column; align-items: flex-start; padding: 1.25rem 1rem; }
  .support { padding: 1.5rem 1rem; }
  .subscribe { padding: 1.25rem 1rem; }

  .dialog-body { padding: 1.5rem 1.25rem; }
  .form-alt { flex-basis: 100%; order: 3; margin-right: 0; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .button:hover { transform: none; }
}
