/* ==========================================
   Hair@Home - Custom Styles
   2025-2026 Modern Web Standards
   ========================================== */

/* ----------------------------------------
   Reduced Motion Support (WCAG 2.1)
   Users who prefer reduced motion get
   instant transitions without animation
   ---------------------------------------- */
@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;
  }

  .animate-fade-in,
  .animate-slide-up,
  .animate-slide-in-right,
  .animate-float,
  .animate-float-slow,
  .animate-pulse-soft,
  .animate-shimmer,
  .animate-gradient,
  .animate-glow-pulse,
  .animate-border-shimmer,
  .animate-underglow {
    animation: none !important;
  }
}

/* ----------------------------------------
   Visible Focus States (WCAG 2.4.7)
   Clear focus indicators for keyboard
   navigation users
   ---------------------------------------- */
:focus-visible {
  outline: 3px solid #A66B48;
  outline-offset: 2px;
  border-radius: 4px;
}

.dark :focus-visible {
  outline-color: #C9A86C;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Button focus styles */
button:focus-visible,
a:focus-visible {
  outline: 3px solid #A66B48;
  outline-offset: 3px;
  border-radius: 8px;
}

.dark button:focus-visible,
.dark a:focus-visible {
  outline-color: #C9A86C;
}

/* ----------------------------------------
   Skip to Content Link (WCAG 2.4.1)
   Hidden until focused for keyboard users
   ---------------------------------------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #2D2D2D;
  color: white;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  font-weight: 500;
  border-radius: 0 0 8px 0;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ----------------------------------------
   View Transitions API (2025)
   Smooth page transitions with native API
   ---------------------------------------- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

::view-transition-old(root) {
  animation: fade-out 0.15s ease-out;
}

::view-transition-new(root) {
  animation: fade-in 0.15s ease-in 0.15s;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ----------------------------------------
   Scroll-Triggered Animations
   Elements animate as they enter viewport
   ---------------------------------------- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered animations for children */
.scroll-reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scroll-reveal-stagger.revealed > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: translateY(0); }

/* Reduced motion override for scroll animations */
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ----------------------------------------
   Enhanced Card Hover Effects
   Subtle lift and glow on interaction
   ---------------------------------------- */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (hover: hover) {
  .card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px -12px rgba(166, 107, 72, 0.25);
  }

  .dark .card-hover:hover {
    box-shadow: 0 12px 40px -12px rgba(201, 168, 108, 0.2);
  }
}

/* Touch devices: active state instead of hover */
@media (hover: none) {
  .card-hover:active {
    transform: scale(0.98);
  }
}

/* ----------------------------------------
   Loading States & Skeleton Screens
   Improves perceived performance
   ---------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    #E8DCC6 0%,
    #F5EDE0 50%,
    #E8DCC6 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    #3A2F28 0%,
    #4A3F38 50%,
    #3A2F28 100%
  );
  background-size: 200% 100%;
}

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

/* ----------------------------------------
   High Contrast Mode Support
   Ensures visibility for users who need it
   ---------------------------------------- */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #000000;
  }

  .dark {
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --border-color: #FFFFFF;
  }
}

/* ----------------------------------------
   Print Styles
   Clean output for printed pages
   ---------------------------------------- */
@media print {
  .no-print,
  nav,
  #mobile-menu,
  button#theme-toggle,
  button#mobile-menu-btn {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  a {
    text-decoration: underline;
  }

  a[href^="tel"]:after {
    content: " (" attr(href) ")";
  }
}

/* ----------------------------------------
   Custom Scrollbar (Webkit)
   Matches brand colors
   ---------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #F5EDE0;
}

::-webkit-scrollbar-thumb {
  background: #A66B48;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #8B5A3C;
}

.dark ::-webkit-scrollbar-track {
  background: #2D2520;
}

.dark ::-webkit-scrollbar-thumb {
  background: #B0956C;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #C9A86C;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #A66B48 #F5EDE0;
}

.dark * {
  scrollbar-color: #B0956C #2D2520;
}
