* { box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --text: #eaeaea;

  /* pixel-art accent font (keycaps, small labels) */
  --pixel-font: "Press Start 2P", monospace;
  /* faint CRT scanline overlay tint for glass panels */
  --scanline: rgba(255,255,255,0.035);
  /* pixel accent color for focus rings / keycap edges */
  --pixel-accent: #6be0d0;

  --glass-bg: rgba(20,20,20,0.4);
  --glass-border: rgba(255,255,255,0.08);
  --glass-highlight: rgba(255,255,255,0.1);

  --card-bg: linear-gradient(
    145deg,
    rgba(255,255,255,0.06),
    rgba(255,255,255,0.02)
  );
  --card-border: rgba(255,255,255,0.08);
  --card-hover-bg: linear-gradient(
    145deg,
    rgba(255,255,255,0.6),
    rgba(255,255,255,0.25)
  );
  --card-hover-text: #111;

  --code-bg: linear-gradient(
    145deg,
    rgba(20,20,20,0.8),
    rgba(20,20,20,0.6)
  );
  --code-border: rgba(255,255,255,0.08);

  --inline-code-bg: rgba(255,255,255,0.08);

  --table-head: rgba(255,255,255,0.06);
  --table-row: rgba(255,255,255,0.02);

  --link-hover-underline: #fff;

  --copy-btn-bg: rgba(255,255,255,0.06);
  --copy-btn-border: rgba(255,255,255,0.1);
  --copy-btn-hover: rgba(255,255,255,0.12);

  --shadow-strong: rgba(0,0,0,0.5);
  --shadow-soft: rgba(0,0,0,0.2);

  --callout-warning-border: #e3b341;
  --callout-warning-bg: rgba(227,179,65,0.08);

  --callout-info-border: #58a6ff;
  --callout-info-bg: rgba(88,166,255,0.08);

  --callout-important-border: #a371f7;
  --callout-important-bg: rgba(163,113,247,0.08);

  --callout-note-border: #8b949e;
  --callout-note-bg: rgba(139,148,158,0.08);

  --callout-caution-border: #ff7b72;
  --callout-caution-bg: rgba(255,123,114,0.08);

  --syntax-kw: #7aa2f7;
  --syntax-str: #9ece6a;
  --syntax-com: #6b7280;
  --syntax-num: #f78c6c;
  --syntax-fn: #82aaff;

  --table-hover: rgba(255,255,255,0.04);

  --scrollbar-thumb: rgba(160, 235, 222, 0.30);
  --scrollbar-thumb-hover: rgba(160, 235, 222, 0.55);
}

body.light {
  --bg: #f5f5f5;
  --text: #111;

  --scanline: rgba(0,0,0,0.04);
  --pixel-accent: #0b7d70;

  --glass-bg: rgba(255,255,255,0.55);
  --glass-border: rgba(0,0,0,0.08);
  --glass-highlight: rgba(255,255,255,0.6);

  --card-bg: linear-gradient(
    145deg,
    rgba(255,255,255,0.9),
    rgba(240,240,240,0.6)
  );
  --card-border: rgba(0,0,0,0.08);
  --card-hover-bg: linear-gradient(
    145deg,
    rgba(0,0,0,0.5),
    rgba(0,0,0,0.2)
  );
  --card-hover-text: #f5f5f5;

  --code-bg: linear-gradient(
    145deg,
    rgba(255,255,255,0.95),
    rgba(240,240,240,0.85)
  );
  --code-border: rgba(0,0,0,0.08);

  --inline-code-bg: rgba(0,0,0,0.05);

  --table-head: rgba(0,0,0,0.05);
  --table-row: rgba(0,0,0,0.02);

  --link-hover-underline: #000;

  --copy-btn-bg: rgba(0,0,0,0.06);
  --copy-btn-border: rgba(0,0,0,0.12);
  --copy-btn-hover: rgba(0,0,0,0.08);

  --shadow-strong: rgba(0,0,0,0.2);
  --shadow-soft: rgba(0,0,0,0.08);

  --callout-warning-bg: rgba(227,179,65,0.12);
  --callout-info-bg: rgba(88,166,255,0.12);
  --callout-caution-bg: rgba(255,123,114,0.12);
  --callout-important-bg: rgba(163,113,247,0.12);
  --callout-note-bg: rgba(139,148,158,0.12);

  --syntax-kw: #005cc5;
  --syntax-str: #22863a;
  --syntax-com: #9ca3af;
  --syntax-num: #d73a49;
  --syntax-fn: #6f42c1;

  --table-hover: rgba(0,0,0,0.04);

  --scrollbar-thumb: rgba(11, 125, 112, 0.35);
  --scrollbar-thumb-hover: rgba(11, 125, 112, 0.6);
}

html, body {
  margin: 0;
  font-family: "Gabarito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  width: 100%;
  min-width: 100vw;
  overflow-x: hidden;
}

/* hide UI */
body.canvas-mode .content,
body.canvas-mode .footer {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.content,
.footer {
  transition: opacity 0.3s ease, transform 0.3s ease,
    background 0.4s ease, border 0.4s ease, box-shadow 0.4s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   Scrollbar — slim, visible, inset so it doesn't protrude.
   Themed via --scrollbar-thumb (recolors with light/dark).
========================================================= */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  /* 3px transparent border + padding-box clip keeps the visible thumb slim */
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

/* =========================================================
   Minimal mode — shader canvas disabled, clean solid bg.
   Disables GPU-heavy backdrop-filter so low-end / battery-
   conscious devices stay cool without sacrificing looks.
   The glass panels become solid-ish tinted cards with the
   same feel, just no blur.
========================================================= */
body.minimal-mode {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(107, 224, 208, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(255, 0, 128, 0.03) 0%, transparent 50%);
}

body.minimal-mode #canvas {
  opacity: 0;
  pointer-events: none;
}

body.minimal-mode::before {
  opacity: 0;
}

body.minimal-mode .glass,
body.minimal-mode .navbar,
body.minimal-mode .content {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.minimal-mode .content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 60px var(--shadow-strong);
}

body.minimal-mode .navbar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px var(--shadow-soft);
}

/* =========================================================
   Pixel + glass shared primitives
   .glass / .scanlines / .kbd / pixel focus ring
========================================================= */

/* =========================================================
   Datamosh text selection
========================================================= */
::selection {
  background: rgba(255, 0, 128, 0.85);
  color: #e9fffb;
  text-shadow: 1px 0 rgba(0, 225, 220, 0.9), -1px 0 rgba(255, 0, 128, 0.6);
}
::-moz-selection {
  background: rgba(255, 0, 128, 0.85);
  color: #e9fffb;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 10px 40px var(--shadow-strong),
    inset 0 1px 0 var(--glass-highlight);
  transition: background 0.4s ease, border 0.4s ease;
}

/* CRT scanlines — sits above the panel bg, below its content */
.scanlines { position: relative; }
.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    var(--scanline) 0,
    var(--scanline) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.6;
}

/* =========================
   Pixel keycap
========================= */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 0.35em 0.5em;

  font-family: var(--pixel-font);
  font-size: 9px;
  line-height: 1;
  text-transform: lowercase;
  color: var(--text);

  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* =========================
   Blocky pixel focus ring
========================= */
.card:focus,
.card:focus-visible,
.nav-btn:focus-visible,
.theme-btn:focus-visible {
  outline: 2px solid var(--pixel-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================
   Glitch / corrupt hover for buttons
========================================================= */
.nav-btn,
.theme-btn,
.nav-link,
.help-close,
.md-copy-btn {
  position: relative;
}

/* scanline flash overlay (icon buttons only) */
.nav-btn,
.theme-btn,
.help-close {
  overflow: hidden;
}
.nav-btn::after,
.theme-btn::after,
.help-close::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg, var(--scanline) 0 1px, transparent 1px 3px
  );
  transition: opacity 0.1s steps(2, end);
}

.nav-btn:hover,
.theme-btn:hover,
.nav-link:hover,
.help-close:hover,
.md-copy-btn:hover {
  animation: btnGlitch 0.26s steps(3, end) infinite;
}

.nav-btn:hover::after,
.theme-btn:hover::after,
.help-close:hover::after {
  opacity: 0.7;
}

@keyframes btnGlitch {
  0% {
    transform: translate(0, 0);
    filter: drop-shadow(1px 0 rgba(255, 0, 128, 0.8)) drop-shadow(-1px 0 rgba(0, 225, 220, 0.8));
    text-shadow: 1px 0 rgba(255, 0, 128, 0.7), -1px 0 rgba(0, 225, 220, 0.7);
  }
  33% {
    transform: translate(-1px, 1px);
    filter: drop-shadow(2px 0 rgba(255, 0, 128, 0.9)) drop-shadow(-2px 0 rgba(0, 225, 220, 0.9));
    text-shadow: 2px 0 rgba(255, 0, 128, 0.85), -2px 0 rgba(0, 225, 220, 0.85);
  }
  66% {
    transform: translate(1px, -1px);
    filter: drop-shadow(-2px 0 rgba(255, 0, 128, 0.9)) drop-shadow(2px 0 rgba(0, 225, 220, 0.9));
    text-shadow: -2px 0 rgba(0, 225, 220, 0.85), 2px 0 rgba(255, 0, 128, 0.85);
  }
  100% {
    transform: translate(0, 0);
    filter: none;
    text-shadow: none;
  }
}

/* Transform-free chromatic glitch for elements with their own hover transform. */
.footer-links a:hover,
.card:hover,
.resume-btn:hover {
  animation: glitchTint 0.28s steps(3, end) infinite;
}

@keyframes glitchTint {
  0% {
    filter: drop-shadow(2px 0 rgba(255, 0, 128, 0.4)) drop-shadow(-2px 0 rgba(0, 225, 220, 0.4));
    text-shadow: 1px 0 rgba(255, 0, 128, 0.55), -1px 0 rgba(0, 225, 220, 0.55);
  }
  50% {
    filter: drop-shadow(-3px 0 rgba(255, 0, 128, 0.5)) drop-shadow(3px 0 rgba(0, 225, 220, 0.5));
    text-shadow: -2px 0 rgba(0, 225, 220, 0.6), 2px 0 rgba(255, 0, 128, 0.6);
  }
  100% {
    filter: none;
    text-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-btn:hover,
  .theme-btn:hover,
  .nav-link:hover,
  .help-close:hover,
  .md-copy-btn:hover,
  .footer-links a:hover,
  .card:hover,
  .resume-btn:hover {
    animation: none;
  }
}

/* =========================================================
   Retro pixel cursors (served from /frontend/cursors)
========================================================= */
html,
body {
  cursor: url("/frontend/cursors/cursor-arrow.png") 0 0, auto;
}

a,
button,
.card,
.nav-link,
.footer-links a,
[data-link],
[data-action],
summary,
label {
  cursor: url("/frontend/cursors/cursor-target.png") 16 16, pointer;
}

#canvas {
  position: fixed;
  width: 100%;
  height: 100%;
  display: block;

  z-index: 0;
  transition: opacity 0.4s ease;
}

#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

#theme-toggle:hover {
  opacity: 0.7;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;

  background:
    radial-gradient(circle at center,
      rgba(0,0,0,0.05),
      rgba(0,0,0,0.5)
    );
  transition: opacity 0.4s ease;
}

main {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: auto auto 80px;
}

/* =========================
   NAVBAR
========================= */
.navbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 1000px;

  z-index: 5;
  border-radius: 16px;
}

/* =========================
   INNER
========================= */
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-ctrl {
  display: flex;
  gap: 4px;
}

/* =========================
   ICON / CHROME BUTTONS
========================= */
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;

  color: var(--text);
  font-size: 18px;
  line-height: 1;

  background: var(--copy-btn-bg);
  border: 1px solid var(--copy-btn-border);
  border-radius: 8px;
  cursor: pointer;

  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
  opacity: 0.7;
}

.nav-btn:hover {
  opacity: 1;
  background: var(--copy-btn-hover);
  transform: translateY(-1px);
}

.nav-btn:active { transform: translateY(0) scale(0.94); }

/* the "?" help button gets the pixel font */
.nav-btn-pixel {
  font-family: var(--pixel-font);
  font-size: 11px;
}

/* =========================
   LINKS
========================= */
.nav-links a {
  margin-left: 20px;
  text-decoration: none;

  color: var(--text);
  opacity: 0.6;

  position: relative;
  transition: 0.25s;
}

/* pill container */
.nav-link {
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  z-index: 1;
}

/* =========================
   ACTIVE (glass pill)
========================= */
.nav-link.active {
  background: var(--glass-highlight);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid var(--glass-border);

  box-shadow:
    inset 0 1px 1px var(--glass-highlight),
    0 4px 20px var(--shadow-soft);
}

/* =========================
   HOVER
========================= */
.nav-links a:hover {
  opacity: 1;
}

/* underline animation */
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;

  width: 0%;
  height: 1px;

  background: var(--link-hover-underline);
  transition: 0.3s;
}

.nav-links a:hover::after {
  width: 100%;
}

/* =========================
   THEME BUTTON
========================= */
.theme-btn {
  background: var(--copy-btn-bg);
  border: 1px solid var(--copy-btn-border);

  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;

  transition: all 0.25s ease;
}

.theme-btn:hover {
  background: var(--copy-btn-hover);
  transform: scale(1.05);
}

/* =========================
   FOOTER
========================= */
.footer {
  --footer-porcelain: #f2f4f5;
  --footer-ash: #b8bdc2;
  --footer-smoke: #747b82;
  --footer-ink: #111820;
  --footer-blueblack: #182331;
  --footer-brownbark: #2a211d;
  --footer-coal: #08090b;
  --footer-glass: rgba(17, 24, 32, 0.72);
  --footer-line: rgba(242, 244, 245, 0.16);
  --footer-shine: rgba(242, 244, 245, 0.2);

  font-family: inherit;
  margin-top: 120px;
  padding: 2px;
  z-index: 5;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(120deg, rgba(242, 244, 245, 0.22), transparent 27%),
    linear-gradient(300deg, rgba(42, 33, 29, 0.58), transparent 34%),
    linear-gradient(180deg, var(--footer-blueblack), var(--footer-coal));
  border: 1px solid var(--footer-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--footer-porcelain);
  box-shadow:
    0 18px 45px var(--shadow-soft),
    inset 0 1px 0 var(--footer-shine);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.footer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 10px, rgba(242, 244, 245, 0.09) 10px 11px, transparent 11px 22px),
    linear-gradient(0deg, transparent 0 10px, rgba(116, 123, 130, 0.08) 10px 11px, transparent 11px 22px);
  opacity: 0.26;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.footer:hover::before {
  opacity: 0.5;
  transform: translateX(8px);
}

.footer::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--footer-shine), transparent 42%),
    radial-gradient(circle at 8% 18%, rgba(184, 189, 194, 0.22), transparent 32%),
    radial-gradient(circle at 92% 88%, rgba(42, 33, 29, 0.5), transparent 34%);
  opacity: 0.72;
}

.footer:hover {
  transform: translateY(-2px);
  border-color: rgba(242, 244, 245, 0.26);
  box-shadow:
    0 22px 55px var(--shadow-soft),
    0 0 0 1px rgba(116, 123, 130, 0.18),
    inset 0 1px 0 var(--footer-shine);
}

/* =========================
   LAYOUT
========================= */
.footer-inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  min-height: 82px;
  padding: 20px 24px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(242, 244, 245, 0.07), transparent 48%),
    linear-gradient(300deg, rgba(42, 33, 29, 0.28), transparent 55%),
    var(--footer-glass);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.footer-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--footer-porcelain);
  border: 1px solid rgba(242, 244, 245, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(242, 244, 245, 0.2), transparent 52%),
    rgba(24, 35, 49, 0.78);
  box-shadow:
    inset 0 1px 0 var(--footer-shine),
    4px 4px 0 rgba(42, 33, 29, 0.56);
  transition:
    transform 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.footer:hover .footer-mark {
  color: #ffffff;
  transform: translate(-2px, -2px);
  box-shadow:
    inset 0 1px 0 var(--footer-shine),
    6px 6px 0 rgba(42, 33, 29, 0.68),
    -3px -3px 0 rgba(184, 189, 194, 0.12);
}

.footer-brand {
  font-family: var(--pixel-font);
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.35;
}

.footer-meta {
  font-size: 12px;
  line-height: 1.6;
  color: var(--footer-ash);
}

.footer-nowplaying {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 4px 9px;
  border: 1px solid rgba(242, 244, 245, 0.14);
  border-radius: 10px;
  background: rgba(8, 9, 11, 0.34);
  box-shadow: inset 0 1px 0 var(--footer-shine);
  min-width: 0;
  max-width: 280px;
}

.np-label {
  font-family: var(--pixel-font);
  font-size: 7px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--pixel-accent);
  opacity: 0.8;
  flex-shrink: 0;
}

.np-track-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.np-art {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
}

.np-art-fallback {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
  background: var(--glass-highlight);
}

.np-body {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  color: var(--footer-porcelain);
}

.np-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecf8f;
  flex-shrink: 0;
  animation: npPulse 1.6s ease-in-out infinite;
}

@keyframes npPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.np-track {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.np-sep {
  opacity: 0.4;
  flex-shrink: 0;
}

.np-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.7;
  font-size: 11px;
}

.np-offline {
  font-size: 11px;
  opacity: 0.4;
  font-style: italic;
}

/* =========================
   LINKS
========================= */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.footer-links a {
  isolation: isolate;
  font-size: 13px;
  line-height: 1;
  position: relative;
  overflow: hidden;
  padding: 11px 12px;
  border: 1px solid rgba(242, 244, 245, 0.14);
  border-radius: 8px;
  color: var(--footer-porcelain);
  background: rgba(8, 9, 11, 0.28);
  box-shadow: inset 0 1px 0 var(--footer-shine);
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease;
}

.footer-links a::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background:
    linear-gradient(110deg, transparent 0 35%, rgba(242, 244, 245, 0.22) 48%, transparent 62%),
    linear-gradient(180deg, rgba(184, 189, 194, 0.14), transparent);
  opacity: 0;
  transform: translateX(-50%);
  transition:
    opacity 0.25s ease,
    transform 0.45s ease;
}

.footer-links a:hover::before {
  opacity: 1;
  transform: translateX(50%);
}

.footer-links a:hover {
  transform: translateY(-3px);
  color: #ffffff;
  border-color: rgba(242, 244, 245, 0.34);
  background:
    linear-gradient(135deg, rgba(242, 244, 245, 0.1), transparent 55%),
    rgba(24, 35, 49, 0.78);
  box-shadow:
    0 10px 24px var(--shadow-soft),
    3px 3px 0 rgba(42, 33, 29, 0.48),
    inset 0 1px 0 var(--footer-shine);
}

.footer-links a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  background: var(--footer-ash);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition:
    opacity 0.2s ease,
    transform 0.24s steps(4, end);
}

.footer-links a:hover::after {
  opacity: 0.9;
  transform: scaleX(1);
}

@media (max-width: 720px) {
  .footer {
    margin-top: 80px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
  }

  .footer-nowplaying {
    display: none;
  }

  .footer-links {
    width: 100%;
    justify-content: flex-start;
  }

  .footer-links a {
    flex: 1 1 calc(50% - 10px);
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer,
  .footer::before,
  .footer-mark,
  .np-dot,
  .footer-links a,
  .footer-links a::before,
  .footer-links a::after {
    transition: none;
  }
}

/* =========================
   SECTIONS
========================= */
.section {
  margin-bottom: 100px;
  animation: fadeUp 0.8s ease;
}

/* =========================
   INTRO CARD (home) — glassy, pixel-bordered, hover glow
========================= */
.intro-card {
  --intro-line: rgba(242, 244, 245, 0.16);
  --intro-light: rgba(242, 244, 245, 0.58);
  --intro-mid: rgba(184, 189, 194, 0.34);
  --intro-blueblack: rgba(24, 35, 49, 0.7);
  --intro-brownbark: rgba(42, 33, 29, 0.46);

  position: relative;
  padding: 32px 34px;
  border-radius: 14px;

  background: var(--card-bg);
  border: 1px solid var(--intro-line);
  box-shadow:
    0 12px 44px var(--shadow-strong),
    inset 0 1px 0 var(--glass-highlight);

  transition:
    transform 0.4s ease,
    box-shadow 0.4s ease,
    border-color 0.3s ease;
}

/* animated monochrome border (masked to just the ring) */
.intro-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.6px;

  background: linear-gradient(
    90deg,
    var(--intro-blueblack),
    var(--intro-mid),
    var(--intro-light),
    var(--intro-brownbark),
    var(--intro-mid),
    var(--intro-blueblack)
  );
  background-size: 320% 100%;

  /* punch out the center so only the border ring shows */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
          mask-composite: exclude;

  opacity: 0.6;
  pointer-events: none;
  animation: introFlow 9s linear infinite;
  transition: opacity 0.3s ease;
}

.intro-card:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 244, 245, 0.24);
  box-shadow:
    0 20px 56px var(--shadow-strong),
    0 0 0 1px rgba(184, 189, 194, 0.12),
    inset 0 0 30px var(--glass-highlight);
}

.intro-card:hover::before {
  opacity: 1;
  animation-duration: 4s;
}

@keyframes introFlow {
  to { background-position: 320% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-card::before { animation: none; }
}

.intro-card p {
  margin: 0 0 14px;
  opacity: 0.85;
  line-height: 1.7;
}

.intro-card p:last-child {
  margin-bottom: 0;
}

.section h2 {
  font-size: 28px;
  margin-bottom: 24px;
}

/* =========================
   CARD
========================= */
.card {
  position: relative;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  overflow: hidden;

  padding: 28px;
  margin-bottom: 20px;
  border-radius: 18px;

  transform-style: preserve-3d;

  background: var(--card-bg);
  border: 1px solid var(--card-border);

  transition:
    transform 0.3s ease,
    background 0.4s ease,
    color 0.3s ease,
    border 0.3s ease,
    box-shadow 0.4s ease;
}

.card:focus,
.card:focus-visible {
  outline: 2px solid var(--glass-highlight);
  outline-offset: 4px;
  transform: scale(1.02);
}

.card:active {
  transform: scale(0.98);
}

.card:hover {
  transform:
    translateY(-6px)
    rotateX(4deg)
    rotateY(-2deg);

  background: var(--card-hover-bg);
  color: var(--card-hover-text);

  border: 1px solid var(--glass-border);

  box-shadow:
    0 20px 50px var(--shadow-strong),
    inset 0 0 30px var(--glass-highlight);
}

.card h3,
.card p {
  transition: color 0.3s ease, opacity 0.3s ease;
}

.card:hover p {
  opacity: 0.75;
}

/* glass sheen */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;

  background: linear-gradient(
    120deg,
    transparent,
    var(--glass-highlight),
    transparent
  );

  opacity: 0;
  transition: opacity 0.4s ease;
}

.card:hover::before {
  opacity: 1;
}

/* =========================
   PROJECT (expandable preview)
========================= */
.project {
  margin-bottom: 18px;
  border-radius: 20px;
  overflow: hidden;

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);

  transition:
    border 0.3s ease,
    box-shadow 0.35s ease,
    background 0.4s ease;
}

.project:hover,
.project:focus-within,
.project[data-expanded="true"] {
  border: 1px solid var(--glass-highlight);
  box-shadow:
    0 14px 40px var(--shadow-strong),
    inset 0 0 24px var(--glass-highlight);
}

/* selected (keyboard) — a soft rounded glassy ring instead of a square outline */
.project:focus-within {
  box-shadow:
    0 14px 44px var(--shadow-strong),
    inset 0 0 26px var(--glass-highlight),
    0 0 0 1.5px var(--pixel-accent);
}

/* clickable header (a real button for keyboard + a11y) */
.project-head {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;

  margin: 0;
  padding: 22px 52px 22px 24px;

  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* datamosh glitch overlay — eases in on hover, then corrupts in pixel bands */
.project-head::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;

  background:
    linear-gradient(90deg, rgba(255, 0, 128, 0.20), transparent 42%),
    linear-gradient(270deg, rgba(0, 225, 220, 0.20), transparent 42%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 4px);
  mix-blend-mode: screen;

  opacity: 0;
  transition: opacity 0.28s ease;
}

.project:hover .project-head::before,
.project:focus-within .project-head::before {
  opacity: 1;
  animation: projGlitch 0.85s steps(5, end) infinite;
}

/* RGB split on the title while hovering / selected */
.project:hover .project-title-row h3,
.project:focus-within .project-title-row h3 {
  animation: projRGB 0.5s steps(2, end) infinite;
}

/* Light mode: 'screen' blend washes out on a pale background, so darken the
   bands with 'multiply' and stronger colors to keep the datamosh apparent. */
body.light .project-head::before {
  mix-blend-mode: multiply;
  background:
    linear-gradient(90deg, rgba(214, 0, 110, 0.55), transparent 42%),
    linear-gradient(270deg, rgba(0, 150, 170, 0.55), transparent 42%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.07) 0 2px, transparent 2px 4px);
}

body.light .project:hover .project-title-row h3,
body.light .project:focus-within .project-title-row h3 {
  animation: projRGBLight 0.5s steps(2, end) infinite;
}

@keyframes projRGBLight {
  0%   { text-shadow: -1.5px 0 rgba(214, 0, 110, 0.85), 1.5px 0 rgba(0, 150, 170, 0.85); }
  50%  { text-shadow:  1.5px 0 rgba(214, 0, 110, 0.85), -1.5px 0 rgba(0, 150, 170, 0.85); }
  100% { text-shadow: -1.5px 0 rgba(214, 0, 110, 0.85), 1.5px 0 rgba(0, 150, 170, 0.85); }
}

@keyframes projGlitch {
  0%   { clip-path: inset(0 0 78% 0);  transform: translateX(-3px); }
  25%  { clip-path: inset(40% 0 38% 0); transform: translateX(3px); }
  50%  { clip-path: inset(66% 0 10% 0); transform: translateX(-2px); }
  75%  { clip-path: inset(20% 0 60% 0); transform: translateX(2px); }
  100% { clip-path: inset(0 0 0 0);     transform: translateX(0); }
}

@keyframes projRGB {
  0%   { text-shadow: -1.5px 0 rgba(255, 0, 128, 0.7), 1.5px 0 rgba(0, 225, 220, 0.7); }
  50%  { text-shadow:  1.5px 0 rgba(255, 0, 128, 0.7), -1.5px 0 rgba(0, 225, 220, 0.7); }
  100% { text-shadow: -1.5px 0 rgba(255, 0, 128, 0.7), 1.5px 0 rgba(0, 225, 220, 0.7); }
}

/* the rounded glassy ring on .project:focus-within is the focus indicator */
.project-head:focus-visible {
  outline: none;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.project-title-row h3 {
  margin: 0;
  font-size: 20px;
}

.project-blurb {
  margin: 6px 0 0;
  opacity: 0.7;
  font-size: 14px;
}

/* status pill — pixel font, color-coded by state */
.project-status {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;

  padding: 4px 8px;
  border-radius: 6px;

  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

.project-status.s-active,
.project-status.s-stable   { color: #2ecf8f; border-color: rgba(46,207,143,0.5); }
.project-status.s-wip,
.project-status.s-experimental { color: #e3b341; border-color: rgba(227,179,65,0.5); }
.project-status.s-archived { color: #8b949e; border-color: rgba(139,148,158,0.5); }

/* language pill — mirrors the status pill, accent-tinted */
.project-lang {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.5px;

  padding: 4px 8px;
  border-radius: 6px;

  background: var(--glass-highlight);
  border: 1px solid var(--pixel-accent);
  color: var(--pixel-accent);
}

/* date — pushed to the rightmost edge of the header */
.project-date {
  margin-left: auto;
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

/* chevron, rotates when open */
.project-chevron {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 14px;
  opacity: 0.6;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.project[data-expanded="true"] .project-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* dropdown — grid-rows trick animates unknown content height smoothly */
.project-preview {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}

.project[data-expanded="true"] .project-preview {
  grid-template-rows: 1fr;
}

.project-preview-inner {
  overflow: hidden;
  min-height: 0;

  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s steps(4, end) 0.05s, transform 0.3s ease 0.05s;
}

.project[data-expanded="true"] .project-preview-inner {
  opacity: 1;
  transform: translateY(0);
}

/* padded content wrapper (kept inside the clipped inner) */
.project-about,
.project-tags,
.project-shots,
.project-link {
  margin-left: 24px;
  margin-right: 24px;
}

/* pixel tag chips */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.project-tag {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.5px;

  padding: 6px 9px;
  border-radius: 7px;

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  cursor: default;

  transition:
    transform 0.18s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.25s ease;
}

.project-tag::before {
  content: "#";
  opacity: 0.45;
  margin-right: 2px;
}

.project-tag:hover {
  transform: translateY(-2px);

  background: var(--glass-highlight);
  border-color: var(--pixel-accent);
  color: var(--pixel-accent);

  box-shadow:
    0 5px 16px var(--shadow-soft),
    inset 0 0 10px var(--glass-highlight);
}

.project-tag:hover::before {
  opacity: 0.9;
}

.project-about {
  margin-top: 0;
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.85;
}

.project-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.project-shot {
  width: auto;
  height: auto;
  max-width: min(100%, 460px);   /* keep wide shots reasonable */
  max-height: 240px;
  object-fit: contain;

  border-radius: 10px;
  border: 1px solid var(--card-border);
  box-shadow: 0 6px 20px var(--shadow-soft);
}

.project-link {
  display: inline-block;
  margin-top: 18px;
  margin-bottom: 22px;
  padding: 8px 14px;

  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text);

  font-size: 14px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.project-link:hover {
  transform: translateY(-1px);
  background: var(--card-hover-bg);
  color: var(--card-hover-text);
}

@media (prefers-reduced-motion: reduce) {
  .project-preview,
  .project-preview-inner,
  .project-chevron { transition: none; }

  .project:hover .project-head::before,
  .project:focus-within .project-head::before,
  .project:hover .project-title-row h3,
  .project:focus-within .project-title-row h3 { animation: none; }
}

/* =========================
   CONTENT WRAPPER
========================= */
.content {
  position: relative;
  z-index: 2;

  max-width: 950px;
  margin: 100px auto;
  padding: 30px 32px 50px;

  border-radius: 24px;

  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  box-shadow:
    0 20px 60px var(--shadow-strong),
    inset 0 0 60px var(--glass-highlight);
}

/* =========================
   HERO
========================= */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;

  margin-bottom: 80px;
  animation: fadeUp 1s ease;
}

.title {
  font-size: clamp(52px, 9vw, 80px);
  font-weight: 600;
  letter-spacing: -1.5px;
}

.subtitle {
  margin-top: 10px;
  font-size: 18px;
  opacity: 0.6;
}

/* =========================
   ANIMATIONS
========================= */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   LOGO
========================= */
.logo {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.logo-glass {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 4px;
  border-radius: 999px;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.2),
    inset 0 1px 0 var(--glass-highlight);

  transition: all 0.25s ease;
}

.logo-glass img {
  height: 28px;
  width: 28px;
  border-radius: 50%;
  display: block;
}

.logo:hover .logo-glass {
  transform: translateY(-1px) scale(1.02);

  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);

  box-shadow:
    0 6px 18px var(--shadow-strong),
    inset 0 1px 0 var(--glass-highlight);
}

/* =========================
   TOOLTIP
========================= */
.logo-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);

  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;

  border-radius: 8px;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  background: var(--glass-bg);
  border: 1px solid var(--glass-border);

  color: var(--text);

  box-shadow:
    0 6px 20px rgba(0,0,0,0.25),
    inset 0 1px 0 var(--glass-highlight);

  opacity: 0;
  pointer-events: none;

  transition: all 0.2s ease;
}

/* tooltip arrow */
.logo-tooltip::after {
  content: "";
  position: absolute;

  top: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);

  width: 8px;
  height: 8px;

  background: var(--glass-bg);
  border-left: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-border);
}

.logo:hover .logo-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.logo:hover .logo-glass {
  transform: translateY(-2px) scale(1.05);
}

/* glass reflection */
.logo-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;

  background: linear-gradient(
    120deg,
    var(--glass-highlight) 0%,
    transparent 60%
  );

  opacity: 0;
  transition: opacity 0.25s ease;
}

.logo:hover .logo-glass::after {
  opacity: 1;
}

#vim-hints {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  font-family: "Gabarito", system-ui, sans-serif;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px var(--shadow-strong), 0 1px 4px var(--shadow-soft);
}

#vim-hints.show {
  display: flex;
  opacity: 1;
}

/* prefix keycap uses the shared .kbd; just nudge spacing */
.vim-hint-prefix { margin-right: 2px; }

.vim-hint-divider {
  width: 1px;
  height: 14px;
  background: var(--glass-border);
  margin: 0 2px;
}

/* chip = keycap + its label (keycap styled by .kbd) */
.vim-hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.vim-hint-label {
  opacity: 0.6;
}

.vim-hint-sep {
  color: var(--glass-border);
  font-size: 11px;
  margin: 0 1px;
  opacity: 0.5;
}

/* =========================================================
   Keybind help overlay (glass panel + pixel accents)
========================================================= */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.help-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.help-panel {
  width: min(780px, 100%);
  max-height: 80vh;
  overflow-y: auto;

  padding: 22px 24px;
  border-radius: 18px;

  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
}

.help-overlay.show .help-panel {
  transform: translateY(0) scale(1);
}

/* =========================
   HEADER
========================= */
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.help-title {
  font-family: var(--pixel-font);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text);
}

.help-close {
  cursor: pointer;
  opacity: 0.8;
}
.help-close:hover { opacity: 1; }

/* =========================
   GROUPS
========================= */
.help-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.help-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
}

@media (max-width: 720px) {
  .help-body,
  .help-groups {
    grid-template-columns: 1fr;
  }
}

.help-cat {
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--pixel-accent);

  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.help-keys {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.help-desc {
  font-size: 13px;
  opacity: 0.7;
  text-align: right;
}

.help-factoids {
  padding: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, var(--glass-highlight), transparent 48%),
    rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.help-factoids ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-factoids li {
  position: relative;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.55;
  opacity: 0.76;
}

.help-factoids li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  background: var(--pixel-accent);
  box-shadow: 8px 0 0 rgba(255, 0, 128, 0.55);
  transform: translateY(-50%);
}

/* =========================================================
   Page transition overlay (corrupted-pixel + glass)
   Masks the .content panel during a route swap.
========================================================= */
.page-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;

  opacity: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);

  /* stepped fade = chunky/pixel feel */
  transition: opacity 0.16s steps(3, end);
}

.page-fx.show {
  opacity: 1;
}

/* chromatic corruption bands (decorative; the base layer does the masking) */
.page-fx::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    linear-gradient(90deg, rgba(255, 0, 128, 0.55), transparent 45%),
    linear-gradient(270deg, rgba(0, 225, 220, 0.55), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 6px);
  mix-blend-mode: screen;
  opacity: 0;
}

.page-fx.show::before {
  animation: pageCorrupt 0.18s steps(4, end) infinite;
}

@keyframes pageCorrupt {
  0%   { opacity: 0.9;  clip-path: inset(0 0 72% 0);  transform: translateX(-9px); }
  25%  { opacity: 0.55; clip-path: inset(33% 0 42% 0); transform: translateX(10px); }
  50%  { opacity: 0.85; clip-path: inset(60% 0 12% 0); transform: translateX(-6px); }
  75%  { opacity: 0.5;  clip-path: inset(16% 0 58% 0); transform: translateX(7px); }
  100% { opacity: 0.75; clip-path: inset(0 0 0 0);     transform: translateX(0); }
}

/* respect reduced-motion: plain glass fade, no glitch */
@media (prefers-reduced-motion: reduce) {
  .page-fx.show::before { animation: none; opacity: 0; }
}

/* =========================================================
   Theme switch transition — smooth light <-> dark recolor.
   Two layers:
     1. a gated color crossfade so every surface eases between
        palettes instead of snapping (only active during the
        ~0.55s switch window, via body.theme-transition);
     2. a radial "ink ripple" that blooms from the toggle button.
========================================================= */

/* (1) ease the themed properties only while switching */
body.theme-transition,
body.theme-transition *,
body.theme-transition *::before,
body.theme-transition *::after {
  transition:
    background-color 0.5s ease,
    color            0.5s ease,
    border-color     0.5s ease,
    box-shadow       0.5s ease,
    fill             0.5s ease,
    stroke           0.5s ease !important;
}

/* (2) the ripple — JS sets its origin (left/top), size, and tint */
#theme-sweep {
  position: fixed;
  z-index: 9000;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(
    circle at center,
    var(--sweep-color, rgba(127, 127, 127, 0.5)) 0%,
    var(--sweep-color, rgba(127, 127, 127, 0.5)) 55%,
    transparent 72%
  );
  will-change: transform, opacity;
}

@keyframes themeSweep {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  15%  { opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  #theme-sweep.run { animation: themeSweep 0.55s ease-out forwards; }
}

/* =========================================================
   Resume doc viewer — glass + pixel chrome around a PDF iframe.
========================================================= */
.resume {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.6s ease;
}

/* ---- toolbar ---- */
.resume-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;

  padding: 12px 16px;
  border-radius: 14px;
}

.resume-id {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.resume-tag {            /* pixel "PDF" chip (reuses .kbd) */
  font-size: 8px;
  letter-spacing: 1px;
}

.resume-title {
  font-family: var(--pixel-font);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text);
}

.resume-sub {
  font-size: 12px;
  opacity: 0.5;
}

.resume-actions {
  display: flex;
  gap: 10px;
}

.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--text);

  padding: 9px 12px;
  border-radius: 8px;

  background: var(--copy-btn-bg);
  border: 1px solid var(--copy-btn-border);
  border-bottom-width: 2px;
  cursor: pointer;

  transition: background 0.2s ease, transform 0.15s ease;
}

.resume-btn:hover {
  background: var(--copy-btn-hover);
  transform: translateY(-1px);
}
.resume-btn:active { transform: translateY(0) scale(0.97); }

.resume-dl {            /* primary action = accent edge */
  border-color: var(--pixel-accent);
}

/* ---- document frame ---- */
.resume-frame {
  position: relative;
  border-radius: 16px;
  padding: 8px;
  overflow: hidden;
}

.resume-doc {
  display: block;
  width: 100%;
  height: 78vh;
  min-height: 420px;

  border: 0;
  border-radius: 10px;
  background: #fff;            /* PDF pages are white */
}

.resume-fallback,
.resume-hint {
  font-size: 12px;
  opacity: 0.55;
  text-align: center;
  margin: 0;
}

.resume-hint a,
.resume-fallback a {
  color: var(--pixel-accent);
  text-decoration: underline;
}

/* =========================
   MARKDOWN BASE
========================= */
.markdown {
  line-height: 1.7;
  font-size: 15px;
}

.markdown h1,
.markdown h2 {
  margin: 24px 0 12px;
}

.markdown p {
  opacity: 0.85;
}

/* =========================
   LINKS
========================= */
.markdown a {
  color: var(--pixel-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.markdown a:hover {
  text-decoration-color: var(--link-hover-underline);
  opacity: 0.85;
}

/* =========================
   IMAGES
========================= */
.markdown img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border-radius: 10px;
  border: 1px solid var(--code-border);
  box-shadow: 0 6px 20px var(--shadow-soft);
}

/* =========================
   INLINE CODE
========================= */
.markdown p code,
.markdown li code {
  background: var(--inline-code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

/* =========================
   PRE BLOCK
========================= */
.markdown pre {
  background: var(--inline-code-bg);
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
}

/* =========================
   CALLOUTS
========================= */
.md-callout {
  margin: 10px 0;
  padding: 12px 16px;

  border-left: 4px solid var(--callout-border);
  border-radius: 8px;

  background: var(--callout-bg);
  backdrop-filter: blur(8px);
}

/* title */
.md-callout-title {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.85;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--callout-border);
}

/* content */
.md-callout-content p {
  margin: 6px 0;
  opacity: 1;
}

/* variants */
.md-warning {
  --callout-border: var(--callout-warning-border);
  --callout-bg: var(--callout-warning-bg);
}

.md-info {
  --callout-border: var(--callout-info-border);
  --callout-bg: var(--callout-info-bg);
}

.md-caution {
  --callout-border: var(--callout-caution-border);
  --callout-bg: var(--callout-caution-bg);
}

.md-important {
  --callout-border: var(--callout-important-border);
  --callout-bg: var(--callout-important-bg);
}

.md-note {
  --callout-border: var(--callout-note-border);
  --callout-bg: var(--callout-note-bg);
}

/* =========================
   CODE BLOCK (WRAPPER)
========================= */
.md-codeblock {
  border-radius: 14px;
  overflow: hidden;
  margin: 20px 0;

  background: var(--code-bg);
  border: 1px solid var(--code-border);
}

.md-codeblock code {
  all: unset;
  font-family: monospace;
  white-space: pre;
}

.md-codeblock code span {
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* =========================
   HEADER
========================= */
.md-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 6px 12px;
  font-size: 12px;
  opacity: 0.7;

  border-bottom: 1px solid var(--code-border);
}

/* =========================
   COPY BUTTON
========================= */
.md-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;

  padding: 4px 8px;
  font-size: 12px;

  border-radius: 6px;
  border: 1px solid var(--copy-btn-border);

  background: var(--copy-btn-bg);
  color: var(--text);

  cursor: pointer;
  transition: all 0.2s ease;
}

.md-copy-btn:hover {
  background: var(--copy-btn-hover);
  transform: translateY(-1px);
}

.md-copy-btn:active {
  transform: scale(0.96);
}

/* =========================
   CODE AREA
========================= */
.md-codeblock pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  background: transparent;
}

/* =========================
   SYNTAX
========================= */
.kw  { color: var(--syntax-kw); }
.str { color: var(--syntax-str); }
.com { color: var(--syntax-com); }
.num { color: var(--syntax-num); }
.fn  { color: var(--syntax-fn); }

/* =========================
   TABLES
========================= */
.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;

  border-radius: 10px;
  overflow: hidden;
}

.markdown thead {
  background: var(--table-head);
}

.markdown th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
}

.markdown td {
  padding: 10px 12px;
  border-top: 1px solid var(--code-border);
}

.markdown tbody tr:nth-child(even) {
  background: var(--table-row);
}

.markdown tbody tr:hover {
  background: var(--table-hover);
}

/* =========================
   POST HEADER
   Visually separates the title + blurb from the document body.
========================= */
.post-header {
  position: relative;
  margin: 10px 0 48px;
  padding-bottom: 28px;
  animation: fadeUp 0.8s ease;

  border-bottom: 1px solid var(--glass-border);
}

/* pixel-dashed accent line riding the divider */
.post-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 120px;
  height: 2px;

  background: repeating-linear-gradient(
    90deg,
    var(--pixel-accent) 0 6px,
    transparent 6px 10px
  );
}

.post-kicker {
  display: inline-block;
  margin-bottom: 16px;
}

.post-title {
  margin: 0;
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.05;
}

.post-sub {
  margin: 12px 0 0;
  font-size: 16px;
  font-style: italic;
  opacity: 0.7;
  color: var(--pixel-accent);
}

/* hide the blurb line when a post has no blurb */
.post-sub:empty {
  display: none;
}

