/* Railcode — cognition.ai bones, sfcompute.com blood.
   Paper ground, hairline rules, grotesk display over serif text,
   mono wherever a number lives. */

:root {
  --paper: #f7f6f5;
  --paper-deep: #efedeb;
  --ink: #111110;
  --ink-soft: #5c5a56;
  --rule: rgba(17, 17, 16, 0.14);
  --rule-faint: rgba(17, 17, 16, 0.07);
  --accent: #3823f0;
  --accent-soft: rgba(56, 35, 240, 0.08);

  --sans: "Schibsted Grotesk", "Helvetica Neue", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --gutter: clamp(20px, 4vw, 56px);
  --frame-w: 1120px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

.mono { font-family: var(--mono); }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav__inner {
  max-width: var(--frame-w);
  margin: 0 auto;
  padding: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav__glyph { width: 22px; height: 22px; display: block; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav__link {
  position: relative;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 0;
}

/* cognition's vertical tick, rotated for a top nav: a small bar that
   slides in from the left of the link on hover / when active */
.nav__link::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 50%;
  height: 14px;
  width: 2px;
  background: var(--accent);
  transform: translateY(-50%) scaleY(0);
  transform-origin: center;
  transition: transform 160ms ease;
}

.nav__link:hover::before,
.nav__link.is-active::before { transform: translateY(-50%) scaleY(1); }

.nav__link.is-active { color: var(--accent); }

.nav__cta {
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--ink);
  padding: 7px 16px;
  transition: background 140ms ease, color 140ms ease;
}

.nav__cta:hover { background: var(--ink); color: var(--paper); }

.nav__toggle {
  display: none;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 7px 14px;
  cursor: pointer;
}

/* ---------- Frame: hairline-bounded content column ---------- */

.frame {
  max-width: var(--frame-w);
  margin: 0 auto;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}

/* ---------- Sections ---------- */

.section {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}

.section--last { border-bottom: none; }

/* gutter column kept for its vertical rule; the 01/02 numbers are hidden */
.section__no {
  color: transparent;
  user-select: none;
}

.section__body {
  padding: clamp(48px, 7vw, 88px) var(--gutter) clamp(48px, 7vw, 88px) clamp(24px, 3vw, 48px);
  max-width: 920px;
}

.section__title {
  font-family: var(--sans);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0 0 28px;
}

.section__lede {
  max-width: 72ch;
  margin: 0 0 40px;
  color: var(--ink);
}

.section__note {
  max-width: 70ch;
  color: var(--ink-soft);
  font-style: italic;
  margin: 28px 0 0;
}

/* ---------- Hero ---------- */

.hero__title {
  font-family: var(--sans);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin: 0 0 36px;
  max-width: 22ch;
  animation: rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero__prose { max-width: 72ch; }

.hero__prose p {
  margin: 0 0 1.3em;
  animation: rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero__prose p:nth-child(1) { animation-delay: 80ms; }
.hero__prose p:nth-child(2) { animation-delay: 160ms; }
.hero__prose p:nth-child(3) { animation-delay: 240ms; }

.hero__prose a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

.hero__prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 44px;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  animation: rise 600ms 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__title, .hero__prose p, .hero__meta { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  border: 1px solid var(--rule);
}

.stats__cell {
  padding: 20px;
  border-right: 1px solid var(--rule);
}

.stats__cell:last-child { border-right: none; }

.stats dt {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.stats dd {
  margin: 0;
  font-size: clamp(17px, 1.9vw, 21px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

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

.chart { margin: 0 0 36px; }

.chart__caption {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.chart__caption strong { color: var(--ink); font-weight: 500; font-size: 15px; }

.chart__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  align-self: center;
}

.chart__plot {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
}

.chart__ylabels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 28px 0 32px;
  font-variant-numeric: tabular-nums;
}

.chart svg {
  display: block;
  width: 100%;
  height: 150px;
  border: 1px solid var(--rule);
  background: linear-gradient(var(--paper), var(--paper-deep));
}

.chart__grid { stroke: var(--rule-faint); stroke-width: 1; }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.chart__band { fill: var(--accent-soft); stroke: none; }

.chart__axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 6px;
  padding-left: 54px;
}

/* ---------- Market table ---------- */

.market {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 0 0 36px;
}

.market th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--ink);
}

.market td {
  padding: 16px 16px 16px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

.market .num { text-align: right; padding-right: 0; padding-left: 24px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.market td:first-child { font-weight: 500; white-space: nowrap; }

.market .tag {
  display: inline-block;
  margin-left: 10px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  padding: 2px 7px;
}

.market .unit { color: var(--ink-soft); font-size: 11.5px; }

.market tbody tr { transition: background 120ms ease; }
.market tbody tr:hover { background: var(--accent-soft); }

/* ---------- CTA (sfcompute's blue bar) ---------- */

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  padding: 16px 22px;
  transition: background 140ms ease, transform 140ms ease;
}

.cta:hover { background: #2a18c9; }
.cta:active { transform: translateY(1px); }

.cta svg { width: 18px; height: 18px; flex: none; transition: transform 160ms ease; }
.cta:hover svg { transform: translateX(4px); }

.cta--ghost {
  background: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  margin-top: 36px;
}

.cta--ghost:hover { background: var(--ink); color: var(--paper); }

.footnote {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 12px 0 0;
}

/* ---------- Method ---------- */

.method {
  list-style: none;
  margin: 0;
  padding: 0;
}

.method__step {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
}

.method__step:first-child { border-top: none; padding-top: 0; }

.method__no { font-size: 13px; color: var(--accent); padding-top: 4px; }

.method__step h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.method__step p {
  margin: 0;
  max-width: 66ch;
  color: var(--ink-soft);
}

/* ---------- Writing ---------- */

.writing {
  list-style: none;
  margin: 0;
  padding: 0;
}

.writing__row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  transition: color 120ms ease;
}

.writing li:first-child .writing__row { border-top: none; padding-top: 0; }

.writing__date {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.writing__title {
  font-family: var(--sans);
  font-size: 16.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.writing__row:hover .writing__title { color: var(--accent); }

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

.footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
}

.footer__inner {
  max-width: var(--frame-w);
  margin: 0 auto;
  padding: 48px var(--gutter) 40px;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px 64px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.footer__cols {
  display: flex;
  gap: 56px;
}

.footer__cols > div { display: flex; flex-direction: column; gap: 8px; }

.footer__head {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  margin-bottom: 4px;
  color: var(--ink);
}

.footer__cols a {
  text-decoration: none;
  color: var(--ink-soft);
}

.footer__cols a:hover { color: var(--accent); }

.footer__legal {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats__cell { border-bottom: 1px solid var(--rule); }
  .stats__cell:nth-child(2n) { border-right: none; }
  .stats__cell:nth-child(n + 3) { border-bottom: none; }

  .footer__inner { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav__inner { padding: 0 var(--gutter); }

  .section { grid-template-columns: 1fr; }
  .section__no { display: none; }
  .section__body { padding: 40px var(--gutter) 56px; }

  .nav__toggle { display: block; }

  .nav__links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 20px;
  }

  .nav__links.is-open { display: flex; }

  .nav__link { padding: 13px 0 13px 14px; border-bottom: 1px solid var(--rule-faint); }
  .nav__link::before { left: 0; }

  .nav__cta { margin-top: 16px; text-align: center; }

  .writing__row { grid-template-columns: 1fr; gap: 4px; }

  .market { font-size: 12.5px; }
  .market .tag { display: none; }
  .market th:nth-child(2), .market td:nth-child(2) { display: none; }
}
