/* ── Theme tokens ─────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Same bright orange in both modes */
  --orange: #ff6a00;
  --orange-tint: rgba(255, 106, 0, 0.14);

  --bg: #ffffff;
  --text: #000000;
  --text-muted: #4a4a4a;
  --rule: #e2e2e2;
  --card: #fafafa;

  --rail-width: 56px;
  --row-height: 56px;
  --sidebar-width: 280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --text-muted: #a8a8a8;
    --rule: #262626;
    --card: #0d0d0d;
  }
}

/* ── Base ─────────────────────────────────────────────────── */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar / git graph menu ─────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  padding: 72px 48px 48px 40px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand a {
  text-decoration: none;
}

.brand-sub {
  margin: 0 0 28px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-muted);
}

.graph {
  position: relative;
}

/* SVG rail sits behind the labels. --rows must match the row count in the
   markup, and the viewBox height must be 56 * rows, or the nodes drift. */
.graph-rail {
  --rows: 5;
  position: absolute;
  top: 0;
  left: 0;
  width: var(--rail-width);
  height: calc(var(--rows) * var(--row-height));
  pointer-events: none;
}

.graph-rail--404 {
  --rows: 6;
}

.graph-rail path {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
  stroke-linecap: round;
}

.graph-rail circle {
  fill: var(--bg);
  stroke: var(--orange);
  stroke-width: 2;
}

.graph-rail circle.is-current {
  fill: var(--orange);
}

.graph-rail .graph-x {
  stroke-width: 2.5;
}

.graph-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.graph-list li {
  height: var(--row-height);
  display: flex;
  align-items: center;
}

.node {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-left: 40px;
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
}

.node--branch {
  margin-left: 62px;
}

a.node:hover {
  background: var(--orange-tint);
}

a.node:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

a.node[aria-current="page"] {
  background: var(--orange-tint);
}

/* 'Socials' is a grouping node, not a destination */
.node--label {
  font-weight: 700;
  cursor: default;
}

.node-meta {
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-muted);
}

/* ── Main content ─────────────────────────────────────────── */

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 72px 48px 96px 56px;
}

.content-inner {
  max-width: 680px;
}

h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin: 40px 0 8px;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 32px;
}

.content a {
  color: var(--orange);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ── Blog list ────────────────────────────────────────────── */

.posts {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}

.posts li + li {
  margin-top: 12px;
}

.post {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
}

.post:hover {
  border-color: var(--orange);
}

.post-date {
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--text-muted);
}

.post-title {
  margin: 6px 0 6px;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--text);
}

.post-excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── 404 ──────────────────────────────────────────────────── */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - 168px);
}

.robot {
  width: 172px;
  height: auto;
  color: var(--text);
}

.robot-bulb {
  fill: var(--orange);
}

.error-line {
  margin: 30px 0 0;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  max-width: 22ch;
}

/* ── Small screens ────────────────────────────────────────── */

/* Sidebar stays on the left at every width; the rail scales down instead.
   --rail-width must equal --row-height so the 56x280 viewBox scales uniformly. */
@media (max-width: 720px) {
  :root {
    --rail-width: 40px;
    --row-height: 40px;
    --sidebar-width: 152px;
  }

  .sidebar {
    padding: 40px 12px 32px;
  }

  /* The ↗ markers cost ~15px of label width the narrow rail can't spare */
  .node-meta {
    display: none;
  }

  .brand {
    font-size: 1rem;
  }

  .brand-sub {
    font-size: 0.65rem;
    margin-bottom: 20px;
  }

  .node {
    margin-left: 28px;
    padding: 3px 7px;
    font-size: 0.9rem;
  }

  .node--branch {
    margin-left: 44px;
  }

  .content {
    padding: 40px 18px 64px 16px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .robot {
    width: 124px;
  }

  .error-line {
    font-size: 1.15rem;
  }
}
