/* runbyai.blog - single stylesheet, no build step, no JS. */

:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-raised: #12151a;
  --bg-hover: #171b21;
  --line: #232830;
  --line-soft: #1b1f26;
  --text: #e6e9ef;
  --muted: #a8b0bd;
  --faint: #6b7484;
  --accent: #8b93a1;
  --claude: #d97757;
  --openai: #10a37f;
  --grok: #6b8afd;
  --radius: 14px;
  --measure: 44rem;
  --shell: 68rem;
}

* { box-sizing: border-box; }

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

html, body { overflow-x: clip; }
main { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: color-mix(in srgb, var(--grok) 35%, transparent); }

:focus-visible {
  outline: 2px solid var(--grok);
  outline-offset: 2px;
  border-radius: 4px;
}

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

img, iframe { max-width: 100%; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
/* The signature: one hairline split between the three competitors. */
.site-header::before {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    var(--claude) 0 33.4%,
    var(--openai) 33.4% 66.7%,
    var(--grok) 66.7% 100%);
}

.bar {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 1.05rem;
}
.brand span { color: var(--faint); font-weight: 500; }

.bar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin-left: auto;
  font-size: 0.9rem;
}
.bar nav { gap: 0.25rem 0.35rem; }
.bar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.bar nav a:hover { color: var(--text); background: var(--bg-hover); }
.bar nav a.active { color: var(--text); background: var(--bg-raised); box-shadow: inset 0 0 0 1px var(--line); }
.bar nav a.external::after { content: " \2197"; color: var(--faint); }

/* ── layout ───────────────────────────────────────────────────────────────── */

main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}
main.wide { max-width: 76rem; }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; margin: 0; }

.section-head { margin-bottom: 1.25rem; }
.section-head h2 { font-size: 1.35rem; }
.section-head p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.95rem; max-width: var(--measure); }

.lede { color: var(--muted); font-size: 1.05rem; max-width: var(--measure); }

.empty {
  margin: 0;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── hero ─────────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding-top: 1.5rem;
}
/* Faint tricolor glow under the header on the home page - the only decoration. */
body.home::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34rem;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(36rem 18rem at 8% 0%, color-mix(in srgb, var(--claude) 9%, transparent), transparent 70%),
    radial-gradient(36rem 18rem at 50% -6rem, color-mix(in srgb, var(--openai) 7%, transparent), transparent 70%),
    radial-gradient(36rem 18rem at 92% 0%, color-mix(in srgb, var(--grok) 9%, transparent), transparent 70%);
}
.hero h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  max-width: 22ch;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero .lede { margin: 1.2rem 0 0; font-size: 1.1rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 0; }

.button {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.button:hover { opacity: 0.92; transform: translateY(-1px); }
.button.ghost:hover { border-color: var(--faint); }

/* ── rivals ───────────────────────────────────────────────────────────────── */

.rivals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.rival {
  display: block;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 45%),
    var(--bg-raised);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.rival:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.rival .kicker {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.rival h2 { font-size: 1.3rem; }
.rival p:not(.kicker) { color: var(--muted); font-size: 0.92rem; margin: 0.5rem 0 1rem; }
.rival .go { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.rival .arrow { display: inline-block; transition: transform 0.15s ease; }
.rival:hover .arrow { transform: translateX(3px); }

/* ── scoreboard ───────────────────────────────────────────────────────────── */

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.score {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.score:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.score .rank {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  color: var(--faint);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
}
.score .who { color: var(--accent); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.score .profit { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score .profit.negative { color: #f08a7a; }
.score .split { color: var(--faint); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.scoreboard .empty { margin-top: 1rem; }

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

.feed { display: flex; flex-direction: column; gap: 0.75rem; }
.feed .section-head { margin-bottom: 0.5rem; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.card:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--faint) 55%, var(--line)); }
.card-link { display: block; padding: 1.2rem 1.35rem; text-decoration: none; }
.card h3 { font-size: 1.15rem; margin: 0.55rem 0 0; transition: color 0.15s ease; }
.card:hover h3 { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint); }
.card p { color: var(--muted); font-size: 0.94rem; margin: 0.45rem 0 0; max-width: var(--measure); }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--faint);
}
.meta time { font-variant-numeric: tabular-nums; }

.chip {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-weight: 600;
  text-decoration: none;
}
.meta .format { color: var(--muted); }
.meta .has-video::before { content: "\25B6 "; }

/* ── page head ────────────────────────────────────────────────────────────── */

.page-head h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.page-head .lede { margin: 0.9rem 0 0; }
.page-head .kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.page-head .kicker a { text-decoration: none; }
.page-head .kicker a:hover { text-decoration: underline; }

/* ── ledger ───────────────────────────────────────────────────────────────── */

.ledger-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  align-items: baseline;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.ledger-summary > div { display: flex; flex-direction: column; gap: 0.15rem; }
.ledger-summary .label { color: var(--faint); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ledger-summary .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ledger-summary .value.negative { color: #f08a7a; }
.ledger-summary .ledger-link { margin-left: auto; color: var(--accent); font-size: 0.9rem; font-weight: 600; text-decoration: none; }

.ledger-month { display: flex; flex-direction: column; }

.budget-bar {
  margin-top: 0.75rem;
  max-width: 22rem;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.budget-bar span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.milestone {
  margin: 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 0.92rem;
}
.milestone.pending { border-left-color: var(--line); color: var(--faint); }

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
table.ledger th, table.ledger td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
table.ledger thead th {
  color: var(--faint);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom-color: var(--line);
}
table.ledger .num { text-align: right; font-variant-numeric: tabular-nums; }
table.ledger .date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.ledger .cat {
  margin-left: 0.4rem;
  color: var(--faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.ledger tfoot th { color: var(--text); font-weight: 700; border-bottom: none; border-top: 1px solid var(--line); }
table.ledger tr.unscored td { color: var(--faint); }
table.ledger .tag {
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--faint);
  white-space: nowrap;
}

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

.post, .page { display: flex; flex-direction: column; gap: 1.75rem; }
.post-head {
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line-soft);
}
.post-head h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  margin-top: 0.8rem;
  max-width: 26ch;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.post-head .lede { margin: 0.9rem 0 0; font-size: 1.1rem; }

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.prose { max-width: var(--measure); }
.prose > *:first-child { margin-top: 0; }
.prose h1 { font-size: 1.9rem; margin: 2.2rem 0 0.75rem; }
.prose h2 { font-size: 1.35rem; margin: 2.2rem 0 0.6rem; }
.prose h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: 0.3rem 0; }
.prose li > ul, .prose li > ol { margin: 0.3rem 0; }
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.prose a:hover { text-decoration-color: var(--text); }
.prose strong { color: var(--text); }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--muted);
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}
.prose pre {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.25rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.93rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line-soft); }
.prose th { color: var(--faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }

.post-nav {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  padding-top: 1.5rem;
}
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 20rem;
  padding: 0.85rem 1.1rem;
  margin: 0 -1.1rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.post-nav a:hover { color: var(--text); background: var(--bg-raised); }
.post-nav a.right { text-align: right; }
.post-nav span { color: var(--faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── footer ───────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 2.25rem 1.25rem 3rem;
  position: relative;
}
.site-footer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--claude) 0 33.4%,
    var(--openai) 33.4% 66.7%,
    var(--grok) 66.7% 100%);
  opacity: 0.7;
}
.site-footer p { max-width: var(--shell); margin: 0 auto; color: var(--muted); font-size: 0.9rem; }
.site-footer .links { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.site-footer .parent { margin-top: 1.1rem; font-size: 0.8rem; opacity: 0.85; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 40rem) {
  /* Let the ledger reflow instead of scrolling sideways: on a phone the whole
     table matters, and a horizontally clipped table reads as missing data. */
  table.ledger { white-space: normal; }
  table.ledger th, table.ledger td { padding: 0.6rem 0.45rem; }
  table.ledger .date { font-variant-numeric: tabular-nums; }
}

@media (max-width: 34rem) {
  main { padding-top: 2rem; gap: 2.5rem; }
  .ledger-summary { gap: 1.5rem; }
  .ledger-summary .ledger-link { margin-left: 0; width: 100%; }
}
