/* 
   Lou Simbèu - Extreme Mobile-First / FULL DRY Patches
   Optimized for viewports as small as 320px (iPhone SE)
*/

:root {
  /* --- Responsive Typography Tokens --- */
  --fs-h1: clamp(1.4rem, 10vw, 8rem);
  --fs-h2: clamp(1.2rem, 8vw, 5rem);
  --fs-h3: clamp(1rem, 6vw, 3rem);
  --fs-body: clamp(0.85rem, 4vw, 1.125rem);

  /* --- Responsive Spacing Tokens --- */
  --inner-padding: clamp(0.4rem, 4vw, 2rem);
  --section-py: clamp(2rem, 8vh, 8rem);

  /* --- Colors & Safety --- */
  --western-leather: #3d2314;
}

/* --- Global Resets & Safety --- */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

html,
body {
  overflow-x: hidden !important;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

section:not(.section-hero) {
  position: relative;
  overflow: hidden !important;
  padding-top: var(--section-py) !important;
  padding-bottom: var(--section-py) !important;
}

/* --- Hero Fixed Distribution System --- */
.section-hero {
  position: relative;
  overflow: hidden !important;
  height: 100svh !important;
  display: flex !important;
  flex-direction: column !important;
}

.section-hero .container-western {
  display: grid !important;
  grid-template-rows: auto 1fr auto !important;
  height: 100% !important;
  padding-top: 5rem !important; /* Fixed space for nav */
  padding-bottom: 3rem !important; /* Fixed space from bottom */
  gap: 1rem !important;
}

.container-western {
  max-width: 1400px;
  margin: 0 auto;
  padding-left: var(--inner-padding) !important;
  padding-right: var(--inner-padding) !important;
  width: 100%;
  box-sizing: border-box;
}

/* --- Typography DRY Overrides --- */
.heading-western-xl {
  font-size: var(--fs-h1) !important;
  line-height: 1 !important;
  text-shadow: 2px 2px 0 var(--western-leather) !important;
  word-break: break-word;
  overflow-wrap: break-word;
}

.heading-western-lg {
  font-size: var(--fs-h2) !important;
  line-height: 1.1 !important;
}

.text-western-body {
  font-size: var(--fs-body) !important;
}

.font-medium {
  font-weight: 500 !important;
}

.font-semibold {
  font-weight: 600 !important;
}

/* --- Mobile Specific Refinements --- */
@media (max-width: 640px) {
  .grid-cols-3,
  .sm\:grid-cols-3,
  .lg\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  #mobile-menu a {
    font-size: clamp(1.1rem, 7vw, 2.5rem) !important;
    line-height: 1.2 !important;
  }

  .btn-western-primary,
  .btn-western-secondary {
    width: 100% !important;
    padding: 0.6rem 0.8rem !important;
    font-size: 0.85rem !important;
    justify-content: center;
  }
}

@media (max-width: 375px) {
  #hero .container-western {
    padding-top: 4.5rem !important;
    padding-bottom: 2rem !important;
  }

  .mobile-link {
    font-size: 1.1rem !important;
  }
  .btn-western-primary span,
  .btn-western-secondary span {
    font-size: 0.8rem !important;
  }
  span,
  a,
  p {
    letter-spacing: normal !important;
  }
  .western-badge {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.5rem !important;
  }
  .w-16.h-16 {
    width: 3rem !important;
    height: 3rem !important;
  }
}

/* Global Adjustments */
.min-h-screen {
  min-height: 100vh;
  min-height: 100svh;
}
img {
  max-width: 100%;
  height: auto;
  content-visibility: auto;
  display: block;
}
.shadow-xl,
.western-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.rope-border {
  max-width: 100vw !important;
  left: 0 !important;
  right: 0 !important;
}

/* --- Centering Fixes --- */
.western-divider.mx-auto {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* --- Navigation Smoothing --- */
#main-nav {
  transition:
    background-color 0.5s ease,
    padding 0.5s ease,
    box-shadow 0.5s ease !important;
}

#main-nav.nav-western {
  background-color: var(--western-leather) !important;
  background-image: none !important; /* Force override of style.css gradient if any */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

/* --- Story Block System (History Page) --- */
.story-block {
  margin-bottom: clamp(4rem, 10vh, 8rem) !important;
}

.story-block:last-child {
  margin-bottom: 0 !important;
}

.story-image-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* --- Western Floating Badges (DRY System) --- */
.western-floating-badge {
  position: absolute !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: clamp(0.5rem, 2vw, 1rem) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3) !important;
  z-index: 20;
}

.western-floating-badge span {
  font-family: var(--font-western);
  text-align: center;
  font-size: 0.75rem;
}

.badge-br {
  bottom: -1rem;
  right: -1rem;
}
.badge-bl {
  bottom: -1rem;
  left: -1rem;
}

@media (min-width: 640px) {
  .badge-br {
    bottom: -1.5rem;
    right: -1.5rem;
  }
  .badge-bl {
    bottom: -1.5rem;
    left: -1.5rem;
  }
}

.badge-dark {
  background-color: var(--western-leather) !important;
  border: 2px solid var(--western-gold) !important;
  color: var(--western-gold) !important;
}

.badge-gold {
  background-color: var(--western-gold) !important;
  border: 2px solid var(--western-leather) !important;
  color: var(--western-leather) !important;
}

.rotate-3 {
  transform: rotate(3deg) !important;
}
.rotate-6 {
  transform: rotate(6deg) !important;
}
.rotate-neg-3 {
  transform: rotate(-3deg) !important;
}
.rotate-neg-12 {
  transform: rotate(-12deg) !important;
}

@media (max-width: 480px) {
  .story-block h2 {
    font-size: clamp(1.2rem, 6vw, 2rem) !important;
  }
  .story-block .text-western-body {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
  }
}

/* --- Grid Area System (Perfect Narrative Ordering) --- */
.story-grid {
  display: grid !important;
  grid-template-areas:
    "caption"
    "title"
    "divider"
    "image"
    "body" !important;
  gap: 1.5rem !important;
}

.area-caption {
  grid-area: caption !important;
}
.area-title {
  grid-area: title !important;
}
.area-divider {
  grid-area: divider !important;
}
.area-image {
  grid-area: image !important;
}
.area-body {
  grid-area: body !important;
}

@media (min-width: 1024px) {
  .story-grid {
    grid-template-columns: 1fr 1fr !important;
    column-gap: clamp(3rem, 8vw, 8rem) !important;
    row-gap: 0.75rem !important; /* Tighten the text stack */
  }

  /* Give the body area a bit more top space specifically */
  .area-body {
    margin-top: 1rem !important;
  }

  .story-grid-left {
    grid-template-areas:
      "caption image"
      "title image"
      "divider image"
      "body image" !important;
  }

  .story-grid-right {
    grid-template-areas:
      "image caption"
      "image title"
      "image divider"
      "image body" !important;
  }
}

@media (max-width: 480px) {
  .story-grid {
    gap: 1rem !important;
  }

  /* FAQ Mobile Adjustments */
  .faq-western span {
    font-size: 0.875rem !important; /* text-sm */
    line-height: normal !important;
  }
}

/* --- Added Missing Utilities for Ride Pages --- */
.pl-4 {
  padding-left: 1rem !important;
}
.pl-8 {
  padding-left: 2rem !important;
}
.pl-12 {
  padding-left: 3rem !important;
}
.pl-16 {
  padding-left: 4rem !important;
}
.pl-20 {
  padding-left: 5rem !important;
}

.pr-8 {
  padding-right: 2rem !important;
}
.pr-12 {
  padding-right: 3rem !important;
}

.gap-16 {
  gap: 4rem !important;
}
.gap-20 {
  gap: 5rem !important;
}
.gap-24 {
  gap: 6rem !important;
}
.gap-32 {
  gap: 8rem !important;
}

.mb-12 {
  margin-bottom: 3rem !important;
}
.mb-16 {
  margin-bottom: 4rem !important;
}
.mb-24 {
  margin-bottom: 6rem !important;
}

.sticky {
  position: sticky !important;
}
.top-24 {
  top: 6rem !important;
}

/* --- Blockquote Margin Fix --- */
blockquote {
  margin-bottom: 5rem !important;
}

/* --- Article Footer Navigation --- */
.article-footer-nav {
  margin-top: 8rem !important; /* mt-32 equivalent */
  padding-top: 2.5rem !important; /* pt-10 equivalent */
  border-top-width: 4px !important;
  border-color: #3d2314 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* --- Article Breadcrumb UI --- */
@media (max-width: 640px) {
  .breadcrumb-western {
    padding: 0.25rem 0 !important;
  }
  .breadcrumb-western nav {
    font-size: 10px !important;
    letter-spacing: 0.05em !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 0.5rem 0 !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex !important;
    align-items: center !important;
  }
  .breadcrumb-western nav::-webkit-scrollbar {
    display: none;
  }
}

/* --- Article Footer Navigation: Action Cards Approach --- */
@media (max-width: 640px) {
  .article-footer-nav {
    flex-direction: column !important;
    gap: 1rem !important;
    margin-top: 4rem !important;
    border: none !important;
    padding-top: 0 !important;
  }

  .article-footer-nav a {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 1rem !important;
    background: #e5cfa8 !important; /* Lighter leather */
    border: 2px solid #3d2314 !important;
    color: #3d2314 !important;
    font-size: 0.9rem !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    box-shadow: 4px 4px 0 #3d2314 !important;
    gap: 0.75rem !important;
    transition: transform 0.2s !important;
  }

  .article-footer-nav a:active {
    transform: translate(2px, 2px) !important;
    box-shadow: 2px 2px 0 #3d2314 !important;
  }

  .article-footer-nav a .w-10.h-10 {
    width: 2.25rem !important;
    height: 2.25rem !important;
    background: #3d2314 !important;
    color: #f4e4bc !important;
    border: none !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Specific style for "Next Article" to make it pop */
  .article-footer-nav a.text-right {
    flex-direction: row-reverse !important;
    text-align: right !important;
    background: #b7410e !important; /* Rust red */
    color: #f4e4bc !important;
    border-color: #d4af37 !important;
    box-shadow: 4px 4px 0 #d4af37 !important;
    justify-content: space-between !important;
  }

  .article-footer-nav a.text-right .w-10.h-10 {
    background: #f4e4bc !important;
    color: #b7410e !important;
  }
}
