/* ==========================================================================
   ui-polish.css — presentation layer for the storefront pages (2026-10-27)

   Loaded LAST on each page, after styles.css and the page's own <style>. It
   only refines how things look and move; nothing is hidden, added or removed,
   and no script depends on it. Remove the <link> and the shop looks as before.
   The same motion rules as the staff panels (staff/ui-polish.css): entrance
   animations play once (while <html> has .ui-enter, set by ui-motion.js) or
   when a section is switched to; reduced-motion is respected throughout.
   ========================================================================== */

:root {
  --ui-ease: cubic-bezier(.22, .8, .24, 1);
  --ui-fast: 160ms;
  --ui-mid: 220ms;
  --ui-slow: 300ms;
  --ui-ring: 0 0 0 3px rgba(74, 158, 255, .28);
  --ui-ring-danger: 0 0 0 3px rgba(239, 68, 68, .25);
  --ui-hairline: inset 0 1px 0 rgba(255, 255, 255, .035);
  --ui-elev-1: 0 1px 2px rgba(0, 0, 0, .22), 0 2px 8px -4px rgba(0, 0, 0, .35);
  --ui-elev-2: 0 14px 30px -16px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .3);
  --ui-elev-3: 0 30px 80px -24px rgba(0, 0, 0, .75);
  --ui-hover-border: rgba(74, 158, 255, .45);
}

/* ---------- typography: one family across the shop and the staff panels ---------- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, .section-head h2 { letter-spacing: -.015em; }
.price, .subtotal-row .val, .qty-value { font-variant-numeric: tabular-nums; }
/* the theme's own muted colour, solid: at least 4.5:1 on the fields */
::placeholder { color: var(--muted); opacity: 1; }
::selection { background: rgba(74, 158, 255, .3); }

/* ---------- header ---------- */
.site-header { box-shadow: 0 10px 24px -22px rgba(0, 0, 0, .9); }
.header-search { transition: border-color var(--ui-mid) var(--ui-ease), box-shadow var(--ui-mid) var(--ui-ease); }
.header-search:focus-within { box-shadow: 0 0 0 3px rgba(255, 122, 58, .18); }
.header-search-btn { transition: background-color var(--ui-fast) var(--ui-ease); }
.cart-icon-btn svg { transition: transform var(--ui-fast) var(--ui-ease); }
.cart-icon-btn:hover svg { transform: translateY(-1px); }
.cart-badge { box-shadow: 0 0 0 2px var(--bg); }
.brand .logo { transition: box-shadow var(--ui-mid); }

/* ---------- buttons ---------- */
.btn {
  transition: transform var(--ui-fast) var(--ui-ease), box-shadow var(--ui-mid) var(--ui-ease),
              background-color var(--ui-fast) var(--ui-ease), border-color var(--ui-fast), color var(--ui-fast),
              opacity var(--ui-fast), filter var(--ui-fast);
}
.btn-hero:hover:not(:disabled), .btn-fire:hover:not(:disabled) { filter: brightness(1.06); }
.btn-outline:hover:not(:disabled) { border-color: color-mix(in srgb, var(--border) 45%, var(--primary)); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { filter: saturate(.55); box-shadow: none; }
/* small controls: same timing and press feedback (none of them is positioned by transform) */
.chip, .size-btn, .color-btn, .pdp-size-btn, .pdp-color-btn, .purchase-tab, .resend-btn, .btn-see-more,
.pdp-add-btn, .pdp-buy-btn, .header-search-btn, .tb-user-btn, .lang-btn, .notif-drop-viewall, .label-btn,
.cz-btn, .cz-toggle, .vc-apply, .vc-use, .vc-browse, .opt, .addr-opt, .co-change, .addr-edit, .gc-copy {
  transition: background-color var(--ui-fast) var(--ui-ease), border-color var(--ui-fast) var(--ui-ease),
              color var(--ui-fast), box-shadow var(--ui-mid) var(--ui-ease), transform var(--ui-fast) var(--ui-ease);
}
.chip:active, .size-btn:active, .color-btn:active, .pdp-size-btn:active, .pdp-color-btn:active, .purchase-tab:active,
.btn-see-more:active, .pdp-add-btn:active, .pdp-buy-btn:active, .cz-btn:active, .vc-apply:active, .vc-use:active,
.opt:active, .addr-opt:active { transform: scale(.97); }
:where(button, a, [role="button"], summary, label[for]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- form fields ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
select, textarea {
  transition: border-color var(--ui-fast) var(--ui-ease), box-shadow var(--ui-mid) var(--ui-ease), background-color var(--ui-fast);
}
.field input:focus, .field textarea:focus, .afield input:focus, .pf-val input:focus, .pf-val select:focus,
.search input:focus, .mf-field input:focus, .mf-field select:focus, .mf-field textarea:focus,
.cz-field input:focus, .cz-field textarea:focus, .gc-input:focus, .auth-field input:focus, .del-pw:focus,
.purchase-search input:focus, .purchase-search:focus { box-shadow: var(--ui-ring); }
.field input.invalid:focus, .afield input.invalid:focus, input.invalid:focus { box-shadow: var(--ui-ring-danger); }
.afield input:hover:not(:focus), .field input:hover:not(:focus), .pf-val input:hover:not(:focus) {
  border-color: color-mix(in srgb, var(--border) 60%, var(--primary));
}
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--primary); }
select { cursor: pointer; }
.aerror, .ainfo { animation: ui-rise var(--ui-mid) var(--ui-ease) both; }

/* ---------- cards & containers ---------- */
.card { box-shadow: var(--ui-hairline), var(--ui-elev-1); transition: transform var(--ui-mid) var(--ui-ease),
        border-color var(--ui-mid) var(--ui-ease), box-shadow var(--ui-mid) var(--ui-ease); }
.card:hover { box-shadow: var(--ui-hairline), var(--ui-elev-2); }
.card .imgwrap img { transition: transform var(--ui-mid) var(--ui-ease); }
.panel, .auth-box, .co-card, .order-card, .addr-card, .notif-card, .empty-state, .cart-item, .sq-row,
.tos-box, .modal-box, .pdp-box {
  box-shadow: var(--ui-hairline), var(--ui-elev-1);
}
.auth-box { box-shadow: var(--ui-hairline), var(--ui-elev-2); }
.order-card, .addr-card, .notif-card, .co-card { transition: border-color var(--ui-mid) var(--ui-ease), box-shadow var(--ui-mid) var(--ui-ease); }
.order-card:hover, .addr-card:hover, .notif-card:hover { border-color: color-mix(in srgb, var(--border) 55%, var(--primary)); }
.sq-row { transition: border-color var(--ui-fast), background-color var(--ui-fast); }
.sq-row:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--primary)); }
.cart-item { transition: background-color var(--ui-fast); }

/* ---------- account page: side menu ---------- */
.acc-nav-section a { border-radius: 6px; transition: color var(--ui-fast), background-color var(--ui-fast), padding-left var(--ui-mid) var(--ui-ease); }
.acc-nav-section a:hover { background: rgba(255, 255, 255, .03); }
.acc-nav-section a.active { font-weight: 600; }
/* Notification Settings switches: each is a <label>, which is inline, so its 48x26 size never
   applied and only the knob showed (hanging past the row on phones). Now the full switch shows. */
.toggle { display: inline-block; vertical-align: middle; }

/* ---------- dropdowns (account menu, notifications, language) ----------
   Still opened by .open (display:block); they now fade and drop in. */
.tb-user-drop, .notif-drop, .lang-drop {
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--ui-mid) var(--ui-ease), transform var(--ui-mid) var(--ui-ease),
              display var(--ui-mid) allow-discrete;
  box-shadow: var(--ui-elev-3);
}
.tb-user-drop.open, .notif-drop.open, .lang-drop.open { opacity: 1; transform: none; }
.tb-user-drop:not(.open), .notif-drop:not(.open), .lang-drop:not(.open) { pointer-events: none; }
.notif-drop-item { transition: background-color var(--ui-fast); }
.notif-drop-item:hover { background: var(--surface-2); }

/* ---------- overlays: cart drawer backdrop, product detail, terms, account dialogs ---------- */
.drawer-backdrop, .pdp-overlay, .tos-overlay, .modal-overlay {
  opacity: 0;
  transition: opacity var(--ui-mid) var(--ui-ease), display var(--ui-mid) allow-discrete, overlay var(--ui-mid) allow-discrete;
}
.drawer-backdrop.open, .pdp-overlay.open, .tos-overlay.open, .modal-overlay.open { opacity: 1; }
.drawer-backdrop:not(.open), .pdp-overlay:not(.open), .tos-overlay:not(.open), .modal-overlay:not(.open) { pointer-events: none; }
.drawer-backdrop, .tos-overlay, .modal-overlay { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.drawer { transition: transform var(--ui-slow) var(--ui-ease); box-shadow: -24px 0 60px -30px rgba(0, 0, 0, .8); }
.pdp-overlay .pdp-box, .tos-overlay .tos-box, .modal-overlay .modal-box {
  transform: translateY(10px) scale(.98); opacity: 0;
  transition: transform var(--ui-slow) var(--ui-ease), opacity var(--ui-mid) var(--ui-ease);
  box-shadow: var(--ui-elev-3);
}
.pdp-overlay.open .pdp-box, .tos-overlay.open .tos-box, .modal-overlay.open .modal-box { transform: none; opacity: 1; }
@starting-style {
  .tb-user-drop.open, .notif-drop.open, .lang-drop.open { opacity: 0; transform: translateY(-4px); }
  .drawer-backdrop.open, .pdp-overlay.open, .tos-overlay.open, .modal-overlay.open { opacity: 0; }
  .pdp-overlay.open .pdp-box, .tos-overlay.open .tos-box, .modal-overlay.open .modal-box { transform: translateY(10px) scale(.98); opacity: 0; }
}

/* ---------- toasts ---------- */
.toast {
  border-radius: 12px; box-shadow: var(--ui-elev-3);
  transition: transform var(--ui-slow) var(--ui-ease), opacity var(--ui-mid) var(--ui-ease);
  transform: translateY(14px) scale(.98);
}
.toast.show { transform: none; }
.toast.success { box-shadow: inset 4px 0 0 var(--primary), var(--ui-elev-3); }
.toast.error   { box-shadow: inset 4px 0 0 var(--danger), var(--ui-elev-3); }

/* ---------- footer ---------- */
.footer-link svg { transition: transform var(--ui-fast) var(--ui-ease); }
.footer-link:hover svg { transform: translateX(2px); }

/* ==========================================================================
   MOTION
   ========================================================================== */
@keyframes ui-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }

/* switching sections on the account page */
.acc-panel.active { animation: ui-rise var(--ui-slow) var(--ui-ease) both; }

/* first paint only */
html.ui-enter .hero-content, html.ui-enter .section-head, html.ui-enter .chips,
html.ui-enter .auth-box, html.ui-enter .panel, html.ui-enter .co-card, html.ui-enter .acc-sidebar,
html.ui-enter .banner-fire, html.ui-enter .empty-state {
  animation: ui-rise var(--ui-slow) var(--ui-ease) both;
}
html.ui-enter .grid > .card { animation: ui-rise var(--ui-slow) var(--ui-ease) both; }
html.ui-enter .grid > .card:nth-child(2) { animation-delay: 40ms; }
html.ui-enter .grid > .card:nth-child(3) { animation-delay: 80ms; }
html.ui-enter .grid > .card:nth-child(4) { animation-delay: 120ms; }
html.ui-enter .grid > .card:nth-child(5) { animation-delay: 160ms; }
html.ui-enter .grid > .card:nth-child(6) { animation-delay: 200ms; }
html.ui-enter .grid > .card:nth-child(7) { animation-delay: 240ms; }
html.ui-enter .grid > .card:nth-child(n+8) { animation-delay: 280ms; }
html.ui-enter .co-card:nth-of-type(2) { animation-delay: 60ms; }
html.ui-enter .co-card:nth-of-type(3) { animation-delay: 120ms; }
html.ui-enter .co-card:nth-of-type(n+4) { animation-delay: 160ms; }
/* the map in the address and checkout pin pickers: fade only (Leaflet measures it) */
html.ui-enter .leaflet-container { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
    transition-duration: .01ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
  }
  .card:hover, .card:hover .imgwrap img, .btn-hero:hover { transform: none !important; }
}
