/* ==========================================
   ELVO/VIZIBIL ENHANCEMENTS - Design & UX Improvements
   Modern animations, dark mode, improved accessibility
   ========================================== */

/* === CSS CUSTOM PROPERTIES FOR THEME SWITCHING === */
:root {
  /* Light mode colors (default) */
  --paper: #f8f9f3;
  --white: #fff;
  --ink: #173a2c;
  --forest: #214d3b;
  --deep: #123628;
  --lime: #c8f16b;
  --sage: #eaf0e2;
  --lilac: #eeebf8;
  --muted: #667568;
  --line: #dce2d6;
  
  /* Shadows with better depth */
  --shadow-sm: 0 2px 8px rgba(18, 54, 40, 0.06);
  --shadow: 0 20px 55px rgba(18, 54, 40, 0.08);
  --shadow-lg: 0 30px 70px rgba(18, 54, 40, 0.12);
  --shadow-xl: 0 40px 90px rgba(18, 54, 40, 0.16);
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Animations */
  --animation-duration: 0.6s;
  --animation-easing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* === DARK MODE THEME === */
[data-theme="dark"] {
  --paper: #0f1612;
  --white: #1a2420;
  --ink: #e8f0eb;
  --forest: #3d7a5c;
  --deep: #2d5844;
  --lime: #b8e055;
  --sage: #1f2d25;
  --lilac: #2a2733;
  --muted: #a0afa3;
  --line: #2a3832;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 40px 90px rgba(0, 0, 0, 0.6);
}

/* Dark mode specific adjustments */
[data-theme="dark"] body {
  background: var(--paper);
  color: var(--ink);
}

[data-theme="dark"] .site-header {
  background: rgba(15, 22, 18, 0.95);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

[data-theme="dark"] .button-primary {
  box-shadow: 0 4px 16px rgba(184, 224, 85, 0.25);
}

[data-theme="dark"] .button-primary:hover {
  box-shadow: 0 6px 24px rgba(184, 224, 85, 0.35);
}

[data-theme="dark"] .art-dashboard {
  box-shadow: 6px 20px 0 rgba(184, 224, 85, 0.15);
}

[data-theme="dark"] img {
  opacity: 0.9;
  transition: opacity var(--transition-base);
}

[data-theme="dark"] img:hover {
  opacity: 1;
}

/* === DARK MODE TOGGLE BUTTON === */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-base), transform var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--sage);
  transform: scale(1.05);
}

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

.theme-toggle svg {
  width: 22px;
  height: 22px;
  color: var(--forest);
  transition: transform var(--transition-smooth), opacity var(--transition-base);
}

.theme-toggle .icon-sun {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-toggle .icon-moon {
  position: absolute;
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* === ENHANCED ANIMATIONS === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Intersection Observer animation classes */
.animate-on-scroll {
  opacity: 0;
}

.animate-on-scroll.animate-in {
  animation: fadeInUp var(--animation-duration) var(--animation-easing) forwards;
}

.animate-fade-in {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in-delay-1 {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.animate-fade-in-delay-2 {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.animate-fade-in-delay-3 {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

/* === MICRO-INTERACTIONS === */

/* Enhanced button interactions */
.button {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

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

.button:active::before {
  width: 300px;
  height: 300px;
}

/* Card hover effects */
.service-card,
.price-card,
.industry-card,
.case-card {
  transition: all var(--transition-base);
  position: relative;
}

.service-card::after,
.price-card::after,
.industry-card::after,
.case-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(200, 241, 107, 0.1) 0%,
    transparent 50%
  );
}

.service-card:hover::after,
.price-card:hover::after,
.industry-card:hover::after,
.case-card:hover::after {
  opacity: 1;
}

/* Enhanced focus states for accessibility */
*:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
  transition: outline-offset var(--transition-fast);
}

a:focus-visible,
button:focus-visible {
  outline-offset: 6px;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* === IMPROVED LOADING STATES === */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--line) 0px,
    rgba(200, 241, 107, 0.1) 40px,
    var(--line) 80px
  );
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
}

/* === SCROLL INDICATORS === */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--lime) 0%,
    var(--forest) 100%
  );
  transform-origin: left;
  z-index: 9999;
  transition: transform var(--transition-fast);
}

/* === IMPROVED FORM ELEMENTS === */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  transition: all var(--transition-base);
  border: 2px solid var(--line);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(33, 77, 59, 0.1);
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="tel"]:focus,
[data-theme="dark"] input[type="url"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 4px rgba(61, 122, 92, 0.2);
}

/* === ENHANCED TOOLTIPS === */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 8px 12px;
  background: var(--deep);
  color: var(--lime);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-base);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--deep);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-base);
}

[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* === IMPROVED NAVIGATION ANIMATIONS === */
.nav-link {
  position: relative;
  transition: color var(--transition-base);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--lime);
  transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link.is-current::after {
  width: 100%;
}

/* === ENHANCED HERO SLIDER === */
.hero-slide {
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.hero-slide:not(.is-active) {
  opacity: 0;
  transform: translateX(-30px);
}

.hero-dot {
  position: relative;
  transition: all var(--transition-base);
  overflow: hidden;
}

.hero-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lime);
  transform: scale(0);
  transition: transform var(--transition-base);
  border-radius: inherit;
}

.hero-dot.is-active::before {
  transform: scale(1);
}

/* === RESPONSIVE ENHANCEMENTS === */
@media (max-width: 980px) {
  .theme-toggle {
    width: 44px;
    height: 44px;
  }
  
  .theme-toggle svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 720px) {
  .theme-toggle {
    width: 40px;
    height: 40px;
  }
  
  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }
  
  /* Reduce animation complexity on mobile */
  .animate-on-scroll {
    animation-duration: 0.4s !important;
  }
}

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

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--forest);
  color: var(--lime);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 20px;
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}

/* Screen reader only content */
.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;
}

/* Focus trap for modals */
[role="dialog"] {
  animation: slideInUp var(--transition-slow) var(--animation-easing);
}

/* Keyboard navigation indicators */
:focus-visible {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--lime);
  transition: box-shadow var(--transition-fast);
}

/* === PRINT STYLES === */
@media print {
  .theme-toggle,
  .scroll-indicator,
  .mobile-toggle,
  .demo-strip {
    display: none !important;
  }
  
  [data-theme="dark"] {
    --paper: #fff;
    --ink: #000;
    --forest: #214d3b;
  }
}

/* === REDUCED MOTION PREFERENCES === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-on-scroll,
  .hero-slide,
  .hero-art-slide-wrap {
    animation: none !important;
  }

  /* Never leave scroll-reveal content hidden for reduced-motion users. */
  .animate-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
  :root {
    --line: #999;
    --muted: #333;
  }
  
  .button {
    border: 2px solid currentColor;
  }
  
  a:not(.button) {
    text-decoration: underline;
  }
}

/* ==========================================
   DARK MODE REFINEMENTS — surface colors that
   site.css hardcodes for the light palette are
   remapped to the token values below so the
   dark theme stays consistent and contrast-safe.
   ========================================== */
[data-theme="dark"] {
  --paper-soft: #141e19;
  --surface-1: #1a2420;
  --surface-2: #1f2d25;
  --text-soft: #a4b3a6;
}

[data-theme="dark"] body {
  background: var(--paper);
}

[data-theme="dark"] .site-header {
  background: rgba(15, 22, 18, 0.92);
}

[data-theme="dark"] .mega-menu {
  background: var(--paper);
  border-color: var(--line);
}

[data-theme="dark"] .guide-nav,
[data-theme="dark"] .bento-nav,
[data-theme="dark"] .path-nav {
  background: var(--paper-soft);
  border-color: var(--line);
}

[data-theme="dark"] .guide-nav a,
[data-theme="dark"] .bento-nav a,
[data-theme="dark"] .path-nav a {
  background: var(--surface-1);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .guide-nav a:hover,
[data-theme="dark"] .bento-nav a:hover,
[data-theme="dark"] .path-nav a:hover {
  border-color: var(--forest);
}

[data-theme="dark"] .calculator-main {
  background: var(--surface-1);
}

[data-theme="dark"] .calculator-progress {
  background: var(--surface-2);
}

[data-theme="dark"] .choice-card {
  background: var(--surface-1);
  border-color: var(--line);
}

[data-theme="dark"] .choice-card:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--forest);
}

[data-theme="dark"] .choice-icon {
  background: var(--surface-2);
  color: var(--lime);
}

[data-theme="dark"] .choice-card small,
[data-theme="dark"] .step-tab {
  color: var(--muted);
}

[data-theme="dark"] .review-empty,
[data-theme="dark"] .news-empty {
  background: var(--surface-2);
}

[data-theme="dark"] .review-quote {
  background: var(--surface-1);
  color: var(--lime);
}

[data-theme="dark"] .about-statement {
  background: var(--surface-2);
}

[data-theme="dark"] .about-values > span {
  border-color: var(--line);
}

[data-theme="dark"] .services-duo-against,
[data-theme="dark"] .services-excluded {
  background: var(--surface-1);
  border-color: var(--line);
}

[data-theme="dark"] .services-duo-against .services-duo-title {
  color: var(--muted);
}

[data-theme="dark"] .inline-note,
[data-theme="dark"] .legal-note,
[data-theme="dark"] .services-compare-note {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text-soft);
}

[data-theme="dark"] .highlight-row {
  border-block-color: var(--line);
}

[data-theme="dark"] .hero-assurances {
  color: var(--muted);
}

[data-theme="dark"] .breadcrumbs {
  color: var(--muted);
}

[data-theme="dark"] .breadcrumbs > a {
  color: var(--forest);
}

[data-theme="dark"] .contact-card {
  background: var(--surface-1);
}

[data-theme="dark"] .contact-card-num {
  background: var(--surface-2);
  color: var(--lime);
}

[data-theme="dark"] .footer-column a {
  color: var(--text-soft);
}

[data-theme="dark"] .art-dashboard {
  box-shadow: 6px 20px 0 rgba(184, 224, 85, 0.18);
}

[data-theme="dark"] .phd-acc-tag {
  background: var(--paper);
  color: var(--forest);
}

[data-theme="dark"] .empty-results {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="dark"] .art-cube,
  [data-theme="dark"] .phd-cube-a,
  [data-theme="dark"] .phd-cube-b,
  [data-theme="dark"] .phd-cube-c,
  [data-theme="dark"] .phd-acc-chip-float {
    animation: none !important;
  }
}
