/* ==========================================================================
   MT Treatment — Shop (products, cart, checkout, order)
   Builds on the Industrial Navy system in ai-components.css: same tokens
   (--navy-*, --steel-*, --accent, --font-display, --shadow-card), same
   page-hero / section / svc-feature / stat-strip patterns.
   Loaded on every page (the header cart badge lives here too).
   ========================================================================== */

.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; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--color-muted); }

/* ---- Header cart ---- */
.nav-cart { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--navy-800); text-decoration: none; transition: background .15s, color .15s; }
.nav-cart:hover, .nav-cart[aria-current="page"] { background: var(--steel-100); color: var(--accent); text-decoration: none; }
.nav-cart svg { display: block; }
.nav-cart-count { position: absolute; top: 2px; right: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.nav-cart-count[hidden] { display: none; }
@media (max-width: 900px) { .nav-actions { gap: var(--space-2); } }
@media (max-width: 520px) {
    .nav-cta { padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); white-space: nowrap; }
    .nav-cart { width: 38px; height: 38px; }
}
@media (max-width: 400px) { .nav-cta { font-size: var(--fs-xs); padding: var(--space-2); } .brand-logo { height: 32px; } }

/* ---- Buttons & small bits ---- */
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--fs-sm); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: var(--fs-sm); color: var(--color-muted); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--color-danger); }
.alert-error { background: #fdecec; border: 1px solid #f5b5b5; color: #7f1d1d; padding: var(--space-4) var(--space-5); border-radius: var(--radius-card); margin: 0 0 var(--space-5); }
.alert-info { background: var(--steel-100); border: 1px solid var(--steel-200); color: var(--navy-800); padding: var(--space-4) var(--space-5); border-radius: var(--radius-card); margin: 0 0 var(--space-5); }
.alert a { color: inherit; font-weight: 700; }

/* ---- Hero variants ---- */
.page-hero-slim .container { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.page-hero-slim .breadcrumb { margin-bottom: var(--space-3); }
.page-hero-slim h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0; }
.page-hero-slim .hero-eyebrow { margin-bottom: var(--space-2); }
.shop-hero .container { padding-bottom: 3rem; }
.shop-search { display: flex; gap: var(--space-2); max-width: 560px; margin-top: var(--space-2); }
.shop-search input { flex: 1; min-width: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-button); border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.96); font: inherit; color: var(--ink-strong); }
.shop-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Category tiles ---- */
.shop-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); }
@media (max-width: 400px) { .shop-cat-grid { grid-template-columns: 1fr; } }
.shop-cat-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); box-shadow: var(--shadow-card); text-decoration: none; color: inherit; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.shop-cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); text-decoration: none; }
.shop-cat-media { flex: 0 0 76px; height: 76px; border-radius: 10px; background: var(--tile, #fff); border: 1px solid var(--steel-100); display: grid; place-items: center; overflow: hidden; }
.shop-cat-media img { width: 100%; height: 100%; object-fit: contain; }
.shop-cat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-cat-body strong { font-family: var(--font-display); color: var(--navy-800); font-size: var(--fs-md); line-height: 1.25; }
.shop-cat-body span { font-size: var(--fs-xs); color: var(--color-ink-soft); }
.shop-cat-body .shop-cat-meta { color: var(--accent); font-weight: 700; margin-top: 2px; white-space: nowrap; }

/* ---- Listing toolbar, grid, pager ---- */
.shop-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.shop-count { margin: 0; color: var(--color-ink-soft); font-size: var(--fs-sm); }
.shop-count a { color: var(--accent); }
.shop-sort { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); font-weight: 600; color: var(--navy-800); }
.shop-sort select, .field select { padding: var(--space-2) var(--space-3); border: 1px solid var(--steel-200); border-radius: var(--radius-button); font: inherit; background: #fff; color: var(--ink-strong); }
.pager { display: flex; justify-content: center; align-items: center; gap: var(--space-4); margin-top: var(--space-7); font-size: var(--fs-sm); color: var(--color-muted); }
.shop-empty { text-align: center; padding: var(--space-7) var(--space-4); background: var(--steel-100); border-radius: var(--radius-card); }
.shop-empty h2 { font-size: var(--fs-2xl); }
.shop-empty p { color: var(--color-ink-soft); max-width: 520px; margin: 0 auto var(--space-5); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-5); }
.product-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product-card-media { display: grid; place-items: center; aspect-ratio: 1 / 1; background: var(--tile, #fff); border-bottom: 1px solid var(--steel-100); padding: var(--space-4); }
.product-card-media img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s var(--ease); }
.product-card:hover .product-card-media img { transform: scale(1.04); }
.product-card-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-4) var(--space-5); flex: 1; }
.product-card-cat { margin: 0; font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.product-card-body h3 { font-size: var(--fs-md); line-height: 1.3; margin: 0; }
.product-card-body h3 a { color: var(--navy-800); text-decoration: none; }
.product-card-body h3 a:hover { color: var(--accent); }
.product-card-body .add-form { margin-top: auto; padding-top: var(--space-3); }
.product-card-body .add-form .btn { width: 100%; }
.product-sku { margin: 0; font-size: var(--fs-xs); color: var(--color-muted); font-family: var(--font-mono); letter-spacing: .02em; }
.product-price { margin: var(--space-2) 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-2); }
.product-price strong { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--ink-strong); font-weight: 800; }
.product-price s { color: var(--color-muted); font-size: var(--fs-sm); }
.product-price .save { font-size: var(--fs-xs); font-weight: 800; color: var(--color-success); background: #e7f6ec; padding: 2px 8px; border-radius: var(--radius-pill); }
.product-price-lg strong { font-size: var(--fs-3xl); }
.product-price-lg s { font-size: var(--fs-md); }
.product-price-quote strong { font-size: var(--fs-lg); color: var(--navy-800); }
.product-price-lg.product-price-quote strong { font-size: var(--fs-2xl); }
.product-noimg { display: grid; place-items: center; width: 100%; height: 100%; min-height: 80px; color: var(--steel-200); }
.product-noimg svg { width: 38%; max-width: 90px; height: auto; }
.product-unavailable { margin: var(--space-3) 0 0; font-size: var(--fs-sm); color: var(--color-ink-soft); }

/* ---- Product page ---- */
.product-main { padding-top: var(--space-7); }
.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: start; }
.product-gallery { position: sticky; top: 130px; display: grid; place-items: center; aspect-ratio: 1 / 1; background: var(--tile, #fff); border: 1px solid var(--steel-200); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--space-6); }
.product-gallery img { width: 100%; height: 100%; object-fit: contain; }
.product-info h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.15; margin: 0 0 var(--space-3); }
.product-info .kicker a { color: inherit; text-decoration: none; }
.product-meta { color: var(--color-ink-soft); font-size: var(--fs-sm); margin: 0 0 var(--space-4); }
.product-price-note { font-size: var(--fs-xs); color: var(--color-muted); margin: var(--space-2) 0 var(--space-5); }
.product-buy .add-form { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.qty-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--navy-800); text-transform: uppercase; letter-spacing: .06em; }
.qty-field input { width: 84px; padding: var(--space-3); border: 1px solid var(--steel-200); border-radius: var(--radius-button); font: inherit; font-size: var(--fs-md); text-align: center; }
.product-buy .qty-field input { padding: 0.95rem var(--space-3); }
.qty-field input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.product-assurances { list-style: none; margin: var(--space-6) 0 0; padding: var(--space-5) 0 0; border-top: 1px solid var(--steel-200); display: flex; flex-direction: column; gap: var(--space-3); }
.product-assurances li { position: relative; padding-left: 28px; font-size: var(--fs-sm); color: var(--color-ink-soft); }
.product-assurances li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 5px; background: rgba(46,125,255,.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e7dff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.product-assurances a { color: var(--accent); }
.product-details { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-8); align-items: start; }
.spec-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); overflow: hidden; font-size: var(--fs-sm); }
.spec-table th, .spec-table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--steel-100); vertical-align: top; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table th { width: 40%; color: var(--navy-800); font-weight: 700; background: var(--steel-100); }
.product-fineprint { font-size: var(--fs-xs); color: var(--color-muted); margin-top: var(--space-4); }
.product-fineprint a { color: var(--accent); }
.included-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.included-list li { background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); padding: var(--space-3) var(--space-4); font-weight: 600; color: var(--navy-800); font-size: var(--fs-sm); }
.install-cta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; padding: var(--space-7); border-radius: var(--radius-card); color: #fff; background: radial-gradient(700px 300px at 90% 0%, rgba(46,125,255,.28), transparent 65%), linear-gradient(120deg, var(--navy-800), var(--navy-900)); }
.install-cta > div:first-child { max-width: 620px; }
.install-cta h2 { color: #fff; font-size: var(--fs-2xl); margin: 0 0 var(--space-3); }
.install-cta p { color: rgba(255,255,255,.75); margin: 0; }
.install-cta .kicker { color: #7db0ff; }
.install-cta-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.install-cta .btn-ghost { color: #fff; border-color: rgba(255,255,255,.45); }
.install-cta .btn-ghost:hover { border-color: #fff; color: #fff; }
@media (max-width: 860px) {
    .product-layout, .product-details { grid-template-columns: 1fr; gap: var(--space-6); }
    .product-gallery { position: static; max-width: 460px; width: 100%; margin: 0 auto; }
    .install-cta { padding: var(--space-6); }
}

/* ---- Cart ---- */
.cart-layout, .order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-7); align-items: start; }
.cart-lines { display: flex; flex-direction: column; gap: var(--space-4); }
.cart-line { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; padding: var(--space-4); background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.cart-line-media { display: grid; place-items: center; width: 96px; height: 96px; background: var(--tile, #fff); border: 1px solid var(--steel-100); border-radius: 10px; padding: 6px; }
.cart-line-media img { width: 100%; height: 100%; object-fit: contain; }
.cart-line-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cart-line-name { font-family: var(--font-display); font-weight: 700; color: var(--navy-800); text-decoration: none; line-height: 1.3; }
.cart-line-name:hover { color: var(--accent); }
.cart-line-actions { display: flex; align-items: flex-end; gap: var(--space-4); margin-top: var(--space-2); flex-wrap: wrap; }
.qty-form { display: flex; align-items: flex-end; gap: var(--space-2); }
.qty-form .qty-field input { padding: var(--space-2); width: 72px; }
.cart-line-total { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); color: var(--ink-strong); white-space: nowrap; }
@media (max-width: 560px) {
    .cart-line { grid-template-columns: 72px minmax(0, 1fr); }
    .cart-line-media { width: 72px; height: 72px; }
    .cart-line-total { grid-column: 2; }
}

/* ---- Summary card (cart, checkout, order) ---- */
.order-summary { position: sticky; top: 130px; background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--space-6); }
.order-summary h2 { font-size: var(--fs-xl); margin: 0 0 var(--space-4); }
.summary-items { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-sm); }
.summary-items li { display: flex; justify-content: space-between; gap: var(--space-3); color: var(--color-ink-soft); }
.summary-items li span:last-child { white-space: nowrap; color: var(--ink-strong); font-weight: 600; }
.summary-items em { font-style: normal; color: var(--color-muted); }
.summary-edit { font-size: var(--fs-xs); color: var(--accent); }
.summary-rows { margin: var(--space-4) 0; padding: var(--space-4) 0 0; border-top: 1px solid var(--steel-200); display: flex; flex-direction: column; gap: var(--space-2); }
.summary-rows > div { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-sm); }
.summary-rows dt { color: var(--color-ink-soft); }
.summary-rows dd { margin: 0; font-weight: 600; white-space: nowrap; }
.summary-rows .summary-total { margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--steel-200); font-size: var(--fs-lg); }
.summary-rows .summary-total dt { color: var(--ink-strong); font-weight: 800; }
.summary-rows .summary-total dd { font-family: var(--font-display); font-weight: 800; }
.summary-note { font-size: var(--fs-xs); color: var(--color-muted); margin: var(--space-4) 0 0; }
.summary-note a { color: inherit; }
.order-summary.is-loading .summary-rows { opacity: .5; transition: opacity .15s; }

/* ---- Express checkout (cart summary) ---- */
#checkout { scroll-margin-top: 140px; }
.checkout-choose { margin: var(--space-5) 0 var(--space-3); font-family: var(--font-display); font-weight: 800; color: var(--navy-800); }
.express-form { margin: 0 0 var(--space-3); }
.express-option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: var(--space-4) var(--space-5); text-align: left; font: inherit; cursor: pointer; border-radius: var(--radius-card); border: 1px solid var(--steel-200); background: #fff; color: var(--navy-800); transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s, background .15s; }
.express-option:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.express-option.express-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(46,125,255,.6); }
.express-option.express-primary:hover { background: var(--accent-600); }
.express-option[disabled] { opacity: .6; cursor: progress; transform: none; }
.express-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-md); display: flex; justify-content: space-between; gap: var(--space-3); width: 100%; }
.express-title em { font-style: normal; font-weight: 700; font-size: var(--fs-sm); opacity: .85; }
.express-sub { font-size: var(--fs-xs); opacity: .8; line-height: 1.4; }
.express-busy { font-size: var(--fs-xs); font-weight: 700; }
.express-wallets { margin: var(--space-4) 0 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-button); background: var(--steel-100); font-size: var(--fs-xs); color: var(--navy-800); }
.checkout-choose + .alert { margin-bottom: 0; }
.product-buy .btn-ghost { background: #fff; }
@media (max-width: 960px) {
    .cart-layout, .order-layout { grid-template-columns: 1fr; }
    .order-summary { position: static; }
}
@media (max-width: 560px) { .order-summary { padding: var(--space-5); } }

/* ---- Order page ---- */
.order-layout h2 { font-size: var(--fs-2xl); margin: var(--space-6) 0 var(--space-3); }
.next-steps { padding-left: var(--space-5); color: var(--color-ink-soft); }
.next-steps li { margin-bottom: var(--space-2); }
.order-layout a { color: var(--accent); }

/* ---- "Added to cart" toast (shop.js) ---- */
.shop-toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); background: var(--navy-900); color: #fff; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 600; transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none; max-width: calc(100vw - 32px); }
.shop-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.shop-toast.is-error { background: #7f1d1d; }
.shop-toast a { color: #fff; background: var(--accent); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); text-decoration: none; white-space: nowrap; }
.add-form .btn.is-busy { opacity: .7; pointer-events: none; }
.add-form .btn.is-added { background: var(--color-success); box-shadow: none; }

.shop-trust .stat-value { font-size: var(--fs-xl); }
@media (prefers-reduced-motion: reduce) {
    .product-card, .shop-cat-card, .shop-toast, .product-card-media img { transition: none; }
}

/* ---- Order request form (email-order mode, /checkout) ---- */
.request-form { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.request-form fieldset { border: 1px solid var(--steel-200); border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); padding: var(--space-5) var(--space-5) var(--space-2); margin: 0; min-width: 0; }
.request-form legend { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); color: var(--navy-800); padding: 0 var(--space-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-4); min-width: 0; }
.field > span { font-size: var(--fs-xs); font-weight: 700; color: var(--navy-800); text-transform: uppercase; letter-spacing: .06em; }
.field > span em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--color-muted); }
.field input, .field select, .field textarea { width: 100%; padding: var(--space-3); border: 1px solid var(--steel-200); border-radius: var(--radius-button); font: inherit; font-size: var(--fs-md); background: #fff; color: var(--ink-strong); }
.field textarea { resize: vertical; min-height: 96px; }
.field.has-error input, .field.has-error select { border-color: var(--color-danger); }
.field-error { font-size: var(--fs-xs); color: var(--color-danger); font-weight: 600; margin: 0 0 var(--space-3); }
.choice-list { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice .express-option { pointer-events: none; }
.choice input:checked + .express-option { border-color: var(--accent); background: rgba(46,125,255,.05); box-shadow: 0 0 0 2px rgba(46,125,255,.25); }
.choice input:focus-visible + .express-option { outline: 2px solid var(--accent); outline-offset: 2px; }
.address[hidden] { display: none; }
.check { display: flex; align-items: flex-start; gap: var(--space-3); font-size: var(--fs-sm); color: var(--color-ink-soft); margin-bottom: var(--space-4); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--accent); }
.request-submit { display: flex; flex-direction: column; gap: var(--space-3); }
.request-submit .btn[disabled] { opacity: .6; cursor: progress; }
.request-submit .summary-note { margin: 0; }
.checkout-page .order-summary .summary-edit { display: inline-block; margin-bottom: var(--space-2); }
.checkout-page .alert-info { margin-bottom: var(--space-6); }
@media (max-width: 560px) {
    .field-row { grid-template-columns: 1fr; }
    .request-form fieldset { padding: var(--space-4) var(--space-4) var(--space-1); }
}
