/* APR: WooCommerce buy box, size matrix and system landing pages.
   Uses the same tokens as apr-global.css (ink / steel / paper / safety orange). */

body.apr-design { background: var(--paper); color: var(--ink); font-family: var(--font-body); }
/* low specificity on purpose: page sections (dark heroes etc.) set their own heading colour */
:where(body.apr-design) h1, :where(body.apr-design) h2, :where(body.apr-design) h3 { color: var(--ink); }
.apr-site { min-height: 60vh; }
.apr-mt { margin-top: 40px !important; }
.apr-note { font-size: 12.5px; color: var(--steel-light); margin: 12px 0 0; }
.apr-intro { font-size: 14.5px; color: var(--steel); line-height: 1.7; max-width: 760px; margin: -12px 0 24px; }

/* ---------- buy box: real WooCommerce form ---------- */
.apr-buybox form.cart { margin: 0; }
.apr-buybox table.variations { width: 100%; border: 0; margin: 0 0 6px; border-collapse: collapse; }
.apr-buybox table.variations tr { display: block; margin-bottom: 16px; border: 0; }
.apr-buybox table.variations th, .apr-buybox table.variations td { display: block; padding: 0; border: 0; background: none; text-align: left; }
.apr-buybox table.variations th.label label,
.apr-buybox .wapf-field-label label, .apr-buybox .wapf-field-label {
	font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.05em; color: var(--steel-light); margin-bottom: 6px; display: block;
}
.apr-buybox select {
	width: 100%; max-width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--ink);
	border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background-color: #fff; cursor: pointer; height: auto;
}
.apr-buybox select:focus { outline: 2px solid var(--safety); outline-offset: 1px; }
.apr-buybox .reset_variations { font-size: 12px; color: var(--safety-deep); margin-top: 6px; display: inline-block; }
.apr-buybox .woocommerce-variation-price .price { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--ink); }
.apr-buybox .woocommerce-variation-availability .stock { font-size: 12.5px; color: var(--steel); margin: 4px 0 0; }
.apr-buybox .woocommerce-variation-description { font-size: 13px; color: var(--steel); }
.apr-buybox .single_variation_wrap { margin-top: 4px; }

/* Add-on fields (Advanced Product Fields) */
.apr-buybox .wapf-wrapper, .apr-buybox .wapf { margin: 6px 0 4px; }
.apr-buybox .wapf-field-container { margin-bottom: 14px; padding: 0; }
.apr-buybox .wapf-field-input .wapf-checkable,
.apr-buybox .wapf-checkbox { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 8px 0; }
.apr-buybox .wapf-field-input label {
	display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink);
	border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: #fff; cursor: pointer;
}
.apr-buybox .wapf-field-input input[type=checkbox], .apr-buybox .wapf-field-input input[type=radio] { accent-color: var(--safety); margin: 0; }
.apr-buybox .wapf-pricing-hint { color: var(--safety-deep); font-weight: 600; font-size: 12.5px; }
.apr-buybox .wapf-product-totals, .apr-buybox .wapf--wrapper .wapf-product-totals {
	background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 6px 0 14px; font-size: 13.5px;
}

/* Quantity + button */
.apr-buybox .woocommerce-variation-add-to-cart, .apr-buybox form.cart:not(.variations_form) {
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px;
}
.apr-buybox .quantity { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; margin: 0 !important; }
.apr-buybox .quantity .qty { width: 64px; height: 46px; border: 0; text-align: center; font-family: var(--font-mono); font-size: 15px; background: #fff; }
.apr-buybox .quantity .plus, .apr-buybox .quantity .minus { width: 40px; height: 46px; background: var(--paper-2); border: 0; font-size: 18px; font-weight: 700; color: var(--ink); cursor: pointer; }
.apr-buybox .single_add_to_cart_button, .apr-buybox button.button.alt {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 30px !important;
	font-family: var(--font-display) !important; font-weight: 700 !important; font-size: 15px !important; line-height: 1.2 !important;
	border-radius: 999px !important; border: 2px solid var(--safety) !important; background: var(--safety) !important; color: #fff !important;
	cursor: pointer; transition: all .18s ease; min-height: 50px; flex: 1 1 220px;
}
.apr-buybox .single_add_to_cart_button:hover { background: #fff !important; color: var(--safety-deep) !important; }
.apr-buybox .single_add_to_cart_button.disabled { opacity: .55; cursor: not-allowed; }
.apr-buybox .added_to_cart { font-weight: 700; color: var(--safety-deep); }
.woocommerce-notices-wrapper { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.woocommerce-message, .woocommerce-error, .woocommerce-info { border-top-color: var(--safety) !important; font-size: 14px; }
.woocommerce-message .button { background: var(--safety) !important; color: #fff !important; border-radius: 999px !important; }

/* ---------- facts strip ---------- */
.apr-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.apr-fact { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; align-items: center; }
.apr-fact__icon { grid-row: span 2; width: 34px; height: 34px; border-radius: 8px; background: rgba(255,90,0,.09); display: flex; align-items: center; justify-content: center; }
.apr-fact__icon svg { width: 18px; height: 18px; color: var(--safety-deep); }
.apr-fact__label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--steel-light); }
.apr-fact__value { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--ink); }
@media (max-width: 900px) { .apr-facts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .apr-facts { grid-template-columns: 1fr; } }

/* ---------- size/price matrix ---------- */
.apr-matrix-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; -webkit-overflow-scrolling: touch; }
table.apr-matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; margin: 0; }
table.apr-matrix th, table.apr-matrix td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; border-left: 0; border-right: 0; }
table.apr-matrix thead th { background: var(--ink); color: #fff; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
table.apr-matrix tbody th { font-family: var(--font-display); font-weight: 700; white-space: nowrap; color: var(--ink); background: var(--paper-2); }
table.apr-matrix tbody tr:last-child th, table.apr-matrix tbody tr:last-child td { border-bottom: 0; }
table.apr-matrix tbody tr:hover td { background: rgba(255,90,0,.04); }
.apr-matrix__price { display: block; font-weight: 700; color: var(--ink); }
.apr-matrix__sku { display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--steel-light); }
.apr-matrix__na { color: var(--steel-light); }
.apr-oos { color: var(--steel-light); font-size: 12px; }

/* ---------- product description + tabs ---------- */
.apr-desc__body { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px 30px; font-size: 14.5px; color: var(--steel); line-height: 1.75; }
.apr-desc__body h1, .apr-desc__body h2, .apr-desc__body h3 { font-family: var(--font-display); font-size: 17px; margin: 18px 0 8px; }
.apr-desc__body ul { padding-left: 20px; }
.apr-tab__body { font-size: 14px; color: var(--steel); line-height: 1.7; }
.apr-tab__body h2 { display: none; }
.apr-tab__body table { font-size: 13px; }

/* ---------- product CTA ---------- */
.product-cta__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- system landing hero (dark industrial) ---------- */
.apr-syshero { background: var(--ink); color: #fff; position: relative; overflow: hidden; }
.apr-syshero::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 40px 40px; pointer-events: none; }
.apr-syshero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: repeating-linear-gradient(-45deg, var(--safety) 0 14px, var(--ink) 14px 28px); }
.apr-syshero__inner { position: relative; padding: 28px 24px 64px; }
.apr-syshero h1 { color: #fff !important; font-family: var(--font-display); font-weight: 900; font-size: clamp(32px, 5vw, 54px); letter-spacing: -.02em; line-height: 1.04; margin: 6px 0 16px; max-width: 900px; }
.apr-syshero__lead { font-size: 17px; color: rgba(255,255,255,.78); line-height: 1.6; max-width: 760px; margin: 0 0 28px; }
.apr-syshero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 36px; }
.breadcrumb--dark, .breadcrumb--dark a { color: rgba(255,255,255,.55) !important; }
.breadcrumb--dark { padding: 0 0 18px !important; }
.seclabel--dark { color: #FFB088 !important; border-color: rgba(255,255,255,.18) !important; background: rgba(255,255,255,.06) !important; }
.apr-facts--dark .apr-fact { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
.apr-facts--dark .apr-fact__value { color: #fff; }
.apr-facts--dark .apr-fact__label { color: rgba(255,255,255,.55); }
.apr-facts--dark .apr-fact__icon { background: rgba(255,90,0,.18); }
.apr-facts--dark .apr-fact__icon svg { color: #FF8A47; }

/* ---------- trust strip ---------- */
.apr-trust { display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between; padding: 20px 0; margin: 0 0 40px; border-bottom: 1px solid var(--line); }
.apr-trust span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.apr-trust svg { width: 18px; height: 18px; color: var(--safety-deep); }

/* ---------- product cards ---------- */
.apr-pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.apr-pcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.apr-pcard:hover { border-color: var(--safety); transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20,21,26,.08); }
.apr-pcard__img { aspect-ratio: 4 / 3; background: var(--paper-2); display: flex; align-items: center; justify-content: center; padding: 18px; }
.apr-pcard__img img { width: 100%; height: 100%; object-fit: contain; }
.apr-pcard__body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.apr-pcard__title { font-family: var(--font-display); font-weight: 800; font-size: 17px; margin: 0 0 6px; }
.apr-pcard__price { font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--safety-deep); }
.apr-pcard__sub { font-size: 12px; color: var(--steel-light); margin-bottom: 10px; }
.apr-pcard__facts { list-style: none; margin: 0 0 14px; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--steel); line-height: 1.8; }
.apr-pcard__facts strong { color: var(--ink); font-weight: 600; }
.apr-pcard__cta { margin-top: auto; font-weight: 700; font-size: 13.5px; color: var(--safety-deep); }
@media (max-width: 900px) { .apr-pgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .apr-pgrid { grid-template-columns: 1fr; } }

/* ---------- structural vs roll-formed ---------- */
.apr-explain { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: start; }
.apr-explain__copy p { font-size: 15px; color: var(--steel); line-height: 1.75; margin: 0 0 14px; }
.apr-choose { display: grid; gap: 12px; }
.apr-choose__card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--safety); border-radius: 10px; padding: 16px 18px; }
.apr-choose__card h3 { font-family: var(--font-display); font-size: 15.5px; margin: 0 0 4px; }
.apr-choose__card p { font-size: 13.5px; color: var(--steel); line-height: 1.6; margin: 0 0 6px; }
.apr-choose__card a { font-size: 13px; font-weight: 700; color: var(--safety-deep); text-decoration: none; }
@media (max-width: 900px) { .apr-explain { grid-template-columns: 1fr; } }

/* ---------- used inventory (Ninja Tables) ---------- */
.apr-used { margin-bottom: 18px; }
.apr-used__title { font-family: var(--font-display); font-size: 16px; margin: 0 0 12px; }
.apr-used table { font-size: 13px; }

/* ---------- quote form (Fluent Forms) ---------- */
.apr-quote { display: grid; grid-template-columns: 1fr 1.1fr; gap: 36px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; margin: 8px 0 64px; }
.apr-quote__copy p { font-size: 14.5px; color: var(--steel); line-height: 1.7; }
.apr-quote__phone a { color: var(--safety-deep); font-weight: 700; text-decoration: none; }
.apr-quote .ff-el-input--label label { font-family: var(--font-mono) !important; font-size: 11px !important; text-transform: uppercase; letter-spacing: .05em; color: var(--steel-light) !important; }
.apr-quote .ff-el-form-control { border: 1px solid var(--line) !important; border-radius: 8px !important; padding: 11px 13px !important; font-size: 14px !important; }
.apr-quote .ff-btn-submit { background: var(--safety) !important; border: 2px solid var(--safety) !important; color: #fff !important; border-radius: 999px !important; padding: 13px 28px !important; font-family: var(--font-display) !important; font-weight: 700 !important; }
.apr-quote .ff-btn-submit:hover { background: #fff !important; color: var(--safety-deep) !important; }
@media (max-width: 900px) { .apr-quote { grid-template-columns: 1fr; padding: 22px; } }

/* sticky bar shows only after scrolling past the buy box (set by apr-product.js) */
@media (max-width: 899px) { .sticky-quote-bar { display: none !important; } }

/* ---------- header on small phones: keep logo, quote button and menu on one line ---------- */
@media (max-width: 520px) {
	.nav .wrap { padding: 10px 14px; gap: 10px; }
	.nav__logo { font-size: 15px; gap: 6px; }
	.nav__logo-img { width: 26px; height: 26px; }
	.nav__cta { gap: 8px; }
	.nav__quote-btn { padding: 9px 14px !important; font-size: 12.5px !important; }
	.utilbar .wrap { padding: 6px 14px; font-size: 11px; gap: 10px; }
}
@media (max-width: 380px) { .nav__logo { font-size: 13px; } .nav__logo-img { width: 24px; height: 24px; } .nav__quote-btn { padding: 8px 12px !important; font-size: 12px !important; } }

/* Astra's global button styles must not reshape the gallery controls */
.apr-design .product-hero__zoom-btn { padding: 0 !important; width: 36px !important; height: 36px !important; min-height: 0 !important; line-height: 1 !important; background: rgba(255,255,255,.92) !important; color: var(--ink) !important; }
.apr-design .product-hero__thumb, .apr-design .lightbox__close, .apr-design .lightbox__arrow { padding: 0 !important; min-height: 0 !important; line-height: 1 !important; }
.apr-design .product-hero__thumb { background: var(--paper-2) !important; }

/* matrix cells with more than one item (post styles, gauges) */
.apr-matrix__cell + .apr-matrix__cell { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.apr-matrix__sub { display: block; font-size: 11px; color: var(--steel); }
.apr-matrix__extra { display: block; font-size: 11.5px; color: var(--safety-deep); font-weight: 600; }
.apr-mt-sm { margin-top: 14px; }
.apr-matrix--list { min-width: 0 !important; }
.apr-pcard__desc { font-size: 13.5px; color: var(--steel); line-height: 1.6; margin: 0 0 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- isolation from the old site's global Elementor/Astra typography ---------- */
body.apr-design h1, body.apr-design h2, body.apr-design h3,
body.apr-design .section__heading, body.apr-design .apr-pcard__title, body.apr-design .apr-choose__card h3,
body.apr-design .consider-card h3, body.apr-design .apr-used__title, body.apr-design .product-cta h2,
body.apr-design .apr-fact__value { font-family: var(--font-display) !important; letter-spacing: -0.01em; }
body.apr-design .section__heading { font-size: clamp(22px, 2.6vw, 28px) !important; line-height: 1.2 !important; font-weight: 900 !important; }
body.apr-design .apr-syshero h1 { font-size: clamp(32px, 5vw, 54px) !important; line-height: 1.04 !important; }
body.apr-design .product-hero__info h1 { font-size: 30px !important; line-height: 1.15 !important; }
body.apr-design, body.apr-design p, body.apr-design li, body.apr-design td, body.apr-design th { font-family: var(--font-body); }
body.apr-design .breadcrumb, body.apr-design .breadcrumb a { font-family: var(--font-mono) !important; font-size: 12.5px !important; }
body.apr-design .apr-pcard__desc { font-size: 13.5px !important; line-height: 1.6 !important; }
body.apr-design .apr-pcard__title { font-size: 17px !important; line-height: 1.3 !important; }
body.apr-design .nav__top-link { background: none !important; border: 0 !important; padding: 0 !important; color: #1f2937 !important; font-family: var(--font-body) !important; font-weight: 700 !important; box-shadow: none !important; }
body.apr-design .nav__top-link:hover, body.apr-design .nav__item.is-open .nav__top-link { color: #ff6a00 !important; }
body.apr-design .nav__mobile-toplink, body.apr-design .nav__hamburger, body.apr-design .nav__mobile-close { background: none !important; border: 0 !important; box-shadow: none !important; color: var(--ink) !important; font-family: var(--font-display) !important; }
body.apr-design .nav__mobile-toplink { padding: 15px 20px !important; }
body.apr-design .nav__hamburger { padding: 0 !important; }
body.apr-design .minifaq summary { font-family: var(--font-display) !important; }

/* ---------- touch targets: inline links get a 32-44px hit area on touch screens ---------- */
@media (max-width: 1279px) {
	body.apr-design .breadcrumb a { display: inline-block; padding: 9px 0; }
	body.apr-design .apr-choose__card a,
	body.apr-design .product-hero__meta a,
	body.apr-design .apr-quote__phone a { display: inline-block; padding: 10px 0; }
	body.apr-design .apr-buybox .reset_variations { display: inline-block; padding: 8px 12px 8px 0; }
	body.apr-design .product-hero__meta { line-height: 1.5; }
}

/* ---------- phones: one-line info bar, pinned first column in size tables ---------- */
@media (max-width: 600px) {
	.utilbar .wrap > span:last-child { display: none; }
	.utilbar .wrap { justify-content: center; }
	table.apr-matrix tbody th, table.apr-matrix thead th:first-child { position: sticky; left: 0; z-index: 1; }
	table.apr-matrix thead th:first-child { background: var(--ink); }
	table.apr-matrix tbody th { box-shadow: 1px 0 0 var(--line); }
	table.apr-matrix th, table.apr-matrix td { padding: 10px 11px; }
	.apr-swipe { display: block !important; }
}
@media (min-width: 601px) and (max-width: 900px) {
	table.apr-matrix tbody th, table.apr-matrix thead th:first-child { position: sticky; left: 0; z-index: 1; }
	table.apr-matrix thead th:first-child { background: var(--ink); }
}
.apr-pcard__img { aspect-ratio: auto; min-height: 180px; max-height: 320px; }
.apr-pcard__img img { max-height: 280px; }

.apr-swipe { display: none; font-size: 11.5px; color: var(--steel-light); margin: 8px 0 0; }

/* images that fail to load collapse into a neutral panel instead of a broken icon */
img.apr-img-missing { visibility: hidden; }

/* Astra adds its own scroll-to-top button; redesigned pages have their own controls */
body.apr-design #ast-scroll-top { display: none !important; }

/* ---------- v3b fixes ---------- */
/* dark heroes: headings stay white even against Astra's global heading colour */
body.apr-design .calc-hero h1, body.apr-design .apr-syshero h1 { color: #fff; }
/* WooCommerce caps every number box at 58px; only its own quantity box should be narrow */
body.apr-design .calc-field input[type="number"] { max-width: none; }
/* Astra pads every <button>; the round back-to-top button must stay a 46px circle */
body.apr-design .back-to-top { padding: 0 !important; min-height: 0 !important; line-height: 1 !important; display: flex !important; align-items: center; justify-content: center; box-sizing: border-box; }
body.apr-design .back-to-top svg { width: 20px; height: 20px; flex-shrink: 0; }
/* desktop header between 1280 and 1679px: icon-only Account/Wishlist, cart shows item count only, so the menu never runs into the right-hand group */
@media (min-width: 1280px) and (max-width: 1679px) {
	.nav__cta .nav__icon-link:not(.nav__icon-link--cart) .nav__icon-label { display: none; }
	.nav__cta .apr-cart-total { display: none; }
	.nav__cta .apr-cart-count:not(:has(.apr-cart-num)) { display: none; }
	.apr-cart-num { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--safety); color: #fff; font-size: 11.5px; font-weight: 700; }
}
@media (min-width: 1280px) and (max-width: 1399px) {
	.nav__links { gap: 10px; padding-left: 4px; }
	.nav__logo { font-size: 15px; }
}

/* ---------- v3c: pinned header ---------- */
/* The nav lives inside <header>; a sticky element cannot outlive its parent, so let the header box dissolve and the nav stick to the page */
body.apr-design { --apr-adminbar: 0px; }
@media (min-width: 783px) { body.apr-design.admin-bar { --apr-adminbar: 32px; } }
@media (min-width: 601px) and (max-width: 782px) { body.apr-design.admin-bar { --apr-adminbar: 46px; } }
body.apr-design > header { display: contents; }
body.apr-design .nav { position: sticky; top: var(--apr-adminbar); z-index: 60; }
body.apr-design .calc-nav { top: calc(var(--nav-height, 76px) + var(--apr-adminbar)); }
body.apr-design .calc-result { top: calc(var(--nav-height, 76px) + var(--subnav-height, 57px) + 16px + var(--apr-adminbar)); }
body.apr-design .filters { top: calc(var(--nav-height, 76px) + 4px + var(--apr-adminbar)); }
/* footer bottom row keeps clear of the round back-to-top button */
body.apr-design .footer__bottom { padding-right: 72px !important; }
@media (max-width: 600px) { body.apr-design .footer__bottom { padding-right: 0 !important; padding-bottom: 64px !important; } }
/* quote section: the three ticks line up with the copy above them */
body.apr-design .apr-quote__copy .help-choosing__checks { justify-content: flex-start; text-align: left; }

/* ---------- used-inventory tables (Ninja Tables, filled from Google Sheets) ---------- */
/* our section already titles each table, so drop the table's own repeated title */
body.apr-design .apr-used .table_title { display: none; }
/* on phones the table scrolls sideways instead of cutting off the price column */
body.apr-design .apr-used .ninja_table_wrapper,
body.apr-design .apr-tab__body .ninja_table_wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
body.apr-design .apr-used table.foo-table,
body.apr-design .apr-tab__body table.foo-table { min-width: 520px; }

/* ---------- phone menu ---------- */
/* the desktop mega-menu rule (.mega__parent padding 4px 0 !important) must not strip the phone menu's indent */
body.apr-design .nav__mobile-sub a.mega__parent { display: block !important; padding: 12px 20px !important; white-space: normal !important; }
/* when logged in, open the panel below the WordPress admin bar so its logo and close button stay visible */
@media (max-width: 782px) { body.apr-design.admin-bar .nav__mobile-panel { top: 46px; } }
@media (min-width: 783px) { body.apr-design.admin-bar .nav__mobile-panel { top: 32px; } }

/* ---------- back-to-top on every design page (button lives in footer-apr.php) ---------- */
body.apr-design .back-to-top {
	position: fixed; bottom: 28px; right: 28px; width: 46px; height: 46px; border-radius: 50%;
	background: var(--ink); border: none; color: #fff; cursor: pointer;
	box-shadow: 0 8px 22px rgba(20,21,26,0.25);
	opacity: 0; visibility: hidden; transform: translateY(10px); z-index: 80;
	transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background 0.2s ease, bottom 0.25s ease;
}
body.apr-design .back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
body.apr-design .back-to-top:hover { background: var(--safety); }
body.apr-design .back-to-top:focus-visible { outline: 3px solid var(--safety-deep); outline-offset: 2px; }
body.apr-design.apr-bar-up .back-to-top { bottom: 104px; }
@media (max-width: 700px) { body.apr-design .back-to-top { bottom: 18px; right: 18px; width: 42px !important; height: 42px !important; } }
@media (prefers-reduced-motion: reduce) { body.apr-design .back-to-top { transition: opacity 0.1s linear; } }

/* ---------- phone tables ---------- */
.apr-scrollshade { position: relative; }
.apr-scrollshade::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 28px; pointer-events: none; opacity: 0; transition: opacity 0.2s ease; background: linear-gradient(to right, rgba(20,21,26,0), rgba(20,21,26,0.16)); border-radius: 0 12px 12px 0; }
.apr-scrollshade.has-more::after { opacity: 1; }
@media (max-width: 900px) {
	table.apr-matrix .apr-matrix__price, table.apr-matrix .apr-matrix__extra, table.apr-matrix .apr-matrix__sku, table.apr-matrix .apr-matrix__sub { white-space: nowrap; }
	.apr-swipe { margin: 0 0 8px; }
}

/* ---------- phones: every table row becomes a labelled card (no sideways scrolling) ---------- */
@media (max-width: 600px) {
	body.apr-design .apr-swipe { display: none !important; }
	body.apr-design .apr-scrollshade::after { display: none; }
	body.apr-design .apr-matrix-wrap,
	body.apr-design .apr-used .ninja_table_wrapper,
	body.apr-design .apr-tab__body .ninja_table_wrapper { overflow: visible !important; }
	body.apr-design table.apr-stacked,
	body.apr-design table.apr-stacked tbody { display: block !important; width: 100% !important; min-width: 0 !important; }
	body.apr-design table.apr-stacked thead { display: block !important; }
	body.apr-design table.apr-stacked thead tr.apr-colnames { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	body.apr-design table.apr-stacked thead tr:not(.apr-colnames) { display: block !important; }
	body.apr-design table.apr-stacked thead tr:not(.apr-colnames) > * { display: block !important; width: 100% !important; box-sizing: border-box; }
	body.apr-design table.apr-stacked tr { display: block !important; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; }
	body.apr-design table.apr-stacked tr:last-child { border-bottom: 0; }
	body.apr-design table.apr-stacked tbody th { display: block !important; position: static !important; padding: 0 0 6px !important; background: none !important; box-shadow: none !important; font-size: 15px; text-align: left; }
	body.apr-design table.apr-stacked td { display: block !important; position: relative; padding: 6px 0 6px 42% !important; border: 0 !important; text-align: left !important; white-space: normal !important; min-height: 0; }
	body.apr-design table.apr-stacked td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 40%; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--steel); }
	body.apr-design table.apr-stacked td.apr-matrix__na { display: none !important; }
	body.apr-design table.apr-stacked .apr-matrix__cell + .apr-matrix__cell { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
	body.apr-design table.apr-stacked .apr-matrix__price,
	body.apr-design table.apr-stacked .apr-matrix__extra,
	body.apr-design table.apr-stacked .apr-matrix__sku,
	body.apr-design table.apr-stacked .apr-matrix__sub { white-space: normal; }
	body.apr-design .apr-used table.apr-stacked td { font-size: 14px; }
	body.apr-design .apr-used table.apr-stacked tr { background: transparent; }
	/* inventory tables have no row heading: the first column (description) is the card title */
	body.apr-design .apr-used table.apr-stacked td:first-child,
	body.apr-design .apr-tab__body table.apr-stacked td:first-child { padding-left: 0 !important; font-weight: 700; font-size: 15px; }
	body.apr-design .apr-used table.apr-stacked td:first-child::before,
	body.apr-design .apr-tab__body table.apr-stacked td:first-child::before { display: none; }
}
