:root {
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-glow: #0891b2;
  --dot-1: #22d3ee;
  --dot-2: #a78bfa;
  --dot-3: #f472b6;
  --dot-4: #fbbf24;
  --bg: #ffffff;
  --bg-alt: #f7f7fb;
  --surface: #ffffff;
  --border: #e6e6ef;
  --text: #15151c;
  --text-muted: #5a5a6e;
  --shadow: 0 1px 2px rgba(15, 15, 25, 0.04), 0 8px 24px rgba(15, 15, 25, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1080px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --accent: #818cf8;
  --accent-strong: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --accent-glow: #22d3ee;
  --bg: #0b0b12;
  --bg-alt: #11111b;
  --surface: #15151f;
  --border: #262633;
  --text: #ededf5;
  --text-muted: #a0a0b5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --dot-1: #22d3ee;
  --dot-2: #a78bfa;
  --dot-3: #f472b6;
  --dot-4: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
}
.brand-text { font-family: var(--font-mono); font-size: 0.95rem; letter-spacing: -0.01em; }

.nav-links { display: flex; gap: 22px; }
.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle, .menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover, .menu-toggle:hover { border-color: var(--accent); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 24px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.mobile-nav a {
  padding: 12px 0;
  color: var(--text);
  font-weight: 500;
  border-top: 1px solid var(--border);
}
.mobile-nav a:first-child { border-top: none; }
.mobile-nav[hidden] { display: none; }

.hero {
  padding: 96px 0 64px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  color: var(--accent-strong);
  margin: 0 0 12px;
  font-size: 0.95rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  font-weight: 800;
}
.hero-subtitle {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 0 32px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  font-weight: 700;
}
.section-lede {
  color: var(--text-muted);
  margin: 0 0 36px;
  font-size: 1.05rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}
.prose p { margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }
.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  position: relative;
}
.chip-list li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 7px 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  transition: transform 0.18s cubic-bezier(0.2, 0, 0.2, 1), background 0.15s ease;
  will-change: transform;
  cursor: default;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.stack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.stack-heading {
  margin: 0 0 18px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-strong);
}
.stack-list { list-style: none; margin: 0; padding: 0; }
.stack-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.stack-list li:first-child { border-top: none; }
.stack-name { font-weight: 600; }
.stack-note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
  align-content: start;
  overflow: hidden;
}
.project-grid.is-animating {
  transition: max-height 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}
.projects-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.projects-title-block .section-title { margin: 0 0 4px; line-height: 1.1; }
.projects-title-block .section-lede { margin: 0; }
.projects-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}
.projects-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.shuffle-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.shuffle-btn:active { transform: translateY(0); }
.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.reset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.reset-btn[hidden] { display: none; }
.projects-footer {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.expand-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}
.expand-icon { transition: transform 0.2s ease; }
.expand-btn[aria-expanded="true"] .expand-icon { transform: rotate(180deg); }

.float-collapse {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(15, 15, 25, 0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 40;
}
.float-collapse.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.float-collapse:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover { }
.project-tag {
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.project-card h3 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
}
.card-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.card-points li {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}
.card-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.65;
}
.project-links { display: flex; gap: 16px; font-weight: 600; font-size: 0.9rem; margin-top: 14px; }
.card-points code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 1px 5px;
  border-radius: 4px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: 16px;
}
.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.bento-card:hover { }
.bento-wide { grid-column: span 2; }
.bento-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.bento-title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 700; }
.bento-text { margin: 0; color: var(--text-muted); font-size: 0.93rem; }

/* --- Bento structured layouts --- */
.spec-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 0.88rem;
}
.spec-list dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  align-self: center;
}
.spec-list dd {
  margin: 0;
  font-weight: 500;
  color: var(--text);
}

.trip-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trip-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.9rem;
}
.trip-place { font-weight: 600; color: var(--text); }
.trip-note { color: var(--text-muted); font-size: 0.85rem; }

.music-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
}
.music-genre { display: flex; flex-direction: column; gap: 3px; }
.music-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-strong);
}
.music-artists {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.45;
}

.terminal-card { padding: 0; overflow: hidden; grid-row: span 2; display: flex; flex-direction: column; }
.terminal-card .terminal-body { flex: 1; display: flex; align-items: center; }
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  background: color-mix(in srgb, var(--bg-alt) 80%, var(--border));
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.terminal-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.terminal-body {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.terminal-body code { font-family: inherit; }
.t-prompt { color: var(--accent-strong); }
.t-key { color: var(--text-muted); }
.t-val { color: var(--accent-strong); }
.t-cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.contact-card:hover { text-decoration: none; }
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.contact-value { font-weight: 600; color: var(--text); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  background: var(--bg-alt);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-inner p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.footer-links a { color: var(--text-muted); font-weight: 500; }

@media (max-width: 900px) {
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
  .bento-wide { grid-column: span 2; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .menu-toggle { display: inline-flex; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 56px 0; }
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .bento-grid { grid-template-columns: 1fr; }
  .bento-wide { grid-column: span 1; }
  .music-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .stack-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .stack-note { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* --- Dot grid: ambient + 3D wave spotlight --- */
.project-card, .bento-card, .stack-card {
  position: relative;
  overflow: hidden;
}
/* Ambient dots - always visible, subtle texture */
.project-card::before, .bento-card::before, .stack-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(var(--dot-1) 1px, transparent 1.2px),
    radial-gradient(var(--dot-2) 1px, transparent 1.2px),
    radial-gradient(var(--dot-3) 1px, transparent 1.2px),
    radial-gradient(var(--dot-4) 1px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 0, 0 10px, 10px 10px;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}
/* Wave highlight - masked dome near mouse, multi-stop falloff for 3D feel */
.project-card::after, .bento-card::after, .stack-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(var(--dot-1) 1.5px, transparent 1.7px),
    radial-gradient(var(--dot-2) 1.5px, transparent 1.7px),
    radial-gradient(var(--dot-3) 1.5px, transparent 1.7px),
    radial-gradient(var(--dot-4) 1.5px, transparent 1.7px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 0, 0 10px, 10px 10px;
  -webkit-mask-image: radial-gradient(circle at var(--mouse-x, -200px) var(--mouse-y, -200px), #000 0%, rgba(0,0,0,0.7) 50px, rgba(0,0,0,0.2) 130px, transparent 180px);
  mask-image: radial-gradient(circle at var(--mouse-x, -200px) var(--mouse-y, -200px), #000 0%, rgba(0,0,0,0.7) 50px, rgba(0,0,0,0.2) 130px, transparent 180px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.2s ease;
}
.project-card > *, .bento-card > *, .stack-card > * {
  position: relative;
  z-index: 1;
  text-shadow: 0 0 6px var(--surface), 0 0 3px var(--surface);
}

/* --- Scroll reveal (opacity only - no transform, FLIP owns transforms) --- */
html.js-reveal .reveal {
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: opacity;
}
html.js-reveal .reveal.active {
  opacity: 1;
}
.stack-card.reveal:nth-child(2) { transition-delay: 0.06s; }
.stack-card.reveal:nth-child(3) { transition-delay: 0.12s; }
.stack-card.reveal:nth-child(4) { transition-delay: 0.18s; }
.stack-card.reveal:nth-child(5) { transition-delay: 0.24s; }
.stack-card.reveal:nth-child(6) { transition-delay: 0.30s; }
.project-card.reveal:nth-child(2) { transition-delay: 0.05s; }
.project-card.reveal:nth-child(3) { transition-delay: 0.10s; }
.project-card.reveal:nth-child(4) { transition-delay: 0.15s; }
.project-card.reveal:nth-child(5) { transition-delay: 0.20s; }
.project-card.reveal:nth-child(6) { transition-delay: 0.25s; }
.project-card.reveal:nth-child(7) { transition-delay: 0.30s; }
.project-card.reveal:nth-child(8) { transition-delay: 0.35s; }
.project-card.reveal:nth-child(9) { transition-delay: 0.40s; }
.project-card.reveal:nth-child(10) { transition-delay: 0.45s; }
.project-card.reveal:nth-child(11) { transition-delay: 0.50s; }
.project-card.reveal:nth-child(12) { transition-delay: 0.55s; }
.bento-card.reveal:nth-child(2) { transition-delay: 0.05s; }
.bento-card.reveal:nth-child(3) { transition-delay: 0.10s; }
.bento-card.reveal:nth-child(4) { transition-delay: 0.15s; }
.bento-card.reveal:nth-child(5) { transition-delay: 0.20s; }
.bento-card.reveal:nth-child(6) { transition-delay: 0.25s; }
.bento-card.reveal:nth-child(7) { transition-delay: 0.30s; }
