/* Compatibility layer for existing content components. Source snapshots: style.css + spa.css.
   New visual rules belong in portal.css. */
@layer legacy {
/* style.css */
/* Kamen Rider Zein Silver & Gold Theme with bold typography - Landing Page Edition */


/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-color: #e5e7eb;
  --text-color: #111827;
  --nav-bg: rgba(229, 231, 235, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(0, 0, 0, 0.05);
  --btn-outline: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --nav-bg: rgba(15, 23, 42, 0.85);
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --btn-outline: rgba(255, 255, 255, 0.2);
}

/* Hide scrollbar entirely for clean UI */
::-webkit-scrollbar {
  display: none;
}

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  z-index: 9999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(255, 109, 0, 0.8);
}

html {
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
}

body {
  font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}



/* Custom Cursor */
.custom-cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ff6d00;
  pointer-events: none;
  z-index: 999999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s;
}

.custom-cursor-glow {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 109, 0, 0.5);
  pointer-events: none;
  z-index: 999998;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background-color 0.2s, transform 0.1s;
}

.custom-cursor.hover {
  width: 15px;
  height: 15px;
}

.custom-cursor-glow.hover {
  width: 60px;
  height: 60px;
  background-color: rgba(255, 109, 0, 0.1);
  border-color: rgba(255, 109, 0, 0.8);
}

h1,
h2,
h3,
h4 {
  font-family: 'Space Grotesk', sans-serif;
}

/* Glassmorphism utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 5%;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #111827;
}

.logo-text .highlight {
  color: #ff6d00;
}

.logo-image {
  height: 25px;
  /* Perfect height for a tightly-cropped logo in a navbar */
  width: auto;
  object-fit: contain;
  margin-right: 15px;

}

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

.nav-links a {
  color: #374151;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #ff6d00;
}

.nav-actions {
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.nav-login-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #111827;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-login-btn:hover {
  background: rgba(255, 109, 0, 0.15);
  border-color: rgba(255, 109, 0, 0.4);
  color: #ffd700;
  transform: translateY(-2px);
}

.lang-toggle-btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #111827;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 10px;
}

.lang-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: #111827;
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 5%;
  padding-top: 80px;
}

#mujoco-stream {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
  background-color: var(--bg-color);
  transition: filter 0.4s ease;
}

[data-theme="dark"] #mujoco-stream {
  filter: brightness(0.9) contrast(1.1);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(243, 244, 246, 0.4);
  z-index: -1;
  pointer-events: none;
}

.hero-content {
  max-width: 800px;
  animation: slideUp 1s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 109, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 109, 0, 0.3);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 5rem;
  line-height: 1.1;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 2rem;
  font-weight: 400;
  color: #ffd700;
  margin-bottom: 20px;
}

.hero-text {
  font-size: 1.2rem;
  line-height: 1.6;
  color: #111827;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
  margin-bottom: 40px;
  max-width: 600px;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  color: #111827;
  border: none;
  box-shadow: 0 8px 20px rgba(230, 81, 0, 0.3);
}

.primary-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(230, 81, 0, 0.4);
}

.secondary-btn {
  background: transparent;
  color: #111827;
  border: 1px solid rgba(0, 0, 0, 0.2);
  margin-left: 15px;
}

.secondary-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: #111827;
}

/* Base Sections layout */
.section-title {
  font-size: 2.5rem;
  text-align: center;
  color: #111827;
  margin-bottom: 3rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* About Section */
.about-section {
  padding: 100px 5%;
  background-color: #f3f4f6;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 40px;
  border-radius: 24px;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  text-align: center;
}

@media (min-width: 768px) {
  .profile-card {
    flex-direction: row;
    text-align: left;
    gap: 40px;
  }
}

.profile-image-container {
  position: relative;
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .profile-image-container {
    margin-bottom: 0;
  }
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #1a1e24;
  position: relative;
  z-index: 2;
}

.profile-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110%;
  height: 110%;
  background: radial-gradient(circle, rgba(255, 109, 0, 0.4) 0%, transparent 70%);
  z-index: 1;
  filter: blur(15px);
  animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.profile-info {
  flex-grow: 1;
}

.profile-name {
  font-size: 2.2rem;
  color: #111827;
  margin-bottom: 5px;
}

.profile-role {
  font-size: 1.1rem;
  color: #ff6d00;
  font-weight: 500;
  margin-bottom: 15px;
}

.profile-bio {
  color: #4b5563;
  line-height: 1.7;
  font-size: 1rem;
  margin-bottom: 25px;
}

.profile-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

@media (min-width: 768px) {
  .profile-socials {
    justify-content: flex-start;
  }
}

.tech-tag {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #111827;
  transition: all 0.3s ease;
}

.tech-tag:hover {
  background: rgba(255, 109, 0, 0.15);
  border-color: rgba(255, 109, 0, 0.4);
  color: #ffd700;
}

.social-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  color: #111827;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  text-decoration: none;
}

.social-icon:hover {
  background: rgba(255, 109, 0, 0.15);
  border-color: rgba(255, 109, 0, 0.4);
  color: #ffd700;
  transform: translateY(-3px);
}

/* Statistics Section */
.stats-section {
  padding: 80px 5%;
  background: var(--bg-color);
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  overflow: hidden;
}

/* Background grid for cybernetic feel */
.stats-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 109, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 109, 0, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  z-index: -1;
  -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
  mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 45px;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
}

.stat-card {
  position: relative;
  padding: 40px 20px;
  padding-top: 55px;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(12px);
  overflow: visible;
}

/* Cybernetic accent line */
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ff6d00, #ffd700, transparent);
  transition: width 0.4s ease, opacity 0.4s ease;
  border-radius: 3px;
  opacity: 0;
}

.stat-card:hover {
  transform: translateY(-12px);
  border-color: rgba(255, 109, 0, 0.3);
  box-shadow: 0 15px 35px rgba(255, 109, 0, 0.15), inset 0 0 20px rgba(255, 109, 0, 0.05);
}

.stat-card:hover::after {
  width: 70%;
  opacity: 1;
}

/* Floating Icon Wrapper */
.stat-icon-wrapper {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: #0f172a;
  border: 2px solid rgba(255, 109, 0, 0.5);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 109, 0, 0.2);
  transition: all 0.4s ease;
  z-index: 2;
}

.stat-card:hover .stat-icon-wrapper {
  background: linear-gradient(135deg, #ff6d00, #ffd700);
  box-shadow: 0 0 25px rgba(255, 109, 0, 0.5);
  border-color: transparent;
  transform: translateX(-50%) translateY(-5px);
}

.stat-icon {
  font-size: 1.6rem;
  color: #ff6d00;
  transition: all 0.4s ease;
  filter: drop-shadow(0 0 8px rgba(255, 109, 0, 0.4));
}

.stat-card:hover .stat-icon {
  color: #0f172a;
  transform: scale(1.1);
  filter: none;
}

.stat-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 5px;
  font-family: 'Space Grotesk', sans-serif;
  text-shadow: 0 0 15px rgba(255, 109, 0, 0.2);
  transition: text-shadow 0.3s ease;
}

.stat-card:hover .stat-number {
  text-shadow: 0 0 25px rgba(255, 109, 0, 0.5);
}

.stat-label {
  color: var(--text-color);
  opacity: 0.7;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

/* Global Cyber Energy Lines Background (Dynamic Fire/Neon Flow) */
.cyber-energy-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cyber-energy-line {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(255, 109, 0, 0.05), transparent);
  opacity: 0.8;
}

.cyber-energy-line::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -2px;
  width: 5px;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(255, 109, 0, 0.7), #ffeeb5, rgba(255, 109, 0, 0.8), transparent);
  border-radius: 5px;
  filter: drop-shadow(0 0 10px #ff6d00) blur(2px);
  animation: flowLight var(--duration, 4s) infinite linear;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 20px 4px rgba(255, 109, 0, 0.6);
}

@keyframes flowLight {
  0% { top: -35%; opacity: 0; }
  10% { opacity: 1; filter: drop-shadow(0 0 10px #ff6d00) blur(2px) brightness(1.2); }
  90% { opacity: 1; filter: drop-shadow(0 0 15px #ffd700) blur(1px) brightness(1.5); }
  100% { top: 125%; opacity: 0; }
}

/* Ensure container content and buttons stay clickable and above the energetic background */
section[id="projects"] .container,
section[id="knowledge-hub"] .container,
section[id="courses"] .container {
  position: relative;
  z-index: 10;
}

section[id="projects"],
section[id="knowledge-hub"],
section[id="courses"] {
  position: relative;
  overflow: hidden;
}

/* Projects & Knowledge Section */
.projects-section,
.courses-section {
  padding: 100px 5%;
  background: #e5e7eb;
}

.courses-section {
  background: #f3f4f6;
  /* Slight contrast for striped background effect */
}

/* Category Tabs */
.category-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 40px;
}

.tab-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #4b5563;
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #111827;
}

.tab-btn.active {
  background: rgba(0, 230, 118, 0.15);
  border-color: rgba(0, 230, 118, 0.4);
  color: #00e676;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease, filter 0.4s ease;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.project-card.hidden {
  display: none;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 109, 0, 0.2);
}

.project-image {
  height: 200px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.project-content {
  padding: 30px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ff6d00;
  background: rgba(255, 109, 0, 0.1);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.tag-red {
  color: #f44336;
  background: rgba(244, 67, 54, 0.15);
  border: 1px solid rgba(244, 67, 54, 0.4);
  animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
  50% {
    opacity: 0.5;
  }
}

.project-content h3 {
  font-size: 1.5rem;
  color: #111827;
  margin-bottom: 15px;
}

.project-content p {
  color: #4b5563;
  line-height: 1.6;
  font-size: 0.95rem;
  margin-bottom: 25px;
  flex-grow: 1;
}

.project-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ff6d00;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.project-btn:hover {
  color: #e65100;
}

.project-btn i {
  transition: transform 0.3s ease;
}

.project-btn:hover i {
  transform: translateX(5px);
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 5%;
  background: #d1d5db;
  color: #6b7280;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* -------------------------------------------
   Floating Chatbot UI Starts Here 
   ------------------------------------------- */

.chatbot-widget {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
}

/* Toggle Button */
.chatbot-toggle-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  border: none;
  box-shadow: 0 10px 25px rgba(255, 109, 0, 0.4);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-toggle-btn:hover {
  transform: scale(1.1);
}

.toggle-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.9;
}

.toggle-icon {
  font-size: 1.5rem;
  position: relative;
  z-index: 2;
  color: #111827;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pulse-ring {
  content: '';
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  border: 2px solid #ff6d00;
  animation: pulse 2s infinite;
  z-index: -1;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Modified Chat Container for Floating */
.chat-container {
  width: 380px;
  height: 550px;
  max-height: 80vh;
  margin-bottom: 20px;
  background: rgba(243, 244, 246, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.3s;
}

.chat-container.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  visibility: hidden;
  pointer-events: none;
}

.chat-header {
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  color: #111827;
  padding: 1rem 1.2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.chat-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  font-family: 'Outfit', sans-serif;
}

.status-indicator {
  font-size: 0.75rem;
  color: #e0f2f1;
  opacity: 0.9;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #111827;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.chat-log {
  flex-grow: 1;
  padding: 1.2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.4;
  font-size: 0.9rem;
  animation: fadeIn 0.3s ease-in-out;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  color: #111827;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.bot {
  background: rgba(255, 255, 255, 0.8);
  color: #111827;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.bot p {
  margin: 0 0 8px 0;
}

.message.bot p:last-child {
  margin: 0;
}

.message.bot pre {
  background: #0d0f12;
  color: #d4d4d4;
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.bot code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
  color: #00e676;
  font-family: monospace;
}

.message.bot pre code {
  background: transparent;
  color: inherit;
}

.message.bot strong {
  color: #69f0ae;
}

.chat-input {
  display: flex;
  padding: 1rem;
  background: rgba(229, 231, 235, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  gap: 10px;
}

#user-input {
  flex-grow: 1;
  padding: 10px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  font-size: 0.95rem;
  color: #111827;
  outline: none;
  transition: all 0.3s;
  background: rgba(255, 255, 255, 0.5);
}

#user-input::placeholder {
  color: #6b7280;
}

#user-input:focus {
  border-color: #ff6d00;
  background: rgba(255, 255, 255, 0.08);
}

#send-btn {
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  color: #111827;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

#send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #ff6d00;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-log::-webkit-scrollbar {
  width: 6px;
}

.chat-log::-webkit-scrollbar-thumb {
  background: rgba(255, 109, 0, 0.4);
  border-radius: 3px;
}

/* Downloads Section */
.downloads-section {
  padding: 100px 5%;
  background: #f3f4f6;
}

.download-card {
  display: flex;
  align-items: center;
  padding: 30px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  gap: 20px;
}

.download-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 109, 0, 0.2);
}

.download-icon {
  font-size: 2.5rem;
  color: #ff6d00;
  background: rgba(255, 109, 0, 0.1);
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.download-info {
  flex-grow: 1;
}

.download-info h3 {
  font-size: 1.3rem;
  color: #111827;
  margin-bottom: 5px;
}

.download-info p {
  color: #4b5563;
  font-size: 0.95rem;
}

.download-btn {
  font-size: 1.5rem;
  color: #707070;
  transition: color 0.3s ease, transform 0.3s ease;
  padding: 10px;
}

.download-card:hover .download-btn {
  color: #ff6d00;
  transform: scale(1.1);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  max-width: 400px;
  width: 90%;
  padding: 40px;
  border-radius: 24px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  background: rgba(229, 231, 235, 0.85);
  /* Ensure it is visually solid even with glassmorphism */
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #4b5563;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover {
  color: #111827;
}

.modal-header {
  text-align: center;
  margin-bottom: 30px;
}

.modal-header h2 {
  font-size: 1.8rem;
  color: #111827;
  margin-bottom: 10px;
}

.modal-header p {
  color: #4b5563;
  font-size: 0.95rem;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #ff6d00;
}

.input-group input {
  width: 100%;
  padding: 15px 15px 15px 45px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  color: #111827;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.input-group input:focus {
  outline: none;
  border-color: #ff6d00;
}

/* Footer & Sponsors Section */
.site-footer {
  background: rgba(229, 231, 235, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 3rem 5%;
  text-align: center;
  /* THE GAP FIX: this used to be a hard 5rem, which left an 80px dead band
     between the hero/last section and the footer where the fixed #cg-techbg
     canvas showed straight through. Now 0 by default and driven by
     --ss-footer-gap so SSRobotics Studio's layout pane can still open it up. */
  margin-top: var(--ss-footer-gap, 0px);
  position: relative;
  z-index: 10;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.sponsor-title {
  font-size: 1.1rem;
  color: #ff6d00;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 30px;
  font-weight: 600;
}

.sponsors-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 50px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.sponsor-logo {
  height: 90px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.sponsor-logo:hover {
  transform: translateY(-5px) scale(1.05);
  filter: drop-shadow(0 8px 16px rgba(255, 109, 0, 0.3));
}

.copyright {
  color: #707070;
  font-size: 0.9rem;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Responsiveness */
@media (max-width: 1024px) {
  .hero-title {
    font-size: 4rem;
  }

  .hero-subtitle {
    font-size: 1.5rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    padding: 1rem;
    gap: 10px;
    background: rgba(229, 231, 235, 0.95);
  }

  .nav-links {
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-actions {
    margin-left: 0;
    margin-top: 10px;
  }

  .hero-title {
    font-size: 3rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }

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

  .hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .secondary-btn {
    margin-left: 0;
    text-align: center;
  }

  .primary-btn {
    text-align: center;
  }

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

  .about-section,
  .projects-section,
  .courses-section,
  .downloads-section,
  .stats-section {
    padding: 60px 5%;
  }

  .chat-container {
    width: 90vw;
    right: 5vw;
    bottom: 90px;
    height: 60vh;
  }

  .sponsor-logo {
    height: 60px;
  }

  .sponsors-list {
    gap: 20px;
  }

  .profile-card {
    padding: 30px 20px;
  }

  .profile-name {
    font-size: 1.8rem;
  }

  .project-image#cad-viewer {
    height: 250px;
  }
}

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

  .stat-number {
    font-size: 2.5rem;
  }

  .modal-container {
    padding: 20px;
  }

  .chatbot-toggle-btn {
    width: 55px;
    height: 55px;
  }

  .nav-links {
    display: none;
    /* Hide standard links to avoid clutter on very small screens, keeping them in 768px */
  }

  .navbar {
    flex-direction: row;
    /* Put logo and actions side by side on very small screens */
    justify-content: space-between;
  }

  .nav-actions {
    margin-top: 0;
  }

  .nav-login-btn span {
    display: none;
    /* Hide text, icon only */
  }
}

/* Auth Input Group Modifications */
.input-group {
  position: relative;
  margin-bottom: 15px;
}

.input-group i:not(.toggle-password) {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #4b5563;
}

.input-group input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  /* Left padding for icon, Right padding for eye */
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  color: #111827;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

.input-group input:focus {
  border-color: #ff6d00;
}

/* Password Toggle Icon */
.input-group i.toggle-password {
  position: absolute;
  left: auto;
  /* Reset any left positioning */
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #4b5563;
  transition: color 0.3s;
  z-index: 10;
  pointer-events: auto;
}

.input-group i.toggle-password:hover {
  color: #ff6d00;
}

/* Custom Notification Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(243, 244, 246, 0.95);
  border-left: 4px solid #4CAF50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 15px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: #111827;
  font-family: 'Outfit', sans-serif;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateX(0);
}

.toast.error {
  border-left-color: #f44336;
}

.toast-icon {
  font-size: 1.5rem;
}

.toast-success-icon {
  color: #4CAF50;
}

.toast-error-icon {
  color: #f44336;
}

.toast-content h4 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
}

.toast-content p {
  margin: 0;
  font-size: 0.9rem;
  color: #4b5563;
}

/* --- DARK MODE OVERRIDES & NEW UI GIMMICKS --- */
:root {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

[data-theme="dark"] {
  background-color: #0f172a;
  color: #f8fafc;
}

[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .hero-overlay {
  background: rgba(15, 23, 42, 0.3);
}

[data-theme="dark"] .nav-links a {
  color: #cbd5e1;
}

[data-theme="dark"] .logo-text, [data-theme="dark"] .section-title, [data-theme="dark"] .profile-name, [data-theme="dark"] .stat-number, [data-theme="dark"] .project-content h3 {
  color: #f8fafc;
}

[data-theme="dark"] .hero-title {
  color: #ffffff;
  background: linear-gradient(90deg, #ffd700, #ff6d00);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .profile-bio, [data-theme="dark"] .project-content p, [data-theme="dark"] .stat-label {
  color: #cbd5e1;
}

[data-theme="dark"] .hero-text {
  color: #ffffff;
  font-weight: 500;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .about-section, [data-theme="dark"] .projects-section, [data-theme="dark"] .courses-section, [data-theme="dark"] .downloads-section {
  background-color: #1e293b;
}

[data-theme="dark"] .glass {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] footer {
  background: #0f172a;
  color: #cbd5e1;
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .nav-login-btn, [data-theme="dark"] .lang-toggle-btn {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .secondary-btn {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

/* Mouse-tracking Glow on Project Cards */
.project-card {
  position: relative;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  padding: 2px; /* border thickness */
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255, 109, 0, 0.6),
    transparent 40%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

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

/* Preloader */
#preloader {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999999;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-logo {
  max-width: 150px;
  margin-bottom: 20px;
  animation: pulseLogo 2s infinite alternate;
}

@keyframes pulseLogo {
  0% { transform: scale(0.9); filter: drop-shadow(0 0 10px rgba(255, 109, 0, 0.2)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 30px rgba(255, 109, 0, 0.8)); }
}

.loader-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.loader-progress::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 50%; height: 100%;
  background: #ff6d00;
  animation: loadingBar 1.5s infinite ease-in-out;
}

@keyframes loadingBar {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* Scroll Progress */
#scroll-progress {
  position: fixed;
  top: 0; left: 0; width: 0%; height: 3px;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  z-index: 999999;
  box-shadow: 0 0 10px rgba(255, 109, 0, 0.5);
}

/* Hologram Overlay */
.hologram-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 2px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
}

[data-theme='dark'] .hologram-overlay {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 2px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.4;
}

/* Hide default scrollbar */
::-webkit-scrollbar {
  display: none;
}
html {
  scrollbar-width: none;
}

/* --- COMPREHENSIVE DARK MODE FIXES (MODALS, CHAT, CARDS, INPUTS) --- */
[data-theme="dark"] .modal-container {
  background: #1e293b;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}
[data-theme="dark"] .modal-header h2 {
  color: #f8fafc;
}
[data-theme="dark"] .modal-header p {
  color: #cbd5e1;
}
[data-theme="dark"] .close-modal {
  color: #cbd5e1;
}
[data-theme="dark"] .close-modal:hover {
  color: #f8fafc;
}
[data-theme="dark"] .input-group input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}
[data-theme="dark"] .input-group i.toggle-password {
  color: #94a3b8;
}
[data-theme="dark"] .input-group i.toggle-password:hover {
  color: #ff6d00;
}

/* Chatbot */
[data-theme="dark"] .chat-container {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .message.bot {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}
[data-theme="dark"] .chat-input {
  background: rgba(15, 23, 42, 0.95);
  border-top-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] #user-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}
[data-theme="dark"] #user-input::placeholder {
  color: #94a3b8;
}
[data-theme="dark"] .input-group input:focus,
[data-theme="dark"] #user-input:focus {
  border-color: #ff6d00;
  background: rgba(255, 255, 255, 0.08);
}

/* Tags & Buttons */
[data-theme="dark"] .tech-tag,
[data-theme="dark"] .social-icon,
[data-theme="dark"] .tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
[data-theme="dark"] .tech-tag:hover,
[data-theme="dark"] .social-icon:hover,
[data-theme="dark"] .tab-btn:hover {
  background: rgba(255, 109, 0, 0.15);
  border-color: rgba(255, 109, 0, 0.4);
  color: #ffd700;
}
[data-theme="dark"] .tab-btn.active {
  background: rgba(0, 230, 118, 0.15);
  border-color: rgba(0, 230, 118, 0.4);
  color: #69f0ae;
}

/* Download Section */
[data-theme="dark"] .download-info h3 {
  color: #f8fafc;
}
[data-theme="dark"] .download-info p {
  color: #cbd5e1;
}
[data-theme="dark"] .download-btn {
  color: #cbd5e1;
}
[data-theme="dark"] .download-card:hover .download-btn {
  color: #ff6d00;
}

/* --- 10 PROFESSIONAL UX FEATURES CSS --- */
/* 3. Command Palette */
#command-palette-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 15vh; z-index: 9999999;
  opacity: 1; visibility: visible; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#command-palette-overlay.cmd-hidden {
  opacity: 0; visibility: hidden; transform: translateY(-30px);
}
.cmd-palette {
  width: 90%; max-width: 650px; background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow: hidden;
}
[data-theme="light"] .cmd-palette {
  background: rgba(255, 255, 255, 0.95); border-color: rgba(0, 0, 0, 0.1);
}
.cmd-input-container {
  display: flex; align-items: center; padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="light"] .cmd-input-container { border-bottom-color: rgba(0, 0, 0, 0.1); }
.cmd-input-container i { color: #ff6d00; font-size: 1.3rem; margin-right: 16px; }
#cmd-input {
  width: 100%; background: transparent; border: none; color: #f8fafc;
  font-size: 1.2rem; outline: none; font-family: inherit;
}
[data-theme="light"] #cmd-input { color: #111827; }
.cmd-results { padding: 12px 0; }
.cmd-item {
  padding: 14px 24px; color: #cbd5e1; cursor: pointer;
  display: flex; align-items: center; gap: 16px; transition: all 0.2s; font-size: 1.05rem;
}
[data-theme="light"] .cmd-item { color: #4b5563; }
.cmd-item i { width: 24px; text-align: center; font-size: 1.2rem; }
.cmd-item:hover { background: rgba(255, 109, 0, 0.15); color: #ff6d00; padding-left: 32px; }

/* 5. HUD Metrics */
#hud-metrics {
  position: fixed; top: 100px; right: 25px; z-index: 90000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.hud-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 8px 14px; border-radius: 8px; border: 1px solid rgba(0, 230, 118, 0.3);
  width: 160px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.hud-label { color: #00e676; font-size: 0.75rem; font-family: monospace; font-weight: bold; letter-spacing: 1px; }
.hud-val { color: #fff; font-size: 0.95rem; font-family: monospace; font-weight: 600; text-shadow: 0 0 5px rgba(0, 230, 118, 0.5); }
[data-theme="light"] .hud-item { background: rgba(255, 255, 255, 0.8); border-color: rgba(255, 109, 0, 0.3); }
[data-theme="light"] .hud-label { color: #ff6d00; }
[data-theme="light"] .hud-val { color: #111827; text-shadow: none; }

/* 6. Ripple Effect */
.btn, .icon-btn, .primary-btn, .secondary-btn { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.5);
  transform: scale(0); animation: rippleAnim 0.6s linear; pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* 7. Scroll Reveal */
.reveal-node { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal-node.active { opacity: 1; transform: translateY(0); }

/* 8. Cursor Glow Pro */
.cursor-glow-pro {
  position: fixed; top: 0; left: 0; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,109,0,0.15) 0%, transparent 60%);
  border-radius: 50%; pointer-events: none; z-index: 99999;
  transition: opacity 0.3s; will-change: transform;
}

/* 10. Custom Context Menu */
#custom-ctx-menu {
  position: fixed; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
  padding: 8px 0; width: 240px; z-index: 2000000; box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  transform-origin: top left; transition: opacity 0.2s, transform 0.2s; overflow: hidden;
}
[data-theme="light"] #custom-ctx-menu { background: rgba(255, 255, 255, 0.9); border-color: rgba(0, 0, 0, 0.1); }
#custom-ctx-menu.ctx-hidden { opacity: 0; visibility: hidden; transform: scale(0.95); }
.ctx-title { padding: 8px 16px 4px; font-size: 0.7rem; color: #ff6d00; font-weight: bold; font-family: monospace; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 4px; }
.ctx-item {
  padding: 12px 16px; color: #e2e8f0; font-size: 0.95rem; cursor: pointer;
  display: flex; align-items: center; gap: 12px; transition: background 0.2s, padding-left 0.2s;
}
[data-theme="light"] .ctx-item { color: #111827; }
.ctx-item i { font-size: 1.1rem; width: 20px; text-align: center; }
.ctx-item:hover { background: rgba(255, 109, 0, 0.2); color: #ffd700; padding-left: 22px; }
[data-theme="light"] .ctx-item:hover { color: #ff6d00; }

/* --- QA FIXES --- */
[data-theme="light"] .highlight, [data-theme="light"] .hero-badge { color: #d95c00; font-weight: 700; }
[data-theme="light"] .primary-btn { background: #d95c00; border-color: #d95c00; }
[data-theme="light"] .primary-btn:hover { background: #b34a00; border-color: #b34a00; }
body.custom-cursor-active * { cursor: none ; }

/* --- 6 ULTIMATE CYBERNETIC & 3 HYPER-ADVANCED FEATURES CSS --- */
/* 1&2. Advanced Physics Cursor */
.cyber-cursor {
  position: fixed; top: 0; left: 0; width: 6px; height: 6px; background: #ff6d00;
  border-radius: 50%; pointer-events: none; z-index: 9999999;
  transform: translate(-50%, -50%); transition: width 0.2s, height 0.2s; mix-blend-mode: difference;
}
.cyber-follower {
  position: fixed; top: 0; left: 0; width: 34px; height: 34px; border: 1px solid rgba(255, 109, 0, 0.7);
  border-radius: 50%; pointer-events: none; z-index: 9999998;
  transform: translate(-50%, -50%); transition: width 0.3s, height 0.3s, background 0.3s, border-width 0.3s;
}
.cyber-follower.hovering {
  width: 60px; height: 60px; background: rgba(255,109,0,0.1); border-color: #ffd700;
}

/* 3. CRT Glitch Effect */
.hero-title { animation: glitch-anim 8s infinite; }
@keyframes glitch-anim {
  0% { text-shadow: none; }
  92% { text-shadow: none; transform: skew(0deg); }
  93% { text-shadow: -3px 0 rgba(255,0,0,0.8), 3px 0 rgba(0,255,255,0.8); transform: skew(-8deg); }
  94% { text-shadow: 3px 0 rgba(255,0,0,0.8), -3px 0 rgba(0,255,255,0.8); transform: skew(8deg); }
  95% { text-shadow: none; transform: skew(0deg); }
  100% { text-shadow: none; }
}

/* 4. Booting Terminal */
#boot-terminal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: #050a0f; z-index: 10000000; display: flex; flex-direction: column;
  justify-content: center; align-items: center; transition: opacity 0.3s;
}
#boot-terminal.boot-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-text { color: #00ff00; font-family: monospace; font-size: 1.2rem; line-height: 1.8; max-width: 600px; width: 80%; }
.boot-text .success { color: #ff6d00; margin-top: 20px; font-size: 1.5rem; text-shadow: 0 0 10px rgba(255,109,0,0.8); }

/* 5. Flashlight Zone */
[data-theme="dark"] .flashlight-zone {
  --flash-x: 50%; --flash-y: 50%;
  position: relative;
  mask-image: radial-gradient(circle 350px at var(--flash-x) var(--flash-y), black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle 350px at var(--flash-x) var(--flash-y), black 20%, transparent 100%);
}
[data-theme="light"] .flashlight-zone { mask-image: none; -webkit-mask-image: none; }

/* 6. Tech Marquee */
.tech-marquee-container {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 35px;
  background: rgba(15, 23, 42, 0.85); display: flex; align-items: center; overflow: hidden; border-top: 1px solid rgba(255, 109, 0, 0.3); z-index: 10;
}
.tech-marquee-content {
  display: flex; white-space: nowrap; animation: marquee-scroll 25s linear infinite;
  color: #ff6d00; font-family: monospace; font-size: 0.85rem; font-weight: bold; letter-spacing: 2px;
}
.tech-marquee-content span { padding: 0 40px; }
@keyframes marquee-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ============================================================
   ✨ PREMIUM FEATURES — Particle, Trail, FAB, Tech Stack, Mobile
   ============================================================ */

/* --- MuJoCo Stream: hide broken image icon --- */
#mujoco-stream {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  object-fit: cover;
  z-index: -2;
  background-color: transparent;
  transition: opacity 0.6s ease;
}
#mujoco-stream.stream-offline {
  opacity: 0 ;
  pointer-events: none;
}

/* --- Animated Fallback Background Canvas --- */
#bg-fallback-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
#bg-fallback-canvas.visible { opacity: 1; }

/* --- Particle Canvas --- */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -3;
  pointer-events: none;
  opacity: 0.55;
}
[data-theme="light"] #particle-canvas { opacity: 0.2; }

/* --- Cursor Trail --- */
.cursor-trail-dot {
  position: fixed;
  width: 7px; height: 7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999996;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

/* --- Hero Stats Row --- */
.hero-stats {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.hero-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 22px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  min-width: 100px;
  transition: all 0.3s ease;
}
.hero-stat-item:hover {
  border-color: rgba(255, 109, 0, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(255, 109, 0, 0.2);
}
.hero-stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Space Grotesk', sans-serif;
}
.hero-stat-label {
  font-size: 0.72rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
  text-align: center;
}

/* --- Tech Stack Section --- */
.tech-stack-section {
  padding: 100px 5%;
  background-color: var(--bg-color);
  position: relative;
  overflow: hidden;
}
.tech-stack-section .section-title { color: var(--text-color); }
.tech-stack-intro {
  text-align: center;
  color: #9ca3af;
  max-width: 600px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
  line-height: 1.7;
}
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center;
}
.tech-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-radius: 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  cursor: default;
  transition: all 0.3s ease;
  min-width: 95px;
  animation: float-badge 4s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.tech-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,109,0,0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.tech-badge:hover::before { opacity: 1; }
.tech-badge:hover {
  transform: translateY(-10px) scale(1.08);
  border-color: rgba(255, 109, 0, 0.6);
  box-shadow: 0 16px 40px rgba(255, 109, 0, 0.25);
}
.tech-badge img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.tech-badge span { font-size: 0.78rem; font-weight: 700; color: var(--text-color); letter-spacing: 0.5px; text-align: center; }
@keyframes float-badge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.tech-badge:nth-child(2n) { animation-delay: 0.4s; }
.tech-badge:nth-child(3n) { animation-delay: 0.8s; }
.tech-badge:nth-child(4n) { animation-delay: 1.2s; }
.tech-badge:nth-child(5n) { animation-delay: 1.6s; }
.tech-badge:nth-child(6n) { animation-delay: 0.2s; }

.tech-stack-category {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ff6d00;
  margin: 1.5rem 0 0.5rem;
  padding: 6px 0;
  border-top: 1px solid rgba(255,109,0,0.2);
}

/* --- Mobile Hamburger Nav --- */
.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.hamburger:hover { background: rgba(255,109,0,0.1); }
.hamburger span {
  width: 22px; height: 2px;
  background: var(--text-color);
  display: block; border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh; width: 280px;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--glass-border);
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
  z-index: 100000;
  padding: 90px 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer a {
  padding: 14px 18px; border-radius: 12px;
  color: var(--text-color); text-decoration: none;
  font-weight: 600; font-size: 1rem;
  display: flex; align-items: center; gap: 14px;
  transition: all 0.2s;
}
.mobile-drawer a i { width: 20px; text-align: center; color: #ff6d00; }
.mobile-drawer a:hover { background: rgba(255,109,0,0.12); color: #ff6d00; transform: translateX(6px); }
.mobile-drawer-close {
  position: absolute; top: 20px; right: 20px;
  background: rgba(255,109,0,0.1); border: 1px solid rgba(255,109,0,0.3);
  color: #ff6d00; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; transition: all 0.2s;
}
.mobile-drawer-close:hover { background: rgba(255,109,0,0.25); transform: rotate(90deg); }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99999; opacity: 0; pointer-events: none;
  transition: opacity 0.38s;
  backdrop-filter: blur(2px);
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }

/* --- FAB: Back to Top --- */
#fab-container {
  position: fixed;
  bottom: 110px; right: 28px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
#back-to-top {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, #ff6d00, #ffd700);
  border: none; color: #111827; font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 109, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(20px) scale(0.8);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
#back-to-top.visible { opacity: 1; transform: translateY(0) scale(1); }
#back-to-top:hover { transform: translateY(-5px) scale(1.1); box-shadow: 0 10px 30px rgba(255,109,0,0.6); }
#back-to-top::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(255,109,0,0.4);
  animation: fab-pulse 2s ease-out infinite;
}
@keyframes fab-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* --- Enhanced Preloader --- */
#preloader {
  position: fixed; inset: 0;
  background: #050a0f;
  z-index: 99999999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#preloader.hidden { opacity: 0; visibility: hidden; }
.loader-logo { width: 90px; height: auto; animation: logo-pulse 1.5s ease-in-out infinite alternate; }
@keyframes logo-pulse {
  0% { transform: scale(0.95); filter: drop-shadow(0 0 8px rgba(255,109,0,0.4)); }
  100% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(255,109,0,0.9)); }
}
.loader-bar-track {
  width: 240px; height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff6d00, #ffd700);
  border-radius: 99px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(255,109,0,0.6);
}
.loader-pct {
  font-family: 'Space Grotesk', monospace;
  font-size: 0.85rem;
  color: #ff6d00;
  letter-spacing: 3px;
}
.loader-label {
  font-family: monospace;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* --- Enhanced Tilt on All Cards --- */
.tilt-card {
  transform-style: preserve-3d;
}
.tilt-card .project-content { transform: translateZ(10px); }

/* --- Robot Showcase Row Separator --- */
.section-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1rem 0 3rem;
  width: 100%;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,109,0,0.3), transparent);
}
.section-divider span {
  font-size: 0.75rem; letter-spacing: 3px; color: #ff6d00;
  text-transform: uppercase; white-space: nowrap;
  font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .nav-links { display: none; }
}
@media (max-width: 600px) {
  .hero-stats { gap: 0.6rem; }
  .hero-stat-item { padding: 10px 14px; min-width: 80px; }
  .hero-stat-number { font-size: 1.4rem; }
  .tech-grid { gap: 0.8rem; }
  .tech-badge { min-width: 80px; padding: 16px 12px; }
  #fab-container { bottom: 80px; right: 18px; }
}

/* 7. Quake Dev Console */
#dev-console {
  position: fixed; top: 0; left: 0; width: 100vw; height: 35vh; background: rgba(5,10,15,0.95);
  z-index: 99999999; border-bottom: 2px solid #ff6d00; font-family: monospace; padding: 20px;
  box-sizing: border-box; display: flex; flex-direction: column; transition: transform 0.2s cubic-bezier(0.1, 0.8, 0.1, 1);
  opacity: 1; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#dev-console.dev-console-hidden { transform: translateY(-100%); }
#dev-console-log {
  flex: 1; overflow-y: auto; color: #00ff00; font-size: 0.95rem; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.dev-input-line { display: flex; align-items: center; color: #ff6d00; font-size: 1.1rem; }
.dev-input-line span { margin-right: 12px; font-weight: bold; }
#dev-input { flex: 1; background: transparent; border: none; color: #fff; font-family: monospace; font-size: 1.1rem; outline: none; }

/* --- 6 ULTIMATE CYBERNETIC FEATURES CSS --- */
/* 1&2. Advanced Physics Cursor */
.cyber-cursor {
  position: fixed; top: 0; left: 0; width: 6px; height: 6px; background: #ff6d00;
  border-radius: 50%; pointer-events: none; z-index: 9999999;
  transform: translate(-50%, -50%); transition: width 0.2s, height 0.2s; mix-blend-mode: difference;
}
.cyber-follower {
  position: fixed; top: 0; left: 0; width: 34px; height: 34px; border: 1px solid rgba(255, 109, 0, 0.7);
  border-radius: 50%; pointer-events: none; z-index: 9999998;
  transform: translate(-50%, -50%); transition: width 0.3s, height 0.3s, background 0.3s, border-width 0.3s;
}
.cyber-follower.hovering {
  width: 60px; height: 60px; background: rgba(255,109,0,0.1); border-color: #ffd700;
}

/* 3. CRT Glitch Effect */
.hero-title { animation: glitch-anim 8s infinite; }
@keyframes glitch-anim {
  0% { text-shadow: none; }
  92% { text-shadow: none; transform: skew(0deg); }
  93% { text-shadow: -3px 0 rgba(255,0,0,0.8), 3px 0 rgba(0,255,255,0.8); transform: skew(-8deg); }
  94% { text-shadow: 3px 0 rgba(255,0,0,0.8), -3px 0 rgba(0,255,255,0.8); transform: skew(8deg); }
  95% { text-shadow: none; transform: skew(0deg); }
  100% { text-shadow: none; }
}

/* 4. Booting Terminal */
#boot-terminal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: #050a0f; z-index: 10000000; display: flex; flex-direction: column;
  justify-content: center; align-items: center; transition: opacity 0.3s;
}
#boot-terminal.boot-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-text { color: #00ff00; font-family: monospace; font-size: 1.2rem; line-height: 1.8; max-width: 600px; width: 80%; }
.boot-text .success { color: #ff6d00; margin-top: 20px; font-size: 1.5rem; text-shadow: 0 0 10px rgba(255,109,0,0.8); }

/* 5. Flashlight Zone */
[data-theme="dark"] .flashlight-zone {
  --flash-x: 50%; --flash-y: 50%;
  position: relative;
  mask-image: radial-gradient(circle 350px at var(--flash-x) var(--flash-y), black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle 350px at var(--flash-x) var(--flash-y), black 20%, transparent 100%);
}
[data-theme="light"] .flashlight-zone {
  mask-image: none; -webkit-mask-image: none;
}

/* 6. Tech Marquee */
.tech-marquee-container {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 35px;
  background: rgba(15, 23, 42, 0.85); display: flex; align-items: center; overflow: hidden;
  border-top: 1px solid rgba(255, 109, 0, 0.3); z-index: 10;
}
.tech-marquee-content {
  display: flex; white-space: nowrap; animation: marquee-scroll 25s linear infinite;
  color: #ff6d00; font-family: monospace; font-size: 0.85rem; font-weight: bold; letter-spacing: 2px;
}
.tech-marquee-content span { padding: 0 40px; }
@keyframes marquee-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }


/* ══ Scroll Progress Bar ══════════════════════════════════════════ */
#scroll-progress-bar{position:fixed;top:0;left:0;width:0%;height:3px;
  background:linear-gradient(90deg,#00e676,#1de9b6,#00bcd4);
  z-index:9999;transition:width .1s linear;border-radius:0 2px 2px 0;
  box-shadow:0 0 8px rgba(0,230,118,.6);}

/* ══ Mobile: 100dvh prevents keyboard overlap ═════════════════════ */
@media(max-width:900px){
  .chat-container,#chat-container,.chatbot-panel{
    height:100dvh;min-height:-webkit-fill-available;}
}

/* ══ Tech Stack responsive grid ═══════════════════════════════════ */
.tech-grid{grid-template-columns:repeat(auto-fill,minmax(90px,1fr));}

/* ══ Dark/Light mode smooth transition ════════════════════════════ */
body,body *{transition:background-color .3s ease,color .2s ease,border-color .2s ease;}
canvas,video,img,#scroll-progress-bar,#particle-canvas,#bg-fallback-canvas{
  transition:none;}

/* ══ 404 / empty section placeholder ═════════════════════════════ */
.spa-section:empty::after{content:'Section not found';
  display:flex;align-items:center;justify-content:center;
  height:60vh;font-size:1.5rem;color:var(--text-muted,#666);opacity:.5;}

/* SPA display rules — see SPA LAYOUT FIX block below */

/* Canvas positioning — see fix.css */

/* ═══════════════════════════════════════════════════
   ทุก SECTION — padding สม่ำเสมอ ไม่ทับ navbar
   ═══════════════════════════════════════════════════ */
.spa-section.spa-active {
    padding-top: 80px ;
    padding-bottom: 80px ;
    padding-left: 5% ;
    padding-right: 5% ;
    min-height: 100vh;
    box-sizing: border-box;
}
#home.spa-section.spa-active {
    padding-top: 72px ;
    padding-left: 0 ;
    padding-right: 0 ;
}

/* ═══════════════════════════════════════════════════
   CARDS — uniform grid ทุก section
   ═══════════════════════════════════════════════════ */
.section-content,
.projects-grid,
.courses-grid,
.knowledge-grid,
.cards-container,
[class*="grid"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
/* .book-card is excluded: this catch-all forces a dark navy plate, amber border
   and 1.5rem padding with , which fought the light theme and pushed a
   24px frame around a book cover that is meant to sit flush to the card edge. */
.card,
[class*="card"]:not(.book-card) {
    background: rgba(10,10,30,0.8) ;
    border: 1px solid rgba(245,166,35,0.2) ;
    border-radius: 16px ;
    padding: 1.5rem ;
    display: flex ;
    flex-direction: column ;
    gap: 0.75rem ;
    transition: transform 0.25s, border-color 0.25s ;
    overflow: hidden;
}
.card:hover { transform: translateY(-4px) ; border-color: rgba(245,166,35,0.6) ; }
.card img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; }
.card h3, .card h4 { font-size: 1rem; font-weight: 700; color: #e8eaf0; margin: 0; }
.card p { font-size: 0.85rem; color: #8899aa; line-height: 1.65; margin: 0; flex: 1; }
.card a { color: #f5a623; font-size: 0.82rem; font-weight: 600; text-decoration: none; margin-top: auto; }

/* ═══════════════════════════════════════════════════
   SECTION HEADERS — clean ทุก section
   ═══════════════════════════════════════════════════ */
.spa-section > h1:first-child,
.spa-section > h2:first-child,
.spa-section .section-title,
.spa-section .page-title {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 800;
    color: #e8eaf0;
    text-align: center;
    margin: 0 0 0.5rem;
}
.spa-section .section-subtitle,
.spa-section > p:first-of-type {
    text-align: center;
    color: #8899aa;
    max-width: 560px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════
   SPA LAYOUT FIX — injected automatically
   ═══════════════════════════════════════════════════════════════ */

/* 1. ซ่อนทุก section โดย default */
.spa-section {
    display: none ;
}
.spa-section.spa-active {
    display: block ;
    animation: spaFadeIn 0.35s ease forwards;
}
#home.spa-section.spa-active {
    display: flex ;
    flex-direction: column;
    justify-content: center;
}
@keyframes spaFadeIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 2. Canvas + hero positioning — overridden by fix.css */

/* 3. Padding สม่ำเสมอทุก section ไม่ทับ navbar */
.spa-section.spa-active:not(#home) {
    padding: 90px 6% 80px ;
    min-height: 100vh;
    box-sizing: border-box;
    background: #07071a;
}

/* 4. Section headers */
.spa-section h1,
.spa-section h2,
.section-title,
.page-title {
    font-size: clamp(1.9rem, 3.5vw, 2.8rem) ;
    font-weight: 800 ;
    color: #e8eaf0 ;
    text-align: center;
    margin: 0 0 0.6rem ;
    line-height: 1.2;
}
.section-subtitle,
.section-description {
    text-align: center;
    color: #8899aa;
    font-size: 1rem;
    max-width: 580px;
    margin: 0 auto 2.5rem ;
    line-height: 1.75;
}
.section-divider, .accent-line, .title-line {
    width: 56px; height: 3px;
    background: linear-gradient(90deg, #f5a623, #00e676);
    border-radius: 2px;
    margin: 0.4rem auto 2.5rem;
    display: block;
}

/* 5. Card grid — uniform ทุกหน้า */
.projects-grid,
.courses-grid,
.knowledge-grid,
.cards-grid,
.repo-cards,
.course-cards,
.project-cards,
/* .cg-footer-grid and .books-grid are excluded for the same reason .tech-grid is:
   this catch-all forces every "*-grid" class into 290px card columns with
   , which silently overrode the footer's own template (so a footer
   column added from SSRobotics Studio wrapped onto a second row) and stretched
   portrait book covers to card width. */
[class*="-grid"]:not(.tech-grid):not(.hud-grid-top):not(.cg-footer-grid):not(.books-grid) {
    display: grid ;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)) ;
    gap: 1.5rem ;
    margin-top: 1.5rem;
}

/* 6. Cards — clean glassmorphism */
.card,
.project-card,
.course-card,
.knowledge-card,
.repo-card,
.github-card,
.download-card {
    background: rgba(8,8,28,0.85) ;
    border: 1px solid rgba(245,166,35,0.2) ;
    border-radius: 16px ;
    padding: 1.4rem ;
    display: flex ;
    flex-direction: column ;
    gap: 0.75rem ;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease ;
    overflow: hidden;
    position: relative;
}
.card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #f5a623, transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.card:hover {
    transform: translateY(-5px) ;
    border-color: rgba(245,166,35,0.55) ;
    box-shadow: 0 8px 32px rgba(245,166,35,0.15) ;
}
.card:hover::after { opacity: 1; }

.card img,
.card-thumbnail,
.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
.card h3, .card h4, .card-title {
    font-size: 1rem ;
    font-weight: 700 ;
    color: #e8eaf0 ;
    margin: 0 ;
    line-height: 1.4;
}
.card p, .card-desc, .card-description {
    font-size: 0.84rem ;
    color: #8899aa ;
    line-height: 1.65 ;
    margin: 0 ;
    flex: 1;
}
.card a, .card-link, .card-cta {
    display: inline-flex ;
    align-items: center ;
    gap: 5px ;
    font-size: 0.82rem ;
    font-weight: 600 ;
    color: #f5a623 ;
    text-decoration: none ;
    padding: 6px 14px ;
    border: 1px solid rgba(245,166,35,0.3) ;
    border-radius: 8px ;
    align-self: flex-start ;
    margin-top: auto ;
    transition: background 0.2s, border-color 0.2s ;
}
.card a:hover { background: rgba(245,166,35,0.1) ; border-color: #f5a623 ; }

/* 7. Tab buttons (Knowledge Hub) */
.tab-btns,
.knowledge-tabs,
.filter-tabs {
    display: flex ;
    gap: 0.5rem ;
    flex-wrap: wrap ;
    margin-bottom: 2rem ;
    border-bottom: 1px solid rgba(245,166,35,0.15) ;
    padding-bottom: 0.75rem ;
}
.tab-btn {
    padding: 7px 18px ;
    background: transparent ;
    border: 1px solid transparent ;
    border-radius: 8px 8px 0 0 ;
    color: #8899aa ;
    font-size: 0.88rem ;
    font-weight: 600 ;
    cursor: pointer ;
    transition: color 0.2s, background 0.2s, border-color 0.2s ;
}
.tab-btn.active,
.tab-btn:hover {
    color: #f5a623 ;
    background: rgba(245,166,35,0.07) ;
    border-color: rgba(245,166,35,0.25) ;
}

/* 8. Tech Stack badges */
.tech-grid {
    display: flex ;
    flex-wrap: wrap ;
    gap: 0.75rem ;
    margin-top: 1rem ;
}
.tech-badge {
    display: inline-flex ;
    align-items: center ;
    gap: 7px ;
    padding: 8px 16px ;
    background: rgba(255,255,255,0.04) ;
    border: 1px solid rgba(245,166,35,0.2) ;
    border-radius: 10px ;
    font-size: 0.83rem ;
    font-weight: 600 ;
    color: #e8eaf0 ;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s, transform 0.2s ;
}
.tech-badge:hover {
    border-color: #f5a623 ;
    background: rgba(245,166,35,0.08) ;
    transform: translateY(-2px) ;
}
.tech-category-title {
    font-size: 0.78rem ;
    text-transform: uppercase ;
    letter-spacing: 0.1em ;
    color: #f5a623 ;
    margin: 1.5rem 0 0.75rem ;
    font-weight: 700 ;
}

/* 9. Hero section layout */
#home .hero-content {
    max-width: 620px;
    padding: 2rem 5%;
}
#home h1, .hero-title {
    font-size: clamp(2.6rem, 5.5vw, 4.4rem) ;
    font-weight: 800 ;
    color: #f5a623 ;
    line-height: 1.1 ;
    margin: 0 0 0.6rem ;
}
#home h2, .hero-subtitle, .typed-container {
    font-size: clamp(1rem, 2.2vw, 1.4rem) ;
    color: #00e676 ;
    font-weight: 500 ;
    margin: 0 0 1.2rem ;
}
#home p, .hero-desc {
    font-size: 1rem ;
    color: #8899aa ;
    line-height: 1.75 ;
    max-width: 500px;
    margin: 0 0 2rem ;
}
.hero-buttons {
    display: flex ;
    gap: 1rem ;
    flex-wrap: wrap ;
    margin-bottom: 2.5rem ;
}
.hero-stats {
    display: flex ;
    gap: 0.75rem ;
    flex-wrap: wrap ;
}
.hero-stat-item {
    background: rgba(255,255,255,0.05) ;
    border: 1px solid rgba(245,166,35,0.2) ;
    border-radius: 14px ;
    padding: 12px 18px ;
    min-width: 100px ;
    text-align: center ;
    backdrop-filter: blur(6px);
    transition: transform 0.2s, border-color 0.2s ;
}
.hero-stat-item:hover { transform: translateY(-3px) ; border-color: #f5a623 ; }
.hero-stat-number {
    display: block ;
    font-size: 1.75rem ;
    font-weight: 800 ;
    color: #f5a623 ;
    line-height: 1 ;
}
.hero-stat-label {
    font-size: 0.7rem ;
    color: #8899aa ;
    text-transform: uppercase ;
    letter-spacing: 0.07em ;
}

/* 10. Downloads */
.download-grid,
.downloads-container {
    display: grid ;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) ;
    gap: 1.5rem ;
}

/* 11. Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #05050f; }
::-webkit-scrollbar-thumb { background: #f5a623; border-radius: 3px; }

/* 12. Focus visible */
:focus-visible {
    outline: 2px solid #00e676 ;
    outline-offset: 3px ;
    border-radius: 4px;
}

/* 13. Scroll progress bar */
#scroll-progress-bar {
    position: fixed ; top: 0 ; left: 0 ;
    width: 0%; height: 3px;
    background: linear-gradient(90deg, #f5a623, #00e676) ;
    z-index: 10001 ; transition: width 0.1s linear ;
    pointer-events: none ;
}

/* 14. Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms ;
        transition-duration: 0.01ms ;
    }
    #particle-canvas, .cursor-trail-dot { display: none ; }
}

/* 15. Mobile */
@media (max-width: 900px) {
    .spa-section.spa-active:not(#home) { padding: 85px 4% 60px ; }
    #hud-dashboard, .hud-dashboard-panel { display: none ; }
    .hero-stat-item { min-width: 85px ; padding: 10px 12px ; }
    .hero-stat-number { font-size: 1.4rem ; }
}


/* === patch100 === */
:focus-visible {
    outline: 2.5px solid #00e676 ;
    outline-offset: 3px ;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms ;
        transition-duration: .01ms ;
    }
    #particle-canvas, .cursor-trail-dot { display: none ; }
}

#scroll-progress-bar {
    position: fixed; top: 0; left: 0; width: 0%; height: 3px;
    background: linear-gradient(90deg, #f5a623, #00e676);
    z-index: 10001; transition: width .1s linear; pointer-events: none;
    box-shadow: 0 0 10px rgba(245,166,35,.6);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a1a; }
::-webkit-scrollbar-thumb { background: #00e676; border-radius: 3px; }

/* Dynamic SPA Routing Styles */
.spa-section { display: none; opacity: 0; transform: translateY(30px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.spa-section.spa-active { display: block; }
.spa-section.spa-visible { opacity: 1; transform: translateY(0); }
section#home.spa-active { display: flex; }

/* =========================================
   ADVANCED HUD DASHBOARD
   ========================================= */

.hud-dashboard-panel {
    position: fixed;
    top: 90px;
    right: 30px;
    width: 250px;
    background: rgba(10, 15, 25, 0.7) ;
    backdrop-filter: blur(12px) ;
    border: 1px solid rgba(0, 230, 118, 0.3) ;
    border-radius: 4px ;
    padding: 12px ;
    z-index: 990;
    pointer-events: none; /* Crucial to not block clicks */
    font-family: 'Courier New', Courier, monospace ;
    color: #a0aec0 ;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 15px rgba(0, 230, 118, 0.05) ;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hud-header {
    font-size: 0.75rem;
    font-weight: bold;
    color: #00e676;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(0, 230, 118, 0.2);
    padding-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.hud-blink { animation: hudBlink 1s infinite alternate; color: #ff3366; }
@keyframes hudBlink { from { opacity: 1; } to { opacity: 0.1; } }

.hud-grid-top { display: flex; justify-content: space-between; }
.hud-grid-top .hud-pill { display: flex; flex-direction: column; }
.hud-lbl { font-size: 0.7rem; opacity: 0.7; }
.hud-val { font-size: 1rem; font-weight: bold; color: #fff; }
.hud-val.mini { font-size: 0.8rem; width: 35px; text-align: right; }

.hud-canvas-container {
    position: relative;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 2px;
    padding: 4px;
}

.hud-canvas-labels {
    position: absolute;
    top: 4px; left: 6px;
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    font-weight: bold;
}

#hudGraph { display: block; width: 100%; height: 50px; }

.hud-bars { display: flex; flex-direction: column; gap: 6px; }
.hud-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.75rem; }
.hud-bar-bg { flex-grow: 1; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.hud-bar-fill { height: 100%; background: #00e676; width: 0%; transition: width 0.3s ease; }

.hud-logger {
    height: 48px;
    font-size: 0.65rem;
    color: #64748b;
    overflow: hidden;
    line-height: 1.4;
    border-top: 1px dashed rgba(255,255,255,0.1);
    padding-top: 6px;
}
.hud-logger div { animation: logIn 0.2s ease-out forwards; }
@keyframes logIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================
   PRECISION CROSSHAIR CURSOR
   ========================================= */
.custom-cursor { width: 6px ; height: 6px ; background-color: #00e676 ; box-shadow: 0 0 8px #00e676 ; border-radius: 50% ; z-index: 9999; pointer-events: none; }
.custom-cursor-glow { display: none ; }

/* =========================================
   IDENTITY MATRIX (ABOUT SECTION REDESIGN)
   ========================================= */
.matrix-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.matrix-header { text-align: center; margin-bottom: 20px; }

.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 25px;
}

/* BIOMETRIC ID CARD */
.matrix-bio-card {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
    padding: 30px 50px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 40px;
    text-align: left;
    border: 1px solid rgba(0, 230, 118, 0.3) ;
    background: linear-gradient(135deg, rgba(15,20,30,0.8) 0%, rgba(5,10,15,0.9) 100%) ;
    position: relative;
    overflow: hidden;
}

.bio-hud-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.bio-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 10;
    box-shadow: 0 0 30px rgba(0, 230, 118, 0.4);
    border: 2px solid #00e676;
}

/* Rotating HUD Rings */
.hud-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(0, 230, 118, 0.5);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.ring-1 { width: 150px; height: 150px; border: 2px solid rgba(0, 230, 118, 0.2); border-top: 2px solid #00e676; animation: spin 8s linear infinite; }
.ring-2 { width: 165px; height: 165px; border-style: dotted; animation: spin 15s linear infinite reverse; opacity: 0.7;}
.ring-3 { width: 180px; height: 180px; border-left: 2px solid #ffd700; border-right: 2px solid #ffd700; animation: spin 10s ease-in-out infinite alternate; opacity: 0.5; }

@keyframes spin { 100% { transform: translate(-50%, -50%) rotate(360deg); } }

.bio-info { flex-grow: 1; }

.bio-name { font-size: 1.5rem; color: #fff; margin: 10px 0 5px; font-weight: 700; }
.bio-role { font-size: 1rem; color: #ffd700; margin-bottom: 15px; font-family: monospace; }
.bio-desc { font-size: 0.9rem; color: #a0aec0; line-height: 1.6; margin-bottom: 20px; }

.sys-badge {
    position: absolute; top: 15px; right: 25px;
    font-size: 0.7rem; font-family: monospace; color: #00e676;
    background: rgba(0,230,118,0.1); padding: 4px 8px; border-radius: 4px;
    border: 1px solid rgba(0,230,118,0.3); display: flex; align-items: center; gap: 6px;
}
.led-blink { width: 6px; height: 6px; background: #00e676; border-radius: 50%; animation: hudBlink 1s infinite alternate; box-shadow: 0 0 5px #00e676; }

.bio-socials { display: flex; gap: 15px; justify-content: flex-start; }
.social-hex {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: center; align-items: center;
    color: #fff; font-size: 1.2rem; transition: 0.3s;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.social-hex:hover { background: rgba(0, 230, 118, 0.2); border-color: #00e676; color: #00e676; transform: scale(1.1); }

/* SKILL BARS */
.matrix-skills-card {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    padding: 30px;
    border: 1px solid rgba(0, 230, 118, 0.2) ;
}

.matrix-card-title {
    font-size: 1.1rem; color: #fff; margin-bottom: 25px;
    border-left: 4px solid #00e676; padding-left: 10px;
    font-family: 'Courier New', Courier, monospace; letter-spacing: 1px;
}

.skill-bars { display: flex; flex-direction: column; gap: 20px; }
.skill-item { display: flex; flex-direction: column; gap: 8px; }
.skill-label { display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 600; color: #e2e8f0; }
.skill-percent { color: #00e676; font-family: monospace; }
.skill-track { width: 100%; height: 12px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.skill-fill {
    height: 100%; width: 0%;
    background: repeating-linear-gradient(45deg, #00e676, #00e676 10px, #00b35c 10px, #00b35c 20px);
    box-shadow: 0 0 10px rgba(0,230,118,0.5);
    animation: fillSkill 1.5s ease-out forwards 0.5s;
}
@keyframes fillSkill { to { width: var(--w); } }

/* TELEMETRY / STATS */
.matrix-telemetry-card {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    padding: 30px;
    border: 1px solid rgba(255, 215, 0, 0.2) ;
}
.telemetry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tel-item {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); padding: 20px;
    border-radius: 4px; text-align: center; transition: 0.3s;
}
.tel-item:hover { background: rgba(255,215,0,0.05); border-color: rgba(255,215,0,0.3); transform: translateY(-5px); }
.tel-item i { font-size: 1.8rem; color: #ffd700; margin-bottom: 10px; }
.tel-item h4 { font-size: 2rem; color: #fff; margin: 5px 0; font-family: monospace; }
.tel-item p { font-size: 0.85rem; color: #a0aec0; text-transform: uppercase; letter-spacing: 1px; }

@media (max-width: 900px) {
    .matrix-grid { grid-template-columns: 1fr; }
    .matrix-bio-card { grid-column: 1 / 2; grid-row: auto; }
    .matrix-skills-card, .matrix-telemetry-card { grid-column: 1 / 2; }
}

}
