/* ═══════════════════════════════════════════════════════════
   DESIGN SYSTEM — Dark Theme (Default)
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Colors — Dark */
  --bg:           #0a0a0a;
  --bg-elevated:  #111111;
  --bg-card:      #161616;
  --bg-hover:     #1a1a1a;
  --surface:      #1e1e1e;
  --border:       rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.14);

  --text-primary:   #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary:  #6e6e73;

  --accent:       #e8b4b8;
  --accent-soft:  #d4a0a4;
  --accent-dim:   rgba(232,180,184,0.15);
  --accent-glow:  rgba(232,180,184,0.08);
  --accent-ring:  rgba(232,180,184,0.4);

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'Fira Code', 'SF Mono', monospace;

  /* Spacing */
  --section-pad: clamp(80px, 10vw, 140px);
  --container:   min(1100px, 90vw);

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Focus */
  --focus-ring: 0 0 0 2px var(--accent-ring), 0 0 0 4px rgba(232,180,184,0.15);
}

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════ */

[data-theme="light"] {
  --bg:           #f8f8fa;
  --bg-elevated:  #ffffff;
  --bg-card:      #ffffff;
  --bg-hover:     #f0f0f2;
  --surface:      #ebebed;
  --border:       rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);

  --text-primary:   #1a1a1a;
  --text-secondary: #555560;
  --text-tertiary:  #888893;

  --accent:       #b86b70;
  --accent-soft:  #a85a5f;
  --accent-dim:   rgba(184,107,112,0.12);
  --accent-glow:  rgba(184,107,112,0.06);
  --accent-ring:  rgba(184,107,112,0.4);
}

/* Hero adjustments for light theme */
[data-theme="light"] .hero-bg::after {
  background: linear-gradient(170deg, rgba(248,248,250,0.3) 0%, rgba(248,248,250,0.7) 45%, var(--bg) 100%);
}
[data-theme="light"] .hero-scanline {
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.01) 2px, rgba(0,0,0,0.01) 4px);
}
[data-theme="light"] ::selection { background: var(--accent); color: #fff; }
[data-theme="light"] .gallery-wrapper::before { background: linear-gradient(to right, var(--bg), transparent); }
[data-theme="light"] .gallery-wrapper::after { background: linear-gradient(to left, var(--bg), transparent); }
[data-theme="light"] .section-alt .gallery-wrapper::before { background: linear-gradient(to right, var(--bg-elevated), transparent); }
[data-theme="light"] .section-alt .gallery-wrapper::after { background: linear-gradient(to left, var(--bg-elevated), transparent); }
[data-theme="light"] .lightbox { background: rgba(255,255,255,0.96); }
[data-theme="light"] .lightbox-close,
[data-theme="light"] .lightbox-prev,
[data-theme="light"] .lightbox-next {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.1);
  color: #1a1a1a;
}
[data-theme="light"] .lightbox-caption { color: var(--text-secondary); }
[data-theme="light"] #navbar {
  background: rgba(248,248,250,0.75);
}
[data-theme="light"] #navbar.scrolled {
  background: rgba(248,248,250,0.88);
}
[data-theme="light"] .gallery-nav {
  background: rgba(248,248,250,0.9);
  color: var(--text-secondary);
}
[data-theme="light"] #sakura-canvas { opacity: 0.5; }

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  transition: background-color 0.4s var(--ease), color 0.3s var(--ease);
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s var(--ease);
}

img, video { display: block; max-width: 100%; }
ul { list-style: none; }

.container { width: var(--container); margin: 0 auto; }

/* ── Global Focus Styles ── */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ═══════════════════════════════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */

.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 10001;
  background: transparent;
  pointer-events: none;
}
.scroll-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent), var(--accent-soft));
  transition: width 0.08s linear;
  box-shadow: 0 0 8px var(--accent-glow), 0 0 24px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════
   CUSTOM CURSOR
   ═══════════════════════════════════════════════════════════ */

@media (hover: hover) and (pointer: fine) {
  body { cursor: none !important; }
  *, *::before, *::after { cursor: none !important; }
  a, button, [role="button"], input, select, textarea,
  .gallery-item, .nav-link, .btn, .contact-item, .poem-card,
  .project-card, .skill-category, .publication-card,
  .nav-cta, .nav-hamburger, .theme-toggle, .back-to-top,
  .lightbox-close, .lightbox-prev, .lightbox-next,
  .gallery-nav, .tech-badge, .btn-small, .mobile-link {
    cursor: none !important;
  }
  .media-gallery, .writing-carousel { cursor: none !important; }
  .media-gallery.dragging, .writing-carousel.dragging { cursor: none !important; }
  *:active { cursor: none !important; }
  [style*="cursor"] { cursor: none !important; }
}

.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease), height 0.2s var(--ease), background 0.2s;
  mix-blend-mode: difference;
}
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1.5px solid var(--accent-ring);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out), border-color 0.3s, opacity 0.3s;
  opacity: 0.6;
}
.cursor-dot.hovering {
  width: 12px; height: 12px;
  background: var(--accent);
}
.cursor-ring.hovering {
  width: 52px; height: 52px;
  border-color: var(--accent);
  opacity: 0.3;
}

/* Hide custom cursor on touch / mobile */
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   BACK TO TOP
   ═══════════════════════════════════════════════════════════ */

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s var(--ease);
  pointer-events: none;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 24px var(--accent-glow), 0 0 30px var(--accent-glow);
  transform: translateY(-4px);
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDERS
   ═══════════════════════════════════════════════════════════ */

.section-divider {
  position: relative;
  height: 1px;
  overflow: visible;
}
.divider-line {
  position: absolute;
  top: 0; left: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), var(--accent), var(--accent-soft), transparent);
  transform: translateX(-50%);
  transition: width 1.2s var(--ease-out);
  opacity: 0.5;
}
.section-divider.visible .divider-line {
  width: min(80%, 700px);
}

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE
   ═══════════════════════════════════════════════════════════ */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Sun = shown in dark mode (click to go light) */
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
/* Moon = shown in light mode (click to go dark) */
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* ═══════════════════════════════════════════════════════════
   SAKURA CANVAS
   ═══════════════════════════════════════════════════════════ */

#sakura-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9998;
  transition: opacity 0.4s;
}

/* ═══════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════ */

#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 32px;
  transition: all 0.4s var(--ease);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: rgba(10,10,10,0.75);
  border-bottom: 1px solid transparent;
}
#navbar.scrolled {
  border-bottom-color: var(--border);
  background: rgba(10,10,10,0.88);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: -0.5px;
  transition: opacity 0.3s var(--ease);
}
.nav-logo:hover { opacity: 0.8; }

.nav-links { display: flex; gap: 32px; }
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--accent); }
.nav-link.active::after { width: 100%; }

.nav-actions { display: flex; gap: 12px; align-items: center; }
.nav-cta {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.3s var(--ease);
}
.nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.nav-cta-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: transparent;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--text-secondary);
  transition: all 0.3s var(--ease);
  transform-origin: center;
}
.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -5px); }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 20px 0 28px;
  gap: 4px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.mobile-menu.open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.mobile-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 12px 0;
  transition: color 0.3s, padding-left 0.3s var(--ease);
  border-bottom: 1px solid var(--border);
}
.mobile-link:last-child { border-bottom: none; }
.mobile-link:hover {
  color: var(--accent);
  padding-left: 8px;
}

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */

#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: blur(1px) saturate(0.8);
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, rgba(10,10,10,0.4) 0%, rgba(10,10,10,0.75) 45%, var(--bg) 100%);
}

.hero-scanline {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.008) 2px, rgba(255,255,255,0.008) 4px);
  mix-blend-mode: overlay;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding-top: 80px;
}

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0.9;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-shadow: 0 0 80px var(--accent-glow);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-tertiary);
  max-width: 480px;
  line-height: 1.8;
  margin-bottom: 36px;
}

/* Typed cursor blink */
.typed-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* GitHub stats in hero */
.github-stats {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding: 12px 0;
}
.gh-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gh-stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.gh-stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 28px;
  border-radius: 100px;
  border: 1px solid var(--border);
  transition: all 0.4s var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.6s var(--ease);
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-dim), 0 0 40px var(--accent-glow);
}
.btn-secondary { color: var(--text-secondary); }
.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.hero-image { display: flex; justify-content: flex-end; }
.hero-img-wrapper {
  width: 360px;
  height: 440px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-hover);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 50px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: heroFloat 6s ease-in-out infinite;
  will-change: transform;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero-img-wrapper img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
.hero-img-wrapper:hover img { transform: scale(1.03); }
.hero-img-wrapper::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 20px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.3);
  pointer-events: none;
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  z-index: 2;
}
.scroll-line {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--text-tertiary), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.85); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ═══════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════ */

.section {
  padding: var(--section-pad) 0;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}
.section-alt { background: var(--bg-elevated); }

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
  text-shadow: 0 0 20px var(--accent-glow);
  position: relative;
  display: inline-block;
}
.section-label::before {
  content: '//';
  margin-right: 6px;
  opacity: 0.4;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 48px;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   ABOUT
   ═══════════════════════════════════════════════════════════ */

.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 60px;
}

.about-text p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.8;
}

.about-details {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s var(--ease);
}
.detail-item:last-child { border-bottom: none; }
.detail-item:hover { border-color: var(--border-hover); }
.detail-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.detail-value {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════
   PROJECT CARDS
   ═══════════════════════════════════════════════════════════ */

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 16px;
  padding: 48px;
  margin-bottom: 32px;
  transition: all 0.4s var(--ease);
  position: relative;
}
.project-card:hover {
  border-color: var(--border-hover);
  border-left-color: var(--accent);
  box-shadow: 0 12px 48px rgba(0,0,0,0.35), 0 0 30px var(--accent-glow);
  transform: translateY(-4px);
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-dim);
  border-radius: 100px;
}

.project-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.project-summary {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 600px;
  line-height: 1.7;
}

.project-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.project-section h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.project-section p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.result-item { text-align: center; }
.result-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  display: block;
  text-shadow: 0 0 20px var(--accent-dim);
}
.result-label {
  font-size: 12px;
  color: var(--text-tertiary);
  display: block;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.tech-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 14px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 100px;
  border: 1px solid transparent;
  transition: all 0.3s var(--ease);
}
.tech-badge:hover {
  border-color: var(--accent-ring);
  box-shadow: 0 0 12px var(--accent-glow);
}

.project-links { margin-top: 24px; }
.btn-small {
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.3s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-small:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════
   PUBLICATION
   ═══════════════════════════════════════════════════════════ */

.publication-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  gap: 32px;
  transition: all 0.4s var(--ease);
}
.publication-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 48px rgba(0,0,0,0.35), 0 0 25px var(--accent-glow);
  transform: translateY(-3px);
}

.pub-icon {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform 0.4s var(--ease);
}
.publication-card:hover .pub-icon { transform: scale(1.05) rotate(-2deg); }

.pub-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}
.pub-authors {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.pub-venue {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  font-style: italic;
}
.pub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.pub-meta-item {
  font-size: 13px;
  color: var(--text-tertiary);
}
.pub-abstract {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════
   SKILLS + PROFICIENCY BARS
   ═══════════════════════════════════════════════════════════ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-category {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.4s var(--ease);
  position: relative;
  overflow: hidden;
}
.skill-category::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.skill-category:hover::before { opacity: 1; }
.skill-category:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25), 0 0 20px var(--accent-glow);
}

.skill-cat-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.skill-list li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.3s var(--ease), padding-left 0.3s var(--ease);
  position: relative;
}
.skill-list li:last-child { border-bottom: none; }
.skill-list li:hover {
  color: var(--text-primary);
  padding-left: 6px;
}

/* Proficiency bar */
.skill-bar {
  display: block;
  height: 3px;
  margin-top: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.skill-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 3px;
  transition: width 1.2s var(--ease-out);
  box-shadow: 0 0 8px var(--accent-glow);
}
.skill-bar.animate::after {
  width: var(--bar-width, 80%);
}

/* ═══════════════════════════════════════════════════════════
   PHILOSOPHY
   ═══════════════════════════════════════════════════════════ */

.philosophy-block {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}
.philosophy-block::before {
  content: '"';
  position: absolute;
  top: 12px; left: 28px;
  font-family: var(--font-display);
  font-size: 120px;
  color: var(--accent-dim);
  line-height: 1;
  pointer-events: none;
}
.philosophy-quote {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  position: relative;
}
.philosophy-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ═══════════════════════════════════════════════════════════
   GALLERY — Horizontal Auto-Scroll Carousel
   ═══════════════════════════════════════════════════════════ */

.gallery-wrapper {
  position: relative;
  overflow: hidden;
  min-height: 280px;
}

.gallery-wrapper::before,
.gallery-wrapper::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  z-index: 2;
  pointer-events: none;
}
.gallery-wrapper::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.gallery-wrapper::after  { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.section-alt .gallery-wrapper::before { background: linear-gradient(to right, var(--bg-elevated), transparent); }
.section-alt .gallery-wrapper::after  { background: linear-gradient(to left, var(--bg-elevated), transparent); }

.media-gallery {
  display: flex;
  gap: 20px;
  padding: 8px 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scrollbar-width: none;
  contain: layout paint;
}
.media-gallery::-webkit-scrollbar { display: none; }
@media (hover: none) {
  .media-gallery.dragging { cursor: grabbing; }
}
.media-gallery.is-loading::before {
  content: 'Loading gallery...';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  min-width: 100%;
  color: var(--text-tertiary);
  font-size: 14px;
  letter-spacing: 0.3px;
  font-family: var(--font-mono);
}

.gallery-item {
  flex: 0 0 320px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 4/3;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.4s var(--ease);
  user-select: none;
  background: rgba(255,255,255,0.02);
  will-change: transform;
}
.gallery-item:hover {
  border-color: var(--accent-soft);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35), 0 0 30px var(--accent-glow);
}
.gallery-item:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.gallery-item img,
.gallery-item video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
  pointer-events: none;
  backface-visibility: hidden;
}
.gallery-item:hover img,
.gallery-item:hover video { transform: scale(1.08); }

.gallery-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  font-size: 13px;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s var(--ease);
}
.gallery-item:hover .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 3;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease);
  opacity: 0;
}
.gallery-wrapper:hover .gallery-nav,
.writing-gallery-wrapper:hover .gallery-nav { opacity: 1; }
.gallery-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-50%) scale(1.05);
}
.gallery-nav-prev { left: 16px; }
.gallery-nav-next { right: 16px; }

@media (hover: none) {
  .gallery-nav { opacity: 1; }
}

.gallery-progress {
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}
.gallery-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 2px;
  transition: width 0.15s ease;
  width: 0%;
}

.empty-state {
  text-align: center;
  color: var(--text-tertiary);
  padding: 60px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════════ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.96);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.lightbox.open {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
  transform: scale(0.96);
  transition: transform 0.3s var(--ease-out), opacity 0.25s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.lightbox.open img { transform: scale(1); }
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.3s var(--ease);
  z-index: 10;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
  opacity: 1;
  background: rgba(255,255,255,0.12);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.lightbox-close { top: 20px; right: 24px; }
.lightbox-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-caption {
  position: absolute;
  bottom: 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  width: 100%;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   WRITING LIGHTBOX
   ═══════════════════════════════════════════════════════════ */

.writing-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  backdrop-filter: blur(30px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.writing-lightbox.open {
  display: flex;
  opacity: 1;
}

.writing-lb-content {
  max-width: 620px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  transform: scale(0.94);
  transition: transform 0.4s var(--ease-out);
  box-shadow: 0 32px 120px rgba(0,0,0,0.5), 0 0 60px var(--accent-glow);
}
.writing-lightbox.open .writing-lb-content {
  transform: scale(1);
}

.writing-lb-content .wlb-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 600;
  margin-bottom: 28px;
  color: var(--accent);
  letter-spacing: -0.3px;
}
.writing-lb-content .wlb-body {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--text-primary);
  line-height: 2;
  white-space: pre-line;
  margin-bottom: 24px;
}
.writing-lb-content .wlb-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.writing-lb-content::-webkit-scrollbar { width: 4px; }
.writing-lb-content::-webkit-scrollbar-track { background: transparent; }
.writing-lb-content::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 4px;
}

[data-theme="light"] .writing-lightbox {
  background: rgba(255,255,255,0.94);
}

@media (max-width: 600px) {
  .writing-lightbox { padding: 20px 16px; }
  .writing-lb-content { padding: 28px 20px; border-radius: 14px; }
  .writing-lb-content .wlb-body { font-size: 16px; line-height: 1.9; }
}

/* ═══════════════════════════════════════════════════════════
   POETRY / WRITING — Horizontal Carousel
   ═══════════════════════════════════════════════════════════ */

.writing-gallery-wrapper {
  min-height: 240px;
}

.writing-carousel {
  display: flex;
  gap: 20px;
  padding: 8px 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scrollbar-width: none;
  contain: layout paint;
}
.writing-carousel::-webkit-scrollbar { display: none; }
@media (hover: none) {
  .writing-carousel.dragging { cursor: grabbing; }
}

.poem-card {
  flex: 0 0 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  transition: all 0.4s var(--ease);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.poem-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.poem-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.25), 0 0 25px var(--accent-glow);
}
.poem-card:hover::before { opacity: 1; }

.poem-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.poem-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.9;
  white-space: pre-line;
}
.poem-meta {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════
   CONTACT
   ═══════════════════════════════════════════════════════════ */

.contact-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 500px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 440px;
  transition: all 0.3s var(--ease);
  color: var(--text-secondary);
  background: var(--bg-card);
}
.contact-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(6px);
  box-shadow: 0 4px 24px var(--accent-glow), 0 0 40px var(--accent-glow);
}
.contact-item svg { flex-shrink: 0; }
.contact-item span { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.footer {
  padding: 48px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-text {
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════
   REVEAL ANIMATION
   ═══════════════════════════════════════════════════════════ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal { opacity: 1; transform: none; }
  .hero-img-wrapper { animation: none; }
  .btn-primary::before { display: none; }
  .skill-bar::after { transition-duration: 0.01ms !important; }
  .divider-line { transition-duration: 0.01ms !important; }
}

@media (max-width: 900px) {
  #navbar { padding: 0 18px; }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
    padding-inline: 20px;
  }
  .hero-subtitle { margin: 0 auto 28px; }
  .hero-ctas { justify-content: center; }
  .hero-image { justify-content: center; }
  .hero-img-wrapper { width: 260px; height: 320px; }
  .github-stats { justify-content: center; }

  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .skills-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .project-details { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .publication-card { flex-direction: column; gap: 20px; padding: 28px; }

  .nav-links, .nav-actions { display: none; }
  .nav-hamburger { display: flex; }

  .contact-item { max-width: 100%; }
  .contact-links { gap: 10px; }

  .gallery-item { flex: 0 0 280px; }
  .poem-card { flex: 0 0 300px; padding: 28px; }

  .section-heading {
    font-size: clamp(26px, 5vw, 36px);
    margin-bottom: 36px;
  }

  .back-to-top { bottom: 20px; right: 20px; width: 42px; height: 42px; }
}

@media (max-width: 600px) {
  :root {
    --section-pad: clamp(48px, 10vw, 72px);
    --container: 92vw;
  }

  .hero-content { padding-top: 60px; gap: 24px; }
  .hero-img-wrapper { width: 220px; height: 280px; border-radius: 16px; }
  .hero-name { font-size: clamp(36px, 10vw, 48px); letter-spacing: -1px; }
  .hero-title { font-size: 16px; margin-bottom: 16px; }
  .hero-subtitle { font-size: 14px; line-height: 1.7; margin-bottom: 24px; }
  .hero-ctas { gap: 10px; }
  .btn { padding: 12px 22px; font-size: 13px; }
  .hero-scroll-indicator { bottom: 24px; }

  .section-label { font-size: 11px; letter-spacing: 2px; }
  .section-heading { font-size: clamp(24px, 6vw, 32px); margin-bottom: 28px; }

  .about-text p { font-size: 15px; line-height: 1.7; margin-bottom: 16px; }
  .detail-item { padding: 16px 0; }

  .skills-grid { grid-template-columns: 1fr; gap: 12px; }
  .skill-category { padding: 20px; }
  .skill-cat-title { font-size: 11px; margin-bottom: 12px; padding-bottom: 10px; }

  .project-card { padding: 24px; margin-bottom: 20px; }
  .project-title { font-size: 22px; }
  .project-summary { font-size: 14px; margin-bottom: 24px; }
  .project-tag { font-size: 10px; padding: 3px 10px; }
  .tech-badge { font-size: 11px; padding: 5px 12px; }
  .results-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .result-number { font-size: 22px; }

  .pub-title { font-size: 17px; }
  .pub-icon { width: 44px; height: 44px; border-radius: 10px; }
  .pub-meta { gap: 8px; flex-direction: column; }

  .gallery-item { flex: 0 0 240px; }
  .gallery-nav { width: 34px; height: 34px; font-size: 16px; }
  .gallery-wrapper::before,
  .gallery-wrapper::after { width: 40px; }

  .poem-card { flex: 0 0 280px; padding: 24px; }
  .poem-title { font-size: 16px; margin-bottom: 12px; }
  .poem-body { font-size: 14px; line-height: 1.8; }
  .writing-gallery-wrapper { min-height: 200px; }

  .philosophy-block { padding: 24px; border-radius: 14px; }
  .philosophy-block::before { font-size: 60px; top: 2px; left: 12px; }
  .philosophy-quote { font-size: clamp(20px, 5vw, 28px); margin-bottom: 16px; }
  .philosophy-text { font-size: 14px; }

  .contact-text { font-size: 15px; margin-bottom: 28px; }
  .contact-item { max-width: 100%; padding: 16px 18px; gap: 12px; }
  .contact-item span { font-size: 13px; }
  .contact-item svg { width: 18px; height: 18px; }

  .lightbox { padding: 16px; }
  .lightbox img { border-radius: 6px; }
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next { width: 40px; height: 40px; font-size: 20px; }
  .lightbox-close { top: 12px; right: 12px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-caption { font-size: 12px; bottom: 16px; }

  .footer { padding: 32px 0; }
  .footer-text { font-size: 12px; }

  .back-to-top { bottom: 16px; right: 16px; width: 40px; height: 40px; }

  .github-stats { gap: 14px; flex-wrap: wrap; }
  .gh-stat-value { font-size: 16px; }
}

@media (max-width: 380px) {
  :root { --container: 94vw; }
  .hero-img-wrapper { width: 180px; height: 240px; }
  .hero-name { font-size: 32px; }
  .btn { padding: 10px 18px; font-size: 12px; }
  .gallery-item { flex: 0 0 220px; }
  .poem-card { flex: 0 0 260px; }
  .contact-item { padding: 14px 14px; }
}
