/* Ali Husain — portfolio. Hand-written, no build step. */

@font-face { font-family: "Newsreader"; src: url("fonts/newsreader.woff2") format("woff2"); font-style: normal; font-weight: 300 600; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-italic.woff2") format("woff2"); font-style: italic; font-weight: 300 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-style: normal; font-weight: 400 650; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-style: normal; font-weight: 400 500; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #15120e;
  --bg-band: #1a1611;
  --surface: #1f1a15;
  --ink: #f2ebe1;
  --body: #cbc1b4;
  --muted: #988d80;
  --line: #2d2720;
  --line-strong: #4a4036;
  --edge: #7f7468;
  --accent: #d4733a;
  --accent-soft: #e6955f;
  --accent-wash: rgba(212, 115, 58, .10);
  --on-accent: #1b120b;
  --frame-fill: rgba(255, 236, 214, .018);
  --glow: rgba(212, 115, 58, .12);
  --grain-opacity: .05;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --section: clamp(88px, 11vw, 168px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3eee6;
    --bg-band: #ece5da;
    --surface: #fbf8f3;
    --ink: #1a1612;
    --body: #3b342c;
    --muted: #6b6157;
    --line: #ddd3c5;
    --line-strong: #c2b4a2;
    --edge: #988a7a;
    --accent: #a64a1c;
    --accent-soft: #a64a1c;
    --accent-wash: rgba(166, 74, 28, .07);
    --on-accent: #fff8f1;
    --frame-fill: rgba(120, 80, 40, .025);
    --glow: rgba(214, 120, 60, .16);
    --grain-opacity: .07;
    --shadow: 0 30px 60px -34px rgba(60, 35, 15, .35);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(min(980px, 120vw) 820px at 82% -60px, var(--glow), transparent 70%) no-repeat, var(--bg);
  color: var(--body);
  font: 400 1.0625rem/1.65 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .3 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 400; }
b, strong { color: var(--ink); font-weight: 600; }
cite { font-style: italic; }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); font-weight: 400; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 14px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -.12em; }

/* ---------- Masthead ---------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-top: 28px; padding-bottom: 28px;
  position: relative; z-index: 2;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font: 500 .95rem/1 var(--sans); letter-spacing: .01em; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.brand-mark path { fill: none; stroke: var(--accent); stroke-width: 4.4; stroke-linecap: round; stroke-linejoin: round; }
.masthead nav ul { display: flex; gap: clamp(18px, 2.6vw, 34px); align-items: center; }
.masthead nav a {
  font: 400 .78rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 8px 0;
  transition: color .2s ease;
}
.masthead nav a:hover { color: var(--ink); }
.masthead nav .nav-cta { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(48px, 9vw, 120px); padding-bottom: clamp(64px, 8vw, 112px); }
.kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: clamp(18px, 2.4vw, 30px); }
.kicker::before { content: ""; display: inline-block; width: 28px; height: 1px; background: var(--accent); vertical-align: .3em; margin-right: 14px; }
.hero-name {
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(4.1rem, 15.5vw, 13rem);
  line-height: .86;
  letter-spacing: -.035em;
  margin-left: -.05em;
  font-variation-settings: "opsz" 72;
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(32px, 6vw, 96px);
  margin-top: clamp(36px, 5vw, 64px); padding-top: clamp(28px, 3.5vw, 40px);
  border-top: 1px solid var(--line);
  align-items: start;
}
.hero-role { color: var(--ink); margin-bottom: 22px; }
.hero-role em { display: block; font: italic 400 clamp(1.7rem, 3.1vw, 2.6rem)/1.1 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.hero-role .rl { display: block; }
.hero-role .sep { font-style: normal; color: var(--accent-soft); margin: 0 .08em; }
.hero-lede { font-size: clamp(1.06rem, 1.35vw, 1.2rem); line-height: 1.6; max-width: 40em; color: var(--body); }
.hero-facts { display: grid; gap: 0; border-left: 1px solid var(--line); padding-left: clamp(20px, 2.5vw, 32px); }
.hero-facts > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.hero-facts > div:first-child { padding-top: 4px; }
.hero-facts > div:last-child { border-bottom: 0; }
.hero-facts dt { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.hero-facts dd { color: var(--ink); font-size: .98rem; line-height: 1.45; }

/* ---------- Buttons & links ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  font: 500 .95rem/1 var(--sans);
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.btn:hover { border-color: var(--ink); }
.btn .i { transition: transform .2s ease; }
.btn:hover .i { transform: translateX(2px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
@media (prefers-color-scheme: light) { .btn-primary:hover { background: #8f3e15; border-color: #8f3e15; } }

.link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-soft); text-decoration: none; font-weight: 500;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-soft) 40%, transparent);
  padding-bottom: 2px;
  transition: border-color .2s ease;
}
.link:hover { border-bottom-color: currentColor; }
.link-quiet { color: var(--body); border-bottom-color: var(--line-strong); }

/* ---------- Figures strip ---------- */
.figures { padding-bottom: clamp(24px, 4vw, 40px); }
.figures-cap { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.figures-list {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
}
.figures-list li { padding: 28px 24px 30px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.figures-list li:first-child { border-left: 0; padding-left: 0; }
.fig-n { font: 300 clamp(2.8rem, 4.6vw, 4.2rem)/.9 var(--serif); color: var(--ink); letter-spacing: -.03em; font-variant-numeric: lining-nums; font-variation-settings: "opsz" 72; }
.fig-unit { font-style: italic; font-size: .42em; letter-spacing: 0; color: var(--accent-soft); margin-left: .12em; }
.figs-inset { margin-left: calc(120px + 24px); margin-bottom: clamp(40px, 5vw, 64px); }
.figs-inset .fig-n { font-size: clamp(2.4rem, 3.6vw, 3.4rem); }
.ledger-inset { margin-left: calc(120px + 24px); margin-bottom: 0; }
.fig-l { font-size: .9rem; line-height: 1.4; color: var(--muted); max-width: 15em; }

/* ---------- Sections ---------- */
.section { padding-top: var(--section); }
.sec-head { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; margin-bottom: clamp(48px, 6vw, 80px); align-items: baseline; }
.sec-no { font-size: .8rem; letter-spacing: .14em; color: var(--accent-soft); padding-top: .4em; }
.sec-no::after { content: ""; display: inline-block; width: 40px; height: 1px; background: currentColor; opacity: .55; margin-left: 12px; vertical-align: .3em; }
.sec-head h2 { font: 400 clamp(2.4rem, 5vw, 4rem)/1.02 var(--serif); letter-spacing: -.022em; font-variation-settings: "opsz" 72; }
.role-meta { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.role-meta span { color: var(--accent-soft); margin: 0 .35em; }
.sec-intro { margin-top: 18px; max-width: 38em; font-size: clamp(1.02rem, 1.25vw, 1.14rem); color: var(--body); }

.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.title-lg { font: 400 clamp(2rem, 3.6vw, 3rem)/1.06 var(--serif); letter-spacing: -.018em; font-variation-settings: "opsz" 60; text-wrap: balance; }
.title-md { font: 400 clamp(1.8rem, 3vw, 2.5rem)/1.06 var(--serif); letter-spacing: -.015em; }
.byline { margin-top: 10px; color: var(--muted); font-size: .95rem; }
.stack { font-size: .76rem; line-height: 1.7; letter-spacing: .03em; color: var(--muted); }

/* ---------- Areas of expertise ---------- */
.areas {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  counter-reset: area;
}
.areas li {
  position: relative; display: flex; flex-direction: column;
  padding: 30px 24px 30px;
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.areas li:nth-child(5n+1) { border-left: 0; padding-left: 0; }
.areas li::before { content: ""; position: absolute; top: -1px; left: 0; width: 28px; height: 1px; background: var(--accent); transition: width .5s cubic-bezier(.2, .7, .2, 1); }
.areas li:not(:nth-child(5n+1))::before { left: 24px; }
.areas li:hover::before { width: 64px; }
.area-n { font-size: .74rem; letter-spacing: .12em; color: var(--accent-soft); margin-bottom: 22px; }
.areas h3 { font: 400 clamp(1.3rem, 1.6vw, 1.5rem)/1.12 var(--serif); letter-spacing: -.01em; margin-bottom: 12px; text-wrap: balance; }
.areas p { font-size: .9rem; line-height: 1.55; color: var(--muted); }
.area-proof {
  margin-top: auto; padding-top: 22px; align-self: flex-start;
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--body); text-decoration: none;
  transition: color .2s ease;
}
.area-proof span { color: var(--accent-soft); display: inline-block; transition: transform .2s ease; }
.area-proof:hover { color: var(--ink); }
.area-proof:hover span { transform: translateX(3px); }

/* ---------- Roles index ---------- */
.roles {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
  margin-left: calc(120px + 24px);
}
.roles li + li { border-left: 1px solid var(--line); }
.roles a { display: flex; flex-direction: column; height: 100%; padding: 26px 22px 28px; text-decoration: none; transition: background-color .25s ease; }
.roles li:first-child a { padding-left: 0; }
.roles a:hover { background: var(--accent-wash); }
.roles li:first-child a:hover { background: none; }
.role-n { font-size: .74rem; letter-spacing: .12em; color: var(--accent-soft); margin-bottom: 16px; }
.role-t { font: 400 1.32rem/1.15 var(--serif); color: var(--ink); letter-spacing: -.01em; margin-bottom: 16px; text-wrap: balance; }
.role-d { margin-top: auto; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Feature: homelab ---------- */
.feature { margin-left: calc(120px + 24px); }
.feature-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 72px); align-items: end; margin-bottom: clamp(36px, 4.5vw, 56px); }
.feature-lede { font-size: clamp(1.04rem, 1.3vw, 1.16rem); color: var(--body); }

.diagram {
  margin: 0 0 clamp(40px, 5vw, 64px);
  margin-left: calc(-1 * (120px + 24px));
  padding: clamp(20px, 3vw, 40px);
  background: var(--bg-band);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.diagram figcaption { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .76rem; letter-spacing: .03em; color: var(--muted); }
.diagram figcaption span { color: var(--accent-soft); margin-right: 10px; }

.dg { width: 100%; height: auto; overflow: visible; }
.dg-tall { display: none; }
.dg .frame { fill: var(--frame-fill); stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 2 5; stroke-linecap: round; }
.dg .box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.dg .box-strong { stroke: var(--edge); }
.dg .box-dash { fill: none; stroke-dasharray: 4 4; }
.dg .box-a { fill: var(--accent-wash); stroke: var(--accent); }
.dg .t { font: 600 15px var(--sans); fill: var(--ink); letter-spacing: -.005em; }
.dg .t-sm { font-size: 14px; }
.dg .s { font: 400 11.5px var(--mono); fill: var(--muted); }
.dg .s-note { fill: var(--body); }
.dg .s-edge { font-size: 11px; fill: var(--body); }
.dg .s-a { fill: var(--accent-soft); }
.dg .l { font: 500 10.5px var(--mono); letter-spacing: .12em; fill: var(--muted); }
.dg .l-a { fill: var(--accent-soft); }
.dg .e { fill: none; stroke: var(--edge); stroke-width: 1.3; stroke-linejoin: round; }
.dg .e-a { stroke: var(--accent); }
.dg .mk { fill: none; stroke: var(--edge); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.dg .mk-a { stroke: var(--accent); }

.feature-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px; }
.feature-foot .stack { max-width: 46em; }
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(28px, 4vw, 56px); margin-bottom: 36px; }
.ledger > div { padding: 22px 0 26px; border-top: 1px solid var(--line); }
.ledger dt { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); margin-bottom: 10px; }
.ledger dd { font-size: .98rem; line-height: 1.6; }

/* ---------- Project: Ethereal ---------- */
.project {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 88px);
  align-items: center;
  margin-top: clamp(88px, 10vw, 150px);
  padding-top: clamp(88px, 10vw, 150px);
  border-top: 1px solid var(--line);
  margin-left: calc(120px + 24px);
}
.project-first { margin-top: 0; padding-top: 0; border-top: 0; }
.project-shot { margin: 0; margin-left: calc(-1 * (120px + 24px)); }
.project-shot a { display: block; }
.project-shot img { border-radius: 16px; box-shadow: var(--shadow); }
.project-body > p:not(.eyebrow):not(.byline):not(.stack):not(.links) { margin-top: 22px; font-size: 1.04rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 28px 0; border-top: 1px solid var(--line); }
.facts li { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .92rem; color: var(--muted); line-height: 1.4; }
.facts b { display: block; font: 400 1.5rem/1.15 var(--serif); color: var(--ink); letter-spacing: -.01em; margin-bottom: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 14px 26px; margin-top: 26px; }

/* ---------- Index of other work ---------- */
.index { margin-top: clamp(88px, 10vw, 150px); border-top: 1px solid var(--line-strong); }
.index > li {
  display: grid; grid-template-columns: 120px minmax(0, 7fr) minmax(0, 4fr); gap: 24px clamp(28px, 4vw, 64px);
  padding: clamp(32px, 4vw, 48px) 0;
  border-bottom: 1px solid var(--line);
}
.idx { font-size: .8rem; letter-spacing: .12em; color: var(--accent-soft); padding-top: .55em; }
.idx-main h3 { font: 400 clamp(1.6rem, 2.4vw, 2.1rem)/1.1 var(--serif); letter-spacing: -.012em; }
.idx-main .byline { margin-top: 6px; margin-bottom: 16px; }
.idx-main > p:last-child { max-width: 40em; }
.idx-side { display: flex; flex-direction: column; gap: 18px; padding-top: 6px; }
.idx-stat span { display: block; font: 300 2.6rem/1 var(--serif); color: var(--ink); letter-spacing: -.02em; font-variation-settings: "opsz" 72; }
.idx-stat small { display: block; margin-top: 6px; font-size: .85rem; color: var(--muted); }

.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 7.2em minmax(0, 1fr) 3.4em; align-items: center; gap: 12px; font-size: .86rem; }
.bar-l { color: var(--ink); }
.bar-t { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar-t span { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--accent); border-radius: 3px; }
.bar + .bar .bar-t span { background: var(--edge); }
.bar-v { font-size: .78rem; color: var(--muted); text-align: right; }

.also { display: grid; grid-template-columns: 120px repeat(3, minmax(0, 1fr)); gap: 24px clamp(28px, 4vw, 56px); padding-top: clamp(32px, 4vw, 48px); }
.also-h { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: .2em; }
.also-4 { grid-template-columns: 120px repeat(4, minmax(0, 1fr)); margin-top: clamp(64px, 8vw, 112px); border-top: 1px solid var(--line); }
.also h4 { font: 600 .98rem/1.3 var(--sans); margin-bottom: 8px; }
.also p { font-size: .92rem; line-height: 1.6; color: var(--muted); }

/* ---------- Agents band ---------- */
.section-band {
  margin-top: var(--section);
  padding-bottom: var(--section);
  background: var(--bg-band);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.loop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); margin-left: calc(120px + 24px); counter-reset: loop; position: relative; }
.loop li { position: relative; padding-top: 28px; border-top: 1px solid var(--line-strong); }
.loop li::before { content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.loop-n { display: block; font: italic 300 2.8rem/1 var(--serif); color: var(--accent-soft); margin-bottom: 18px; }
.loop h3 { font: 400 1.6rem/1.15 var(--serif); margin-bottom: 10px; letter-spacing: -.01em; }
.loop p { font-size: .98rem; }

.agent-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  margin-top: clamp(56px, 7vw, 96px); margin-bottom: 32px;
  margin-left: calc(120px + 24px);
}
.agent-case { background: var(--bg-band); padding: clamp(24px, 3vw, 36px); display: flex; flex-direction: column; }
.agent-case > p:last-of-type { font-size: .95rem; color: var(--body); }
.agent-case-lg { grid-row: span 2; grid-column: span 2; background: var(--surface); }
.agent-case .eyebrow { margin-bottom: 18px; }
.agent-n { font: 300 clamp(3.4rem, 6vw, 5.4rem)/.9 var(--serif); color: var(--ink); letter-spacing: -.03em; margin-bottom: 20px; font-variation-settings: "opsz" 72; }
.agent-n span { font: italic 400 .32em/1 var(--serif); letter-spacing: 0; color: var(--accent-soft); margin-left: .15em; }
.agent-case:not(.agent-case-lg) .agent-n { font-size: clamp(2.6rem, 4vw, 3.4rem); margin-bottom: 14px; }
.agent-h { font: 400 1.5rem/1.15 var(--serif); color: var(--ink); margin-bottom: 12px; letter-spacing: -.01em; }
.agent-case-lg > p:last-of-type { font-size: 1.04rem; max-width: 30em; }
.agent-flow { display: flex; align-items: center; gap: 10px; margin-top: 36px; }
.af-dots { display: grid; grid-template-columns: repeat(3, 8px); gap: 5px; flex: none; }
.af-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .85; }
.af-line { flex: 1 1 12px; min-width: 12px; height: 1px; background: var(--line-strong); }
.af-step { flex: none; font-size: .7rem; letter-spacing: .08em; color: var(--body); border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 10px; }
.af-done { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.agent-meta { margin-top: auto; padding-top: 32px; display: grid; gap: 0; }
.agent-meta > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: .78rem; letter-spacing: .04em; }
.agent-meta dt { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; }
.agent-meta dd { color: var(--ink); }
#ai .stack { margin-left: calc(120px + 24px); }

/* ---------- Film ---------- */
.film { margin-left: calc(120px + 24px); margin-bottom: clamp(64px, 8vw, 112px); }
.film-text { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: baseline; margin-bottom: 28px; }
.film-text p { max-width: 40em; }
.plates { display: grid; gap: clamp(10px, 1.2vw, 16px); margin-left: calc(-1 * (120px + 24px)); }
.plate { margin: 0; position: relative; }
.plate img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; background: var(--surface); }
.plate figcaption {
  position: absolute; left: 14px; bottom: 12px;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: #f6eee3; background: rgba(20, 14, 9, .55); padding: 5px 9px; border-radius: 6px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.plates-bs { grid-template-columns: 2fr 1fr 1fr; aspect-ratio: auto; }
.plates-bs .plate:not(.plate-wide) img { position: absolute; inset: 0; }
.plates-sm { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.plates-sm .plate-hero { grid-row: span 2; }
.plates-sm .plate:not(.plate-hero) { aspect-ratio: 16 / 9; }
#media > .media-foot { margin-left: calc(120px + 24px); margin-top: -32px; }
.feature-foot .links { margin-top: 0; }
.links-inset { margin-left: calc(120px + 24px); margin-top: 30px; }
.case-link { margin-top: auto; padding-top: 20px; }
.case-link .link { font-size: .9rem; }
.post { margin-left: calc(120px + 24px); margin-bottom: clamp(72px, 9vw, 128px); }
.post .ledger { margin-bottom: 0; }
#ai { margin-top: clamp(72px, 8vw, 120px); }

/* ---------- Profile ---------- */
.profile { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(36px, 6vw, 96px); margin-left: calc(120px + 24px); }
.skills > div { display: grid; grid-template-columns: 11em minmax(0, 1fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.skills > div:last-child { border-bottom: 1px solid var(--line); }
.skills dt { color: var(--ink); font-weight: 500; font-size: .96rem; }
.skills dd { font-size: .96rem; color: var(--body); }
.profile-side { display: grid; gap: 44px; align-content: start; }
.edu h3 { font: 400 1.6rem/1.15 var(--serif); }
.edu .byline { margin-bottom: 14px; }
.edu > p:not(.eyebrow):not(.byline):not(.edu-note) { font-size: .95rem; }
.edu-note { margin-top: 12px; font-size: .88rem; color: var(--muted); }
.cert { color: var(--ink); font-size: 1.02rem; }
.cert span { display: block; margin-top: 4px; font-size: .88rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips li { font: 400 .8rem/1 var(--mono); letter-spacing: .04em; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 12px; }
.chips li:first-child { border-color: var(--accent); color: var(--accent-soft); }
.edu .cert { margin-top: 16px; }
.foundations { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px clamp(28px, 4vw, 56px); margin-top: clamp(64px, 8vw, 112px); padding-top: clamp(32px, 4vw, 48px); border-top: 1px solid var(--line); }
.foundations ul { columns: 3 15em; column-gap: clamp(28px, 4vw, 56px); }
.foundations li { break-inside: avoid; display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font: 400 clamp(1.08rem, 1.3vw, 1.22rem)/1.3 var(--serif); color: var(--ink); letter-spacing: -.005em; }
.foundations li::before { content: ""; flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .8; transform: translateY(-.2em); }
.foundations + .also-4 { margin-top: clamp(40px, 5vw, 64px); }

/* ---------- Contact ---------- */
.contact { margin-top: var(--section); padding: var(--section) 0 40px; border-top: 1px solid var(--line); position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: 50%; bottom: -380px; transform: translateX(-50%);
  width: min(1200px, 140vw); height: 700px;
  background: radial-gradient(closest-side, var(--glow), transparent);
}
.contact .sec-no { display: block; margin-bottom: 28px; }
.contact-h { font: 400 clamp(2.2rem, 5.2vw, 4.4rem)/1.04 var(--serif); letter-spacing: -.022em; max-width: 16em; font-variation-settings: "opsz" 72; }
.contact-sub { margin-top: 22px; max-width: 36em; font-size: 1.08rem; }
.contact-mail {
  display: inline-block; margin-top: clamp(40px, 5vw, 64px);
  font: italic 400 clamp(1.5rem, 4.2vw, 3.2rem)/1.15 var(--serif);
  color: var(--accent-soft); text-decoration: none; letter-spacing: -.01em;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-soft) 35%, transparent);
  padding-bottom: 4px; overflow-wrap: anywhere;
  transition: border-color .2s ease;
}
.contact-mail:hover { border-bottom-color: currentColor; }
.colophon {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 32px;
  margin-top: clamp(80px, 10vw, 140px); padding-top: 22px; border-top: 1px solid var(--line);
  font-size: .72rem; letter-spacing: .06em; color: var(--muted);
}
.colophon a { text-decoration: none; }
.colophon a:hover { color: var(--ink); }

/* ---------- Motion ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .btn .i, .link { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .feature, .project, .loop, .agent-grid, .film, .profile, .roles, .post, #ai .stack, #media > .media-foot, .links-inset { margin-left: 0; }
  .diagram, .project-shot, .plates { margin-left: 0; }
  .sec-head { grid-template-columns: 1fr; gap: 14px; }
  .index > li { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 18em); }
  .also { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .also-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .also-h { grid-column: 1 / -1; }
  .areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .areas li:nth-child(n) { border-left: 1px solid var(--line); padding-left: 24px; }
  .areas li:nth-child(odd) { border-left: 0; padding-left: 0; }
  .areas li:not(:nth-child(5n+1))::before { left: 24px; }
  .areas li:nth-child(odd)::before { left: 0; }
  .roles { grid-template-columns: 1fr; }
  .roles li:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .roles li:first-child { border-top: 0; }
  .roles li:nth-child(n) a { padding: 18px 0 20px; display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: baseline; gap: 4px 16px; }
  .roles a:hover { background: none; }
  .role-n { margin: 0; }
  .role-t { margin: 0; }
  .role-d { margin: 0; text-align: right; }
  .figs-inset, .ledger-inset { margin-left: 0; }
  .foundations { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 820px) {
  .masthead nav li:not(:last-child) { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-facts { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .hero-facts > div:first-child { padding-top: 14px; }
  .feature-head, .film-text { grid-template-columns: 1fr; gap: 18px; }
  .ledger { grid-template-columns: 1fr 1fr; }
  .project { grid-template-columns: 1fr; }
  .index > li { grid-template-columns: 1fr; gap: 14px; }
  .idx { padding-top: 0; }
  .also { grid-template-columns: 1fr; }
  .loop { grid-template-columns: 1fr; gap: 36px; }
  .agent-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .agent-case-lg { grid-row: auto; grid-column: 1 / -1; }
  .agent-case:last-child { grid-column: 1 / -1; }
  .figures-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures-list li:nth-child(3) { border-left: 0; padding-left: 0; }
  .figures-list li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .profile { grid-template-columns: 1fr; }
  .dg-wide { display: none; }
  .dg-tall { display: block; max-width: 460px; margin-inline: auto; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .masthead { padding-top: 20px; padding-bottom: 20px; }
  .hero { padding-top: 40px; }
  .hero-name { font-size: clamp(3.6rem, 19.5vw, 6rem); line-height: .9; }
  .kicker { font-size: .7rem; letter-spacing: .1em; }
  .kicker::before { width: 18px; margin-right: 10px; }
  .actions { gap: 10px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .actions .btn-primary { flex-basis: 100%; }
  .figures-list li { padding: 22px 16px 22px; }
  .figures-list li:nth-child(odd) { padding-left: 0; }
  .areas { grid-template-columns: 1fr; }
  .areas li:nth-child(n) { border-left: 0; padding: 24px 0 26px; }
  .areas li:nth-child(n)::before { left: 0; }
  .area-n { margin-bottom: 12px; }
  .area-proof { padding-top: 16px; }
  .roles li:nth-child(n) a { grid-template-columns: 3.6em minmax(0, 1fr); gap: 4px 12px; }
  .role-n { margin: .35em 0 0; grid-row: span 2; }
  .role-t { font-size: 1.3rem; }
  .role-d { text-align: left; }
  .also-4 { grid-template-columns: 1fr; }
  .post .ledger { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .post .ledger dd { font-size: .9rem; line-height: 1.5; }
  .diagram { padding: 14px 10px; border-radius: 14px; }
  .diagram figcaption { margin-inline: 6px; }
  .ledger { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
  .agent-flow { gap: 6px; }
  .af-line { min-width: 6px; }
  .af-step { padding: 4px 8px; font-size: .66rem; letter-spacing: .04em; }
  .plates-bs { grid-template-columns: 1fr 1fr; }
  .plates-bs .plate-wide { grid-column: 1 / -1; }
  .plates-sm { grid-template-columns: 1fr; grid-template-rows: auto; }
  .plates-sm .plate-hero { grid-row: auto; grid-column: 1 / -1; }
  .plate figcaption { left: 8px; bottom: 8px; font-size: .6rem; padding: 4px 7px; }
  #media > .media-foot { margin-top: -16px; }
  .skills > div { grid-template-columns: 1fr; gap: 4px; }
  .colophon { flex-direction: column; }
}

/* Large plates fill the row their neighbours define */
.plate-hero img { position: absolute; inset: 0; }
@media (max-width: 560px) {
  .plates-bs .plate:not(.plate-wide) { aspect-ratio: 3 / 4; }
  .plates-sm .plate-hero { aspect-ratio: 16 / 9; }
}
