/* harbert.dev, grammar H "Slate". Authority: _design-contract.md. Dark only. Nothing eases; state changes are flips. */

@font-face { font-family: "Archivo"; src: url("/fonts/archivo-var.woff2") format("woff2"); font-weight: 400 800; font-stretch: 75% 100%; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }

:root {
  --ground: #121417;
  --panel: #191c21;
  --well: #0e1013;
  --rule: #2c313a;
  --bone: #e6e3dc;
  --muted: #9a9890;
  --ember: #ff7a45;
  --gut: 26px;
  --sans: "Archivo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bezel: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 0 1px rgba(0,0,0,.5), inset 0 8px 18px rgba(0,0,0,.35);
  --dim: brightness(.82) saturate(.9);
  color-scheme: dark;
}

/* author display rules override the hidden attribute */
[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--bone); font: 400 1rem/1.55 var(--sans); font-stretch: 100%; overflow-wrap: break-word; }
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--bone); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--sans); font-weight: 700; font-stretch: 80%; letter-spacing: -.025em; }
h1 { font-size: 2.3rem; line-height: 1.02; }
h2 { font-size: 1.45rem; line-height: 1; }
p { margin: 0; }
#main, #cases, #contact { scroll-margin-top: 62px; }
.mono { font-family: var(--mono); font-size: .75rem; font-weight: 400; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 5; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 var(--gut); background: var(--ground); border-bottom: 1px solid var(--rule); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ground); color: var(--bone); padding: 8px 12px; border: 1px solid var(--rule); }
.skip:focus { left: var(--gut); top: 4px; z-index: 6; }
.brand { font-weight: 700; font-stretch: 85%; letter-spacing: -.01em; font-size: 1rem; text-decoration: none; white-space: nowrap; }
.nav ul { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; }
.nav li a { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 0; font-weight: 500; font-stretch: 90%; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-decoration: none; }
.nav li a:hover { color: var(--bone); }
.nav li a[aria-current="page"] { color: var(--bone); box-shadow: 0 1px 0 var(--ember); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; padding: 40px var(--gut) 28px; border-bottom: 1px solid var(--rule); }
.hero h1 { max-width: 720px; }
.hero p { color: var(--muted); line-height: 1.5; }
.hero .mono { display: block; margin-top: 10px; letter-spacing: .04em; }
.hero .mono b { color: var(--bone); font-weight: 500; }

/* ---------- index ---------- */
.index { padding: 14px var(--gut) 30px; }
.ih h2 { font: 400 .75rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ih { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0 10px; font: 400 .75rem/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.rows { margin: 0; padding: 0; list-style: none; }
.row { border-top: 1px solid var(--rule); }
.row:last-child { border-bottom: 1px solid var(--rule); }
.row-link { display: grid; grid-template-columns: 40px 160px minmax(0, 1fr) 250px 56px; grid-template-areas: "num thumb title stack year"; gap: 20px; align-items: center; padding: 12px 10px; margin: 0 -10px; color: inherit; text-decoration: none; position: relative; }
.row-link:hover, .row-link:focus-visible { background: var(--panel); }
.row-link > .num { grid-area: num; font: 400 .75rem/1 var(--mono); color: var(--muted); }
.row-link > .thumb { grid-area: thumb; }
.row-link > .badge { grid-area: thumb; justify-self: end; align-self: start; margin: 4px; z-index: 2; padding: 1px 5px; background: var(--bone); color: var(--ground); font: 500 max(.7rem, 12px)/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.row-link > h3 { grid-area: title; font-size: 1.15rem; font-stretch: 90%; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.row-link > h3 small { display: block; margin-top: 4px; font: 400 1rem/1.4 var(--sans); font-stretch: 100%; letter-spacing: 0; color: var(--muted); }
.row-link > .stack { grid-area: stack; font: 400 .75rem/1.5 var(--mono); color: var(--muted); }
.row-link > .stack b { color: var(--bone); font-weight: 500; }
.row-link > .year { grid-area: year; font: 400 .75rem/1.4 var(--mono); color: var(--muted); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--well); border: 1px solid var(--rule); overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; filter: var(--dim); }
.row-link:hover .thumb img, .row-link:hover .thumb video, .row-link:focus-visible .thumb img, .row-link:focus-visible .thumb video { filter: none; }
.thumb--text { display: block; padding: 26px 10px 8px; font: 400 .75rem/1.4 var(--mono); color: var(--muted); }
.row-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rule); }
.row-progress i, .cm-progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--ember); transition: none; }

/* ---------- case ---------- */
.case { margin: 0 var(--gut); padding: 22px 0 36px; border-top: 1px solid var(--rule); }
.case .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font: 400 .75rem/1.4 var(--mono); color: var(--muted); }
.case .meta b { color: var(--ember); font-weight: 500; }
.case > h1 { margin-bottom: 14px; font-size: 1.45rem; line-height: 1; }
.bench { display: grid; grid-template-columns: 1fr 330px; gap: 22px; align-items: start; }
.case-media { margin: 0; min-width: 0; }
.cm-stage { position: relative; container-type: inline-size; aspect-ratio: 16 / 9; overflow: hidden; background: var(--well); border: 1px solid var(--rule); }
.cm-stage::after, .thumb::after, [data-layout="reel"] .cm-shot::after { content: ""; position: absolute; inset: 0; z-index: 1; box-shadow: var(--bezel); pointer-events: none; }
.cm-lab { position: absolute; left: 10px; top: 8px; z-index: 2; max-width: calc(100% - 210px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; background: var(--ground); font: 400 .75rem/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cm-lab b { color: var(--bone); font-weight: 500; margin-right: 8px; }
.cm-ctl { position: absolute; right: 10px; top: 8px; z-index: 2; display: flex; gap: 6px; align-items: center; font: 400 .75rem/1 var(--mono); }
.cm-count { padding: 5px 6px; background: var(--ground); color: var(--muted); }
.cm-pause, .cm-full, .cm-play { min-width: 24px; min-height: 24px; padding: 4px 8px; font: 400 .75rem/1.2 var(--mono); background: var(--ground); color: var(--muted); border: 1px solid var(--rule); border-radius: 2px; }
.cm-pause:hover, .cm-full:hover, .cm-play:hover { color: var(--bone); border-color: var(--muted); }
figure[data-paused="true"] .cm-pause, .cm-shot[data-paused="true"] .cm-pause { color: var(--bone); border-color: var(--bone); }
.cm-shot { position: absolute; inset: 0; overflow: auto; }
.cm-shot:focus-visible { outline-offset: -4px; }
.cm-shot img, .cm-shot video { width: 100%; height: 100%; object-fit: cover; filter: var(--dim); }
.cm-stage:hover .cm-shot img, .cm-stage:hover .cm-shot video,
.cm-stage:focus-within .cm-shot img, .cm-stage:focus-within .cm-shot video,
.cm-shot.lit img, .cm-shot.lit video { filter: none; }
.cm-shot[data-kind="text"] { padding: 44px 16px 16px; background: var(--well); }
.cm-shot[data-kind="text"] * { filter: none; }
/* svg fills the stage so rendered scale is width/600; figures keep their top ~60 units clear for the label and controls */
.cm-shot[data-kind="figure"] { display: grid; place-items: center; }
.cm-shot[data-kind="figure"] svg { width: 100%; height: 100%; }
.cm-shot[data-kind="figure"] text { font-family: var(--mono); font-size: 12px; fill: var(--bone); }
@container (max-width: 600px) { .cm-shot[data-kind="figure"] text { font-size: 21px; } }
.cm-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; min-height: 44px; min-width: 88px; }
.cm-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rule); z-index: 2; }
.cm-sample table { width: 100%; border-collapse: collapse; font: 400 .75rem/1.5 var(--mono); color: var(--bone); }
.cm-sample caption { text-align: left; padding-bottom: 6px; color: var(--muted); }
.cm-sample th, .cm-sample td { padding: 3px 10px 3px 0; text-align: left; font-weight: 400; border-top: 1px solid var(--rule); vertical-align: top; }
.cm-sample th { color: var(--muted); }

.cm-strip { display: flex; gap: 6px; margin-top: 8px; }
.cm-strip button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 5px 8px; text-align: left; background: var(--panel); color: var(--bone); border: 1px solid var(--rule); font: 400 .75rem/1.3 var(--mono); letter-spacing: .03em; text-transform: uppercase; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-strip button i { display: block; font-style: normal; color: inherit; }
.cm-strip button:hover, .cm-strip button:focus-visible { opacity: 1; }
.cm-strip button[aria-selected="true"] { opacity: 1; border-color: var(--ember); box-shadow: inset 0 0 0 1px var(--ember); }
.cm-fig { display: block; margin-top: 8px; font: 400 .75rem/1.5 var(--mono); color: var(--muted); }
.cm-fig b { color: var(--bone); font-weight: 500; }

.cm-dialog { width: min(1280px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 16px; background: var(--ground); color: var(--bone); border: 0; overflow: auto; }
.cm-dialog::backdrop { background: var(--well); }
.cm-close { display: block; min-width: 44px; min-height: 44px; margin: 0 0 12px auto; padding: 8px 16px; font: 400 .75rem/1.2 var(--mono); background: var(--ground); color: var(--bone); border: 1px solid var(--rule); }
.cm-close:hover { border-color: var(--bone); }
.cm-dialog-body img, .cm-dialog-body video { width: 100%; height: auto; filter: none; }
.cm-dialog-body svg { width: 100%; height: auto; }
.cm-dialog-body table { width: 100%; border-collapse: collapse; font: 400 .75rem/1.5 var(--mono); }
.cm-dialog-body th, .cm-dialog-body td { padding: 3px 10px 3px 0; text-align: left; font-weight: 400; border-top: 1px solid var(--rule); }
.cm-dialog-cap { margin-top: 10px; font: 400 .75rem/1.5 var(--mono); color: var(--muted); }

.reason .body { margin: 0 0 14px; color: var(--bone); }
.ledger { padding: 10px 12px 12px; background: var(--panel); border: 1px solid var(--rule); }
.ledger .t { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 8px; font: 400 .75rem/1.4 var(--mono); color: var(--muted); }
.steps { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0 0 0 3px; list-style: none; }
.steps button { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; width: 100%; min-height: 32px; padding: 6px 10px; text-align: left; background: var(--ground); color: var(--bone); border: 1px solid var(--rule); font: 400 1rem/1.3 var(--sans); }
.steps .n, .steps .tc { font: 400 .75rem/1.3 var(--mono); color: var(--muted); white-space: nowrap; }
.steps .tc { justify-self: end; }
.steps button:hover { border-color: var(--muted); }
.steps button[aria-pressed="true"] { background: var(--bone); color: var(--ground); border-color: var(--bone); box-shadow: -3px 0 0 var(--ember); }
.steps button[aria-pressed="true"] .n, .steps button[aria-pressed="true"] .tc { color: var(--ground); }

/* ---------- reel: reasoning sticky left, shots stacked right ---------- */
.case--reel .bench { grid-template-columns: 330px 1fr; }
.case--reel .reason { order: -1; align-self: stretch; }
.case--reel .ledger { position: sticky; top: 62px; }
[data-layout="reel"] .cm-stage { aspect-ratio: auto; overflow: visible; display: flex; flex-direction: column; gap: 22px; background: none; border: 0; }
[data-layout="reel"] .cm-stage::after { content: none; }
[data-layout="reel"] .cm-lab { position: static; max-width: none; padding: 0; background: none; }
[data-layout="reel"] .cm-shot { position: relative; inset: auto; aspect-ratio: 16 / 9; background: var(--well); border: 1px solid var(--rule); }
[data-layout="reel"] .cm-shot > .cm-pause { position: absolute; right: 64px; top: 8px; z-index: 2; }
[data-layout="reel"] .cm-shot > .cm-full { position: absolute; right: 10px; top: 8px; z-index: 2; }
[data-layout="reel"] .cm-tag { position: absolute; left: 10px; bottom: 10px; z-index: 2; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; background: var(--ground); font: 400 .75rem/1.4 var(--mono); letter-spacing: .04em; color: var(--muted); }
[data-layout="reel"] .cm-shot[data-kind="text"] { aspect-ratio: auto; overflow: visible; }
[data-layout="reel"] .cm-shot[data-kind="text"] .cm-tag { bottom: auto; top: 8px; }
[data-layout="reel"] .cm-sample table + table { margin-top: 18px; }
[data-layout="reel"] .cm-sample th { width: 26%; padding-right: 14px; overflow-wrap: anywhere; }
[data-layout="reel"] .cm-cap { display: block; }
[data-case="websites"] .cm-shot[data-kind="still"] { aspect-ratio: 1237 / 319; }

/* ---------- footer ---------- */
.foot { padding: 28px var(--gut) 32px; border-top: 1px solid var(--rule); }
.foot h2 { margin-bottom: 12px; }
.foot ul { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 20px; padding: 0; list-style: none; }
.foot li a { display: inline-block; min-height: 24px; padding: 4px 0; }
.colophon { max-width: 640px; font: 400 .75rem/1.6 var(--mono); color: var(--muted); }

/* ---------- 404 ---------- */
.lost { padding: 64px var(--gut); }
.lost p { margin-top: 12px; color: var(--muted); }

/* ---------- phones: every layout becomes Stage ---------- */
@media (max-width: 760px) {
  :root { --gut: 16px; }
  .nav li:nth-child(3) { display: none; }
  .nav ul { gap: 16px; }
  .hero { grid-template-columns: 1fr; gap: 14px; padding-top: 28px; }
  h1 { font-size: 2rem; }
  .ih span:last-child { display: none; }
  .row-link { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "num thumb thumb" "title title title" "stack stack year"; gap: 10px 12px; align-items: start; }
  .row-link > .year { align-self: end; }
  .bench, .case--reel .bench { grid-template-columns: 1fr; }
  .case--reel .reason { order: 0; }
  .case--reel .ledger { position: static; }
  .thumb--text { aspect-ratio: auto; height: 88px; }
  /* C3: text and figure shots leave the 16:9 porthole and take their own height; stills and clips keep 16:9 */
  .cm-stage { aspect-ratio: auto; }
  .cm-shot { position: relative; inset: auto; aspect-ratio: 16 / 9; }
  .cm-shot[data-kind="text"], .cm-shot[data-kind="figure"] { aspect-ratio: auto; overflow: visible; }
  .cm-shot[data-kind="figure"] { display: block; }
  .cm-shot[data-kind="figure"] svg { height: auto; }
  /* W12: the source line sits under the media, not over it */
  [data-layout="reel"] .cm-shot:not([data-kind="text"]) { overflow: visible; margin-bottom: 26px; }
  [data-layout="reel"] .cm-shot:not([data-kind="text"]) .cm-tag { top: calc(100% + 4px); bottom: auto; left: 0; padding: 0; background: none; }
  /* F17: a still's Full button leaves the image (the cropped gauge band is ~92px tall) for the source row, 44x44 */
  [data-layout="reel"] .cm-shot[data-kind="still"] { margin-bottom: 52px; }
  [data-layout="reel"] .cm-shot[data-kind="still"] .cm-tag { max-width: calc(100% - 56px); }
  [data-layout="reel"] .cm-shot[data-kind="still"] > .cm-full { top: calc(100% + 4px); right: 0; min-width: 44px; min-height: 44px; }
  [data-layout="reel"] .cm-sample tr, [data-layout="reel"] .cm-sample th, [data-layout="reel"] .cm-sample td { display: block; width: auto; }
  [data-layout="reel"] .cm-sample tr { border-top: 1px solid var(--rule); padding: 3px 0; }
  [data-layout="reel"] .cm-sample th, [data-layout="reel"] .cm-sample td { border-top: 0; padding: 0 0 2px; }
  .cm-strip { overflow-x: auto; }
  .cm-strip button { flex: 0 0 140px; }
  .cm-lab { max-width: calc(100% - 200px); }
  .steps button { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .cm-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 8px; }
  .cm-dialog-body { overflow-x: auto; }
  .cm-dialog-body svg { min-width: 600px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cm-shot img, .cm-shot video, .thumb img, .thumb video { filter: none; }
}

/* ---------- case 03 homelab: topology figure and text-artifact tables ---------- */
.hl-fig .hl-node { fill: var(--panel); stroke: var(--bone); stroke-width: 1; }
.hl-fig .hl-hub { stroke: var(--ember); stroke-width: 2; }
.hl-fig .hl-edge { stroke: var(--bone); stroke-width: 1; }
.cm-dialog-body .hl-fig text { font: 400 12px var(--mono); fill: var(--bone); }
.hl-fig text.hl-lab { fill: var(--muted); }
[data-case="homelab"] .cm-sample th { width: 28%; padding-right: 14px; overflow-wrap: anywhere; }
[data-case="homelab"] .cm-sample thead th { width: auto; color: var(--bone); font-weight: 500; border-top: 0; border-bottom: 1px solid var(--rule); }

/* ---------- case 04 how-i-build: estate map figure and text-artifact tables ---------- */
.es-fig .es-edge { stroke: var(--bone); stroke-opacity: .55; stroke-width: 1; }
.es-fig .es-node { fill: var(--panel); stroke: var(--bone); stroke-width: 1; }
.es-fig .es-hub { stroke: var(--ember); }
/* edge verbs from the estate map, one dash each; audits stays solid */
.es-fig .es-k-reviews { stroke-dasharray: 6 3; }
.es-fig .es-k-deploys { stroke-dasharray: 2 2; }
.es-fig .es-k-governs { stroke-dasharray: 9 3 2 3; }
.es-fig .es-k-boots { stroke-dasharray: 1 4; }
.es-fig .es-k-guards { stroke-dasharray: 4 6; }
.cm-shot[data-kind="figure"] .es-fig text, .cm-dialog-body .es-fig text { font: 400 12px var(--mono); fill: var(--bone); }
[data-case="how-i-build"] .cm-sample th { width: 22%; padding-right: 14px; overflow-wrap: anywhere; }
[data-case="how-i-build"] .cm-sample thead th { width: auto; color: var(--bone); font-weight: 500; border-top: 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 760px) {
  [data-case="how-i-build"] .cm-sample tr, [data-case="how-i-build"] .cm-sample th, [data-case="how-i-build"] .cm-sample td { display: block; width: auto; }
  [data-case="how-i-build"] .cm-sample tr { border-top: 1px solid var(--rule); padding: 3px 0; }
  [data-case="how-i-build"] .cm-sample th, [data-case="how-i-build"] .cm-sample td { border-top: 0; padding: 0 0 2px; }
  [data-case="how-i-build"] .cm-sample thead { display: none; }
  .cm-shot[data-kind="figure"]:has(.es-fig) { overflow-x: auto; overflow-y: hidden; }
  .cm-shot[data-kind="figure"] .es-fig { width: 600px; max-width: none; height: auto; }
}

/* ---------- case 01 bot life: text-artifact tables ---------- */
[data-case="bot-life"] .cm-sample th { padding-right: 14px; overflow-wrap: anywhere; }
[data-case="bot-life"] .cm-sample .bl-kv th { width: 24%; }
[data-case="bot-life"] .cm-sample td { overflow-wrap: anywhere; }
[data-case="bot-life"] .cm-sample .bl-list th { overflow-wrap: normal; }
[data-case="bot-life"] .cm-sample .bl-list td:nth-child(2) { white-space: nowrap; }
[data-case="bot-life"] .cm-sample thead th { width: auto; color: var(--bone); font-weight: 500; border-top: 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 760px) {
  [data-case="bot-life"] .cm-sample tr, [data-case="bot-life"] .cm-sample th, [data-case="bot-life"] .cm-sample td { display: block; width: auto; }
  [data-case="bot-life"] .cm-sample tr { border-top: 1px solid var(--rule); padding: 3px 0; }
  [data-case="bot-life"] .cm-sample th, [data-case="bot-life"] .cm-sample td { border-top: 0; padding: 0 0 2px; }
  [data-case="bot-life"] .cm-sample thead { display: none; }
  [data-case="bot-life"] .bl-list td::before { content: attr(data-label) " "; color: var(--muted); }
}
