/* human-in-loop.dev — line design layer.
   Two colours only. Every grey on the page is lines at some density. */

:root {
  --paper: #F3F1EC;
  --ink: #0D0D0C;
  --pad: clamp(16px, 4.4vw, 76px);
  --gap: clamp(14px, 1.6vw, 24px);
  --r-plate: 30px;
  --r-glass: 40px;
  --f-display: "Kalnia", "Didot", Georgia, serif;
  --f-text: "Geologica", system-ui, "Segoe UI", sans-serif;
  --f-data: "Workbench", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-nav: "Michroma", "Geologica", system-ui, sans-serif;
  --f-num: "Monoton", "Kalnia", Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] { --paper: #0D0D0C; --ink: #F3F1EC; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* the native scrollbar's track drew a pale strip down the right of every dark section. Once the engine runs it is
   hidden and a thin thumb takes its place: no track, shown while you scroll or point at the right edge, draggable,
   and inverted against whatever is under it so it reads on paper and on ink */
html.nav-js { scrollbar-width: none; }
html.nav-js::-webkit-scrollbar { display: none; width: 0; height: 0; }
.scroll-thumb { position: fixed; top: 0; right: 3px; z-index: 60; width: 5px; height: 40px; border-radius: 4px; background: #F3F1EC; mix-blend-mode: difference; opacity: 0; pointer-events: none; touch-action: none; cursor: grab; transition: opacity .35s, width .18s, right .18s; }
.scroll-thumb.on { opacity: .5; pointer-events: auto; }
.scroll-thumb.on:hover, .scroll-thumb.drag { opacity: .78; width: 8px; right: 2px; }
.scroll-thumb.drag { cursor: grabbing; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-text);
  font-variation-settings: "SHRP" 13;
  font-size: clamp(16px, 1.02vw + 5px, 18px);
  line-height: 1.6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

[data-polarity="same"] { --g: var(--paper); --f: var(--ink); }
[data-polarity="inverse"] { --g: var(--ink); --f: var(--paper); }
/* sections fixed to one look in both themes: the resume is always day, the footer always night */
[data-polarity="night"] { --g: #0D0D0C; --f: #F3F1EC; color-scheme: dark; }
[data-polarity="day"] { --g: #F3F1EC; --f: #0D0D0C; color-scheme: light; }
[data-polarity] { color: var(--f); position: relative; z-index: 1; }

#field { position: absolute; left: 0; top: 0; width: 100%; height: 100lvh; display: block; z-index: 0; pointer-events: none; will-change: transform; }
html:not(.lines-live) #field { display: none; }

a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; transition: text-decoration-thickness .2s, text-underline-offset .2s; }
a:hover { text-decoration-thickness: 3px; text-underline-offset: .3em; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--f); color: var(--g); }

h2, h3 { font-family: var(--f-display); font-weight: 405; font-stretch: 104%; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(32px, 4.8vw + 12px, 108px); line-height: .95; letter-spacing: -.012em; overflow-wrap: break-word; hyphens: auto; }
h3 { font-size: clamp(20px, 1.5vw + 8px, 30px); line-height: 1.12; font-weight: 520; }
p { margin: 0; }
strong { font-family: var(--f-data); font-weight: 400; font-size: .86em; letter-spacing: .02em; }

.skip { position: absolute; left: var(--pad); top: -80px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; }
.skip:focus { top: 12px; }

[data-plate] { border-radius: var(--r-plate); }
[data-plate="glass"] { border-radius: var(--r-glass); }
/* Without the line engine the page still has ground and plates */
html:not(.lines-live) [data-polarity] { background-color: var(--g); }
html:not(.lines-live) [data-plate] { background: var(--g); }
html:not(.lines-live) .hero { background-image: repeating-radial-gradient(circle at 38% 40%, transparent 0 7px, color-mix(in srgb, var(--f) 45%, transparent) 7px 8px); }
html:not(.lines-live) main > section:nth-child(odd), html:not(.lines-live) .foot { background-image: repeating-linear-gradient(180deg, transparent 0 8px, color-mix(in srgb, var(--f) 30%, transparent) 8px 9px); }
html:not(.lines-live) main > section:nth-child(even) { background-image: repeating-radial-gradient(ellipse at 70% 40%, transparent 0 9px, color-mix(in srgb, var(--f) 28%, transparent) 9px 10px); }
/* model canvases never size their box: their pixels must not feed back into the layout */
.model { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* ---------- loader: only when JavaScript runs; rings draw in and turn, then open outward into the page ---------- */
.loader { display: none; }
html.is-loading, html.is-leaving { overflow: hidden; }
html.is-loading .loader, html.is-leaving .loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #F3F1EC; color: #0D0D0C; }
.loader svg { width: min(44vmin, 300px); height: auto; overflow: visible; transform: translate(var(--dx, 0px), var(--dy, 0px)); transition: transform .65s cubic-bezier(.65,0,.25,1); }
.loader .lr { fill: none; stroke: currentColor; stroke-width: .9; stroke-linecap: round; transform-origin: 100px 100px; stroke-dasharray: 0 100;
  animation: lr-draw 1s cubic-bezier(.6,0,.2,1) calc(var(--i) * 70ms) forwards, lr-turn var(--dur) linear infinite; }
.loader .lr:nth-child(odd) { stroke-width: 1.4; }
.loader .lr-dot { fill: currentColor; }
@keyframes lr-draw { to { stroke-dasharray: var(--arc) calc(100 - var(--arc)); } }
@keyframes lr-turn { to { transform: rotate(calc(var(--dir) * 360deg)); } }
html.is-leaving .loader { opacity: 0; transition: opacity .6s .25s; }
html.is-leaving .loader svg { transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(3.2); transition: transform .9s cubic-bezier(.7,0,.2,1); }
@media (prefers-reduced-motion: reduce) {
  .loader .lr { animation: none; stroke-dasharray: var(--arc) calc(100 - var(--arc)); }
  .loader svg, html.is-leaving .loader svg { transform: none; transition: none; }
}

/* ---------- navigation: the floating glass island ---------- */
.topbar {
  position: fixed; z-index: 40; top: 14px; left: var(--pad); right: var(--pad);
  display: flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 16px; color: var(--ink);
  transition: color .35s, background-color .35s;
}
.topbar[data-on="dark"] { color: #F3F1EC; --nav-g: #0D0D0C; }
.topbar[data-on="light"] { color: #0D0D0C; --nav-g: #F3F1EC; }
html:not(.lines-live) .topbar { background: var(--nav-g, var(--paper)); }
.lines-live .topbar { background-color: color-mix(in srgb, var(--nav-g, #F3F1EC) 46%, transparent); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.topbar .mark { width: 34px; height: 34px; flex: none; }
.topbar ul { display: flex; flex: 1; min-width: 0; flex-wrap: nowrap; align-items: center; gap: 6px 22px; margin: 0; padding: 0; list-style: none; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.topbar ul::-webkit-scrollbar { display: none; }
.topbar .brand { display: none; align-items: center; flex: none; color: inherit; font-family: var(--f-nav); font-size: 12px; letter-spacing: .08em; text-decoration: none; white-space: nowrap; }
.topbar.compact .brand { display: inline-flex; }
/* the name and the menu button in the site's own lettering; the two o's of loop watch the pointer.
   Both words share one vertical box, so at the same height their letters sit on the same lines */
.brand-word, .mt-word { display: block; height: 21px; width: auto; overflow: visible; }
.mt-word .mt-mid { transition: opacity .25s; }
.topbar.open .mt-word .mt-mid { opacity: 0; }
.topbar.compact.no-brand .brand { display: none; }
/* without JavaScript the island is not fixed and its links wrap, so it never covers the page */
html:not(.nav-js) .topbar { position: absolute; }
html:not(.nav-js) .topbar ul { flex-wrap: wrap; overflow: visible; }
.menu-toggle { display: none; }
/* compact island (set by the engine when the links no longer fit): mark, Menu, theme; the list opens as a sheet */
.topbar.compact { justify-content: space-between; }
.topbar.compact .menu-toggle { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-family: var(--f-nav); font-size: 12px; letter-spacing: .06em; cursor: pointer; }
.topbar.compact ul { position: fixed; inset: 0; z-index: -1; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; overflow-y: auto;
  padding: 104px var(--pad) 40px; counter-reset: nav;
  background-color: var(--nav-g, #F3F1EC);
  background-image: repeating-linear-gradient(to bottom, transparent 0 13px, color-mix(in srgb, currentColor 26%, transparent) 13px 14px);
  clip-path: inset(0 0 100% 0); visibility: hidden; transition: clip-path .5s cubic-bezier(.7,0,.2,1), visibility 0s .5s; }
.topbar.compact.menu-out { -webkit-backdrop-filter: none; backdrop-filter: none; } /* a filter would trap the fixed sheet inside the island */
/* the open sheet takes the theme's colours (paper and ink, swapped in dark), not the section under the island */
.topbar.compact.menu-out { color: var(--ink); --nav-g: var(--paper); }
.topbar.compact.open ul { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .5s cubic-bezier(.7,0,.2,1); }
.topbar.compact li { counter-increment: nav; border-top: 1px solid currentColor; }
.topbar.compact li:not(.agents) a { display: flex; align-items: baseline; gap: 18px; padding: 14px 10px; background: var(--nav-g, #F3F1EC); text-decoration: none; font-family: var(--f-display); font-weight: 460; font-stretch: 104%; font-size: clamp(30px, 7vw, 58px); line-height: 1.05; letter-spacing: 0;
  opacity: 0; transform: translateY(14px); transition: opacity .3s, transform .4s cubic-bezier(.2,.8,.2,1); }
.topbar.compact li:not(.agents) a::before { content: counter(nav, decimal-leading-zero); font-family: var(--f-data); font-size: 13px; letter-spacing: .1em; }
.topbar.compact.open li a { opacity: 1; transform: none; }
.topbar.compact.open li:nth-child(2) a { transition-delay: .04s; } .topbar.compact.open li:nth-child(3) a { transition-delay: .08s; }
.topbar.compact.open li:nth-child(4) a { transition-delay: .12s; } .topbar.compact.open li:nth-child(5) a { transition-delay: .16s; }
.topbar.compact.open li:nth-child(6) a { transition-delay: .2s; } .topbar.compact.open li:nth-child(7) a { transition-delay: .24s; }
.topbar.compact.open li:nth-child(8) a { transition-delay: .28s; }
.topbar.compact li:not(.agents) a:hover, .topbar.compact li:not(.agents) a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
.topbar.compact .agents { margin: auto 0 0; padding: 18px 10px 0; border-left: 0; background: transparent; }
.topbar.compact .agents a { opacity: 1; transform: none; background: var(--nav-g, #F3F1EC); padding: 4px 6px; }
html.menu-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .topbar.compact ul, .topbar.compact li a { transition: none !important; } }
.topbar a { font-family: var(--f-nav); font-size: 12px; letter-spacing: .02em; text-decoration-thickness: 1px; text-underline-offset: .5em; }
.topbar a:hover, .topbar a:focus-visible { text-decoration-thickness: 2px; }
.topbar .agents { margin-left: auto; padding-left: 18px; border-left: 1px solid currentColor; font-family: var(--f-data); font-size: 13px; }
.topbar .agents a { font-family: var(--f-data); font-size: 13px; letter-spacing: 0; }
.theme-toggle { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.theme-toggle svg { width: 24px; height: 24px; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.theme-toggle[aria-pressed="true"] svg { transform: rotate(180deg); }

/* ---------- hero: the tunnel, the one-line name, and the words cut into the cliff ---------- */
.hero {
  z-index: 5; /* keeps the fixed glass bar above everything that scrolls under it */
  min-height: 118svh;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: 1fr auto;
  column-gap: var(--gap);
  padding: 104px var(--pad) clamp(36px, 6vh, 72px);
}
.hero-name { position: relative; grid-column: 1 / -1; grid-row: 1; align-self: center; margin: 0 0 12vh; font-weight: 400; line-height: 1; }
.n1 {
  display: block; max-width: 100%;
  font-family: var(--f-display); font-weight: 700; font-stretch: expanded;
  font-size: min(300px, calc((100vw - 2 * var(--pad)) * .138)); line-height: .84; letter-spacing: -.02em; /* "Tomar" fills the row even before the engine measures it */
}
.lines-live .n1 { color: transparent; }
/* the handle: the same face at a third of the size; live, it is cut out of the spiral (the name is lines, the handle is their absence) */
.n2 { display: inline-block; margin: .25em 0 0 .06em; font-family: var(--f-display); font-weight: 700; font-stretch: expanded; font-size: min(102px, calc((100vw - 2 * var(--pad)) * .047)); line-height: 1; letter-spacing: .01em; }
.lines-live .n2 { position: absolute; margin: 0; color: transparent; white-space: nowrap; }
/* the identity text lives on the rock; the engine cuts the cliff to fit it */
.hero-id { grid-column: 7 / -1; grid-row: 2; align-self: end; display: grid; gap: 10px; color: var(--g); padding: 6px 0 0; max-width: 46ch; }
html:not(.lines-live) .hero-id { background: var(--f); border-radius: 26px 26px 0 0; padding: 26px 28px; }
.hero-title { font-family: var(--f-display); font-weight: 460; font-stretch: 104%; font-size: clamp(17px, .7vw + 10px, 23px); line-height: 1.1; }
.hero-title strong { display: block; margin-bottom: 4px; font-size: 12px; }
.hero-handles { font-family: var(--f-data); font-size: 12.5px; line-height: 1.75; letter-spacing: .02em; }
.hero-handles strong, .hero-loc strong { font-size: 12px; }
.hero-loc { font-size: 13.5px; line-height: 1.5; }
@media (max-width: 760px) {
  .hero { padding-top: 92px; }
  .n1 { font-size: calc((100vw - 2 * var(--pad)) * .27); line-height: .9; font-stretch: normal; }
  .hero { min-height: 0; }
  .hero-name { margin-bottom: 2vh; }
  .hero-id { grid-column: 1 / -1; margin-top: 30vh; padding-top: 8px; }
}

/* ---------- about: a scanned head drawn in contour lines ---------- */
.about {
  min-height: 100svh;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
  align-items: center;
  padding: clamp(96px, 16vh, 180px) var(--pad) clamp(80px, 12vh, 140px);
}
.about-copy { grid-column: 1 / span 6; display: grid; gap: 22px; padding: clamp(18px, 2.4vw, 40px); max-width: 64ch; }
.about-copy h2 { margin-bottom: 8px; }
.about-copy p:first-of-type { font-size: 1.18em; line-height: 1.5; }
/* the head runs from the section's top to its end and off the right edge */
/* side by side, the canvas hangs 18vh past the section; the engine cuts it along the seam, so the torso runs to the section's edge */
.face-space {
  grid-column: 7 / -1; grid-row: 1; align-self: stretch; position: relative; min-height: 100svh;
  margin: calc(-1 * clamp(96px, 16vh, 180px)) calc(-1 * var(--pad)) calc(-1 * clamp(80px, 12vh, 140px) - 18vh) 0;
}
.about-copy { grid-row: 1; }
.face-space .model { -webkit-mask-image: linear-gradient(to right, transparent, #000 14%); mask-image: linear-gradient(to right, transparent, #000 14%); }
html:not(.lines-live) .face-space .model { -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
@media (max-width: 820px) {
  .about-copy { grid-column: 1 / -1; grid-row: 2; }
  .face-space { grid-column: 1 / -1; grid-row: 1; min-height: 0; height: min(112vw, 76svh); margin: calc(-1 * clamp(96px, 16vh, 180px)) calc(-1 * var(--pad)) 0; }
  .face-space .model { -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
}

/* ---------- faq: a fist has dragged the top of a sheet of lines down; the heading hangs in the night it uncovered,
   the questions sit on the sheet either side of the arm ---------- */
.faq {
  min-height: 104svh;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto auto minmax(0, 1fr);
  column-gap: var(--gap); row-gap: clamp(22px, 3.4vh, 44px);
  padding: clamp(110px, 16vh, 190px) var(--pad) clamp(80px, 11vh, 140px);
}
.faq > h2 { grid-column: 3 / span 8; grid-row: 1; justify-self: center; text-align: center; margin-bottom: clamp(30px, 7vh, 100px); padding: 6px 18px; font-size: clamp(34px, 3.2vw + 12px, 96px); line-height: 1.02; }
.q { display: grid; align-content: start; align-self: start; gap: 12px; padding: clamp(18px, 1.8vw, 28px); }
.q p { font-size: .95em; }
.q1 { grid-column: 1 / span 4; grid-row: 2; }
.q2 { grid-column: 9 / span 4; grid-row: 2; }
.q3 { grid-column: 1 / span 4; grid-row: 3; }
.q4 { grid-column: 9 / span 4; grid-row: 3; }
/* --grip-y: where the fist sits, as a share of this box's height (read by the engine and by models.js) */
.hand-space { --grip-y: .26; position: relative; grid-column: 5 / span 4; grid-row: 2 / -1; min-height: 62svh; margin-bottom: calc(-1 * clamp(80px, 11vh, 140px)); }
@media (max-width: 900px) {
  .faq { grid-template-rows: none; min-height: 0; }
  .faq > h2 { grid-column: 1 / -1; justify-self: start; text-align: left; margin-bottom: 0; padding-left: 0; }
  .q, .q1, .q2, .q3, .q4 { grid-column: 1 / -1; grid-row: auto; }
  .hand-space { --grip-y: .42; grid-column: 1 / -1; grid-row: 2; height: 96vw; min-height: 0; margin: 0; }
}

/* ---------- case studies: seven landforms ---------- */
.cases {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: clamp(40px, 8vh, 100px);
  padding: clamp(120px, 18vh, 210px) var(--pad) clamp(100px, 14vh, 170px);
}
.cases-head { grid-column: 1 / span 6; display: grid; gap: 14px; padding: 18px 22px; justify-self: start; }
.cases-map { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: clamp(60px, 12vh, 150px); margin: 0; padding: 0; list-style: none; counter-reset: site; }
.cases-map li { counter-increment: site; padding: clamp(18px, 1.8vw, 28px); font-size: .98em; align-self: start; }
.cases-map li::before { content: counter(site); display: block; font-family: var(--f-num); font-size: clamp(64px, 7vw, 124px); line-height: .9; margin: 0 0 10px -4px; }
.cases-map li a { font-family: var(--f-display); font-size: clamp(21px, 1.5vw + 8px, 32px); line-height: 1.12; font-weight: 520; display: block; margin: 6px 0; text-decoration-thickness: 1px; text-wrap: balance; }
.cases-map li:nth-child(1) { grid-column: 2 / span 4; }
.cases-map li:nth-child(2) { grid-column: 8 / span 4; margin-top: 14vh; }
.cases-map li:nth-child(3) { grid-column: 4 / span 4; }
.cases-map li:nth-child(4) { grid-column: 9 / span 4; margin-top: 6vh; }
.cases-map li:nth-child(5) { grid-column: 1 / span 4; }
.cases-map li:nth-child(6) { grid-column: 6 / span 4; margin-top: 16vh; }
.cases-map li:nth-child(7) { grid-column: 3 / span 5; }
@media (max-width: 900px) {
  .cases-head { grid-column: 1 / -1; }
  .cases-map li:nth-child(n) { grid-column: 1 / span 11; margin-top: 0; }
  .cases-map li:nth-child(even) { grid-column: 2 / span 11; }
}

/* ---------- experience: growth rings, one band per month; a core sample across them reads as the timeline ---------- */
.exp {
  min-height: 100svh;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 0;
  align-content: start;
  padding: clamp(130px, 18vh, 210px) var(--pad) clamp(110px, 16vh, 180px);
}
.exp-head { grid-column: 1 / span 6; display: grid; gap: 14px; padding: 18px 22px; justify-self: start; }
.timeline { grid-column: 1 / -1; position: relative; height: 118px; margin: clamp(60px, 9vh, 96px) 0 clamp(44px, 7vh, 72px); border-radius: 28px; }
.tl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tl-year, .tl-now, .tl-role { position: absolute; font-family: var(--f-data); line-height: 1; white-space: nowrap; }
.tl-year, .tl-now { top: 12px; font-size: 15px; letter-spacing: .14em; transform: translateX(-50%); }
.tl-year:first-of-type { transform: translateX(-4px); }
.tl-now { transform: translateX(-100%); }
.tl-role { font-size: 12px; letter-spacing: .1em; }
.tl-year::before { content: attr(data-year); }
.tl-now::before, .tl-role::before { content: attr(data-label); }
html:not(.lines-live) .timeline { display: none; }
/* the two entries are the same size side by side */
.role { display: grid; align-content: start; gap: 16px; padding: clamp(20px, 2.2vw, 36px); align-self: stretch; }
.role p:first-of-type { font-family: var(--f-data); font-size: .92em; letter-spacing: .02em; }
.r1 { grid-column: 1 / span 6; }
.r2 { grid-column: 7 / span 6; }
@media (max-width: 900px) {
  .exp-head, .r1, .r2 { grid-column: 1 / -1; } .r2 { margin-top: 18px; }
  .timeline { margin: 56px 0 30px; }
}

/* ---------- projects: a bento, with drawings only where they say something ---------- */
.projects {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap);
  padding: clamp(130px, 18vh, 210px) var(--pad) clamp(110px, 14vh, 170px);
}
.proj-head { grid-column: 1 / span 6; display: grid; gap: 14px; padding: 18px 22px; justify-self: start; margin-bottom: clamp(20px, 5vh, 60px); }
.proj { display: flex; flex-direction: column; gap: 12px; padding: clamp(18px, 1.7vw, 28px); min-width: 0; }
.proj h3 { font-size: clamp(20px, 1.2vw + 10px, 28px); }
.proj p { font-size: .95em; }
.proj p:first-of-type { font-family: var(--f-data); font-size: .8em; }
.emblem { display: block; width: 100%; height: clamp(150px, 13vw, 210px); margin-bottom: 6px; }
.p1 { grid-column: 1 / span 4; }
.p2 { grid-column: 5 / span 4; }
.p3 { grid-column: 9 / span 4; }
.p4 { grid-column: 1 / span 8; grid-row: span 2; }
.p4 .emblem { flex: 1; min-height: clamp(220px, 24vw, 420px); }
.p5 { grid-column: 9 / span 4; }
.p6 { grid-column: 9 / span 4; }
.p7 { grid-column: 1 / span 8; grid-row: span 2; }
.p7 .emblem { flex: 1; min-height: clamp(220px, 22vw, 380px); }
.p8 { grid-column: 9 / span 4; }
.p9 { grid-column: 9 / span 4; }
.proj:not(.has-art) h3 { font-size: clamp(22px, 1.4vw + 10px, 32px); }
.proj:not(.has-art) { justify-content: flex-end; }
@media (max-width: 1100px) {
  .p1, .p2, .p3, .p5, .p6, .p8, .p9 { grid-column: span 6; grid-row: auto; }
  .p4, .p7 { grid-column: 1 / -1; grid-row: auto; }
  .p4 .emblem, .p7 .emblem { min-height: 240px; }
}
@media (max-width: 640px) { .proj-head, .proj:nth-child(n) { grid-column: 1 / -1; } }

/* ---------- publication: counted lines on ink ---------- */
.pub {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 40px;
  padding: clamp(130px, 18vh, 200px) var(--pad) clamp(110px, 14vh, 170px);
}
.pub-head { grid-column: 1 / span 6; display: grid; gap: 14px; padding: 18px 22px; justify-self: start; }
.paper { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 18px; padding: clamp(22px, 3vw, 54px); }
.paper h3 { grid-column: 1 / span 9; font-size: clamp(26px, 2.6vw + 6px, 52px); line-height: 1.05; font-weight: 440; }
.paper > p { grid-column: 1 / span 8; }
.results { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 2vw, 34px); list-style: none; margin: 28px 0 0; padding: 0; }
.results li { font-size: .92em; line-height: 1.5; }
.figure { display: block; width: 100%; height: 168px; margin-bottom: 18px; }
@media (max-width: 1000px) { .results { grid-template-columns: repeat(2, minmax(0, 1fr)); } .paper h3, .paper > p { grid-column: 1 / -1; } }
@media (max-width: 560px) { .results { grid-template-columns: minmax(0, 1fr); } .pub-head { grid-column: 1 / -1; } }

/* ---------- marks of tools, drawn as lines by the engine (decoration only; hidden until it runs) ---------- */
.lics { display: none; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: auto; padding-top: 8px; }
.icons-on .lics { display: flex; }
.lic { display: block; width: 38px; height: 38px; flex: none; }
.lic-wide { width: auto; height: 30px; } /* wordmarks: the engine sets the width from the mark's own proportions */
html:not(.icons-on) .lic { display: none; }
.legend li { display: flex; flex-direction: column; }
.legend .lics { padding-top: 16px; }

/* ---------- skills: a clean grid; the terrain rises under what you point at ---------- */
.skills {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 40px;
  padding: clamp(130px, 18vh, 200px) var(--pad) clamp(110px, 16vh, 180px);
}
.skills-head { grid-column: 1 / span 6; display: grid; gap: 14px; padding: 18px 22px; justify-self: start; }
.legend { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin: 0; padding: 0; list-style: none; }
.legend li { padding: 22px 24px 24px; font-size: .94em; line-height: 1.6; }
.legend strong { display: block; margin: 0 0 10px; font-family: var(--f-display); font-weight: 520; font-stretch: 104%; font-size: clamp(20px, 1vw + 12px, 26px); line-height: 1.15; letter-spacing: 0; }
@media (max-width: 1000px) { .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .legend { grid-template-columns: minmax(0, 1fr); } .skills-head { grid-column: 1 / -1; } }

/* ---------- resume: a sheet beside the resume itself, drawn in lines ---------- */
.resume {
  min-height: 92svh;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
  align-items: center;
  padding: clamp(120px, 16vh, 180px) var(--pad);
}
.sheet { grid-column: 2 / span 5; grid-row: 1; display: grid; gap: 18px; padding: clamp(26px, 3vw, 52px); position: relative; }
.sheet::before, .sheet::after { content: ""; position: absolute; left: clamp(26px, 3vw, 52px); right: clamp(26px, 3vw, 52px); height: 9px; background: repeating-linear-gradient(180deg, currentColor 0 1px, transparent 1px 4px); opacity: .9; }
.sheet::before { top: 14px; }
.sheet::after { bottom: 14px; }
.sheet-link a { font-family: var(--f-display); font-size: clamp(24px, 2vw + 8px, 40px); font-weight: 520; }
/* the resume as a page drawn in lines; its corner peels back after the pointer and the page is the download */
.cv-page { grid-column: 7 / -1; grid-row: 1; justify-self: center; align-self: center; position: relative; display: block; width: min(100%, 50svh, 520px); aspect-ratio: .72; color: inherit; border-radius: 6px; }
.cv-page-art { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.cv-page .dl-icon { position: absolute; right: 12%; bottom: 12%; width: 18%; height: auto; }
.lines-live .cv-page .dl-icon { display: none; }
html:not(.lines-live) .cv-page { background: var(--g); outline: 1px solid currentColor; outline-offset: -8%; }
.cv-page:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 900px) { .sheet { grid-column: 1 / -1; grid-row: 2; } .cv-page { grid-column: 1 / -1; grid-row: 1; width: min(74vw, 380px); margin-bottom: 32px; } }

/* ---------- contact: a black hole made of lines ---------- */
/* narrow screens: the heading, then the hole in its own space, then the links */
.contact {
  position: relative; min-height: 114svh;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start;
  padding: clamp(140px, 20vh, 230px) var(--pad) clamp(90px, 12vh, 150px);
}
.contact-core { display: grid; align-content: start; justify-items: start; gap: 12px; z-index: 2; }
.contact-core h2 { font-size: clamp(30px, 6vw, 56px); line-height: 1.04; }
/* the gap is the hole's height; the engine sizes the hole from the same width (min(30vw, 150px) is its shadow's radius) */
.orbit { list-style: none; margin: calc(min(30vw, 150px) * 3.7) 0 0; padding: 0; display: grid; gap: 14px; justify-items: stretch; }
.orbit li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 14px 24px 14px 16px; font-size: 15px; line-height: 1.35; }
.orbit li a { overflow-wrap: anywhere; }
.orbit li .lic { grid-row: 1 / span 2; width: 40px; height: 40px; }
.orbit li strong { display: block; font-size: 12px; }
/* wide screens: the hole sits right of centre and its disk reaches left; the heading holds the top left, the links the
   bottom left, and the disk passes between them */
@media (min-width: 1000px) {
  .contact { min-height: 112svh; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto 1fr auto; column-gap: var(--gap); align-content: stretch; }
  .contact-core { grid-column: 1 / span 5; grid-row: 1; }
  .contact-core h2 { font-size: clamp(44px, 3.4vw + 10px, 112px); }
  .orbit { grid-column: 1 / span 5; grid-row: 3; margin: 0; justify-items: start; }
  .orbit li { width: max-content; max-width: 100%; }
}

/* ---------- footer: a night ocean under a barcode moon (night in both themes) ---------- */
.foot {
  min-height: 105svh;
  display: grid; align-content: end; justify-items: start; row-gap: 12px;
  padding: 280px var(--pad) clamp(28px, 5vh, 54px);
}
.foot hr { position: absolute; left: 0; right: 0; top: 52%; margin: 0; border: 0; height: 0; }
/* the barcode is the domain in Code 128 (start B, data, check "d", stop): it scans as human-in-loop.dev */
.foot::after, .foot::before { position: absolute; right: var(--pad); pointer-events: none; color: var(--f); white-space: nowrap; }
/* both stand on the water line (--hz, set by the engine; 52% without it) */
.foot::after { content: "\CC human-in-loop.devd\CE"; top: calc(var(--hz, 52%) - 34px - .61em); font-family: "Libre Barcode 128", monospace; font-size: clamp(46px, 5.6vw, 88px); line-height: 1; }
.foot::before { content: "human-in-loop.dev"; top: calc(var(--hz, 52%) - 12px - 1em); width: var(--code-w, auto); text-align: center; font-family: var(--f-data); font-size: clamp(12px, .5vw + 8px, 16px); letter-spacing: .3em; line-height: 1; }
html:not(.lines-live) .foot::after, html:not(.lines-live) .foot::before { color: var(--f); }
.foot p { padding: 14px 22px; }
.foot p:first-of-type { font-family: var(--f-display); font-size: clamp(22px, 2vw + 6px, 38px); line-height: 1.15; }
.foot p:first-of-type strong { font-family: inherit; font-size: inherit; letter-spacing: 0; font-weight: 520; }
/* credits for the models the About and FAQ drawings are made from: one small line, straight on the water, on the
   page's bottom edge; on narrow screens the model names drop out so it stays one line */
.foot p.credit { position: absolute; left: var(--pad); right: var(--pad); bottom: 0; margin: 0; padding: 0; font-size: 10px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.foot p.credit small { font-size: inherit; }
@media (max-width: 760px) { .foot p.credit { font-size: 9.5px; } .foot p.credit .opt { display: none; } }
/* narrow screens: the barcode and its domain stack at the top right, clear of the moon; the tiles sit in the water
   (the engine puts the horizon just above them) and there is sky above for the moon */
@media (max-width: 700px) {
  /* the barcode is 6.66 times its font size wide: it takes the width it has and never wraps */
  .foot { --bcs: min(54px, calc((100vw - 2 * var(--pad)) / 6.8)); padding-top: 310px; }
  .foot::after { top: 96px; bottom: auto; font-size: var(--bcs); }
  .foot::before { top: calc(96px + var(--bcs) * .64); bottom: auto; }
}

/* ---------- section headings: always a row of their own, about half the width on wide screens, so a tile never
   shares their row (a long heading was running into the first project between 640 and 1100 wide) ---------- */
.cases-head, .exp-head, .proj-head, .pub-head, .skills-head { grid-column: 1 / -1; max-width: max(50%, min(100%, 560px)); padding: clamp(24px, 2.2vw, 34px) clamp(22px, 2.2vw, 34px); }
/* never narrower than the heading's longest word ("Comprehensive" was running out of its tile) */
@media (min-width: 700px) { .cases-head, .exp-head, .proj-head, .pub-head, .skills-head { min-width: min-content; } }
