/* ==========================================================================
   United Foods — Catalogue (Sections 4, 17, 18): product rows, cards, shop and
   category pages, product page content, gallery controls and image zoom.
   Colours only through the theme tokens in app.css (Section 0.4).
   ========================================================================== */

.visually-hidden { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.section-alt { background:var(--color-surface-alt); }

/* ----- Product rows (carousel component) ----- */
.section-title { min-width:0; }
.section-title h2 { margin-bottom:.15em; }
.section-sub { margin:0; color:var(--color-muted); font-size:.92rem; }
.row-controls { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.row-arrow { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:50%; cursor:pointer;
  border:1px solid var(--color-border); background:var(--color-surface); color:var(--color-primary-dark); box-shadow:var(--shadow-sm); }
.row-arrow:hover { border-color:var(--color-primary); color:var(--color-primary); }
.row-arrow:disabled { opacity:.35; cursor:default; }
.product-row:not(.is-scrollable) .row-arrow { display:none; }
.carousel:focus-visible { outline:2px solid var(--color-accent); outline-offset:4px; border-radius:var(--radius); }
.carousel-dots { display:none; }
.carousel-dots button, .gallery-dots button { width:8px; height:8px; padding:0; border:0; border-radius:50%; cursor:pointer;
  background:var(--color-border); transition:width .2s, background .2s; }
.carousel-dots button[aria-current="true"], .gallery-dots button[aria-current="true"] { width:22px; border-radius:6px; background:var(--color-primary); }
@media (max-width:860px){
  .carousel-dots { display:flex; justify-content:center; flex-wrap:wrap; gap:6px; margin-top:12px; }
  .row-arrow { display:none; }
  .section-head { align-items:flex-end; }
}

/* ----- Product card (Section 18.3) ----- */
.product-card { background:var(--color-surface); }
.product-card .pc-name { margin:0; font-family:var(--font-sans); line-height:1.35; }
.product-card .pc-name a { color:inherit; }
.product-card .pc-name a:hover { color:var(--color-primary); }
.product-card .pc-spec { margin:0; }
.product-card .pc-spec-label { font-weight:600; color:var(--color-text); }
.product-card .pc-actions .btn { padding-left:.5rem; padding-right:.5rem; }
.product-grid { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:20px; }
@media (max-width:1100px){ .product-grid { grid-template-columns:repeat(3, minmax(0,1fr)); } }
@media (max-width:860px){ .product-grid { grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px; } }
@media (max-width:520px){ .product-grid { grid-template-columns:minmax(0,1fr); } }

/* ----- Shop and category pages (Sections 18.1 / 18.5) ----- */
.shop-head { padding-bottom:8px; }
.shop-intro { max-width:760px; color:var(--color-muted); margin:0 0 16px; }
.category-chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip { display:inline-flex; align-items:center; padding:.4rem .9rem; border-radius:999px; font-size:.88rem;
  border:1px solid var(--color-border); background:var(--color-surface); color:var(--color-primary-dark); }
.chip:hover { border-color:var(--color-primary); color:var(--color-primary); }
.chip.is-active { background:var(--color-primary); border-color:var(--color-primary); color:var(--color-surface); }
.sort-form { display:flex; align-items:center; gap:8px; }
.sort-form label { font-size:.85rem; color:var(--color-muted); white-space:nowrap; }
.sort-form .form-control { width:auto; padding:.45rem .6rem; font-size:.9rem; }
.pagination-wrap { margin-top:24px; }
.pagination-wrap nav { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; }
.pagination-wrap svg { width:18px; height:18px; }
@media (max-width:640px){ .catalogue-section .section-head { flex-wrap:wrap; } }

/* ----- Home category tiles ----- */
.category-tiles { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:16px; }
.category-tile { display:flex; flex-direction:column; gap:4px; padding:12px; border:1px solid var(--color-border); border-radius:var(--radius);
  background:var(--color-surface); box-shadow:var(--shadow-sm); color:var(--color-primary-dark); transition:box-shadow .15s, transform .15s; }
.category-tile:hover { box-shadow:var(--shadow); transform:translateY(-2px); color:var(--color-primary); }
.category-tile-img { display:block; aspect-ratio:1/1; border-radius:var(--radius-sm); overflow:hidden; background:var(--color-surface-alt); margin-bottom:6px; }
.category-tile-img img { width:100%; height:100%; object-fit:cover; display:block; }
.category-tile-name { font-weight:600; }
.category-tile-count { font-size:.82rem; color:var(--color-muted); }
@media (max-width:860px){ .category-tiles { grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px; } }

/* ----- Product page content (Sections 17.4–17.6) ----- */
.product-page { padding-top:24px; }
.pd-eyebrow { display:inline-block; font-size:.8rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--color-accent-dark); margin-bottom:6px; }
.pd-sku { margin:0 0 8px; font-size:.85rem; color:var(--color-muted); }
.pd-lead { font-size:1.05rem; margin:0 0 14px; }
.pd-highlights { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:10px; margin:0 0 18px; }
.pd-highlights div { padding:10px 12px; border-radius:var(--radius-sm); background:var(--color-primary-050); }
.pd-highlights dt { font-size:.75rem; text-transform:uppercase; letter-spacing:.05em; color:var(--color-muted); }
.pd-highlights dd { margin:2px 0 0; font-weight:600; color:var(--color-primary-dark); }
.pd-cta { display:flex; flex-wrap:wrap; gap:10px; margin:6px 0 8px; }
.pd-cta .btn { flex:1 1 180px; justify-content:center; }
.pd-cta-note { font-size:.85rem; color:var(--color-muted); margin:0 0 12px; }
.pd-jump { display:flex; flex-wrap:wrap; gap:6px 16px; padding:12px 0; margin:12px 0 4px; border-top:1px solid var(--color-border); border-bottom:1px solid var(--color-border); font-size:.9rem; }
.pd-section { padding-top:24px; scroll-margin-top:90px; }
.pd-section h2 { font-size:1.35rem; }
.rich-text > :first-child { margin-top:0; }
.rich-text h3 { font-size:1.12rem; margin:1.2em 0 .4em; }
.rich-text h4 { font-size:1rem; margin:1em 0 .3em; }
.rich-text ul, .rich-text ol { padding-left:1.3em; }
.rich-text table { width:100%; border-collapse:collapse; margin:12px 0; }
.rich-text th, .rich-text td { border:1px solid var(--color-border); padding:6px 8px; text-align:left; }
.rich-text img { border-radius:var(--radius-sm); }
.pd-chips { list-style:none; padding:0; margin:0; display:flex; flex-wrap:wrap; gap:8px; }
.pd-chips li { padding:.4rem .8rem; border-radius:999px; border:1px solid var(--color-border); background:var(--color-surface); font-size:.9rem; }
.doc-list { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.doc-list a { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; margin:0; background:var(--color-surface); }
.doc-list a:hover { border-color:var(--color-primary); }
.doc-list .doc-title { font-weight:600; color:var(--color-primary-dark); }
.doc-list .doc-type { font-size:.8rem; color:var(--color-muted); margin-left:auto; }
.faq-item summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.faq-item summary::-webkit-details-marker { display:none; }
.faq-item summary::after { content:"+"; font-size:1.2rem; color:var(--color-accent-dark); }
.faq-item[open] summary::after { content:"–"; }
.faq-item summary h3 { margin:0; font-family:var(--font-sans); font-size:1rem; color:inherit; }
.faq-answer { margin-top:8px; color:var(--color-text); }
.pd-cta-box { margin-top:28px; padding:20px; border-radius:var(--radius); background:var(--color-primary-050); border:1px solid var(--color-border); }
.pd-cta-box-title { font-family:var(--font-head); font-size:1.2rem; color:var(--color-primary-dark); margin:0 0 4px; }
.category-cta { padding-top:0; }

/* ----- Gallery controls, videos ----- */
.gallery-arrow { position:absolute; top:50%; transform:translateY(-50%); z-index:2; display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius:50%; border:1px solid var(--color-border); cursor:pointer;
  background:color-mix(in srgb, var(--color-surface) 88%, transparent); color:var(--color-primary-dark); box-shadow:var(--shadow-sm); }
.gallery-arrow.prev { left:10px; }
.gallery-arrow.next { right:10px; }
.gallery-arrow:disabled { opacity:.35; cursor:default; }
.gallery-thumbs .thumb-play { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--color-surface);
  background:color-mix(in srgb, var(--color-primary-dark) 45%, transparent); }
.gallery-caption { position:absolute; left:0; right:0; bottom:0; padding:6px 10px; font-size:.8rem; color:var(--color-surface);
  background:color-mix(in srgb, var(--color-primary-dark) 70%, transparent); pointer-events:none; }
.video-facade { position:relative; width:100%; height:100%; padding:0; border:0; cursor:pointer; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%); color:var(--color-surface); }
.video-facade img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.video-play { position:relative; display:inline-flex; align-items:center; justify-content:center; width:68px; height:68px; border-radius:50%;
  background:var(--color-accent); color:var(--color-surface); box-shadow:var(--shadow); }
.video-note { position:absolute; left:10px; right:10px; top:10px; font-size:.75rem; text-align:left; opacity:.9; }
.video-embed { width:100%; height:100%; border:0; display:block; }
@media (max-width:860px){ .gallery-arrow { display:none; } }

/* ----- Image zoom viewer (lightbox) ----- */
.lightbox { position:fixed; inset:0; z-index:120; display:flex; align-items:center; justify-content:center; padding:56px 16px;
  background:color-mix(in srgb, var(--color-primary-dark) 94%, transparent); color:var(--color-surface); touch-action:pan-y; }
.lightbox[hidden] { display:none; }
.lightbox-figure { margin:0; max-width:min(1100px, 100%); max-height:100%; display:flex; flex-direction:column; align-items:center; gap:10px; }
.lightbox-figure img { max-width:100%; max-height:calc(100vh - 140px); object-fit:contain; cursor:zoom-in; transition:transform .2s ease; user-select:none; -webkit-user-drag:none; }
.lightbox.is-zoomed .lightbox-figure img { transform:scale(2.2); cursor:zoom-out; }
.lightbox-figure figcaption { font-size:.9rem; opacity:.9; text-align:center; }
.lightbox-count { opacity:.75; margin-left:8px; }
.lightbox-close, .lightbox-arrow { position:absolute; display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; border-radius:50%;
  border:1px solid color-mix(in srgb, var(--color-surface) 35%, transparent); cursor:pointer;
  background:color-mix(in srgb, var(--color-surface) 12%, transparent); color:var(--color-surface); }
.lightbox-close { top:12px; right:12px; }
.lightbox-arrow { top:50%; transform:translateY(-50%); }
.lightbox-arrow.prev { left:12px; }
.lightbox-arrow.next { right:12px; }
.lightbox-close:focus-visible, .lightbox-arrow:focus-visible { outline:2px solid var(--color-accent-light); outline-offset:2px; }
body.lightbox-open { overflow:hidden; }
@media (max-width:860px){ .lightbox-arrow { top:auto; bottom:14px; transform:none; } }

@media (prefers-reduced-motion: reduce){
  .carousel, .gallery-track { scroll-behavior:auto; }
  .lightbox-figure img, .carousel-dots button, .gallery-dots button { transition:none; }
}
