/* ===================================================
   CORCA Website — Responsive Styles
   Breakpoints: 1024px (tablet) | 768px (mobile) | 480px (small)
   =================================================== */

/* ── Hamburger toggle ───────────────────────────── */
.cw-menu-toggle {
  display: none;
  cursor: pointer;
  font-size: 22px;
  color: #16243a;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid #d6dce5;
  line-height: 1;
  user-select: none;
  transition: background 0.2s;
  flex-shrink: 0;
}
.cw-menu-toggle:hover { background: #f0f3f7; }

/* Nav visible by default on desktop */
.cw-nav { display: flex; }

/* ── TABLET (≤ 1024px) ──────────────────────────── */
@media (max-width: 1024px) {

  /* Hero 2-col → 1 col, image on top */
  .rg-hero {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    padding-top: 56px !important;
    padding-bottom: 48px !important;
  }
  .rg-hero > div:last-child { order: -1; }

  /* Stats 4-col → 2×2 */
  .rg-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    padding: 28px 24px !important;
  }

  /* 5-col → 3-col */
  .rg-5 { grid-template-columns: repeat(3, 1fr) !important; }

  /* 4-col → 2-col */
  .rg-4 { grid-template-columns: repeat(2, 1fr) !important; }

  /* 3-col → 2-col */
  .rg-3 { grid-template-columns: repeat(2, 1fr) !important; }

  /* 2-col → 1-col */
  .rg-2 {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }

  /* Brand card 300px+1fr → stacked */
  .rg-brand {
    grid-template-columns: 1fr !important;
  }
  .rg-brand > div:first-child {
    border-right: none !important;
    border-bottom: 1px solid #eef1f5 !important;
  }

  /* Brand product grids (nested 4-col inside brand cards) */
  .rg-brand-prods {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Step timeline rows adjust */
  .rg-step {
    grid-template-columns: 36px 24px 1fr !important;
  }

  /* Section padding */
  .rg-section-pad { padding: 56px 24px !important; }
  .cw-process-section {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  /* Contacto form field pairs */
  .rg-form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Footer */
  .cw-footer-inner {
    flex-direction: column !important;
    gap: 32px !important;
  }
  .cw-footer-bottom {
    flex-direction: column !important;
    gap: 6px !important;
    text-align: center !important;
  }
}

/* ── MOBILE (≤ 768px) ───────────────────────────── */
@media (max-width: 768px) {

  /* Coverage: text and departments first, full-size map below. */
  .cw-coverage {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
    padding: 24px !important;
  }
  .cw-coverage > div { min-width: 0; }
  .cw-coverage > div:last-child {
    width: 100%;
    max-width: 360px;
    height: auto !important;
    aspect-ratio: 1;
    margin-inline: auto;
  }

  /* ── Sticky sidebar → static when grid collapses ── */
  .cw-sticky-col {
    position: static !important;
    top: auto !important;
  }

  /* ── Heading font sizes ─────────────────────────── */
  h1[style*="font-size"] {
    font-size: clamp(26px, 7.5vw, 36px) !important;
    line-height: 1.1 !important;
  }
  h2[style*="font-size"] {
    font-size: clamp(20px, 6vw, 28px) !important;
    line-height: 1.15 !important;
  }
  h3[style*="font-size"] {
    font-size: clamp(17px, 5vw, 22px) !important;
    line-height: 1.2 !important;
  }

  /* ── Section padding ────────────────────────────── */
  /* Reduce horizontal padding: any container with 32px side padding */
  [style*="padding: "][style*=" 32px"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  /* Reduce top padding for tall sections */
  [style*="padding: 88px"],
  [style*="padding: 92px"],
  [style*="padding: 84px"] {
    padding-top: 48px !important;
    padding-bottom: 40px !important;
  }
  [style*="padding: 72px 32px"],
  [style*="padding: 80px 32px"] {
    padding-top: 40px !important;
    padding-bottom: 36px !important;
  }
  .cw-process-section {
    padding: 56px 20px 60px !important;
    background-position: 58% center !important;
  }
  .cw-process-grid { gap: 14px !important; }

  /* ── Product carousel ───────────────────────────── */
  /* Native horizontal scrolling; one full-width card on mobile. */
  .cw-carousel-track {
    gap: 16px !important;
  }
  .cw-carousel-track > div {
    flex: 0 0 100% !important;   /* one full-width card at a time */
  }

  /* ── Header */
  .cw-header {
    height: 60px !important;
    padding: 0 20px !important;
    position: relative !important;
    flex-wrap: nowrap !important;
  }
  .cw-header img[alt="CORCA"] { height: 26px !important; }

  .cw-menu-toggle { display: flex !important; }

  .cw-cta-btn { display: none !important; }

  /* Nav hidden until checkbox checked */
  .cw-nav {
    display: none !important;
    position: absolute !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255,255,255,0.98) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-bottom: 1px solid #e4e8ee !important;
    padding: 4px 20px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    z-index: 200 !important;
    box-shadow: 0 8px 24px -8px rgba(22,36,58,0.14) !important;
  }
  .cw-nav a {
    padding: 13px 0 !important;
    border-bottom: 1px solid #f0f2f5 !important;
    font-size: 15px !important;
    width: 100% !important;
    display: block !important;
    border-left: none !important;
    border-right: none !important;
  }
  #cw-nav-check:checked ~ header .cw-nav {
    display: flex !important;
  }

  /* Hero heading */
  .rg-hero h1 {
    font-size: clamp(28px, 8vw, 46px) !important;
    line-height: 1.12 !important;
  }

  /* Stats → 2 col on mobile too */
  .rg-stats { grid-template-columns: repeat(2, 1fr) !important; }

  /* 3-col → 1-col */
  .rg-3 { grid-template-columns: 1fr !important; }

  /* 5-col → 2-col */
  .rg-5 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Hero compact */
  .rg-hero {
    padding-top: 40px !important;
    padding-bottom: 36px !important;
    gap: 24px !important;
  }
}

/* ── SMALL MOBILE (≤ 480px) ────────────────────── */
@media (max-width: 480px) {

  /* Stats → 1-col */
  .rg-stats { grid-template-columns: 1fr !important; }

  /* 4-col → 1-col */
  .rg-4 { grid-template-columns: 1fr !important; }

  /* 5-col → 1-col */
  .rg-5 { grid-template-columns: 1fr !important; }

  /* Brand products → 1 col */
  .rg-brand-prods { grid-template-columns: 1fr !important; }

  /* Section padding */
  .rg-section-pad { padding: 36px 16px !important; }
  .cw-process-section {
    padding: 44px 16px 48px !important;
    background-position: center !important;
  }
  .cw-process-grid { gap: 12px !important; }

  .rg-hero {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ── Brand product carousel ───────────────── */
.cw-brand-carousel { min-width: 0; }
.cw-brand-carousel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.cw-brand-carousel-controls { display: flex; gap: 8px; }
.cw-brand-carousel-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #d6dce5;
  border-radius: 50%;
  background: #ffffff;
  color: #16243a;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.cw-brand-carousel-button:hover {
  border-color: #16243a;
  background: #16243a;
  color: #ffffff;
}
.cw-brand-carousel-button:focus-visible {
  outline: 3px solid rgba(176, 127, 36, .45);
  outline-offset: 2px;
}
.cw-brand-carousel-hint { display: none; }
.cw-brand-carousel-viewport {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c5ccd7 transparent;
}
.cw-brand-carousel-track {
  display: flex;
  gap: 16px;
  padding-bottom: 6px;
}
.cw-brand-carousel-slide,
.cw-brand-carousel-track > div {
  flex: 0 0 calc((100% - 48px) / 4);
  min-width: 0;
  scroll-snap-align: start;
}
.cw-brand-carousel-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #e4e8ee;
  border-radius: 12px;
  background: #fbfcfd;
}
.cw-brand-carousel-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 768px) {
  .cw-brand-carousel-slide,
  .cw-brand-carousel-track > div { flex-basis: min(82%, 280px); }
  .cw-brand-carousel-hint {
    display: block;
    margin: -7px 0 12px;
    color: #7d8798;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .cw-brand-carousel-button { width: 36px; height: 36px; }
}

/* Homepage distribution brand carousel */
@keyframes cw-home-brand-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.cw-home-brand-viewport {
  overflow: hidden;
  position: relative;
  width: 100%;
  margin-top: 48px;
  border-radius: 16px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.cw-home-brand-viewport:focus-visible {
  outline: 3px solid rgba(176, 127, 36, .5);
  outline-offset: 5px;
}
.cw-home-brand-track {
  display: flex;
  width: max-content;
  animation: cw-home-brand-scroll 38s linear infinite;
  will-change: transform;
}
.cw-home-brand-viewport:hover .cw-home-brand-track,
.cw-home-brand-viewport:focus-within .cw-home-brand-track {
  animation-play-state: paused;
}
.cw-home-brand-group {
  display: flex;
  flex: 0 0 auto;
  gap: 20px;
  padding-right: 20px;
}
.cw-home-brand-card {
  flex: 0 0 clamp(220px, 27vw, 320px);
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #e4e8ee;
  border-radius: 14px;
  box-shadow: 0 12px 32px -22px rgba(22, 36, 58, .28);
}
.cw-home-brand-card img {
  display: block;
  max-width: 100%;
  max-height: 82px;
  object-fit: contain;
}
@media (max-width: 768px) {
  .cw-home-brand-viewport { margin-top: 36px; }
  .cw-home-brand-track { animation-duration: 30s; }
  .cw-home-brand-card {
    flex-basis: min(78vw, 260px);
    height: 126px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cw-home-brand-viewport {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .cw-home-brand-track {
    width: 100%;
    animation: none;
  }
  .cw-home-brand-group[aria-hidden="true"] { display: none; }
  .cw-home-brand-group:not([aria-hidden="true"]) {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding-right: 0;
  }
  .cw-home-brand-card {
    flex: initial;
    height: 120px;
    min-width: 0;
  }
}
