/* Comfortable touch controls and readable forms, including small tablets. */
html { scroll-padding-top: 122px; }
input, select, textarea { min-width: 0; }
.menu-toggle { display: none; }
.site-header nav a { display: flex; align-items: center; min-height: 44px; }
.quote-trigger, .filter-tabs button, .colour-filters button, .clear-filters,
.card-link, .gallery-expand, .gallery-caption a, .quote-alternatives button,
.remove-item, .footer-end button, footer a { min-height: 44px; }
.card-link { gap: 8px; }
.card-options button, .quick-add, .gallery-arrow, .dialog-close { min-width: 44px; min-height: 44px; }
.quick-add { width: 44px; height: 44px; }
.photo-note { max-width: calc(100% - 76px); }
.quantity-stepper { height: 48px; flex-shrink: 0; }
.quantity-stepper button, .quote-item .quantity-stepper button { width: 44px; flex: 0 0 44px; }
.quantity-stepper input, .quote-item .quantity-stepper input { width: 42px; min-height: 44px; font-size: 16px; }
.unit-toggle { flex-shrink: 0; }
.unit-toggle button { min-width: 44px; min-height: 44px; font-size: 12px; }
.dimension-box > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.dialog-tools { position: sticky; top: 0; height: 0; z-index: 5; }
.dialog-close { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
dialog { overscroll-behavior: contain; }
.drawer-head { position: sticky; top: 0; z-index: 5; background: var(--paper); padding-right: 75px; }
.drawer-body { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
.quote-dialog { scroll-padding-top: 150px; scroll-padding-bottom: 24px; }
.quote-item { grid-template-columns: 70px minmax(0, 1fr) 132px; }
.quote-item > div { min-width: 0; overflow-wrap: anywhere; }
.quote-item .quantity-stepper { height: 46px; }
.quote-alternatives { flex-wrap: wrap; gap: 8px 28px; }
.quote-alternatives button { font-size: 12px; }
.quote-dialog .toast { left: auto; right: 20px; max-width: min(90vw, 600px); transform: translateY(20px); }
.quote-dialog .toast.show { transform: translateY(0); }
.detail-gallery, .detail-main, .detail-content > section { min-width: 0; }
.gallery-stage { touch-action: pan-y pinch-zoom; }
.gallery-thumbs { justify-content: flex-start; padding: 15px 4px 4px; }
.gallery-thumbs button:first-child { margin-left: auto; }
.gallery-thumbs button:last-child { margin-right: auto; }
.gallery-caption a { display: inline-flex; align-items: center; }
.spec-slide { padding: 18px; }
.spec-slide h3 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 18px; }
.spec-slide strong { font-size: clamp(20px, 2.4vw, 25px); overflow-wrap: anywhere; }
.spec-slide .measure-rule { margin: 20px auto; }
.empty-state { padding: 40px 16px; }

@media (max-width: 1100px), (pointer: coarse) {
  .search input, .sort select, form input, form textarea { font-size: 16px; min-height: 48px; }
  .search { min-width: 0; }
  .search input { text-overflow: ellipsis; }
  .sort select { max-width: 150px; }
  form label { font-size: 13px; }
  .filter-tabs button, .colour-filters button { font-size: 12px; }
  .detail-content p, .detail-content li, .product-subtitle { font-size: 14px; }
  .variant-label, .detail-specs, .measurement-note, .gallery-caption { font-size: 12px; }
  .gallery-expand { font-size: 12px; }
}

@media (max-width: 900px) {
  html { scroll-padding-top: 96px; }
  .site-header { height: 84px; gap: 12px; }
  .site-header .wordmark { margin-right: auto; font-size: 29px; letter-spacing: 5px; }
  .site-header .wordmark span { font-size: 6px; letter-spacing: 1.9px; margin-top: 8px; }
  .menu-toggle { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); font-size: 23px; }
  .site-header nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 5%; box-shadow: 0 12px 20px #253a3110; }
  .site-header.menu-open nav { display: grid; gap: 4px; }
  .site-header nav a { padding: 8px 12px; font-size: 15px; }
  .site-header nav a:hover { background: var(--cream); }
  .quote-trigger { font-size: 12px; padding: 9px 12px; gap: 8px; }
  .selection-arrow { display: none; }
  .detail-top { grid-template-columns: 1fr; }
  .detail-gallery { border-right: 0; border-bottom: 1px solid var(--line); padding: 58px 6% 24px; }
  .detail-gallery .gallery-stage { height: clamp(290px, 45vw, 400px); }
  .detail-main { padding: 28px 6%; }
  .variant-options { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  .variant-label { font-size: 12px; }
  .detail-content { padding: 12px 6% 36px; }
}

@media (max-width: 760px) {
  .filter-tabs { gap: 22px; padding: 4px 2px; }
  .filter-tabs button { padding-bottom: 10px; }
  .colour-filters button { min-height: 44px; padding: 8px 11px; }
  .card-options button { width: 44px; height: 44px; }
  .card-link, .card-summary, .card-selected, .card-meta { font-size: 12px; }
  .card-category { font-size: 9px; letter-spacing: .8px; }
  .card-title { font-size: 21px; }
  .product-card .photo-note { left: 8px; max-width: calc(100% - 62px); font-size: 8px !important; line-height: 1.4; }
  .quick-add { bottom: 8px; right: 8px; }
  .drawer-head { padding-right: 72px; }
  .drawer-head h2 { font-size: 34px; }
  .quote-item { grid-template-columns: 54px minmax(0, 1fr); gap: 10px 16px; }
  .quote-item > div:last-child { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .quote-item img { width: 54px; height: 70px; }
  .quote-item .quantity-stepper { margin-top: 0; }
  .quote-item p, .remove-item { font-size: 12px; }
  .quote-item h3 { font-size: 20px; }
  .quote-small, .form-intro, .form-note, .quote-disclaimer { font-size: 12px; }
  .search { width: min(390px, 65%); }
  .sort { font-size: 12px; gap: 8px; }
  .detail-content { grid-template-columns: 1fr; }
  .small-dialog { padding-top: 64px; }
  .small-dialog p:not(.eyebrow) { font-size: 14px; }
  .product-card .no-photo small { font-size: 10px; }
  .product-card .no-photo { gap: 8px; }
  .footer-end a, .footer-end button { display: inline-flex; align-items: center; font-size: 12px; }
}

@media (max-width: 480px) {
  .site-header { gap: 8px; }
  .site-header .wordmark { font-size: 26px; letter-spacing: 4px; }
  .site-header .wordmark span { font-size: 5.5px; letter-spacing: 1.4px; }
  .quote-trigger { padding: 8px; font-size: 11px; gap: 5px; }
  .selection-prefix { display: none; }
  .quote-trigger #quote-count { min-width: 24px; padding: 0 4px; width: auto; border-radius: 12px; }
  .search-row { flex-wrap: wrap; gap: 10px; }
  .search { width: 100%; }
  .sort { margin-left: auto; }
  .search input { font-size: 16px; }
  .dimension-box { flex-wrap: wrap; }
  .add-row { flex-wrap: wrap; }
  .add-row .button { min-width: 145px; }
  .quote-item > div:last-child { flex-wrap: wrap; }
  .remove-item { margin-left: 0; padding: 8px; }
  .spec-slide .eyebrow { margin-bottom: 12px; }
  .spec-slide h3 { margin-bottom: 12px; }
  .spec-slide p { font-size: 10px; margin-top: 7px; }
  .spec-slide .measure-rule { margin: 15px auto; }
  footer { gap: 24px 16px; }
}

@media (max-width: 359px) {
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .card-summary, .card-selected, .card-meta { min-height: 0; }
  .card-title { font-size: 25px; }
  .card-summary { font-size: 13px; }
  footer { grid-template-columns: 1fr; }
  footer > div:nth-child(2) { align-items: flex-start; }
}

@media print {
  .dialog-tools, .menu-toggle { display: none; }
  .drawer-head { position: static; }
}
