/* ========================================
   SECTION 1: CLEANED UP - Removed duplicate CSS blocks
   ======================================== */

/* ========== Global Variables ========== */
:root {
  --text-dark: #1A1A1A;
  --text-muted: #2A2A2A;
  --text-light: #F5F5F5;
  --bg-primary: #56B4E9;
  --bg-accent: #009E73;
  --bg-neutral: #F5F5F5;
  --bg-highlight: #CC79A7;
  --bg-beige: #FFF8E1;
  --text-accent: #007C91;
  --bg-cta: #E0F7FA;
  --bg-login: #F0F4F8;
}

/* SECTION 6: Better organized transition rules */
/* ========== Smooth Theme Transitions ========== */
body, html,
#navMenu a,
label,
button,
input,
textarea {
  transition: color 0.5s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* ========== Base Layout ========== */
body, html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  font-family: sans-serif;
  background-color: var(--bg-neutral);
  color: var(--text-dark);
}

/* SECTION 1: Consolidated dark mode variables */
body.dark {
  --text-dark: #F5F5F5;
  --text-muted: #CCCCCC;
  --text-light: #1A1A1A;
  --text-accent: #FFB000;
  --bg-cta: #004D40;
  --bg-login-dark: #1E2A33;
  background-color: #111;
  color: var(--text-light);
}

/* SECTION 2: Skip to content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* SECTION 3: Improved responsive text sizing */
section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

/* ========== Sticky Navbar ========== */
.navbar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #333;
  padding: 1rem;
  z-index: 1000;
  color: var(--text-light);
}

.logo {
  justify-self: start;
  display: flex;
  align-items: center;
}

.site-logo,
.logo img {
  height: 40px;
  width: auto;
  display: block;
}

/* SECTION 3: Mobile logo optimization */
@media (max-width: 768px) {
  .site-logo,
  .logo img {
    height: 34px;
  }
}

/* ========== Hamburger Menu ========== */
#hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem; /* SECTION 3: Better touch target */
}

.hamline {
  width: 100%;
  height: 2px;
  background: white;
  margin: 3px 0;
}

/* SECTION 2: Focus indicators for accessibility */
#hamburger:focus,
button:focus,
a:focus,
input:focus,
textarea:focus,
.scene:focus {
  outline: 3px solid #FFB000;
  outline-offset: 2px;
}

/* ========== Nav Menu ========== */
#navMenu {
  justify-self: end;
  display: flex;
  gap: 1rem;
}

#navMenu a {
  color: var(--text-accent);
  text-decoration: none;
  padding: 0.5rem; /* SECTION 2: Better click area */
}

/* SECTION 3: Mobile navigation improvements */
@media (max-width: 768px) {
  #navMenu {
    display: none;
    flex-direction: column;
    background: #444;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    min-width: 200px;
  }
  
  #navMenu.active {
    display: flex;
  }
  
  #hamburger {
    display: flex;
  }
  
  #navMenu a {
    padding: 1rem; /* SECTION 3: Better mobile touch targets */
    text-align: center;
  }
}

/* SECTION 1: Consolidated dark mode styles */
body.dark .bg-section {
  background-color: #1a1a1a;
}

body.dark a,
body.dark #navMenu a {
  color: var(--text-light);
}

body.dark footer {
  background: #000;
  color: #ccc;
}

/* ========== Dark Mode Toggle ========== */
#darkModeToggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  margin-left: 1rem;
  padding: 0.5rem; /* SECTION 2: Better touch target */
}

#darkModeToggle:hover {
  color: #ccc;
}

#darkModeToggle svg {
  width: 24px;
  height: 24px;
  transition: transform 0.5s ease, color 0.3s ease;
  color: #fff;
}

#darkModeToggle.rotate svg {
  transform: rotate(180deg);
}

/* SECTION 6: Keyframe organization */
@keyframes glowPulse {
  0% {
    box-shadow: 0 0 0px rgba(255, 176, 0, 0.6);
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 176, 0, 0.9);
  }
  100% {
    box-shadow: 0 0 0px rgba(255, 176, 0, 0.6);
  }
}

#darkModeToggle.glow {
  animation: glowPulse 1s ease-out;
}

/* ========== Hero Section Background ========== */
#hero.bg-section {
  background: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)),
              url('images/lucidorigin.jpg') center/cover no-repeat;
  background-size: cover;
  background-position: center;
  color: #fff;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

/* SECTION 3: Responsive hero heading */
#hero h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* ========== Section Backgrounds ========== */
#skills.bg-section {
  background-color: var(--bg-beige);
  color: var(--text-dark);
  flex-direction: column;
  padding: 3rem 1rem;
}

#experience.bg-section {
  background-color: var(--bg-accent);
  color: #fff;
}

#mission.bg-section {
  background: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.2)),
              url('images/mission-texture.svg') center/cover no-repeat,
              #007C91;
  color: #fff;
}

#contact.bg-section {
  background-color: var(--bg-cta);
  color: var(--text-dark);
  padding: 2rem;
  transition: background-color 0.3s ease;
}

#login.bg-section {
  background-color: var(--bg-login);
  color: var(--text-dark);
  padding: 2rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark #login.bg-section {
  background-color: var(--bg-login-dark);
  color: var(--text-light);
}

/* SECTION 1: Consolidated and fixed cube carousel */
/* ========== 3D Cube Carousel ========== */
.cube-carousel {
  display: flex;
  gap: 2rem;
  padding: 2rem 0;
  justify-content: center;
  flex-wrap: wrap; /* SECTION 3: Better mobile wrapping */
}

.scene {
  width: 100px;
  height: 100px;
  perspective: 800px;
  cursor: pointer;
}

.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: spinStable 8s linear infinite;
  transition: transform 0.3s ease;
}

.scene:hover .cube {
  transform: rotateX(20deg) rotateY(0deg);
}

.face {
  position: absolute;
  width: 100px;
  height: 100px;
  background-size: cover;
  background-position: center;
  border: 1px solid #111;
}

.front  { transform: rotateY(0deg) translateZ(50px); }
.back   { transform: rotateY(180deg) translateZ(50px); }
.right  { transform: rotateY(90deg) translateZ(50px); }
.left   { transform: rotateY(-90deg) translateZ(50px); }
.top    { transform: rotateX(90deg) translateZ(50px); }
.bottom { transform: rotateX(-90deg) translateZ(50px); }

/* SECTION 1: Fixed duplicate keyframe */
@keyframes spinStable {
  0%   { transform: rotateX(10deg) rotateY(0deg); }
  50%  { transform: rotateX(10deg) rotateY(180deg); }
  100% { transform: rotateX(10deg) rotateY(360deg); }
}

/* SECTION 3: Mobile cube sizing */
@media (max-width: 768px) {
  .cube-carousel {
    gap: 1rem;
  }
  
  .scene {
    width: 80px;
    height: 80px;
  }
  
  .cube {
    width: 80px;
    height: 80px;
  }
  
  .face {
    width: 80px;
    height: 80px;
  }
  
  .front  { transform: rotateY(0deg) translateZ(40px); }
  .back   { transform: rotateY(180deg) translateZ(40px); }
  .right  { transform: rotateY(90deg) translateZ(40px); }
  .left   { transform: rotateY(-90deg) translateZ(40px); }
  .top    { transform: rotateX(90deg) translateZ(40px); }
  .bottom { transform: rotateX(-90deg) translateZ(40px); }
}

/* SECTION 3: Extra small screens */
@media (max-width: 400px) {
  .scene {
    width: 60px;
    height: 60px;
  }
  
  .cube {
    width: 60px;
    height: 60px;
  }
  
  .face {
    width: 60px;
    height: 60px;
  }
  
  .front  { transform: rotateY(0deg) translateZ(30px); }
  .back   { transform: rotateY(180deg) translateZ(30px); }
  .right  { transform: rotateY(90deg) translateZ(30px); }
  .left   { transform: rotateY(-90deg) translateZ(30px); }
  .top    { transform: rotateX(90deg) translateZ(30px); }
  .bottom { transform: rotateX(-90deg) translateZ(30px); }
}

/* ========== Pulse Animation for Coming Soon ========== */
@keyframes pulseFade {
  0%   { opacity: 0.6; transform: scale(1); }
  50%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.6; transform: scale(1); }
}

.coming-soon {
  animation: pulseFade 2s ease-in-out infinite;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* SECTION 3: Improved contact form mobile styling */
/* ========== Contact Form ========== */
#contactForm {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

#contactForm label {
  display: block;
  margin: 10px 0 5px;
  font-weight: bold;
  color: var(--text-muted);
}

#contactForm input,
#contactForm textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}

/* SECTION 2: Better focus states */
#contactForm input:focus,
#contactForm textarea:focus {
  border-color: #007C91;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 124, 145, 0.1);
}

#contactForm button {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

#contactForm button:hover {
  background: #555;
}

/* SECTION 8: Form feedback messages */
.error-message {
  color: #d32f2f;
  font-size: 0.875rem;
  display: block;
  margin-top: -10px;
  margin-bottom: 10px;
}

#formMessage {
  max-width: 400px;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
  display: none;
}

#formMessage.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

#formMessage.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

/* SECTION 3: Mobile contact form adjustments */
@media (max-width: 768px) {
  #contactForm {
    max-width: 100%;
    padding: 0 1.5rem;
  }
}

/* SECTION 3: Improved login box mobile styling */
/* ========== Login Box ========== */
.login-box {
  max-width: 320px;
  margin: 50px auto;
  padding: 20px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #f9f9f9;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.login-box h2 {
  margin-bottom: 20px;
}

.login-box label {
  display: block;
  margin: 10px 0 5px;
  color: var(--text-muted);
  text-align: left;
}

.login-box input {
  width: 100%;
  padding: 8px;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.login-box button:hover {
  background: #555;
}

/* SECTION 3: Mobile login adjustments */
@media (max-width: 768px) {
  .login-box {
    margin: 20px;
    max-width: calc(100% - 40px);
  }
}

/* ========== Footer ========== */
footer {
  background: #222;
  color: var(--text-light);
  text-align: center;
  padding: 1rem;
}

/* SECTION 4: Optimized mouse circle - only runs when mouse moves */
/* ========== Mouse Circle ========== */
#mouseCircle {
  position: fixed;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #007C91;
  pointer-events: none;
  z-index: 9999;
  transition: background-color 0.2s ease, transform 0.1s ease;
  will-change: transform; /* SECTION 4: Performance optimization */
}

/* SECTION 3: Hide mouse circle on touch devices */
@media (hover: none) and (pointer: coarse) {
  #mouseCircle {
    display: none;
  }
}

/* ========== Mission Section ========== */
#mission.bg-section {
  background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), #007C91;
  color: #fff;
  flex-direction: column;
  padding: 4rem 2rem;
  text-align: center;
  height: auto;
  min-height: 100vh;
}

#mission h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 2rem;
  font-weight: bold;
  margin-top: 0;
}

.mission-content {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.8;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.mission-content p {
  margin-bottom: 1.5rem;
  text-align: left;
}

.mission-content p:last-child {
  margin-bottom: 0;
}

body.dark #mission.bg-section {
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), #004D40;
}

/* ========== Experience Section ========== */
#experience.bg-section {
  background-color: var(--bg-accent);
  color: #fff;
  flex-direction: column;
  padding: 4rem 2rem;
  min-height: 100vh;
  height: auto;
  align-items: center;
  justify-content: flex-start;
}

#experience h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 3rem;
  text-align: center;
  width: 100%;
  margin-top: 0;
}

.experience-item,
.education-section,
.differentiator {
  max-width: 1000px;
  margin: 0 auto 2.5rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 2rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.experience-item h3,
.education-section h3,
.differentiator h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.75rem;
  color: #fff;
  margin-top: 0;
}

.experience-meta {
  font-style: italic;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.experience-subtitle {
  font-weight: bold;
  color: #FFD700;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.experience-item ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 1rem 0;
  line-height: 1.8;
}

.experience-item li {
  margin-bottom: 0.75rem;
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
}

.key-competencies {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.key-competencies h4 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  color: #FFD700;
  margin-top: 0;
}

.key-competencies p {
  line-height: 1.8;
  font-size: 1rem;
  margin: 0;
}

.education-section h3 {
  margin-top: 0;
}

.education-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.education-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.education-item h4 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: #FFD700;
  margin-top: 0;
}

.education-item p {
  line-height: 1.6;
  font-size: 1rem;
  margin: 0.5rem 0;
}

.differentiator {
  background: rgba(255, 215, 0, 0.2);
  border: 2px solid #FFD700;
}

.differentiator h3 {
  margin-top: 0;
}

.differentiator p {
  line-height: 1.8;
  font-size: clamp(1rem, 2vw, 1.15rem);
  margin: 0;
}

body.dark #experience.bg-section {
  background-color: #1a3a2e;
}

body.dark .experience-item,
body.dark .education-section,
body.dark .differentiator {
  background: rgba(0, 0, 0, 0.4);
}

/* SECTION 3: Mobile Responsive for Experience and Mission */
@media (max-width: 768px) {
  #experience.bg-section,
  #mission.bg-section {
    padding: 3rem 1rem;
  }
  
