:root {
  --bg: #0d0e0b;
  --surface: #14150f;
  --line: #2a2a22;
  --line-strong: #45432f;
  --text: #cfc9b5;
  --strong: #f2ecd9;
  --muted: #a8a28e;
  --faint: #85806e;
  --accent: #ffb547;
  --accent-hover: #ffd28a;
  --btn-bg: var(--accent);
  --btn-fg: #0d0e0b;
  --shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3efe4;
  --surface: #fbf9f3;
  --line: #d8d1bf;
  --line-strong: #b9b19c;
  --text: #4a4638;
  --strong: #1c1b16;
  --muted: #5f5a4a;
  --faint: #6e6857;
  --accent: #8a4b00;
  --accent-hover: #5e3300;
  --btn-bg: #1c1b16;
  --btn-fg: #f3efe4;
  --shadow: 0 30px 60px rgba(60, 50, 20, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.6 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2 { margin: 0; font-family: var(--mono); color: var(--strong); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1440px; margin: 0 auto; padding-inline: 80px; }
.mono { font-family: var(--mono); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 14px; border-bottom: 1px solid var(--line); font: 14px var(--mono); }
.brand { font-weight: 700; }
.brand span { color: var(--faint); font-weight: 400; margin-left: 8px; }
.crumbs { display: flex; align-items: center; gap: 6px; }
.crumbs span { color: var(--faint); }
.crumbs b { color: var(--strong); font-weight: 400; }
.top nav { display: flex; gap: 32px; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; }
.status { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #7ccf6a; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--strong); cursor: pointer; }

/* hero */
.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; padding-block: 96px 80px; }
.hero-copy { display: flex; flex-direction: column; gap: 28px; }
.eyebrow { font: 14px var(--mono); letter-spacing: 0.08em; color: var(--muted); }
.hero h1 { font-size: 88px; line-height: 0.95; font-weight: 700; letter-spacing: -0.03em; }
.hero h1 span, .accent { color: var(--accent); }
.lede { margin: 0; font-size: 20px; max-width: 560px; }
.buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.btn { display: inline-flex; background: none; cursor: pointer; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--strong); font: 15px var(--mono); }
.btn.primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 700; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--strong); }
.btn.primary:hover { color: var(--btn-fg); opacity: 0.9; }

/* terminal: always dark, in both themes */
.term { background: #14150f; border: 1px solid #2f2f25; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); color: #cfc9b5; font: 15px/1.75 var(--mono); }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid #2a2a22; background: #191a13; font-size: 12px; color: #85806e; }
.term-bar i { width: 12px; height: 12px; border-radius: 50%; background: #3a3a2e; }
.term-bar i:last-of-type { margin-right: 12px; }
.term-out { padding: 20px 26px 0; height: 330px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out p { margin: 0; }
.term-out a { color: #ffb547; }
.term .p { color: #ffb547; }
.term .dir { color: #8fc7ff; }
.term .err { color: #ff8f7a; }
.term-in { display: flex; gap: 0.6ch; padding: 0 26px 20px; }
.term-in input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #f2ecd9; font: inherit; caret-color: #ffb547; }
.term:focus-within { border-color: #6b5a33; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips button { min-height: 44px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; color: var(--text); font: 13px var(--mono); cursor: pointer; }
.chips button:hover { border-color: var(--accent); color: var(--strong); }

/* sections */
.section { padding-block: 48px 80px; display: flex; flex-direction: column; gap: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font: 13px var(--mono); color: var(--faint); }
.section-head h2 { font-size: 28px; font-weight: 500; }
.section-head h2 span { color: var(--faint); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.card:hover { text-decoration: none; color: var(--text); border-color: var(--line-strong); }
.card-meta { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--faint); }
.card h3 { margin: 0; font: 700 22px var(--mono); color: var(--strong); }
.card p { margin: 0; flex: 1; font-size: 15px; }
.tags { display: flex; gap: 10px; font: 12px var(--mono); color: var(--muted); }
.tags span { padding: 4px 8px; }
.tags span:first-child { border: 1px solid var(--line-strong); border-radius: 3px; color: var(--accent); }

/* demos: screens are always dark, like the terminal */
.demos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.demo { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.screen-wrap { position: relative; background: #0a0b08; border: 1px solid #2f2f25; border-radius: 8px; overflow: hidden; }
.screen-wrap:focus-within { border-color: #ffb547; }
.screen { margin: 0; aspect-ratio: 2 / 1; min-height: 240px; padding: 20px 24px; overflow-y: auto; font: 15px/1.6 var(--mono); color: #9be08a; white-space: pre-wrap; overflow-wrap: anywhere; }
#basic:not(.on) .screen { color: #85806e; }
#basic.on .screen { cursor: text; }
.cursor { background: #9be08a; color: #0a0b08; }
.screen-wrap:not(:focus-within) .cursor { background: none; outline: 1px solid #9be08a; outline-offset: -1px; color: inherit; }
.map svg { display: block; width: 100%; height: auto; }
.map .grid { stroke: #1f2019; stroke-width: 0.4; fill: none; }
.map .track, .map .past { fill: none; stroke: #ffb547; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.map .past { stroke-dasharray: 4 5; opacity: 0.45; }
.map .sat { fill: #ffb547; stroke: #0a0b08; stroke-width: 0.8; }
.map:not(.on) .sat { display: none; }
.readout { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 16px; background: rgba(10, 11, 8, 0.8); font: 13px var(--mono); }
.readout div { display: flex; gap: 8px; }
.readout dt { color: #85806e; }
.readout dd { margin: 0; color: #f2ecd9; }
.demo-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: auto; }
.demo-foot b { display: block; font: 700 16px var(--mono); color: var(--strong); }
.demo-foot span { font-size: 14px; color: var(--muted); }
.demo-foot span span { color: inherit; font-size: inherit; }
.pick select { min-height: 44px; padding: 0 12px; background: var(--surface); color: var(--strong); border: 1px solid var(--line-strong); border-radius: 4px; font: 14px var(--mono); }

.log { list-style: none; margin: 0; padding: 0; font: 15px var(--mono); }
.log li { display: grid; grid-template-columns: 140px 240px minmax(0, 1fr); gap: 24px; padding-block: 16px; border-bottom: 1px dashed var(--line); }
.log .yr { color: var(--accent); }
.log b { color: var(--strong); }
.log span:last-child { font: 16px/1.5 var(--sans); }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding-block: 40px; border-top: 1px solid var(--line); font: 15px var(--mono); }
.foot > a { color: var(--strong); }
.foot nav { display: flex; gap: 28px; flex-wrap: wrap; }
.foot nav a { display: inline-flex; align-items: center; min-height: 44px; }

/* blog list (home) */
.posts { list-style: none; margin: 0; padding: 0; }
.posts a { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 14px 0; border-bottom: 1px dashed var(--line); color: var(--text); }
.posts a:hover { text-decoration: none; }
.posts a:hover .t { color: var(--accent); }
.posts time { font: 15px var(--mono); color: var(--accent); }
.posts .t { font-size: 18px; color: var(--strong); }
.posts .c { font: 12px var(--mono); color: var(--faint); text-align: right; }

/* blog post, attachment and résumé pages */
.post { max-width: 820px; margin: 0 auto; padding-block: 72px 0; }
.post-head { display: flex; flex-direction: column; gap: 20px; margin-bottom: 40px; }
.post-head h1 { font-size: 44px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
.post .featured { display: block; width: 100%; height: auto; margin-bottom: 40px; border: 1px solid var(--line); border-radius: 8px; }
.post + .back { max-width: 820px; margin-inline: auto; }
.post-content { font-size: 18px; line-height: 1.75; overflow-wrap: break-word; }
.post-content > * + * { margin-top: 1.1em; }
.post-content :where(p, ul, ol, pre, table, blockquote, figure) { margin-bottom: 0; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-family: var(--mono); color: var(--strong); line-height: 1.3; margin-top: 1.8em; }
.post-content h1 { font-size: 30px; }
.post-content h2 { font-size: 26px; font-weight: 500; }
.post-content h3 { font-size: 20px; font-weight: 500; }
.post-content h4 { font-size: 17px; font-weight: 500; }
.post-content > :first-child { margin-top: 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li + li { margin-top: 0.35em; }
.post-content li::marker { color: var(--accent); }
.post-content strong { color: var(--strong); font-weight: 600; }
.post-content hr { border: 0; border-top: 1px solid var(--line); margin-block: 2em; }
.post-content img { max-width: 100%; height: auto; border-radius: 6px; }
.post-content blockquote { margin-inline: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.post-content :not(pre) > code { font: 0.86em var(--mono); color: var(--strong); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.post-content pre, .txt-content { padding: 20px 24px; background: #0a0b08; border: 1px solid #2f2f25; border-radius: 8px; overflow-x: auto; font: 14px/1.6 var(--mono); color: #cfc9b5; white-space: pre; }
.post-content pre code { font: inherit; background: none; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.post-content th, .post-content td { padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.post-content th { font: 500 13px var(--mono); color: var(--strong); border-bottom-color: var(--line-strong); }
.video-embed { position: relative; aspect-ratio: 16 / 9; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }
.file-nav { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font: 14px var(--mono); }
.file-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.resume .post-content h1 { font-size: 44px; margin-top: 0; }
.resume .post-content h2 { padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* syntax highlighting: code blocks are always dark */
.hljs-comment, .hljs-quote, .hljs-meta { color: #85806e; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-built_in, .hljs-type, .hljs-link { color: #ffb547; }
.hljs-string, .hljs-symbol, .hljs-bullet, .hljs-attr, .hljs-addition, .hljs-template-tag, .hljs-template-variable, .hljs-selector-attr { color: #9be08a; }
.hljs-number, .hljs-regexp, .hljs-variable, .hljs-selector-id, .hljs-selector-class { color: #8fc7ff; }
.hljs-title, .hljs-name, .hljs-title.function_, .hljs-title.class_ { color: #f2ecd9; font-weight: 500; }
.hljs-deletion { color: #ff8f7a; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* project page */
.proj-hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; padding-block: 80px 56px; border-bottom: 1px solid var(--line); }
.proj-hero > div:first-child { grid-column: span 8; display: flex; flex-direction: column; gap: 24px; }
.proj-hero h1 { font-size: 96px; line-height: 0.95; letter-spacing: -0.03em; }
.proj-hero .lede { font-size: 24px; max-width: 760px; }
.proj-hero .buttons { grid-column: 1 / -1; }
.spec { grid-column: span 4; align-self: end; margin: 0; display: grid; grid-template-columns: 90px minmax(0, 1fr); row-gap: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font: 14px var(--mono); }
.spec dt { color: var(--faint); }
.spec dd { margin: 0; color: var(--strong); }
.prose { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; padding-block: 64px 0; }
.prose h2 { grid-column: span 4; font-size: 22px; font-weight: 500; }
.prose h2 span { color: var(--faint); }
.prose > div { grid-column: span 8; display: flex; flex-direction: column; gap: 18px; }
.prose p { margin: 0; line-height: 1.7; }
.prose pre { margin: 0; padding: 20px 24px; background: #0a0b08; border: 1px solid #2f2f25; border-radius: 8px; overflow-x: auto; font: 14px/1.6 var(--mono); color: #cfc9b5; }
.prose code { font-family: var(--mono); font-size: 0.88em; }
.prose :not(pre) > code { color: var(--strong); }
.prose ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 10px; line-height: 1.6; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--strong); font-weight: 600; }
.fig { margin: 64px 0 0; padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.fig figcaption { margin-bottom: 24px; font: 13px var(--mono); color: var(--faint); }
.fig svg { display: block; width: 100%; height: auto; font-family: var(--mono); }
.fig rect { fill: var(--bg); stroke: var(--line-strong); }
.fig rect.hl { stroke: var(--accent); }
.fig text { fill: var(--strong); font-size: 16px; text-anchor: middle; }
.fig text.sub { fill: var(--muted); font-size: 12px; }
.fig text.hl { fill: var(--accent); }
.fig .arrows { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.fig marker path { fill: var(--muted); }
.fig .shots { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.fig .shots img { display: block; width: 512px; max-width: 100%; height: auto; image-rendering: pixelated; outline: 1px solid var(--line); } /* native size keeps 1-bit pixels crisp */
.findings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.finding { display: flex; flex-direction: column; gap: 10px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 4px; }
.finding span { font: 12px var(--mono); color: var(--accent); }
.finding p { color: var(--strong); font-size: 16px; }
.note { color: var(--muted); font-size: 16px; }
.back { margin-top: 80px; padding-block: 40px; border-top: 1px solid var(--line); font: 24px var(--mono); }

@media (max-width: 1000px) {
  .wrap { padding-inline: 40px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 56px; gap: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demos { grid-template-columns: minmax(0, 1fr); }
  .log li { grid-template-columns: 110px minmax(0, 1fr); }
  .log span:last-child { grid-column: 2; }
  .posts a { grid-template-columns: 110px minmax(0, 1fr); }
  .posts .c { grid-column: 2; text-align: left; }
  .proj-hero > div:first-child, .spec, .prose h2, .prose > div { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding-inline: 20px; }
  .top { flex-wrap: wrap; gap: 0 16px; }
  .top { font-size: 13px; }
  .crumbs { gap: 4px; }
  .top nav:not(.crumbs) { order: 3; width: 100%; gap: 20px; }
  .status .tz, .status .dot, .section-head > span { display: none; }
  .hero { padding-block: 40px; }
  .hero h1 { font-size: 54px; }
  .lede { font-size: 17px; }
  .buttons { flex-direction: column; }
  .term { font-size: 13px; }
  .term-out { height: 260px; padding: 16px 14px 0; }
  .term-in { padding: 0 14px 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .screen { aspect-ratio: auto; height: 260px; padding: 14px; font-size: 13px; }
  .readout { position: static; padding: 10px 14px; font-size: 12px; }
  .demo-foot { flex-wrap: wrap; }
  .section-head h2 { font-size: 20px; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .log span:last-child { grid-column: 1; }
  .posts a { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .posts .c { grid-column: 1; }
  .post { padding-block: 40px 0; }
  .post-head h1, .resume .post-content h1 { font-size: 32px; }
  .post-content { font-size: 17px; }
  .post-content pre, .txt-content { padding: 14px; font-size: 13px; }
  .proj-hero h1 { font-size: 56px; }
  .proj-hero .lede { font-size: 19px; }
  .fig { padding: 20px; overflow-x: auto; }
  .fig svg { min-width: 640px; }
  .fig .shots img { image-rendering: auto; } /* downscaled: smoothing avoids dither moiré */
  .findings { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-direction: column; align-items: flex-start; }
}
