/* The Railyard website: the "signal box" palette of the Mac app (apps/mac/Sources/Railyard/UI/Theme.swift).
   Greys have no hue. Green, amber and red are only signals. Blue is the one accent. */

:root {
  --canvas: #ffffff;
  --chrome: #f4f4f4;
  --hairline: #00000014;
  --hairline-strong: #00000029;
  --fg: #171717;
  --fg2: #525252;
  --fg3: #8c8c8c;
  --accent: #2463eb;
  --accent-hover: #1d50c4;
  --accent-fg: #ffffff;
  --link: #0969da;
  --green: #1a7f37;
  --amber: #9a6700;
  --red: #cf222e;

  /* The panel is a dark instrument in both themes. */
  --panel: #1b1b1b;
  --panel-edge: #ffffff13;
  --panel-fg: #ededed;
  --panel-fg2: #a3a3a3;
  --panel-fg3: #6f6f6f;
  --rail: #3a3a3a;
  --lamp-green: #3fb950;
  --lamp-amber: #d29922;
  --lamp-off: #5c5c5c;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 24px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #161616;
    --chrome: #1b1b1b;
    --hairline: #ffffff13;
    --hairline-strong: #ffffff29;
    --fg: #ededed;
    --fg2: #a3a3a3;
    --fg3: #6f6f6f;
    --accent: #4c8dff;
    --accent-hover: #3d7af0;
    --accent-fg: #ffffff;
    --link: #6cb6ff;
    --green: #3fb950;
    --amber: #d29922;
    --red: #f85149;
    --panel: #1d1d1d;
  }
}

:root[data-theme="dark"] {
  --canvas: #161616;
  --chrome: #1b1b1b;
  --hairline: #ffffff13;
  --hairline-strong: #ffffff29;
  --fg: #ededed;
  --fg2: #a3a3a3;
  --fg3: #6f6f6f;
  --accent: #4c8dff;
  --accent-hover: #3d7af0;
  --accent-fg: #ffffff;
  --link: #6cb6ff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --panel: #1d1d1d;
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 400 16px/1.55 var(--sans);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

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

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 15px;
}

.nav a {
  color: var(--fg2);
  text-decoration: none;
  transition: color 120ms ease;
}

.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 10fr);
  gap: 64px;
  align-items: center;
  padding-block: 72px 104px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 6.2vw, 64px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lede {
  margin: 24px 0 0;
  max-width: 30em;
  font-size: 18px;
  line-height: 1.6;
  color: var(--fg2);
  text-wrap: pretty;
}

.get {
  margin-top: 36px;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px 0 18px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background-color 120ms ease;
}

.download:hover { background: var(--accent-hover); }

.download svg { width: 18px; height: 18px; flex: none; }

.facts {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg3);
}

.facts a {
  color: var(--fg2);
  text-underline-offset: 3px;
  text-decoration-color: var(--hairline-strong);
  transition: color 120ms ease;
}

.facts a:hover { color: var(--fg); }

#version { display: block; }
#version:empty { display: none; }

/* ---------- The mimic panel: a project's agents as sidings off one line ---------- */

.panel {
  margin: 0;
  padding: 18px 22px 14px;
  border-radius: 16px;
  background: var(--panel);
  color: var(--panel-fg);
  box-shadow:
    inset 0 0 0 1px var(--panel-edge),
    inset 0 1px 0 #ffffff0d,
    0 1px 2px #0000001f,
    0 24px 48px -24px #00000059;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 2px 12px;
  font-size: 13px;
  color: var(--panel-fg3);
}

.plate {
  color: var(--panel-fg);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
}

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

.siding {
  --lit: var(--rail);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 14px 76px;
  align-items: center;
  height: 64px;
}

.siding.works { --lit: var(--lamp-green); }
.siding.needs { --lit: var(--lamp-amber); }

.points {
  width: 52px;
  height: 64px;
  overflow: visible;
}

.points path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.points .trunk { stroke: var(--rail); }
.points .branch { stroke: var(--lit); }

.track {
  position: relative;
  height: 64px;
  margin: 0 10px 0 4px;
}

/* The rail of the siding. The 4px gap to the points is the joint of the track section. */
.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 30.5px;
  height: 3px;
  border-radius: 2px;
  background: var(--lit);
}

.works .track::before, .works .points .branch { filter: drop-shadow(0 0 6px #3fb95073); }
.needs .track::before, .needs .points .branch { filter: drop-shadow(0 0 6px #d2992266); }

.agent {
  position: absolute;
  left: 2px;
  right: 0;
  bottom: 39px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 500 13px/1 var(--mono);
  color: var(--panel-fg);
}

.agent span { color: var(--panel-fg3); }

.program {
  position: absolute;
  left: 2px;
  top: 41px;
  font-size: 12px;
  line-height: 1;
  color: var(--panel-fg3);
}

.lamp {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--lamp-off);
}

.works .lamp {
  background: var(--lamp-green);
  box-shadow: 0 0 0 3px #3fb9502e, 0 0 14px #3fb950a6;
}

/* The only motion on the page: a working agent pulses, as in the app. */
.works .lamp::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--lamp-green);
  animation: pulse 1.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.needs .lamp {
  background: var(--lamp-amber);
  box-shadow: 0 0 0 3px #d299222e, 0 0 14px #d2992299;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}

.state {
  padding-left: 10px;
  font-size: 13px;
  color: var(--panel-fg3);
  white-space: nowrap;
}

.works .state { color: var(--lamp-green); }
.needs .state { color: var(--lamp-amber); }

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

.section {
  padding: 72px 0;
  border-top: 1px solid var(--hairline);
}

.section h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.section-lede {
  margin: 0;
  max-width: 34em;
  color: var(--fg2);
  font-size: 17px;
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 64px;
  margin: 48px 0 0;
}

.features div { max-width: 30em; }

.features dt {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.features dd {
  margin: 6px 0 0;
  color: var(--fg2);
  text-wrap: pretty;
}

.install {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 64px;
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 44px;
  color: var(--fg2);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
  font: 500 13px/26px var(--mono);
  text-align: center;
  color: var(--fg);
}

/* The steps are stations on one line. */
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 12.5px;
  top: 32px;
  bottom: 6px;
  width: 1px;
  background: var(--hairline-strong);
}

.steps strong { color: var(--fg); font-weight: 600; }

.steps code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--chrome);
  color: var(--fg);
  font-size: 13.5px;
  white-space: nowrap;
}

.updates {
  margin-top: 8px;
  padding: 20px 22px;
  border-radius: 12px;
  background: var(--chrome);
  color: var(--fg2);
}

.updates p { margin: 0; }
.updates p + p { margin-top: 10px; }
.updates strong { color: var(--fg); font-weight: 600; }

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

.foot-rule { border-top: 1px solid var(--hairline); }

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 40px 56px;
  color: var(--fg3);
  font-size: 14px;
}

.foot p { margin: 0; }

.github {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
  color: var(--fg);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 120ms ease;
}

.github:hover { background: var(--chrome); }
.github svg { width: 20px; height: 20px; }

/* ---------- Changelog: each release is a station on the line ---------- */

.page-head {
  padding: 56px 0 40px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.page-head p {
  margin: 14px 0 0;
  max-width: 34em;
  font-size: 17px;
  color: var(--fg2);
  text-wrap: pretty;
}

.releases {
  list-style: none;
  margin: 0 0 72px;
  padding: 0;
  max-width: 760px;
}

.release {
  position: relative;
  padding: 0 0 56px 40px;
}

.release::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 14px;
  bottom: -14px;
  width: 1px;
  background: var(--hairline-strong);
}

.release:last-child::before { display: none; }

.station {
  position: absolute;
  left: 0;
  top: 8px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--canvas);
  box-shadow: inset 0 0 0 1.5px var(--fg3);
}

.release.latest .station {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.release-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.release h2 {
  margin: 0;
  font: 600 24px/1.2 var(--mono);
  letter-spacing: -0.03em;
}

.release h2 a { text-decoration: none; }
.release h2 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.release time { color: var(--fg3); font-size: 14px; }

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.badge.pre {
  color: var(--fg3);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}

.notes {
  margin-top: 14px;
  color: var(--fg2);
}

.notes > :first-child { margin-top: 0; }
.notes > :last-child { margin-bottom: 0; }

.notes h1, .notes h2, .notes h3, .notes h4 {
  margin: 22px 0 6px;
  font: 600 15px/1.4 var(--sans);
  letter-spacing: 0;
  color: var(--fg);
}

.notes p { margin: 10px 0; }

.notes ul, .notes ol { margin: 6px 0 10px; padding-left: 20px; }
.notes ul { list-style: disc; }
.notes li { margin: 4px 0; }
.notes li::marker { color: var(--fg3); }

.notes a { color: var(--link); text-underline-offset: 3px; }

.notes code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--chrome);
  color: var(--fg);
  font-size: 13.5px;
}

.notes pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--chrome);
}

.notes pre code { padding: 0; background: none; }

.release-get {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}

.release-get svg { width: 15px; height: 15px; color: var(--fg3); }
.release-get span { color: var(--fg3); font-weight: 400; }
.release-get:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hairline-strong); }

.status {
  max-width: 760px;
  margin: 0 0 72px;
  color: var(--fg2);
}

.status a { color: var(--link); }

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

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 48px; padding-block: 40px 72px; }
  .install { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .top { height: 60px; }
  .nav { gap: 18px; }
  .lede { font-size: 17px; }
  .download { width: 100%; justify-content: center; }
  .panel { padding: 14px 14px 10px; border-radius: 14px; }
  .siding { grid-template-columns: 40px minmax(0, 1fr) 12px 70px; height: 58px; }
  .points { width: 40px; height: 58px; }
  .track { height: 58px; margin: 0 8px 0 2px; }
  .track::before { top: 27.5px; }
  .agent { bottom: 36px; font-size: 12px; }
  .program { top: 38px; font-size: 11.5px; }
  .lamp { width: 10px; height: 10px; }
  .state { padding-left: 8px; font-size: 12px; }
  .section { padding: 56px 0; }
  .features { grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 32px; }
  .foot { flex-direction: column; align-items: flex-start; }
  .release { padding-left: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .works .lamp::after { animation: none; opacity: 0; }
  * { transition: none !important; }
}
