/* ========== CSS Variables (Light Theme) ========== */
:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fc;
  --bg-navbar: rgba(255, 255, 255, 0.88);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --card-shadow-hover: 0 12px 28px rgba(37, 99, 235, 0.1), 0 4px 12px rgba(0, 0, 0, 0.04);
  --hero-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #2563eb 85%, #7c3aed 100%);
  --hero-gradient-alt: linear-gradient(135deg, rgba(15,23,42,0.92) 0%, rgba(37,99,235,0.88) 100%);
  --tag-bg: #eff6ff;
  --tag-text: #2563eb;
  --tag-bg-hover: #2563eb;
  --tag-text-hover: #ffffff;
  --navbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

.dark-mode {
  --bg: #0b1120;
  --bg-secondary: #111827;
  --bg-navbar: rgba(11, 17, 32, 0.92);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-light: #1e293b;
  --accent-glow: rgba(96, 165, 250, 0.12);
  --border: #1e293b;
  --border-light: #1a2332;
  --card-bg: #111827;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 12px 28px rgba(96, 165, 250, 0.08), 0 4px 12px rgba(0, 0, 0, 0.15);
  --hero-gradient: linear-gradient(135deg, #020617 0%, #0f172a 40%, #1e3a5f 85%, #1a1a4e 100%);
  --hero-gradient-alt: linear-gradient(135deg, rgba(2,6,23,0.95) 0%, rgba(30,58,95,0.9) 100%);
  --tag-bg: #1e3a5f;
  --tag-text: #93c5fd;
  --tag-bg-hover: #60a5fa;
  --tag-text-hover: #0f172a;
}

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

a:visited {
  color: var(--accent);
}

/* ========== Navbar ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--navbar-height);
  background: var(--bg-navbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

.navbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.navbar-brand svg {
  width: 26px;
  height: 26px;
  opacity: 0.7;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-links a {
  color: var(--text-secondary) !important;
  font-size: 0.89rem;
  font-weight: 500;
  padding: 0.35rem 0;
  position: relative;
  transition: color 0.2s;
}

.navbar-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
  border-radius: 1px;
}

.navbar-links a:hover {
  color: var(--accent) !important;
}

.navbar-links a:hover::after {
  width: 100%;
}

.navbar-links a.active {
  color: var(--accent) !important;
}

.navbar-links a.active::after {
  width: 100%;
}

/* Dark mode toggle */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  padding: 0;
  margin-left: 0.5rem;
}

.dark-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.dark-toggle svg {
  width: 18px;
  height: 18px;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  margin-top: var(--navbar-height);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ========== Fade-in Animations ========== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fade-up {
  animation: fade-up 0.6s ease both;
}

/* Stagger children */
.animate-fade-up:nth-child(1) { animation-delay: 0.05s; }
.animate-fade-up:nth-child(2) { animation-delay: 0.12s; }
.animate-fade-up:nth-child(3) { animation-delay: 0.19s; }
.animate-fade-up:nth-child(4) { animation-delay: 0.26s; }
.animate-fade-up:nth-child(5) { animation-delay: 0.33s; }
.animate-fade-up:nth-child(6) { animation-delay: 0.40s; }

/* ========== Hero Section ========== */
.hero {
  background: var(--hero-gradient);
  padding: 7rem 2rem 5.5rem;
  text-align: center;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

/* Subtle animated glow */
.hero::after {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(96,165,250,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: glow-drift 8s ease-in-out infinite alternate;
}

@keyframes glow-drift {
  0%   { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-45%) translateY(30px); }
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 3px solid rgba(255,255,255,0.25);
  margin: 0 auto 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  overflow: hidden;
  animation: scale-in 0.5s ease both;
}

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

.hero-avatar .initials {
  font-size: 2.2rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.6rem;
  line-height: 1.08;
  animation: fade-up 0.6s ease both;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .tagline {
  font-size: 1.3rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
  animation: fade-up 0.6s ease 0.1s both;
}

.hero .tagline-accent {
  background: linear-gradient(135deg, #93c5fd 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 500;
}

.hero .bio {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2rem;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
  animation: fade-up 0.6s ease 0.2s both;
}

.hero .hero-cta {
  animation: fade-up 0.6s ease 0.3s both;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.social-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.social-links a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.social-links svg {
  width: 17px;
  height: 17px;
}

/* Primary / secondary buttons for hero */
.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.6rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-hero-primary {
  background: rgba(255,255,255,0.15);
  color: #ffffff !important;
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-hero-primary:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}

.btn-hero-secondary {
  background: transparent;
  color: rgba(255,255,255,0.8) !important;
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-hero-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
  color: #ffffff !important;
}

.social-links a svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ========== Section Headings ========== */
.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.section-subheading {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.section {
  padding: 3.5rem 0 3rem;
}

/* ========== Project Cards (Home Page Grid) ========== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.65rem;
  text-decoration: none !important;
  color: var(--text) !important;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.project-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card .card-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.project-card .card-title-icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

.project-card .card-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex-grow: 1;
}

.project-card .card-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.project-card .card-metric {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-glow);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.project-card .card-arrow {
  margin-top: 0.3rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap 0.2s ease;
}

.project-card:hover .card-arrow {
  gap: 0.55rem;
}

/* ========== Project Groups (Home Page) ========== */
.projects-group {
  margin-bottom: 2.75rem;
}

.projects-group:last-child {
  margin-bottom: 0;
}

.projects-group-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
}

.projects-group-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
}

.projects-group-sub {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0 0 1.25rem;
}

/* "Live" badge on production project cards */
.card-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.card-badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}

.dark-mode .card-badge-live {
  color: #86efac;
}

/* ========== About Page ========== */
.about-profile {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  margin-bottom: 3rem;
}

.about-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-avatar span {
  color: white;
  font-size: 3rem;
  font-weight: 700;
}

.about-info h2 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.about-info .role {
  color: var(--accent);
  font-weight: 500;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.about-info .bio-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 600px;
}

.about-info .bio-text ul {
  list-style: none;
  padding-left: 0;
}

.about-info .bio-text ul li {
  margin-bottom: 0.5rem;
  padding-left: 1.25rem;
  position: relative;
}

.about-info .bio-text ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ========== Skills Tags ========== */
.skills-section {
  margin-bottom: 3rem;
}

.skills-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.skill-tag:hover {
  background: var(--tag-bg-hover);
  color: var(--tag-text-hover);
}

/* ========== Skill Categories ========== */
.skill-category {
  margin-bottom: 1.25rem;
}

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

.skill-category-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-light);
}

/* ========== Metrics Section ========== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin: 2.5rem 0;
}

.metric-card {
  text-align: center;
  padding: 1.75rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
}

.metric-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
  line-height: 1.1;
}

.dark-mode .metric-value {
  background: linear-gradient(135deg, #93c5fd 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========== Contact Card ========== */
.contact-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.2s;
}

.contact-card:hover {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}

.contact-card .contact-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-card .contact-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.contact-card .contact-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.contact-card .contact-text p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.contact-card .contact-text a {
  color: var(--accent);
  font-weight: 500;
}

.badge-open {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  margin-top: 0.75rem;
}

.badge-open::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}

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

.dark-mode .badge-open {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

/* ========== Project Detail Page Elements ========== */
.demo-btn-wrap {
  text-align: center;
  margin: 1rem 0;
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #ffffff !important;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.6rem;
  border-radius: var(--radius-md);
  border: none;
  transition: all 0.2s;
}

.demo-btn:hover {
  background: var(--accent-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
}

.dark-mode .demo-btn {
  background: #1e40af;
  color: #ffffff !important;
}

.dark-mode .demo-btn:hover {
  background: #3b82f6;
  color: #ffffff !important;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.5rem 0 1.5rem 0;
  color: var(--text-secondary);
}

.keyword-tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}

.keyword-tag:hover {
  background: var(--tag-bg-hover);
  color: var(--tag-text-hover);
}

.goal-box {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  color: var(--text);
  font-size: 0.95rem;
}

.results-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin: 1.5rem 0;
  color: var(--text);
}

.results-box ul {
  list-style: none;
  padding-left: 0;
}

.results-box li {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.7;
}

.results-box li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text);
  font-weight: 700;
}

.results-box li:last-child {
  margin-bottom: 0;
}

.highlight-number {
  font-weight: 700;
  color: var(--accent);
}

/* Figure / Image styling */
.figure {
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s;
}

.figure:hover {
  border-color: var(--accent);
  box-shadow: var(--card-shadow-hover);
}

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

.figure-caption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  line-height: 1.6;
}

.architecture-diagram {
  background: var(--bg-secondary);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace, 'Consolas';
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  border: 1px solid var(--border);
  text-align: center;
}

/* ========== Results Table ========== */
.results-table {
  border-collapse: collapse;
  width: 70%;
  min-width: 400px;
  font-size: 1rem;
  margin: 1.5rem auto;
}

.results-table th,
.results-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  text-align: center;
}

.results-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text);
}

.results-table td {
  background: var(--card-bg);
}

.results-table .merged-value {
  font-weight: 700;
  color: var(--accent);
}

/* ========== Content Typography ========== */
.content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--text);
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2.75rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}

.content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.content p {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.content p b, .content p strong {
  color: var(--text);
  font-weight: 600;
}

.content ul, .content ol {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  list-style-position: inside;
}

.content li > ul,
.content li > ol {
  padding-left: 1.25rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.content li {
  margin-bottom: 0.3rem;
}

.content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace, 'Consolas';
}

.content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1rem;
}

.content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

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

.content table th,
.content table td {
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.9rem;
}

.content table th {
  background: var(--bg-secondary);
  font-weight: 600;
}

/* ========== Other Projects - Section grids ========== */
.project-category {
  margin-bottom: 2rem;
}

.project-category h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.category-tag {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.category-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ========== Footer ========== */
.footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .hero {
    padding: 5rem 1.5rem 3.5rem;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .hero .tagline {
    font-size: 1.15rem;
  }

  .hero .bio {
    font-size: 0.95rem;
  }

  .hero-avatar {
    width: 85px;
    height: 85px;
  }

  .about-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }

  .about-avatar {
    width: 110px;
    height: 110px;
  }

  .about-info .bio-text {
    max-width: 100%;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    flex-direction: column;
    text-align: center;
  }

  .container {
    padding: 0 1.25rem;
  }

  .section {
    padding: 2.5rem 0 2rem;
  }

  .navbar-inner {
    padding: 0 1.25rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-table {
    width: 100%;
    min-width: auto;
  }

  .hero-cta-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .social-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .skill-category-label {
    display: block;
  }
}

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

  .hero .tagline {
    font-size: 1rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Preserve legacy classes for project detail pages ========== */
.highlight, .hB {
  background: #b3d4fc;
  text-shadow: none;
}

.dark-mode .highlight,
.dark-mode .hB {
  background: #1e3a5f;
}

.hY {
  background: #ffff66;
  text-shadow: none;
}

.hP {
  background: #ffccff;
  text-shadow: none;
}

.hR {
  background: #cc0000;
  color: #fff;
  text-shadow: none;
}

.codeblock {
  background: #e0e0e0;
  text-shadow: none;
  padding: 2px;
  border: 1px solid #888;
}

.dark-mode .codeblock {
  background: var(--bg-secondary);
  border-color: var(--border);
}

.w100 {
  max-width: 100%;
  max-height: 90%;
}

img {
  image-orientation: from-image;
}

hr {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ========== Error Pages ========== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  gap: 0.5rem;
}

.error-code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.error-page p {
  color: var(--text-secondary);
}

.error-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: background 0.2s ease;
}

.error-link:hover {
  background: var(--accent-hover);
}
