@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root,
:root[data-theme="dark"] {
  --bg: #0b0b10;
  --surface: #13131b;
  --surface-2: #1b1b26;
  --border: #262633;
  --border-strong: #353547;
  --text: #ececf1;
  --muted: #9a9aad;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-text: #ffffff;
  --glow: rgba(139, 92, 246, 0.22);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --skeleton: linear-gradient(90deg, #161620 0%, #1f1f2c 50%, #161620 100%);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fafafc;
  --surface: #ffffff;
  --surface-2: #f3f2f8;
  --border: #e4e2ee;
  --border-strong: #d2cfe0;
  --text: #16161d;
  --muted: #5e5e70;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --accent-text: #ffffff;
  --glow: rgba(124, 58, 237, 0.12);
  --shadow: 0 10px 30px -14px rgba(40, 20, 90, 0.18);
  --skeleton: linear-gradient(90deg, #f0eff6 0%, #e6e4ef 50%, #f0eff6 100%);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Background */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% -5%, var(--glow), transparent 70%),
    radial-gradient(500px 360px at 95% 10%, var(--glow), transparent 70%);
}
.bg-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 0%, transparent 75%);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font: 600 17px "JetBrains Mono", monospace;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.caret {
  display: inline-block;
  width: 9px;
  height: 18px;
  margin-left: 3px;
  vertical-align: -3px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn .i-moon { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .i-moon,
:root[data-theme="light"] .i-sun { display: none; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: start;
  padding-top: 88px;
  padding-bottom: 48px;
}
.hero-avatar {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 32px;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), transparent 60%, var(--accent-strong));
  margin-top: 26px;
  box-shadow: 0 0 60px -10px var(--glow);
}
.hero-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 29px;
  object-fit: cover;
  background: var(--surface-2);
}
.kicker { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.prompt { color: var(--accent); }
.hero h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.045em;
}
.tagline {
  margin: 10px 0 18px;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 500;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.about { max-width: 640px; margin: 0 0 20px; color: var(--muted); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: 500 13px "JetBrains Mono", monospace;
  color: var(--text);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 11px;
  border: 1px solid transparent;
  font: 600 15px "Inter", sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent-strong);
  color: var(--accent-text);
  box-shadow: 0 6px 20px -8px var(--accent-strong);
}
.btn-primary:hover { background: var(--accent); box-shadow: 0 8px 26px -8px var(--accent-strong); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 24px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.stat:first-child { border-radius: 14px 0 0 14px; }
.stat:last-child { border-radius: 0 14px 14px 0; }
.stat-num { font: 600 24px "JetBrains Mono", monospace; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 13px; }

/* Latest commit */
.activity {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.activity:hover { border-color: var(--accent); }
.activity[hidden] { display: none; }
.activity-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.activity-label { color: var(--muted); font-size: 12.5px; }
.activity-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.activity-meta { color: var(--muted); font-size: 12.5px; }

/* Discord presence */
.presence { display: inline-flex; align-items: center; gap: 7px; margin-top: 3px; color: var(--muted); font-size: 13px; }
.presence[hidden] { display: none; }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status, #80848e); }
.hero-avatar .presence-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 24px;
  height: 24px;
  border: 5px solid var(--bg);
}
.hero-avatar .presence-dot[hidden] { display: none; }
[data-status="online"] { --status: #23a55a; }
[data-status="idle"] { --status: #f0b232; }
[data-status="dnd"] { --status: #f23f43; }
[data-status="offline"] { --status: #80848e; }

/* Sections */
.section { padding-top: 72px; padding-bottom: 24px; scroll-margin-top: 64px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.section h2 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.sub a { color: var(--accent); text-decoration: none; }
.sub a:hover { text-decoration: underline; }
.source {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.source.is-fallback { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.seg button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 500 14px "Inter", sans-serif;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 20px; }
.chips button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 13px "Inter", sans-serif;
  cursor: pointer;
}
.chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

/* Project cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.45s ease both;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card.featured { grid-column: span 2; }
.card:nth-child(2) { animation-delay: 60ms; } .card:nth-child(3) { animation-delay: 120ms; }
.card:nth-child(4) { animation-delay: 180ms; } .card:nth-child(5) { animation-delay: 240ms; }
.card:nth-child(n + 6) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.cover {
  position: relative;
  height: 132px;
  margin: -22px -22px 18px;
  border-radius: 15px 15px 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
/* Covers are 1200x480 with the motif in the upper middle; the chip row is the first thing to go */
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.cover-gen {
  display: flex;
  align-items: flex-end;
  padding: 16px 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--lc, #8b5cf6) 55%, transparent), transparent 60%),
    radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, var(--hue, #8b5cf6) 40%, transparent), transparent 65%),
    var(--surface-2);
}
.cover-gen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 18%, transparent) 1px, transparent 1px);
  background-size: 14px 14px;
  mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
  -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
}
.cover-mark {
  position: relative;
  font: 700 34px/1 "JetBrains Mono", monospace;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--text) 82%, transparent);
}
.cover-mark::before { content: "./"; color: var(--accent); opacity: 0.8; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.card-title a { text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.card-title svg { flex: none; width: 18px; height: 18px; fill: var(--muted); }
.stars {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  color: var(--muted);
  font: 500 13px "JetBrains Mono", monospace;
}
.stars svg { width: 15px; height: 15px; fill: #f5b301; }
.card-desc { flex: 1; margin: 12px 0 14px; color: var(--muted); font-size: 14.5px; }
.card-desc.empty { font-style: italic; opacity: 0.7; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.topics span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 12px "JetBrains Mono", monospace;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.meta-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.lang { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.lang-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--lc); }

/* GitHub language colours (class names from LANG_SLUGS in js/render.js) */
.lc-other { --lc: #8b8b9a; }
.lc-python { --lc: #3572a5; } .lc-javascript { --lc: #f1e05a; } .lc-typescript { --lc: #3178c6; }
.lc-html { --lc: #e34c26; } .lc-css { --lc: #563d7c; } .lc-lua { --lc: #000080; } .lc-luau { --lc: #00a2ff; }
.lc-csharp { --lc: #178600; } .lc-cpp { --lc: #f34b7d; } .lc-c { --lc: #555555; } .lc-go { --lc: #00add8; }
.lc-rust { --lc: #dea584; } .lc-java { --lc: #b07219; } .lc-kotlin { --lc: #a97bff; } .lc-shell { --lc: #89e051; }
.lc-powershell { --lc: #2c6fb7; } .lc-batchfile { --lc: #c1f12e; } .lc-dart { --lc: #00b4ab; }
.lc-swift { --lc: #f05138; } .lc-php { --lc: #4f5d95; } .lc-ruby { --lc: #701516; } .lc-vue { --lc: #41b883; }
.hue-0 { --hue: hsl(0 80% 60%); } .hue-1 { --hue: hsl(30 80% 60%); } .hue-2 { --hue: hsl(60 80% 60%); }
.hue-3 { --hue: hsl(90 80% 60%); } .hue-4 { --hue: hsl(120 80% 60%); } .hue-5 { --hue: hsl(150 80% 60%); }
.hue-6 { --hue: hsl(180 80% 60%); } .hue-7 { --hue: hsl(210 80% 60%); } .hue-8 { --hue: hsl(240 80% 60%); }
.hue-9 { --hue: hsl(270 80% 60%); } .hue-10 { --hue: hsl(300 80% 60%); } .hue-11 { --hue: hsl(330 80% 60%); }
.card-links { display: flex; flex: none; gap: 8px; }
.card-links a {
  position: relative;
  z-index: 1;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s;
}
.card-links a:hover { border-color: var(--accent); }
.card-links .dl { display: inline-flex; align-items: center; gap: 5px; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.card-links .dl svg { width: 13px; height: 13px; fill: currentColor; }

.skeleton {
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.notice {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}
.notice a { color: var(--accent); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.contact-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.contact-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
}
.contact-icon svg { width: 28px; height: 28px; fill: currentColor; }
.discord .contact-icon { background: rgba(88, 101, 242, 0.15); color: #5865f2; }
.github .contact-icon { background: var(--surface-2); color: var(--text); }
.contact-body { display: flex; flex-direction: column; }
.contact-label { color: var(--muted); font-size: 13px; }
.contact-handle { font-size: 19px; font-weight: 600; }
.contact-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }

.toast {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 13px;
}

/* Nav extras */
.text-btn { width: auto; padding: 0 10px; font: 600 13px "JetBrains Mono", monospace; }
.icon-btn .i-term { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: fixed; opacity: 0; pointer-events: none; }
.kbd-hint { white-space: nowrap; }

/* Heatmap */
.heatmap { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.heatmap[hidden] { display: none; }
.hm-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.hm-cell { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--surface-2); }
.hm-pad { visibility: hidden; }
.hm-1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.hm-2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.hm-3 { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.hm-4 { background: var(--accent-strong); }
.hm-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.hm-legend { display: inline-flex; align-items: center; gap: 3px; }
.hm-legend .hm-cell { width: 10px; height: 10px; }

/* Project page */
.project { padding-top: 40px; }
.back { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.back:hover { color: var(--accent); }
.project-head { display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: start; margin-bottom: 40px; }
.project-cover .cover { margin: 0; height: 200px; border: 1px solid var(--border); border-radius: 16px; }
.project-cover .cover-mark { font-size: 46px; }
.project-info h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -0.03em; word-break: break-word; }
.project-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.project-info .topics { margin-bottom: 20px; }
.project-info .sub { margin-top: 12px; }

/* Long-form text: READMEs and posts */
.prose {
  max-width: 820px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.8em 0 0.6em; line-height: 1.25; letter-spacing: -0.02em; }
.prose h1 { font-size: 28px; } .prose h2 { font-size: 23px; } .prose h3 { font-size: 19px; } .prose h4 { font-size: 16px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1.1em; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; height: auto; display: inline-block; border-radius: 8px; vertical-align: middle; }
.prose [align="center"] { text-align: center; }
.prose code { padding: 2px 6px; border-radius: 6px; background: var(--surface-2); font: 0.88em "JetBrains Mono", monospace; }
.prose pre { padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); overflow-x: auto; line-height: 1.55; }
.prose pre code { padding: 0; background: none; font-size: 13.5px; }
.prose blockquote { margin-left: 0; padding: 4px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.prose th, .prose td { padding: 7px 12px; border: 1px solid var(--border); text-align: left; }
.prose th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose .markdown-heading { position: relative; }
.prose .anchor { display: none; }
.prose .markdown-alert { padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; margin-bottom: 1.1em; }
.prose .markdown-alert-title { font-weight: 600; }
.prose .markdown-alert-title svg, .prose .octicon { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; margin-right: 4px; }
.prose input[type="checkbox"] { margin-right: 6px; }

/* Devlog */
.page-title { margin: 0; font-size: clamp(34px, 6vw, 48px); letter-spacing: -0.035em; }
.post-list { display: grid; gap: 14px; }
.post-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-date { color: var(--muted); font-size: 12.5px; margin: 0; }
.post-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.post-summary { color: var(--muted); }
.post-read { color: var(--accent); font-size: 13px; }
.post { padding-top: 40px; }
.post-head { max-width: 820px; margin-bottom: 28px; }
.post-head h1 { margin: 6px 0 12px; font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.035em; }
.draft-banner { padding: 10px 14px; border: 1px dashed #d97706; border-radius: 10px; color: #d97706; font-size: 13px; }

/* Terminal */
.terminal {
  width: min(720px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 64px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #0d0d14;
  color: #e5e5ee;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(139, 92, 246, 0.15);
  overflow: hidden;
}
.terminal[open] { display: flex; flex-direction: column; }
.terminal::backdrop { background: rgba(5, 5, 10, 0.55); backdrop-filter: blur(3px); }
.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #262633;
  color: #9a9aad;
  font-size: 12.5px;
}
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: #f23f43; }
.term-dots i:nth-child(2) { background: #f0b232; }
.term-dots i:nth-child(3) { background: #23a55a; }
.term-close { margin-left: auto; border: 0; background: none; color: #9a9aad; font-size: 20px; line-height: 1; cursor: pointer; }
.term-close:hover { color: #fff; }
.term-out { flex: 1; min-height: 200px; padding: 14px 16px 4px; overflow-y: auto; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.term-out a { color: #a78bfa; }
.term-cmd { color: #fff; }
.term-muted { color: #9a9aad; }
.term-in { display: flex; align-items: center; gap: 8px; padding: 8px 16px 14px; font-size: 13.5px; }
.term-in .prompt { color: #a78bfa; white-space: nowrap; }
.term-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #fff; font: inherit; caret-color: #a78bfa; }

/* Stats page */
.stats-box { margin-top: 18px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.stats-box h2 { margin: 0 0 12px; font-size: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 18px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats-table td { padding: 4px 6px; }
.stats-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-table .num { text-align: right; }
.stats-box progress, .day-bar progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent-strong); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent-strong); border-radius: 4px; }
.day-bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 4px; align-items: end; }
.day-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.day-bar progress { height: 80px; width: 8px; writing-mode: vertical-lr; direction: rtl; }

/* Post layout with table of contents */
.post-body.has-toc { display: grid; grid-template-columns: minmax(0, 820px) 220px; gap: 32px; align-items: start; }
.post-body.has-toc .toc { order: 2; position: sticky; top: 84px; }
.toc { font-size: 13.5px; }
.toc-title { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 4px 0 4px 14px; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc li a:hover { color: var(--accent); }
.toc .toc-3 a { padding-left: 26px; font-size: 13px; }
.prose h2[id], .prose h3[id] { scroll-margin-top: 80px; }

/* Code highlighting (highlight.js classes, colours tuned to the site) */
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: #c792ea; }
.hljs-string, .hljs-attr .hljs-string, .hljs-regexp, .hljs-addition { color: #a5d6a7; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #f6c177; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #82aaff; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: #7fdbca; }
.hljs-type, .hljs-title.class_, .hljs-params { color: #ffcb8b; }
.hljs-meta, .hljs-deletion { color: #f78c6c; }
:root[data-theme="light"] .hljs-keyword, :root[data-theme="light"] .hljs-built_in, :root[data-theme="light"] .hljs-literal { color: #7c3aed; }
:root[data-theme="light"] .hljs-string, :root[data-theme="light"] .hljs-regexp { color: #2f7d32; }
:root[data-theme="light"] .hljs-number { color: #b45309; }
:root[data-theme="light"] .hljs-title, :root[data-theme="light"] .hljs-title.function_ { color: #1d4ed8; }
:root[data-theme="light"] .hljs-attr, :root[data-theme="light"] .hljs-property, :root[data-theme="light"] .hljs-variable { color: #0e7490; }
:root[data-theme="light"] .hljs-type, :root[data-theme="light"] .hljs-params { color: #9a3412; }

/* Accent colours, chosen in the terminal (`accent <color>`) */
:root[data-accent="cyan"] { --accent: #5ee0d8; --accent-strong: #14b8a6; --accent-soft: rgba(20, 184, 166, 0.14); --glow: rgba(20, 184, 166, 0.2); }
:root[data-accent="green"] { --accent: #4ade80; --accent-strong: #16a34a; --accent-soft: rgba(22, 163, 74, 0.14); --glow: rgba(22, 163, 74, 0.2); }
:root[data-accent="pink"] { --accent: #f472b6; --accent-strong: #db2777; --accent-soft: rgba(219, 39, 119, 0.14); --glow: rgba(219, 39, 119, 0.2); }
:root[data-accent="amber"] { --accent: #fbbf24; --accent-strong: #d97706; --accent-soft: rgba(217, 119, 6, 0.14); --glow: rgba(217, 119, 6, 0.2); }
:root[data-theme="light"][data-accent="cyan"] { --accent: #0f766e; --accent-strong: #0d9488; }
:root[data-theme="light"][data-accent="green"] { --accent: #15803d; --accent-strong: #16a34a; }
:root[data-theme="light"][data-accent="pink"] { --accent: #be185d; --accent-strong: #db2777; }
:root[data-theme="light"][data-accent="amber"] { --accent: #b45309; --accent-strong: #d97706; }
.terminal .term-in .prompt, .term-prompt, .term-out a { color: var(--accent); }
.term-dots i:first-child { background: #f23f43; }

/* Terminal programs and extras */
.term-dir { color: var(--accent); }
.term-click { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.term-ok { color: #4ade80; }
.term-warn { color: #f0b232; }
.term-canvas { display: block; margin: 6px 0; border: 1px solid #262633; border-radius: 10px; max-width: 100%; touch-action: none; }
.term-running .term-in { opacity: 0.45; }
.term-pulse { color: #c9c9d6; }
.term-heart { display: inline-block; color: #f23f5c; transition: transform 0.12s; }
.term-heart.beat { transform: scale(1.35); }
.term-status-online { color: #23a55a; } .term-status-idle { color: #f0b232; }
.term-status-dnd { color: #f23f43; } .term-status-offline { color: #80848e; }

/* /now */
.now .activity { margin: 18px 0; }
.now-intro { margin-bottom: 8px; }
.now-updated { font-size: 12.5px; margin: 1em 0 0; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.now-box { padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.now-box h2 { margin: 0 0 10px; font-size: 16px; }
.now-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.now-list a { color: var(--text); font-weight: 600; text-decoration: none; }
.now-list a:hover { color: var(--accent); }
.now-list .muted { display: block; font-size: 12.5px; }
.now-list p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* 404 */
.notfound { padding-top: 96px; padding-bottom: 96px; }
.notfound h1 {
  margin: 0 0 8px;
  font-size: clamp(72px, 14vw, 140px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.notfound-term {
  display: inline-block;
  margin: 0 0 28px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  white-space: pre-wrap;
}

/* Footer */
.footer { margin-top: 72px; border-top: 1px solid var(--border); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 24px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 14px;
}
.footer .mono { font-size: 12.5px; }

/* Responsive */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 48px; }
  .hero-avatar { width: 104px; height: 104px; margin-top: 0; border-radius: 26px; }
  .hero-avatar img { border-radius: 23px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:first-child { border-radius: 14px 0 0 0; }
  .stat:nth-child(2) { border-radius: 0 14px 0 0; }
  .stat:nth-child(3) { border-radius: 0 0 0 14px; }
  .stat:last-child { border-radius: 0 0 14px 0; }
  .grid { grid-template-columns: 1fr; }
  .card.featured { grid-column: auto; }
  .contact-grid { grid-template-columns: 1fr; }
  .section { padding-top: 56px; }
  .nav-links a { padding: 8px; }
  .activity-msg { flex-basis: 100%; order: 3; white-space: normal; }
  .nav-links { gap: 2px; }
  .nav-links a { font-size: 14px; padding: 8px 6px; }
  .icon-btn { width: 34px; height: 34px; margin-left: 2px; }
  .text-btn { width: auto; padding: 0 7px; }
  .project-head { grid-template-columns: 1fr; gap: 20px; }
  .project-cover .cover { height: 150px; }
  .prose { padding: 20px 18px; }
  .kbd-hint { display: none; }
  .post-body.has-toc { grid-template-columns: 1fr; }
  .post-body.has-toc .toc { order: 0; position: static; }
  .day-bars { gap: 2px; }
  .day-bar span { display: none; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .post-body.has-toc { grid-template-columns: 1fr; }
  .post-body.has-toc .toc { order: 0; position: static; }
}
@media (max-width: 420px) {
  .nav-links a[href="#contact"], .nav-links a[href="/#contact"] { display: none; }
}

/* ---------- Phones ---------- */
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, summary { -webkit-tap-highlight-color: rgba(139, 92, 246, 0.15); }
.menu-btn, .nav-menu { display: none; }
.menu-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-btn .m-close, .menu-open .menu-btn .m-open { display: none; }
.menu-open .menu-btn .m-close { display: inline; }
summary.toc-title { cursor: pointer; list-style: none; }
summary.toc-title::-webkit-details-marker { display: none; }
summary.toc-title::after { content: " ▾"; }
details[open] > summary.toc-title::after { content: ""; }

@media (max-width: 760px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nav-inner { height: 56px; }
  .logo { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; }
  .nav-text { display: none; }
  .menu-btn { display: grid; }
  .icon-btn { width: 40px; height: 40px; margin-left: 4px; }
  .nav-menu:not([hidden]) {
    display: grid;
    padding: 6px max(16px, env(safe-area-inset-left)) 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    animation: drop 0.18s ease both;
  }
  .nav-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 6px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
  }
  .nav-menu a:last-child { border-bottom: 0; }
  .section, .project, .post { scroll-margin-top: 56px; }

  /* Hero: avatar next to the name, everything else full width */
  .hero { grid-template-columns: 76px 1fr; column-gap: 16px; row-gap: 0; align-items: end; padding-top: 32px; padding-bottom: 28px; }
  .hero-text { display: contents; }
  .hero-avatar { grid-row: 1 / 3; width: 76px; height: 76px; margin: 0; padding: 2px; border-radius: 20px; }
  .hero-avatar img { border-radius: 18px; }
  .hero-avatar .presence-dot { width: 18px; height: 18px; border-width: 4px; right: -4px; bottom: -4px; }
  .kicker { grid-column: 2; margin: 0; font-size: 12.5px; }
  .hero h1 { grid-column: 2; font-size: 42px; }
  .tagline, .about, .tags, .actions { grid-column: 1 / -1; }
  .tagline { margin: 14px 0 12px; font-size: 18px; }
  .about { font-size: 15.5px; line-height: 1.6; margin-bottom: 16px; }
  .tags { gap: 6px; margin-bottom: 22px; }
  .tags li { padding: 3px 9px; font-size: 12px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .actions .btn { width: 100%; padding: 0 12px; }

  .stat { padding: 14px 16px; }
  .stat-num { font-size: 19px; }
  .stat-label { font-size: 12px; }
  .activity { padding: 12px 14px; font-size: 13.5px; }
  .heatmap { padding: 14px; }

  .section h2 { font-size: 26px; }
  .section-head { margin-bottom: 18px; }
  .seg button { height: 36px; }
  .card { min-height: 0; padding: 18px; }
  .cover { height: 96px; margin: -18px -18px 16px; }
  .cover-mark { font-size: 26px; }
  .card-meta { flex-wrap: wrap; }
  .card-links { margin-left: auto; }
  .card-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; font-size: 13px; }
  .contact-card { padding: 18px; }
  .contact-actions .btn { flex: 1; }

  .project-info h1, .post-head h1 { font-size: 30px; }
  .project .actions { grid-template-columns: 1fr; }
  .prose { font-size: 15.5px; line-height: 1.7; }
  .prose pre code { font-size: 12.5px; }
  /* minmax(0, …): a plain 1fr column grows with long code lines and widens the whole page */
  .post-body, .post-body.has-toc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* Long-form text runs edge to edge on phones; the card frame only costs width there */
  .prose { min-width: 0; padding: 0; border: 0; background: none; }
  .now-intro.prose { padding: 16px; border: 1px solid var(--border); background: var(--surface); }
  .back { display: inline-flex; align-items: center; min-height: 40px; margin-bottom: 10px; }
  summary.toc-title { display: flex; align-items: center; min-height: 40px; margin: -8px 0; }
  .toc { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .toc ol { margin-top: 8px; }
  .toc li a { min-height: 36px; display: flex; align-items: center; }
  .post-card { padding: 18px; }
  .now-box { padding: 16px; }

  .footer-inner { flex-direction: column; padding-bottom: max(32px, env(safe-area-inset-bottom)); }

  .terminal { width: calc(100vw - 16px); max-height: 72vh; margin-top: max(12px, env(safe-area-inset-top)); }
  .term-out { min-height: 160px; font-size: 13px; }
  /* Anything under 16px makes iOS zoom into the field */
  .term-in input { font-size: 16px; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Touch screens: no hover lift that sticks after a tap */
@media (hover: none) {
  .card:hover, .post-card:hover { transform: none; box-shadow: none; border-color: var(--border); }
  .card:hover::before { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
