/* ───────────────────────────── tokens ───────────────────────────── */
:root {
  --bg: #0a0a0b;
  --fg: #ece9e4;
  --muted: #918e89;
  --faint: #5f5c58;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .22);
  --accent: #d7b78c;
  --accent-glow: rgba(215, 183, 140, .5);
  --ok: #8fbf8a;
  --warn: #e08a6d;
  --hover: rgba(255, 255, 255, .035);
  --glass: rgba(10, 10, 11, .72);
  --spot: rgba(215, 183, 140, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --header-h: 72px;
  --pad: clamp(20px, 4vw, 44px);
  --toc-w: 200px;
  --maxw: 1360px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f1eb;
  --fg: #181613;
  --muted: #6f6a62;
  --faint: #a39c92;
  --line: rgba(24, 22, 19, .1);
  --line-strong: rgba(24, 22, 19, .26);
  --accent: #a06a2c;
  --accent-glow: rgba(160, 106, 44, .35);
  --ok: #5d8a58;
  --warn: #c0563a;
  --hover: rgba(24, 22, 19, .04);
  --glass: rgba(244, 241, 235, .78);
  --spot: rgba(160, 106, 44, .055);
  color-scheme: light;
}

/* ───────────────────────────── reset ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(1100px 560px at 78% -12%, var(--spot), transparent 62%);
}
main { position: relative; z-index: 1; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* A custom rail replaces the scrollbar on precise pointers only. */
html.custom-scrollbar { scrollbar-width: none; }
html.custom-scrollbar::-webkit-scrollbar { width: 0; height: 0; }
@media (pointer: coarse) {
  html { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform .3s var(--ease);
}
.skip-link:focus { transform: none; }

/* ─────────────────────── atmosphere / overlays ─────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
[data-theme="light"] .grain { opacity: .045; mix-blend-mode: multiply; }

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  height: 2px;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: .75;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ───────────────────────────── header ──────────────────────────── */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color .5s var(--ease), border-color .5s var(--ease);
}
.header.is-scrolled {
  background: var(--glass);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.header-inner {
  width: 100%;
  height: 100%;
  padding-inline: var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* ─────────────────────────── nav search ────────────────────────── */
.nav-search {
  position: relative;
  flex: 1 1 auto;
  margin-inline: auto;
  width: 100%;
  max-width: 440px;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 88%, var(--fg) 3%);
  transition: border-color .2s;
}
.search-bar:focus-within {
  border-color: var(--line-strong);
}
.search-scope {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  padding-right: 4px;
  outline: none;
}
.search-scope option {
  background: var(--bg);
  color: var(--fg);
}
.search-sep {
  width: 1px;
  height: 14px;
  background: var(--line);
}
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.search-input::placeholder {
  color: var(--faint);
}
.search-kbd {
  font-size: 10.5px;
  color: var(--faint);
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  z-index: 90;
}
.search-results[hidden] { display: none; }
.search-hit {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 12.5px;
  color: var(--fg);
}
.search-hit:hover {
  background: var(--hover);
}
.search-hit-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}
.search-hit-ctx {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--accent);
}
.search-empty {
  padding: 10px;
  font-size: 12.5px;
  color: var(--faint);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1;
  white-space: nowrap;
}
.brand-mark { color: var(--accent); transition: transform .7s var(--ease); }
.brand:hover .brand-mark { transform: rotate(90deg); }

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.status-item { display: inline-flex; align-items: center; gap: 6px; }
.battery svg { overflow: visible; }
.battery-fill { fill: currentColor; }
.battery-bolt { display: none; fill: var(--bg); }
.battery.charging .battery-bolt { display: block; }
.battery.low { color: var(--warn); }

.conn-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 14%, transparent);
  transition: background-color .3s;
}
.conn.offline .conn-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 16%, transparent); }

.theme-toggle,
.menu-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: 2px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s, border-color .3s, transform .5s var(--ease);
}
.theme-toggle:hover,
.menu-toggle:hover { color: var(--fg); border-color: var(--line-strong); }
.theme-toggle:hover { transform: rotate(18deg); }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.menu-toggle { display: none; }

@media (pointer: fine) {
  .header-inner { padding-right: max(var(--pad), 58px); }
}

/* ─────────────────────────── top-left TOC ──────────────────────── */
.toc {
  position: fixed;
  top: calc(var(--header-h) + 20px);
  left: var(--pad);
  z-index: 40;
  width: var(--toc-w);
  max-height: calc(100svh - var(--header-h) - 44px);
  overflow-y: auto;
  scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }

.toc-head {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}

.toc-list,
.toc-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-group + .toc-group { margin-top: 2px; }

.toc-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 4px;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.toc-row:hover { background: var(--hover); }
.toc-row.is-active > .toc-nav-link { color: var(--accent); }

.toc-nav-link {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  transition: color .2s;
}
.toc-nav-link:hover { color: var(--fg); }

.toc-expand {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  cursor: pointer;
}
.toc-expand:hover { color: var(--fg); }

.toc-num {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.toc-sub {
  margin: 2px 0 8px 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.toc-sub[hidden] { display: none; }

.toc-sub-link {
  display: block;
  padding: 3px 6px;
  margin-left: -6px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s, background-color .2s;
}
.toc-sub-link:hover { color: var(--fg); background: var(--hover); }

/* ─────────────────────────── page shell ────────────────────────── */
.shell {
  width: 100%;
  padding-top: var(--header-h);
  padding-right: max(var(--pad), 64px);
  padding-left: calc(var(--pad) + var(--toc-w) + clamp(56px, 6vw, 88px));
  padding-bottom: 72px;
}

.shell-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.empty-stage {
  min-height: calc(100svh - var(--header-h) - 72px);
}

/* ───────────────────────── index / home ────────────────────────── */
.intro,
.sector,
.footer {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--fg);
}

.intro {
  padding-top: clamp(24px, 5vh, 48px);
  padding-bottom: 36px;
  max-width: 62ch;
  margin-inline: auto;
  text-align: center;
  color: var(--muted);
}
.intro strong {
  font-weight: 500;
  color: var(--fg);
}

.socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 19px;
  text-decoration: none;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.socials a:hover {
  color: var(--fg);
  transform: translateY(-1px);
}

/* ────────────────────── github contributions ───────────────────── */
.contrib {
  margin-top: 22px;
  margin-inline: auto;
  max-width: 530px;
  text-align: left;
}
.contrib-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--faint);
}
.contrib-head a {
  text-decoration: none;
}
.contrib-head a:hover {
  color: var(--fg);
}
.contrib-grid {
  display: grid;
  grid-template-rows: repeat(7, 7px);
  grid-auto-flow: column;
  grid-auto-columns: 7px;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.contrib-grid::-webkit-scrollbar { display: none; }
.contrib-cell {
  width: 7px;
  height: 7px;
  border-radius: 1.5px;
  background: var(--line);
}
.contrib-cell[data-level="1"] { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.contrib-cell[data-level="2"] { background: color-mix(in srgb, var(--accent) 52%, transparent); }
.contrib-cell[data-level="3"] { background: color-mix(in srgb, var(--accent) 76%, transparent); }
.contrib-cell[data-level="4"] { background: var(--accent); }

.contrib-activity {
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contrib-activity a {
  color: var(--muted);
  text-decoration: none;
}
.contrib-activity a:hover {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.active-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: middle;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

.gists-wrap {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.gists-wrap[hidden] { display: none; }

.sector {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px 40px;
  align-items: start;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.sector + .sector {
  margin-top: 44px;
}

.sector-name {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
}
.sector-name a {
  text-decoration: none;
}
.sector-name a:hover {
  color: var(--fg);
}

.proj-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.proj-item + .proj-item {
  margin-top: 22px;
}

.proj-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.proj-title {
  display: inline-block;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.015em;
  color: var(--sector-color, var(--accent));
  text-decoration: none;
  transition: opacity .2s;
}
a.proj-title:hover {
  opacity: .78;
}

.proj-tags {
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
}

/* ───────────────────────── recent blogs ────────────────────────── */
.blogs-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.blogs-head {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.blogs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.blogs-item + .blogs-item {
  margin-top: 16px;
}
.blogs-date {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
}
.blogs-link {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.blogs-link:hover {
  color: var(--fg);
}

/* ────────────────────── dense detail pages ─────────────────────── */
.page-head {
  padding-top: clamp(24px, 5vh, 44px);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-title {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -.015em;
  color: var(--fg);
}
.page-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14.5px;
}

.stack-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--faint);
}

.detail-block {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 20px 36px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.detail-block-full {
  display: block;
}
.detail-lead {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
.detail-title {
  display: inline-block;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--accent);
  text-decoration: none;
}
a.detail-title:hover { opacity: .8; }
.detail-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.detail-summary {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.detail-body {
  min-width: 0;
}
.detail-group + .detail-group {
  margin-top: 16px;
}
.detail-label {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.detail-ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.detail-ul li + li { margin-top: 4px; }
.detail-ul a {
  color: var(--fg);
  text-decoration: none;
}
.detail-ul a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.detail-cmd {
  position: relative;
  margin: 14px 0 0;
  padding: 2px 44px 2px 12px;
  border-left: 1px solid var(--line-strong);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.detail-cmd::after {
  content: attr(data-copy);
  position: absolute;
  top: 2px;
  right: 0;
  font-size: 11px;
  color: var(--faint);
  opacity: 0;
  transition: opacity .2s, color .2s;
}
.detail-cmd:hover {
  color: var(--fg);
  border-left-color: var(--accent);
}
.detail-cmd:hover::after,
.detail-cmd.is-copied::after {
  opacity: 1;
}
.detail-cmd.is-copied::after {
  color: var(--ok);
}

.repo-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 32px;
  margin-top: 16px;
}
.repo-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.repo-row a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}
.repo-row a:hover { color: var(--accent); }
.repo-row span {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}

/* ────────────────────── motion media layout ────────────────────── */
.media-block {
  display: grid;
  grid-template-columns: minmax(280px, 440px) minmax(0, 1fr);
  gap: 20px 32px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.media-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.media-frame iframe,
.media-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 24px;
  margin-top: 16px;
}
.pipeline-step-num {
  font-size: 11.5px;
  color: var(--accent);
}
.pipeline-step-title {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}
.pipeline-step-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ───────────────────────── blogs & prose ───────────────────────── */
.blog-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.blog-row-meta {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.blog-row-title {
  display: inline-block;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--accent);
  text-decoration: none;
}
.blog-row-title:hover { opacity: .8; }
.blog-row-desc {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  max-width: 66ch;
}

.prose {
  padding-top: 24px;
  font-size: 15px;
  line-height: 1.72;
  color: var(--fg);
}
.prose > * + * { margin-top: 18px; }
.prose h2 {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--fg);
}
.prose h3 {
  margin-top: 26px;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--accent);
}
.prose p { color: var(--muted); }
.prose strong { color: var(--fg); font-weight: 500; }
.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color .2s, text-decoration-color .2s;
}
.prose a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
.prose code {
  font-family: inherit;
  font-size: .92em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--hover);
  color: var(--fg);
}
.prose blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent);
  color: var(--fg);
}
.prose blockquote p { color: var(--fg); }
.prose blockquote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 12.5px;
  color: var(--faint);
}
.prose figure {
  margin: 26px 0;
}
.prose figure img,
.prose figure svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, var(--fg) 2%);
}
.prose figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--faint);
}
.prose .callout {
  margin: 22px 0;
  padding: 10px 14px;
  border-left: 2px solid var(--line-strong);
  background: var(--hover);
  font-size: 13.5px;
  color: var(--muted);
}
.prose .callout strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
}
.prose ul,
.prose ol {
  padding-left: 20px;
  color: var(--muted);
}
.prose li + li { margin-top: 6px; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.prose th {
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.prose td { color: var(--muted); }
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}
.blog-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.blog-nav a {
  color: var(--muted);
  text-decoration: none;
}
.blog-nav a:hover { color: var(--accent); }

/* ────────────────────── individual project + githubby ──────────── */
.gh-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gh-meta-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gh-lang-bar {
  display: flex;
  height: 4px;
  width: 100%;
  border-radius: 99px;
  overflow: hidden;
  background: var(--line);
  margin-top: 14px;
  gap: 1px;
}
.gh-lang-seg { height: 100%; }
.gh-lang-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--faint);
}
.gh-lang-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
}

.gh-commits {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gh-commit-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.gh-commit-sha {
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.gh-commit-sha:hover { text-decoration: underline; }
.gh-commit-msg {
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-commit-age {
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

.proj-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.proj-repo-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.proj-repo-cta:hover { text-decoration: underline; text-underline-offset: 4px; }

.stack-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
}
.stack-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.stack-icon {
  width: 13px;
  height: 13px;
  opacity: .78;
  filter: invert(1);
}
[data-theme="light"] .stack-icon {
  filter: none;
}

.proj-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.proj-shot {
  margin: 0;
}
.proj-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.proj-shot figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--faint);
}

.proj-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
}
.proj-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.sev-badge {
  display: inline;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--accent);
}
.sev-critical { color: #e06d6d; }
.sev-high { color: #e0a96d; }
.sev-ok { color: var(--ok); }

#software { --sector-color: #d7b78c; }
#motion   { --sector-color: #8fbf8a; }
#pentesting { --sector-color: #e08a6d; }
#design   { --sector-color: #9bb3d6; }

[data-theme="light"] #software   { --sector-color: #9a6224; }
[data-theme="light"] #motion     { --sector-color: #3a7544; }
[data-theme="light"] #pentesting { --sector-color: #b84b2c; }
[data-theme="light"] #design     { --sector-color: #3d5f8f; }

.proj-desc {
  margin-top: 3px;
  max-width: 74ch;
  font-size: 14.5px;
  color: var(--muted);
}

/* ──────────────────────────── footer ───────────────────────────── */
.footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--faint);
  font-size: 14.5px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.footer a {
  text-decoration: none;
  transition: color .25s;
}
.footer a:hover { color: var(--fg); }

/* ───────────────────────── custom scrollbar ────────────────────── */
.rail {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: 30px;
  height: 100vh;
  height: 100svh;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.rail-track {
  position: absolute;
  top: 0;
  right: 11px;
  width: 1px;
  height: 100%;
  background: var(--line);
  transition: background-color .4s, opacity .4s;
}
.rail:hover .rail-track { background: var(--line-strong); }
.rail-thumb {
  position: absolute;
  top: 0;
  right: 9px;
  width: 5px;
  height: 40px;
  border-radius: 99px;
  background: var(--muted);
  opacity: .4;
  transition: opacity .3s, background-color .3s;
  will-change: transform;
}
.rail:hover .rail-thumb,
.rail.dragging .rail-thumb { opacity: .9; background: var(--fg); }

.rail-tick {
  position: absolute;
  right: 7px;
  width: 9px;
  height: 1px;
  padding: 0;
  border: 0;
  background: var(--muted);
  opacity: .35;
  cursor: pointer;
  transform: translateY(-50%);
  transition: width .3s var(--ease), right .3s var(--ease), opacity .3s, background-color .3s;
}
.rail-tick::before { content: ""; position: absolute; inset: -9px -12px; }
.rail-tick:hover,
.rail-tick:focus-visible {
  right: 3px;
  width: 17px;
  background: var(--fg);
  opacity: 1;
  outline: none;
}
.rail-tick.is-active { right: 5px; width: 13px; background: var(--accent); opacity: .9; }

.rail-tick span {
  position: absolute;
  top: 50%;
  right: 27px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--fg);
  font-size: 9.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(4px, -50%);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.rail-tick:hover span,
.rail-tick:focus-visible span { opacity: 1; transform: translate(0, -50%); }

/* ──────────────────────── reveal animation ─────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .85s var(--ease), transform .85s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: .45s; animation-timing-function: ease; }

/* ───────────────────────────── mobile ──────────────────────────── */
@media (max-width: 1160px) {
  .shell-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .blogs-aside {
    position: static;
    padding-left: 0;
    padding-top: 24px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .nav-search { max-width: 240px; }
  .search-kbd { display: none; }
  .detail-block,
  .repo-table,
  .media-block,
  .pipeline-grid,
  .blog-row {
    grid-template-columns: 1fr;
  }
  .detail-lead { position: static; }
  .shell {
    padding-left: var(--pad);
    padding-right: var(--pad);
  }
  .toc {
    top: var(--header-h);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100svh - var(--header-h));
    padding: 18px var(--pad) 28px;
    background: var(--glass);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    display: none;
  }
  .toc.is-open { display: block; }
  .sectors { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --header-h: 106px; }
  .header-inner {
    flex-wrap: wrap;
    align-content: center;
    gap: 10px 12px;
    padding-block: 10px;
  }
  .status {
    gap: 10px;
  }
  .nav-search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
  }
  .sector {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .sector-name {
    position: static;
  }
}

@media (max-width: 390px) {
  .battery { display: none; }
}

@media (hover: none), (pointer: coarse) {
  .rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .rail-thumb { transition: none; }
}
