/* The Odyssey — autonomous studio */

/* ── type ──────────────────────────────────────── */

@font-face {
  font-family: "Coinbase Sans";
  src: url("fonts/CoinbaseSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Coinbase Sans";
  src: url("fonts/CoinbaseSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Coinbase Display";
  src: url("fonts/CoinbaseDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Coinbase Display";
  src: url("fonts/CoinbaseDisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Coinbase Mono";
  src: url("fonts/CoinbaseMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #000000;
  --bg-2: #0a0a0a;
  --bg-3: #151515;
  --line: #1f1f1f;
  --line-2: #2e2e2e;

  --ink: #fafafa;
  --ink-2: #a1a1a1;
  --ink-3: #6b6b6b;
  --ink-4: #4a4a4a;

  --sans: "Coinbase Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Coinbase Display", var(--sans);
  --mono: "Coinbase Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --r: 12px;
  --maxw: 1160px;

  /* One curve and one duration for the whole site, so nothing feels
     borrowed from a different page. */
  --ease: cubic-bezier(0.22, 0.68, 0.28, 1);
  --t: 0.18s var(--ease);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; }
h1, h2 { font-family: var(--display); }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, .mono { font-family: var(--mono); font-size: 0.9em; letter-spacing: 0; }

/* ── header ────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.top-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand b { font-family: var(--display); font-size: 16px; font-weight: 500; letter-spacing: -0.02em; }
.brand img { border-radius: 5px; display: block; transition: transform 0.4s var(--ease); }
.brand:hover img { transform: rotate(-9deg) scale(1.09); }

nav { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.x-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t), background var(--t);
}
.x-link:hover {
  color: var(--ink);
  border-color: var(--ink-4);
  background: var(--bg-3);
  text-decoration: none;
}
@media (max-width: 860px) { .x-link span { display: none; } }

/* Every tab is a visible button, as in the xAI console —
   the current one is filled, the rest are outlined. */
nav a {
  color: var(--ink);
  font-size: 14px;
  padding: 8px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
nav a:hover { background: var(--bg-3); border-color: var(--ink-4); text-decoration: none; }
nav a[aria-current="page"] {
  color: #000;
  background: var(--ink);
  border-color: var(--ink);
}
nav a[aria-current="page"]:hover { background: #fff; }

/* ── page frame ────────────────────────────────── */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 110px;
}

.lede {
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 62ch;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 14px;
  letter-spacing: 0;
}

.head { margin-bottom: 44px; }
.head h1 { margin-bottom: 16px; }

section { margin-bottom: 60px; }
section > h2 { margin-bottom: 20px; }

/* ── cards ─────────────────────────────────────── */

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
}

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* stat card, as in the xAI console */
.stat .eyebrow { margin: 0 0 10px; font-size: 13px; }
.stat-v { font-family: var(--display); font-size: 30px; font-weight: 400; letter-spacing: -0.03em; color: var(--ink); }

/* ── Homer quotation ───────────────────────────── */

.homer {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  border-left: 1px solid var(--line-2);
  padding: 2px 0 2px 18px;
  margin: 0;
  white-space: pre-line;
}

.homer-src {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 12px;
}

/* ── the post ──────────────────────────────────── */

/* The whole card is the link — the post is one thing, not a block with a
   link stuck to the bottom of it. */
.tweet {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  background: var(--bg-2);
  max-width: 640px;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.tweet:hover {
  text-decoration: none;
  border-color: var(--line-2);
  background: var(--bg-3);
  transform: translateY(-2px);
}

.tweet-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }

.tweet-av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  object-fit: cover;
  flex: none;
}

.tweet-who b { display: block; font-size: 15px; font-weight: 500; }
.tweet-who span { font-size: 13px; color: var(--ink-3); }

.tweet-x { margin-left: auto; color: var(--ink-3); transition: color var(--t); }
.tweet:hover .tweet-x { color: var(--ink); }

.tweet-body { font-size: 17px; line-height: 1.5; letter-spacing: -0.01em; }

.tweet-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
  transition: color var(--t);
}
.tweet:hover .tweet-foot { color: var(--ink-2); }

/* ── status and progress ───────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
}
.pill.done { color: var(--ink); }
.pill.done::before { background: var(--ink); }
.pill.active { color: var(--ink); border-color: var(--ink-3); }
.pill.active::before { background: var(--ink); animation: pulse 1.8s ease-in-out infinite; }
.pill.fail { color: var(--ink-2); border-style: dashed; }
.pill.fail::before { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-2); }

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

@media (prefers-reduced-motion: reduce) {
  .pill.active::before { animation: none; }
  * { transition: none !important; }
}

.bar { height: 3px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }

/* ── pipeline stages ───────────────────────────── */

.stages {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.stage {
  background: var(--bg-2);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}
.stage:last-child { border-bottom: 0; }
.stage:hover { background: var(--bg-3); text-decoration: none; }

.stage-n { font-family: var(--mono); font-size: 12px; color: var(--ink-4); }
.stage-t { font-size: 15px; }
.stage-t small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.stage-v { font-size: 13px; color: var(--ink-2); text-align: right; }

/* ── table ─────────────────────────────────────── */

.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
}

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; color: var(--ink-3); font-weight: 400; white-space: nowrap; }
tbody tr:hover { background: var(--bg-3); }

/* ── brain log ─────────────────────────────────── */

.log {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.entry {
  background: var(--bg-2);
  padding: 15px 20px;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.entry:last-child { border-bottom: 0; }
.entry time { font-family: var(--mono); font-size: 12px; color: var(--ink-4); padding-top: 2px; }
.entry-kind { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.entry-body { color: var(--ink); }
.entry.think .entry-body { color: var(--ink-2); }
.entry.err .entry-kind { color: var(--ink-2); }

/* ── media tiles ───────────────────────────────── */

.tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tile-media {
  aspect-ratio: 16 / 9;
  background: #060606;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Canon sheets come in whatever shape the model returned — a standing figure,
   a square portrait, a dog lying down. Fit the whole image rather than crop it. */
.tile-media.portrait { aspect-ratio: 4 / 3; background: #060606; }
.tile-media.portrait img { object-fit: contain; }

.tile-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.tile-body p { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.tile-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ── source reader ─────────────────────────────── */

.reader {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  align-items: start;
}

.reader-nav {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  overflow: hidden;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.booklink {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}
.booklink:last-child { border-bottom: 0; }
.booklink:hover { background: var(--bg-3); color: var(--ink); text-decoration: none; }
.booklink[data-on] { background: var(--bg-3); color: var(--ink); }
.booklink[data-on] .booklink-n { color: var(--ink); }

.booklink-n { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.booklink-t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.booklink-c { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }

.reader-pane {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  padding: 28px 32px 40px;
  min-height: 60vh;
}

.reader-head { margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.reader-head h2 { margin-top: 8px; }

.para {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.para p {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 72ch;
}
.para:target p { color: var(--ink); }

.para-n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  padding-top: 5px;
  text-align: right;
}
.para-n:hover { color: var(--ink-2); text-decoration: none; }

/* ── misc ──────────────────────────────────────── */

.note {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  color: var(--ink-2);
  font-size: 14px;
  background: var(--bg-2);
}

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 22px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }

pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0;
}

footer {
  border-top: 1px solid var(--line);
  padding: 26px 24px 52px;
  color: var(--ink-3);
  font-size: 13px;
}
.foot-in { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }

@media (max-width: 640px) {
  main { padding: 36px 18px 80px; }
  .top-in { padding: 0 18px; gap: 12px; min-height: 56px; }
  nav { margin-left: 0; width: 100%; padding-bottom: 10px; gap: 2px; }
  nav a { padding: 6px 11px; font-size: 13px; }
  .stage { grid-template-columns: 22px 1fr; }
  .stage-v { grid-column: 2; text-align: left; }
  .entry { grid-template-columns: 1fr; gap: 4px; }
  .reader { grid-template-columns: 1fr; }
  .reader-nav { position: static; max-height: 260px; }
  .reader-pane { padding: 22px 18px 30px; }
  .para { grid-template-columns: 26px 1fr; gap: 10px; }
}

/* Screenplay reader — a script page, not a document. */
.sp-scene { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.sp-scene:last-child { border-bottom: 0; }

.sp-heading {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 14px;
}

.sp-action {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 62ch;
  white-space: pre-line;
}

.sp-line { margin: 18px 0 0 clamp(0px, 8vw, 120px); max-width: 42ch; }
.sp-line p { font-size: 15px; line-height: 1.65; color: var(--ink); }

.sp-who {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.sp-cite {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  text-decoration: none;
}
.sp-cite:hover { color: var(--ink); }

/* ── the console ───────────────────────────────── */

.con-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.con-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-4);
  flex: none;
}
.dot.live {
  background: var(--ink);
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(250, 250, 250, 0.4);
}

.console {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  height: 420px;
  overflow-y: auto;
  padding: 6px 0;
  scroll-behavior: smooth;
}

.con-line {
  display: grid;
  grid-template-columns: 68px 46px 1fr;
  gap: 12px;
  padding: 5px 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  animation: slide-in 0.32s var(--ease) both;
}
.con-line time { color: var(--ink-4); }
.con-kind { color: var(--ink-3); }
.con-text {
  color: var(--ink-2);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* What it says gets the page font and the full width — it is prose, not a
   path, and it is the only line worth reading slowly. */
.con-line.say { grid-template-columns: 68px 1fr; padding: 11px 18px; }
.con-line.say .con-kind { display: none; }
.con-line.say .con-text {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
}

.con-line.run .con-kind, .con-line.write .con-kind, .con-line.edit .con-kind {
  color: var(--ink-2);
}
.con-line.run .con-text, .con-line.write .con-text { color: var(--ink); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── motion ────────────────────────────────────── */

/* Sections lift into place once, the first time they are reached. */
[data-rise] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
[data-rise][data-shown] { opacity: 1; transform: none; }

/* The page itself fades up on load, so navigation does not flash. */
main { animation: page-in 0.4s var(--ease) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.card, .tile, .booklink, .stage, .entry {
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.tile:hover { border-color: var(--line-2); transform: translateY(-2px); }
.entry:hover { background: var(--bg-2); }

@media (prefers-reduced-motion: reduce) {
  [data-rise] { opacity: 1; transform: none; transition: none; }
  main, .con-line { animation: none; }
  .console { scroll-behavior: auto; }
}
