/* ============================================================
   SOY ALHAMA — Visual Identity Layer
   Creative design enhancements — purely additive, breaks nothing
   Inspired by: Andalusian light, terracotta pottery, Mediterranean sea
   ============================================================ */

/* ============================================================
   1. CUSTOM SCROLLBAR — Brand-colored
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--sand);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--terracotta), var(--terracotta-dark));
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, var(--terracotta-light), var(--terracotta));
}

/* Firefox scrollbar */
html {
  scrollbar-color: var(--terracotta) var(--sand);
  scrollbar-width: thin;
}

/* ============================================================
   ALTERNATING SECTION RHYTHM — Blanc / Saumon
   Enforces the warm alternating pattern across ALL pages
   ============================================================ */

/* Default: all main sections get alternating backgrounds */
main > section:nth-of-type(odd) {
  background-color: var(--off-white);
}

main > section:nth-of-type(even) {
  background-color: var(--sand);
}

/* Preserve dark header sections (listing-header, histoire, etc.) */
main > section.listing-header,
main > section.histoire {
  background-color: var(--black-soft) !important;
}

/* Preserve terracotta gradient headers (patrimonio, etc.) */
main > section[style*="linear-gradient"] {
  /* don't override inline gradient backgrounds */
}

/* Monument detail sections: enforce the strict alternating pattern */
main > section.monument-detail:nth-of-type(odd) {
  background-color: var(--off-white);
}

main > section.monument-detail:nth-of-type(even) {
  background-color: var(--sand);
}

/* Smooth transitions between sections */
main > section {
  transition: background-color 0.3s var(--ease-smooth);
}

/* --- Content Pages (Guide, Que faire) ---
   These pages use a single container layout without
   separate sections. We create the blanc/saumon rhythm
   using alternating full-width visual breaks.
   ============================================= */

/* Content body: alternate guide-grid backgrounds */
.content-body .guide-grid:nth-of-type(odd) {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}

.content-body .guide-grid:nth-of-type(even) {
  background: var(--off-white);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}

/* Thermes showcases on content pages: alternate warm background */
.content-body .thermes-showcase:nth-of-type(odd) {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
}

/* Activities grid warm background */
.content-body .activities-grid {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
}

/* Content hero: warm vignette effect */
.content-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px 20px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  border-radius: var(--radius-lg);
  z-index: 1;
}

/* Timeline: warm sand background band */
.content-body .timeline {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-xl) var(--space-xl) var(--space-xl) calc(var(--space-xl) + var(--space-2xl));
  border-radius: var(--radius-lg);
}

/* Content image breaks: no background, clean display */
.content-body .content-image-break {
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
}

/* Related links: warm background */
.content-body .related-links {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}

/* Patrimoine block: warm sand background for heritage section */
.patrimoine-block {
  background: var(--sand);
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  padding: var(--space-xl) var(--space-xl);
  border-radius: var(--radius-lg);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.patrimoine-block h2 {
  margin-top: var(--space-lg);
}

.patrimoine-block h2:first-child {
  margin-top: 0;
}

.patrimoine-block h3 {
  color: var(--terracotta);
}

/* ============================================================
   2. AMBIENT GRAIN TEXTURE — Warm photographic feel
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ============================================================
   3. ANIMATED SECTION LABELS — Terracotta accent line grows in
   ============================================================ */
.section-label::before {
  width: 0;
  transition: width 0.8s var(--ease-out-expo);
}

.visible .section-label::before,
.listing-header .section-label::before,
section:not(.reveal):not(.stagger-children) .section-label::before {
  width: 28px;
}

/* Decorative dot after section label text */
.section-label::after {
  content: '·';
  margin-left: var(--space-xs);
  color: var(--terracotta-light);
  font-size: 1.2em;
  animation: sectionDot 2s ease-in-out infinite;
}

@keyframes sectionDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   4. HERO ENHANCEMENTS — Cinematic depth
   ============================================================ */

/* Cinematic overlay layering */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.2) 100%);
  box-shadow: inset 0 0 200px 50px rgba(0, 0, 0, 0.3);
}

.hero-overlay {
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.5) 0%,
    rgba(10, 10, 10, 0.2) 40%,
    rgba(10, 10, 10, 0.5) 85%,
    var(--off-white) 100%
  );
}

/* Hero title: Dramatic Scale & Accents */
.hero-title {
  font-size: clamp(3.5rem, 10vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
  text-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 0, 0, 0.3),
    0 0 80px rgba(0, 0, 0, 0.2);
  line-height: 0.95;
  margin-bottom: var(--space-lg);
}

.hero-title em {
  display: block;
  font-family: var(--ff-heading);
  font-weight: 400;
  font-style: italic;
  font-size: 0.9em;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--gold-light), #fff, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: -0.1em;
  filter: drop-shadow(0 2px 10px rgba(196, 106, 58, 0.2));
}

/* Floating animation for content groups */
.hero-content {
  animation: heroFloat 8s ease-in-out infinite;
}

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

/* Hero description: Editorial feel */
.hero-description {
  font-size: var(--fs-body-lg);
  max-width: 620px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 400;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: var(--space-2xl);
}

/* Parallax-like subtle movement on hero badge */
.hero-badge {
  border-color: rgba(196, 106, 58, 0.25);
}

/* ============================================================
   5. CARD ENHANCEMENTS — Premium hover states
   ============================================================ */

/* Gradient shine on card images */
.listing-card .card-image::after,
.card .card-image::after,
.experience-card .card-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 60%
  );
  background-size: 250% 250%;
  transition: background-position 0.6s var(--ease-smooth);
  pointer-events: none;
  z-index: 1;
}

.listing-card:hover .card-image::after,
.card:hover .card-image::after,
.experience-card:hover .card-header::after {
  background-position: 100% 100%;
}

/* Warm accent line appears at bottom of cards on hover */
.listing-card::after {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(to right, var(--terracotta), var(--terracotta-light), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out-expo);
}

.listing-card:hover::after {
  transform: scaleX(1);
}

/* Activity cards get a warm glow on hover */
.activity-card:hover {
  box-shadow: 0 8px 32px rgba(196, 106, 58, 0.12),
              0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Guide cards: decorative left border on hover */
.guide-card {
  border-left: 3px solid transparent;
  transition: all var(--duration-normal) var(--ease-smooth),
              border-left-color 0.4s var(--ease-smooth);
}

.guide-card:hover {
  border-left-color: var(--terracotta);
}

/* ============================================================
   6. BUTTON MICRO-INTERACTIONS — Springy & alive
   ============================================================ */

/* Active press effect */
.btn:active {
  transform: translateY(0) scale(0.97) !important;
  transition-duration: 80ms;
}

/* Subtle shine sweep on primary buttons */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s var(--ease-smooth);
  pointer-events: none;
}

.btn-primary:hover::before {
  left: 125%;
}

/* Filter chip active: slight scale */
.filter-chip.active {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(196, 106, 58, 0.25);
}

/* ============================================================
   7. SECTION DIVIDERS — Andalusian wave pattern
   ============================================================ */

/* Warm wave between sections */
.listing-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--off-white);
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1200 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40V20C200 0 400 0 600 20S1000 40 1200 20V40z' fill='%23fff'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1200 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40V20C200 0 400 0 600 20S1000 40 1200 20V40z' fill='%23fff'/%3E%3C/svg%3E");
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  z-index: 2;
}

/* Decorative pattern dots in sand-background sections */
[style*="background: var(--sand)"]::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(circle, var(--terracotta) 1px, transparent 1px);
  background-size: 28px 28px;
}

[style*="background: var(--sand)"] {
  position: relative;
}

/* ============================================================
   8. NAVBAR LOGO ENHANCEMENT — Warm accent
   ============================================================ */

/* Logo icon warm pulse */
.nav-logo svg {
  transition: transform 0.3s var(--ease-spring), filter 0.3s;
}

.nav-logo:hover svg {
  transform: rotate(12deg) scale(1.1);
  filter: drop-shadow(0 0 6px rgba(196, 106, 58, 0.4));
}

/* Active nav link: terracotta underline glows */
.navbar.scrolled .nav-link.active::after {
  box-shadow: 0 2px 8px rgba(196, 106, 58, 0.3);
}

/* ============================================================
   9. FOOTER ENHANCEMENT — Star-lit Andalusian night
   ============================================================ */

/* Starfield pattern in footer */
.footer {
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 25% 45%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 40% 20%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 55% 60%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 10%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 80% 35%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 90% 50%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 15% 70%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 35% 85%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 60% 75%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 85% 80%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 5% 50%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 50% 5%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 95% 25%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 45% 40%, rgba(255, 255, 255, 0.4), transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.1; }
  100% { opacity: 0.2; }
}

/* Footer brand: subtle terracotta accent */
.footer-brand h3 {
  background: linear-gradient(135deg, #fff, var(--terracotta-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   10. BADGE ENHANCEMENTS — Glassmorphism upgrade
   ============================================================ */

.badge-type {
  border: 1px solid rgba(196, 106, 58, 0.15);
}

.badge-price {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================
   11. FEATURE TAGS — Subtle warmth
   ============================================================ */

.feature-tag {
  transition: all 0.2s var(--ease-smooth);
}

.feature-tag:hover {
  background: var(--sand);
  color: var(--terracotta-dark);
  transform: translateY(-1px);
}

/* ============================================================
   12. STATS — Animated gradient numbers
   ============================================================ */

.stat-number {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   13. IMAGE HOVER — Warm color wash
   ============================================================ */

.listing-card .card-image img,
.experience-card .card-header img,
.galerie-item img {
  filter: saturate(1.05) contrast(1.02);
}

.listing-card:hover .card-image img,
.experience-card:hover .card-header img {
  filter: saturate(1.15) contrast(1.05) brightness(1.03);
}

/* ============================================================
   14. BREADCRUMBS — Styled separator
   ============================================================ */

.listing-header .breadcrumbs .separator {
  color: var(--terracotta-light);
  font-weight: 700;
}

/* ============================================================
   15. TYPOGRAPHY FLOURISH — Elegant heading accents
   ============================================================ */

/* Section titles in dark background get subtle warm shadow */
.histoire .section-title,
.listing-header .section-title {
  text-shadow: 0 2px 20px rgba(196, 106, 58, 0.15);
}

/* Italic emphasis in headings */
.hero-title em,
.section-title em {
  background: linear-gradient(135deg, var(--sand), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   16. MOBILE MENU — Premium overlay
   ============================================================ */

.mobile-menu.open .nav-link {
  animation: menuSlideIn 0.5s var(--ease-out-expo) both;
}

.mobile-menu.open .nav-link:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu.open .nav-link:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu.open .nav-link:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu.open .nav-link:nth-child(4) { animation-delay: 0.2s; }
.mobile-menu.open .nav-link:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu.open .nav-link:nth-child(6) { animation-delay: 0.3s; }
.mobile-menu.open .nav-link:nth-child(7) { animation-delay: 0.35s; }

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

/* ============================================================
   17. SCROLL INDICATOR — Enhanced glow
   ============================================================ */

.scroll-line {
  background: linear-gradient(
    to bottom,
    rgba(196, 106, 58, 0.6),
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

/* ============================================================
   18. SELECTION COLOR — Warmer
   ============================================================ */

::selection {
  background: rgba(196, 106, 58, 0.25);
  color: var(--black-soft);
}

/* ============================================================
   19. CONTENT BLOCKQUOTE — Editorial styling
   ============================================================ */

.content-body blockquote {
  border-left-width: 4px;
  border-image: linear-gradient(to bottom, var(--terracotta), var(--gold)) 1;
  background: linear-gradient(135deg, rgba(245, 230, 211, 0.3), transparent);
  padding: var(--space-md) var(--space-lg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ============================================================
   20. EVENT DATE — Enhanced visual weight
   ============================================================ */

.event-date {
  background: linear-gradient(135deg, var(--sand), var(--sand-dark));
  border: 1px solid rgba(196, 106, 58, 0.1);
}

/* ============================================================
   21. LOADING SHIMMER FOR LAZY IMAGES
   ============================================================ */

.listing-card .card-image,
.experience-card .card-header,
.galerie-item {
  background: linear-gradient(
    90deg,
    var(--gray-100) 25%,
    var(--gray-50) 50%,
    var(--gray-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

/* Stop shimmer once image loads */
.listing-card .card-image:has(img[src]),
.experience-card .card-header:has(img[src]),
.galerie-item:has(img[src]) {
  animation: none;
  background: var(--gray-100);
}

/* ============================================================
   22. MAP BUTTON — Location pin animation
   ============================================================ */

.btn-map {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-spring) !important;
}

.btn-map:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(196, 106, 58, 0.3);
}

/* ============================================================
   23. PRINT STYLES — Clean output
   ============================================================ */

@media print {
  body::before,
  .footer::before,
  .listing-header::after,
  [style*="background: var(--sand)"]::before {
    display: none !important;
  }
}

/* ============================================================
   24. REDUCED MOTION — Respect user preferences
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .section-label::after,
  .footer::before,
  .scroll-line,
  .btn-primary::before {
    animation: none !important;
  }

  .listing-card::after,
  .guide-card,
  .feature-tag,
  .btn-map {
    transition: none !important;
  }
}
