/* ========================================
   Design System — CSS Custom Properties
   ======================================== */
:root {
  /* Colors — Sage Green Palette (macOS-style: same accents both modes) */
  --color-primary: #5C7650;
  --color-primary-dark: #3A5A40;
  --color-primary-light: rgba(92, 118, 80, 0.12);
  --color-primary-glow: rgba(92, 118, 80, 0.2);
  --color-accent: #A3B18A;
  --color-accent-light: rgba(163, 177, 138, 0.15);
  --color-amber: #A3B18A;
  --color-amber-light: rgba(163, 177, 138, 0.15);
  --color-rose: #344E41;

  /* Neutrals — Dark Mode (default, macOS-style neutral darks) */
  --color-white: #ffffff;
  --color-bg: #1c1c1e;
  --color-bg-alt: #202022;
  --color-bg-muted: #3a3a3c;
  --color-bg-card: #242426;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-light: rgba(255, 255, 255, 0.06);
  --color-text-muted: #98989d;
  --color-text: #d1d1d6;
  --color-text-dark: #f2f2f7;

  /* Gradient */
  --gradient-hero: linear-gradient(135deg, #344E41 0%, #3A5A40 50%, #5C7650 100%);
  --gradient-text: linear-gradient(135deg, #A3B18A, #DAD7CD, #5C7650);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));

  /* Shadows — Dark mode */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(92, 118, 80, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25), 0 0 1px rgba(255, 255, 255, 0.05);

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Fonts */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;

  /* Dark-specific */
  --particle-color: 92, 118, 80;
  --nav-scrolled-bg: rgba(28, 28, 30, 0.9);
  --hero-badge-bg: rgba(163, 177, 138, 0.12);
  --hero-badge-border: rgba(163, 177, 138, 0.2);
  --hero-badge-color: #A3B18A;
  --blob-1-color: rgba(92, 118, 80, 0.03);
  --blob-2-color: rgba(58, 90, 64, 0.025);
  --blob-3-color: rgba(163, 177, 138, 0.02);
  --dot-grid-color: rgba(255, 255, 255, 0.02);
  --footer-bg: #111113;
  --footer-text: rgba(255, 255, 255, 0.4);
  --footer-icon-bg: rgba(255, 255, 255, 0.06);
  --footer-icon-color: rgba(255, 255, 255, 0.4);
  --footer-icon-border: rgba(255, 255, 255, 0.08);
  --ripple-color: rgba(255, 255, 255, 0.15);
  --cursor-ring-border: rgba(92, 118, 80, 0.4);
  --cursor-ring-hover-bg: rgba(92, 118, 80, 0.08);
  --cursor-ring-hover-border: rgba(92, 118, 80, 0.2);
}

/* ========================================
   Light Theme Override
   ======================================== */
[data-theme="light"] {
  --color-primary: #3A5A40;
  --color-primary-dark: #344E41;
  --color-primary-light: rgba(58, 90, 64, 0.08);
  --color-primary-glow: rgba(58, 90, 64, 0.12);
  --color-accent: #5C7650;
  --color-accent-light: rgba(92, 118, 80, 0.1);
  --color-amber: #5C7650;
  --color-amber-light: rgba(92, 118, 80, 0.1);
  --color-rose: #344E41;

  --color-bg: #f6f5f2;
  --color-bg-alt: #f2f1ee;
  --color-bg-muted: #e5e4e0;
  --color-bg-card: #ffffff;
  --color-border: rgba(52, 78, 65, 0.1);
  --color-border-light: rgba(52, 78, 65, 0.05);
  --color-text-muted: #6b7c6e;
  --color-text: #2d3a30;
  --color-text-dark: #1a2e22;

  --gradient-text: linear-gradient(135deg, #344E41, #3A5A40, #5C7650);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(246, 245, 242, 0.5));
  --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(246, 245, 242, 0.2));

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.09);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.11);
  --shadow-glow: 0 0 30px rgba(58, 90, 64, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);

  --particle-color: 58, 90, 64;
  --nav-scrolled-bg: rgba(246, 245, 242, 0.92);
  --hero-badge-bg: rgba(58, 90, 64, 0.1);
  --hero-badge-border: rgba(58, 90, 64, 0.18);
  --hero-badge-color: #344E41;
  --blob-1-color: rgba(58, 90, 64, 0.04);
  --blob-2-color: rgba(92, 118, 80, 0.03);
  --blob-3-color: rgba(163, 177, 138, 0.03);
  --dot-grid-color: rgba(52, 78, 65, 0.03);
  --footer-bg: #344E41;
  --footer-text: rgba(218, 215, 205, 0.6);
  --footer-icon-bg: rgba(218, 215, 205, 0.08);
  --footer-icon-color: rgba(218, 215, 205, 0.5);
  --footer-icon-border: rgba(218, 215, 205, 0.1);
  --ripple-color: rgba(218, 215, 205, 0.35);
  --cursor-ring-border: rgba(58, 90, 64, 0.4);
  --cursor-ring-hover-bg: rgba(58, 90, 64, 0.05);
  --cursor-ring-hover-border: rgba(58, 90, 64, 0.2);
}

/* ========================================
   Creative Mode — Full-screen 3D Playground
   Portfolio hidden, interactive scene takes over
   ======================================== */

/* --- 3D Canvas: full viewport --- */
#creativeCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: none;
  pointer-events: none;
}

/* --- Creative HUD: floating glass overlay --- */
.creative-hud {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* MUST sit above .creative-scroll (1001). This element is position:fixed with
     a z-index, so it creates a stacking context: every child is clamped to THIS
     layer no matter what z-index it declares. At 1000 the whole HUD — social
     buttons, hint, credits — sat under the full-viewport scroll overlay and
     nothing down there could be clicked. Raising it is safe because the HUD is
     pointer-events:none, so scroll and drag still pass through to the container
     beneath; only children that opt back in with pointer-events:auto are hit. */
  z-index: 1002;
  pointer-events: none;
}

.creative-hud > * {
  pointer-events: auto;
}

/* Cinematic vignette overlay */
.creative-hud::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(12, 18, 16, 0.4) 100%);
}

/* Top bar — glass pill with brand + back button */
.creative-hud-top {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1010;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(12, 18, 16, 0.25);
  -webkit-backdrop-filter: blur(40px) saturate(150%);
  backdrop-filter: blur(40px) saturate(150%);
  border: 1px solid rgba(163, 177, 138, 0.08);
  border-radius: 9999px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.creative-hud-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #A3B18A;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.creative-hud-brand .brand-slash {
  color: #5C7650;
}

.creative-hud-brand .brand-dot {
  color: #6B8F71;
}

.creative-hud-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
}

.creative-hud-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(12, 18, 16, 0.2);
  border: 1px solid rgba(163, 177, 138, 0.1);
  border-radius: 9999px;
  color: rgba(163, 177, 138, 0.7);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.creative-hud-back:hover {
  background: rgba(92, 118, 80, 0.2);
  color: #DAD7CD;
  border-color: rgba(163, 177, 138, 0.35);
}

/* Bottom hint */
.creative-hud-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(52, 78, 65, 0.15);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid rgba(163, 177, 138, 0.1);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: opacity 0.5s ease;
}

.creative-hud-hint span {
  color: rgba(163, 177, 138, 0.5);
  font-size: 0.78rem;
  font-weight: 400;
  font-family: var(--font-body);
  white-space: nowrap;
}

.creative-hud-hint kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(92, 118, 80, 0.15);
  border: 1px solid rgba(163, 177, 138, 0.2);
  border-radius: 6px;
  color: #A3B18A;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
}

/* Stats corner */
/* Hint wording follows the input device: mouse gets "click", touch gets "tap".
   Done in CSS so there is no JS/UA sniffing to keep in sync. */
.hint-coarse { display: none; }
@media (pointer: coarse) {
  .hint-fine { display: none; }
  .hint-coarse { display: inline; }
}

.creative-hud-stats {
  position: fixed;
  bottom: 48px;
  right: 28px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.68rem;
  color: rgba(163, 177, 138, 0.3);
  letter-spacing: 0.04em;
}

/* Music credit */
.creative-music-credit {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(163, 177, 138, 0.3);
  letter-spacing: 0.02em;
}

.creative-music-credit i {
  margin-right: 3px;
  font-size: 0.55rem;
}


@media (max-width: 768px) {
  .creative-music-credit {
    display: none;
  }
}

/* Social links + mute in creative mode */
.creative-hud-social {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 1010;
  display: flex;
  gap: 8px;
}

.creative-mute-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(12, 18, 16, 0.25);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(163, 177, 138, 0.08);
  border-radius: 50%;
  color: rgba(163, 177, 138, 0.35);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
}

.creative-mute-btn:hover {
  color: #A3B18A;
  border-color: rgba(163, 177, 138, 0.2);
  background: rgba(12, 18, 16, 0.4);
}

.creative-mute-btn.muted i::before {
  content: "\f6a9";
}

.creative-hud-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(12, 18, 16, 0.25);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(163, 177, 138, 0.08);
  border-radius: 50%;
  color: rgba(163, 177, 138, 0.35);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.25s ease;
}

.creative-hud-social a:hover {
  background: rgba(92, 118, 80, 0.2);
  color: #A3B18A;
  border-color: rgba(163, 177, 138, 0.3);
}

/* === Creative mode cinematic transition === */
.creative-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: #0C1210;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.creative-transition.ct-active {
  opacity: 1;
  pointer-events: all;
}

.creative-transition.ct-fade-out {
  opacity: 0;
}

/* --- Creative mode active: hide portfolio, show journey --- */
[data-theme="creative"] .navbar,
[data-theme="creative"] #home,
[data-theme="creative"] #about,
[data-theme="creative"] #expertise,
[data-theme="creative"] #skills,
[data-theme="creative"] #resume,
[data-theme="creative"] #projects,
[data-theme="creative"] #contact,
[data-theme="creative"] .footer,
[data-theme="creative"] .scroll-progress,
[data-theme="creative"] .scroll-spy-widget,
[data-theme="creative"] .custom-cursor,
[data-theme="creative"] .cursor-glow {
  display: none !important;
}

[data-theme="creative"] body {
  overflow: hidden;
  background: #0C1210;
}

[data-theme="creative"] body::before,
[data-theme="creative"] body::after {
  display: none !important;
}

[data-theme="creative"] .creative-hud {
  display: block;
}

/* Cursor */
[data-theme="creative"] body,
[data-theme="creative"] #creativeCanvas {
  cursor: crosshair !important;
}

[data-theme="creative"] .creative-hud-back,
[data-theme="creative"] .creative-hud-social a,
[data-theme="creative"] .creative-cta-btn,
[data-theme="creative"] .creative-cta-outline {
  cursor: pointer !important;
}

/* === Scroll container — drives the 3D camera === */
.creative-scroll {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1001;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.creative-scroll::-webkit-scrollbar {
  display: none;
}

/* === Scroll progress bar === */
.creative-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 1px;
  width: 0%;
  background: linear-gradient(90deg, rgba(92, 118, 80, 0.35), rgba(163, 177, 138, 0.6), rgba(232, 200, 122, 0.55));
  z-index: 1010;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* Chapter progress dots */
.creative-dots {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1010;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.creative-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(163, 177, 138, 0.1);
  border: 1px solid rgba(163, 177, 138, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.creative-dot:hover {
  background: rgba(163, 177, 138, 0.3);
  transform: scale(1.4);
}

.creative-dot.active {
  background: rgba(232, 200, 122, 0.75);
  border-color: rgba(232, 200, 122, 0.5);
  box-shadow: 0 0 6px rgba(232, 200, 122, 0.3);
}

.creative-dot span {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(163, 177, 138, 0.5);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.creative-dot:hover span {
  opacity: 1;
}

.creative-dot.active span {
  opacity: 0.7;
}

/* === Chapters — each is 100vh tall for scroll pacing === */
.creative-chapter {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  pointer-events: none;
  scroll-snap-align: start;
}

.chapter-content {
  max-width: 480px;
  padding: 40px;
  pointer-events: auto;
  background: rgba(12, 18, 16, 0.3);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid rgba(163, 177, 138, 0.05);
  border-radius: 1.25rem;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

/* Staggered child reveals */
.chapter-content .chapter-label,
.chapter-content h2,
.chapter-content p,
.chapter-content .chapter-scroll-cue,
.chapter-content .chapter-cta,
.chapter-content .chapter-links {
  opacity: 0;
  transform: translateY(20px);
  filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
}

.chapter-content .chapter-label { transition-delay: 0s; }
.chapter-content h2 { transition-delay: 0.15s; }
.chapter-content p { transition-delay: 0.3s; }
.chapter-content .chapter-scroll-cue { transition-delay: 0.45s; }
.chapter-content .chapter-cta { transition-delay: 0.45s; }
.chapter-content .chapter-links { transition-delay: 0.4s; }

.chapter-content.chapter-visible .chapter-label,
.chapter-content.chapter-visible h2,
.chapter-content.chapter-visible p,
.chapter-content.chapter-visible .chapter-scroll-cue,
.chapter-content.chapter-visible .chapter-cta,
.chapter-content.chapter-visible .chapter-links {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.chapter-left { margin-left: 8%; }
.chapter-right { margin-left: auto; margin-right: 8%; }
.chapter-center { margin: 0 auto; text-align: center; }

/* Chapter typography */
.chapter-label {
  display: inline-block;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #A3B18A;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: rgba(163, 177, 138, 0.1);
  border: 1px solid rgba(163, 177, 138, 0.18);
  border-radius: 9999px;
}

.chapter-content h2 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.15;
  color: #DAD7CD;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.chapter-content p {
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(163, 177, 138, 0.6);
  margin: 0 0 20px 0;
  max-width: 400px;
}

.chapter-center p {
  margin-left: auto;
  margin-right: auto;
}

.chapter-scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(163, 177, 138, 0.35);
  margin-top: 8px;
  animation: chapterBounce 2s ease infinite;
}

@keyframes chapterBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Chapter CTA buttons */
.chapter-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chapter-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #A3B18A;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(163, 177, 138, 0.15);
  border-radius: 6px;
  background: rgba(163, 177, 138, 0.05);
  transition: all 0.2s ease;
  pointer-events: auto;
}

.chapter-links a:hover {
  background: rgba(163, 177, 138, 0.12);
  border-color: rgba(163, 177, 138, 0.3);
  color: #DAD7CD;
}

.chapter-links a i {
  font-size: 0.65rem;
}

.chapter-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.creative-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(12, 18, 16, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(163, 177, 138, 0.15);
  border-radius: 9999px;
  color: #A3B18A;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
}

.creative-cta-btn:hover {
  background: rgba(92, 118, 80, 0.25);
  border-color: rgba(163, 177, 138, 0.3);
  color: #DAD7CD;
}

.creative-cta-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(12, 18, 16, 0.15);
  border: 1px solid rgba(163, 177, 138, 0.15);
  border-radius: 9999px;
  color: rgba(163, 177, 138, 0.6);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
}

.creative-cta-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(163, 177, 138, 0.3);
  color: #DAD7CD;
}

/* === Responsive === */
@media (max-width: 768px) {
  /* The card was eating ~40% of a phone screen and hiding the scene it is
     supposed to be narrating. Tighter type and padding claw most of that back. */
  .chapter-content h2 { font-size: 1.5rem; line-height: 1.12; }
  .chapter-content p { font-size: 0.84rem; line-height: 1.55; margin-top: 0.6rem; }
  .chapter-left, .chapter-right { margin: 0; }
  .chapter-content { max-width: 100%; padding: 16px 18px; margin: 0 14px; }
  .chapter-label { font-size: 0.58rem; padding: 4px 10px; }
  .chapter-scroll-cue { font-size: 0.72rem; margin-top: 0.7rem; }

  /* Bottom-anchored, but clear of the HUD hint text and the social buttons
     that sit along the bottom edge */
  .creative-chapter {
    padding: 70px 0 132px;
    align-items: flex-end;
  }

  /* Mobile: card fades in slowly with delay so user sees forest first.
     No max-height/overflow here on purpose — a scrollable card inside a
     scroll-driven journey traps the gesture: dragging the text moved the card
     instead of walking the trail. Cards size to their copy instead. */
  .chapter-content {
    opacity: 0;
    background: rgba(12, 18, 16, 0);
    border-color: transparent;
    box-shadow: none;
    transition: opacity 1.2s ease 0.8s, background 1.2s ease 0.8s, border-color 1.2s ease 0.8s, box-shadow 1.2s ease 0.8s;
  }

  /* Readable over a lantern-lit forest — the old 0.2 wash left text sitting
     on bright canopy. Darker plate, visible edge. */
  .chapter-content.chapter-visible {
    opacity: 1;
    background: rgba(10, 16, 14, 0.62);
    border-color: rgba(163, 177, 138, 0.14);
    box-shadow: 0 8px 34px rgba(0, 0, 0, 0.4);
  }

  /* Less blur on mobile — let forest show through */
  .chapter-content {
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
  }

  /* Center chapters — compact on mobile, don't block the whole view */
  .chapter-center {
    margin: 0 16px;
    text-align: center;
    max-width: 100%;
  }

  /* Longer stagger delays on mobile */
  .chapter-content .chapter-label { transition-delay: 1.0s; }
  .chapter-content h2 { transition-delay: 1.3s; }
  .chapter-content p { transition-delay: 1.8s; }
  .chapter-content .chapter-scroll-cue { transition-delay: 2.2s; }
  .chapter-content .chapter-cta { transition-delay: 2.2s; }
  .chapter-content .chapter-links { transition-delay: 2.0s; }

  /* Typing cursor after heading — no white-space constraint */
  .chapter-content.chapter-visible h2::after {
    content: '|';
    color: var(--color-primary, #5C7650);
    font-weight: 400;
    animation: typing-cursor 0.6s step-end infinite;
    margin-left: 2px;
  }

  @keyframes typing-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
  }

  .creative-hud-top {
    padding: 7px 12px;
    gap: 8px;
    max-width: calc(100vw - 24px);
  }
  .creative-hud-brand { font-size: 0.85rem; white-space: nowrap; }
  /* nowrap is the fix for "Code Mode" breaking onto two lines and making the
     pill twice as tall as it should be */
  .creative-hud-back {
    font-size: 0.72rem; padding: 7px 12px; min-height: 38px;
    white-space: nowrap; flex-shrink: 0;
  }
  /* Keep the hint on phones — tap-to-plant works on touch now, so hiding the
     only instruction for it made the signature interaction undiscoverable.
     Compact and centred above the bottom edge instead. */
  .creative-hud-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 74px;
    text-align: center;
    font-size: 0.68rem;
    opacity: 0.62;
  }
  .creative-hud-social { bottom: 20px; left: 16px; }
  .creative-hud-social a { width: 44px; height: 44px; font-size: 1rem; }

  .chapter-cta { flex-direction: column; align-items: center; }
  .creative-cta-btn, .creative-cta-outline { width: 100%; max-width: 280px; justify-content: center; padding: 14px 20px; }
  .creative-dots { display: none; }
}

@media (max-width: 400px) {
  .chapter-content h2 { font-size: 1.34rem; }
  .chapter-content p { font-size: 0.8rem; max-width: 100%; }
  .chapter-content { padding: 14px 15px; margin: 0 12px; }
  .chapter-label { font-size: 0.56rem; }
  /* Least room of all — pull the card closer to the chrome below it */
  .creative-chapter { padding-bottom: 118px; }
  .creative-hud-stats { bottom: 68px; font-size: 0.64rem; }
  .creative-hud-social a { width: 40px; height: 40px; font-size: 0.92rem; }

  .creative-hud-top { padding: 6px 10px; gap: 7px; }
  .creative-hud-brand { font-size: 0.76rem; }
  .creative-hud-back { font-size: 0.68rem; padding: 6px 10px; min-height: 34px; }
}

/* ========================================
   Base & Reset
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

/* Smooth scroll only for anchor clicks, not finger scrolling */
@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  line-height: 1.7;
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--color-primary);
  color: white;
}

/* ========================================
   Scrollbar — Xcode-style thin track
   ======================================== */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(163, 177, 138, 0.2);
  border-radius: 4px;
  border: 2px solid var(--color-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(163, 177, 138, 0.35);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(163, 177, 138, 0.2) var(--color-bg);
}

/* Creative mode — hide scrollbar entirely */
[data-theme="creative"] ::-webkit-scrollbar {
  display: none;
}

[data-theme="creative"] html,
[data-theme="creative"] body {
  scrollbar-width: none;
}

/* ========================================
   ZZZ-Inspired — Scan Lines & Noise Overlay
   ======================================== */

/* Subtle full-page scan line overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.008) 3px,
    rgba(0, 0, 0, 0.008) 6px
  );
  mix-blend-mode: multiply;
}

[data-theme="light"] body::after {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.008) 2px,
    rgba(0, 0, 0, 0.008) 4px
  );
}

/* ========================================
   ZZZ-Inspired — Corner Bracket Decorations
   ======================================== */

/* Geometric corner brackets on bento cells */
.bento-cell {
  position: relative;
}

.bento-cell::before,
.bento-cell::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--color-primary);
  border-style: solid;
  opacity: 0.15;
  transition: opacity var(--transition-base), border-color var(--transition-base);
  z-index: 2;
}

.bento-cell::before {
  top: 10px;
  left: 10px;
  border-width: 2px 0 0 2px;
}

.bento-cell::after {
  bottom: 10px;
  right: 10px;
  border-width: 0 2px 2px 0;
}

.bento-cell:hover::before,
.bento-cell:hover::after {
  opacity: 0.7;
}

/* ========================================
   ZZZ-Inspired — Glitch Text Effect
   ======================================== */

.glitch-text {
  position: relative;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.glitch-text:hover::before {
  opacity: 0.8;
  color: var(--color-primary);
  animation: glitch-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  -webkit-text-fill-color: var(--color-primary);
}

.glitch-text:hover::after {
  opacity: 0.8;
  color: var(--color-accent);
  animation: glitch-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  -webkit-text-fill-color: var(--color-accent);
}

@keyframes glitch-1 {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 1px); }
  100% { transform: translate(0); }
}

@keyframes glitch-2 {
  0% { transform: translate(0); }
  20% { transform: translate(3px, -2px); }
  40% { transform: translate(-3px, 1px); }
  60% { transform: translate(2px, 1px); }
  80% { transform: translate(-2px, -1px); }
  100% { transform: translate(0); }
}

/* ========================================
   ZZZ-Inspired — Diagonal Section Dividers
   ======================================== */

/* Section dividers — long smooth gradients */
.section-divider {
  position: relative;
}

/* Regular sections fade into alt */
.section-divider::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  background: linear-gradient(to bottom, transparent 0%, var(--color-bg-alt) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Alt sections fade into regular */
.section-divider-alt::after {
  background: linear-gradient(to bottom, transparent 0%, var(--color-bg) 100%);
}

/* First section — no visible switch from hero */
.section-divider-first::after {
  background: linear-gradient(to bottom, transparent 0%, var(--color-bg-alt) 100%);
}

/* Contact fades into footer */
.section-divider-footer::after {
  background: linear-gradient(to bottom, transparent 0%, var(--footer-bg) 100%);
  height: 350px;
}

/* Scroll Code Annotations */
.section-divider::before {
  content: attr(data-annotation);
  position: absolute;
  top: 2rem;
  left: 1rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.6s ease;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  letter-spacing: 0.05em;
  z-index: 2;
}

.section-divider.reveal-visible::before {
  opacity: 0.25;
}

@media (max-width: 991.98px) {
  .section-divider::before { display: none; }
}

/* ========================================
   ZZZ-Inspired — Neon Glow Accents
   ======================================== */

/* Primary buttons get subtle neon glow */
.btn-primary-custom {
  text-shadow: 0 0 20px rgba(var(--particle-color), 0.3);
}

.btn-primary-custom:hover {
  box-shadow: 0 8px 25px rgba(var(--particle-color), 0.4),
              0 0 40px rgba(var(--particle-color), 0.15);
}

/* Stat numbers glow — text-shadow is cheaper than drop-shadow */
.bento-stat-item .stat-number {
  text-shadow: 0 0 8px rgba(var(--particle-color), 0.2);
}

/* Hero badge glow pulse */
.hero-badge {
  box-shadow: 0 0 20px rgba(var(--particle-color), 0.08);
}

/* Award trophy icon glow */
.bento-award .badge-icon {
  box-shadow: 0 0 15px rgba(var(--particle-color), 0.15);
}

/* ========================================
   ZZZ-Inspired — Geometric Grid Overlay
   ======================================== */

/* Dot grid pattern in hero background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(circle, var(--dot-grid-color) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ========================================
   macOS Window Chrome — Traffic Light Dots
   ======================================== */
.mac-window {
  position: relative;
  padding-top: 2.75rem !important;
}

.mac-window::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow:
    18px 0 0 #febc2e,
    36px 0 0 #28c840;
  z-index: 3;
  opacity: 0.85;
}

/* ========================================
   macOS Notification Toast
   ======================================== */
.mac-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99997;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 0.82rem;
  color: var(--color-text-dark);
  font-weight: 600;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease;
}

.mac-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.mac-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.mac-toast-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mac-toast-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-dark);
}

.mac-toast-sub {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Word-by-word reveal for section titles */
.title-reveal .word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.15;
  padding-bottom: 0.05em;
}
.title-reveal .word {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
.title-reveal-active .word {
  transform: translateY(0);
}


/* (The preloader is gone, and the scroll-lock that hid the page behind it went
   with it. Nothing here gates document scroll on a JS class any more.) */

/* Terminal window */
.terminal-preloader {
  width: min(480px, 90vw);
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot-red { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green { background: #28c840; }

.terminal-title {
  margin-left: auto;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.04em;
}

.terminal-body {
  padding: 16px 18px 4px;
  min-height: 120px;
  max-height: 180px;
  overflow: hidden;
}

.terminal-line {
  font-size: 0.78rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transform: translateY(5px);
  animation: term-line-in 0.2s ease forwards;
}

.terminal-line .term-success {
  color: #28c840;
}

.terminal-line .term-accent {
  color: var(--color-primary);
}

.terminal-line .term-muted {
  color: rgba(255, 255, 255, 0.25);
}

.terminal-prompt {
  color: rgba(255, 255, 255, 0.6);
}

.terminal-cursor-line {
  padding: 0 18px 16px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  gap: 6px;
}

.terminal-prompt-symbol {
  color: var(--color-primary);
}

.terminal-blink {
  color: var(--color-primary);
  animation: term-blink 0.8s step-end infinite;
}

@keyframes term-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes term-line-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 0;
  padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
  transition: all var(--transition-base);
  background: transparent;
}

.navbar.navbar-scrolled {
  background: var(--nav-scrolled-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 var(--color-border-light), var(--shadow-sm);
  padding: 0.75rem 0;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

.navbar.navbar-hidden {
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-dark) !important;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.navbar-brand .brand-slash {
  color: var(--color-primary);
  font-weight: 400;
  margin-right: 0.1em;
}

.navbar-brand .brand-dot {
  color: var(--color-text-muted);
  font-weight: 400;
}

.navbar .nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  position: relative;
  transform-origin: bottom center;
}

/* Dock magnify — hovered link scales up, neighbors scale slightly */
.navbar .nav-link:hover {
  color: var(--color-text-dark);
  transform: scale(1.15) translateY(-2px);
}

.navbar .nav-item:hover + .nav-item .nav-link {
  transform: scale(1.05);
}

.navbar .nav-item:has(+ .nav-item:hover) .nav-link {
  transform: scale(1.05);
}

.navbar .nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.nav-cta {
  background: var(--color-primary);
  color: var(--color-white) !important;
  padding: 0.5rem 1.25rem !important;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(var(--particle-color), 0.3);
}

.nav-cta:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--particle-color), 0.4);
}

.navbar-toggler {
  border: none;
  padding: 0;
  background: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.hamburger-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
}

.hamburger-lines span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text-muted);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-lines span:nth-child(2) {
  width: 70%;
}

.navbar-toggler:hover .hamburger-lines span {
  background: var(--color-primary);
}

.navbar-toggler:hover .hamburger-lines span:nth-child(2) {
  width: 100%;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
  padding-top: 6rem;
  padding-bottom: 2rem;
}

/* Animated mesh gradient background */
.hero-bg-mesh {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-bg-mesh .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.15;
}

.hero-bg-mesh .blob-1 {
  width: 600px;
  height: 600px;
  background: var(--blob-1-color);
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
}

.hero-bg-mesh .blob-2 {
  width: 400px;
  height: 400px;
  background: var(--blob-2-color);
  bottom: 0;
  left: 10%;
}

.hero-bg-mesh .blob-3 {
  width: 350px;
  height: 350px;
  background: var(--blob-3-color);
  bottom: 10%;
  right: 10%;
}

/* Removed blob-float animation — blobs are now static for clean pathing */
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.02); }
}

/* Subtle dot grid */
.hero-bg-mesh::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-grid-color) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 1;
}

.hero > .container {
  position: relative;
  z-index: 3;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--hero-badge-bg);
  color: var(--hero-badge-color);
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.75rem;
  border: 1px solid var(--hero-badge-border);
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px currentColor;
}

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

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.5vw, 4.2rem);
  font-weight: 900;
  color: var(--color-text-dark);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.hero .name-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .credential {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Xcode console-style typed line */
.xc-console-line {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  min-height: 2.4rem;
  width: fit-content;
  max-width: 100%;
}

[data-theme="light"] .xc-console-line {
  background: rgba(0, 0, 0, 0.04);
}

.xc-prompt {
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.xc-cmd-text {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.xc-output .typing {
  color: #28c840;
  font-weight: 600;
}

.xc-output .typed-cursor {
  color: #28c840;
}

.hero-summary {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin-bottom: 2.25rem;
  line-height: 1.75;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.btn-primary-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-primary);
  color: var(--color-white);
  padding: 0.85rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: none;
  box-shadow: 0 4px 15px rgba(var(--particle-color), 0.35);
}

.btn-primary-custom:hover {
  background: var(--color-primary-dark);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(var(--particle-color), 0.4);
}

.btn-primary-custom i {
  transition: transform var(--transition-fast);
}

.btn-primary-custom:hover i {
  transform: translateX(3px);
}

.btn-outline-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-bg-card);
  color: var(--color-text);
  padding: 0.85rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
}

.btn-outline-custom:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.hero-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 1.1rem;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.hero-social a:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(var(--particle-color), 0.3);
}

.badge-icon.icon-trophy {
  background: var(--color-amber-light);
  color: var(--color-amber);
}

/* ========================================
   Bento Grid Hero Layout
   ======================================== */

/* Mega card — macOS-window outer container */
.bento-mega-card {
  background: var(--gradient-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  z-index: 3;
}

/* CSS Grid */
.bento-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "intro intro  profile profile"
    "intro intro  stats   stats"
    "skills skills award   award";
  gap: 1.25rem;
}

/* Cell base — glassmorphism card */
.bento-cell {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow var(--transition-base);
}

.bento-cell.bento-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bento-cell:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(var(--particle-color), 0.2);
}

/* Cell A: Main intro — largest cell */
.bento-intro {
  grid-area: intro;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem;
}

/* Cell B: Profile card — top-right */
.bento-profile {
  grid-area: profile;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 2rem 1.5rem;
}

.bento-profile .hero-profile-wrapper {
  position: relative;
}

.bento-profile .hero-profile-img {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  border: 3px solid var(--color-border-light);
  box-shadow: var(--shadow-lg);
}

.bento-profile-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.25rem;
}

.bento-profile-info .about-location {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.bento-profile-info .about-location i {
  color: var(--color-primary);
  font-size: 0.75rem;
}

/* Cell C: Stats row — mid-right */
.bento-stats {
  grid-area: stats;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 1.5rem;
  gap: 0.75rem;
}

.bento-stat-item {
  text-align: center;
  flex: 1;
}

.bento-stat-item .stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.bento-stat-item .stat-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Cell D: Skills preview — bottom-left */
.bento-skills {
  grid-area: skills;
  padding: 1.5rem 2rem;
}

.bento-skills h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bento-skills h5 i {
  color: var(--color-primary);
}

.bento-skills .skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bento-skills .skill-tag {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
}

/* Cell E: Award badge — bottom-right */
.bento-award {
  grid-area: award;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}

.bento-award-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-dark);
}

.bento-award-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* Bento responsive — Tablet */
@media (max-width: 991.98px) {
  .bento-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "intro   intro"
      "profile stats"
      "skills  award";
  }

  .bento-mega-card {
    padding: 1rem;
  }

  .bento-intro {
    padding: 2rem;
  }

  .bento-profile .hero-profile-img {
    width: 120px;
    height: 120px;
  }
}

/* Bento responsive — Mobile */
@media (max-width: 767.98px) {
  .bento-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "profile"
      "stats"
      "skills"
      "award";
  }

  .bento-mega-card {
    padding: 0.75rem;
    border-radius: var(--radius-xl);
  }

  .bento-cell {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .bento-intro {
    padding: 1.5rem;
  }

  .bento-stats {
    flex-direction: row;
    gap: 0.5rem;
  }

  .bento-stat-item .stat-number {
    font-size: 1.5rem;
  }
}

/* ========================================
   IDE Hero Layout
   ======================================== */
.ide-hero::before { display: none; } /* Hide default mac-window dots */
.ide-hero { padding: 0 !important; overflow: hidden; }

.ide-hero-layout { display: flex; flex-direction: column; }

/* Titlebar */
.ide-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--color-border-light);
}

.ide-titlebar .xcode-dots { display: flex; gap: 6px; }

.ide-filename {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex: 1;
}

/* Body — 3-column layout */
.ide-body {
  display: flex;
  min-height: 420px;
}

/* Sidebar */
.ide-sidebar {
  width: 180px;
  min-width: 180px;
  padding: 8px 0;
  border-right: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ide-sidebar-section { padding: 8px 12px; }

.ide-profile-thumb { padding: 8px 12px; }
.ide-profile-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}

.ide-link {
  text-decoration: none;
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}
.ide-link:hover { color: var(--color-primary); }

.ide-cv-btn.cv-button {
  width: auto;
  margin: 0;
  font-size: 0.68rem;
  padding: 5px 10px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(92, 118, 80, 0.1);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* Main Editor */
.ide-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ide-editor {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

.ide-comment {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  margin-bottom: 1rem;
}

/* Inspector */
.ide-inspector {
  width: 170px;
  min-width: 170px;
  padding: 12px;
  border-left: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.ide-metric { text-align: center; padding: 8px 0; }
.ide-metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ide-metric-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.ide-inspector-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 4px 0;
}

.ide-award {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.ide-frameworks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ide-frameworks .skill-tag {
  font-size: 0.65rem;
  padding: 3px 8px;
}

.ide-location {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Breadcrumb */
.ide-breadcrumb {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  padding: 4px 16px;
  border-bottom: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.05);
  opacity: 0.6;
}
.ide-bc-sep { margin: 0 4px; opacity: 0.4; }
.ide-bc-active { color: var(--color-text); }

/* Status bar */
.ide-statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 3px 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.58rem;
  color: var(--color-text-muted);
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--color-border-light);
  opacity: 0.6;
}
.ide-statusbar i { font-size: 0.55rem; margin-right: 3px; }
.ide-statusbar .fa-check-circle { color: #4CAF50; }
.ide-statusbar .fa-code-branch { color: var(--color-accent); }

/* Console */
/* IDE Tab Panels */
.ide-tab-panel { display: none; }
.ide-tab-panel.active { display: block; }

/* Code block styling */
.ide-code-block {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--color-text);
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  white-space: pre-wrap;
}
.code-keyword { color: #C678DD; }
.code-fn { color: #61AFEF; }
.code-string { color: var(--color-accent); }
.code-comment { color: var(--color-text-muted); opacity: 0.5; }
.code-error { color: #FF6B6B; text-decoration: wavy underline; text-underline-offset: 3px; }

/* Debug puzzle — terminal-style inline */
.debug-code { margin-bottom: 12px; }
.debug-prompt {
  border-top: 1px solid var(--color-border-light);
  padding-top: 10px;
}
.debug-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  opacity: 0.5;
}
.debug-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.debug-input-row::before {
  content: '$';
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--color-primary);
  padding: 6px 4px 6px 10px;
  flex-shrink: 0;
}
.debug-input {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--color-accent);
  outline: none;
  caret-color: var(--color-primary);
}
.debug-submit {
  padding: 6px 12px;
  background: none;
  border: none;
  border-left: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  font-family: 'SF Mono', monospace;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}
.debug-submit:hover { color: #34C759; }
.debug-result {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.68rem;
  min-height: 1.2em;
}
.debug-result.debug-success { color: #34C759; }
.debug-result.debug-fail { color: #FF6B6B; }

/* Forest Run Prompt */
.forest-run-prompt {
  padding-top: 12px;
  border-top: 1px solid var(--color-border-light);
  margin-top: 12px;
}
.forest-run-hint {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  opacity: 0.45;
  display: flex;
  align-items: center;
  gap: 6px;
}
.forest-run-hint kbd {
  padding: 2px 6px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border-light);
  border-radius: 3px;
  font-family: 'SF Mono', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
}

/* IDE Run Button in titlebar */
.ide-run-btn {
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.ide-run-btn:hover {
  background: rgba(52, 199, 89, 0.25) !important;
  color: #34C759 !important;
}

.ide-console {
  border-top: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.2);
}

.ide-console-tab {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.65rem;
  padding: 4px 14px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ide-console .xc-console-line {
  margin: 0;
  border: none;
  background: none;
  border-radius: 0;
  padding: 10px 14px;
}

.ide-console {
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: none;
}
.ide-console::-webkit-scrollbar { display: none; }

/* Interactive console input */
.ide-cmd-input {
  width: 100%;
  padding: 6px 14px;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--color-accent);
  caret-color: var(--color-primary);
}
.ide-cmd-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.3;
}

.ide-console .tf-line {
  padding: 2px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.ide-console .tf-prompt {
  color: var(--color-primary);
  margin-right: 6px;
}
.ide-console .tf-output-line {
  padding: 2px 14px 2px 28px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--color-text);
  opacity: 0.6;
}

/* IDE Panel reveal animation */
.ide-sidebar, .ide-main, .ide-inspector {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.ide-sidebar.ide-revealed,
.ide-main.ide-revealed,
.ide-inspector.ide-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile-only header */
.ide-mobile-header {
  display: none;
  padding: 16px;
  border-bottom: 1px solid var(--color-border-light);
  align-items: center;
  gap: 12px;
}

.ide-mobile-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.ide-mobile-info h4 {
  font-size: 0.9rem;
  margin: 0;
  color: var(--color-text-dark);
}

.ide-mobile-social {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.ide-mobile-social a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.ide-mobile-social a:hover { color: var(--color-primary); }
.ide-mobile-cv {
  background: var(--color-primary-light);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.ide-mobile-cv:hover { color: var(--color-primary); }

/* Responsive */
@media (max-width: 991.98px) {
  .ide-sidebar { display: none; }
  .ide-mobile-header { display: flex; }
  .ide-inspector {
    width: 100%;
    min-width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    border-left: none;
    border-top: 1px solid var(--color-border-light);
    padding: 12px;
  }
  .ide-inspector .xcode-sidebar-label:first-child { display: none; }
  .ide-inspector .ide-inspector-divider { display: none; }
  .ide-inspector .ide-frameworks { display: none; }
  .ide-inspector .ide-location { display: none; }
  .ide-body { flex-wrap: wrap; }
}

@media (max-width: 767.98px) {
  .ide-body { flex-direction: column; min-height: auto; }
  .ide-editor { padding: 16px 20px; }
  .ide-inspector { gap: 4px; }
  .ide-inspector .ide-award { display: none; }

  /* Keep the Build & Run CTA visible on mobile (was display:none) — it's the
     hero's primary interaction and forest.js tells users to press it. */
  .ide-titlebar .xcode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.62rem;
    padding: 6px 10px;
    min-height: 32px;
    line-height: 1;
    flex-shrink: 0;
  }
  /* Let the filename truncate so the button always has room */
  .ide-filename {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 375px) {
  .ide-editor { padding: 12px 14px; }
  .ide-editor h1 { font-size: 1.8rem; }
  .ide-editor .hero-summary { font-size: 0.82rem; }
  .ide-inspector .ide-metric-value { font-size: 1.2rem; }
  .hero-buttons { flex-direction: column; gap: 8px; }
  .hero-buttons a { width: 100%; text-align: center; }
}


/* ========================================
   Command Palette (Cmd+K)
   ======================================== */
.cmd-palette { position: fixed; inset: 0; z-index: 99999; display: flex; justify-content: center; padding-top: 20vh; }
.cmd-palette-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

.cmd-palette-box {
  position: relative;
  width: 480px;
  max-width: 90vw;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: cmdSlideIn 0.15s ease;
}

@keyframes cmdSlideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cmd-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-light);
}
.cmd-palette-input-wrap i { color: var(--color-text-muted); font-size: 0.85rem; }
.cmd-palette-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
}
.cmd-palette-input::placeholder { color: var(--color-text-muted); opacity: 0.5; }

.cmd-palette-results { max-height: 300px; overflow-y: auto; padding: 6px; }

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}
.cmd-item:hover { background: var(--color-primary-light); }
.cmd-label { font-size: 0.85rem; color: var(--color-text); }
.cmd-item kbd {
  font-family: 'SF Mono', monospace;
  font-size: 0.6rem;
  padding: 2px 6px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  color: var(--color-text-muted);
}


/* Section connectors — unsaved file indicator between sections */
.section-connector {
  text-align: center;
  padding: 0;
  margin: -1rem 0;
  position: relative;
  z-index: 1;
}
.section-connector span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
  opacity: 0.25;
}

/* XCTest Result Cards */
.xctest-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.xctest-result h6 {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  margin: 0 0 4px;
}
.xctest-pass {
  color: #34C759;
  font-size: 1.1rem;
  margin-top: 2px;
}
.xctest-pass.xctest-gold { color: #FFD700; }
.xctest-status {
  font-size: 0.6rem;
  padding: 2px 6px;
  background: rgba(52, 199, 89, 0.15);
  border-radius: var(--radius-full);
  color: #34C759;
  margin-left: 6px;
}
.xctest-gold-text {
  background: rgba(255, 215, 0, 0.15);
  color: #FFD700;
}

/* Image download progress animation */
.xcode-preview {
  position: relative;
}

.xcode-preview::before {
  content: 'Downloading...';
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  background: var(--color-bg-card);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.xcode-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--color-primary);
  transition: width 1s ease;
  z-index: 2;
}

.xcode-preview.img-loading::before { opacity: 1; }
.xcode-preview.img-loading::after { width: 100%; }

/* ========================================
   Section Common
   ======================================== */
.section {
  position: relative;
  padding: 6rem 0;
}

.section-enter {
  animation: section-slide-in 0.4s ease-out both;
}

@keyframes section-slide-in {
  0% {
    opacity: 0.7;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@media (max-width: 767.98px) {
  .section {
    padding: 4rem 0;
  }
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(var(--particle-color), 0.15);
}

.section-badge::before {
  content: '//';
  font-weight: 800;
  color: var(--color-primary);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 900;
  color: var(--color-text-dark);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin: 0 auto 3.5rem;
}

/* Section divider */
.section-bg-alt {
  background: var(--color-bg-alt);
}


/* About — kept for bento-profile reuse */
.about-location {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.about-location i {
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.cv-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-primary);
  color: var(--color-white);
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cv-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(var(--particle-color), 0.3);
}

@media (max-width: 767.98px) {
  .stat-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .about-card {
    padding: 1.5rem;
  }
}

/* ========================================
   Expertise Section
   ======================================== */
.expertise-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all var(--transition-base);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.expertise-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.expertise-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.expertise-card:hover::after {
  transform: scaleX(1);
}

.expertise-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  transition: all var(--transition-base);
}

.expertise-card:hover .expertise-icon {
  background: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(var(--particle-color), 0.3);
}

.expertise-card h5 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.expertise-card p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: 0;
}

/* Xcode Target Expertise Cards */
.xcode-target .xt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.xcode-target .xt-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-size: 0.85rem;
}

.xcode-target .xt-meta { flex: 1; }
.xcode-target .xt-meta h5 { margin: 0; font-size: 0.9rem; }
.xcode-target .xt-scheme {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0.6;
}

.xcode-target .xt-status {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.55rem;
}
.xcode-target .xt-status-active {
  background: rgba(52, 199, 89, 0.15);
  color: #34C759;
}

.xcode-target p {
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.xcode-target .xt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-light);
}

.xcode-target .xt-badge {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  padding: 2px 8px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  color: var(--color-primary);
}

.xcode-target .xt-build {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ========================================
   Skills Section
   ======================================== */
.skills-container {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
}

.skills-category {
  margin-bottom: 2rem;
}

.skills-category:last-child {
  margin-bottom: 0;
}

.skills-category h5 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skills-category h5::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-text);
  transition: all var(--transition-fast);
  cursor: default;
}

.skill-tag:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--particle-color), 0.1);
}

/* Package.json Skills Display */
.pkg-json {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  padding: 1.5rem;
  color: var(--color-text);
}

.pkg-line { white-space: nowrap; }
.pkg-indent { padding-left: 1.5rem; }
.pkg-indent2 { padding-left: 3rem; }
.pkg-comment {
  color: var(--color-text-muted);
  opacity: 0.5;
  font-style: italic;
  margin-bottom: 0.5rem;
}
.pkg-comment-inline {
  color: var(--color-text-muted);
  opacity: 0.4;
  font-style: italic;
}
.pkg-string { color: var(--color-accent); }
.pkg-version { color: var(--color-primary); }

@media (max-width: 767.98px) {
  .pkg-json { font-size: 0.7rem; padding: 1rem; overflow-x: auto; }
}

/* ========================================
   Resume / Timeline Section
   ======================================== */
.resume-subsection {
  margin-bottom: 2.5rem;
}

.resume-subsection:last-child {
  margin-bottom: 0;
}

.resume-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}

.resume-heading i {
  color: var(--color-primary);
  font-size: 1rem;
}

/* ========================================
   Git Log Terminal — Resume
   ======================================== */
.git-log-terminal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.git-log-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border-light);
}

.git-tab {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  padding: 8px 16px;
  cursor: pointer;
  border-right: 1px solid var(--color-border-light);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.git-tab:hover {
  background: var(--color-primary-light);
}

.git-tab.active {
  color: var(--color-text-dark);
  background: var(--color-bg-card);
  position: relative;
}

.git-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
}

.git-tab i {
  font-size: 0.6rem;
  opacity: 0.6;
}

.git-log-header {
  padding: 10px 18px;
  border-bottom: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .git-log-header {
  background: rgba(0, 0, 0, 0.02);
}

.git-cmd {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.git-log-body {
  padding: 16px 18px;
}

.git-commit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.72rem;
  line-height: 1.5;
}

.git-commit:last-child {
  border-bottom: none;
}

.git-graph {
  color: var(--color-primary);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.git-hash {
  color: #d19a66;
  font-weight: 600;
  flex-shrink: 0;
}

/* Git Blame Annotation */
.git-blame {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0.4;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
}

@media (max-width: 767.98px) {
  .git-blame { display: none; }
}

.git-branch {
  color: #28c840;
  font-weight: 600;
  font-size: 0.62rem;
  background: rgba(40, 200, 64, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.git-msg {
  color: var(--color-text-dark);
  font-weight: 500;
}

.git-date {
  color: var(--color-text-muted);
  font-size: 0.62rem;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.7;
}

.git-detail {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 4px 0 2px 20px;
  line-height: 1.5;
}

@media (max-width: 767.98px) {
  .git-commit {
    flex-direction: column;
    gap: 3px;
  }

  .git-date {
    margin-left: 0;
  }

  .git-detail {
    padding-left: 0;
  }
}

/* Cert & Award cards */
.cert-card, .award-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition-base);
}

.cert-card:hover, .award-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cert-icon, .award-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
}

.cert-icon {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.award-icon {
  background: var(--color-amber-light);
  color: var(--color-amber);
}

.cert-card h6, .award-card h6 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.15rem;
}

.cert-card p, .award-card p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* ========================================
   Projects Section
   ======================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 1.5rem;
}

@media (max-width: 767.98px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.project-link:hover {
  color: var(--color-primary-dark);
  transform: translateX(3px);
}

.project-link i {
  font-size: 0.7rem;
}

/* ========================================
   Xcode-Style Project Cards
   ======================================== */
.xcode-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.xcode-card:hover {
  box-shadow: var(--shadow-xl);
  border-color: rgba(var(--particle-color), 0.2);
  transform: translateY(-4px);
}

/* Title bar — macOS chrome */
.xcode-titlebar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--color-border-light);
  gap: 8px;
}

[data-theme="light"] .xcode-titlebar {
  background: rgba(0, 0, 0, 0.02);
}

.xcode-dots {
  display: flex;
  gap: 6px;
}

.xcode-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.xcode-dot-red { background: #ff5f57; }
.xcode-dot-yellow { background: #febc2e; }
.xcode-dot-green { background: #28c840; }

.xcode-filename {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.xcode-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #28c840;
  background: rgba(40, 200, 64, 0.1);
  padding: 2px 8px;
  border-radius: 3px;
}

.xcode-badge-build {
  color: #febc2e;
  background: rgba(254, 188, 46, 0.1);
}

/* Body — sidebar + main */
.xcode-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Sidebar — file navigator */
.xcode-sidebar {
  width: 140px;
  min-width: 140px;
  padding: 12px;
  border-right: 1px solid var(--color-border-light);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

[data-theme="light"] .xcode-sidebar {
  background: rgba(0, 0, 0, 0.015);
}

.xcode-sidebar-label {
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  opacity: 0.5;
  margin-top: 8px;
  margin-bottom: 4px;
}

.xcode-sidebar-label:first-child {
  margin-top: 0;
}

.xcode-file {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  padding: 3px 6px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.xcode-file i {
  font-size: 0.6rem;
  width: 12px;
  text-align: center;
  opacity: 0.6;
}

.xcode-file.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.xcode-file.active i {
  opacity: 1;
}

.xcode-tag {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  border-radius: 3px;
  width: fit-content;
}

/* Main content area */
.xcode-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.xcode-preview {
  height: 180px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
  border-bottom: 1px solid var(--color-border-light);
  padding: 12px;
}

[data-theme="light"] .xcode-preview {
  background: #1e1e1e;
}

.xcode-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s ease;
}

.xcode-card:hover .xcode-preview img {
  transform: scale(1.04) translateY(-2px);
}

.xcode-preview-empty {
  flex-direction: column;
  gap: 8px;
  color: var(--color-text-muted);
  opacity: 0.4;
}

.xcode-preview-empty i {
  font-size: 2rem;
}

.xcode-preview-empty span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.xcode-info {
  padding: 14px 16px;
  flex: 1;
}

.xcode-role {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.xcode-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.xcode-info p {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.xcode-info .project-link {
  margin-top: 8px;
}

/* Tab bar */
.xcode-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border-light);
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
  scrollbar-width: none;
}

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

[data-theme="light"] .xcode-tabs {
  background: rgba(0, 0, 0, 0.015);
}

.xcode-tab {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  padding: 6px 14px;
  white-space: nowrap;
  border-right: 1px solid var(--color-border-light);
  cursor: default;
  transition: all 0.15s ease;
  position: relative;
}

.xcode-tab.active {
  color: var(--color-text-dark);
  background: var(--color-bg-card);
}

.xcode-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
}

/* Build console */
.xcode-console {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  padding: 8px 14px;
  border-top: 1px solid var(--color-border-light);
  background: rgba(0, 0, 0, 0.15);
  letter-spacing: 0.02em;
}

[data-theme="light"] .xcode-console {
  background: rgba(0, 0, 0, 0.03);
}

.xc-ok {
  color: #28c840;
  font-weight: 700;
}

.xc-warn {
  color: #febc2e;
  font-weight: 700;
}

.xc-time {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Xcode Toolbar */
.xcode-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  gap: 12px;
  overflow-x: auto;
}

.xcode-toolbar-left,
.xcode-toolbar-center,
.xcode-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.xcode-toolbar-center {
  flex: 1;
  justify-content: center;
}

.xcode-tb-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  cursor: default;
  transition: all 0.15s ease;
  background: none;
}

.xcode-tb-play {
  color: #28c840;
}

.xcode-tb-stop {
  color: var(--color-text-muted);
  opacity: 0.4;
}

.xcode-tb-scheme {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  padding: 4px 10px;
  background: var(--color-bg-muted);
  border-radius: var(--radius-sm);
}

.xcode-tb-scheme i {
  font-size: 0.6rem;
  opacity: 0.6;
}

.xcode-tb-chevron {
  opacity: 0.4;
}

.xcode-tb-device {
  color: var(--color-text-dark);
  font-weight: 600;
}

.xcode-tb-status {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.68rem;
  color: #28c840;
  font-weight: 600;
}

.xcode-tb-status i {
  margin-right: 4px;
}

.xcode-tb-icon {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: none;
  cursor: default;
  opacity: 0.5;
}

.xcode-tb-icon.active {
  opacity: 1;
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Xcode card responsive */
@media (max-width: 767.98px) {
  /* Stack the card body so the sidebar can reflow full-width */
  .xcode-body {
    flex-direction: column;
  }

  /* Re-show the sidebar as a horizontal STACK-tag strip (was display:none,
     which dropped every card's tech stack on mobile) */
  .xcode-sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    border-right: none;
    border-top: 1px solid var(--color-border-light);
    padding: 10px 14px;
  }

  /* Drop the decorative file-navigator rows; keep only the tech tags */
  .xcode-sidebar .xcode-sidebar-label,
  .xcode-sidebar .xcode-file {
    display: none;
  }

  .xcode-tag {
    font-size: 0.64rem;
    padding: 3px 8px;
  }

  /* Taller preview now that cards are full-width (was 140px → letterboxed) */
  .xcode-preview {
    height: 200px;
  }

  .xcode-toolbar {
    display: none;
  }
}

/* ========================================
   Spotlight-Style Contact
   ======================================== */
.spotlight-container {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.spotlight-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border-light);
}

.spotlight-icon {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.spotlight-placeholder {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.spotlight-results {
  padding: 8px 0;
}

.spotlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  width: 100%;
  background: none;
  border: none;
  text-decoration: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.spotlight-item:hover {
  background: var(--color-primary-light);
}

.spotlight-item-info {
  cursor: default;
}

.spotlight-item-info:hover {
  background: none;
}

.spotlight-item-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.spotlight-item:hover .spotlight-item-icon {
  background: var(--color-primary);
  color: var(--color-white);
}

.spotlight-item-info:hover .spotlight-item-icon {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

.spotlight-item-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.spotlight-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-dark);
}

.spotlight-item-sub {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.spotlight-item-shortcut {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.spotlight-item-shortcut kbd {
  font-family: inherit;
  font-size: 0.65rem;
  padding: 2px 5px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text-muted);
}

.spotlight-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 6px 0;
}

/* ========================================
   Contact Editor — Code-style form
   ======================================== */
.contact-editor {
  overflow: hidden;
}

.ce-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--color-border-light);
}
.ce-titlebar .xcode-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ce-filename {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-left: 8px;
}

.ce-body {
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 2;
}

.ce-line { color: var(--color-text); }
.ce-comment { color: var(--color-text-muted); opacity: 0.5; font-style: italic; }
.ce-keyword { color: #C678DD; }
.ce-type { color: #61AFEF; }
.ce-string { color: var(--color-accent); }
.ce-indent { padding-left: 1.5rem; }

.ce-input {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--color-accent);
  outline: none;
  width: 220px;
  max-width: 50%;
  transition: border-color 0.2s ease;
}
.ce-input:focus { border-color: var(--color-primary); }

.ce-textarea {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--color-accent);
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s ease;
}
.ce-textarea:focus { border-color: var(--color-primary); }

.ce-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

.ce-send {
  padding: 8px 16px;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: 'SF Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}
.ce-send:hover { background: var(--color-primary-dark); }

.ce-copy {
  padding: 8px 12px;
  background: none;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: 'SF Mono', monospace;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}
.ce-copy:hover { border-color: var(--color-primary); color: var(--color-text); }

.ce-result {
  font-family: 'SF Mono', monospace;
  font-size: 0.72rem;
  margin-top: 8px;
  min-height: 1.2em;
}
.ce-result.ce-success { color: #34C759; }
.ce-result.ce-error { color: #FF6B6B; }

.ce-imports {
  padding: 12px 24px;
  border-top: 1px solid var(--color-border-light);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.8;
}
.ce-imports a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
.ce-imports a:hover { color: var(--color-text); text-decoration: underline; }

@media (max-width: 767.98px) {
  .ce-body { padding: 14px 16px; font-size: 0.75rem; }
  /* 16px prevents iOS Safari from auto-zooming the page on focus */
  .ce-input { width: 160px; max-width: 45%; font-size: 16px; }
  .ce-textarea { font-size: 16px; }
  .ce-imports { font-size: 0.65rem; padding: 10px 16px; }
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 2rem 0;
  text-align: left;
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border-light);
}

.footer-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-white);
  margin-bottom: 1rem;
  display: inline-block;
  letter-spacing: -0.02em;
}

.footer-brand .brand-slash {
  color: var(--color-primary);
  font-weight: 400;
}

.footer-brand .brand-dot {
  color: var(--footer-text);
  font-weight: 400;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--footer-icon-bg);
  color: var(--footer-icon-color);
  font-size: 0.9rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid var(--footer-icon-border);
}

.footer-social a:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-2px);
}

.footer p {
  margin: 0;
}

/* Terminal Footer */
.terminal-footer {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 2;
  padding: 1rem 0;
}

.tf-line { color: var(--color-text-muted); }
.tf-prompt { color: var(--color-primary); margin-right: 6px; }
.tf-output { color: var(--color-text); opacity: 0.6; padding-left: 1rem; }
.tf-links {
  display: flex;
  gap: 20px;
  padding-left: 1rem;
  flex-wrap: wrap;
}
.tf-links a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
.tf-links a:hover { color: var(--color-text); }
.tf-cursor {
  animation: tfBlink 1s step-end infinite;
  color: var(--color-primary);
}
@keyframes tfBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (max-width: 767.98px) {
  .terminal-footer { font-size: 0.7rem; }
  .tf-links { gap: 12px; }
}

/* ========================================
   Scroll Progress Bar
   ======================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--gradient-text);
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  box-shadow: 0 0 10px rgba(var(--particle-color), 0.4);
}

/* ========================================
   Code Scroll Spy Widget
   ======================================== */
.scroll-spy-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 997;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.72rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

.scroll-spy-widget.visible {
  opacity: 1;
  transform: translateY(0);
}

.spy-comment {
  color: var(--color-text-muted);
  font-style: italic;
}

.spy-section {
  color: var(--color-primary);
  font-weight: 700;
  font-style: normal;
  transition: all 0.2s ease;
}

.spy-line {
  color: var(--color-text-muted);
  opacity: 0.5;
  font-size: 0.65rem;
  border-left: 1px solid var(--color-border);
  padding-left: 8px;
  margin-left: 2px;
}

/* ========================================
   Particle Canvas
   ======================================== */
#particleCanvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

/* ========================================
   Custom Cursor
   ======================================== */
.custom-cursor {
  pointer-events: none;
  z-index: 99999;
}

/* Xcode crosshair cursor */
.xc-cursor {
  position: fixed;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 99999;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Horizontal line */
.xc-h {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-primary);
  transform: translateY(-0.5px);
  opacity: 0.6;
}

/* Vertical line */
.xc-v {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--color-primary);
  transform: translateX(-0.5px);
  opacity: 0.6;
}

/* Center dot */
.xc-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(var(--particle-color), 0.5);
}

/* Coordinate label */
.xc-label {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.55rem;
  color: var(--color-primary);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0.7;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

/* Hover state — crosshair becomes pointer icon */
.xc-cursor.xc-hover {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}

.xc-cursor.xc-hover ~ .xc-label {
  opacity: 0;
}

/* Hover pointer replacement */
.custom-cursor .xc-pointer {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  font-size: 1.1rem;
  color: var(--color-primary);
  transform: translate(-4px, -2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ========================================
   Cursor glow (desktop only)
   ======================================== */
.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--particle-color), 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

/* ========================================
   Button Ripple Effect
   ======================================== */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--ripple-color);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out;
  pointer-events: none;
}

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

/* ========================================
   Tilt Card Enhancements
   ======================================== */
.tilt-card {
  transform-style: preserve-3d;
}

/* ========================================
   Text Scramble
   ======================================== */
.text-scramble {
  display: inline-block;
}

/* ========================================
   Theme Toggle — iOS-style pill switch
   ======================================== */
.sound-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  padding: 0;
}

.sound-toggle:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
  width: 36px;
  height: 36px;
  transition: all 0.3s ease;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 1rem;
  color: var(--color-text-muted);
  position: relative;
}

.theme-toggle:hover .toggle-thumb {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Dark mode (default): show sun, hide moon */
.toggle-thumb .icon-sun {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg) scale(1);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle-thumb .icon-moon {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light mode: show moon, hide sun */
[data-theme="light"] .toggle-thumb .icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}
[data-theme="light"] .toggle-thumb .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Theme transition — Xcode build terminal */
.toggle-aftershock {
  display: none;
}

.xc-build-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: xc-overlay-in 0.15s ease both;
}

.xc-build-overlay.xc-build-done {
  animation: xc-overlay-out 0.4s ease both;
}

@keyframes xc-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes xc-overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.xc-build-terminal {
  width: min(440px, 88vw);
  background: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: xc-term-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.xc-build-done .xc-build-terminal {
  animation: xc-term-out 0.3s ease both;
}

@keyframes xc-term-in {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes xc-term-out {
  from { transform: scale(1) translateY(0); opacity: 1; }
  to { transform: scale(0.95) translateY(-10px); opacity: 0; }
}

.xc-build-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.xc-build-title {
  margin-left: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.3);
}

.xc-build-body {
  padding: 12px 16px;
  min-height: 100px;
  max-height: 160px;
  overflow: hidden;
}

.xc-build-line {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  animation: xc-line-in 0.12s ease both;
}

.xc-build-line.xc-cmd {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.xc-build-line.xc-success {
  color: #28c840;
  font-weight: 700;
  margin-top: 4px;
}

@keyframes xc-line-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Text transform during theme switch */
html.theme-switching h1,
html.theme-switching h2,
html.theme-switching h3,
html.theme-switching h4,
html.theme-switching h5,
html.theme-switching p,
html.theme-switching .nav-link,
html.theme-switching .section-title,
html.theme-switching .section-badge,
html.theme-switching .hero-badge,
html.theme-switching .stat-number,
html.theme-switching .stat-label,
html.theme-switching .xcode-filename,
html.theme-switching .spotlight-item-title,
html.theme-switching .bento-award-title {
  animation: text-wipe 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

html.theme-switching .hero-summary,
html.theme-switching .credential,
html.theme-switching .xcode-role,
html.theme-switching .xcode-info p,
html.theme-switching .skill-tag,
html.theme-switching .xcode-tag {
  animation: text-wipe 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.05s both;
}

html.theme-switching .btn-primary-custom,
html.theme-switching .btn-outline-custom,
html.theme-switching .cv-button,
html.theme-switching .project-link {
  animation: text-wipe 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

@keyframes text-wipe {
  0% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: blur(0);
  }
  30% {
    opacity: 0;
    transform: translateY(-8px) scaleY(0.95);
    filter: blur(3px);
  }
  70% {
    opacity: 0;
    transform: translateY(8px) scaleY(0.95);
    filter: blur(3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: blur(0);
  }
}

/* Mobile: navbar-brand smaller, keep controls tight */
/* ========================================
   Mobile — 767px (phones)
   ======================================== */
@media (max-width: 767.98px) {
  /* Scroll spy — hide on phones */
  .scroll-spy-widget {
    display: none !important;
  }

  /* Toast — reposition to bottom center */
  .mac-toast {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }

  /* Bento profile image smaller */
  .bento-profile .hero-profile-img {
    width: 100px;
    height: 100px;
  }

  /* Build terminal lines wrap */
  .xc-build-line {
    white-space: normal;
    word-break: break-word;
  }

  /* Spotlight tighter */
  .spotlight-item {
    padding: 8px 14px;
    gap: 10px;
  }

  .spotlight-item-shortcut {
    display: none;
  }

  /* Footer icons touch-friendly */
  .footer-social a {
    width: 42px;
    height: 42px;
  }

  /* Git log font smaller */
  .git-commit {
    font-size: 0.65rem;
  }

  .git-detail {
    font-size: 0.72rem;
  }

  /* XC console line wrap */
  .xc-console-line {
    flex-wrap: wrap;
    gap: 4px;
  }

  .xc-cmd-text {
    display: none;
  }

  /* Mobile — boost background visibility */
  .hero-bg-mesh .blob {
    opacity: 0.3;
    filter: blur(100px);
  }

  /* Add subtle body gradient for depth on mobile */
  .hero {
    background: linear-gradient(
      180deg,
      var(--color-bg) 0%,
      #1e2420 50%,
      var(--color-bg) 100%
    );
  }

  [data-theme="light"] .hero {
    background: linear-gradient(
      180deg,
      var(--color-bg) 0%,
      #eff0eb 50%,
      var(--color-bg) 100%
    );
  }

  /* Section transitions smoother on mobile */
  .section-divider::after {
    height: 200px;
  }

  .section-divider-footer::after {
    height: 250px;
  }
}

/* ========================================
   Small Mobile — 575px (iPhone SE / small)
   ======================================== */
@media (max-width: 575.98px) {
  .navbar-brand {
    font-size: 1.1rem;
  }

  /* Blobs smaller to prevent overflow */
  .hero-bg-mesh .blob-1 {
    width: 250px;
    height: 250px;
  }

  .hero-bg-mesh .blob-2 {
    width: 200px;
    height: 200px;
  }

  .hero-bg-mesh .blob-3 {
    width: 150px;
    height: 150px;
  }

  /* Hero heading tighter */
  .hero h1 {
    font-size: 1.8rem;
  }

  /* Bento profile even smaller */
  .bento-profile .hero-profile-img {
    width: 80px;
    height: 80px;
  }

  .bento-profile-info h4 {
    font-size: 0.9rem;
  }

  /* Stats compact */
  .bento-stat-item .stat-number {
    font-size: 1.25rem;
  }

  /* Section badge compact */
  .section-badge {
    font-size: 0.65rem;
    padding: 0.3rem 0.75rem;
  }

  /* Section title */
  .section-title {
    font-size: 1.4rem;
  }

  /* Build terminal compact */
  .xc-build-terminal {
    width: 92vw;
  }

  .xc-build-body {
    max-height: 120px;
  }

  /* Git log compact */
  .git-hash {
    display: none;
  }

  .git-branch {
    font-size: 0.55rem;
  }
}


/* Theme transition — smooth crossfade on all themed elements */
body,
.navbar,
.hero,
.section,
.footer,
.bento-mega-card,
.bento-cell,
.expertise-card,
.xcode-card,
.xcode-titlebar,
.xcode-sidebar,
.xcode-console,
.xcode-tabs,
.xcode-preview,
.xcode-toolbar,
.skills-container,
.spotlight-container,
.spotlight-item,
.scroll-spy-widget,
.mac-toast {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991.98px) {
  /* === Mobile navbar: full at top, hamburger when scrolled === */
  .navbar {
    padding: 0.75rem 0;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .navbar.navbar-scrolled {
    padding: 0.5rem 0;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  }

  .navbar-brand {
    font-size: 1.1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  /* Dropdown panel when hamburger is clicked */
  .navbar-collapse {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 8px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .navbar .nav-link {
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
  }

  .navbar .nav-link:hover,
  .navbar .nav-link.active {
    background: var(--color-primary-light);
  }

  /* === When scrolled: collapse to floating hamburger === */
  .navbar.navbar-compact .navbar-brand,
  .navbar.navbar-compact .sound-toggle,
  .navbar.navbar-compact .theme-toggle,
  .navbar.navbar-compact .nav-cta {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: scale(0.8);
  }

  .navbar.navbar-compact {
    background: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none;
    padding: 0 !important;
  }

  .navbar.navbar-compact .container {
    justify-content: flex-end;
  }

  .navbar.navbar-compact .navbar-toggler {
    pointer-events: auto;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 16px;
    z-index: 101;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0;
  }

  /* Compact mode dropdown: floating panel */
  .navbar.navbar-compact .navbar-collapse {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 68px);
    right: 16px;
    left: auto;
    width: 200px;
    margin-top: 0;
    pointer-events: auto;
    z-index: 100;
  }

  /* Don't do the slide-up hide in compact mode */
  .navbar.navbar-compact.navbar-hidden {
    transform: none !important;
  }

  /* Show toggles next to hamburger when compact + menu open */
  .navbar.navbar-compact.mobile-menu-open .sound-toggle,
  .navbar.navbar-compact.mobile-menu-open .theme-toggle {
    opacity: 1;
    pointer-events: auto;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    transform: scale(1);
  }

  .navbar.navbar-compact.mobile-menu-open .sound-toggle {
    right: 116px;
  }

  .navbar.navbar-compact.mobile-menu-open .theme-toggle {
    right: 72px;
  }
}

@media (max-width: 767.98px) {
  .hero h1 {
    font-size: 2.25rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .expertise-card {
    padding: 1.5rem;
  }

  .skills-container {
    padding: 1.5rem;
  }
}

/* ========================================
   Smooth scroll snap (optional feel)
   ======================================== */
/* ========================================
   Konami Code Easter Egg
   ======================================== */
html.konami-active {
  --color-primary: #ff6b6b;
  --color-primary-dark: #ee5a24;
  --gradient-text: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff);
  --particle-color: 255, 107, 107;
}

html.konami-active * {
  transition: all 0.3s ease !important;
}

html.konami-active .hero-profile-img,
html.konami-active .bento-profile .hero-profile-img {
  animation: konami-spin 1s ease-in-out;
  border-color: #ff6b6b;
}

html.konami-active .bento-mega-card,
html.konami-active .xcode-card,
html.konami-active .git-log-terminal,
html.konami-active .spotlight-container {
  border-color: #ff6b6b;
  box-shadow: 0 0 30px rgba(255, 107, 107, 0.2);
}

html.konami-active .hero h1 {
  animation: konami-rainbow 0.5s linear infinite;
}

html.konami-active .xc-build-terminal {
  border-color: #ff6b6b;
}

@keyframes konami-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes konami-rainbow {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ========================================================================
   MOBILE POLISH — code-mode responsive refinements (audit pass)
   Every rule is scoped to a max-width media query, so desktop (>=992px) is
   never touched. Ordered widest -> narrowest so the narrower breakpoints win
   by source order. Creative mode is unaffected.
   ======================================================================== */

@media (max-width: 991.98px) {
  /* Remove the default grey/blue tap-flash on touch — desktop uses hover
     states the touch UI never shows, so the flash reads as "cheap". */
  a,
  button,
  [role="button"],
  .nav-cta,
  .btn-primary-custom,
  .btn-outline-custom,
  .cv-button,
  .project-link,
  .xcode-tab,
  .git-tab,
  .footer-social a,
  .navbar-toggler {
    -webkit-tap-highlight-color: transparent;
  }

  /* Mirror body's overflow-x clip onto html (the real iOS scroll container)
     to kill stray horizontal rubber-banding. */
  html {
    overflow-x: hidden;
  }

  /* Grow the top-of-page nav controls to a 44px tap target. Only the outer
     button grows; the inner 36px toggle thumb stays visually centered.
     Excludes the floating .navbar-compact cluster (deliberately spaced, and
     its hamburger is already 44px). */
  .navbar:not(.navbar-compact) .navbar-toggler,
  .navbar:not(.navbar-compact) .sound-toggle,
  .navbar:not(.navbar-compact) .theme-toggle {
    width: 44px;
    height: 44px;
  }

  /* Comfortable 44px rows in the open dropdown menu */
  .navbar .nav-link {
    min-height: 44px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    display: flex;
    align-items: center;
  }

  /* Floating dropdown: adapt width to the device and scroll internally if it
     ever gets taller than the viewport (landscape / short phones). */
  .navbar.navbar-compact .navbar-collapse {
    width: auto;
    min-width: 200px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - 84px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 84px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Lead with identity on mobile: reorder the IDE hero column so the
     avatar/name/social card sits under the titlebar, ahead of the editor.
     (.ide-hero-layout is a flex column; these are its only children.) */
  .ide-titlebar { order: 0; }
  .ide-mobile-header { order: 1; }
  .ide-body { order: 2; }
  .ide-console { order: 3; }
}

@media (max-width: 767.98px) {
  /* Trim the large empty gap above the first card in each section */
  .section-subtitle {
    font-size: 0.95rem;
    margin: 0 auto 2rem;
  }

  /* Project "Live Site" link -> a real, button-like 44px tap target */
  .xcode-info .project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    margin-top: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-primary-light);
    font-size: 0.8rem;
  }
  .xcode-info .project-link:active {
    transform: scale(0.98);
  }

  /* In-development preview placeholders read as intentional, not unloaded */
  .xcode-preview-empty {
    opacity: 0.6;
  }
  .xcode-preview-empty i {
    font-size: 2.4rem;
  }

  /* Resume work/education toggles -> 44px tap target */
  .git-tab {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 0.7rem;
  }

  /* Let long git-log commit text wrap instead of clipping at the card edge */
  .git-commit {
    overflow-wrap: anywhere;
  }
  .git-commit > span,
  .git-msg,
  .git-detail {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* Cert/award test-result headings wrap with their inline status badge */
  .cert-card h6,
  .award-card h6,
  .xctest-result h6 {
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .xctest-status,
  .xctest-gold-text {
    display: inline-block;
  }

  /* Footer social links: real tap padding + legible size */
  .tf-links {
    row-gap: 4px;
    column-gap: 16px;
  }
  .tf-links a {
    display: inline-flex;
    align-items: center;
    padding: 6px 0;
    font-size: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  /* One consistent outer page gutter (up from Bootstrap's cramped ~12px) */
  .container {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Hero code blocks: shrink slightly + let long tokens break (no clipping) */
  .ide-code-block {
    font-size: 0.7rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* skills.json package block: stop the tiny internal sideways scroll */
  .pkg-json {
    font-size: 0.68rem;
    padding: 1rem 0.85rem;
    line-height: 1.7;
    overflow-x: hidden;
  }
  .pkg-indent { padding-left: 1rem; }
  .pkg-indent2 { padding-left: 2rem; }
  .pkg-line {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  /* IDE status bar wraps instead of clipping "Ln 1, Col 1" */
  .ide-statusbar {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 4px 14px;
  }

  /* Even, balanced inspector metric columns ("Businesses Indexed" no longer
     makes the middle column taller than its neighbours) */
  .ide-inspector .ide-metric {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 4px;
    text-align: center;
  }
  .ide-inspector .ide-metric-label {
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
  }

  /* Expertise card meta text: legible (was ~9.6px micro-text) */
  .xcode-target .xt-scheme,
  .xcode-target .xt-badge,
  .xcode-target .xt-build {
    font-size: 0.68rem;
  }
  .xcode-target .xt-scheme {
    opacity: 0.75;
  }

  /* Contact "code" inputs: break onto their own full-width line so the email
     placeholder/value isn't clipped by the Swift prefix text */
  .ce-input {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Contact buttons: wrap, equal width, 44px tall */
  .ce-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ce-send,
  .ce-copy {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.78rem;
  }

  /* Import-style social links: legible + a little tap padding */
  .ce-imports {
    font-size: 0.72rem;
    line-height: 2.1;
  }
  .ce-imports a {
    display: inline-block;
    padding: 2px 3px;
  }

  /* A touch more breathing room now that cards are full-width */
  .xcode-info {
    padding: 16px 16px 18px;
  }
}

@media (max-width: 400px) {
  /* Hero IDE tab strip: fit all four tabs; scoped to .ide-main so the project
     cards' reused tab strips are untouched. Mask hints at scroll if needed. */
  .ide-main .xcode-tab {
    padding: 7px 9px;
    font-size: 0.6rem;
  }
  .ide-main .xcode-tabs {
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);
    mask-image: linear-gradient(to right, #000 92%, transparent);
  }

  /* Expertise card footer: let the badge + build text wrap before touching */
  .xcode-target .xt-footer {
    flex-wrap: wrap;
    gap: 4px 10px;
  }
}

/* ========================================================================
   ACCESSIBILITY — skip link + keyboard focus rings
   ======================================================================== */
.skip-link {
  position: absolute;
  left: 8px;
  top: -56px;
  z-index: 10001;
  padding: 10px 16px;
  background: var(--color-bg-card, #1c1c1e);
  color: var(--color-text, #fff);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-sm, 6px);
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
}

/* Visible focus ring for keyboard users (mouse focus stays clean via :focus-visible). */
:focus-visible {
  outline: 2px solid var(--color-primary, #5C7650);
  outline-offset: 2px;
}
/* These inputs clear the default outline in their base rule — restore a ring on keyboard focus. */
.ce-input:focus-visible,
.ce-textarea:focus-visible,
.debug-input:focus-visible,
.ide-cmd-input:focus-visible,
.cmd-palette-input:focus-visible {
  outline: 2px solid var(--color-primary, #5C7650);
  outline-offset: 2px;
}

/* ========================================================================
   PERF-LITE — auto-enabled by JS when the machine can't hold ~40fps.
   Drops the decorative GPU load; content and layout are untouched.
   ======================================================================== */
html.perf-lite .hero-bg-mesh,
html.perf-lite #particleCanvas,
html.perf-lite .cursor-glow,
html.perf-lite #customCursor {
  display: none !important;
}
html.perf-lite body {
  cursor: auto !important;
}
/* backdrop blur is the single most expensive paint effect on weak GPUs */
html.perf-lite *,
html.perf-lite *::before,
html.perf-lite *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
