@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0d0c;
  --ink: #eef1ec;
  --text: #b8beb4;
  --muted: #858c82;
  --line: #222724;
  --accent: #7dd3a8;
  --tag-bg: rgba(125, 211, 168, .09);
  --tag-line: rgba(125, 211, 168, .22);
  --thumb-line: #2a302c;
  interpolate-size: allow-keywords;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #141714;
  --text: #3d443c;
  --muted: #5f675d;
  --line: #dde1da;
  --accent: #1d7149;
  --tag-bg: rgba(29, 113, 73, .07);
  --tag-line: rgba(29, 113, 73, .22);
  --thumb-line: #d3d8cf;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 "Hanken Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
ol, ul { list-style: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
strong, b { font-weight: 600; color: var(--ink); }

.skip { position: absolute; left: 16px; top: -60px; padding: 8px 12px; background: var(--ink); color: var(--bg); border-radius: 6px; z-index: 10; }
.skip:focus { top: 16px; }

.page { max-width: 680px; margin: 0 auto; padding: 120px 24px 72px; }

/* Theme toggle */
.theme {
  position: fixed; top: 20px; right: 20px; z-index: 5;
  display: grid; place-items: center; width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); cursor: pointer; transition: color .2s ease, border-color .2s ease;
}
.theme:hover { color: var(--ink); border-color: var(--muted); }
.theme svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .i-sun, :root[data-theme="light"] .i-moon { display: none; }

/* Intro */
.intro { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 28px; align-items: center; }
.avatar { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.role { margin-top: 6px; font-size: 17px; line-height: 1.5; color: var(--text); }
.where { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 14.5px; color: var(--muted); }
.where a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--tag-line); text-underline-offset: 3px; }
.where a:hover { text-decoration-color: currentColor; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 14px; font-size: 15px; font-weight: 500; }
.links a { display: inline-flex; align-items: center; gap: 3px; min-height: 32px; color: var(--ink); transition: color .2s ease; }
.links a:hover { color: var(--accent); }
.arrow { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .6; transition: transform .2s ease, opacity .2s ease; }
a:hover > .arrow { transform: translate(1.5px, -1.5px); opacity: 1; }

/* Sections */
main > section { margin-top: 104px; }
main > section > h2 { margin-bottom: 30px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.prose { display: grid; gap: 16px; max-width: 62ch; font-size: 16.5px; }

/* Rows: label column + content */
.rows { display: grid; gap: 44px; }
.row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 4px 28px; }
.when { padding-top: 2px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
h3 { font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--ink); }
h3 .at { font-weight: 400; color: var(--muted); }
h3 .at::before { content: "· "; }
h3 a { display: inline-flex; align-items: center; gap: 4px; transition: color .2s ease; }
h3 a:hover { color: var(--accent); }
.row p { margin-top: 6px; max-width: 60ch; font-size: 15.5px; }

.results { display: grid; gap: 4px; margin-top: 14px; font-size: 15px; color: var(--muted); }
.results b { display: inline-block; min-width: 92px; margin-right: 10px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags li { padding: 3px 10px; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--accent); background: var(--tag-bg); border: 1px solid var(--tag-line); border-radius: 999px; }

/* Projects: thumbnail in the label column */
.thumb { display: block; overflow: hidden; border: 1px solid var(--thumb-line); border-radius: 6px; aspect-ratio: 16 / 10; align-self: start; margin-top: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .5s cubic-bezier(.16, 1, .3, 1), opacity .3s ease; opacity: .88; }
a.thumb:hover img { transform: scale(1.04); opacity: 1; }

/* Disclosure */
.more { margin-top: 12px; }
.more summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; list-style: none;
  transition: color .2s ease;
}
.more summary::-webkit-details-marker { display: none; }
.more summary:hover, .more[open] summary { color: var(--ink); }
.chev { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.more[open] .chev { transform: rotate(180deg); }
.more::details-content { height: 0; overflow: clip; opacity: 0; transition: height .35s cubic-bezier(.16, 1, .3, 1), opacity .25s ease, content-visibility .35s allow-discrete; }
.more[open]::details-content { height: auto; opacity: 1; }
.more > p { max-width: 60ch; padding: 4px 0 6px; font-size: 15px; }
section > .more > p { max-width: 62ch; }
.earlier { margin-top: 32px; }
.earlier .rows { padding-top: 24px; }

.steps { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px 18px; padding: 8px 0 4px; font-size: 15px; }
.steps dt { padding-top: 2px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* Label/value pairs */
.pairs { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px 28px; font-size: 15.5px; }
.pairs dt { color: var(--muted); font-size: 14px; padding-top: 1px; }
.contact { margin-top: 28px; }
.contact a { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); transition: color .2s ease; }
.contact a:hover { color: var(--accent); }

.foot { margin-top: 120px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

@media (max-width: 640px) {
  .page { padding: 88px 20px 56px; }
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .avatar { width: 96px; height: 96px; }
  h1 { font-size: 27px; }
  main > section { margin-top: 80px; }
  .row { grid-template-columns: 1fr; }
  .row.project .thumb { margin: 0 0 12px; }
  .pairs { grid-template-columns: 96px minmax(0, 1fr); gap: 10px 16px; }
  .steps { grid-template-columns: 1fr; gap: 2px; }
  .steps dd { margin-bottom: 10px; }
  .results b { min-width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::details-content { transition-duration: 0s !important; }
}

/* Fixes after first render */
.row > .when { margin-top: 0; padding-top: 1px; }
.results li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.results b { min-width: 0; margin-right: 0; }
@media (max-width: 640px) {
  .results li { grid-template-columns: 76px minmax(0, 1fr); }
}

/* Justified body copy: paragraphs fill the column so right edges line up */
.prose p, p.prose, .row p:not(.when), .more > p, .steps dd {
  max-width: none;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
}
/* Same right edge in every section; hyphenate only on narrow screens */
.prose, section > .more > p { max-width: none; }
section > .more > p { text-align: justify; }
.prose p, p.prose, .row p:not(.when), .more > p, .steps dd { hyphens: manual; -webkit-hyphens: manual; }
.steps { grid-template-columns: 1fr; gap: 2px; }
.steps dd { margin-bottom: 12px; }
.steps dd:last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .prose p, p.prose, .row p:not(.when), .more > p, .steps dd { hyphens: auto; -webkit-hyphens: auto; }
}

/* ===== Sub pages: top bar, Writing list, articles ===== */
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.topbar { display: flex; align-items: center; gap: 20px; max-width: 680px; margin: 0 auto; padding: 32px 24px 0; }
.home { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; font-size: 15px; font-weight: 600; color: var(--ink); }
.mini-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.topnav { display: flex; gap: 18px; font-size: 14.5px; }
.topnav a { display: inline-flex; align-items: center; gap: 3px; min-height: 40px; color: var(--muted); transition: color .2s ease; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); }
.theme-inline { position: static; flex: none; }

.page-sub { padding-top: 72px; }
.sub-head h1 { font-size: 30px; }
.sub-head p { margin-top: 10px; font-size: 16.5px; color: var(--text); }
.sub-head + .rows { margin-top: 56px; }
.row-title { font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.row-title a { display: inline-flex; align-items: center; gap: 4px; transition: color .2s ease; }
.row-title a:hover { color: var(--accent); }
.row p.row-meta { margin-top: 2px; font-size: 13.5px; color: var(--muted); text-align: left; }
.row[hidden] { display: none; }

.site-foot { max-width: 680px; margin: 0 auto; padding: 0 24px 56px; }
.site-foot .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.site-foot .foot a { color: var(--muted); transition: color .2s ease; }
.site-foot .foot a:hover { color: var(--ink); }

/* Article shell */
.article-main { padding: 0 24px; }
.reading-index { display: none; }
.article { max-width: 632px; margin: 0 auto; padding: 72px 0 24px; }
.a-back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 20px; font-size: 14px; color: var(--muted); transition: color .2s ease; }
.a-back:hover { color: var(--ink); }
.article h1 { font-size: 32px; line-height: 1.18; font-weight: 600; letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
.article .a-sub { margin: 14px 0 0; font-size: 18px; line-height: 1.6; color: var(--text); text-align: left; }
.article .a-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 14px 0 0; font-size: 13.5px; color: var(--muted); text-align: left; }
.a-hero { display: block; width: 100%; height: auto; margin: 36px 0; border: 1px solid var(--thumb-line); border-radius: 8px; background: #000; }

.article p { margin: 0 0 20px; font-size: 16.5px; line-height: 1.75; text-align: justify; hyphens: manual; }
.article .lead { font-size: 18px; line-height: 1.7; color: var(--ink); }
.article strong { color: var(--ink); font-weight: 600; }
.article blockquote { margin: 32px 0 36px; padding: 2px 0 2px 20px; border-left: 1px solid var(--accent); font-size: 19px; line-height: 1.6; color: var(--ink); }
.article h2 { margin: 60px 0 16px; font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; color: var(--ink); scroll-margin-top: 24px; }
.article h2:focus { outline: none; }
.article h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.article > ul { margin: 0 0 24px; padding-left: 20px; list-style: disc; }
.article > ul li { padding-left: 4px; font-size: 16px; line-height: 1.7; }
.article > ul li + li { margin-top: 10px; }
.article > ul li::marker { color: var(--muted); }
.inline-link { color: var(--accent); text-decoration: underline; text-decoration-color: var(--tag-line); text-underline-offset: 3px; }

.a-figure { margin: 32px 0; }
.a-figure > img { width: 100%; border: 1px solid var(--thumb-line); border-radius: 8px; }
.a-figure figcaption, .strobe-gallery-slide figcaption { margin-top: 10px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.architecture-frame { overflow: hidden; border: 1px solid var(--thumb-line); border-radius: 8px; background: #020617; }
.architecture-frame iframe { display: block; width: 100%; height: clamp(270px, calc(51vw + 80px), 460px); border: 0; background: #020617; }
.architecture-frame img { width: 100%; background: #020617; }
.callout { margin: 28px 0; padding: 16px 20px; border: 1px solid var(--tag-line); border-radius: 8px; background: var(--tag-bg); font-size: 15px; line-height: 1.7; }

/* Strobe gallery */
.strobe-gallery { margin: 32px 0; overflow: hidden; border: 1px solid var(--thumb-line); border-radius: 8px; }
.strobe-gallery:focus-visible { outline-offset: 4px; }
.strobe-gallery-viewport { overflow: hidden; touch-action: pan-y; }
.strobe-gallery-track { display: flex; transition: transform .45s cubic-bezier(.16, 1, .3, 1); }
.strobe-gallery-slide { flex: 0 0 100%; min-width: 100%; }
.strobe-gallery-slide img { width: 100%; user-select: none; }
.strobe-gallery-slide figcaption { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line); }
.strobe-gallery-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.strobe-gallery-arrow { display: grid; place-items: center; width: 36px; height: 36px; flex: none; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; transition: color .2s ease, border-color .2s ease; }
.strobe-gallery-arrow:hover { color: var(--ink); border-color: var(--muted); }
.strobe-gallery-dots { display: flex; align-items: center; }
.strobe-gallery-dot { position: relative; width: 24px; height: 36px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.strobe-gallery-dot::after { content: ""; position: absolute; top: 15px; left: 9px; width: 6px; height: 6px; border-radius: 3px; background: var(--muted); transition: width .25s ease, left .25s ease, background-color .25s ease; }
.strobe-gallery-dot[aria-pressed="true"]::after { left: 4px; width: 16px; background: var(--accent); }
.strobe-gallery-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Upload workflow */
.article .upload-flow { margin: 28px 0 8px; padding: 0; list-style: none; }
.article .upload-flow-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding-bottom: 22px; }
.upload-flow-index { padding-top: 1px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.article .upload-flow-content p { margin: 0 0 8px; font-size: 15.5px; line-height: 1.7; }
.upload-flow-service, .chip { display: inline-block; padding: 3px 10px; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--accent); background: var(--tag-bg); border: 1px solid var(--tag-line); border-radius: 999px; }

/* Decisions and chips */
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin: 20px 0 28px; }
.decision { padding-top: 14px; border-top: 1px solid var(--line); }
.article .decision p { margin: 0; font-size: 15px; line-height: 1.65; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }

/* Calls to action */
.a-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 44px; }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14.5px; font-weight: 500; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.btn-primary { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); }

/* Contents: native disclosure below the intro; sticky index on wide screens */
.mobile-toc { margin: 24px 0 0; border-block: 1px solid var(--line); }
.mobile-toc summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; list-style: none; }
.mobile-toc summary::-webkit-details-marker { display: none; }
.mobile-toc summary .icon { transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.mobile-toc[open] summary .icon { transform: rotate(180deg); }
.mobile-toc ol { padding: 0 0 12px; list-style: none; }
.mobile-toc a { display: block; padding: 6px 0; font-size: 14px; color: var(--muted); }
.mobile-toc a:hover { color: var(--ink); }

@media (min-width: 1180px) {
  .reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 632px) minmax(0, 1fr); column-gap: 48px; }
  .article { grid-column: 2; grid-row: 1; width: 100%; }
  .reading-index { display: block; grid-column: 1; grid-row: 1; justify-self: end; align-self: start; position: sticky; top: 40px; width: 200px; margin-top: 168px; }
  .reading-index .label { margin-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .reading-index ol { list-style: none; border-left: 1px solid var(--line); }
  .reading-index a { display: block; padding: 5px 0 5px 14px; font-size: 13.5px; line-height: 1.45; color: var(--muted); transition: color .2s ease; }
  .reading-index a:hover { color: var(--ink); }
  .mobile-toc { display: none; }
}

@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 20px 20px 0; }
  .home span, .home { font-size: 14.5px; }
  .topnav { gap: 12px; font-size: 14px; }
  .topnav a:first-child { display: none; }
  .article-main { padding: 0 20px; }
  .article { padding-top: 48px; }
  .article h1 { font-size: 27px; }
  .article .a-sub { font-size: 17px; }
  .article p { font-size: 16px; hyphens: auto; -webkit-hyphens: auto; }
  .article .lead { font-size: 17px; }
  .article h2 { margin-top: 48px; font-size: 19px; }
  .decision-grid { grid-template-columns: 1fr; }
  .page-sub { padding-top: 48px; }
  .site-foot { padding: 0 20px 48px; }
  .strobe-gallery-controls { flex-wrap: wrap; }
  .strobe-gallery-status { order: 4; flex: 1 0 100%; text-align: center; }
}
@media (max-width: 400px) {
  .home { font-size: 0; gap: 0; }
  .home .mini-avatar { width: 32px; height: 32px; }
}

/* Binary field behind the home intro */
:root { --bits: rgba(238, 241, 236, .085); }
:root[data-theme="light"] { --bits: rgba(20, 23, 20, .085); }
.bits {
  position: absolute; top: 0; left: 0; z-index: 0;
  width: 100%; height: 620px;
  pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 100%);
  animation: bits-in 1.4s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes bits-in { from { opacity: 0; } to { opacity: 1; } }
.page { position: relative; z-index: 1; }
@media (max-width: 640px) { .bits { height: 520px; } }
@media (prefers-reduced-motion: reduce) { .bits { animation: none; } }

/* Larger portrait */
.intro { grid-template-columns: 176px minmax(0, 1fr); gap: 36px; }
.avatar { width: 176px; height: 176px; }
@media (max-width: 640px) {
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .avatar { width: 128px; height: 128px; }
}
.where .where-note { flex-basis: 100%; padding-left: 15px; }

/* Daylight: cooler, teal-leaning green */
:root[data-theme="light"] { --accent: #0a7a66; --tag-bg: rgba(10, 122, 102, .07); --tag-line: rgba(10, 122, 102, .24); }

/* Daylight: a touch greyer, neutral rather than green-tinted */
:root[data-theme="light"] {
  --bg: #efefed;
  --text: #3c403b;
  --muted: #5a5f59;
  --line: #d9dad6;
  --thumb-line: #d2d3cf;
  --accent: #087262;
  --tag-bg: rgba(8, 114, 98, .07);
  --tag-line: rgba(8, 114, 98, .24);
}

/* RAGcat: linked hero, narrow portrait figure, project links */
.a-hero-link { display: block; margin: 36px 0; border-radius: 8px; }
.a-hero-link .a-hero { margin: 0; transition: opacity .3s ease; }
.a-hero-link:hover .a-hero { opacity: .92; }
.a-figure-narrow > img { max-width: 340px; }
.row .row-links { margin-top: 10px; font-size: 14.5px; }

/* Tag lists fold after five; the toggle reads as a quieter pill than the tags */
.tags.is-folded > li:nth-child(n+6):not(.tags-more) { display: none; }
.tags .tags-more { padding: 0; background: none; border: 0; }
.tags-more button {
  position: relative; padding: 3px 10px; font: inherit; font-size: 12.5px; font-weight: 500; line-height: 1.5;
  color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.tags-more button::after { content: ""; position: absolute; inset: -8px -4px; }
.tags-more button:hover { color: var(--ink); border-color: var(--muted); }
.tags-more button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
