/*=====================================================================
@File: Features (Modern Enhancements)
@Description: Modern interactive features and animations
@Author: Robbie Belson
@Created: February 2026

This file contains all modern feature implementations including:
- Preloader and loading states
- Dark mode toggle functionality
- Scroll animations (fade-in, slide-in, scale-in)
- Lazy loading effects
- Custom lightbox dialog
- Custom carousel
- Collapsible sections
- Accessibility enhancements
- Performance optimizations
- Micro-interactions and hover effects

These are custom-built features that replace vendor libraries,
providing full control and better performance.
=====================================================================*/

/* ===== CSS Custom Properties ===== */
:root {
  --primary-gradient-start: #766dff;
  --primary-gradient-end: #88f3ff;
  --dark-bg: #222222;
  --text-primary: #222222;
  --text-secondary: #777777;
  --white: #ffffff;
  --light-bg: #fafaff;
  --border-color: #eeeeee;
  --transition-speed: 300ms;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --primary-gradient-start: #88f3ff;
  --primary-gradient-end: #766dff;
  --dark-bg: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --white: #16213e;
  --light-bg: #0f1419;
  --border-color: #2d2d44;
}

/* ===== Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}

/* ===== Preloader ===== */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-content {
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.preloader-text {
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  margin-top: 20px;
  font-family: 'Heebo', sans-serif;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Dark Mode Toggle ===== */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(118, 109, 255, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-speed) var(--transition-smooth), box-shadow var(--transition-speed);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 30px rgba(118, 109, 255, 0.6);
}

.theme-toggle i {
  font-size: 24px;
  color: #ffffff;
  transition: transform var(--transition-speed);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ===== Scroll to Top Button ===== */
.scroll-to-top {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: rgba(118, 109, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) var(--transition-smooth);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  background: rgba(118, 109, 255, 1);
}

.scroll-to-top i {
  color: #ffffff;
  font-size: 20px;
}

/* ===== Intersection Observer Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--transition-smooth), transform 0.6s var(--transition-smooth);
}

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

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s var(--transition-smooth), transform 0.6s var(--transition-smooth);
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s var(--transition-smooth), transform 0.6s var(--transition-smooth);
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s var(--transition-smooth), transform 0.6s var(--transition-smooth);
}

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ===== Lazy Loading Images ===== */
img[data-src] {
  filter: blur(10px);
  transition: filter 0.3s;
}

img.loaded {
  filter: blur(0);
}

/* ===== Enhanced Glassmorphism Cards ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  transition: all var(--transition-speed) var(--transition-smooth);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ===== Improved Focus States ===== */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--primary-gradient-start);
  outline-offset: 2px;
}

/* ===== Skip to Content Link ===== */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-gradient-start);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  z-index: 10000;
  transition: top var(--transition-speed);
  font-weight: 500;
}

.skip-to-content:focus {
  top: 20px;
  outline: 3px solid #ffffff;
}

/* ===== Animated Background Pattern ===== */
.animated-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.animated-bg::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-50px, -50px); }
}

/* ===== Enhanced Hover Effects ===== */
.hover-lift {
  transition: transform var(--transition-speed) var(--transition-smooth), box-shadow var(--transition-speed);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.hover-glow {
  position: relative;
  transition: all var(--transition-speed);
}

.hover-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  opacity: 0;
  box-shadow: 0 0 30px rgba(118, 109, 255, 0.6);
  transition: opacity var(--transition-speed);
  pointer-events: none;
}

.hover-glow:hover::after {
  opacity: 1;
}

/* ===== Improved Typography ===== */
body {
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
}

/* ===== CSS Grid Gallery (Modern Alternative) ===== */
.modern-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  padding: 20px 0;
}

.modern-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 4/3;
  cursor: pointer;
}

.modern-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--transition-smooth);
}

.modern-gallery-item:hover img {
  transform: scale(1.1);
}

/* ===== Scroll Snap ===== */
.scroll-snap-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
}

.scroll-snap-section {
  scroll-snap-align: start;
  min-height: 100vh;
}

/* ===== Enhanced Progress Bars ===== */
.progress-bar {
  position: relative;
  overflow: visible;
}

.progress-bar::after {
  content: attr(aria-valuenow) '%';
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Improved Accessibility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Mobile Optimizations ===== */
@media (max-width: 768px) {
  .theme-toggle,
  .scroll-to-top {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
  }
  
  .scroll-to-top {
    bottom: 80px;
  }
  
  .modern-gallery {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 10px;
  border-radius: 4px;
}

.skeleton-title {
  height: 32px;
  margin-bottom: 15px;
  border-radius: 4px;
  width: 60%;
}

.skeleton-image {
  height: 200px;
  border-radius: 12px;
  margin-bottom: 15px;
}


/* ===== Gallery Icon Pop Animation ===== */
@keyframes iconPop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.h_gallery_item:hover .g_img_item a.light {
  animation: iconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}


/* ===== Custom Lightbox ===== */
.lightbox-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  margin: auto;
}

.lightbox-dialog::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}


/* ===== Custom Awards Carousel (replaces Owl Carousel) ===== */
.custom-carousel {
  position: relative;
  overflow: hidden;
  padding: 20px 0;
}

.custom-carousel-track {
  display: flex;
  gap: 30px;
  transition: transform 0.5s ease;
}

.custom-carousel-item {
  flex: 0 0 calc(33.333% - 20px);
  min-width: calc(33.333% - 20px);
}

.custom-carousel-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.custom-carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(118, 109, 255, 0.3);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.custom-carousel-dot.active {
  background: #766dff;
  transform: scale(1.2);
}

.custom-carousel-dot:hover {
  background: rgba(118, 109, 255, 0.6);
}

/* Auto-scroll animation */
@keyframes carouselScroll {
  0%, 20% { transform: translateX(0); }
  33%, 53% { transform: translateX(calc(-100% - 30px)); }
  66%, 86% { transform: translateX(calc(-200% - 60px)); }
  100% { transform: translateX(0); }
}

.custom-carousel-track.auto-scroll {
  animation: carouselScroll 15s infinite;
}

.custom-carousel-track.auto-scroll:hover {
  animation-play-state: paused;
}

/* Responsive */
@media (max-width: 991px) {
  .custom-carousel-item {
    flex: 0 0 calc(50% - 15px);
    min-width: calc(50% - 15px);
  }
  
  @keyframes carouselScroll {
    0%, 25% { transform: translateX(0); }
    50%, 75% { transform: translateX(calc(-100% - 30px)); }
    100% { transform: translateX(0); }
  }
}

@media (max-width: 767px) {
  .custom-carousel-item {
    flex: 0 0 100%;
    min-width: 100%;
  }
  
  .custom-carousel-track {
    gap: 0;
  }
  
  @keyframes carouselScroll {
    0%, 30% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
  }
}

[data-theme="dark"] .custom-carousel-dot {
  background: rgba(136, 243, 255, 0.3);
}

[data-theme="dark"] .custom-carousel-dot.active {
  background: #88f3ff;
}
