/* Hugo Richmond - portfolio. Dark only. */
:root {
  color-scheme: dark;
  --bg: #0d1012;
  --surface: #141a1d;
  --surface-2: #1a2125;
  --line: #273035;
  --line-soft: #1f272b;
  --text: #dbe1e4;
  --text-soft: #b4bec4;
  --muted: #84919a;
  --accent: #6cc3a0;        /* solder-mask green, desaturated */
  --accent-ink: #0c2a1f;
  --amber: #e2b04e;         /* status LED amber - warnings, "not yet" */
  --red: #e0705f;
  --blue: #7aa8de;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
  padding-inline: var(--gutter);
}
img, video, iframe { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #8fe0bd; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--sans); color: #eef2f4; text-wrap: balance; line-height: 1.2; }
h2 { font-size: 1.6rem; font-weight: 700; margin: 0 0 .9rem; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 2.2rem 0 .6rem; }
h4 { font-size: .95rem; font-weight: 700; margin: 1.6rem 0 .4rem; letter-spacing: .01em; }
p { margin: 0 0 1rem; }
strong { color: #eef2f4; font-weight: 600; }
code, kbd { font-family: var(--mono); font-size: .84em; background: var(--surface-2);
  border: 1px solid var(--line-soft); border-radius: 4px; padding: .05em .35em; color: #d6e6de; }
pre { font-family: var(--mono); font-size: .8rem; line-height: 1.55; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; margin: 0 0 1.2rem; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: #cfdad5; }
.eyebrow { font: 600 .74rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- site header / footer ---------- */
.site-head { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 18px; border-bottom: 1px solid var(--line-soft); font-family: var(--sans); flex-wrap: wrap; }
.site-head .name { font-weight: 800; letter-spacing: .02em; color: #eef2f4; text-decoration: none; }
.site-head nav { display: flex; gap: 18px; font-size: .9rem; flex-wrap: wrap; }
.site-head nav a { color: var(--text-soft); text-decoration: none; }
.site-head nav a:hover, .site-head nav a[aria-current] { color: var(--accent); }
.site-foot { max-width: 1180px; margin: 64px auto 0; padding-block: 22px 40px; border-top: 1px solid var(--line-soft);
  font: .82rem/1.6 var(--sans); color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- home ---------- */
.home { max-width: 1180px; margin: 0 auto; }
.intro { padding-block: clamp(48px, 9vw, 110px) clamp(32px, 5vw, 56px); max-width: 760px; }
.intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.025em; margin: .6rem 0 1rem; }
.intro p { font-size: 1.15rem; color: var(--text-soft); max-width: 58ch; }
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s; }
a.card:hover { border-color: #3a4a4f; transform: translateY(-2px); color: inherit; }
@media (prefers-reduced-motion: reduce) { a.card:hover { transform: none; } }
.card .shot { aspect-ratio: 4 / 3; background: #0a0d0e; overflow: hidden; }
.card .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.card h2 { font-size: 1.35rem; margin: 0; }
.card p { margin: 0; color: var(--text-soft); font-size: .98rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font: 500 .72rem/1 var(--mono); color: var(--text-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; }
.card.soon .shot { display: grid; place-items: center; background:
  repeating-linear-gradient(135deg, #12181b 0 10px, #151c1f 10px 20px); }
.card.soon .shot span { font: 600 .78rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------- paper layout ---------- */
.paper { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 56px; }
@media (max-width: 1080px) { .paper { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.article { min-width: 0; max-width: 780px; }
.article > section { padding-top: 46px; margin-top: 46px; border-top: 1px solid var(--line-soft); }
.article > section > p, .article > section > ul, .article > section > ol,
.article section h3 + p, .prose { max-width: var(--measure); }
.article ul, .article ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.article li { margin: .25rem 0; }
.secnum { font: 600 .8rem/1 var(--mono); color: var(--accent); display: block; margin-bottom: .55rem; letter-spacing: .04em; }

.title-block { padding-block: clamp(40px, 7vw, 80px) 8px; }
.title-block h1 { font-size: clamp(2.2rem, 5.4vw, 3.6rem); font-weight: 800; letter-spacing: -.025em; margin: .7rem 0 .8rem; }
.title-block .sub { font-size: 1.2rem; color: var(--text-soft); max-width: 60ch; margin-bottom: 1.2rem; }
.byline { font: .9rem/1.6 var(--sans); color: var(--muted); display: flex; gap: 6px 18px; flex-wrap: wrap; }
.byline strong { color: var(--text); font-weight: 600; }
.abstract { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; margin: 28px 0 0; }
.abstract p { margin: 0; max-width: none; }
.abstract .eyebrow { display: block; margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 22px 0 0; }
.facts div { background: var(--surface); padding: 14px 16px; font-family: var(--sans); }
.facts b { display: block; font: 700 1.05rem/1.25 var(--sans); color: #eef2f4; font-variant-numeric: tabular-nums; }
.facts span { font-size: .78rem; color: var(--muted); }

/* table of contents (top right on wide screens) */
.toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto;
  padding-top: clamp(40px, 7vw, 80px); font-family: var(--sans); }
.toc h2 { font: 600 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; font-size: .86rem; line-height: 1.35; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc .n { font-family: var(--mono); font-size: .74rem; opacity: .75; margin-right: 6px; }
.toc-toggle { display: none; }
@media (max-width: 1080px) {
  .toc { position: fixed; top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; left: 16px;
    max-height: 70vh; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 40px #000a; z-index: 20; }
  .toc[data-open="false"] nav { display: none; }
  .toc nav { padding: 14px 16px 16px; overflow-y: auto; max-height: calc(70vh - 48px); }
  .toc-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
    background: none; border: 0; color: var(--text); font: 600 .9rem/1 var(--sans); padding: 14px 16px; cursor: pointer; }
  .toc[data-open="false"] { left: auto; }
  .toc h2 { display: none; }
}

/* figures, media slots, diagrams */
figure { margin: 1.6rem 0 1.8rem; }
figcaption { font: .84rem/1.5 var(--sans); color: var(--muted); margin-top: 10px; max-width: var(--measure); }
figcaption b { color: var(--text-soft); font-weight: 600; }
.media { border-radius: 10px; overflow: hidden; background: #0a0d0e; border: 1px solid var(--line); }
.media img, .media video { display: block; width: 100%; height: auto; }
.media iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.media.slot { aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 20px;
  background: repeating-linear-gradient(135deg, #111719 0 12px, #13191c 12px 24px); }
.media.slot.tall { aspect-ratio: 3 / 4; }
.media.slot .slot-kind { font: 600 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.media.slot .slot-text { font: .9rem/1.45 var(--sans); color: var(--text-soft); margin-top: 8px; max-width: 40ch; }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.fig-row figure { margin: 0; }
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 560px; }
.diagram.narrow svg { min-width: 0; max-width: 520px; margin: 0 auto; }
svg .bx { fill: #182024; stroke: #33424a; stroke-width: 1.2; }
svg .bx-pi { fill: #13241e; stroke: #3e7a63; }
svg .bx-esp { fill: #1a1f2c; stroke: #4b6390; }
svg .bx-warn { fill: #2a2213; stroke: #8a6a2a; }
svg .bx-grp { fill: none; stroke: #2e3a40; stroke-dasharray: 5 4; }
svg text { font-family: "Archivo", Arial, sans-serif; fill: #dbe1e4; font-size: 13px; }
svg .t-s { font-size: 11px; fill: #9aa7af; }
svg .t-b { font-weight: 700; }
svg .t-acc { fill: #6cc3a0; }
svg .t-amb { fill: #e2b04e; }
svg .t-blu { fill: #8fb5e6; }
svg .t-mono { font-family: "JetBrains Mono", monospace; font-size: 11px; }
svg .ln { stroke: #6f7f88; stroke-width: 1.4; fill: none; }
svg .ln-acc { stroke: #6cc3a0; stroke-width: 1.6; fill: none; }
svg .ln-blu { stroke: #7aa8de; stroke-width: 1.6; fill: none; }
svg .ln-amb { stroke: #e2b04e; stroke-width: 1.6; fill: none; }
svg .ln-red { stroke: #e0705f; stroke-width: 2; fill: none; }
svg .dash { stroke-dasharray: 6 5; }
svg .fill-acc { fill: #6cc3a0; }
svg .fill-amb { fill: #e2b04e; }
svg .fill-red { fill: #e0705f; }
svg .fill-blu { fill: #7aa8de; }
svg .fill-txt { fill: #dbe1e4; }
svg .fill-bg { fill: #0d1012; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4rem; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font: .9rem/1.45 var(--sans); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td code { white-space: nowrap; }

/* call-outs and status pills */
.note { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 8px; padding: 14px 16px; margin: 0 0 1.3rem; max-width: var(--measure); font-size: .97rem; }
.note.warn { border-left-color: var(--amber); }
.note.fail { border-left-color: var(--red); }
.note > :last-child { margin-bottom: 0; }
.note .eyebrow { display: block; margin-bottom: 6px; }
.note.warn .eyebrow { color: var(--amber); }
.note.fail .eyebrow { color: var(--red); }
.pill { display: inline-block; font: 600 .7rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill.ok { color: var(--accent); border-color: #2f5e4c; background: #10231b; }
.pill.part { color: var(--amber); border-color: #6b5426; background: #231c0e; }
.pill.no { color: var(--muted); border-color: var(--line); background: var(--surface); }
.pill.fail { color: var(--red); border-color: #6b3a32; background: #24130f; }

/* equations */
.eq { margin: 1rem 0 1.2rem; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 8px; overflow-x: auto; max-width: var(--measure); }
.eq .katex-display { margin: .3rem 0; }
.katex { color: #e6ecef; font-size: 1.05em; }

/* timeline */
.timeline { list-style: none; padding: 0 !important; margin: 0 0 1.4rem; display: grid; gap: 14px; max-width: var(--measure); }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; margin: 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.timeline .when { font: 600 .8rem/1.4 var(--mono); color: var(--accent); }
.timeline p { margin: 0; font-size: .97rem; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 6px; } }

.back-top { font: .85rem var(--sans); }

/* ---------- update: smaller photos, video, hardware grid, code ---------- */
.article figure { max-width: 600px; }
.article figure.wide { max-width: none; }
.article figure.sm { max-width: 420px; }
.fig-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 1.4rem 0 1.6rem; }
.fig-row figure { max-width: none; }
.fig-row .media { aspect-ratio: 4 / 3; }
.fig-row .media img { width: 100%; height: 100%; object-fit: cover; }
.fig-row figcaption { font-size: .8rem; }
.media.slot { aspect-ratio: 16 / 9; }

.abstract.with-photo { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 22px; align-items: start; }
.abstract.with-photo .media { aspect-ratio: 3 / 4; }
.abstract.with-photo .media img { height: 100%; object-fit: cover; }
@media (max-width: 640px) { .abstract.with-photo { grid-template-columns: 1fr; } .abstract.with-photo .media { max-width: 240px; } }

.hw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 0 0 1.2rem; }
.hw-cat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.hw-cat h4 { margin: 0 0 8px; font: 700 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.hw-cat p { margin: 0 0 8px; font: .88rem/1.35 var(--sans); max-width: none; }
.hw-cat p:last-child { margin-bottom: 0; }
.hw-cat b { display: block; color: #eef2f4; font-weight: 600; }
.hw-cat span { color: var(--muted); font-size: .8rem; }
.small { font-size: .88rem; }

.diagram.paper-sheet { background: #f6f4ec; border-color: #d8d2c0; }
.diagram.paper-sheet svg { min-width: 900px; }
#odo, #sch { min-width: 720px; }

/* code blocks (Prism) */
pre[class*="language-"], pre { background: #10161a !important; border: 1px solid var(--line); border-radius: 8px;
  margin: 0 0 1.2rem; max-width: 640px; font-size: .78rem !important; }
code[class*="language-"], pre[class*="language-"] { font-family: var(--mono) !important; text-shadow: none !important; }
:not(pre) > code { white-space: nowrap; }
.article figure.sm .media { aspect-ratio: 4 / 3; }
.article figure.sm .media img { height: 100%; object-fit: cover; }
