/* Pass 1: readable, reachable navigation from narrow phones through tablets. */
:root { --touch-size:44px; }
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip-path:inset(50%)!important; white-space:nowrap!important; border:0!important; }
.brand { min-height:44px; }
/* Pass 9: a clear, readable return from hosted checkout on every screen. */
.result-card { max-width:760px; padding-block:60px; }
.result-card h1 { font-size:clamp(30px,5vw,44px); line-height:1.2; margin:20px 0; }
.result-card > p { font-size:15px; }
#result-totals { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:14px 24px; margin:28px 0; padding:20px; background:#edf5ee; border-radius:10px; }
#result-totals dt, #result-totals dd { margin:0; font-size:15px; }
#result-totals dd { text-align:right; font-variant-numeric:tabular-nums; }
#result-totals :nth-last-child(-n+2) { border-top:1px solid var(--line); padding-top:14px; font-weight:700; }
.result-notice { margin:24px 0; }
.result-actions { display:flex; gap:12px; flex-wrap:wrap; }
.result-actions > * { min-height:48px; margin:0; }
.product-spec { display:block; margin:8px 0; font-size:12px; color:var(--muted); }
@media(max-width:720px) { .result-card { padding-top:36px; } .result-actions > * { width:100%; justify-content:center; } }
.no-branding .product-signature { display:none; }
.input-hint { font-size:12px; color:var(--muted); text-align:right; margin-top:-6px; }
.branding-option { min-height:44px; }
.branding-option input[type=checkbox] { width:22px!important; height:22px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline:3px solid var(--teal); outline-offset:3px; }
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  *, *::before, *::after { animation:none!important; transition:none!important; }
  .button:hover { transform:none; }
}
@media(forced-colors:active) {
  button, .button, .product-image, .design-summary { border:1px solid ButtonText; }
  [aria-pressed=true] { outline:2px solid Highlight; }
}
body { overflow-wrap:break-word; }
main, .hero-copy, .section-top > *, .caption-showcase > *, .story > * { min-width:0; }
button, a, input, select, summary { scroll-margin-block:18px; }
button:disabled { cursor:not-allowed; }
.announcement { padding-inline:max(16px,env(safe-area-inset-left)); }
nav a { display:flex; align-items:center; min-height:44px; }
.helper, .privacy-note { font-size:13px; }
select, input { max-width:100%; }
.hero-art { width:100%; }
.hero h1 { overflow-wrap:normal; }
@media(max-width:720px) {
  header { gap:4px 8px; padding:10px max(16px,env(safe-area-inset-left)) 0; }
  nav { gap:6px; }
  nav a { padding:8px 0; min-height:44px; font-size:12px; }
  .brand { letter-spacing:1.5px; gap:8px; font-size:14px; }
  .brand-logo { width:40px; height:40px; }
  .hero { padding-top:28px; }
  .hero h1 { font-size:clamp(46px,13.5vw,70px); }
  .hero .eyebrow { letter-spacing:1px; }
  .caption-card-actions > button { flex:1 1 140px; justify-content:center; }
  .faq summary { min-height:48px; }
  footer .footer-brand { font-size:14px; }
}
/* Pass 3: clear direct manipulation, with no position sliders. */
.photo-window::before { content:''; position:absolute; inset:-20px; }
.photo-window.dragging { outline:2px dashed var(--teal); outline-offset:6px; }
.photo-window:focus-visible { outline:3px solid var(--teal); outline-offset:6px; }
.placement-buttons { gap:8px; }
.placement-buttons .small-btn:disabled { opacity:.4; }
/* Pass 10: issues found during the phone / tablet / desktop regression sweep. */
.preview-area::after { display:none; }
input[type=range] { min-height:44px; }
.bag-preview, .bag-preview * { pointer-events:none; }
#toast { max-width:calc(100vw - 32px); white-space:normal; }
@media(max-width:720px) {
  .cart-bottom p { margin:8px 0; }
  .cart-bottom { padding-top:12px; }
  .continue-shopping { margin-top:4px; }
}
/* Pass 6: edit and undo are comfortable touch actions, even with long names. */
#cart[open] { display:flex; flex-direction:column; overflow:hidden; max-height:min(92dvh,var(--visual-height,100dvh)); }
#cart .dialog-header { flex-shrink:0; }
#cart-items { min-height:0; overflow:auto; overscroll-behavior:contain; }
.cart-bottom { flex-shrink:0; }
.quantity-control button { width:44px; height:44px; min-height:44px; }
.bag-item-actions { display:flex; flex-wrap:wrap; gap:4px 16px; }
.cart-row .remove-item, .cart-row .edit-item { min-height:44px; font-size:13px; }
.cart-row .edit-item { color:var(--teal); font-weight:600; }
.bag-recovery { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px; background:#e8f4ed; border-radius:8px; font-size:13px; }
.bag-recovery .small-btn { margin:0; }
@media(max-width:720px) {
  #cart[open] { height:var(--visual-height,100dvh); max-height:100dvh; }
  #cart .dialog-header { position:static; }
  #cart .cart-bottom { padding-bottom:env(safe-area-inset-bottom); }
  .cart-row { display:grid; grid-template-columns:68px minmax(0,1fr); gap:12px; }
  .bag-preview { width:68px; height:94px; grid-row:span 2; }
  .cart-row > strong { grid-column:2; padding-top:0; }
  .cart-row .item-copy { min-width:0; }
}
/* Pass 5: photo editing stays usable without page scrolling under the canvas. */
#photo-editor[open] { display:flex; flex-direction:column; max-height:min(94dvh,var(--visual-height,100dvh)); overflow:auto; }
#photo-editor .dialog-header { flex-shrink:0; }
#photo-editor .canvas-wrap { flex-shrink:0; }
#photo-editor .edit-footer { position:sticky; bottom:-26px; background:var(--paper); padding:12px 0; border-top:1px solid var(--line); z-index:2; }
#photo-editor select { font-size:16px; min-height:44px; }
#photo-editor input[type=range] { min-height:44px; }
#edit-canvas:focus-visible { outline:3px solid var(--teal); outline-offset:-3px; }
#photo-tool-status { margin:10px 0; }
@media(max-width:720px) {
  #photo-editor[open] { width:100%; height:var(--visual-height,100dvh); max-height:100dvh; }
  #photo-editor .dialog-header { position:static; margin:0 0 12px; padding:0 0 12px; }
  #photo-editor .dialog-header h2 { font-size:22px; }
  #photo-editor .edit-footer { bottom:-16px; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
  .brush-modes { flex-wrap:wrap; }
}
/* Pass 2: the editor keeps its next action reachable, including short screens. */
dialog { overscroll-behavior:contain; }
#customizer[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; height:min(860px,94dvh); max-height:min(94dvh,var(--visual-height,100dvh)); overflow:hidden; }
#customizer .dialog-header { margin-bottom:16px; }
#customizer .editor { min-height:0; overflow:hidden; align-items:stretch; }
#customizer .preview-area { position:relative; top:0; height:100%; min-height:0; }
#customizer .editor-controls { min-height:0; max-height:none; overflow:auto; padding:0 10px 16px 2px; overscroll-behavior:contain; scroll-padding-block:70px 18px; }
.customizer-steps { position:sticky; top:0; z-index:2; background:var(--paper); padding-top:4px; }
.customizer-footer { border-top:1px solid var(--line); background:var(--paper); padding-top:10px; }
.step-navigation { position:static; padding:0; justify-content:flex-end; }
.step-navigation .button { flex:0 1 360px; justify-content:center; }
.editor-privacy { margin-top:4px; }
.editor-privacy summary { font-size:12px; min-height:44px; display:flex; align-items:center; cursor:pointer; text-decoration:underline; }
.editor-privacy p { max-height:90px; overflow:auto; padding-bottom:8px; }
@media(max-width:720px) {
  #customizer[open] { height:var(--visual-height,100dvh); max-height:100dvh; padding:12px max(12px,env(safe-area-inset-left)); }
  #customizer .dialog-header { position:static; margin:0 0 10px; padding:0 0 10px; }
  #customizer .dialog-header h2 { font-size:22px; }
  #customizer .editor { grid-template-rows:clamp(130px,24dvh,200px) minmax(0,1fr); gap:10px; }
  #customizer .preview-area { box-shadow:none; }
  #customizer .editor-controls { padding:0 4px 14px; }
  #customizer[open], #cart[open], #photo-editor[open] { padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)); padding-top:max(12px,env(safe-area-inset-top)); }
  .keyboard-open #customizer .preview-area { display:none; }
  .keyboard-open #customizer .editor { grid-template-rows:minmax(0,1fr); }
  .customizer-footer { padding-bottom:env(safe-area-inset-bottom); }
  .step-navigation .button { flex:1; }
  .preview-label { max-width:95%; text-align:center; font-size:9px; letter-spacing:.6px; }
}
@media(max-height:600px) {
  #customizer .dialog-header .eyebrow { display:none; }
  #customizer .dialog-header h2 { margin:0; font-size:20px; }
  #customizer .editor { grid-template-rows:100px minmax(0,1fr); }
  #customizer .preview-area .product-mock { transform:scale(.38); margin:0; }
  #customizer .preview-label { bottom:4px; font-size:8px; }
}
@media(min-width:721px) and (max-height:600px) {
  #customizer .editor { grid-template-rows:minmax(0,1fr); }
  #customizer .preview-area .product-mock { transform:scale(.65); }
}
@media(max-height:450px) {
  /* Landscape and heavily zoomed screens need one scroll area, not a zero-height bag list. */
  #cart[open] { display:block; overflow:auto; }
  #cart-items { overflow:visible; }
  #cart .dialog-header { position:sticky; top:-26px; z-index:3; background:var(--paper); padding-bottom:10px; }
}
@media(max-width:360px) {
  .hero-art { height:300px; }
  .hero-mug { left:-22px; transform:rotate(-8deg) scale(.66); }
  .hero-cup { right:3%; transform:rotate(11deg) scale(.66); }
  .hero-sticker { right:-20px; transform:rotate(15deg) scale(.55); }
  .scribble { font-size:12px; left:30%; }
  .scribble svg { width:40px; right:-42px; }
  .filters button { flex-grow:1; }
}
