/* =========================================================
   GLOBAL VARIABLES
========================================================= */
:root {
  --bg: linear-gradient(135deg, #f7f3ff 0%, #ffffff 50%);
  --card: rgba(255, 255, 255, 0.75);
  --glass: rgba(255, 255, 255, 0.5);
  --accent-1: #ff6b6b;
  --accent-2: #ffd166;
  --accent-3: #6be5ff;
  --text: #121212;
  --muted: #444;
  --nav-height: 72px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 17, 17, 0.08);
  --transition: 300ms cubic-bezier(.2, .9, .3, 1);
}

/* ========== DARK THEME ========== */
:root[data-theme='dark'] {
  --bg: linear-gradient(180deg, #05060a 0%, #071020 60%);
  --card: rgba(10, 12, 18, 0.6);
  --glass: rgba(255, 255, 255, 0.03);
  --accent-1: #00f5ff;
  --accent-2: #7c5cff;
  --accent-3: #00ff9f;
  --text: #e9f0ff;
  --muted: #9aa6bf;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* =========================================================
   BASE STYLES
========================================================= */
* { box-sizing: border-box; }
html, body {
  height: auto;           /* Fix scrolling */
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;      /* Prevent horizontal scroll */
  overflow-y: auto;        /* Allow vertical scroll */
  cursor: none;            /* Hide default cursor */
}

/* =========================================================
   NAVBAR — Glass Blur, Sticky
========================================================= */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 50;
  transition: background var(--transition);
}

header .controls {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  flex-shrink: 0;
  min-width: fit-content;
}
:root[data-theme='dark'] header {
  background: rgba(10, 12, 18, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex; 
  align-items: center; 
  gap: 12px;
  text-decoration: none; 
  color: inherit;
  font-weight: 700; 
  font-size: 1.05rem;
  flex-shrink: 1;
  min-width: 0;
}

.logo {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; color: white;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.logo:hover { transform: translateY(-4px) rotate(-6deg); }

nav {
  display: flex; gap: 10px; align-items: center;
}
nav a {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  transition: color var(--transition), transform var(--transition);
}
nav a:hover { color: var(--text); transform: translateY(-3px); }
nav a.active { color: var(--accent-1); }

/* Toggle + Controls */
.controls { 
  display: flex; 
  gap: 12px; 
  align-items: center; 
  justify-content: flex-end;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: var(--glass);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--transition);
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.theme-toggle:hover {
  background: var(--card);
}

.theme-toggle > div:first-child:not(.dot) {
  display: none;
}

.theme-toggle .dot {
  width: 32px; 
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #042;
  font-size: 0.8rem;
  transition: all 0.3s cubic-bezier(.2, .9, .3, 1);
  flex-shrink: 0;
}
:root[data-theme='dark'] .theme-toggle .dot {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  color: #001;
}

/* =========================================================
   HERO SECTION
========================================================= */
main { padding-top: calc(var(--nav-height) + 28px); position: relative; z-index: 2; }

.hero {
  min-height: calc(100vh - var(--nav-height));
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 40px;
  align-items: center;
  padding: 64px;
  position: relative;
  z-index: 3;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 18px 0;
  line-height: 1.02;
}

p.lead {
  margin: 0 0 24px 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.cta {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  color: #07102a;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 30px rgba(99, 99, 99, 0.08);
}

/* =========================================================
   CARD
========================================================= */
.card {
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  position: relative;
  z-index: 3;
}
:root[data-theme='dark'] .card {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* =========================================================
   BLOBS — Full Page Animated Background
========================================================= */
.blobs {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: -1;  /* behind everything */
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  filter: blur(60px);
  opacity: 0.8;
  transform: translate3d(0,0,0);
  transition: background 0.3s ease;
}

/* Grid overlay */
.grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(transparent 96%, rgba(155, 89, 182, 0.08) 96%),
    linear-gradient(90deg, transparent 96%, rgba(255,107,107, 0.08) 96%);
  background-size: 100% 60px, 60px 100%;
  mix-blend-mode: overlay;
  z-index: 1;
}
:root[data-theme='dark'] .grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;

  background-image:
    linear-gradient(transparent 96%, rgba(190, 250, 164, 0.06) 96%), /* horizontal */
    linear-gradient(90deg, transparent 96%, rgba(255, 255, 255, 0.06) 96%); /* vertical */

  background-size: 100% 60px, 60px 100%; /* restore spacing */
  mix-blend-mode: overlay; /* subtle on dark background */
  z-index: 1;
}



/* =========================================================
   PROJECTS GRID
========================================================= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  margin-top: 18px;
  position: relative;
  z-index: 3;
}

.project {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.35));
  padding: 18px;
  border-radius: 12px;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
:root[data-theme='dark'] .project {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}
.project:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(10, 10, 10, 0.15);
}

/* =========================================================
   FOOTER
========================================================= */
footer {
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  position: relative;
  z-index: 2;
}

/* =========================================================
   ANIMATIONS + UTILITIES
========================================================= */
.fade-in {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.fade-in.show { opacity: 1; transform: none; }

/* =========================================================
   HERO PAINT SPLASH + IMAGE
========================================================= */
.hero-right {
  position: relative;
  justify-self: center;
  align-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
  overflow: visible;
}

.paint-splash {
  position: absolute;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle at 20% 30%, #00FFFF, #B497FF);
  border-radius: 35% 65% 25% 70% / 60% 30% 55% 40%;
  transform: rotate(-20deg);
  filter: blur(12px) brightness(1.1) hue-rotate(0deg);
  opacity: 0.9;
  z-index: 1;
  animation: splashMorph 12s ease-in-out infinite, hueShift 30s linear infinite;
}

@keyframes splashMorph {
  0%   { border-radius: 30% 70% 25% 65% / 50% 30% 55% 40%; transform: rotate(-25deg) scale(1); }
  25%  { border-radius: 65% 35% 70% 40% / 35% 55% 40% 85%; transform: rotate(-15deg) scale(1.05); }
  50%  { border-radius: 80% 60% 45% 30% / 65% 35% 10% 55%; transform: rotate(-5deg) scale(1.03); }
  75%  { border-radius: 50% 80% 30% 70% / 40% 60% 45% 35%; transform: rotate(-20deg) scale(1.02); }
  100% { border-radius: 30% 70% 25% 65% / 50% 30% 55% 40%; transform: rotate(-25deg) scale(1); }
}
@keyframes hueShift {
  0%   { filter: blur(12px) brightness(1.1) hue-rotate(0deg); }
  100% { filter: blur(12px) brightness(1.1) hue-rotate(360deg); }
}

.hero-right img {
   width: 220px;
   height: 220px;
   border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
   object-fit: cover;
   box-shadow: var(--shadow);
   z-index: 2;
   transition: transform 0.3s ease;
}

.hero-right img:hover { transform: scale(1.05) rotate(-2deg); }

/* =========================================================
   RESPONSIVE
========================================================= */

/* Mobile Menu Styles */
.hamburger { 
  display: none; 
  align-items: center;
  justify-content: center;
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.5rem;
  background: var(--glass);
  border-radius: 8px;
  transition: all var(--transition);
  z-index: 100;
  position: relative;
  border: none;
  outline: none;
  flex-shrink: 0;
}

.hamburger:hover {
  background: var(--card);
  transform: scale(1.05);
}

.hamburger.active {
  background: var(--accent-1);
  color: white;
}

/* Mobile Navigation Overlay */
nav.mobile-open {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  min-height: calc(100vh - var(--nav-height));
  height: calc(100vh - var(--nav-height));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  background: rgba(255, 255, 255, 0.7);
  display: flex !important;
  flex-direction: column;
  gap: 16px;
  padding: 40px 24px;
  z-index: 99;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  animation: slideDown 0.3s ease-out;
  opacity: 1;
  visibility: visible;
  overflow-y: auto;
  transition: background var(--transition);
}

/* Frosted glass effect for dark theme */
:root[data-theme='dark'] nav.mobile-open {
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  background: rgba(10, 12, 18, 0.75);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure nav is completely hidden when not mobile-open on mobile */
@media (max-width: 700px) {
  nav:not(.mobile-open) {
    display: none !important;
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

nav.mobile-open a {
  padding: 16px 20px;
  border-radius: 20px;
  font-size: 1.1rem;
  text-align: center;
  background: transparent;
  transition: all var(--transition);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border: none;
  position: relative;
}

nav.mobile-open a:hover {
  color: var(--accent-1);
}

nav.mobile-open a.clicked {
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  background-size: 200% 200%;
  animation: slowGradientShift 6s ease infinite;
  color: white;
  border-radius: 24px;
}

@keyframes slowGradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Tablet and below */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 48px 36px;
    gap: 32px;
    min-height: auto;
  }

  /* For hero with left/right layout (about, contact, projects, skills) */
  .hero .left {
    width: 100%;
  }

  .hero aside.card {
    width: 100%;
    margin-top: 0;
  }

  .hero-right {
    order: -1;
    margin-bottom: 24px;
  }

  .hero-right img {
    width: 180px;
    height: 180px;
  }

  .paint-splash {
    width: 240px;
    height: 240px;
  }

  h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
  }

  p.lead {
    font-size: 1rem;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }

  section {
    padding: 32px 36px !important;
  }
}

/* Mobile devices */
@media (max-width: 700px) {
  /* Header adjustments */
  header {
    padding: 0 16px;
    height: 64px;
    min-width: 0;
  }

  :root {
    --nav-height: 64px;
  }

  .brand {
    font-size: 0.9rem;
    flex-shrink: 1;
    min-width: 0;
    max-width: calc(100% - 120px); /* Leave space for controls */
  }

  .brand > div > div:first-child {
    font-size: 0.85rem !important;
  }

  .brand > div > div:last-child {
    font-size: 0.7rem !important;
  }

  .logo {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  nav:not(.mobile-open) { 
    display: none !important;
    opacity: 0;
    visibility: hidden;
  }

  .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .controls {
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    min-width: fit-content;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    padding: 4px;
  }

  .theme-toggle .dot {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  /* Hero section */
  .hero {
    padding: 32px 20px;
    gap: 24px;
  }

  .hero-right {
    margin-bottom: 20px;
  }

  .hero-right img {
    width: 150px;
    height: 150px;
  }

  .paint-splash {
    width: 200px;
    height: 200px;
  }

  h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin-bottom: 14px;
  }

  p.lead {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  .cta {
    padding: 10px 16px;
    font-size: 0.95rem;
    width: 100%;
    justify-content: center;
  }

  /* Main content */
  main {
    padding-top: calc(var(--nav-height) + 16px);
  }

  section {
    padding: 24px 20px !important;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  /* Cards */
  .card {
    padding: 20px;
    margin-top: 24px;
  }

  /* Project grid */
  .project-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
  }

  .project-card {
    padding: 18px;
  }

  /* Skill grid */
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 24px;
  }

  .skill-bubble {
    padding: 20px 16px;
    font-size: 0.9rem;
    gap: 10px;
  }

  .skill-icon {
    font-size: 1.6rem;
  }

  .skill-name {
    font-size: 0.85rem;
  }

  .skill-category {
    margin-bottom: 36px;
  }

  .skill-category h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }

  /* Contact form */
  .contact-form {
    margin-top: 24px;
    gap: 16px;
  }

  .contact-form input,
  .contact-form textarea {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .send-btn {
    width: 100%;
    padding: 14px 20px;
  }

  /* Footer */
  footer {
    padding: 32px 20px;
    font-size: 0.9rem;
  }

  /* Skill bars */
  .skill-bar {
    margin-bottom: 16px;
  }

  /* About page layout */
  .hero .left {
    width: 100%;
  }

  .hero aside.card {
    margin-top: 24px;
    width: 100%;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  header {
    padding: 0 12px;
  }

  .brand > div {
    max-width: 100px; /* Limit brand text width on very small screens */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand {
    min-width: auto;
    gap: 8px;
  }

  .hero {
    padding: 24px 16px;
  }

  .hero-right img {
    width: 120px;
    height: 120px;
  }

  .paint-splash {
    width: 160px;
    height: 160px;
  }

  h1 {
    font-size: 1.4rem;
  }

  section {
    padding: 20px 16px !important;
  }

  .card {
    padding: 16px;
  }

  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .skill-bubble {
    padding: 16px 12px;
    font-size: 0.85rem;
    gap: 8px;
  }

  .skill-icon {
    font-size: 1.4rem;
  }

  .skill-name {
    font-size: 0.8rem;
  }

  .skill-category {
    margin-bottom: 32px;
  }

  .skill-category h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }
}

/* Hero left/right layout (for about, contact, projects, skills pages) */
.hero .left + aside.card {
  margin-top: 32px;
}

@media (max-width: 900px) {
  .hero .left + aside.card {
    margin-top: 24px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Show cursor on touch devices */
  body {
    cursor: auto !important;
  }

  /* Increase touch targets */
  nav a,
  .cta,
  .send-btn,
  .project-card,
  .skill-bubble {
    min-height: 44px;
  }

  /* Reduce hover effects on touch */
  .project:hover,
  .project-card:hover,
  .skill-bubble:hover {
    transform: none;
  }

  /* Better tap feedback */
  nav a:active,
  .cta:active,
  .send-btn:active {
    transform: scale(0.98);
  }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 32px 36px;
  }

  .hero-right {
    order: 0;
  }
}

/* ================= BURST PARTICLES ================= */
.burst-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 1;
}

.burst-particle {
  position: absolute;
  width: 30px;
  height: 20px;
  border-radius: 50%;
  opacity: 0.95;
  transform: translate(-50%, -50%) scale(0);
  filter: blur(3px);
  animation: burstAnim 1s forwards;
}

@keyframes burstAnim {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0.9; }
  100% { transform: translate(var(--x), var(--y)) scale(1); opacity: 0; }
}

/* Particle colours */
.burst-particle:nth-child(1) { background: #00ffff; }
.burst-particle:nth-child(2) { background: #b399ff; }
.burst-particle:nth-child(3) { background: #ffdab9; }
.burst-particle:nth-child(4) { background: #98ff98; }
.burst-particle:nth-child(5) { background: #cfff00; }
.burst-particle:nth-child(6) { background: #fff44f; }
.burst-particle:nth-child(7) { background: #ff9a00; }
.burst-particle:nth-child(8) { background: #aa00ff; }

/* =========================================================
   CUSTOM CURSOR + SPLASH
========================================================= */
body {
  cursor: none;         /* hide default cursor */
  overflow-x: hidden;   /* prevent horizontal scroll */
  overflow-y: auto;     /* allow vertical scroll */
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cursor-splash {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Each particle */
.splash-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(4px);
  opacity: 0.9;
  transform: scale(0);
  animation: splashFade 0.8s ease-out forwards;
}

@keyframes splashFade {
  0% { transform: scale(0.5); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

/* =========================================================
   BUTTON STYLES WITH ANIMATED GRADIENTS
========================================================= */
.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  color: #07102a;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(99, 99, 99, 0.08);
}

.send-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.send-icon {
  display: inline-block;
  animation: floatSend 2s ease-in-out infinite alternate;
}

@keyframes floatSend {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

