/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  transition: background-color 0.3s, color 0.3s;
  line-height: 1.6;
}
.dark body, body.dark-body {
  background: #030712;
  color: #cbd5e1;
}

::selection { background: #06b6d4; color: #fff; }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ── Grid Pattern ─────────────────────────── */
.bg-grid-pattern {
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
}
.dark .bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
}

/* ── Scroll Reveal Animations (replaces AOS) ─ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.reveal-left {
  transform: translateX(-40px);
}
.reveal.reveal-right {
  transform: translateX(40px);
}
.reveal.reveal-zoom {
  transform: scale(0.92);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* ── Blob Animation ──────────────────────── */
@keyframes blob {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -50px) scale(1.1); }
  66%  { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}
.animate-blob {
  animation: blob 7s ease-in-out infinite;
  will-change: transform;
  backface-visibility: hidden;
}
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

/* ── Typewriter Cursor ───────────────────── */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.cursor-blink { animation: blink 1s step-end infinite; }

/* ── Card Hover Lift ─────────────────────── */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-8px);
}

/* ── Mobile Menu Transition ──────────────── */
#mobile-menu {
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#mobile-menu.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
#mobile-menu.flex {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Button Hover Scale ──────────────────── */
.btn-scale {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-scale:hover {
  transform: translateY(-3px);
}
.btn-scale:active {
  transform: scale(0.97);
}

/* ── Dark Mode Icon Swap (pure CSS) ──────── */
.dark .icon-moon { display: none; }
.dark .icon-sun  { display: inline; }
.icon-sun        { display: none; }
.icon-moon       { display: inline; }

/* ── Digital Pulse: Pulse Dot ────────────── */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}
.pulse-dot { animation: pulse-glow 2s ease-in-out infinite; }

/* ── Digital Pulse: GitHub Heatmap ────────── */
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  min-width: 600px;
}
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.heatmap-cell:hover {
  transform: scale(1.6);
  outline: 2px solid rgba(6,182,212,0.4);
  z-index: 1;
}

/* ── Digital Pulse: WakaTime Bars ─────────── */
.waka-bar {
  animation: waka-grow 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: left;
}
@keyframes waka-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ── Digital Pulse: Spotify Waveform ─────── */
@keyframes waveform {
  0% { height: var(--bar-height); }
  50% { height: 15%; }
  100% { height: var(--bar-height); }
}
.waveform-bar {
  height: var(--bar-height, 50%);
  animation: waveform 1.2s ease-in-out infinite;
  min-height: 4px;
}
.waveform-bar:nth-child(1)  { animation-delay: 0s; }
.waveform-bar:nth-child(2)  { animation-delay: 0.15s; }
.waveform-bar:nth-child(3)  { animation-delay: 0.3s; }
.waveform-bar:nth-child(4)  { animation-delay: 0.05s; }
.waveform-bar:nth-child(5)  { animation-delay: 0.4s; }
.waveform-bar:nth-child(6)  { animation-delay: 0.2s; }
.waveform-bar:nth-child(7)  { animation-delay: 0.35s; }
.waveform-bar:nth-child(8)  { animation-delay: 0.1s; }
.waveform-bar:nth-child(9)  { animation-delay: 0.25s; }
.waveform-bar:nth-child(10) { animation-delay: 0.45s; }
.waveform-bar:nth-child(11) { animation-delay: 0.18s; }
.waveform-bar:nth-child(12) { animation-delay: 0.38s; }

/* ── Digital Pulse: Fitness Activity Ring ─── */
.activity-ring-fill {
  stroke-dasharray: calc(2 * 3.14159 * var(--r, 46));
  stroke-dashoffset: calc(2 * 3.14159 * var(--r, 46) * (1 - var(--ring-pct, 0) / 100));
  transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Digital Pulse: System Gauges ─────────── */
.gauge-fill {
  stroke-dasharray: calc(2 * 3.14159 * 32);
  stroke-dashoffset: calc(2 * 3.14159 * 32 * (1 - var(--gauge-pct, 0) / 100));
  transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}