/* caleb.md — one document, typeset like a rendered markdown file.
   Body is a reading face; monospace is reserved for structural marks only
   (path line, # / ## glyphs, footer). One accent, used only for links. */

:root {
  /* Dark is the default look; light is offered only to visitors whose OS asks for it. */
  --bg:      #17171b;
  --text:    #e7e5df;
  --muted:   #706c64;
  --rule:    #2a2a30;
  --accent:  #7aa2f7;
  --line:    #3b3b43;
  --line-on: #ecebe6;
  color-scheme: dark;

  --reading: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono:    ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:     #fdfdfb;
    --text:   #1c1b19;
    --muted:  #9c988e;
    --rule:   #e8e5dd;
    --accent: #245fc4;
    --line:    #d3d0c8;
    --line-on: #1c1b19;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--reading);
  font-size: 1.15rem;
  line-height: 1.7;
  margin: 0;
  padding: 4rem 1.5rem 6rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { max-width: 41rem; margin: 0 auto; }

/* full-bleed banner strip — a thin cover photo, Notion-style.
   Negative margins cancel the body padding so it runs edge to edge; the
   ::after fades its lower edge into the page so there's no hard seam. */
.banner {
  position: relative;
  margin: -4rem -1.5rem 0;            /* undo body's top + side padding; the topbar sits flush below */
  height: clamp(140px, 24vw, 240px);
  overflow: hidden;
  background: var(--rule);            /* quiet placeholder tone before load */
}
.banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Eased scrim: the extra stops ramp the fade in gently so there's no hard
   line where it starts — a linear two-stop gradient reads as an edge. */
.banner::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 62%;
  background: linear-gradient(to bottom,
    transparent 0%,
    color-mix(in srgb, var(--bg) 12%, transparent) 38%,
    color-mix(in srgb, var(--bg) 45%, transparent) 66%,
    color-mix(in srgb, var(--bg) 80%, transparent) 86%,
    var(--bg) 100%);
  pointer-events: none;
}

/* sticky nav — path on the left, routes on the right. Sits flush under the
   banner and blends in (its background *is* the page background, so it's
   invisible at rest); when it pins to the top on scroll it grows a hairline
   rule to lift off the text scrolling beneath it. */
.topbar-sentinel { display: block; height: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1rem 1.1rem;             /* faint side bleed; tight breathing room before the title */
  padding: 1.15rem 1rem 0.6rem;       /* extra room above the row so it clears the banner fade */
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.topbar.stuck { border-bottom: 1px solid var(--rule); }
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--accent); }
/* routes read as quiet navigation: wider tracking, a step back from the path
   in weight, brightening on hover */
.topbar .routes { display: flex; gap: 1.3rem; }
.topbar .routes a { letter-spacing: 0.04em; opacity: 0.84; }
.topbar .routes a:hover { opacity: 1; }

/* keep anchored sections clear of the pinned topbar when jumped to */
[id] { scroll-margin-top: 4rem; }

/* blog category tabs — CSS-only (radios switch panels), so no JS needed.
   The row reads like a HUD toggle: mono labels over a hairline, the active
   one lit with an accent underline. */
.tab-radio { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.tab-row {
  display: flex;
  gap: 1.6rem;
  margin: 2.2rem 0 1.6rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}
.tab {
  color: var(--muted);
  padding: 0 0 0.6rem;
  margin-bottom: -1px;                /* sit the underline on the row's rule */
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
#cat-work:checked ~ .tab-row label[for="cat-work"],
#cat-life:checked ~ .tab-row label[for="cat-life"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
/* keyboard focus lands on the (hidden) radio — surface it on the label */
.tab-radio:focus-visible ~ .tab-row label { outline: 2px solid var(--accent); outline-offset: 3px; }

.panel { display: none; }
#cat-work:checked ~ .panel-work,
#cat-life:checked ~ .panel-life { display: block; }
.panel h2:first-child { margin-top: 0; }

/* file-path affordance: ~/caleb.md */
.path {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0 0 2.5rem;
}
.path a { color: inherit; text-decoration: none; }
.path a:hover { color: var(--accent); }

h1 {
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 1.6rem;
}

h2 {
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.4;
  margin: 2.4rem 0 0;
}

/* muted structural glyphs: the # and ## */
.hash {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.82em;
  color: var(--muted);
  margin-right: 0.4em;
  user-select: none;
}

/* inline content trailing a section heading, dropped back to reading size */
.tail {
  font-family: var(--reading);
  font-weight: 400;
  font-size: 1.15rem;
}
.sep { color: var(--muted); }

.lead { font-size: 1.25rem; }

.draftnote {
  color: var(--muted);
  font-style: italic;
  font-size: 0.98rem;
  margin-top: 2.4rem;
}

p { margin: 0 0 1.4rem; }

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

code { font-family: var(--mono); font-size: 0.88em; }

/* timeline — vertical grey spine, branches alternating left/right, mono dates. Ring nodes;
   coordination-layer moments (2018 / 2021 / 2026) carry a filled accent node. Each entry
   settles in once as it scrolls into view (IntersectionObserver adds .in): the card rises
   into place and its node/leader/date brighten, then it holds — no scroll-linked motion,
   text stays legible throughout. No JS → spine runs full height and every entry shows final. */
.tl { position: relative; margin: 2rem 0 0.5rem; }
.tl > ol { list-style: none; margin: 0; padding: 0; }

/* base spine (grey). No JS → runs full height. With JS it spans exactly
   first node → last node, so the line reaches the start and the bottom. */
.tl::before {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  background: var(--line);
  transform: translateX(-1px);
}
.tl.js::before {
  top: var(--tl-top, 0);
  bottom: auto;
  height: var(--tl-span, 0);
}

.tl-item {
  position: relative;
  width: 50%;
  box-sizing: border-box;
  padding: 0.95rem 2.6rem;
  min-height: 2.3rem;
}
.tl-item:nth-child(odd)  { left: 0;   text-align: right; }
.tl-item:nth-child(even) { left: 50%; text-align: left; }

/* node: crisp grey ring; coordination moments fill solid by default; the
   ring brightens once when its entry is revealed and stays lit */
.tl-node {
  position: absolute;
  top: 0.95rem;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--line);
  transition: border-color .3s ease, background .3s ease;
  z-index: 1;
}
.tl-item:nth-child(odd)  .tl-node { right: -5.5px; }
.tl-item:nth-child(even) .tl-node { left:  -5.5px; }
.tl--mark .tl-node { background: var(--line-on); border-color: var(--line-on); }
.tl.js .tl-item.in .tl-node { border-color: var(--line-on); }

/* leader line from card to spine; brightens once on reveal */
.tl-item::after {
  content: "";
  position: absolute;
  top: calc(0.95rem + 5px);
  width: 2.4rem; height: 2px;
  background: var(--line);
  transition: background .3s ease;
}
.tl-item:nth-child(odd)::after  { right: 0; }
.tl-item:nth-child(even)::after { left:  0; }
.tl.js .tl-item.in::after { background: var(--line-on); }

.tl-card { position: relative; display: inline-block; max-width: 19rem; }
/* one-time entrance: with JS the card rests 0.5rem low until its entry is
   revealed, then settles up. Text stays fully opaque and legible the whole
   way — it never fades in from invisible. No JS → no offset, shown final. */
.tl.js .tl-card { transform: translateY(0.5rem); transition: transform .38s ease; }
.tl.js .tl-item.in .tl-card { transform: none; }

.tl-date {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  transition: color .3s ease;
}
.tl.js .tl-item.in .tl-date { color: var(--text); }
.tl-role {
  display: block;
  font-weight: 600;
  font-size: 1.14rem;
  margin-top: 0.2rem;
  letter-spacing: -0.01em;
}
.tl-desc {
  margin: 0.45rem 0 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .tl.js .tl-card { transform: none; }
  .tl.js .tl-card,
  .tl.js .tl-node,
  .tl.js .tl-item::after,
  .tl.js .tl-date { transition: none; }
}

/* mobile: single left spine */
@media (max-width: 34rem) {
  .tl::before { left: 6px; }
  .tl-item,
  .tl-item:nth-child(odd),
  .tl-item:nth-child(even) {
    width: 100%; left: 0; text-align: left;
    padding: 0.7rem 0 0.7rem 2rem;
  }
  .tl-item .tl-node { left: 0.5px; right: auto; }
  .tl-item::after,
  .tl-item:nth-child(odd)::after,
  .tl-item:nth-child(even)::after { left: 11px; right: auto; width: 0.7rem; }
  .tl-card { max-width: none; }
}

footer {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--accent); }
