@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  /* Core Colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: rgba(20, 20, 20, 0.6);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-1: #3b82f6; /* Blue */
  --accent-2: #8b5cf6; /* Purple */
  --accent-3: #ec4899; /* Pink */

  /* Glassmorphism */
  --glass-bg: rgba(25, 25, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 12px;

  /* Fonts */
  --font-serif: "Fraunces", serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-sans: "Inter", sans-serif;

  /* Spacing */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 4rem;

  /* Cursor */
  --cursor-size: 8px;
  --cursor-ring-size: 32px;
}

/* Night Mode (Post 9PM Theme) */
.theme-night {
  --accent-1: #ef4444; /* Red */
  --accent-2: #f43f5e; /* Rose */
  --accent-3: #fbbf24; /* Amber */
  --bg-primary: #050505;
}

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

html {
  scroll-behavior: smooth;
  cursor: none; /* Custom cursor */
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.5s ease;
}

#three-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2; /* Behind noise and content */
  pointer-events: none;
  opacity: 0.6;
}

/* Typography */
h1,
h2,
h3,
.modal-title {
  font-family: var(--font-serif);
  font-weight: 400;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
}
h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--spacing-lg);
}
h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
}

.accent-text {
  background: linear-gradient(
    var(--gradient-angle),
    var(--accent-1),
    var(--accent-2),
    var(--accent-3)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-rotate 8s linear infinite;
}

@keyframes gradient-rotate {
  0% {
    --gradient-angle: 0deg;
  }
  100% {
    --gradient-angle: 360deg;
  }
}

.dynamic-headline {
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 1rem;
  height: 2.5rem; /* prevent layout shift */
}

.cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--accent-1);
}

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

/* Custom Cursor */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: var(--cursor-size);
  height: var(--cursor-size);
  background-color: var(--text-primary);
  border-radius: 50%;
  transition:
    width 0.2s,
    height 0.2s,
    background-color 0.2s;
}

.cursor-ring {
  width: var(--cursor-ring-size);
  height: var(--cursor-ring-size);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transition:
    width 0.3s,
    height 0.3s,
    border-color 0.3s,
    transform 0.1s ease-out;
}

/* Hover state for custom cursor */
body.hovering .cursor-dot {
  width: 4px;
  height: 4px;
  background-color: var(--accent-1);
}
body.hovering .cursor-ring {
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-1);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    opacity 0.8s ease-in-out,
    visibility 0.8s ease-in-out;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80%;
  max-width: 400px;
}

.loading-logo {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 2rem;
}

.logo-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--accent-1);
  border-right-color: var(--accent-2);
  border-bottom-color: var(--accent-3);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

.logo-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background-color: var(--text-primary);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite alternate;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.loading-text {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

.loading-status {
  animation: pulse-text 1.5s infinite;
}

.loading-bar-container {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--accent-1),
    var(--accent-2),
    var(--accent-3)
  );
  border-radius: 2px;
  /* Removed CSS transition to allow smooth JS requestAnimationFrame updates */
  box-shadow: 0 0 15px var(--accent-2);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
  }
}

/* Scanline & Noise */
.scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(255, 255, 255, 0.02) 51%,
    transparent 51%
  );
  background-size: 100% 4px;
  z-index: 9998;
  pointer-events: none;
  animation: scanline-sweep 3s ease-out forwards;
}

@keyframes scanline-sweep {
  0% {
    transform: translateY(-100%);
    opacity: 1;
  }
  80% {
    transform: translateY(100%);
    opacity: 1;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
    display: none;
  }
}

.noise-overlay {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.04;
  animation: noise-move 8s steps(10) infinite;
}

@keyframes noise-move {
  0% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-5%, -5%);
  }
  20% {
    transform: translate(-10%, 5%);
  }
  30% {
    transform: translate(5%, -10%);
  }
  40% {
    transform: translate(-5%, 15%);
  }
  50% {
    transform: translate(-10%, 5%);
  }
  60% {
    transform: translate(15%, 0);
  }
  70% {
    transform: translate(0, 15%);
  }
  80% {
    transform: translate(3%, 35%);
  }
  90% {
    transform: translate(-10%, 10%);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* System Widget */
.system-widget {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 12px;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  min-width: 160px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  transform: translateX(50px);
}

body.page-ready .system-widget {
  opacity: 1;
  transform: translateX(0);
}

.system-widget:hover {
  transform: translateY(-5px);
}

.widget-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 0.25rem;
}
.widget-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.widget-label {
  color: var(--text-secondary);
}
.status-online {
  color: #10b981;
  animation: pulse-text 2s infinite;
}
.status-error {
  color: #ef4444;
  animation: pulse-text 0.5s infinite;
  font-weight: bold;
}

@keyframes pulse-text {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Scroll to Top */
#scroll-to-top {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  transition:
    opacity 0.3s,
    transform 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
#scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Layout Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Bento Hero Section */
.hero-bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: var(--spacing-md);
  padding: 120px 0 var(--spacing-xl);
}

.bento-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: var(--spacing-lg);
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}
.bento-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}
.bento-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at top right,
    rgba(255, 255, 255, 0.05),
    transparent 60%
  );
  pointer-events: none;
}

.bento-main {
  grid-column: span 4;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: var(--spacing-md);
  border: 3px solid var(--glass-border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transition:
    transform 0.3s ease,
    border-color 0.3s ease;
}

.hero-avatar:hover {
  transform: scale(1.05);
  border-color: var(--accent-1);
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bento-location {
  grid-column: span 2;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.bento-status {
  grid-column: span 2;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.bento-funfact {
  grid-column: span 4;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.bento-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-1);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-2);
  margin-top: 0.25rem;
}

/* Buttons */
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-weight: 600;
  font-family: var(--font-sans);
  margin-top: 2rem;
  width: fit-content;
  transition:
    transform 0.2s,
    background 0.2s;
}
.primary-btn:hover {
  background: var(--text-secondary);
  transform: scale(1.05);
}

/* Projects Masonry Grid */
.projects-section {
  padding: var(--spacing-xl) 0;
}

.project-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}
.filter-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.3s;
}
.filter-btn.active,
.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--accent-1);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.project-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transform-style: preserve-3d;
  perspective: 1000px;
}
.project-card.large {
  grid-column: span 2;
}
.project-card.small {
  grid-column: span 1;
}

.project-image {
  position: relative;
  width: 100%;
  height: 300px; /* Base height, adjust via masonry or JS if needed */
  overflow: hidden;
}
.project-card.large .project-image {
  height: 400px;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Skeleton Loader */
.skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  z-index: 1;
}
.lazy-load.loaded + .skeleton {
  display: none;
}
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.project-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
}
.project-card:hover .project-overlay {
  opacity: 1;
}
.project-card:hover .project-image img {
  transform: scale(1.05);
}

.read-more-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-weight: 500;
  transform: translateY(20px);
  transition:
    transform 0.3s,
    background 0.3s;
}
.project-card:hover .read-more-btn {
  transform: translateY(0);
}
.read-more-btn:hover {
  background: var(--accent-1);
  border-color: var(--accent-1);
}

.project-info {
  padding: 1.5rem;
}
.project-info h3 {
  margin-bottom: 0.25rem;
}
.project-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* 3D Tilt Effect applied via JS */
.tilt-card {
  transition: transform 0.1s;
}

/* Skills Bubbles */
.skills-section {
  padding: var(--spacing-xl) 0;
}
.skills-bubble-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 2rem 0;
}
.skill-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.skill-bubble:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1) translateY(-5px);
  border-color: var(--accent-2);
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.2);
}

/* Gamified Contact */
.contact-section {
  padding: var(--spacing-xl) 0;
  text-align: center;
}
.contact-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.challenge-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.challenge-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.3s;
}
.challenge-btn.active {
  background: var(--accent-1);
  color: white;
  border-color: var(--accent-1);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.game-instruction {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.game-canvas {
  width: 100%;
  height: 250px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.game-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5;
}

#game-stats {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-2);
}

.game-node {
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--accent-1);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 15px var(--accent-1);
  animation: node-spawn 0.3s ease-out;
}

@keyframes node-spawn {
  from {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.riddle-container {
  max-width: 500px;
  margin: 0 auto;
}
.challenge-view {
  padding: 2.5rem 2rem;
}
.riddle-box h3,
.game-box h3 {
  margin-bottom: 1.5rem;
  color: var(--accent-3);
}

.riddle-input {
  width: 100%;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: white;
  font-family: var(--font-mono);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.3s;
}
.riddle-input:focus {
  outline: none;
  border-color: var(--accent-1);
}

.riddle-feedback {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.5rem;
}
.feedback-error {
  color: #ef4444;
  animation: shake 0.4s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.unlocked-contact {
  animation: fadeUp 0.5s forwards;
}
.success-animation {
  color: #10b981;
  margin-bottom: 1rem;
}
.success-animation svg {
  width: 48px;
  height: 48px;
}
.email-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--accent-1);
  color: white;
  padding: 1rem 2rem;
  border-radius: 30px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: bold;
  transition: all 0.3s;
  margin-top: 1rem;
}
.email-btn:hover {
  background: var(--accent-1);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.hidden {
  display: none !important;
}

/* Footer Terminal */
.terminal-footer {
  background: #000;
  border-top: 1px solid var(--glass-border);
  padding: 1.5rem var(--spacing-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #a3a3a3;
  margin-top: var(--spacing-xl);
  opacity: 0;
  transform: translateY(50px);
  transition:
    opacity 1s ease,
    transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.page-ready .terminal-footer {
  opacity: 1;
  transform: translateY(0);
}
.terminal-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.terminal-dot.red {
  background: #ff5f56;
}
.terminal-dot.yellow {
  background: #ffbd2e;
}
.terminal-dot.green {
  background: #27c93f;
}
.terminal-title {
  margin-left: 1rem;
  opacity: 0.7;
}

.terminal-body {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}
.terminal-body p {
  margin-bottom: 0.25rem;
}
.terminal-response {
  color: #4ade80;
}
.terminal-error {
  color: #f87171;
}

.terminal-input-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.prompt-symbol {
  color: var(--accent-1);
}
.terminal-input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1rem;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}
.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-body {
  margin-top: 1.5rem;
  color: var(--text-secondary);
}
.modal-body p {
  margin-bottom: 1rem;
}
.modal-body strong {
  color: var(--text-primary);
}

/* Scroll Reveals */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  filter: blur(5px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  html {
    cursor: auto;
  } /* Disable custom cursor on mobile */
  .cursor-dot,
  .cursor-ring {
    display: none;
  }

  .hero-bento {
    grid-template-columns: 1fr;
    padding-top: 100px;
  }
  .bento-main,
  .bento-location,
  .bento-status,
  .bento-funfact {
    grid-column: span 1;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
  .project-card.large,
  .project-card.small {
    grid-column: span 1;
  }

  .system-widget {
    top: auto;
    bottom: 80px;
    right: 10px;
    transform: scale(0.8);
    transform-origin: bottom right;
  }
}
/* Chatbot Widget Styles */
.chatbot-container {
  position: fixed;
  bottom: 90px;
  right: var(--spacing-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  opacity: 0;
  transform: translateY(50px) scale(0.5);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-delay: 0.5s;
}

body.page-ready .chatbot-container {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s;
}

.chatbot-toggle:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.chat-status-pulse {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 12px;
  height: 12px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.chat-window {
  width: 400px;
  height: 550px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  visibility: hidden;
  opacity: 0;
  transform: scale(0.7) translateY(40px) rotate(5deg);
  pointer-events: none;
  background: rgba(15, 15, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(139, 92, 246, 0.1);
}

.chat-window.active {
  visibility: visible;
  opacity: 1;
  transform: scale(1) translateY(0) rotate(0deg);
  pointer-events: all;
}

.chat-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-avatar-mini {
  position: relative;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.chat-avatar-mini i {
  width: 18px;
  height: 18px;
}

.chat-title-text {
  display: flex;
  flex-direction: column;
}

.chat-title h3 {
  font-size: 1rem;
  margin: 0;
  background: linear-gradient(to right, #fff, var(--accent-1));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-serif);
}

.chat-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.chat-online-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}

.close-chat-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition:
    background 0.2s,
    color 0.2s;
}

.close-chat-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.chat-suggestions {
  padding: 0 var(--spacing-md) var(--spacing-md);
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for suggestions */
}

.chat-suggestions::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-1);
  border-color: var(--accent-1);
  transform: translateY(-2px);
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.9rem;
  max-width: 85%;
  line-height: 1.4;
  position: relative;
  transition: transform 0.3s ease;
}

.bot-message {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  animation: message-slide-left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
}

.user-message {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  animation: message-slide-right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
}

@keyframes message-slide-left {
  from {
    transform: translateX(-20px) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes message-slide-right {
  from {
    transform: translateX(20px) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  align-self: flex-start;
  margin-bottom: 1rem;
  animation: message-slide-left 0.3s ease-out;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1s infinite ease-in-out;
}

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

@keyframes typing-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
    opacity: 0.5;
  }
}

.chat-input-area {
  padding: var(--spacing-md);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
}

.chat-input-area input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s;
}

.chat-input-area input:focus {
  border-color: var(--accent-1);
}

.send-chat-btn {
  background: var(--accent-1);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}

.send-chat-btn:hover {
  background: var(--accent-2);
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .chat-window {
    width: calc(100vw - 40px);
    height: 60vh;
    right: 20px;
    bottom: 80px;
  }
}
