/* ================================================================
   RESET + BASE

   ---------------------------------------------------------------
   AUDIT NOTES — optimization pass, referenced by line number below
   ---------------------------------------------------------------
   #2  Heatmap particle animation speed reads from a single
       --particle-speed CSS var (set once per scroll frame by JS)
       instead of being restyled per-particle. See .heatmap-particle
       below and onScroll() in main.js.
   #7  Scroll-reveal rules (.reveal / .reveal.visible) live here
       instead of being injected at runtime from JS. See the
       "SCROLL REVEAL" section further down.
   #9  Card/stat-specific reveal transitions are extended directly
       in the .reveal block so they also cover theme-change
       transitions, removing the need for a separate
       .hero-ctas .btn transition rule (the base .btn rule already
       covers it).
   #10 body{} is one consolidated rule (background, color, font,
       transitions) instead of being split across multiple rules.
   #11 ::-moz-selection was removed — Firefox 62+ honours the
       standard ::selection selector, so the prefixed copy was dead
       weight.
   #12 .scroll-progress includes transform-origin: left so its
       scaleX animation starts from the left edge; JS skips updating
       it manually whenever the browser supports native CSS
       scroll-driven animation (@supports animation-timeline: scroll()).
   #13 An empty @media (prefers-color-scheme: dark) block was
       removed — theme switching is handled via the data-theme
       attribute toggle, not a media query.
   #14 All green tones derive from one --green-rgb token, so any
       alpha variant is written as rgba(var(--green-rgb), α) instead
       of hardcoding new hex/rgba values per use site.
   ================================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ================================================================
   TOKENS (Design System) — GITHUB GREEN
   ================================================================ */
:root {
  /* Spacing & Layout */
  --radius:      10px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Motion */
  --ease:        cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-snap:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-apple:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.8, 0.64, 1);

  --green-rgb:   45, 164, 78;
  --green:       #2da44e;
  --green-dim:   rgba(45, 164, 78, 0.08);
  --green-glow:  rgba(45, 164, 78, 0.04);
  --green-hover: #2c974b;
  --green-dark:  #1a7f37;
  --green-light: #3fb950;

  /* Typography Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;
  --text-4xl:  2.5rem;
  --text-5xl:  3rem;

  /* Font Families */
  --font-body: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --bg:         #0A0A0A;
  --bg2:        #111111;
  --bg3:        #181818;
  --card:       #121212;
  --border:     #222222;
  --border2:    #2a2a2a;
  --text:       #EDEDED;
  --text-dim:   #a0a0a0;
  --text-muted: #666666;
  --shadow:     0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-sm:  0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg:         #F5F5F0;
  --bg2:        #EBEBE5;
  --bg3:        #E0E0DA;
  --card:       #FFFFFF;
  --border:     #D0D0CA;
  --border2:    #B8B8B2;
  --text:       #1A1A1A;
  --text-dim:   #444444;
  --text-muted: #777777;
  --shadow:     0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-sm:  0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ================================================================
   BASE STYLES
   ================================================================ */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  /* theme + fade-in transitions combined */
  transition: background 0.25s ease, color 0.25s ease, opacity 0.3s ease;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.loading {
  opacity: 0;
}

::selection {
  background: var(--green);
  color: #000;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

/* ================================================================
   BACKGROUND
   ================================================================ */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--green);
  z-index: 1000;
  width: 0%;
  opacity: 0.3;
  transform-origin: left center;
  transition: opacity 0.2s ease;
}

@supports (animation-timeline: scroll()) {
  .scroll-progress {
    width: 100%;
    transform: scaleX(0);
    animation: scroll-progress-anim auto linear;
    animation-timeline: scroll(root);
  }
}

@keyframes scroll-progress-anim {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* ================================================================
   HEATMAP WATERFALL
   ================================================================ */
.heatmap-container {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 55vh;
  z-index: 100;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  opacity: 0.4;
  transition: opacity 0.3s ease;
  overflow: visible;
}

.heatmap-container:hover {
  opacity: 0.8;
}

.heatmap-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  border-radius: 10px;
  background: linear-gradient(
    to top,
    rgba(45, 164, 78, 0.05)  0%,
    rgba(45, 164, 78, 0.15)  15%,
    rgba(45, 164, 78, 0.30)  30%,
    rgba(45, 164, 78, 0.50)  50%,
    rgba(45, 164, 78, 0.70)  70%,
    rgba(45, 164, 78, 0.85)  85%,
    rgba(45, 164, 78, 1)    100%
  );
  transition: height 0.1s linear;
  box-shadow: 0 0 20px rgba(45, 164, 78, 0.05);
  will-change: height;
}

.heatmap-bar::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 164, 78, 0.4), transparent 70%);
  opacity: 0.3;
  filter: blur(4px);
  animation: heatmap-pulse 2s ease-in-out infinite;
}

@keyframes heatmap-pulse {
  0%, 100% { opacity: 0.2; transform: translateX(-50%) scale(1); }
  50%       { opacity: 0.6; transform: translateX(-50%) scale(1.3); }
}

.heatmap-markers {
  position: absolute;
  right: 14px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 0;
  pointer-events: none;
}

.heatmap-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.3s ease, color 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.05em;
}

.heatmap-container:hover .heatmap-marker {
  opacity: 0.7;
}

.heatmap-marker .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.2;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

.heatmap-marker.active {
  opacity: 0.9;
  color: var(--green);
}

.heatmap-marker.active .dot {
  opacity: 1;
  box-shadow: 0 0 12px rgba(45, 164, 78, 0.5);
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.5); }
}

.heatmap-scroll-indicator {
  position: absolute;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg);
  box-shadow: 0 0 20px rgba(45, 164, 78, 0.2);
  transform: translateY(-50%);
  transition: top 0.1s linear;
  z-index: 2;
  will-change: top;
}

.heatmap-scroll-indicator::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(45, 164, 78, 0.15);
  animation: indicator-ring 2s ease-in-out infinite;
}

@keyframes indicator-ring {
  0%, 100% { transform: scale(1);   opacity: 0.5; }
  50%       { transform: scale(1.6); opacity: 0; }
}

.heatmap-particles {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.heatmap-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--green);
  border-radius: 50%;
  opacity: 0;
  animation: particle-rise var(--particle-speed, 5s) linear infinite;
}

@keyframes particle-rise {
  0%   { transform: translateY(0)     scale(1) translateX(0);   opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-150px) scale(0) translateX(20px); opacity: 0; }
}

.heatmap-label {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.4;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.heatmap-container:hover .heatmap-label {
  opacity: 0.8;
}

.heatmap-percentage {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.heatmap-container:hover .heatmap-percentage {
  opacity: 0.8;
}

/* ================================================================
   NAVIGATION
   ================================================================ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  height: 60px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-dim);
  position: relative;
  transition: color 0.2s ease;
  padding: 8px 4px;
  border-radius: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1.5px;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.28s var(--ease);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

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

.theme-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease-snap);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-btn:hover,
.theme-btn:focus-visible {
  border-color: var(--green);
  color: var(--green);
  transform: rotate(20deg) scale(1.1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
              border-color 0.2s, color 0.2s, background 0.2s;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
}

.btn-primary {
  background: var(--green);
  color: #0A0A0A;
  border-color: var(--green);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px var(--green-dim);
  background: var(--green-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border2);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-2px);
}

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  animation: ripple-expand 0.55s var(--ease) forwards;
}

@keyframes ripple-expand {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(1); opacity: 0; }
}

/* ================================================================
   HERO SECTION
   ================================================================ */
#hero {
  padding: 140px 0 100px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: center;
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  opacity: 0.7;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.accent {
  color: var(--green);
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 560px;
  margin-bottom: 2rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.3s ease, color 0.3s ease,
              border-color 0.25s ease, transform 0.2s var(--ease),
              box-shadow 0.2s ease;
  contain: layout style paint;
}

.stat:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--green);
  font-weight: 600;
  transition: color 0.3s ease;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.3rem;
  transition: color 0.3s ease;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.avatar-frame {
  width: clamp(220px, 28vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--green);
  padding: 6px;
  background: radial-gradient(circle at 30% 30%, var(--green-dim), transparent 70%);
  position: relative;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.avatar-frame::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px dashed var(--border2);
  animation: rotate 40s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  transition: color 0.3s ease;
}

.avatar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  justify-content: center;
  margin-top: 0.3rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse 2s ease-in-out infinite;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.avatar-status:hover .status-dot {
  transform: scale(1.3);
  box-shadow: 0 0 16px #4ade80;
}

/* ================================================================
   FLOATING NOTIFICATION — "mini player" style toast
   Populated from data/notification.json (emoji left, header +
   context stacked right, dismissible). See initNotification() in
   main.js.
   ================================================================ */
.notify-box {
  position: fixed;
  top: 92px;
  right: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: min(340px, calc(100vw - 48px));
  padding: 0.75rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.45s var(--ease-apple), transform 0.45s var(--ease-apple),
              border-color 0.25s ease, background 0.3s ease, box-shadow 0.25s ease,
              color 0.3s ease;
}

.notify-box.notify-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notify-box.notify-link { cursor: pointer; }

.notify-box.notify-link:hover {
  border-color: var(--green);
  box-shadow: var(--shadow), 0 0 0 1px rgba(var(--green-rgb), 0.15);
}

/* Album-art-style emoji tile, mini-player style */
.notify-emoji {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border-radius: 12px;
  background: var(--green-dim);
  border: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.25s ease;
}

.notify-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.notify-header {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notify-context {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.3s ease;
}

.notify-close {
  flex-shrink: 0;
  align-self: flex-start;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
}

.notify-close:hover {
  color: var(--text);
  background: var(--bg3);
}

@media (max-width: 640px) {
  .notify-box {
    top: auto;
    bottom: 18px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* ================================================================
   SCROLL REVEAL
   ================================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition:
    opacity  700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
  visibility: hidden;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

/* Cards need extra transitions for hover theme-reversal effects */
.project-card.reveal,
.cert-card.reveal,
.skill-card.reveal {
  transition:
    opacity      700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform    700ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    box-shadow   0.25s ease,
    background   0.3s ease,
    color        0.3s ease;
}

.stat.reveal {
  transition:
    opacity      700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform    700ms cubic-bezier(0.22, 1, 0.36, 1),
    background   0.3s ease,
    color        0.3s ease,
    border-color 0.25s ease;
}

.sec-label.reveal,
.sec-title.reveal {
  transition:
    opacity   500ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.1s; }
.reveal-delay-3 { transition-delay: 0.15s; }
.reveal-delay-4 { transition-delay: 0.2s; }
.reveal-delay-5 { transition-delay: 0.25s; }

/* ================================================================
   SECTIONS
   ================================================================ */
section {
  padding: 90px 0;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
  contain: layout style;
}

.sec-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.sec-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 3rem;
}

/* ================================================================
   PROJECTS — horizontal scroll strip
   Cards stay a fixed width and the list scrolls sideways, so the
   section's height never grows as more projects are added to
   data/projects.js. See initProjectsScroller() in main.js for the
   arrow-button / drag / wheel behaviour.
   ================================================================ */
.projects-scroll-wrap {
  position: relative;
}

.projects-grid {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-left: 4px;
  padding: 4px 4px 1.5rem;
  margin: -4px -4px -1.5rem;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  overscroll-behavior-x: contain;
}

.projects-grid:active { cursor: grabbing; }

.projects-grid.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
}

.projects-grid::-webkit-scrollbar { height: 6px; }

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  flex: 0 0 clamp(260px, 32vw, 340px);
  scroll-snap-align: start;
  transition: border-color 0.25s, transform 0.3s var(--ease-spring),
              box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
  contain: layout style paint;
}

/* Round nav arrows that sit over the strip's edges */
.scroll-nav {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, opacity 0.2s ease,
              transform 0.2s var(--ease), background 0.3s ease, color 0.3s ease;
}

.scroll-nav:hover  { border-color: var(--green); color: var(--green); }
.scroll-nav:active { transform: translateY(-50%) scale(0.92); }

.scroll-nav--prev { left: -8px; }
.scroll-nav--next { right: -8px; }

.scroll-nav[disabled] {
  opacity: 0;
  pointer-events: none;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: var(--green);
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.project-thumb {
  aspect-ratio: 16/10;
  background: var(--bg3);
  overflow: hidden;
  position: relative;
  transition: background 0.3s ease;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
  will-change: transform;
}

.project-card:hover .project-thumb img {
  transform: scale(1.06);
}

.project-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-body {
  padding: 1.25rem 1.4rem 1.5rem;
  flex: 1;
}

.project-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.project-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  line-height: 1.6;
  transition: color 0.3s ease;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.25rem 0.55rem;
  background: var(--bg3);
  color: var(--text-dim);
  border-radius: 4px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s, background 0.3s ease;
}

.tech-tag:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ================================================================
   SKILLS
   ================================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.skill-card {
  padding: 1.4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s var(--ease),
              background 0.3s ease, color 0.3s ease;
}

.skill-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}

.skill-cat {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--green);
  margin-bottom: 0.9rem;
  transition: color 0.3s ease;
}

.skill-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.skill-pill {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease-snap),
              box-shadow 0.2s, background 0.3s ease;
  cursor: default;
  user-select: none;
}

.skill-pill:hover {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-2px) scale(1.04);
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   ACHIEVEMENTS
   ================================================================ */
.ach-grid {
  display: grid;
  gap: 0.75rem;
}

.ach-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.25s var(--ease),
              box-shadow 0.2s, background 0.3s ease, color 0.3s ease;
  word-break: break-word;
  contain: layout style;
}

.ach-item:hover {
  border-color: var(--green);
  transform: translateX(5px);
  box-shadow: var(--shadow-sm);
}

.ach-rank {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green);
  text-align: center;
  padding: 0.3rem 0.7rem;
  background: var(--green-glow);
  border-radius: var(--radius);
  border: 1px solid var(--green-dim);
  white-space: nowrap;
  min-width: 44px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.ach-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.ach-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  transition: color 0.3s ease;
}

/* ================================================================
   CERTIFICATES
   ================================================================ */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.cert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s var(--ease),
              box-shadow 0.2s, background 0.3s ease, color 0.3s ease;
  contain: layout style;
}

.cert-card:hover,
.cert-card:focus-visible {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.cert-issuer {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
  transition: color 0.3s ease;
}

.cert-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
  transition: color 0.3s ease;
}

.cert-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

/* ================================================================
   HERO SECTION HOVER THEME REVERSAL
   ================================================================ */
[data-theme="dark"] .stat:hover,
[data-theme="dark"] .hero-ctas .btn:hover {
  background: #F5F5F0;
  border-color: #2da44e;
  color: #1A1A1A;
}

[data-theme="dark"] .stat:hover .stat-value {
  color: #1A1A1A;
}

[data-theme="dark"] .stat:hover .stat-label {
  color: #444444;
}

[data-theme="dark"] .hero-ctas .btn-ghost:hover {
  background: #F5F5F0;
  border-color: #2da44e;
  color: #1A1A1A;
}

[data-theme="dark"] .hero-ctas .btn-primary:hover {
  background: #1A1A1A;
  border-color: #1A1A1A;
  color: #F5F5F0;
}

[data-theme="dark"] .avatar-frame:hover {
  background: radial-gradient(circle at 30% 30%, rgba(45, 164, 78, 0.25), transparent 70%);
  border-color: #2da44e;
}

[data-theme="dark"] .avatar-label:hover {
  color: #F5F5F0;
}

[data-theme="light"] .stat:hover,
[data-theme="light"] .hero-ctas .btn:hover {
  background: #121212;
  border-color: #2da44e;
  color: #EDEDED;
}

[data-theme="light"] .stat:hover .stat-value {
  color: #EDEDED;
}

[data-theme="light"] .stat:hover .stat-label {
  color: #a0a0a0;
}

[data-theme="light"] .hero-ctas .btn-ghost:hover {
  background: #121212;
  border-color: #2da44e;
  color: #EDEDED;
}

[data-theme="light"] .hero-ctas .btn-primary:hover {
  background: #EDEDED;
  border-color: #EDEDED;
  color: #121212;
}

[data-theme="light"] .avatar-frame:hover {
  background: radial-gradient(circle at 30% 30%, rgba(45, 164, 78, 0.2), transparent 70%);
  border-color: #2da44e;
}

[data-theme="light"] .avatar-label:hover {
  color: #121212;
}

/* ================================================================
   CARD HOVER THEME REVERSAL — DARK TO LIGHT
   ================================================================ */
[data-theme="dark"] .project-card:hover,
[data-theme="dark"] .skill-card:hover,
[data-theme="dark"] .ach-item:hover,
[data-theme="dark"] .cert-card:hover,
[data-theme="dark"] .contact-row:hover,
[data-theme="dark"] .notify-box:hover {
  background: #F5F5F0;
  border-color: #2da44e;
  color: #1A1A1A;
}

[data-theme="dark"] .project-card:hover .project-title,
[data-theme="dark"] .skill-card:hover .skill-cat,
[data-theme="dark"] .ach-item:hover .ach-title,
[data-theme="dark"] .cert-card:hover .cert-title,
[data-theme="dark"] .contact-row:hover .contact-value {
  color: #1A1A1A;
}

[data-theme="dark"] .project-card:hover .project-desc,
[data-theme="dark"] .project-card:hover .project-date,
[data-theme="dark"] .skill-card:hover .skill-pill,
[data-theme="dark"] .ach-item:hover .ach-desc,
[data-theme="dark"] .cert-card:hover .cert-date,
[data-theme="dark"] .cert-card:hover .cert-issuer,
[data-theme="dark"] .contact-row:hover .contact-label,
[data-theme="dark"] .notify-box:hover .notify-context {
  color: #444444;
}

[data-theme="dark"] .notify-box:hover .notify-emoji {
  background: rgba(45, 164, 78, 0.12);
  border-color: rgba(45, 164, 78, 0.3);
}

[data-theme="dark"] .notify-box:hover .notify-close {
  color: #1A1A1A;
}

[data-theme="dark"] .notify-box:hover .notify-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .project-card:hover .tech-tag {
  background: #E0E0DA;
  border-color: #B8B8B2;
  color: #1A1A1A;
}

[data-theme="dark"] .project-card:hover .tech-tag:hover {
  border-color: #2da44e;
  color: #2da44e;
}

[data-theme="dark"] .ach-item:hover .ach-rank {
  background: rgba(45, 164, 78, 0.12);
  border-color: rgba(45, 164, 78, 0.3);
  color: #2da44e;
}

[data-theme="dark"] .project-card:hover .project-thumb {
  background: #E0E0DA;
}

[data-theme="dark"] .skill-card:hover .skill-pill {
  background: #E0E0DA;
  border-color: #B8B8B2;
  color: #1A1A1A;
}

[data-theme="dark"] .skill-card:hover .skill-pill:hover {
  border-color: #2da44e;
  color: #2da44e;
}

/* ================================================================
   CARD HOVER THEME REVERSAL — LIGHT TO DARK
   ================================================================ */
[data-theme="light"] .project-card:hover,
[data-theme="light"] .skill-card:hover,
[data-theme="light"] .ach-item:hover,
[data-theme="light"] .cert-card:hover,
[data-theme="light"] .contact-row:hover,
[data-theme="light"] .notify-box:hover {
  background: #121212;
  border-color: #2da44e;
  color: #EDEDED;
}

[data-theme="light"] .project-card:hover .project-title,
[data-theme="light"] .skill-card:hover .skill-cat,
[data-theme="light"] .ach-item:hover .ach-title,
[data-theme="light"] .cert-card:hover .cert-title,
[data-theme="light"] .contact-row:hover .contact-value {
  color: #EDEDED;
}

[data-theme="light"] .project-card:hover .project-desc,
[data-theme="light"] .project-card:hover .project-date,
[data-theme="light"] .skill-card:hover .skill-pill,
[data-theme="light"] .ach-item:hover .ach-desc,
[data-theme="light"] .cert-card:hover .cert-date,
[data-theme="light"] .cert-card:hover .cert-issuer,
[data-theme="light"] .contact-row:hover .contact-label,
[data-theme="light"] .notify-box:hover .notify-context {
  color: #a0a0a0;
}

[data-theme="light"] .notify-box:hover .notify-emoji {
  background: rgba(45, 164, 78, 0.15);
  border-color: rgba(45, 164, 78, 0.25);
}

[data-theme="light"] .notify-box:hover .notify-close {
  color: #EDEDED;
}

[data-theme="light"] .notify-box:hover .notify-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .project-card:hover .tech-tag {
  background: #181818;
  border-color: #2a2a2a;
  color: #EDEDED;
}

[data-theme="light"] .project-card:hover .tech-tag:hover {
  border-color: #2da44e;
  color: #2da44e;
}

[data-theme="light"] .ach-item:hover .ach-rank {
  background: rgba(45, 164, 78, 0.15);
  border-color: rgba(45, 164, 78, 0.25);
  color: #2da44e;
}

[data-theme="light"] .project-card:hover .project-thumb {
  background: #181818;
}

[data-theme="light"] .skill-card:hover .skill-pill {
  background: #181818;
  border-color: #2a2a2a;
  color: #EDEDED;
}

[data-theme="light"] .skill-card:hover .skill-pill:hover {
  border-color: #2da44e;
  color: #2da44e;
}

/* ================================================================
   CONTACT
   ================================================================ */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.contact-intro {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 480px;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s var(--ease),
              background 0.3s ease, box-shadow 0.2s, color 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 52px;
}

.contact-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--green);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s var(--ease);
  border-radius: 0 0 0 var(--radius);
}

.contact-row:hover::before {
  transform: scaleY(1);
}

.contact-row:hover {
  border-color: var(--green);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

.contact-value {
  font-size: 0.9rem;
  color: var(--text);
  transition: color 0.2s;
  word-break: break-all;
}

.contact-row:hover .contact-value {
  color: var(--green);
}

[data-theme="dark"] .contact-row:hover .contact-label {
  color: #444444;
}

[data-theme="light"] .contact-row:hover .contact-label {
  color: #a0a0a0;
}

/* ================================================================
   FOOTER
   ================================================================ */
footer {
  padding: 2rem clamp(1.25rem, 4vw, 3rem);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}

.footer-sig {
  color: var(--green);
}

/* ================================================================
   MODAL
   ================================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem 2rem;
  animation: slideUp 0.25s var(--ease);
  margin: 1rem;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.9rem;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  color: var(--green);
  font-size: 1.3rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s var(--ease-snap);
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--green);
  transform: rotate(90deg) scale(1.1);
}

/* Carousel */
.carousel {
  position: relative;
  margin-bottom: 1rem;
  text-align: center;
}

.carousel img {
  max-height: 420px;
  width: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 100%;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s, transform 0.2s var(--ease-snap);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover,
.carousel-btn:focus-visible {
  background: var(--green);
  color: #000;
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev { left: 6px; }
.carousel-btn.next { right: 6px; }

.carousel-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ================================================================
   INLINE MARKDOWN — shared by every data-driven text box on the site
   (hero copy, stats, pills, tags, titles, contact rows, notification,
   footer). Renders via renderInlineMarkdown() in main.js: supports
   **bold**, *italic*, `code`, [text](url) links and =(#hex)text=
   coloring, but never introduces block spacing/margins of its own —
   it always inherits the font size/color/weight of its container.
   ================================================================ */
.md-inline {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.md-inline strong {
  font-weight: 700;
  color: inherit;
}

.md-inline em {
  font-style: italic;
}

.md-inline code {
  font-family: var(--font-mono);
  background: var(--bg3);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.md-inline a.md-link,
a.md-link {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}

.md-inline a.md-link:hover,
a.md-link:hover {
  color: var(--green-hover);
}

/* ================================================================
   MARKDOWN CONTENT
   ================================================================ */
.md-content {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.75;
}

.md-content h1,
.md-content h2,
.md-content h3 {
  margin: 1.2rem 0 0.6rem;
  color: var(--green);
}

.md-content h1 { font-size: var(--text-2xl); }
.md-content h2 { font-size: var(--text-xl); }
.md-content h3 { font-size: var(--text-lg); }

.md-content p {
  margin-bottom: 0.8rem;
  color: var(--text-dim);
}

.md-content ul,
.md-content ol {
  margin: 0.5rem 0 0.8rem 1.4rem;
  color: var(--text-dim);
}

.md-content li {
  margin-bottom: 0.25rem;
}

.md-content code {
  font-family: var(--font-mono);
  background: var(--bg3);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--green);
  font-size: 0.85em;
}

.md-content pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.md-content pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.md-content a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.md-content a:hover {
  color: var(--green-hover);
}

.md-content blockquote {
  border-left: 3px solid var(--green);
  padding-left: 1rem;
  margin: 0.8rem 0;
  color: var(--text-dim);
  font-style: italic;
}

.md-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.md-content th,
.md-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.md-content th {
  background: var(--bg3);
  font-weight: 600;
}

/* ================================================================
   LOADING
   ================================================================ */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
  .animated-bg,
  .heatmap-container,
  .nav-links,
  .theme-btn,
  .scroll-progress,
  .grid-bg,
  .hero-avatar-wrap .avatar-status,
  #hero .hero-ctas,
  .notify-box,
  .scroll-nav {
    display: none !important;
  }

  .projects-grid {
    display: block !important;
    overflow: visible !important;
  }

  .project-card { margin-bottom: 1rem; }

  body {
    background: white !important;
    color: black !important;
  }

  .project-card,
  .skill-card,
  .ach-item,
  .cert-card,
  .contact-row {
    border-color: #ccc !important;
    box-shadow: none !important;
    background: white !important;
  }

  .stat          { border-color: #ccc !important; }
  .hero-name     { font-size: 2.5rem !important; }
  .container     { max-width: 100% !important; padding: 0 1rem !important; }
  .hero-inner    { display: block !important; }
  .modal         { display: none !important; }

  section {
    break-inside: avoid;
    padding: 40px 0 !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline !important;
  }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .hero-inner { gap: 2.5rem; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    text-align: center;
  }

  .hero-avatar-wrap { order: -1; }

  .hero-tagline {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-ctas     { justify-content: center; }
  .hero-stats    { grid-template-columns: repeat(2, 1fr); }

  section        { padding: 70px 0; }
  #hero          { padding: 110px 0 70px; }

  .contact-wrap  { grid-template-columns: 1fr; }
  .contact-intro { max-width: 100%; }

  .ach-item {
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
  }

  .ach-rank {
    font-size: 1rem;
    white-space: normal;
    word-break: keep-all;
  }

  .heatmap-container { display: none; }

  .modal-content {
    padding: 1.25rem;
    max-height: 90vh;
  }

  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .hero-name    { font-size: 2.5rem; }
  .sec-title    { font-size: 1.5rem; }

  .skills-grid,
  .cert-grid    { grid-template-columns: 1fr; }

  /* Projects stay a horizontal strip; just show one full card
     at a time and hide the arrows in favour of touch swiping */
  .project-card    { flex-basis: 84vw; }
  .scroll-nav       { display: none; }

  .hero-stats   { grid-template-columns: 1fr 1fr; gap: 0.5rem; }

  .stat         { padding: 0.75rem; }
  .stat-value   { font-size: 1.1rem; }

  .ach-rank {
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
    min-width: auto;
  }

  .ach-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    text-align: center;
  }

  .contact-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .contact-row::before { display: none; }

  footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .btn          { min-height: 44px; padding: 0.5rem 0.9rem; }
  .avatar-frame { width: 200px; }
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
  }

  .avatar-frame::before,
  .status-dot,
  .heatmap-bar::after,
  .heatmap-scroll-indicator::after,
  .heatmap-marker.active .dot {
    animation: none !important;
  }

  .btn .ripple      { display: none !important; }

  .heatmap-particle {
    animation: none !important;
    display: none !important;
  }

  .scroll-progress  { transition: none !important; }

  .notify-box {
    transition: opacity 0.01ms !important;
    transform: none !important;
  }

  .projects-grid { scroll-behavior: auto !important; }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-accent  { color: var(--green); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1       { gap: 0.5rem; }
.gap-2       { gap: 1rem; }
.w-full      { width: 100%; }
.h-full      { height: 100%; }

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar        { width: 8px; height: 8px; }
::-webkit-scrollbar-track  { background: var(--bg2); }
::-webkit-scrollbar-thumb  { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) var(--bg2);
}

/* ================================================================
   SKIP LINK — Accessibility
   ================================================================ */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--green);
  color: #000;
  font-weight: 600;
  border-radius: var(--radius);
  z-index: 9999;
  font-family: var(--font-body);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ================================================================
   ACTIVITY HEATMAP SECTION
   (detailed component styles live in heatmap.js via injectStyles;
    these handle only the section-level layout + theme integration)
   ================================================================ */
#activity {
  /* matches the rhythm of every other section */
  padding: 90px 0;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
  contain: layout style;
}

/* Heatmap wrapper sits inside .container, no extra padding needed */
#activityHeatmap {
  position: relative;
  min-height: 160px;        /* reserve space while loading */
}

/* ── Light-theme overrides for the injected component styles ── */
[data-theme="light"] .ahm-badge {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text-dim);
}

[data-theme="light"] .ahm-tooltip {
  background: #ffffff;
  border-color: var(--border2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
  color: var(--text);
}

[data-theme="light"] .ahm-tooltip strong {
  color: var(--green-dark);
}

[data-theme="light"] .ahm-tooltip span {
  color: var(--text-dim);
  border-left-color: var(--border2);
}

[data-theme="light"] .ahm-cell {
  stroke: var(--bg);
}

[data-theme="light"] .ahm-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg3)  25%,
    var(--bg2)  50%,
    var(--bg3)  75%
  );
  background-size: 200% 100%;
}

/* ── Responsive adjustments ── */
@media (max-width: 860px) {
  #activity { padding: 70px 0; }

  .ahm-stats {
    gap: 1rem 2rem;
  }

  .ahm-platform-badges {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .ahm-stat-value { font-size: 1.15rem; }
  .ahm-stat-label { font-size: 0.6rem; }
  .ahm-badge      { font-size: 0.65rem; padding: 0.25rem 0.55rem; }
}