/* LunaryInk - Main Stylesheet */

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

/* Body scroll lock for mobile menu */
body.menu-open {
  overflow: hidden;
}

/* Base typography */
body {
  font-size: 16px;
  line-height: 1.6;
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #334e68;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.75rem 1.5rem;
  background: #102a43;
  color: white;
  z-index: 9999;
  font-weight: 600;
}

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

/* Mobile menu transitions */
#mobile-menu {
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

#mobile-menu.active {
  opacity: 1;
  pointer-events: auto;
}

#mobile-menu > div:last-child {
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

#mobile-menu.active > div:last-child {
  transform: translateX(0);
}

/* Animated gradient for hero */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

/* Table responsive wrapper */
.table-wrapper {
  -webkit-overflow-scrolling: touch;
}

/* Card hover lift effect */
.card-hover:hover {
  transform: translateY(-4px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Quiz progress bar */
.quiz-progress {
  transition: width 0.5s ease;
}

/* Cookie consent animation */
#cookie-consent {
  animation: slideInUp 0.4s ease-out;
}

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

/* Newsletter success/error states */
#newsletter-success,
#newsletter-error {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: #627d98;
}

/* Form input states */
input:invalid:not(:placeholder-shown) {
  border-color: #e53e3e;
}

input:valid:not(:placeholder-shown) {
  border-color: #38a169;
}

textarea:invalid:not(:placeholder-shown) {
  border-color: #e53e3e;
}

textarea:valid:not(:placeholder-shown) {
  border-color: #38a169;
}

/* Button active states */
button:active {
  transform: scale(0.98);
}

/* Link underline animation */
.link-animated {
  position: relative;
  text-decoration: none;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #102a43;
  transition: width 0.3s ease;
}

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

/* Comparison table row highlight */
table tbody tr {
  transition: background-color 0.2s ease;
}

/* Print styles */
@media print {
  header,
  footer,
  #cookie-consent,
  #mobile-menu,
  .no-print {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }
}

/* Responsive image fallback */
img[src=""] {
  background: linear-gradient(135deg, #d9e2ec 0%, #bcccdc 100%);
  min-height: 120px;
  display: block;
}

/* Selection color */
::selection {
  background: #334e68;
  color: white;
}

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

  html {
    scroll-behavior: auto;
  }
}

/* Quiz option cards */
.quiz-option {
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-option:hover {
  border-color: #334e68;
  background-color: #f0f4f8;
}

.quiz-option.selected {
  border-color: #102a43;
  background-color: #d9e2ec;
}

/* Rating stars */
.rating-star {
  color: #d9e2ec;
}

.rating-star.filled {
  color: #d69e2e;
}

/* Sticky header shadow on scroll */
header.scrolled {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Tooltip styles */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: #102a43;
  color: white;
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  margin-bottom: 4px;
}

.tooltip:hover::after {
  opacity: 1;
}
