:root {
  --primary-gradient-start: #1565c0;
  --primary-gradient-end: #00acc1;
  --background-overlay: rgba(0, 0, 0, 0.5);
  --text-light: #ffffff;
  --text-dark: #333333;
  --accent-color: #ffd900;
  --grid-gap: 1rem;
  --transition-speed: 0.3s;
  --color-wheel-speed: 20s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

body#home-page-bkg {
  background: #000;
  position: relative;
}

.bg {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  background: linear-gradient(45deg, #1a237e 0%, #4a148c 50%, #880e4f 100%);
  opacity: 0.3;
  z-index: -3;
  will-change: transform;
}

.bg2 {
  background: radial-gradient(circle at 30% 50%, rgba(255, 87, 34, 0.3), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(33, 150, 243, 0.3), transparent 50%);
  animation: float 15s ease-in-out infinite;
  z-index: -2;
}

.bg3 {
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.03) 10px, rgba(255, 255, 255, 0.03) 20px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.03) 10px, rgba(255, 255, 255, 0.03) 20px);
  animation: slide 20s linear infinite;
  z-index: -1;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -30px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

@keyframes slide {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 50px 50px;
  }
}

.lava-lamp {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -4;
  overflow: hidden;
  pointer-events: none;
}

.lava-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.6;
  animation: blob-float 20s ease-in-out infinite;
}

.lava-blob:nth-child(1) {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #ff006e, #8338ec);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
  animation-duration: 25s;
}

.lava-blob:nth-child(2) {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #3a86ff, #06ffa5);
  bottom: -80px;
  right: -80px;
  animation-delay: -7s;
  animation-duration: 20s;
}

.lava-blob:nth-child(3) {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #fb5607, #ffbe0b);
  top: 50%;
  left: 50%;
  animation-delay: -14s;
  animation-duration: 30s;
}

@keyframes blob-float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(100px, -100px) scale(1.1);
  }

  50% {
    transform: translate(-80px, 80px) scale(0.9);
  }

  75% {
    transform: translate(120px, 60px) scale(1.05);
  }
}

.page-header {
  padding: 3rem 1rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(21, 101, 192, 0.9), rgba(0, 172, 193, 0.9));
  color: var(--text-light);
  position: relative;
  z-index: 1;
}

.project-name {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  font-weight: 700;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {

  0%,
  100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  }

  50% {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 217, 0, 0.6);
  }
}

.project-tagline {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 300;
  opacity: 0.95;
}

nav {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-light);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.18s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.25s, height 0.25s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:focus {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.btn svg {
  fill: currentColor;
  position: relative;
  z-index: 1;
}

.svg-div {
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 1;
  margin-top: -2px;
  overflow: hidden;
  height: 80px;
}

.svg-div svg {
  display: block;
  width: 100%;
  height: 100%;
}

.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  min-height: 60vh;
  position: relative;
  z-index: 1;
}

.main-content {
  padding: 2rem 0;
}

#box-for-selfie {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem auto;
  position: relative;
  width: fit-content;
}

#color-wheel {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      #ff0000, #ff7700, #ffff00, #00ff00,
      #0000ff, #8b00ff, #ff0000);
  animation: rotate-wheel var(--color-wheel-speed) linear infinite;
  z-index: 1;
  cursor: pointer;
  transition: animation-duration 0.3s ease;
}

#color-wheel:hover {
  animation-duration: 5s;
}

@keyframes rotate-wheel {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

#selfie {
  position: relative;
  z-index: 2;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.prologue {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin: 1rem 0;
}

.txt {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.txt h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
  position: relative;
  display: inline-block;
}

.txt h1::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, var(--primary-gradient-start), var(--primary-gradient-end));
  animation: underline-grow 2s ease-out;
}

@keyframes underline-grow {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

.blurb {
  white-space: pre-line;
  line-height: 1.8;
}

.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.grid-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--grid-gap);
  margin: 3rem 0;
  padding: 0 1rem;
}

.grid-item {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(21, 101, 192, 0.1), rgba(0, 172, 193, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.grid-item:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.grid-item img,
.grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-speed) ease;
}

.grid-item:hover img,
.grid-item:hover video {
  transform: scale(1.05);
}

.grid-item:empty::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  border: 3px solid rgba(21, 101, 192, 0.3);
  animation: swim 4s ease-in-out infinite;
}

.grid-item:empty:nth-child(5)::before {
  border-radius: 50%;
  animation-delay: 0s;
}

.grid-item:empty:nth-child(6)::before {
  border-radius: 50%;
  animation-delay: -1s;
}

.grid-item:empty:nth-child(7)::before {
  border-radius: 0;
  animation-delay: -2s;
}

.grid-item:empty:nth-child(8)::before {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  animation-delay: -3s;
}

.grid-item:empty:nth-child(9)::before {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation-delay: -1.5s;
}

@keyframes swim {

  0%,
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  25% {
    transform: translate(calc(-50% + 30px), calc(-50% - 30px)) rotate(90deg);
  }

  50% {
    transform: translate(-50%, calc(-50% - 60px)) rotate(180deg);
  }

  75% {
    transform: translate(calc(-50% - 30px), calc(-50% - 30px)) rotate(270deg);
  }
}

.section-separator {
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(21, 101, 192, 0.5), transparent);
  margin: 4rem 0;
}

.site-footer {
  background: #2c3e50;
  color: var(--text-light);
  padding: 2rem 1rem;
  text-align: center;
  margin-top: 4rem;
}

.site-footer a {
  color: var(--accent-color);
  text-decoration: none;
  transition: opacity var(--transition-speed) ease;
}

.site-footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.particle {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  animation: particle-float 2s ease-out forwards;
  z-index: 9999;
}

@keyframes particle-float {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

.typewriter {
  overflow: hidden;
  border-right: 3px solid var(--accent-color);
  white-space: nowrap;
  animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
  max-width: fit-content;
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
}

.glitch::before {
  animation: glitch-1 0.3s infinite;
  color: #ff00de;
  z-index: -1;
}

.glitch::after {
  animation: glitch-2 0.3s infinite;
  color: #00fff9;
  z-index: -2;
}

@keyframes glitch-1 {

  0%,
  100% {
    transform: translate(0);
  }

  33% {
    transform: translate(-2px, 2px);
  }

  66% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitch-2 {

  0%,
  100% {
    transform: translate(0);
  }

  33% {
    transform: translate(2px, -2px);
  }

  66% {
    transform: translate(-2px, 2px);
  }
}

.neon-glow {
  text-shadow:
    0 0 5px #fff,
    0 0 10px #fff,
    0 0 20px var(--accent-color),
    0 0 40px var(--accent-color),
    0 0 80px var(--accent-color);
  animation: neon-flicker 1.5s ease-in-out infinite alternate;
}

@keyframes neon-flicker {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

.transition-block {
  background: var(--primary-gradient-start);
  transform: scaleY(0);
  transform-origin: bottom;
}

.transition-block.animate {
  animation: block-reveal 0.5s ease-out forwards;
}

@keyframes block-reveal {
  0% {
    transform: scaleY(0);
  }

  50% {
    transform: scaleY(1);
  }

  100% {
    transform: scaleY(0);
    transform-origin: top;
  }
}

@media (max-width: 768px) {
  .project-name {
    font-size: 2rem;
  }

  .project-tagline {
    font-size: 1rem;
  }

  nav {
    gap: 0.5rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  #color-wheel {
    width: 180px;
    height: 180px;
  }

  #selfie {
    width: 150px;
    height: 150px;
  }

  .grid-section {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .txt h1 {
    font-size: 1.5rem;
  }

  .main-container {
    padding: 1rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 2rem 0.5rem 1.5rem;
  }

  .grid-section {
    grid-template-columns: repeat(2, 1fr);
  }

  #color-wheel {
    width: 140px;
    height: 140px;
  }

  #selfie {
    width: 120px;
    height: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
