/* Fonts (self-hosted, latin subset) */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(/fonts/plex-sans.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/plex-mono-400.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/plex-mono-500.woff2) format('woff2');
}

/* Tokens */
:root {
  --bg:     #0B0B0B;
  --ink:    #EDEDEA;
  --muted:  #8E8E89;
  --faint:  #4C4C49;
  --line:   #232322;
  --accent: #FFB800;
  --sans: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  color-scheme: dark;
  scrollbar-color: var(--faint) var(--bg);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
ol, ul { list-style: none; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.label {
  font: 400 .75rem/1.5 var(--mono);
  letter-spacing: .02em;
  color: var(--muted);
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font: 500 .9375rem/1 var(--mono);
  letter-spacing: .02em;
}
.logo svg { width: 18px; height: 18px; }
.site-nav { display: flex; gap: clamp(16px, 3vw, 32px); }
.site-nav a {
  font: 400 .8125rem/1 var(--mono);
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.site-nav a:hover { color: var(--ink); }

/* Hero */
.hero { padding: clamp(56px, 11vh, 128px) 0 clamp(72px, 12vh, 136px); }
h1 {
  font: 600 clamp(2.75rem, 7.4vw, 6.25rem)/1 var(--sans);
  letter-spacing: -.035em;
  max-width: 14ch;
  margin-top: 24px;
}
.lede {
  margin-top: 32px;
  max-width: 54ch;
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  color: var(--muted);
}
.lede a { color: var(--ink); text-decoration-color: var(--faint); text-underline-offset: 4px; }
.lede a:hover { text-decoration-color: var(--accent); }

/* Hash instrument */
.hasher {
  margin-top: clamp(64px, 10vh, 112px);
  border: 1px solid var(--line);
}
.hasher-head,
.hasher-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding: 12px 20px;
}
.hasher-head { border-bottom: 1px solid var(--line); }
.hasher-foot { border-top: 1px solid var(--line); align-items: baseline; }
.hasher-body { padding: 24px 20px 28px; }
.input-row {
  display: flex;
  align-items: baseline;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--faint);
  font: 500 clamp(1.5rem, 3.6vw, 2.5rem)/1.2 var(--mono);
  transition: border-color .2s;
}
.input-row:focus-within { border-bottom-color: var(--accent); }
.prompt { color: var(--accent); margin-right: 1ch; }
.hasher input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  caret-color: var(--accent);
}
.hasher input:focus { outline: none; }
.hasher input::placeholder { color: var(--faint); }
.digest {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  margin-top: 28px;
  font: 400 clamp(1rem, 2vw, 1.625rem)/1.6 var(--mono);
  color: var(--faint);
  user-select: all;
}
.digest span { text-align: center; transition: color .6s; }
.digest span.hot { color: var(--accent); transition: none; }
@media (max-width: 900px) { .digest { grid-template-columns: repeat(16, 1fr); } }
.hasher-foot p { font: 400 .8125rem/1.6 var(--mono); color: var(--muted); max-width: 64ch; }
.hasher-foot strong { color: var(--ink); font-weight: 500; }

/* Sections */
.section { border-top: 1px solid var(--line); padding: clamp(64px, 10vw, 120px) 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
h2 {
  font: 600 clamp(1.75rem, 3.4vw, 2.75rem)/1.05 var(--sans);
  letter-spacing: -.025em;
}

/* Focus areas and project log share the same row format */
.rows li {
  display: grid;
  grid-template-columns: 10ch 1fr 1.2fr;
  gap: 8px clamp(20px, 4vw, 48px);
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.rows li:last-child { border-bottom: 1px solid var(--line); }
.rows .id { font: 400 .8125rem/1.9 var(--mono); color: var(--faint); }
.rows h3 {
  font: 600 clamp(1.25rem, 2vw, 1.5rem)/1.25 var(--sans);
  letter-spacing: -.015em;
}
.rows p { color: var(--muted); max-width: 52ch; }
.rows .meta { font: 400 .8125rem/1.6 var(--mono); color: var(--muted); margin-top: 6px; }
.rows .links { display: flex; gap: 20px; margin-top: 10px; font: 500 .8125rem/1 var(--mono); }
.rows .links a { text-decoration: none; color: var(--accent); }
.rows .links a:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 800px) {
  .rows li { grid-template-columns: 1fr; }
}

/* Contact */
.contact { padding-bottom: clamp(80px, 14vw, 168px); }
.contact p { color: var(--muted); max-width: 54ch; margin-top: 20px; }
.mail {
  display: inline-block;
  margin-top: 40px;
  font: 600 clamp(2rem, 6.6vw, 5.5rem)/1 var(--sans);
  letter-spacing: -.035em;
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 3px no-repeat;
  padding-bottom: 8px;
  transition: background-size .35s ease, color .2s;
  overflow-wrap: anywhere;
}
.mail:hover, .mail:focus-visible { background-size: 100% 3px; color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 36px; }
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px 32px;
  flex-wrap: wrap;
  font: 400 .75rem/1.6 var(--mono);
  color: var(--muted);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Project write-ups */
.article { max-width: 760px; padding-top: clamp(48px, 8vh, 96px); padding-bottom: 96px; }
.article h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); max-width: none; margin-top: 16px; }
.article h2 { font-size: 1.5rem; margin-top: 48px; }
.article p { margin-top: 16px; }
.article p.label { margin-top: 32px; }
.article p.byline { margin-top: 16px; font: 400 .8125rem/1.6 var(--mono); color: var(--muted); }
.article p.byline a { color: var(--ink); text-decoration-color: var(--faint); }
.article .list pre { margin-top: 12px; }
.article a { text-underline-offset: 4px; }
.article h3 { font: 600 1.1875rem/1.3 var(--sans); margin-top: 32px; }
.article code { font: 400 .875em/1 var(--mono); }
.article .list { margin-top: 16px; }
.article .list li { position: relative; padding-left: 20px; margin-top: 10px; color: var(--muted); }
.article .list li::before { content: '–'; position: absolute; left: 0; color: var(--faint); }
.article .list strong { color: var(--ink); font-weight: 600; }
.table-wrap { margin-top: 20px; overflow-x: auto; }
.article table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.article th, .article td { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); }
.article th { font: 500 .75rem/1.5 var(--mono); color: var(--muted); }
.article td { color: var(--muted); }
.article td:first-child { color: var(--ink); white-space: nowrap; }
@media (max-width: 600px) {
  .article td:first-child { white-space: normal; min-width: 7rem; }
  .article table { font-size: .875rem; }
}
.article pre code { font-size: inherit; line-height: inherit; }
.article pre .del { color: #E5806B; }
.article pre .add { color: #8FCB7E; }
.article pre {
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  overflow-x: auto;
  font: 400 .875rem/1.6 var(--mono);
}

/* 404 */
.notfound {
  min-height: calc(100vh - 65px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 80px;
}
.notfound p:not(.label) { margin-top: 24px; color: var(--muted); }
