/* ─────────────────────────────────────────────────────────────────
   DIRECTION B — Monospace technical
   Mono everywhere. Cool greys, sharp edges, no warmth.
   Karpathy/HN-personal-site energy. Dark mode also commits hard.
   ───────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --bg:       #fbfbfa;
  --bg-2:     #f1f1ef;
  --text:     #2a2a2c;
  --text-2:   #5c5c60;
  --text-3:   #98989c;
  --accent:   #a8385d;   /* desaturated magenta — still cold, not warm */
  --border:   #dedede;
  --code-bg:  #ececea;

  --serif: "Times New Roman", Times, serif; /* used only as a contrast accent */
  --sans:  "JetBrains Mono", "Berkeley Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --mono:  "JetBrains Mono", "Berkeley Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  --measure: 42rem;
}

* { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: 1.55rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.6rem; }
h3 { font-size: 1rem;    margin: 1.6rem 0 0.4rem; }

h2::before { content: "## "; color: var(--text-3); }
h3::before { content: "### "; color: var(--text-3); }

p  { margin: 1em 0; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}
a:hover { border-bottom-style: solid; }

em, i { font-style: italic; }
strong, b { font-weight: 700; color: var(--text); }

hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 1.8rem 0;
}

blockquote {
  margin: 1.2rem 0;
  padding: 0.3rem 0 0.3rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
  font-style: normal;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  color: var(--text);
}

pre {
  font-family: var(--mono);
  background: var(--code-bg);
  border: none;
  border-left: 3px solid var(--border);
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}
pre code { background: none; padding: 0; font-size: 1em; }

.lead {
  font-style: normal;
  color: var(--text-2);
  font-size: 0.95rem;
  margin-top: 0.4rem;
  line-height: 1.6;
}

.disclosure {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-3);
  font-style: normal;
  line-height: 1.5;
  margin: 1.5rem 0 0;
  padding: 0.6rem 0 0.6rem 1rem;
  border-left: 3px solid var(--border);
  background: transparent;
}
.disclosure::before { content: "// "; color: var(--text-3); }

.meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-3);
  margin: 0.5rem 0 2rem;
}
.meta span + span::before { content: " | "; }

.nav {
  font-family: var(--sans);
  font-size: 0.82rem;
  margin-bottom: 3rem;
}
.nav a {
  color: var(--text-2);
  border-bottom: none;
}
.nav a:hover { color: var(--accent); }

.section-title {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-weight: 700;
  margin: 2.2rem 0 0.8rem;
}
.section-title::before { content: "> "; color: var(--accent); }

.posts, .works { list-style: none; padding: 0; margin: 0; }
.posts li, .works li {
  padding: 0.65rem 0;
  border-bottom: 1px dashed var(--border);
}
.posts li:last-child, .works li:last-child { border-bottom: none; }

.posts .post-date {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-bottom: 0.1rem;
  letter-spacing: 0;
  text-transform: none;
}
.posts .post-date::before { content: "["; }
.posts .post-date::after { content: "]"; }
.posts .post-title {
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px dashed transparent;
  display: inline-block;
  margin-bottom: 0.2rem;
}
.posts .post-title:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.posts .post-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

.works .work-title {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px dashed transparent;
}
.works .work-title:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.works .work-meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-left: 0.5rem;
}
.works .work-meta::before { content: "// "; }
.works .work-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0.2rem 0 0;
  line-height: 1.5;
}

footer {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--border);
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-3);
}
footer p { margin: 0.3rem 0; }
footer a { color: var(--text-2); border-bottom: 1px dashed transparent; }
footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 640px) {
  html { font-size: 14px; }
  .container { padding: 1.8rem 1rem 3.5rem; }
}

/* Figures */
.fig { margin: 2rem 0; }
.fig svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1rem 0.6rem;
  box-sizing: border-box;
}
.fig figcaption {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 0.6rem;
  padding: 0;
  font-style: normal;
}
.fig figcaption::before { content: "fig // "; color: var(--accent); }

/* Walkthrough widget */
.walkthrough {
  font-family: var(--sans);
  margin: 2rem 0;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-2);
}
.wt-cap { display: flex; gap: 0.9rem; min-height: 70px; align-items: flex-start; }
.wt-tag {
  font-size: 0.72rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 2px 8px;
  flex-shrink: 0;
  background: var(--bg);
}
.wt-ttl { font-size: 0.95rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.wt-det { font-size: 0.82rem; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.wt-layer { opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.wt-layer.on { opacity: 1; pointer-events: auto; }
.wt-code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--bg);
  padding: 0.7rem 0.9rem;
  border-radius: 0;
  border: 1px solid var(--border);
  margin: 0.7rem 0;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}
.wt-ctrl { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.wt-ctrl button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
}
.wt-ctrl button:disabled { opacity: .35; cursor: default; }
.wt-ctrl button:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.wt-dots { display: flex; gap: 6px; }
.wt-dot {
  width: 6px; height: 6px; border-radius: 0;
  background: var(--border); cursor: pointer; transition: background .2s;
}
.wt-dot.on { background: var(--accent); }
.wt-svg-text { fill: var(--text); }
.wt-svg-text-2 { fill: var(--text-2); }
.wt-svg-text-3 { fill: var(--text-3); }

/* Mode card grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  margin: 1.8rem 0;
}
.mode-card {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  background: var(--bg-2);
}
.mode-card h4 {
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 0 0 0.2rem;
  font-weight: 700;
  color: var(--text);
}
.mode-card h4::before { content: "$ "; color: var(--accent); }
.mode-card .mode-sub {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
}
.mode-card .mode-sub::before { content: "// "; }
.mode-card p {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}
@media (max-width: 640px) {
  .mode-grid { grid-template-columns: 1fr; }
}

/* ─── Top nav (used on every page; primary navigation) ─── */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.88rem;
}
.topnav-name {
  color: var(--text);
  font-weight: 700;
  border-bottom: none;
  letter-spacing: -0.01em;
}
.topnav-name:hover { color: var(--accent); }
.topnav-links { display: flex; gap: 1.4rem; }
.topnav-links a {
  color: var(--text-2);
  border-bottom: 1px dashed transparent;
  padding-bottom: 2px;
}
.topnav-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.topnav-links a.active {
  color: var(--text);
  border-bottom: 1px solid var(--text);
}
@media (max-width: 540px) {
  .topnav { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .topnav-links { gap: 1rem; flex-wrap: wrap; }
}

/* ─── Featured block (homepage hero) ─── */
.featured {
  margin: 0 0 1.8rem;
  padding: 0;
}
.featured-tag {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.featured-date {
  font-size: 0.74rem;
  color: var(--text-3);
}
.featured-title {
  font-family: var(--sans);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 0.7rem;
}
.featured-title::before { content: none; }
.featured-title a {
  color: var(--text);
  border-bottom: none;
}
.featured-title a:hover { color: var(--accent); }
.featured-desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 0.8rem;
}
.featured-link {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
  border-bottom: 1px dashed var(--accent);
  display: inline-block;
}
.featured-link:hover { border-bottom-style: solid; }

.divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 1.8rem 0;
}

/* ─── Type badges ─── */
.badge {
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-article {
  color: var(--accent);
  border-color: var(--accent);
}
.badge-project {
  color: var(--text-2);
  border-color: var(--text-2);
}
.badge-paper {
  color: var(--text-3);
  border-color: var(--text-3);
}

/* ─── Stream (mixed article + project + paper index) ─── */
.stream { list-style: none; padding: 0; margin: 0; }
.stream-item {
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--border);
}
.stream-item:last-child { border-bottom: none; }
.stream-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.stream-date {
  font-size: 0.72rem;
  color: var(--text-3);
}
.stream-title {
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px dashed transparent;
  display: inline-block;
  margin-bottom: 0.15rem;
}
.stream-title:hover { color: var(--accent); border-bottom-color: var(--accent); }
.stream-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

/* ─── About page additions ─── */
.about h1 {
  font-size: 1.4rem;
  margin: 0 0 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.about h1::before { content: "# "; color: var(--text-3); }
.about h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-weight: 700;
  margin: 2.5rem 0 0.8rem;
}
.about h2::before { content: "> "; color: var(--accent); }

.links-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.links-list li {
  padding: 0.35rem 0;
  font-size: 0.88rem;
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
}
.links-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  min-width: 4rem;
}
.links-list a {
  color: var(--text);
  border-bottom: 1px dashed var(--border);
}
.links-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Archive pages (articles / projects / papers) ─── */
.archive h1 {
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.archive h1::before { content: "# "; color: var(--text-3); }
.archive-desc {
  font-size: 0.88rem;
  color: var(--text-2);
  margin: 0 0 1.6rem;
  line-height: 1.55;
}

/* ─── Publications page (papers.html) — grouped by year ─── */
.pubs { margin-top: 0.4rem; }

.pubs-year {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 2rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.pubs-year::before { content: "## "; color: var(--text-3); }
.pubs-year:first-of-type { margin-top: 0; }

.pub-list { list-style: none; padding: 0; margin: 0 0 1.2rem; }

.pub {
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border);
}
.pub:last-child { border-bottom: none; }

.pub-title {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px dashed transparent;
  display: inline-block;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}
.pub-title:hover { color: var(--accent); border-bottom-color: var(--accent); }

.pub-authors {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: 0.1rem;
}

.pub-venue {
  font-size: 0.74rem;
  color: var(--text-3);
  line-height: 1.4;
  margin-top: 0.15rem;
  font-style: italic;
}
