:root{
  --paper:#F4F2ED;
  --ink:#14110F;
  --muted:#6B655E;
  --rule:#DAD5CC;
  --accent:#1E40AF;
  --panel:#EDEAE3;
}
@media (prefers-color-scheme: dark){
  :root{
    --paper:#131211;
    --ink:#EDEAE4;
    --muted:#948C82;
    --rule:#2C2926;
    --accent:#A5BCF9;
    --panel:#1B1917;
  }
}

*{box-sizing:border-box;margin:0;padding:0}

body{
  background:var(--paper);
  color:var(--ink);
  font:16px/1.55 ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
  padding:0 24px;
}

.wrap{width:100%;max-width:860px;margin:0 auto;display:flex;flex-direction:column;flex:1}

/* header */
header{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:16px;
  padding:26px 0 14px;
  border-bottom:1px solid var(--rule);
}
.mark{
  display:flex;
  align-items:center;
  gap:9px;
  font-size:17px;
  font-weight:600;
  letter-spacing:-0.01em;
  color:var(--ink);
  text-decoration:none;
  border:0;
}
/* the mark is drawn in --ink by the generator, so it inherits nothing here */
.mark svg{flex:none}

nav{display:flex;gap:22px;flex-wrap:wrap}
nav a{
  font-size:13px;
  color:var(--muted);
  text-decoration:none;
  padding-bottom:3px;
  border-bottom:2px solid transparent;
}
nav a:hover{color:var(--ink)}
nav a[aria-current="page"]{color:var(--ink);border-bottom-color:var(--accent)}

/* layout */
main{flex:1;display:flex;align-items:center;padding:44px 0}
body.doc main{align-items:flex-start;padding:36px 0}
body.home main{flex-direction:column;justify-content:center;gap:40px}
main > *{width:100%}

/* type */
.eyebrow{
  font:500 16px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--accent);
  margin-bottom:18px;
}
h1{
  font-size:clamp(27px,4.2vw,38px);
  line-height:1.15;
  letter-spacing:-0.025em;
  font-weight:600;
  max-width:20ch;
}
h2{font-size:19px;letter-spacing:-0.015em;font-weight:600;margin-bottom:11px}
/* home's later articles open with a peer heading, kept at h1 scale but below the
   page's single h1. Direct child only: the home also carries .cases and .grid,
   whose headings are sub-items and must keep their own smaller scale. */
body.home article > h2{font-size:clamp(27px,4.2vw,38px);line-height:1.15;letter-spacing:-0.025em;max-width:20ch;margin-bottom:0}
h3{font-size:14px;font-weight:600;margin-bottom:7px}
/* Body copy fills the column. It was capped at 66ch, which is ~590px against an
   860px .wrap, so text stopped short of the header, footer and figures. */
p{color:var(--muted)}
.lede{margin-top:18px;font-size:17px;line-height:1.55}
p + p{margin-top:12px}
strong{color:var(--ink);font-weight:600}

section + section{margin-top:26px}
/* a section following the lede or the card grid gets no margin from the rule
   above, so its h2 would crowd whatever precedes it */
.lede + section,
.grid + section{margin-top:26px}

.steps{
  display:flex;gap:10px;flex-wrap:wrap;margin-top:30px;
  font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:0.12em;text-transform:uppercase;color:var(--muted);
}
.steps span{border:1px solid var(--rule);padding:8px 12px}
/* the elapsed time the four steps add up to, carried as the last step */
.steps .t{border-color:var(--accent);color:var(--accent)}

.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:26px}
.card{position:relative;background:var(--panel);border:1px solid var(--rule);padding:18px 16px;transition:border-color .15s,background-color .15s}
.card p{font-size:13.5px;line-height:1.5}
/* module icon: ink relief with one accent gesture, generated by diagrams/mark.py */
.card > svg{display:block;width:38px;height:38px;margin-bottom:13px}
.card h3{display:flex;align-items:baseline;gap:8px}
.card h3 a{border:0;color:var(--ink);text-decoration:none}
/* the title link covers the whole card, so anywhere on it is clickable */
.card h3 a::after{content:"";position:absolute;inset:0}
.card h3::after{content:"→";margin-left:auto;color:var(--accent);opacity:.5;transition:transform .15s,opacity .15s}
.card:hover{border-color:var(--accent)}
.card:hover h3 a{color:var(--accent)}
.card:hover h3::after{opacity:1;transform:translateX(3px)}
.card:has(a:focus-visible){border-color:var(--accent);outline:2px solid var(--accent);outline-offset:2px}
.card h3 a:focus-visible{outline:0}
@media (prefers-reduced-motion:reduce){.card,.card h3::after{transition:none}}

/* Worked cases stack in series, each taking the full column like any other
   section on the site. Side by side they were a two column grid whose cells
   were wildly different heights, so a short case left dead space beside a long
   one and a third landed as a widow on its own row. */
.cases{display:grid;grid-template-columns:1fr;gap:40px;margin-top:24px}
/* the home lists these as one-line examples rather than worked cases, so they
   sit three across, and take a smaller size to suit the narrower cell */
.cases.brief{grid-template-columns:repeat(3,1fr);gap:22px}
.cases.brief p{font-size:14px}
/* the grid gap does the separating here, so the stacked-section rhythm rule above
   must not also apply — inside a grid it just pushes the second cell's content down */
.cases > section + section{margin-top:0}
/* a case heading is a full-width section heading and takes the site's h2 scale;
   the rule remains only to hold the line-height, which the global h2 lacks */
.cases h2{line-height:1.3}
.fix{margin-top:14px;padding-left:13px;border-left:2px solid var(--accent)}
.fix strong{display:block;font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:0.12em;text-transform:uppercase;color:var(--accent);margin-bottom:7px}
.tag{
  font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:0.12em;text-transform:uppercase;color:var(--accent);
  display:block;margin-bottom:9px;
}

.crumb{font-size:12px;color:var(--muted);margin-bottom:16px}
.crumb a{color:var(--muted);border:0;text-decoration:none}
.crumb a:hover{color:var(--accent)}

/* figures — diagrams are inlined SVG so they inherit the tokens and the type stack */
figure{margin-top:26px}
/* width:100% against the max-width render.sh writes onto each svg: a diagram
   fills the column when it can and never scales its own labels up past 13px.
   Left-aligned rather than centred, so a diagram narrower than the column still
   shares its left edge with the text, the header and the footer. */
figure svg{display:block;width:100%;height:auto}
figure svg text{
  font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
figcaption{margin-top:12px;font-size:13px;line-height:1.5;color:var(--muted)}
figcaption b{
  display:block;
  font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:0.12em;text-transform:uppercase;color:var(--accent);
  margin-bottom:7px;font-weight:500;
}

.faq{margin-top:26px;border-top:1px solid var(--rule);padding-top:22px}
.faq h2{margin-bottom:16px}
.faq h3{margin-bottom:5px}
.faq div + div{margin-top:15px}
.faq p{font-size:14px}

a{color:var(--ink);text-decoration:none;border-bottom:1px solid var(--accent);padding-bottom:1px}
a:hover{color:var(--accent)}
.email{font-size:22px;letter-spacing:-0.01em;display:inline-block;margin-top:22px}

footer{
  border-top:1px solid var(--rule);
  padding:16px 0 22px;
  display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;
  font-size:12px;color:var(--muted);
}
footer a{color:var(--muted);border:0;text-decoration:none}
footer a:hover{color:var(--accent)}

@media (max-width:720px){
  main{padding:32px 0;align-items:flex-start}
  body.home main{justify-content:flex-start}
  .grid,.cases{grid-template-columns:1fr;gap:14px}
  /* stacked, a worked case needs more air around it than the card grid does */
  .cases{gap:34px}
  /* .cases.brief outranks the rule above on specificity, so it collapses explicitly */
  .cases.brief{grid-template-columns:1fr;gap:18px}
  nav{gap:16px}
  /* diagrams scroll rather than shrink to unreadable */
  figure{overflow-x:auto;-webkit-overflow-scrolling:touch}
  figure svg{min-width:500px}
  /* the case figures are drawn at 420px and stay legible at phone width, so they
     scale down rather than forcing the case to scroll sideways */
  .cases figure{overflow-x:visible}
  .cases figure svg{min-width:0}
}
