@import url("https://fonts.googleapis.com/css2?family=Chewy&family=Fredoka:wght@300;400;500;600;700&display=swap");

:root {
  /* Core Palette - Strictly according to user specs */
  --primary: #49b1e1;
  --primary-light: #cdeff9;
  --primary-ultra-light: #eef9fd;
  --text-dark: #5d5c5b;
  --text-muted: #b0b0af;
  --white: #ffffff;

  /* Derived Colors for depth */
  --shadow-color: rgba(73, 177, 225, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.6);

  /* Fonts */
  --font-header: "Chewy", system-ui;
  --font-body: "Fredoka", system-ui;

  /* Layout */
  --radius-xl: 48px;
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 12px;

  /* Shadows */
  --shadow-sm: 0 4px 12px var(--shadow-color);
  --shadow-md: 0 12px 24px var(--shadow-color);
  --shadow-lg: 0 20px 48px var(--shadow-color);

  /* Transitions */
  --transition-spring: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-smooth: all 0.3s ease;
}

/* --- Accessibility Focus Polish --- */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
  border-radius: 4px;
}

/* --- Base & Reset --- */
html {
  scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
  background: var(--primary-ultra-light);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border: 3px solid var(--primary-ultra-light);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #39a0d0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--primary-ultra-light);
  font-family: var(--font-body);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  transition: background-color 0.5s ease;
}

/* Background Mesh Gradient Animation */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(
      circle at 10% 20%,
      rgba(73, 177, 225, 0.15) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 90% 80%,
      rgba(172, 219, 241, 0.2) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(214, 235, 243, 0.3) 0%,
      transparent 60%
    );
  z-index: -1;
  animation: meshMove 20s infinite alternate ease-in-out;
}

@keyframes meshMove {
  0% {
    transform: scale(1) translate(0, 0);
  }

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-header);
  line-height: 1.1;
  color: var(--primary);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-spring);
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
}

/* --- Global Components --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid var(--glass-border);
  box-shadow:
    var(--shadow-md),
    0 0 20px rgba(73, 177, 225, 0.1);
}

/* Icon Tint Modifier - Turns any icon/image into the primary brand color */
.palette-tint {
  filter: brightness(0) saturate(100%) invert(67%) sepia(34%) saturate(735%)
    hue-rotate(159deg) brightness(91%) contrast(93%);
}

.icon-tint {
  background-color: var(--primary);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  display: inline-block;
}

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1000px;
  height: 80px;
  border-radius: var(--radius-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  transition: var(--transition-smooth);
}

.navbar.scrolled {
  top: 12px;
  height: 64px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-lg);
}

/* Hamburger Menu Icon */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: var(--primary-ultra-light);
  border: 2px solid var(--primary-light);
}

.nav-toggle span {
  width: 28px;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
  transition: var(--transition-smooth);
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-header);
  font-size: 2rem;
  color: var(--primary);
  text-shadow: 2px 2px var(--primary-ultra-light);
}

.nav-logo img {
  height: 48px;
  border-radius: 50%;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-logo:hover img {
  transform: rotate(360deg) scale(1.1);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-weight: 600;
  color: var(--text-dark);
  position: relative;
  padding: 4px 8px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover {
  color: var(--primary);
}

/* --- Hero Section --- */
.hero {
  padding-top: 200px;
  padding-bottom: 80px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(4rem, 12vw, 8rem);
  margin-bottom: 12px;
  animation: floatingText 4s ease-in-out infinite;
  -webkit-text-stroke: 2px var(--white);
}

.hero p {
  font-size: 1.4rem;
  max-width: 700px;
  margin: 0 auto 60px;
  color: var(--text-dark);
  font-weight: 500;
}

@keyframes floatingText {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-15px) rotate(1deg);
  }
}

/* --- Main Category Buttons --- */
.category-container {
  padding-bottom: 120px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 320px));
  gap: 32px;
  justify-content: center;
  padding: 20px;
}

.cat-button {
  background: var(--white);
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-spring);
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.cat-button::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  background: var(--primary-ultra-light);
  z-index: 0;
  transition: height 0.3s ease;
}

.cat-button:hover {
  transform: translateY(-16px) scale(1.02);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.cat-button:hover::before {
  height: 100%;
}

.cat-icon {
  font-size: 3.5rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px var(--shadow-color));
  transition: transform 0.3s ease;
}

.cat-button:hover .cat-icon {
  transform: scale(1.1) rotate(5deg);
}

.cat-button span {
  font-family: var(--font-header);
  font-size: 1.8rem;
  position: relative;
  z-index: 1;
  color: var(--primary);
}

/* --- Subpage Cinematic Layouts --- */
.page-header {
  padding-top: 180px;
  padding-bottom: 60px;
  text-align: center;
}

.page-header h1 {
  font-size: 5.5rem;
  margin-bottom: 8px;
}

.page-header p {
  font-size: 1.3rem;
  color: var(--text-dark);
  max-width: 600px;
  margin: 0 auto;
}

.content-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 64px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--primary-ultra-light);
  margin-bottom: 48px;
  transition: var(--transition-smooth);
}

.content-card:hover {
  box-shadow: 0 32px 64px rgba(73, 177, 225, 0.25);
}

/* --- Links & Lists --- */
.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  background: var(--white);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 2px solid transparent;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-sm);
}

.link-item:hover {
  transform: translateX(12px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  padding: 16px 40px;
  border-radius: var(--radius-sm);
  font-family: var(--font-header);
  font-size: 1.5rem;
  box-shadow: var(--shadow-md);
  display: inline-block;
  transition: var(--transition-spring);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.05);
  background: #39a0d0;
  box-shadow: var(--shadow-lg);
}

/* --- Improved Footer --- */
.site-footer {
  padding: 60px 0;
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  margin-top: 100px;
  border-top: 4px solid var(--primary-ultra-light);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  text-align: left;
  margin-bottom: 40px;
}

.footer-col h4 {
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links a {
  font-weight: 600;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.copyright {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Reveal Transitions */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
  will-change: transform, opacity;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Snake Game Styles */
#snake-game {
  background: var(--white);
  border: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: block;
  margin: 20px auto;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* --- Improved 404 Style & Animations --- */
.error-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(
    circle at center,
    var(--bg-light) 0%,
    #b3e0f2 100%
  );
}

.floating-obj {
  position: absolute;
  font-size: 3rem;
  pointer-events: none;
  animation: float-around 15s linear infinite;
  opacity: 0.2;
}

@keyframes float-around {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  25% {
    transform: translate(10vw, 20vh) rotate(90deg);
  }

  50% {
    transform: translate(20vw, 0) rotate(180deg);
  }

  75% {
    transform: translate(-10vw, 20vh) rotate(270deg);
  }

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

.error-content {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }

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

  70% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--primary);
  color: var(--white);
  padding: 16px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .navbar {
    padding: 0 20px;
    width: calc(100% - 24px);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 100px;
    left: 12px;
    width: calc(100% - 24px);
    background: var(--white);
    flex-direction: column;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary-ultra-light);
    gap: 24px;
    display: none;
  }

  .nav-links.open {
    display: flex;
    animation: slideInNav 0.4s ease-out;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.9);
  }

  @keyframes slideInNav {
    from {
      opacity: 0;
      transform: translateY(-20px) scale(0.95);
    }

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

  .hero h1 {
    font-size: 5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .content-card {
    padding: 32px;
  }

  .cat-button {
    padding: 40px 20px;
  }

  .jurgen-chat {
    width: calc(100vw - 40px);
    right: -20px;
  }
}

/* Snowflake Animation */
.snowflake {
  position: fixed;
  top: -20px;
  z-index: 9999;
  color: #a0d8f0;
  /* Darker blueish for visibility */
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
  user-select: none;
  pointer-events: none;
  will-change: transform;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  100% {
    transform: translateY(105vh) rotate(360deg);
  }
}
/* --- Discord Widget Styling --- */
.discord-widget-container {
  width: 100%;
  height: 500px;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary-light);
  margin-top: 20px;
}

.discord-widget-iframe {
  position: absolute;
  width: calc(100% + 240px);
  height: 100%;
  top: 0;
  left: -240px;
  border: none;
}

@media (max-width: 768px) {
  .discord-widget-container {
    height: 600px;
  }
  .discord-widget-iframe {
    width: 100%;
    left: 0;
  }
}
