/* ============================================
   BOISEXPRESS — Base Styles
   Reset, Typography, Utilities
   ============================================ */

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Ancres défilantes — compense la navbar fixe + bannière promo */
  scroll-padding-top: calc(var(--chrome-offset, 105px) + 0.75rem);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--background);
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ─── Page offset — pages sans hero (FAQ, CGV, Panier, Guide…) ─── */
.page-content,
.page-main,
main[class*="page"] {
  padding-top: calc(var(--chrome-offset, 105px) + 2rem);
}

@media (max-width: 768px) {
  .page-content,
  .page-main,
  main[class*="page"] {
    padding-top: calc(var(--chrome-offset, 105px) + 1.25rem);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

/* iOS Safari WebKit Auto-Zoom Prevention (strictly >= 16px) */
input, select, textarea {
  font-size: max(16px, 1rem);
  -webkit-appearance: none;
  border-radius: 0;
}

button {
  cursor: pointer;
}

a, button, input, textarea, select, summary, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

strong {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-sm);
}

/* ─── Responsive Typography ─── */
@media (min-width: 768px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-3xl); }
}

@media (min-width: 1280px) {
  h1 { font-size: var(--text-6xl); }
  h2 { font-size: var(--text-5xl); }
  h3 { font-size: var(--text-3xl); }
}

/* ─── Layout Utilities ─── */
.container {
  width: 100%;
  max-width: var(--max-width-xl);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-8);
  }
}

.section {
  padding: var(--space-16) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-20) 0;
  }
}

@media (min-width: 1280px) {
  .section {
    padding: var(--space-24) 0;
  }
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-4);
  color: var(--primary);
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-lg);
  max-width: 640px;
  margin: 0 auto var(--space-12);
}

/* ─── Flex / Grid Utilities ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Text Utilities ─── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-white { color: #FFFFFF; }
.font-heading { font-family: var(--font-heading); }
.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.uppercase { text-transform: uppercase; letter-spacing: var(--tracking-wider); }

/* ─── Spacing Utilities ─── */
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* ─── Visibility ─── */
.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;
}

.hidden { display: none !important; }

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}

/* ─── GSAP Animation Base Classes ─── */
.gsap-fade-up {
  opacity: 0;
  transform: translateY(40px);
}

.gsap-fade-in {
  opacity: 0;
}

.gsap-scale-in {
  opacity: 0;
  transform: scale(0.9);
}

.gsap-slide-left {
  opacity: 0;
  transform: translateX(-40px);
}

.gsap-slide-right {
  opacity: 0;
  transform: translateX(40px);
}

/* ─── Reduced Motion ─── */
@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;
  }

  .gsap-fade-up,
  .gsap-fade-in,
  .gsap-scale-in,
  .gsap-slide-left,
  .gsap-slide-right {
    opacity: 1;
    transform: none;
  }
}

/* ─── Selection ─── */
::selection {
  background-color: var(--primary);
  color: var(--text-on-primary);
}

/* ─── Focus Visible ─── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── WebKit GPU & Momentum Scroll Utilities ─── */
.gpu-layer {
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.scroll-touch {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.scroll-touch-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

/* ═══════════════════════════════════════════
   PROMOTION ENGINE & PRICING DISPLAY (-20%)
   ═══════════════════════════════════════════ */
.price-strike-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.price-strike-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.price-old {
  font-size: 0.92rem;
  color: #718096;
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-color: #E53E3E;
  text-decoration-thickness: 1.5px;
}

.price-promo {
  font-family: var(--font-heading, 'Lora', serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary, #1E3F27);
}

.badge-discount-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.35);
  line-height: 1.2;
}

/* ═══════════════════════════════════════════
   STRICT MOBILE ANTI-OVERFLOW RULES
   ═══════════════════════════════════════════ */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  position: relative;
}

*, *::before, *::after {
  box-sizing: border-box;
  max-width: 100%;
}

@media (max-width: 768px) {
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }

  .btn, .btn-xl, .btn-lg, .btn-md {
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
  }

  .hero-actions,
  .hero-actions-wrapper {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  .hero-actions .btn,
  .hero-actions-wrapper .btn {
    width: 100% !important;
    padding: 14px 18px !important;
    font-size: 1rem !important;
  }

  .zone-tag {
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .depot-location-badge {
    left: 12px !important;
    right: 12px !important;
    max-width: calc(100% - 24px) !important;
    font-size: 0.8rem !important;
    word-break: break-word !important;
  }

  .cross-sell-card-bottom {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}
