/* Groundwork dev log (/journal/groundwork). Loads after /assets/site.css and uses its tokens.
   Motion: one critically damped spring (no overshoot: DESIGN.md says "never flash or bounce"). */

:root {
  --gw-spring: linear(0, 0.0418, 0.1362, 0.2511, 0.3681, 0.4774, 0.5743, 0.6575, 0.727, 0.7843, 0.8307, 0.8678, 0.8974, 0.9207, 0.9389, 0.9531, 0.9641, 0.9726, 0.9792, 0.9842, 0.988, 0.9909, 0.9931, 0.9948, 0.9961, 0.9971, 0.9978, 0.9984, 1);
  --gw-mono: var(--gm-font-mono);
  --gw-index-top: 84px;
}

/* ---------- Head ---------- */
.gw article.post h1 { margin-bottom: 14px; }
.gw .lede { font-size: 19px; color: var(--gm-graphite); max-width: 58ch; text-wrap: pretty; }
.gw .status {
  margin: 18px 0 0; padding: 10px 14px; max-width: 62ch;
  font-family: var(--gw-mono); font-size: 12px; line-height: 1.55; letter-spacing: 0.02em;
  color: var(--gm-text-quiet); background: var(--gm-paper);
  border: 1px dashed var(--gm-gray-warm); border-radius: 10px;
}

.gw-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; max-width: none; }
.gw-toc li { margin: 0; }
.gw-toc a {
  display: inline-block; padding: 7px 12px;
  font-family: var(--gw-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gm-graphite); background: var(--gm-paper);
  border: 1px solid var(--gm-hairline); border-radius: 999px;
  transition: transform 420ms var(--gw-spring), border-color 420ms var(--gw-spring), color 420ms var(--gw-spring);
}
.gw-toc a:hover { color: var(--gm-charcoal); border-color: var(--gm-gray-warm); text-decoration: none; transform: translateY(-1px); }

/* ---------- Sections ---------- */
.gw [id] { scroll-margin-top: var(--gw-index-top); }
.gw section > h2 { margin: 6px 0 12px; font-size: clamp(23px, 3.6vw, 28px); line-height: 1.2; text-wrap: balance; }
.gw .when {
  display: block; margin-top: 72px;
  font-family: var(--gw-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gm-text-quiet);
}
.gw .when::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px;
  background: var(--gm-orange); vertical-align: 1px;
}
.gw section > p, .gw section > ul { font-size: 16.5px; }

/* The theme statement: my words, set a size up */
.gw .statement {
  margin-top: 14px; padding: clamp(20px, 4vw, 30px) clamp(18px, 4vw, 32px);
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 16px;
}
.gw .statement p { font-size: clamp(17px, 2.2vw, 19px); line-height: 1.62; color: var(--gm-charcoal); max-width: 64ch; }
.gw .statement p:last-child { margin-bottom: 0; }

/* ---------- The log ---------- */
.gw .log { list-style: none; margin: 18px 0 0; padding: 0; max-width: none; }
.gw .log > li {
  display: grid; grid-template-columns: 78px minmax(0, 1fr); column-gap: 22px;
  margin: 0; padding: 22px 0 8px; border-top: 1px solid var(--gm-hairline);
}
.gw .log time {
  padding-top: 3px;
  font-family: var(--gw-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--gm-text-quiet);
  font-variant-numeric: tabular-nums;
}
.gw .log h3 { margin: 0 0 6px; font-size: 17.5px; line-height: 1.3; color: var(--gm-charcoal); }
.gw .log p { font-size: 16.5px; }
@media (max-width: 640px) {
  .gw .log > li { grid-template-columns: minmax(0, 1fr); }
  .gw .log time { padding: 0 0 4px; }
}

/* What I typed */
.gw .said {
  margin: 12px 0 16px; padding: 13px 16px 14px; max-width: 62ch;
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 10px;
}
.gw .said cite {
  display: block; margin-bottom: 5px; font-style: normal;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gm-text-quiet);
}
.gw .said p { margin: 0; color: var(--gm-charcoal); font-size: 16.5px; }
.gw .said p + p { margin-top: 8px; }

/* ---------- Pictures and films ---------- */
.gw figure { margin: 20px 0 26px; }
.gw figure .frame {
  position: relative; overflow: hidden;
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 10px;
}
.gw figure img, .gw figure video { display: block; width: 100%; height: auto; }
.gw figure video { background: var(--gm-charcoal); aspect-ratio: 16 / 9; }
.gw figcaption { margin-top: 9px; max-width: 70ch; font-size: 14px; line-height: 1.5; color: var(--gm-text-quiet); }
.gw figcaption .no {
  margin-right: 8px; white-space: nowrap;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gm-graphite);
}
.gw figure.narrow { max-width: 560px; }
.gw .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.gw .pair figure { margin-top: 8px; }
@media (max-width: 640px) { .gw .pair { grid-template-columns: minmax(0, 1fr); } }

/* Tall sheets open on a spring. Without script they show whole. */
.js .gw figure.tall .frame { max-height: 480px; transition: max-height 640ms var(--gw-spring); }
.js .gw figure.tall .frame::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 96px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(251, 250, 246, 0), var(--gm-paper));
  transition: opacity 420ms var(--gw-spring);
}
.js .gw figure.tall.open .frame::after { opacity: 0; }
.js .gw figure.tall.fits .frame::after { display: none; }
.gw .more { display: none; }
.js .gw .more {
  display: inline-flex; align-items: center; gap: 8px; margin: 10px 12px 0 0; padding: 8px 13px;
  font-family: var(--gw-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gm-charcoal); background: var(--gm-paper); cursor: pointer;
  border: 1px solid var(--gm-hairline); border-radius: 999px;
  transition: transform 420ms var(--gw-spring), border-color 420ms var(--gw-spring);
}
.js .gw .more:hover { border-color: var(--gm-gray-warm); }
.js .gw .more:active { transform: scale(0.97); }
.js .gw .more .chev { display: inline-block; transition: transform 520ms var(--gw-spring); }
.js .gw figure.tall.open .more .chev { transform: rotate(180deg); }
.gw .full { font-family: var(--gw-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }

/* ---------- Who does what ---------- */
.gw-org {
  display: grid; margin: 24px 0 28px; gap: 0;
  grid-template-columns: minmax(0, 1fr) 132px minmax(0, 1.15fr) 132px minmax(0, 1.15fr);
  grid-template-areas:
    "me    c1  coord c2  lanes"
    ".     .   c3    .   c4"
    ".     .   pc    .   main";
}
.gw-org .node {
  padding: 15px 16px 16px; background: var(--gm-paper);
  border: 1px solid var(--gm-hairline); border-radius: 10px;
}
.gw-org .node.me { grid-area: me; background: var(--gm-charcoal); border-color: var(--gm-charcoal); }
.gw-org .node.coord { grid-area: coord; }
.gw-org .node.lanes { grid-area: lanes; }
.gw-org .node.pc { grid-area: pc; }
.gw-org .node.main { grid-area: main; }
.gw-org .tag {
  display: block; margin-bottom: 6px;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gm-text-quiet);
}
.gw-org strong { display: block; font-size: 16px; line-height: 1.3; }
.gw-org .node p { margin: 6px 0 0; max-width: none; font-size: 14px; line-height: 1.5; }
.gw-org .node.me .tag { color: #B9B4A9; }
.gw-org .node.me strong { color: var(--gm-cream); }
.gw-org .node.me p { color: #D8D3C7; }
.gw-org .steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; max-width: none; }
.gw-org .steps li {
  margin: 0; padding: 4px 9px; border: 1px solid var(--gm-hairline); border-radius: 999px;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gm-graphite);
}
.gw-org .steps li + li::before { content: "→"; margin: 0 8px 0 -4px; color: var(--gm-gray-warm); }
.gw-org .conn {
  display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 8px 10px;
  font-family: var(--gw-mono); font-size: 10.5px; line-height: 1.35; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gm-text-quiet); text-align: center;
}
.gw-org .conn span { display: block; }
.gw-org .conn .arrow { color: var(--gm-orange-deep); font-size: 13px; }
.gw-org .c1 { grid-area: c1; } .gw-org .c2 { grid-area: c2; }
.gw-org .c3 { grid-area: c3; } .gw-org .c4 { grid-area: c4; }
.gw-org .conn.v { padding: 12px 10px; }
.gw-org .conn .h { display: block; } .gw-org .conn .vv { display: none; }
.gw-org .conn.v .h { display: none; } .gw-org .conn.v .vv { display: block; }
@media (max-width: 860px) {
  .gw-org {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "me" "c1" "coord" "c2" "lanes" "c4" "main" "c3" "pc";
  }
  .gw-org .conn { padding: 12px 10px; }
  .gw-org .conn .h { display: none; } .gw-org .conn .vv { display: block; }
}

/* ---------- Lists that read as tables ---------- */
.gw .facts { list-style: none; margin: 18px 0 0; padding: 0; max-width: none; }
.gw .facts > li {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); column-gap: 22px;
  margin: 0; padding: 16px 0 6px; border-top: 1px solid var(--gm-hairline);
}
.gw .facts .k { padding-top: 2px; font-weight: 600; font-size: 15.5px; line-height: 1.35; color: var(--gm-charcoal); }
.gw .facts .k small {
  display: block; margin-top: 4px; font-weight: 400;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gm-text-quiet);
}
.gw .facts p { font-size: 16px; }
@media (max-width: 640px) {
  .gw .facts > li { grid-template-columns: minmax(0, 1fr); }
  .gw .facts .k { padding-bottom: 6px; }
}
.gw code {
  font-family: var(--gw-mono); font-size: 0.86em; padding: 1px 5px;
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 6px; overflow-wrap: anywhere;
}

/* ---------- Slots that Sunday fills ---------- */
.gw .slot {
  margin: 18px 0; padding: 18px 18px 8px; max-width: 70ch;
  border: 1px dashed var(--gm-gray-warm); border-radius: 10px; background: transparent;
}
.gw .slot .tag {
  display: block; margin-bottom: 6px;
  font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gm-orange-deep);
}
.gw .slot strong { display: block; font-size: 16.5px; }
.gw .slot p { margin-top: 4px; font-size: 15.5px; }
.gw .slot.film { aspect-ratio: auto; }

.gw .back { margin-top: 56px; }

@media (prefers-reduced-motion: reduce) {
  .gw-toc a, .js .gw figure.tall .frame, .js .gw figure.tall .frame::after, .js .gw .more, .js .gw .more .chev { transition: none; }
  html { scroll-behavior: auto; }
}
.gw ul.plain { max-width: 62ch; }
.gw ul.plain li { margin-top: 8px; }

/* ---------- r3: first screen, moments, method excerpts ---------- */
.gw .opening { margin-top: 18px; font-size: 18px; line-height: 1.6; color: var(--gm-charcoal); max-width: 62ch; text-wrap: pretty; }
.gw .pointer { font-size: 15.5px; color: var(--gm-graphite); max-width: 62ch; }
.gw .pair.lead { margin-top: 26px; align-items: start; }
.gw .moments { list-style: none; margin: 14px 0 0; padding: 0; max-width: none; counter-reset: m; }
.gw .moments > li { counter-increment: m; margin: 0; padding: 18px 0 4px; border-top: 1px solid var(--gm-hairline); }
.gw .moments h3 { margin: 0 0 6px; font-size: 17.5px; line-height: 1.3; color: var(--gm-charcoal); }
.gw .moments h3::before {
  content: counter(m) "  "; font-family: var(--gw-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--gm-text-quiet);
}
.gw .moments p { font-size: 16.5px; max-width: 64ch; }
.gw .moments .pair figure { margin: 4px 0 14px; }
.gw .statement-label {
  margin: 0 0 10px; font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gm-text-quiet);
}
.gw .statement { margin-top: 22px; }
.gw section > h3.sub { margin: 40px 0 8px; font-size: 19px; line-height: 1.3; color: var(--gm-charcoal); }
.gw pre.excerpt {
  margin: 12px 0 20px; padding: 14px 16px; max-width: none; overflow-x: auto;
  font-family: var(--gw-mono); font-size: 12.5px; line-height: 1.6; color: var(--gm-charcoal);
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 10px;
}
.gw blockquote.note {
  margin: 12px 0 20px; padding: 14px 16px; max-width: 70ch;
  background: var(--gm-paper); border: 1px solid var(--gm-hairline); border-radius: 10px;
}
.gw blockquote.note p { font-size: 15.5px; color: var(--gm-charcoal); }
.gw blockquote.note p:last-child { margin-bottom: 0; }
.gw .cards-wrap { overflow-x: auto; margin: 12px 0 14px; }
.gw table.cards { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; }
.gw table.cards th {
  text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--gm-gray-warm);
  font-family: var(--gw-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gm-text-quiet);
}
.gw table.cards td { vertical-align: top; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--gm-hairline); color: var(--gm-charcoal); }
.gw .facts.numbers > li { grid-template-columns: 120px minmax(0, 1fr); }
.gw .facts.numbers .k { font-size: 20px; font-variant-numeric: tabular-nums; }
.gw .status { margin-top: 22px; }

/* Text folded behind the same "show more" control the tall sheets use */
.js .gw .fold .body { max-height: 0; overflow: hidden; transition: max-height 640ms var(--gw-spring); }
.gw .fold .more { margin: 4px 0 10px; }
.js .gw .fold.open .more .chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .js .gw .fold .body { transition: none; } }
.gw .facts .after { margin-top: -4px; color: var(--gm-graphite); }
.gw .facts .after span {
  margin-right: 6px; font-family: var(--gw-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gm-text-quiet);
}
.gw .cut { margin-top: 18px; }
.gw .cut h3.sub { margin-top: 24px; }
.gw .cut h3.sub { font-size: 19px; line-height: 1.3; color: var(--gm-charcoal); }

/* ---------- Left index ---------- */
/* Default: a complete, ordinary list, including when enhancement is unavailable. */
.gw-layout { position: relative; }
.gw-index-home { max-width: 980px; margin: 0 auto; padding: 32px 24px 0; }
.gw-index {
  display: flex; flex-direction: column; min-height: 0;
  color: var(--gm-charcoal); font-family: var(--gm-font-sans);
}
.gw-index-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 40px; padding: 0 0 10px; border-bottom: 1px solid var(--gm-hairline);
  font-family: var(--gw-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--gm-text-quiet);
}
.gw-index-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.gw-index-track { position: relative; padding: 10px 0; }
.gw-index ol { list-style: none; margin: 0; padding: 0; }
.gw-index a {
  display: block; padding: 8px 4px 8px 17px;
  color: var(--gm-text-quiet); text-decoration: none; overflow-wrap: anywhere;
}
.gw-index-list > li > a {
  font-family: var(--gw-mono); font-size: 11px; font-weight: 500;
  line-height: 1.5; letter-spacing: 0.08em; text-transform: uppercase;
}
.gw-index .gw-index-entries { margin: 2px 0 10px 17px; border-left: 1px solid var(--gm-hairline); }
.gw-index-entries a { padding: 7px 4px 7px 12px; font-size: 12px; line-height: 1.45; }
.gw-index-time {
  display: block; margin-bottom: 2px; font-family: var(--gw-mono); font-size: 11px;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.gw-index a:hover { color: var(--gm-charcoal); text-decoration: underline; text-underline-offset: 3px; }
.gw-index a[aria-current] { color: var(--gm-charcoal); font-weight: 600; }
.gw-index-marker {
  position: absolute; top: 0; left: 0; width: 7px; height: 7px;
  background: var(--gm-orange); pointer-events: none; opacity: 0;
  transition: transform 420ms var(--gw-spring);
}
.gw-index-marker.is-current { opacity: 1; }
.gw-index a:focus-visible, .gw-index-close:focus-visible, .gw-index-toggle:focus-visible {
  outline: 2px solid var(--gm-charcoal); outline-offset: -2px; border-radius: 0;
}
.gw [tabindex="-1"]:focus { outline: none; }
.gw [tabindex="-1"]:focus-visible { outline: 1px solid var(--gm-charcoal); outline-offset: 5px; }
.gw-index-close, .gw-index-toggle {
  font: 500 11px/1.5 var(--gw-mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gm-charcoal); background: var(--gm-cream); cursor: pointer;
}
.gw-index-close { min-height: 44px; padding: 10px 2px 10px 16px; border: 0; }
.gw-index-toggle { min-height: 44px; padding: 11px 16px; border: 1px solid var(--gm-gray-warm); border-radius: 999px; }
.gw-index-dock { display: none; }
.gw-index-ready .gw-index-dock {
  display: block; position: fixed; z-index: 45; right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom) + var(--gma-bridge-dock-height, 0px));
}
.gw-index-dock.film-overlap { visibility: hidden; }
.gw-index-ready .gw-index-home { display: none; }
.gw-index-sheet {
  position: fixed; inset: auto 0 0 auto; margin: 0;
  width: min(100%, 440px); max-width: 100%;
  max-height: min(75vh, calc(100vh - var(--gw-index-top) - 16px));
  max-height: min(75dvh, calc(100dvh - var(--gw-index-top) - 16px));
  padding: 12px 24px max(20px, env(safe-area-inset-bottom));
  overflow: hidden; color: var(--gm-charcoal); background: var(--gm-cream);
  border: 0; border-top: 1px solid var(--gm-hairline);
}
.gw-index-sheet:not([open]) { display: none; }
.gw-index-sheet[open] { display: flex; }
.gw-index-sheet .gw-index { width: 100%; }
.gw-index-sheet .gw-index a { min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.gw-index-sheet::backdrop { background: color-mix(in srgb, var(--gm-charcoal) 18%, transparent); }
html.gw-index-ready { scrollbar-gutter: stable; }
html.gw-index-open { overflow: hidden; }

/* The rail sits in the margin left of the 980 px page: 24 px gap, 16 px outer margin.
   At 1440 px wide that leaves 190 px for it; from 1500 px up it is the full 220 px. */
@media (min-width: 1440px) {
  .gw-index-home, .gw-index-ready .gw-index-home {
    --gw-rail: min(220px, calc(50vw - 530px));
    display: block; position: absolute; top: 72px; bottom: 64px;
    left: calc(50% - 490px - 24px - var(--gw-rail)); width: var(--gw-rail);
    margin: 0; padding: 0;
  }
  .gw-index-home .gw-index {
    position: sticky; top: var(--gw-index-top);
    max-height: calc(100vh - var(--gw-index-top) - 24px);
    max-height: calc(100dvh - var(--gw-index-top) - 24px);
  }
  .gw-index-ready .gw-index-dock, .gw-index-ready .gw-toc { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gw-index-marker { transition: none; }
}
@media print {
  .gw-index-home, .gw-index-ready .gw-index-home, .gw-index-dock,
  .gw-index-ready .gw-index-dock, .gw-index-sheet[open], .gw-toc { display: none; }
  .gw-index-sheet::backdrop { display: none; }
  html.gw-index-open { overflow: visible; }
}
