/* palette: crisp white (#FFFFFF), deep matte black (#111111), light border (#E5E5E5), nothing red (#FF2E2E) */
/* typography: space grotesk & jetbrains mono (lowercase) */

/* reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-card: #ffffff;

  --border: #e5e5e5;
  --border-dark: #111111;

  --text: #111111;
  --text-muted: #4a4a4a;
  --text-dim: #6a6a6a;

  --red-accent: #ff2e2e;
  --red-text: #d92525;
  --orange-accent: #ff6a1a;
  --orange-text: #c24e00;

  --nav-bg: rgba(255, 255, 255, 0.92);

  --font-sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --container: 1120px;
  --nav-h: 58px;
}

/* dark theme, when settings says so these take over from root */
[data-theme="dark"] {
  --bg: #0c0c0e;
  --bg-subtle: #131316;
  --bg-card: #131316;
  --border: #2a2a32;
  --border-dark: #f0f0f4;
  --text: #f5f5fa;
  --text-muted: #b4b4c2;
  --text-dim: #8b8b9a;
  --red-text: #ff5a5a;
  --nav-bg: rgba(12, 12, 14, 0.92);
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.loading {
  overflow: hidden;
}

/* dot matrix canvas background */
#dot-matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* entrance diagonal dot wave loader (same as oxygenated) */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.loader-overlay.fading {
  opacity: 0;
}

.loader-overlay.hidden {
  display: none;
}

#loader-wave-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.loader-center {
  position: relative;
  z-index: 2;
}

.loader-text {
  font-family: var(--font-sans);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  animation: loaderFadeIn 0.8s ease;
}

@keyframes loaderFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* folder-tab style navigation (two tiers: big page tabs + small section tabs) */
:root {
  --subnav-h: 34px;
}

.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

/* folder tabs */
.folder-tabs {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: flex-end;
}

.nav-right {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

/* settings gear button, same folder shape as the nav tabs */
.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  margin-right: -4px;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border-dark);
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg-subtle);
  border-radius: 4px 4px 0 0;
  transition: all 0.2s ease;
}

.tab-item:hover,
.tab-item.active {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border-dark);
}

/* small tab strip under the big tabs - jumps inside the long home page,
   swaps panels on deltavr */
.subtabs-bar {
  border-top: 1px solid var(--border);
}

.subtabs-row {
  display: flex;
  align-items: center;
}

.subtabs-group {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.subtabs-group.hidden {
  display: none;
}

.subtabs-group::-webkit-scrollbar {
  display: none;
}

.sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.sub-tab:hover {
  color: var(--text);
}

.sub-tab.active {
  color: var(--red-text);
}

/* anchored sections on the long home page stop below the two-tier header */
#section-about,
#section-projects,
#section-hardware,
#section-contact {
  scroll-margin-top: calc(var(--nav-h) + var(--subnav-h) + 12px);
}

/* layout containers */
main {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--nav-h) + var(--subnav-h));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
}

body:not(.loading) main {
  opacity: 1;
  transform: translateY(0);
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  margin-bottom: 36px;
}

.red-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-accent);
}

/* hero section */
.hero-section {
  padding: 60px 0 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

/* pfp wrapper */
.pfp-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  cursor: pointer;
  margin-bottom: 24px;
}

.pfp-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border-dark);
  display: block;
}

#pfp-heart-canvas {
  position: absolute;
  top: -19px;
  left: -19px;
  width: 110px;
  height: 110px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.pfp-wrapper:hover #pfp-heart-canvas {
  opacity: 1;
}

.hero-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.hero-name {
  font-family: var(--font-sans);
  font-size: clamp(48px, 6vw, 84px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 20px;
}

.hero-bio {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 460px;
  margin-bottom: 28px;
}

.hero-links {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-black {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

.btn-black:hover {
  background: #222;
}

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--text);
}

/* single loud accent for the primary release CTA */
.btn-accent {
  background: var(--orange-text);
  color: #fff;
  border: 1px solid var(--orange-text);
}

.btn-accent:hover {
  background: #a34400;
  border-color: #a34400;
}

.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tag {
  padding: 3px 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

/* 3d draggable dot matrix card */
.cad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 20px;
  transition: border-color 0.2s ease;
}

.cad-card:hover {
  border-color: var(--border-dark);
}

.cad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.red-indicator {
  color: var(--red-accent);
  font-size: 8px;
}

.cad-coords {
  font-size: 10px;
  color: var(--red-accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cad-viewport {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
}

.cad-viewport:active {
  cursor: grabbing;
}

#cad-3d-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.cad-hint {
  position: absolute;
  bottom: 8px;
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 3px 8px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.cad-footer {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-text {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}

.btn-text:hover {
  color: var(--text);
}

/* about section */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 28px;
}

.card-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.card-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 14px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.pill {
  padding: 3px 8px;
  font-size: 10px;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

/* projects section */
.projects-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease;
}

.project-card:hover {
  border-color: var(--border-dark);
}

.project-card.featured {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
}

.proj-meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin-bottom: 16px;
}

.proj-badge {
  padding: 2px 6px;
  background: var(--text);
  color: var(--bg);
}

.proj-date {
  color: var(--text-dim);
}

.proj-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.proj-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.proj-link {
  text-decoration: none;
  color: inherit;
}

.proj-link:hover {
  color: var(--text);
}

.proj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.proj-tags span {
  font-size: 9px;
  color: var(--text-dim);
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* ── HARDWARE SECTION ─────────────────────────────────────── */
.hardware-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.hw-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px;
}

.hw-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.hw-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* contact section */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 40px;
  max-width: 600px;
}

.contact-title {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.contact-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.c-link {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  background: var(--bg-subtle);
  transition: all 0.2s ease;
}

.c-link:hover {
  border-color: var(--border-dark);
  background: var(--bg);
}

.c-type {
  font-size: 10px;
  color: var(--text-dim);
}

.c-val {
  font-weight: 700;
}

/* footer */
.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
}

/* ── modal (pfp big square) ──────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  padding: 20px;
}

.modal-bg.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.modal-x {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
}

.modal-x:hover {
  color: var(--text);
}

.pfp-expanded-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
}

.pfp-expanded {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pfp-wrapper {
  cursor: pointer;
}

/* ── settings drawer ────────────────────────────────────── */
.drawer-bg {
  position: fixed;
  inset: 0;
  z-index: 299;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.drawer-bg.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: -360px;
  width: 320px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 300;
  padding: 24px 20px;
  overflow-y: auto;
  transition: right 0.3s ease;
}

.drawer.open {
  right: 0;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.setting-opts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.opt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.opt:hover {
  border-color: var(--border-dark);
}

.opt.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* responsive breakpoints */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hardware-grid {
    grid-template-columns: 1fr;
  }

  /* folder tabs become a scrollable strip on mobile instead of vanishing */
  .nav-container {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    height: auto;
  }

  :root {
    --nav-h: 92px;
  }

  .folder-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .folder-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .drawer {
    width: 280px;
    right: -300px;
  }
}

/* ============ panel router ============ */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* ============ deltavr overview ============ */
.stat-strip-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-strip-col .stat-box {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.stat-strip-col .stat-box:hover {
  border-color: var(--border-dark);
}

.stat-num-sm {
  font-size: 15px !important;
}

.featured-border {
  border-color: var(--border-dark);
  background: var(--bg-subtle);
}

.board-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

/* ============ pcb viewer ============ */
.viewer-controls {
  display: flex;
  gap: 14px;
  align-items: center;
}

.btn-text.active {
  color: var(--red-accent);
}

/* ============ schematic viewer ============ */
.sch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
}

.sch-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-dim);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sch-stage {
  position: relative;
  height: 600px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.sch-stage:active {
  cursor: grabbing;
}

.sch-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  background: #ffffff;
}

.sch-canvas svg {
  display: block;
}

.sch-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
}

.sch-hint {
  margin-top: 10px;
  font-size: 9px;
  color: var(--text-dim);
}

/* schematic svg colors follow the theme */
[data-theme="dark"] .sch-canvas svg {
  filter: invert(0.92) hue-rotate(180deg);
}

/* ============ gallery ============ */
/* lapse video cards + goal bar + project bars */
.goal-track {
  margin-top: 10px;
  height: 4px;
  background: var(--border);
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  width: 0;
  background: var(--red-accent);
  transition: width 0.4s ease;
}

#proj-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proj-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  align-items: center;
}

.proj-name {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-fill {
  background: var(--red-accent);
  color: #fff;
  font-size: 10px;
  padding: 4px 8px;
  min-width: fit-content;
  white-space: nowrap;
}

.lapse-card {
  break-inside: avoid;
  margin-bottom: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
}

.lapse-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-subtle);
  overflow: hidden;
}

.lapse-thumb img,
.lapse-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lapse-thumb video {
  object-fit: contain;
  background: #000;
}

.lapse-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  pointer-events: none;
}

.lapse-meta {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.lapse-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.lapse-desc {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.lapse-sub {
  font-size: 10px;
}

.gallery-section .gallery-grid,
.gallery-grid {
  column-count: 3;
  column-gap: 16px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 16px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  transition: border-color 0.2s ease;
}

.gallery-item:hover {
  border-color: var(--border-dark);
}

.gallery-item img {
  width: 100%;
  display: block;
}

.gallery-caption {
  font-size: 9px;
  color: var(--text-dim);
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .gallery-section .gallery-grid,
  .gallery-grid {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .gallery-section .gallery-grid,
  .gallery-grid {
    column-count: 1;
  }
}

/* ============ mobile polish + a11y ============ */
@media (max-width: 720px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-span-4,
  .dash-span-8,
  .dash-span-12 {
    grid-column: span 1;
  }

  .stat-strip-col .stat-box {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .stat-num {
    font-size: 22px;
  }

  .hero-links,
  .contact-links,
  .board-toggle {
    flex-wrap: wrap;
  }

  .hero-links .btn,
  .btn-black,
  .btn-accent {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1 1 140px;
  }

  .tab-item,
  .sub-tab {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .folder-tabs,
  .subtabs-group {
    gap: 4px;
  }

  .section {
    padding: 28px 0;
  }

  .container {
    padding: 0 14px;
  }

  .hero-name {
    font-size: 28px;
  }

  .hero-bio,
  .card-text,
  .proj-desc {
    font-size: 12px;
    line-height: 1.65;
  }

  .heatmap-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #chart-weekly,
  #chart-rhythm {
    min-width: 0;
    width: 100%;
  }

  .modal {
    max-width: 100vw;
    width: 100%;
    border-radius: 0;
  }

  .drawer {
    width: min(320px, 100vw);
    right: min(-320px, -100vw);
  }

  .drawer.open {
    right: 0;
  }

  .footer-inner {
    flex-direction: column;
    gap: 8px;
  }

  .dash-card {
    padding: 14px;
  }

  .pie-legend,
  .pie-legend-inline {
    font-size: 9px;
    overflow-wrap: normal;
    word-break: normal;
  }

  .meta-row {
    font-size: 8px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .stat-num {
    overflow-wrap: normal;
    word-break: normal;
  }

  .subtabs-row,
  .subtabs-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
    width: 100%;
  }

  .subtabs-group::-webkit-scrollbar {
    display: none;
  }

  .sub-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* keyboard focus - visible but still on-brand */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--red-accent);
  outline-offset: 2px;
}

/* dont punish people who get motion sick */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.modal-wide {
  max-width: 900px;
}

.img-lightbox-wrap {
  max-height: 76vh;
  overflow: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.img-lightbox-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

/* ============ stats dashboard (hackatime-ish) ============ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 20px;
  grid-column: span 12;
}

.dash-span-4 { grid-column: span 4; }
.dash-span-8 { grid-column: span 8; }
.dash-span-12 { grid-column: span 12; }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  margin-bottom: 14px;
}

.badge {
  padding: 2px 6px;
  background: var(--text);
  color: var(--bg);
  letter-spacing: 0.04em;
}

.dim {
  color: var(--text-dim);
}

.pie-legend {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.pie-legend-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
}

.legend-row-line {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.legend-row-line.pie-legend-inline {
  width: auto;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  vertical-align: baseline;
}

.ai-swatch {
  background: var(--red-accent);
}

.gauge-caption {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}

.ai-bar-wrap {
  height: 26px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
}

.ai-bar-human {
  height: 100%;
  background: var(--text);
}

.ai-bar-ai {
  height: 100%;
  background: var(--red-accent);
}

.ai-bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
}

.cat-row,
.commit-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--text-muted);
}

.cat-row:last-child,
.commit-row:last-child {
  border-bottom: none;
}

.commit-row a {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commit-row a:hover {
  color: var(--text);
}

.commit-sha {
  color: var(--red-text);
  font-weight: 700;
}

.heatmap-wrap {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 8px;
}

/* last-wins mobile overrides for cards that define columns later in the file */
@media (max-width: 720px) {
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dash-span-4,
  .dash-span-8,
  .dash-span-12 {
    grid-column: 1 / -1;
  }

  .pie-legend-inline {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    gap: 8px;
    flex-wrap: wrap;
  }
}