/* AS6 motion language: compression → travelling chevrons → confirmed landing. */
:root { --as6-motion-out: cubic-bezier(.16,1,.3,1); --as6-motion-spring: cubic-bezier(.2,.85,.25,1.2); }
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]) {
  transition: scale 150ms var(--as6-motion-spring), box-shadow 180ms ease, background-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]):active:not(:disabled):not([aria-disabled="true"]) { scale: .965; }
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]):focus-visible { outline: 3px solid #7399d4; outline-offset: 3px; }
[data-as6-motion-state] { position: relative; isolation: isolate; }
[data-as6-motion-state]:not(input) { color: transparent !important; }
[data-as6-motion-state]:not(input) > * { visibility: hidden; }
[data-as6-motion-state]:not(input)::after {
  content: attr(data-as6-motion-label); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: #fff; background: #1d4f9e;
  border-radius: inherit; padding-inline: 8px; font: inherit; white-space:nowrap; pointer-events: none;
}
[data-as6-motion-state]:not(input)::before {
  content: ''; position: absolute; z-index: 2; pointer-events: none; width: 27px; height: 8px;
  bottom: 5px; left: calc(50% - 13px); background: linear-gradient(90deg,#fff5,#fff);
  clip-path: polygon(0 0,36% 0,54% 50%,36% 100%,0 100%,18% 50%,38% 0,74% 0,100% 50%,74% 100%,38% 100%,64% 50%);
  animation: as6-motion-run 850ms cubic-bezier(.4,0,.2,1) infinite;
}
[data-as6-motion-state="slow"]:not(input)::before { animation-duration: 1500ms; }
[data-as6-motion-state="success"]:not(input)::after { content: '✓  ' attr(data-as6-motion-label); background: #196649; animation: as6-motion-land 300ms var(--as6-motion-spring); }
[data-as6-motion-state="success"]:not(input)::before, [data-as6-motion-state="error"]:not(input)::before, [data-as6-motion-state="uncertain"]:not(input)::before { content: none; }
[data-as6-motion-state="error"]:not(input)::after, [data-as6-motion-state="uncertain"]:not(input)::after { background: #8f3339; }
[data-as6-motion-state="pending"], [data-as6-motion-state="slow"] { cursor: progress; }
[data-as6-motion-state="uncertain"] { cursor: help; }
[data-as6-motion-disclosure] { box-sizing: border-box; }
[data-as6-ship-toggle] .as6-co-card-x::after { transition: transform 240ms var(--as6-motion-out); }
.as6-motion-note {
  position: fixed; z-index: 100100; left: max(16px, env(safe-area-inset-left)); bottom: max(88px, calc(env(safe-area-inset-bottom) + 24px));
  width: min(420px, calc(100vw - 32px)); box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 12px; padding: 15px 44px 15px 18px; color: #162337; background: #fff;
  border: 1px solid #d9e3f1; border-left: 4px solid #1d4f9e; border-radius: 14px; box-shadow: 0 12px 40px #182c5024;
  font: 500 14px/1.45 'Golos Text', system-ui, sans-serif;
}
.as6-motion-note[hidden] { display: none; }
.as6-motion-note[data-placement="top"] { top:max(16px, env(safe-area-inset-top));bottom:auto; }
[data-screen-label="Попап выбора вариации"] > .as6-motion-note {
  position: relative; inset: auto; width: 100%; max-width: none; grid-column: 1 / -1; margin-top: 12px;
}
.as6-motion-note[data-tone="error"] { border-left-color: #a23842; }
.as6-motion-note a { color: #1d4f9e; text-decoration: underline; text-underline-offset: 3px; }
.as6-motion-note button { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border: 0; background: transparent; color: #52647e; font-size: 24px; cursor: pointer; }
.as6-motion-note :focus-visible { outline: 2px solid #1d4f9e; outline-offset: 2px; }
@keyframes as6-motion-run { 0% { transform: translateX(-16px); opacity: .25; } 50% { opacity: .95; } 100% { transform: translateX(16px); opacity: .25; } }
@keyframes as6-motion-land { 0% { transform: scale(.97); } 65% { transform: scale(1.018); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  :where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]), [data-as6-ship-toggle] .as6-co-card-x::after { transition: none; }
  :where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]):active { scale: 1 !important; }
  [data-as6-motion-state]::before, [data-as6-motion-state]::after { animation: none !important; }
}
/* Theme search feedback leaves the input and third-party search controls usable. */
.as6-search-feedback { display:flex;align-items:center;gap:12px;padding:10px 12px;font-size:13px;color:#40536e; }
.as6-search-feedback[hidden] { display:none; }
.as6-search-feedback button { border:0;background:none;color:inherit;text-decoration:underline;font:inherit;min-height:44px;cursor:pointer; }
.as6-oc-pending { display:block;width:28px;height:4px;background:#1d4f9e;border-radius:4px;align-self:center;animation:as6-motion-run 850ms ease-in-out infinite; }
.as6-oc-pending[hidden] { display:none; }
@media (prefers-reduced-motion:reduce) { .as6-oc-pending { animation:none; } }
@media (prefers-reduced-motion:reduce) { .as6-host .sheetm, .as6-host .sheetm > *, .as6-location-dialog { animation:none!important;transition:none!important; } }

/* Native integration r1: touch press and existing cart drawer respect reduce. */
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]).as6-motion-pressed:not(:disabled):not([aria-disabled="true"]) { scale: .965; }
@media (prefers-reduced-motion:reduce) {
  .as6-motion-pressed { scale: 1 !important; }
  .as6-host .drawerBg, .as6-host .drawerBg > [data-screen-label="Мини-корзина"] { animation: none !important; transition: none !important; }
}

/* Native r2: feedback is a row in the drawer's scrollable body, not a footer overlay. */
.as6-motion-note[data-placement="drawer"] {
  position: relative; inset: auto; width: 100%; max-width: none; flex: 0 0 auto;
  margin: 0; max-height: min(240px, 40vh); overflow: auto; box-shadow: none;
}

/* Visual-only v1 over r4: no new event, transport, response or form owner. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]):not(:disabled):not([aria-disabled="true"]):not([data-as6-motion-state]):hover {
    translate: 0 -2px;
    box-shadow: 0 5px 12px #1b4f9c24;
  }
}
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]) {
  transition-property: scale, translate, box-shadow, background-color;
  transition-duration: 150ms, 160ms, 180ms, 160ms;
}
:where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]):is(:active, .as6-motion-pressed):not(:disabled):not([aria-disabled="true"]):not([data-as6-motion-state]) {
  translate: 0 0;
  box-shadow: 0 0 0 3px #1b4f9c24, 0 1px 3px #17243820;
}
/* The existing r4 marker appears only for a committed, eligible disclosure transition. */
form.woocommerce-checkout [data-as6-frag="checkout-ship"] [data-as6-ship-body][data-as6-motion-disclosure]:not([hidden]) {
  animation: as6-visual-ship-enter 220ms var(--as6-motion-out) both;
}
form.woocommerce-checkout [data-as6-frag="checkout-ship"] [data-as6-ship-body][data-as6-motion-disclosure]:focus-within {
  animation: none;
}
@keyframes as6-visual-ship-enter { from { translate: 0 6px; } to { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  :where(.as6-host button, .as6-mini button, .as6-location-dialog button, [data-as6-motion-press]) { transition: none; translate: none; }
  form.woocommerce-checkout [data-as6-frag="checkout-ship"] [data-as6-ship-body][data-as6-motion-disclosure] { animation: none; }
}

/* Mobile native search: expand its right-aligned panel within the viewport. */
@media (max-width: 640px) {
  .hdrsearch > .u-pos-38ed6,
  .hdrsearch > .as6-search-feedback {
    left: auto; right: 0; top: calc(100% + 4px);
    width: calc(100vw - 28px); max-width: calc(100vw - 28px); box-sizing: border-box;
  }
  .hdrsearch > .u-pos-38ed6 {
    max-height: min(420px, calc(100vh - 240px));
    max-height: min(420px, calc(100dvh - 240px));
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    scroll-padding-block: 6px;
  }
  .hdrsearch a[data-onclick^="searchResults."][data-onclick$=".open"] {
    display: grid; grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px; padding: 10px; min-height: 66px; box-sizing: border-box;
  }
  .hdrsearch a[data-onclick^="searchResults."][data-onclick$=".open"] > span:nth-child(2) { min-width: 0; }
  .hdrsearch a[data-onclick^="searchResults."][data-onclick$=".open"] > span:nth-child(2) > span:first-child {
    white-space: normal; overflow-wrap: anywhere;
  }
  .hdrsearch [data-onclick^="searchResults."][data-onclick$=".cta"] { min-height: 44px; padding-inline: 10px; }
  .hdrsearch > .as6-search-feedback {
    position: absolute; z-index: 71; flex-wrap: wrap;
    background: #fff; border: 1px solid #e3e9f1; border-radius: 12px;
    box-shadow: 0 12px 28px #17243818;
  }
  .hdrsearch a[data-onclick^="searchResults."]:focus-visible,
  .hdrsearch [data-onclick^="searchResults."][data-onclick$=".cta"]:focus-visible {
    outline: 2px solid #1b4f9c; outline-offset: -3px;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .hdrsearch > .u-pos-38ed6 { animation: none; }
}

/* Mobile header: give search its own row while keeping the native cart reachable. */
@media (max-width: 640px) {
  .hdrrow { flex-wrap: wrap; height: auto; }
  .hdrrow > .hdrsearch { order: 1; flex: 0 0 100%; }
  .hdrsearch input[name="s"] { padding-inline: 12px; }
  .hdrsearch form > button { flex-shrink: 0; width: 44px; height: 46px; padding: 0; }
  .hdrrow > button[data-onclick="openDrawer"] { margin-left: auto; }
  .hdrrow > button[data-onclick="openDrawer"] > span:first-child { width: 44px; height: 44px; }
  .hdrrow > button[data-onclick="openDrawer"] > span:last-child {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .hdrsearch > .u-pos-38ed6 {
    max-height: min(360px, calc(100vh - 280px));
    max-height: min(360px, calc(100dvh - 280px));
  }
  body:has(.hdrsearch > .u-pos-38ed6) .msgWidget,
  body:has(.hdrsearch > .as6-search-feedback:not([hidden])) .msgWidget { display: none !important; }
}
@layer proto {
  @media (max-width: 640px) {
    .hdrrow { padding-block: 8px !important; row-gap: 6px !important; }
    .hdrrow > button.hidem[data-onclick="openDrawer"] { display: flex !important; }
  }
}

/* Keep catalog cards readable beside the filter at the narrow desktop boundary. */
@media (min-width: 641px) and (max-width: 767px) {
  [data-screen-label="Каталог"] .grid3.u-gtc-823d0 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* System UI r32: composited transitions; native state and hit targets change immediately. */
:root { --as6-ui-fast: 140ms; --as6-ui-enter: 220ms; --as6-ui-ease: cubic-bezier(.16,1,.3,1); }
[data-as6-ui-menu-backdrop] { top: var(--as6-ui-menu-top) !important; }
[data-as6-ui-menu-backdrop] > [data-screen-label="Мега-меню"] {
  top: 0 !important;
  max-height: calc(100dvh - var(--as6-ui-menu-top) - 12px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
[data-screen-label="Мега-меню"] a,
[data-screen-label="Мобильное меню"] :is(a, button),
.catfilt [data-onclick],
.ptabs button,
[data-onclick^="pr.flavors."], [data-onclick^="pr.sizes."], [data-onclick^="pr.portions."] {
  transition: color var(--as6-ui-fast) ease, background-color var(--as6-ui-fast) ease, border-color var(--as6-ui-fast) ease, box-shadow var(--as6-ui-fast) ease;
}
[data-screen-label="Мега-меню"] a:focus-visible,
[data-screen-label="Мобильное меню"] :is(a, button):focus-visible,
.catfilt [data-onclick]:focus-visible,
.ptabs button:focus-visible {
  outline: 2px solid #1b4f9c; outline-offset: -3px;
}
.as6-host :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select) {
  transition: box-shadow var(--as6-ui-fast) ease, border-color var(--as6-ui-fast) ease;
}
.as6-host :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select):focus-visible {
  outline: 2px solid #1b4f9c; outline-offset: 2px; box-shadow: 0 0 0 4px #1b4f9c12;
}
.as6-host :is(input, textarea, select)[aria-invalid="true"] {
  outline: 2px solid #a23842; outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .as6-host :is(a[data-onclick^="catalog."][data-onclick$=".open"], .as6-fav-card, .as6-fav-catalog, .as6-fav-course) {
    transition: translate 200ms var(--as6-ui-ease), box-shadow 200ms ease;
  }
  .as6-host :is(a[data-onclick^="catalog."][data-onclick$=".open"], .as6-fav-card, .as6-fav-catalog, .as6-fav-course):hover {
    translate: 0 -3px; box-shadow: 0 8px 20px #17243814;
  }
  [data-screen-label="Мега-меню"] a:hover { color: #1b4f9c; }
}
@media (prefers-reduced-motion: reduce) {
  [data-screen-label="Мега-меню"] a,
  [data-screen-label="Мобильное меню"] :is(a, button),
  .catfilt [data-onclick], .ptabs button,
  [data-onclick^="pr.flavors."], [data-onclick^="pr.sizes."], [data-onclick^="pr.portions."],
  .as6-host :is(input, textarea, select) { transition: none !important; }
}

/* Full-width menu rows stay under the pointer; color is their immediate feedback. */
.as6-host [data-screen-label="Мобильное меню"] :is(a, button) {
  translate: none !important; scale: 1 !important;
}
.as6-host [data-screen-label="Мобильное меню"] button:is(:active, .as6-motion-pressed) {
  background-color: #e9f0fa;
}

/* Baked banner copy stays unobscured. Reserve the same CTA row on every narrow slide. */
@layer proto {
  @media (max-width: 1007px) {
    .as6-host .heroSlide {
      aspect-ratio: auto !important; flex-direction: column !important;
      align-items: stretch !important; background: #eef2f7;
    }
    .as6-host .heroSlide > picture,
    .as6-host .heroSlide > a:has(> picture) {
      position: relative !important; inset: auto !important; display: block !important;
      width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto;
    }
    .as6-host .heroSlide > .heroCta {
      position: relative !important; inset: auto !important; box-sizing: border-box !important;
      width: 100%; max-width: none !important; flex: 0 0 88px;
      height: 88px; min-height: 88px; padding: 10px 16px 32px !important;
      align-items: flex-start !important; justify-content: flex-start !important;
      background: #eef2f7;
    }
    .as6-host .heroTrack + div { bottom: 6px !important; }
    .as6-host .heroTrack + div > button {
      height: 3px !important; padding: 10.5px 0 !important; box-sizing: content-box !important;
      background-color: #aab8cc !important; background-clip: content-box !important;
    }
    .as6-host .heroTrack + div > button[aria-pressed="true"] { background-color: #1b4f9c !important; }
    .as6-host .heroSlide:not(:has(> .heroCta))::after { content: ''; display: block; height: 88px; flex: 0 0 88px; }
  }
  @media (min-width: 641px) and (max-width: 1007px) {
    .as6-host .heroSlide > picture,
    .as6-host .heroSlide > a:has(> picture) { aspect-ratio: 16 / 5; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .as6-host .heroTrack { transition: none !important; }
}
