/* EGWN responsive compatibility layer — 2026-11-29.
   Adapted from EGWN_Responsive_UI_Patch to the production markup
   (.mast/.navrow, .herowrap/.herotext/.art/.basket, .dept-list, .product-grid/.product,
    .metric, .tabs, .tools, .scroll, .gallery-grid, .request-contact).
   Loads AFTER the approved theme (style.css, market.css, animations/market-motion.css).
   No branding colours, artwork, animations or desktop composition are replaced. */
:root{--egwn-gutter:clamp(12px,3vw,28px);--egwn-touch:44px}
*,*::before,*::after{box-sizing:border-box}
html{min-width:0;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-width:0}
main,header,footer,.frame,.navrow,.mast nav,.herowrap,.herotext,.art,#content,#view,.card,.product,.panel,.grid,.product-grid,.fields,.tools,.tabs,.gallery-grid,.gallery-heading{min-inline-size:0}
#content,#view,.card,.product,.panel,dialog,#status,footer{overflow-wrap:anywhere}
header nav,.mast nav,.navrow nav,.tools,.tabs{display:flex;flex-wrap:wrap;gap:8px;align-items:center;min-inline-size:0}
button,input,textarea,select{max-inline-size:100%;min-inline-size:0}
button,.contact-action,.herocta{white-space:normal;overflow-wrap:anywhere;touch-action:manipulation}
.contact-action{display:inline-flex;align-items:center;justify-content:center;gap:.35em;text-align:center}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:3px solid #8964de;outline-offset:3px}
.product-image img,.gallery-grid img,.card img,.dept-icon{display:block}
.metric{overflow-wrap:anywhere}
.request-contact .tools{align-items:stretch}
/* Dialogs stay inside the viewport in portrait and landscape. */
dialog{max-inline-size:calc(100% - 2 * var(--egwn-gutter));max-block-size:calc(100vh - 2 * var(--egwn-gutter));max-block-size:calc(100dvh - 2 * var(--egwn-gutter));padding:clamp(12px,3vw,24px);overflow:auto;overscroll-behavior:contain;margin:auto}
dialog.gallery{max-inline-size:min(920px,calc(100% - 2 * var(--egwn-gutter)))}
dialog h2{line-height:1.25;overflow-wrap:anywhere}
dialog form .tools{position:sticky;bottom:0;background:#fff;padding:8px 0;margin:0;z-index:1}
/* Trustee register tables scroll inside their own region, never the page. */
.scroll{max-inline-size:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}

@media(max-width:900px){
  input,select,textarea{font-size:16px;line-height:1.35}
  button,.contact-action,.herocta,.tools input,.tools select{min-block-size:var(--egwn-touch)}
  .herowrap{grid-template-columns:minmax(0,1fr);align-items:start;gap:clamp(10px,3vw,22px)}
  .herotext,.art{max-inline-size:100%;width:100%}
  .navrow{flex-wrap:wrap;gap:12px}
  .grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,228px),1fr))}
  .card .tools>button,.product-actions button{flex:1 1 120px}
  .gallery-heading{top:0;align-items:flex-start;gap:12px;flex-wrap:wrap}
  .gallery-heading h2{flex:1 1 200px;margin:0}
  .scroll th,.scroll td{white-space:normal;min-inline-size:88px;max-inline-size:320px;overflow-wrap:anywhere;vertical-align:top}
  .scroll td button{margin:2px 0}
  .metric{font-size:clamp(1.2rem,3.4vw,1.7rem)}
}

/* Tablet portrait band: stack the hero while keeping the approved mobile hero untouched. */
@media(min-width:601px) and (max-width:900px){
  .herotext{padding:clamp(24px,4vw,40px) 0 0}
  .art{height:auto;margin-top:2px}
  .art .basket{width:min(100%,470px);height:auto}
  .market-pulse{grid-template-columns:auto minmax(0,1fr)}
  .market-pulse a{grid-column:2;white-space:normal}
  .value-proof{max-inline-size:100%}
}

@media(max-width:600px){
  :root{--egwn-gutter:12px}
  /* Approved mobile hero: basket at 114% of the art band, resolved explicitly
     because a percentage height on the replaced image resolves against its
     intrinsic height in Chromium and inflated the artwork to ~986x854. */
  .art .basket{width:auto;height:clamp(234px,60vw,325px)}
  .frame{padding-inline:var(--egwn-gutter)}
  .mast{padding:0}
  .navrow{min-height:0;padding-block:10px;align-items:center}
  .mast nav{flex:1 1 100%;width:100%;align-items:stretch;gap:6px}
  .mast nav button{flex:1 1 110px}
  .brand{font-size:18px}
  main.frame{padding-top:20px;padding-bottom:2.5rem}
  #departments{padding-top:18px}
  .grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:12px}
  .card{padding:12px}
  .product-image{height:min(62vw,260px)}
  .product-info{padding:14px}
  .product-actions button{flex:1 1 130px}
  .market-pulse{grid-template-columns:1fr;padding:11px}.market-pulse-mark{width:28px;height:28px;font-size:15px}.market-pulse a{grid-column:1}
  .value-proof{padding:9px 10px}.value-proof p strong{font-size:15px}
  .market-seal{right:8px;top:8px;font-size:10px}
  .gallery-grid{grid-template-columns:minmax(0,1fr)}
  .gallery-grid img{height:auto;max-block-size:300px}
  .fields{grid-template-columns:minmax(0,1fr)}
  .tabs button{flex:1 1 110px}
  .request-contact{padding:12px}
  .request-contact .contact-action{flex:1 1 100%}
  footer{padding:22px 0}
  .foot{flex-direction:column;align-items:flex-start;gap:6px;text-align:left}
  dialog form .tools button{flex:1 1 110px}
}

@media(max-width:360px){
  .product-actions button,.tabs button{flex:1 1 100%}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}
