:root {
  --bg: #030303;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --accent-primary: #00f2fe;
  --accent-secondary: #4facfe;
  --accent-glow: rgba(79, 172, 254, 0.5);
  --font-main: 'Outfit', 'Noto Sans SC', sans-serif;
  --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);

  /* Scrollbar Vars */
  --sb-track: #0a0a12;
  --sb-thumb: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);

  /* Glitch Colors */
  --glitch-red: rgba(255, 0, 128, 0.8);
  --glitch-blue: rgba(0, 242, 254, 0.8);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--sb-track);
}

::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  border-radius: 10px;
}

/* 3D Tilt Perspective */
#projects-grid {
  perspective: 1000px;
}

/* Scroll Reveal Initial State */
.reveal-hidden {
  opacity: 0 !important;
  transform: translateY(30px) scale(0.95);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a,
button,
.social-btn,
.sector-path {
  user-select: auto;
  cursor: pointer;
}

#bg-canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #030303 100%);
}

#bg-aura {
  position: fixed;
  top: 0;
  left: 0;
  width: min(600px, 80vw);
  height: min(600px, 80vw);
  background: radial-gradient(circle, rgba(0, 242, 254, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease-out;
}

/* Cursor Follower Effect - Only for devices with hover support */
@media (hover: hover) {
  #cursor-follower {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: width 0.3s ease, height 0.3s ease, background 0.3s ease, border 0.3s ease;
    border: 0px solid var(--accent-primary);
  }

  #cursor-follower.active {
    width: 60px;
    height: 60px;
    background: rgba(0, 242, 254, 0.2);
    border: 2px solid var(--accent-primary);
  }

  body:active #cursor-follower {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
  }
}

/* Hide cursor follower on touch devices */
@media (hover: none) {
  #cursor-follower {
    display: none;
  }
}

.site-header {
  padding: clamp(60px, 10vw, 120px) 20px clamp(40px, 8vw, 80px);
  text-align: center;
  position: relative;
}

.gradient-text {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 800;
  background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary), #af40ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  letter-spacing: -2px;
  position: relative;
  display: inline-block;
}

/* Glitch Effect on Hover - Also limited to hoverable devices */
@media (hover: hover) {

  .gradient-text:hover::before,
  .gradient-text:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
  }

  .gradient-text:hover::before {
    left: 2px;
    text-shadow: -2px 0 var(--glitch-red);
    animation: glitch-anim-1 0.4s infinite linear alternate-reverse;
  }

  .gradient-text:hover::after {
    left: -2px;
    text-shadow: -2px 0 var(--glitch-blue);
    animation: glitch-anim-2 0.4s infinite linear alternate-reverse;
  }
}

@keyframes glitch-anim-1 {
  0% {
    clip-path: inset(20% 0 50% 0);
  }

  20% {
    clip-path: inset(80% 0 10% 0);
  }

  40% {
    clip-path: inset(40% 0 40% 0);
  }

  60% {
    clip-path: inset(10% 0 70% 0);
  }

  80% {
    clip-path: inset(90% 0 5% 0);
  }

  100% {
    clip-path: inset(30% 0 60% 0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip-path: inset(10% 0 80% 0);
  }

  20% {
    clip-path: inset(40% 0 30% 0);
  }

  40% {
    clip-path: inset(70% 0 10% 0);
  }

  60% {
    clip-path: inset(20% 0 50% 0);
  }

  80% {
    clip-path: inset(50% 0 40% 0);
  }

  100% {
    clip-path: inset(80% 0 20% 0);
  }
}

.site-header p {
  color: var(--text-secondary);
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: 300;
  max-width: 800px;
  margin: 0 auto;
}

/* Container & Grid */
.container {
  max-width: 1440px;
  width: 95%;
  margin: 0 auto;
  padding: 0 0 clamp(60px, 10vw, 100px);
}

.section-title {
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  margin-bottom: clamp(30px, 8vw, 50px);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(280px, 100%, 360px), 1fr));
  gap: clamp(20px, 4vw, 40px);
}

/* Card Styling - Glassmorphism */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.1s ease-out, box-shadow 0.4s ease, border-color 0.4s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 3D tilt effects only for desktop hover */
@media (hover: hover) {
  .card {
    transform-style: preserve-3d;
  }
}

/* Holographic Iridescent Layer */
.card-hologram {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(0, 242, 254, 0.08) 25%,
      rgba(175, 64, 255, 0.08) 50%,
      rgba(0, 242, 254, 0.08) 75%,
      rgba(255, 255, 255, 0) 100%);
  background-size: 200% 200%;
  mix-blend-mode: color-dodge;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card:hover .card-hologram {
  opacity: 1;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(79, 172, 254, 0.5);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-glow);
}

.card-img-container {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
  transform: translateZ(25px);
  transition: transform 0.1s ease-out;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.card:hover .card img {
  transform: scale(1.15);
}

.card-body {
  padding: clamp(20px, 5vw, 30px);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  transform: translateZ(45px);
  transition: transform 0.1s ease-out;
}

.card-title {
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-desc {
  color: var(--text-secondary);
  font-size: clamp(0.9rem, 3vw, 1rem);
  margin-bottom: 24px;
  flex-grow: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-primary);
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.card-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* Button Styling */
.btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 18px;
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:not(.secondary) {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #000;
}

.btn:not(.secondary):hover {
  filter: brightness(1.2);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}

.btn.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(30px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #0a0a0a;
  border: 1px solid var(--card-border);
  box-shadow: 0 0 100px rgba(0, 242, 254, 0.1);
  border-radius: clamp(20px, 5vw, 40px);
  max-width: 1000px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: #ff4d4d;
  transform: rotate(90deg);
}

.modal-caption {
  color: var(--text-secondary);
  background: #0a0a0a;
  border-top: 1px solid var(--card-border);
  padding: clamp(15px, 5vw, 30px);
  font-size: clamp(0.9rem, 3vw, 1rem);
}

/* Section Wave Divider */
.wave-divider {
  width: 100%;
  height: clamp(40px, 8vw, 100px);
  fill: #030303;
  margin-top: -1px;
  position: relative;
  z-index: 5;
}

/* Scanning Overlay */
#scanning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#scanning-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, transparent, var(--accent-primary), #af40ff, transparent);
  box-shadow: 0 0 25px var(--accent-primary);
  animation: scan-move 3s infinite ease-in-out;
}

@keyframes scan-move {
  0% {
    top: 0;
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  85% {
    opacity: 1;
  }

  100% {
    top: 100%;
    opacity: 0;
  }
}

#scan-text {
  font-family: 'Outfit', monospace;
  color: var(--accent-primary);
  font-size: clamp(0.9rem, 4.5vw, 1.5rem);
  font-weight: 300;
  letter-spacing: clamp(1px, 1.5vw, 8px);
  text-transform: uppercase;
  animation: scan-pulse 2s infinite;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}

@keyframes scan-pulse {

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

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

@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-30px) rotate(5deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }

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

/* Specific layout adjustments for very small screens */
@media (max-width: 480px) {
  .site-header {
    padding: 60px 15px 40px;
  }

  .card-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    min-width: unset;
  }
}

/* --- Premium Physics System Styles --- */
#physics-system-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

#physics-ball-wrapper {
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: auto;
  cursor: grab;
  z-index: 10001;
  touch-action: none;
  filter: drop-shadow(0 0 15px var(--accent-glow));
}

#physics-ball-wrapper:active {
  cursor: grabbing;
}

.premium-ball {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(0, 242, 254, 0.5);
  border-radius: 50%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 30px rgba(0, 242, 254, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: ball-pulse 2s infinite ease-in-out;
}

@keyframes ball-pulse {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
    border-color: rgba(0, 242, 254, 0.5);
  }

  50% {
    box-shadow: 0 0 40px rgba(0, 242, 254, 0.6);
    border-color: var(--accent-primary);
  }
}

.ball-label {
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff, var(--accent-primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
  z-index: 2;
}

.ball-waves {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  border: 1px solid var(--accent-primary);
  opacity: 0;
  animation: ball-wave-anim 2s infinite;
}

@keyframes ball-wave-anim {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

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

/* Radial Menu Overlay */
.radial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
}

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

.radial-menu-box {
  position: relative;
  width: min(90vh, 90vw);
  height: min(90vh, 90vw);
  max-width: 800px;
  max-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8) rotate(-20deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-overlay.active .radial-menu-box {
  transform: scale(1) rotate(0);
}

#radial-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

.sector-path {
  fill: rgba(255, 255, 255, 0.03);
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 2;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sector-path:hover {
  fill: rgba(0, 242, 254, 0.15);
  stroke: var(--accent-primary);
  filter: drop-shadow(0 0 15px var(--accent-glow));
}

.sector-label-group {
  pointer-events: none;
}

.sector-text {
  fill: #fff;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 24px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.sector-icon {
  pointer-events: none;
}

.radial-center-ball {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px var(--accent-glow);
  cursor: pointer;
  z-index: 10;
}

#physics-effects-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#grant-tilt-btn {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 242, 254, 0.2);
  border: 1px solid var(--accent-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  z-index: 100005;
  cursor: pointer;
  backdrop-filter: blur(10px);
  display: none;
}