/* Advanced Blog Layout Enhancements */
/* Modern design improvements for SPHYNX Tequila Blog */

/* Advanced Grid System */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Masonry-style layout for larger screens */
@media (min-width: 768px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

@media (min-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
  }
  
  /* Staggered heights for visual interest */
  .blog-card:nth-child(even):not(.featured-post) {
    transform: translateY(1rem);
  }
  
  .blog-card:nth-child(3n):not(.featured-post) {
    transform: translateY(-0.5rem);
  }
}

/* Enhanced Card Animations */
.blog-card {
  opacity: 0;
  transform: translateY(30px);
  animation: cardSlideIn 0.8s ease forwards;
}

.blog-card:nth-child(1) { animation-delay: 0.1s; }
.blog-card:nth-child(2) { animation-delay: 0.2s; }
.blog-card:nth-child(3) { animation-delay: 0.3s; }
.blog-card:nth-child(4) { animation-delay: 0.4s; }
.blog-card:nth-child(5) { animation-delay: 0.5s; }
.blog-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes cardSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progressive Enhancement: Image Loading States */
.blog-card-image {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  position: relative;
  overflow: hidden;
}

.blog-card-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23C6A57C"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17l2.5-3.15L14 17H9zm4.5-6L17 15h-1l-2.5-4z"/></svg>') no-repeat center;
  opacity: 0.3;
}

.blog-card-image[src]:not([src=""]):not([src*="logo.svg"])::before {
  display: none;
}

/* Advanced Hover Effects */
.blog-card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: 0 25px 50px rgba(198, 165, 124, 0.2);
  border-color: var(--primary-gold);
}

/* Parallax effect for card images */
@media (min-width: 768px) {
  .blog-card:hover .blog-card-image {
    transform: scale(1.1) translateY(-5px);
  }
}

/* Enhanced Category Pills with Shimmer Effect */
.blog-card-category {
  position: relative;
  overflow: hidden;
}

.blog-card-category::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

.blog-card:hover .blog-card-category::before {
  left: 100%;
}

/* Dynamic Content Accent Lines */
.blog-card-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-content::before {
  transform: scaleX(1);
}

/* Reading Progress Indicator */
.blog-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-gold), var(--dark-gold));
  z-index: 1000;
  transition: width 0.1s ease;
  box-shadow: 0 2px 8px rgba(198, 165, 124, 0.3);
}

/* Enhanced Typography with Better Spacing */
.blog-title {
  font-family: 'CASTELAR', serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  background: linear-gradient(135deg, var(--accent-black) 0%, var(--primary-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 1rem 0;
  text-align: center;
  line-height: 1.2;
}

.blog-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: var(--text-secondary);
  font-weight: 300;
  text-align: center;
  margin: 0 0 3rem 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Enhanced Search Bar */
.blog-search-input {
  width: 100%;
  padding: 1.2rem 2rem;
  background: var(--white);
  border: 2px solid rgba(198, 165, 124, 0.2);
  border-radius: 50px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.blog-search-input:focus {
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 3px rgba(198, 165, 124, 0.2), 0 8px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.blog-search-input::placeholder {
  color: var(--text-light);
  font-style: italic;
}

/* Enhanced Category Filters */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

.category-pill {
  padding: 0.8rem 1.8rem;
  background: var(--white);
  border: 2px solid rgba(198, 165, 124, 0.2);
  border-radius: 30px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.category-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-gold), var(--dark-gold));
  transition: left 0.3s ease;
  z-index: -1;
}

.category-pill:hover,
.category-pill.active {
  color: var(--white);
  border-color: var(--primary-gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(198, 165, 124, 0.4);
}

.category-pill:hover::before,
.category-pill.active::before {
  left: 0;
}

/* Loading State Enhancements */
.blog-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 300px;
  grid-column: 1 / -1;
}

.blog-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(198, 165, 124, 0.2);
  border-top: 4px solid var(--primary-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.blog-loading-text {
  font-family: 'Montserrat', sans-serif;
  color: var(--text-secondary);
  font-size: 0.9rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Enhanced Newsletter Section */
.newsletter-section {
  text-align: center;
  margin-top: 4rem;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--white) 0%, rgba(198, 165, 124, 0.05) 100%);
  border: 2px solid rgba(198, 165, 124, 0.2);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.newsletter-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-gold), var(--dark-gold));
}

.newsletter-section h3 {
  font-family: 'Cormorant', serif;
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary-gold) 0%, var(--dark-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.newsletter-section p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Enhanced CTA Button */
.blog-cta-button {
  display: inline-block;
  padding: 1.2rem 2.5rem;
  background: linear-gradient(135deg, var(--accent-black) 0%, var(--primary-gold) 100%);
  color: var(--white);
  text-decoration: none;
  border-radius: 50px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.blog-cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-gold) 0%, var(--accent-black) 100%);
  transition: left 0.3s ease;
  z-index: -1;
}

.blog-cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(198, 165, 124, 0.4);
  text-decoration: none;
  color: var(--white);
}

.blog-cta-button:hover::before {
  left: 0;
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-gold), var(--dark-gold));
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 20px rgba(198, 165, 124, 0.3);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(198, 165, 124, 0.5);
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
  .blog-container {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-color: rgba(198, 165, 124, 0.3);
  }

  .blog-card {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(198, 165, 124, 0.2);
  }

  .blog-card:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-gold);
  }

  .blog-title {
    filter: brightness(1.2);
  }

  .blog-search-input {
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    border-color: rgba(198, 165, 124, 0.3);
  }

  .blog-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
  }

  .category-pill {
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    border-color: rgba(198, 165, 124, 0.3);
  }

  .newsletter-section {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(198, 165, 124, 0.3);
  }
}

/* Print Optimizations */
@media print {
  .blog-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }

  .blog-card-image {
    max-height: 150px;
  }

  .blog-cta-button,
  .category-filters,
  .blog-search,
  .scroll-to-top {
    display: none;
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  .blog-card,
  .category-pill,
  .blog-cta-button,
  .scroll-to-top {
    transition: none;
    animation: none;
    transform: none !important;
  }

  .blog-reading-progress {
    transition: none;
  }
}

/* High Contrast Mode */
@media (prefers-high-contrast: high) {
  .blog-container,
  .blog-card,
  .category-pill {
    border-width: 2px;
    border-style: solid;
  }

  .blog-card:hover {
    outline: 3px solid;
  }
}

/* Focus Management for Keyboard Navigation */
.blog-card:focus,
.category-pill:focus,
.blog-cta-button:focus {
  outline: 3px solid var(--primary-gold);
  outline-offset: 2px;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .blog-grid {
    padding: 0 1rem;
  }

  .blog-card {
    margin-bottom: 1rem;
  }

  .newsletter-section {
    margin: 2rem 1rem;
    padding: 2rem 1rem;
  }

  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}
