/* Shared minimal theme for every page. Theme is set on <html data-theme> by an inline head script. */
:root {
  --bg: #fbfbfa;
  --text: #1c1c1c;
  --muted: #6f6f6f;
  --faint: #808080;
  --line: #e8e8e6;
  --code-bg: #f2f2f0;
}
:root[data-theme="dark"] {
  --bg: #111111;
  --text: #e9e9e9;
  --muted: #8f8f8f;
  --faint: #6a6a6a;
  --line: #232323;
  --code-bg: #191919;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
a:hover {
  text-decoration-color: var(--text);
}
p {
  margin: 0 0 14px;
}

main {
  max-width: 580px;
  margin: 0 auto;
  padding: 88px 20px 64px;
}

/* Homepage header */
.intro {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.intro img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  background: var(--line);
  flex-shrink: 0;
}
.intro h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.intro .role {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
/* Quick links under the role: the first things a recruiter looks for. */
.intro-links {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.intro-links a {
  color: var(--muted);
}
.intro-links a:hover {
  color: var(--text);
}
.intro-links a + a {
  margin-left: 14px;
}

/* Inner-page top bar: back link + theme toggle */
.topbar {
  display: flex;
  align-items: center;
  margin-bottom: 48px;
  font-size: 14px;
}
.topbar a {
  color: var(--muted);
  text-decoration: none;
}
.topbar a:hover {
  color: var(--text);
}

.theme {
  margin-left: auto;
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: -8px;
  background: none;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.theme:hover {
  color: var(--text);
  background: var(--line);
}
.theme svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Show the moon in light mode (go dark) and the sun in dark mode (go light). */
:root[data-theme="dark"] .icon-moon,
:root:not([data-theme="dark"]) .icon-sun {
  display: none;
}

/* Inner-page title */
.page-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.page-meta {
  margin: 0 0 20px;
  color: var(--faint);
  font-size: 13px;
}

/* Sections */
section {
  margin-top: 44px;
}
h2 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
h3 {
  margin: 0;
  font-size: inherit;
  font-weight: 500;
}
.muted {
  color: var(--muted);
}

/* Rows: title left, meta right */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rows li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.rows li:last-child {
  border-bottom: 1px solid var(--line);
}
.row-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.row-title {
  font-weight: 500;
}
.row-sub {
  color: var(--muted);
}
.row-meta {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.row-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.row-links {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}
.row-links a + a,
.row-meta a + a {
  margin-left: 14px;
}
.row-meta a {
  color: var(--muted);
}

/* Projects — one featured image, then the same row list as the rest of the page. */
.project-feature {
  margin: 0;
}
.project-media {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: #161616;
  border: 1px solid var(--line);
  aspect-ratio: 8 / 5;
  text-decoration: none;
}
.project-media:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.project-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.project-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}
.project-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.project-when {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.project-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.project-feature .row-links {
  margin-top: 6px;
}
.project-rows {
  margin-top: 18px;
}

/* "More projects" — the rest of the list, collapsed. Continues the row hairlines. */
.more > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s;
}
.more > summary::-webkit-details-marker {
  display: none;
}
.more > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--faint);
}
.more[open] > summary::after {
  content: "–";
}
.more > summary:hover {
  color: var(--text);
}
.more > summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.more-count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.more > .rows li:first-child {
  border-top: 0;
}
.project-rows li:last-child {
  border-bottom: 0;
}

/* Compact rows stay on a single line; the label truncates first. */
.rows--compact .row-head {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.rows--compact .row-title {
  flex-shrink: 0;
}
.rows--compact .row-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rows--compact .row-meta {
  font-size: 14px;
}

/* Writing — soft panel so posts read as one highlighted block */
.writing {
  padding: 18px 18px 16px;
  margin-inline: -18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.writing h2 {
  color: var(--muted);
}

/* Writing list */
.post {
  display: flex;
  gap: 16px;
  padding: 6px 0;
  text-decoration: none;
}
.post time {
  flex-shrink: 0;
  width: 72px;
  color: var(--faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.post span {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.post:hover span {
  text-decoration-color: var(--text);
}

/* Notes and code */
.note {
  margin: 20px 0 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.note strong {
  color: var(--text);
  font-weight: 500;
}
pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--code-bg);
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

/* Case-study pages (ask-my-docs.html): example answer, figures, bar chart */
.demo {
  padding: 18px 18px 16px;
  margin-inline: -18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.demo-label {
  margin: 0 0 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.demo-q {
  margin: 0 0 14px;
  font-weight: 500;
}
.demo-a {
  margin: 0 0 14px;
}
.cite {
  margin: 0 1px;
  padding: 2px 5px;
  background: var(--bg);
  border: 1px solid var(--faint);
  border-radius: 5px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: 1px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.cite:hover,
.cite[aria-pressed="true"] {
  border-color: var(--text);
}
.cite:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.source {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.source-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  color: var(--faint);
  font-size: 13px;
}
.source-head code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.source ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}
.source mark {
  background: none;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
  transition: background-color 0.15s, text-decoration-color 0.15s;
}
.source mark.is-on {
  background: var(--line);
  text-decoration-color: var(--text);
}
.demo-refusal {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.demo-refusal p {
  margin: 0;
}
.figure {
  margin: 0;
}
.figure-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.flow {
  display: block;
  width: 100%;
  min-width: 500px;
  height: auto;
}
.figure figcaption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 13px;
}
.flow-box {
  fill: var(--bg);
  stroke: var(--line);
}
.flow-gate {
  fill: var(--bg);
  stroke: var(--faint);
  stroke-dasharray: 4 3;
}
.flow-out {
  fill: var(--bg);
  stroke: var(--text);
  stroke-width: 1.4;
}
.flow-wire {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.2;
}
.flow-arrow {
  fill: var(--faint);
}
.flow-t {
  fill: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.flow-s {
  fill: var(--muted);
  font-size: 11.5px;
}
.flow-w {
  fill: var(--faint);
  font-size: 11px;
}
.bars {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.bar-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.bar-row svg {
  display: block;
  width: 100%;
  height: 8px;
}
.bar-track {
  fill: var(--line);
}
.bar-fill {
  fill: var(--faint);
}
.bar-row--best {
  color: var(--text);
  font-weight: 500;
}
.bar-row--best .bar-fill {
  fill: var(--text);
}
.bar-val {
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

footer {
  margin-top: 64px;
  color: var(--faint);
  font-size: 13px;
}
footer p {
  margin: 0 0 6px;
}

@media (max-width: 520px) {
  main {
    padding-top: 48px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .row-head {
    flex-wrap: wrap;
    gap: 0 10px;
  }
  .row-meta {
    margin-left: 0;
    width: 100%;
  }
  .rows--compact .row-head {
    gap: 0 10px;
  }
  .rows--compact .row-meta {
    margin-left: auto;
    width: auto;
  }
  .demo {
    margin-inline: -8px;
    padding: 14px 12px 12px;
  }
  .bar-row {
    grid-template-columns: 104px minmax(0, 1fr) 36px;
    gap: 10px;
    font-size: 13px;
  }
}

/* Activity — year contribution heatmaps */
.activity-list {
  display: grid;
  gap: 28px;
}
.activity-block {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.activity-block:last-child {
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.activity-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.activity-title {
  font-weight: 500;
  text-decoration: none;
}
a.activity-title:hover {
  text-decoration: underline;
  text-decoration-color: var(--text);
  text-underline-offset: 3px;
}
.activity-total {
  margin-left: auto;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.activity-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
  padding: 0 2px 4px;
}
.activity-graph {
  display: block;
  max-width: none;
}
.activity-label {
  fill: var(--faint);
  font-size: 9px;
  font-family: inherit;
}
.activity-cell {
  shape-rendering: geometricPrecision;
}
.activity-graph--green .activity-cell[data-level="0"],
.activity-graph--blue .activity-cell[data-level="0"] {
  fill: var(--line);
}
.activity-graph--green .activity-cell[data-level="1"] {
  fill: #9be9a8;
}
.activity-graph--green .activity-cell[data-level="2"] {
  fill: #40c463;
}
.activity-graph--green .activity-cell[data-level="3"] {
  fill: #30a14e;
}
.activity-graph--green .activity-cell[data-level="4"] {
  fill: #216e39;
}
.activity-graph--blue .activity-cell[data-level="1"] {
  fill: #b6d4fe;
}
.activity-graph--blue .activity-cell[data-level="2"] {
  fill: #76a9fa;
}
.activity-graph--blue .activity-cell[data-level="3"] {
  fill: #3b82f6;
}
.activity-graph--blue .activity-cell[data-level="4"] {
  fill: #1a56db;
}
:root[data-theme="dark"] .activity-graph--green .activity-cell[data-level="1"] {
  fill: #0e4429;
}
:root[data-theme="dark"] .activity-graph--green .activity-cell[data-level="2"] {
  fill: #006d32;
}
:root[data-theme="dark"] .activity-graph--green .activity-cell[data-level="3"] {
  fill: #26a641;
}
:root[data-theme="dark"] .activity-graph--green .activity-cell[data-level="4"] {
  fill: #39d353;
}
:root[data-theme="dark"] .activity-graph--blue .activity-cell[data-level="1"] {
  fill: #1e3a5f;
}
:root[data-theme="dark"] .activity-graph--blue .activity-cell[data-level="2"] {
  fill: #1e40af;
}
:root[data-theme="dark"] .activity-graph--blue .activity-cell[data-level="3"] {
  fill: #3b82f6;
}
:root[data-theme="dark"] .activity-graph--blue .activity-cell[data-level="4"] {
  fill: #60a5fa;
}
.activity-stats {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Toolkit — soft panel + monogram tiles from data/tools.json */
.toolkit {
  --toolkit-tint: 0.07;
  --toolkit-tint-l: 48%;
  padding: 18px 18px 16px;
  margin-inline: -18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
:root[data-theme="dark"] .toolkit {
  --toolkit-tint: 0.14;
  --toolkit-tint-l: 58%;
}
.toolkit h2 {
  color: var(--muted);
}
.toolkit-lede {
  margin: -2px 0 16px;
  color: var(--muted);
  font-size: 14px;
}
.toolkit-group + .toolkit-group {
  margin-top: 18px;
}
.toolkit-group-label {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.toolkit-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.toolkit-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px 10px 10px 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  animation: toolkit-in 0.45s ease both;
  animation-delay: calc(var(--d, 0) * 28ms);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.toolkit-tile:hover {
  border-color: hsl(var(--h, 0) 28% var(--toolkit-tint-l) / 0.55);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px hsl(0 0% 0% / 0.04);
}
:root[data-theme="dark"] .toolkit-tile:hover {
  box-shadow: 0 8px 18px hsl(0 0% 0% / 0.28);
}
.toolkit-mark {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: hsl(var(--h, 0) 42% var(--toolkit-tint-l) / var(--toolkit-tint));
  color: hsl(var(--h, 0) 28% 36%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}
:root[data-theme="dark"] .toolkit-mark {
  color: hsl(var(--h, 0) 35% 72%);
}
.toolkit-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toolkit-name {
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.3;
  text-decoration: none;
}
a.toolkit-name {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
a.toolkit-name:hover {
  text-decoration-color: var(--text);
}
.toolkit-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}
@keyframes toolkit-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .toolkit-tile {
    animation: none;
  }
  .toolkit-tile:hover {
    transform: none;
  }
}
@media (max-width: 479px) {
  .toolkit {
    margin-inline: -8px;
    padding: 14px 12px 12px;
  }
  .toolkit-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
