/*
style.css — Neocities Compatible Animated Gradient + Backdrop Filter
Author: You!
Purpose:
- Full-page animated gradient background
- Frosted glass effect using backdrop-filter
- Accessibility and mobile support
- No JavaScript required
*/

/* ===== Neocities Baseline Reset ===== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #0b1220; /* fallback solid background */
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* ===== Theme Variables ===== */
:root {
  --ag-duration: 18s;
  --ag-ease: ease-in-out;
  --ag-saturation: 110%;
  --ag-brightness: 96%;
  --ag-blur: 40px;
  --ag-opacity: 0.95;
  --ag-overlay-color: rgba(0, 0, 0, 0.08);
  --ag-gradient-angle: 110deg;
  --ag-scale: 1.15;
  --ag-contrast: 1.02;
  --ag-safe-solid: #0b1220;
  --ag-text-color: #f7fafc;
  --ag-content-max-width: 1100px;
  --ag-content-padding: 1.25rem;
}

/* ===== Animated Gradient Background ===== */
.animated-gradient {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
  background-color: var(--ag-safe-solid);
  filter: contrast(var(--ag-contrast)) saturate(var(--ag-saturation)) brightness(var(--ag-brightness));
  transform: translateZ(0);
  overflow: hidden;
  isolation: isolate;
}

.animated-gradient::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--ag-overlay-color);
  pointer-events: none;
  z-index: 2;
}

.animated-gradient::after {
  content: "";
  position: absolute;
  top: -10%;
  right: -10%;
  bottom: -10%;
  left: -10%;
  z-index: 1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 240% 240%;
  filter: blur(var(--ag-blur));
  opacity: var(--ag-opacity);
  transform-origin: center;
  animation: ag-pan var(--ag-duration) var(--ag-ease) infinite;
  background-image:
    radial-gradient(1200px 700px at 10% 20%, rgba(255, 120, 100, 0.3), transparent 25%),
    radial-gradient(900px 600px at 85% 30%, rgba(120, 100, 255, 0.28), transparent 25%),
    linear-gradient(var(--ag-gradient-angle), rgba(80, 220, 200, 0.18), rgba(255, 180, 100, 0.1)),
    conic-gradient(from 120deg at 50% 50%, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.02));
}

/* ===== Animation Keyframes ===== */
@keyframes ag-pan {
  0% {
    transform: scale(var(--ag-scale)) translate3d(0%, 0%, 0);
    background-position: 0% 20%, 100% 40%, 50% 50%, 50% 50%;
  }
  25% {
    transform: scale(calc(var(--ag-scale) * 1.01)) translate3d(-6%, 3%, 0);
    background-position: 10% 30%, 90% 20%, 40% 60%, 45% 55%;
  }
  50% {
    transform: scale(var(--ag-scale)) translate3d(-2%, -6%, 0);
    background-position: 20% 10%, 80% 60%, 60% 40%, 55% 45%;
  }
  75% {
    transform: scale(calc(var(--ag-scale) * 1.02)) translate3d(6%, -2%, 0);
    background-position: 15% 50%, 70% 30%, 30% 70%, 50% 50%;
  }
  100% {
    transform: scale(var(--ag-scale)) translate3d(0%, 0%, 0);
    background-position: 0% 20%, 100% 40%, 50% 50%, 50% 50%;
  }
}

/* ===== Reduced Motion Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  .animated-gradient::after {
    animation: none;
    transition: none;
  }
  .animated-gradient {
    filter: none;
  }
}

/* ===== Foreground Content Styling ===== */
.ag-content {
  position: relative;
  z-index: 10;
  color: var(--ag-text-color);
  max-width: var(--ag-content-max-width);
  margin: 0 auto;
  padding: var(--ag-content-padding);
  text-rendering: optimizeLegibility;
}

/* ===== Frosted Glass Card with Backdrop Filter ===== */
.ag-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(3, 6, 12, 0.45);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
}

/* ===== Theme Presets ===== */
.ag-sunset {
  --ag-overlay-color: rgba(6, 1, 10, 0.06);
  --ag-gradient-angle: 120deg;
  --ag-blur: 48px;
  --ag-duration: 20s;
  --ag-saturation: 115%;
}

.ag-ocean {
  --ag-overlay-color: rgba(2, 6, 12, 0.06);
  --ag-gradient-angle: 100deg;
  --ag-blur: 36px;
  --ag-duration: 16s;
  --ag-saturation: 120%;
}

.ag-aurora {
  --ag-overlay-color: rgba(3, 3, 8, 0.04);
  --ag-gradient-angle: 80deg;
  --ag-blur: 52px;
  --ag-duration: 22s;
  --ag-saturation: 125%;
}

/* ===== High Contrast Option ===== */
.ag-contrast-high {
  --ag-overlay-color: rgba(0, 0, 0, 0.18);
  --ag-text-color: #ffffff;
}

/* ===== Mobile Optimization ===== */
@media (max-width: 480px) {
  :root {
    --ag-blur: 22px;
    --ag-duration: 30s;
    --ag-opacity: 0.96;
  }
  .animated-gradient::after {
    background-size: 300% 300%;
  }
}

/* ===== Legacy Fallback ===== */
@supports not (background-image: linear-gradient(black, white)) {
  .animated-gradient {
    background: var(--ag-safe-solid);
    filter: none;
  }
  .animated-gradient::after,
  .animated-gradient::before {
    display: none;
  }
}
