/* =========================================
   PASTELLE WEBSITE - SHARED STYLES
   Common CSS for all pages
   ========================================= */

/* ========== BASE STYLES ========== */

/* Font Smoothing */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== ACCESSIBILITY ========== */

/* Focus Visible Styles - Subtle but clear focus indicators */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.dark button:focus-visible,
.dark a:focus-visible,
.dark [role="button"]:focus-visible,
.dark select:focus-visible,
.dark input:focus-visible,
.dark textarea:focus-visible {
  outline-color: rgba(255, 255, 255, 0.8);
}

/* Touch Action - Prevent double-tap zoom */
button,
a,
[role="button"],
label {
  touch-action: manipulation;
}

/* Screen Reader Only - Visually hidden but accessible */
.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;
}

/* Skip to Content Link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 0.75rem 1.5rem;
  z-index: 9999;
  text-decoration: none;
  font-weight: 500;
  border-radius: 0 0 0.5rem 0;
}

.skip-to-content:focus {
  top: 0;
}

.dark .skip-to-content {
  background: #fff;
  color: #000;
}

/* Custom Selection Color */
::selection {
  background: #000;
  color: #fff;
}

.dark ::selection {
  background: #fff;
  color: #000;
}

/* ========== SCROLLBAR STYLES ========== */

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

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

/* Hide Scrollbar but allow scroll */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom Scrollbar for Modal */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 20px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

/* ========== IMAGE LOADING - SKELETON LOADERS ========== */

/* Skeleton loading animation */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #e0e0e0 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite linear;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    #1a1a1a 0px,
    #2a2a2a 40px,
    #1a1a1a 80px
  );
  background-size: 200px 100%;
}

/* Apply skeleton to images while loading */
img[loading="lazy"]:not([src]) {
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #e0e0e0 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite linear;
}

.dark img[loading="lazy"]:not([src]) {
  background: linear-gradient(
    90deg,
    #1a1a1a 0px,
    #2a2a2a 40px,
    #1a1a1a 80px
  );
  background-size: 200px 100%;
}

/* ========== REVEAL ANIMATIONS ========== */

/* Smooth Reveal Classes */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal-up {
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

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

/* Reduced Motion Support - Disable animations for users who prefer it */
@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;
  }
}

/* ========== BUTTON ANIMATIONS ========== */

/* Primary Button Micro Animations */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
}

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

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.dark .btn-primary:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.btn-primary:active {
  transform: translateY(0px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Secondary Button */
.btn-secondary {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-secondary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  border-color: currentColor;
}

.btn-secondary:hover::before {
  opacity: 0.05;
}

.btn-secondary:active {
  transform: translateY(0px);
}

/* Link button hover animation */
.link-btn {
  position: relative;
}

.link-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-btn:hover::after {
  width: 100%;
}

.link-btn svg {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-btn:hover svg {
  transform: translateX(4px);
}

/* ========== ENHANCED LINK ANIMATIONS ========== */

/* Animated underline from center */
.link-animated {
  position: relative;
  text-decoration: none;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background: currentColor;
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-animated:hover::after {
  width: 100%;
}

/* Navigation link animation */
nav a:not(.link-animated) {
  position: relative;
}

nav a:not(.link-animated)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: currentColor;
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.8;
}

nav a:not(.link-animated):hover::after {
  width: 80%;
}

/* ========== CAROUSEL ANIMATIONS (Homepage) ========== */

/* Carousel Slide Transitions */
.carousel-slide {
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Carousel Button Animations */
.carousel-btn {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carousel-btn svg {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carousel-btn:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.carousel-btn:hover svg {
  transform: translateX(2px);
}

.carousel-btn:first-of-type:hover svg {
  transform: translateX(-2px);
}

.carousel-btn:active {
  transform: scale(0.95);
}

/* ========== ART CARD STYLES ========== */

/* Card Refinements - Subtle shadows and borders */
.art-card > div:first-child {
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
}

.dark .art-card > div:first-child {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.art-card:hover > div:first-child {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
}

.dark .art-card:hover > div:first-child {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Image Hover Effect */
.art-card img {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease;
}

.art-card:hover img {
  transform: scale(1.05);
}

/* ========== TEXT SCRAMBLE EFFECT ========== */

.dud {
  color: #757575;
  opacity: 0.5;
}

.dark .dud {
  color: #a3a3a3;
}

/* ========== NAVBAR STYLES ========== */

/* Navbar Scrolled State */
#navbar.scrolled #navbar-inner {
  height: 4rem;
}

/* Logo Animation on Scroll */
#navbar-inner a {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#navbar.scrolled #navbar-inner a {
  transform: scale(0.9);
}

/* ========== SCROLL PROGRESS INDICATOR ========== */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #121212, #666);
  z-index: 9998;
  transition: width 0.1s ease-out;
  transform-origin: left;
}

.dark #scroll-progress {
  background: linear-gradient(90deg, #ECEBDD, #999);
}

/* ========== BACK TO TOP BUTTON ========== */

#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #121212;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.dark #back-to-top {
  background: #ECEBDD;
  color: #121212;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#back-to-top:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.dark #back-to-top:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

#back-to-top:active {
  transform: translateY(-2px) scale(1);
}

#back-to-top svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#back-to-top:hover svg {
  transform: translateY(-2px);
}

/* ========== ENHANCED THEME TOGGLE ========== */

.theme-toggle-enhanced {
  position: relative;
  overflow: hidden;
}

.theme-toggle-enhanced svg {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
}

.theme-toggle-enhanced:hover svg {
  transform: rotate(20deg) scale(1.1);
}

.theme-toggle-enhanced .sun-icon {
  opacity: 1;
}

.theme-toggle-enhanced .moon-icon {
  opacity: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
}

.dark .theme-toggle-enhanced .sun-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.dark .theme-toggle-enhanced .moon-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* ========== PAGE TRANSITION STYLES ========== */

/* Page Transition Container */
#page-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fade Effect */
.transition-curtain {
  position: absolute;
  inset: 0;
  background: var(--curtain-bg, #ECEBDD);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .transition-curtain {
  --curtain-bg: #13120A;
}

/* Loading Indicator */
.transition-loader {
  position: relative;
  width: 48px;
  height: 48px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

.transition-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  color: var(--loader-color, #121212);
}

.dark .transition-loader::before {
  --loader-color: #ECEBDD;
}

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

/* Active States */
#page-transition-overlay.active {
  pointer-events: auto;
}

#page-transition-overlay.active .transition-curtain {
  opacity: 1;
}

#page-transition-overlay.active .transition-loader {
  opacity: 1;
  transform: scale(1);
}

/* Content Fade */
body.page-transitioning {
  overflow: hidden;
}

.page-content {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.page-fade-out .page-content {
  opacity: 0;
  transform: translateY(-20px);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .transition-curtain,
  .transition-loader,
  .page-content {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  body.page-fade-out .page-content {
    transform: none;
  }
}
