/* SEO and Performance Optimizations */

/* Critical CSS for above-the-fold content */
body {
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
  line-height: 1.6;
  color: #374151;
  background-color: #F9FAFB;
}

/* Improve text rendering */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Optimize images for better loading */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lazy loading optimization */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #2563EB;
  outline-offset: 2px;
}

/* Skip to main content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #2563EB;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* Reduce motion 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;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .text-text-muted {
    color: #000000;
  }
  
  .bg-background-light {
    background-color: #ffffff;
  }
}

/* 定價區域樣式 */
.pricing-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.pricing-popular {
  position: relative;
  background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
}

.pricing-popular::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #10b981, #059669, #2563eb, #1d4ed8);
  border-radius: 18px;
  z-index: -1;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% {
    background: linear-gradient(135deg, #10b981, #059669, #2563eb, #1d4ed8);
  }
  50% {
    background: linear-gradient(135deg, #2563eb, #1d4ed8, #10b981, #059669);
  }
}

.pricing-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.4);
}

.pricing-button {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.pricing-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.pricing-button:hover::before {
  left: 100%;
}

.pricing-feature-list {
  position: relative;
}

.pricing-feature-list::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e5e7eb, #10b981, #e5e7eb);
  border-radius: 1px;
}

/* 響應式調整 */
@media (max-width: 768px) {
  .pricing-card {
    margin-bottom: 2rem;
  }

  .pricing-popular {
    transform: none;
    margin: 0;
  }
}

/* 動畫效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pricing-card {
  animation: fadeInUp 0.6s ease-out;
}

.pricing-card:nth-child(1) { animation-delay: 0.1s; }
.pricing-card:nth-child(2) { animation-delay: 0.2s; }
.pricing-card:nth-child(3) { animation-delay: 0.3s; }
.pricing-card:nth-child(4) { animation-delay: 0.4s; }

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

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

  a {
    text-decoration: underline;
  }

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

/* Optimize for mobile performance */
@media (max-width: 768px) {
  .hero-grid-background::before {
    animation: none; /* Disable animation on mobile for better performance */
  }
}

/* Improve button and interactive element accessibility */
button,
[role="button"] {
  cursor: pointer;
  min-height: 44px; /* Minimum touch target size */
  min-width: 44px;
}

/* Ensure proper heading hierarchy */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Optimize for Core Web Vitals */
.container {
  contain: layout style paint;
}

/* Preload critical resources */
.critical-resource {
  font-display: swap;
}

/* Optimize scrolling performance */
.smooth-scroll {
  scroll-behavior: smooth;
}

@supports (scroll-behavior: smooth) {
  html {
    scroll-behavior: smooth;
  }
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #2563EB;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* Optimize for search engine crawlers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Structured data visibility */
script[type="application/ld+json"] {
  display: none;
}
