/* ================================================================
   TROOPAC — responsive.css
   ALL media queries for the entire project — one file, one place.
   Organised by breakpoint ascending (min-width first, then max-width).

   Homepage breakpoints pulled from: components.css + sections.css
   Product page breakpoints pulled from: product.css
================================================================ */


/* ──────────────────────────────────────────────────────────────
   ≥ 480px
────────────────────────────────────────────────────────────── */
@media (min-width: 480px) {

  /* Product grid — 2 columns */
  .product-grid { grid-template-columns: repeat(2, 1fr); }

  /* CTA band actions — inline row */
  .cta__actions {
    flex-direction: row;
    justify-content: center;
  }
}





/* ──────────────────────────────────────────────────────────────
   ≥ 600px
────────────────────────────────────────────────────────────── */
@media (min-width: 600px) {

  /* Branding feature grid — 2 columns */
  .feature-grid { grid-template-columns: repeat(2, 1fr); }

  /* Benefit grid — 2 columns */
  .benefit-grid { grid-template-columns: repeat(2, 1fr); }

  /* Product meta — 3 columns on small tablets */
  .product-meta__inner { grid-template-columns: repeat(3, 1fr); }
  .product-meta__item:nth-child(even) { border-right: 1px solid var(--color-border); }
  .product-meta__item:nth-child(3n)   { border-right: none; }

  /* Related products — 3 columns */
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ──────────────────────────────────────────────────────────────
   ≥ 640px
────────────────────────────────────────────────────────────── */
@media (min-width: 640px) {

  /* Branding CTA — horizontal layout */
  .brand-cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Footer main grid — 2 columns */
  .footer__grid { grid-template-columns: 1.5fr 1fr; }

  /* Footer bottom bar — horizontal layout */
  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

}


/* ──────────────────────────────────────────────────────────────
   ≥ 768px
────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {

  /* Nav — show desktop links, hide hamburger */
  .nav__links     { display: flex; }
  .nav__cta       { display: flex; }
  .nav__hamburger { display: none; }

  /* Product grid — 3 columns */
  .product-grid { grid-template-columns: repeat(3, 1fr); }

  /* Product hero — gallery left, info right */
  .product-hero__inner { grid-template-columns: 380px 1fr; gap: 3rem; }
  .product-image       { height: auto; aspect-ratio: 1 / 1; }
  .product-hero        { padding: 2.5rem 1.5rem; }

  /* Hide mobile CTA bar on desktop */
  .product-mobile-cta-bar { display: none !important; }
}


/* ──────────────────────────────────────────────────────────────
   ≥ 900px
────────────────────────────────────────────────────────────── */
@media (min-width: 900px) {

  /* Product grid — 4 columns */
  .product-grid { grid-template-columns: repeat(4, 1fr); }

  /* Product meta — single row of 6 on desktop */
  .product-meta__inner           { grid-template-columns: repeat(6, 1fr); }
  .product-meta__item:nth-child(3n) { border-right: 1px solid var(--color-border); }
  .product-meta__item:nth-child(6n) { border-right: none; }
  .product-meta__item            { border-bottom: none; }

  /* Process grid — 4 columns (full step flow) */
  .process-grid { grid-template-columns: repeat(4, 1fr); }

  .process-step {
    flex-direction: column;
    gap: .7rem;
    align-items: stretch;
  }

  .process-step__header {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .process-step__connector {
    display: block;
    position: static;
    flex: 1;
    height: 1.5px;
    width: auto;
    transform: none;
    top: auto;
    bottom: auto;
    left: auto;
  }

  .process-step__content {
    padding-top: 0;
  }

  /* Benefit grid — 3 columns */
  .benefit-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ──────────────────────────────────────────────────────────────
   ≥ 960px
────────────────────────────────────────────────────────────── */
@media (min-width: 960px) {

  /* Hero inner — increase overall layout size to expand showcase width & height while keeping text column wide */
  .hero__inner {
    grid-template-columns: 1.1fr 1fr;
    max-width: 1320px;
    gap: 4.5rem;
  }

  /* Hero showcase — visible on desktop, aligned to the right edge */
  .hero__showcase {
    display: flex;
    margin-left: auto;
    margin-right: 0;
  }
}


/* ──────────────────────────────────────────────────────────────
   ≥ 1000px
────────────────────────────────────────────────────────────── */
@media (min-width: 1000px) {

  /* Branding feature grid — 4 columns (full row) */
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
}


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

  /* Quote form — stacked rows on very small screens */
  .quote-form__row { grid-template-columns: 1fr; }

  /* Allied products — 2-per-row grid on mobile screens */
  .allied-products__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }
  .allied-card {
    flex: none;
    width: auto;
  }
}


/* ──────────────────────────────────────────────────────────────
   ≤ 600px  (overrides)
────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Nav — tighter horizontal padding */
  .nav { padding: 0 1.25rem; }
}


/* ──────────────────────────────────────────────────────────────
   ≤ 639px  — spec table: stacked card layout
────────────────────────────────────────────────────────────── */
@media (max-width: 639px) {

  .spec-table-wrap {
    border: none;
    overflow-x: visible;
    background: transparent;
  }

  .spec-table { display: block; min-width: 0; width: 100%; }
  .spec-table thead { display: none; }
  .spec-table tbody { display: block; }

  /* Each row becomes a card formatted like an industrial spec sheet dashboard */
  .spec-table tbody tr {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background: var(--color-surface) !important;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: .875rem; /* Reduced card gap */
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .spec-table tbody tr:last-child { margin-bottom: 0; }

  /* Label–value row defaults */
  .spec-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .45rem .8rem; /* Tightened padding */
    border-bottom: 1px solid var(--color-border);
    font-size: .78rem;
    background: var(--color-surface);
  }

  .spec-table__value {
    line-height: 1.4;
    display: block;
  }

  /* Column label injected from data-label */
  .spec-table td::before {
    content: attr(data-label);
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-muted);
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Card Header: Product Name + SKU code badge */
  .spec-table td.spec-col-name {
    grid-column: span 6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-dark-alt) !important;
    color: #fff;
    padding: .5rem .8rem;
    border-bottom: 1.5px solid var(--color-primary-mid);
    font-family: var(--font-heading);
    font-size: .88rem;
    font-weight: 800;
  }

  .spec-table td.spec-col-name .spec-table__value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .spec-table td.spec-col-name .sku-code {
    display: inline-block;
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-accent);
    padding: .12rem .45rem;
    border-radius: 4px;
    font-size: .68rem;
    font-family: var(--font-mono);
    font-weight: 600;
    margin-top: 0;
  }

  .spec-table td.spec-col-name::before { display: none; }

  /* 2x2 Technical Parameters Grid (Size, GSM, Material, Form) */
  .spec-table td.spec-col-size,
  .spec-table td.spec-col-gsm,
  .spec-table td.spec-col-material,
  .spec-table td.spec-col-form {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: .45rem .8rem;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  /* Remove double border on right column */
  .spec-table td.spec-col-gsm,
  .spec-table td.spec-col-form {
    border-right: none;
  }

  /* Stacked labels for 2x2 grid */
  .spec-table td.spec-col-size::before,
  .spec-table td.spec-col-gsm::before,
  .spec-table td.spec-col-material::before,
  .spec-table td.spec-col-form::before {
    font-size: .55rem;
    font-weight: 700;
    color: var(--color-muted);
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: .15rem;
    white-space: nowrap;
    flex-shrink: 0;
    content: attr(data-label);
  }

  .spec-table td.spec-col-size .spec-table__value,
  .spec-table td.spec-col-gsm .spec-table__value,
  .spec-table td.spec-col-material .spec-table__value,
  .spec-table td.spec-col-form .spec-table__value {
    text-align: left;
    font-size: .8rem;
    font-weight: 700;
    color: var(--color-text);
  }

  .spec-table td.spec-col-size .spec-table__value,
  .spec-table td.spec-col-gsm .spec-table__value {
    font-family: var(--font-mono);
  }

  /* Technical Options Rows (spans full width) */
  .spec-table td.spec-col-outer_paper_options,
  .spec-table td.spec-col-print_options {
    grid-column: span 6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .8rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  .spec-table td.spec-col-outer_paper_options::before,
  .spec-table td.spec-col-print_options::before {
    content: attr(data-label);
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-muted);
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Highlighted B2B Ordering Section (Shaded card footer 3 items side-by-side) */
  .spec-table td.spec-col-unit,
  .spec-table td.spec-col-pack_size,
  .spec-table td.spec-col-moq_packs,
  .spec-table td.spec-col-moq {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: .5rem .8rem;
    background: var(--color-primary-light) !important;
    border-right: 1px solid rgba(26, 92, 58, 0.08);
    border-bottom: none !important;
  }

  /* Remove double border on right footer item */
  .spec-table td.spec-col-moq_packs,
  .spec-table td.spec-col-moq {
    border-right: none;
  }

  .spec-table td.spec-col-unit::before,
  .spec-table td.spec-col-pack_size::before,
  .spec-table td.spec-col-moq_packs::before,
  .spec-table td.spec-col-moq::before {
    content: attr(data-label);
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-primary-mid);
    margin-bottom: .15rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .spec-table td.spec-col-unit .spec-table__value,
  .spec-table td.spec-col-pack_size .spec-table__value,
  .spec-table td.spec-col-moq_packs .spec-table__value,
  .spec-table td.spec-col-moq .spec-table__value {
    text-align: left;
    font-size: .8rem;
    font-weight: 700;
    color: var(--color-text);
  }

  /* Specifications Chips & Swatches on Mobile Cards */
  .spec-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .spec-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
    font-size: .74rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 6px;
    white-space: nowrap;
  }
}


/* ──────────────────────────────────────────────────────────────
   ≤ 959px
────────────────────────────────────────────────────────────── */
@media (max-width: 959px) {
  .hero__showcase {
    max-width: 540px;
    margin: 0 auto;
  }
}


/* ──────────────────────────────────────────────────────────────
   ≤ 767px  (overrides)
────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {

  /* General sections — reduced vertical padding on mobile */
  .section { padding: 4.2rem 1.5rem; }

  /* Quote modal — mobile adjustments */
  .quote-modal {
    padding: 0;
  }
  .quote-modal__dialog {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    animation: slide-up 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .quote-modal__header {
    padding: 1rem 1.25rem;
    flex-shrink: 0;
  }
  .quote-modal__body {
    padding: 1.25rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .quote-form__intro {
    margin-bottom: 1.25rem;
  }
  .quote-form__row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .quote-form__control {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
    padding: 0.75rem 0.95rem; /* Larger touch targets for mobile */
  }
  .quote-form__actions {
    margin-top: 1.25rem;
  }

  /* Mobile nav — show hamburger */
  .nav__hamburger { display: flex; }
  .nav__cta       { display: none; }

  /* Show FAB on mobile */
  .fab-whatsapp { display: flex !important; }

  /* Product page — mobile menu and padding */
  .nav--light .nav__hamburger { display: flex !important; }
  .nav--light { padding: 0 1.2rem; height: 72px; }
  .breadcrumb          { padding: .55rem 1.2rem; }
  .product-hero        { padding: 1.5rem 1.2rem; }
  .product-specifications { padding: 1.8rem 1.2rem; }
  .spec-panel          { padding: 0; }
  .product-meta        { padding: 0 1.2rem; }
  .product-description-hero { margin-top: 1.2rem; padding-top: 1.2rem; }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
