/* MILORIA · quiet surfaces and one collection tree, shared with the mobile drawer. */
body.storefront {
  --paper: #fffdfa;
  --soft: #f1efeb;
  --line: #e5e0da;
  --catalog-ground: #f6f5f2;
  --catalog-surface: #fffefd;
  background: var(--catalog-ground);
}

body.storefront .header {
  background: rgb(255 254 252 / 96%);
  border-bottom-color: var(--line);
  box-shadow: none;
}

body.storefront .hero {
  background: #eeece6;
  border-color: #e4dfd6;
}

body.storefront .footer {
  background: var(--catalog-surface);
}

body.storefront #coleccion {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
  max-width: 1400px;
  padding-top: 24px;
  overflow-anchor: none;
}

body.storefront .catalog-sidebar {
  position: sticky;
  top: 120px;
  min-width: 0;
}

body.storefront .catalog-navigation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100dvh - 144px);
}

/* Keep the left column independent of changing result counts. */
@media (min-width: 901px) {
  body.storefront .catalog-sidebar .catalog-navigation {
    height: calc(100dvh - 144px);
  }
  body.storefront .catalog-content {
    min-height: calc(100dvh - 144px);
  }
}

body.storefront .catalog-navigation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
  padding: 2px 10px 16px;
}

body.storefront .catalog-navigation-header h2 {
  margin: 0;
  font: 400 1.45rem/1.2 var(--serif);
  color: var(--deep);
}

body.storefront .catalog-navigation-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px 6px 12px 0;
  scrollbar-width: thin;
  scrollbar-color: #c7babf transparent;
  scrollbar-gutter: stable;
  overflow-anchor: none;
  scroll-padding-block: 8px;
}

body.storefront .catalog-navigation :is(#shopping-audience, #shopping-children, #categories) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: normal;
  scroll-snap-type: none;
}

body.storefront .catalog-navigation :is(#shopping-audience, #shopping-children, #categories, .catalog-subcategories) button {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: 450 .875rem/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
  scroll-snap-align: none;
}

body.storefront .catalog-navigation .catalog-audience-section > button[data-family] {
  color: var(--ink);
  font-weight: 500;
}

@media (hover: hover) and (pointer: fine) {
  body.storefront .catalog-navigation :is(#shopping-audience, #categories, .catalog-subcategories) button:hover {
    background: #eeeae7;
    color: var(--deep);
  }
}

body.storefront .catalog-navigation :is(#shopping-audience, #shopping-children, #categories, .catalog-subcategories) button[aria-pressed="true"] {
  background: #ece5e9;
  color: var(--deep);
  border-left-color: var(--deep);
  font-weight: 650;
}

body.storefront .catalog-navigation button:focus-visible,
body.storefront .catalog-browse-toggle:focus-visible {
  outline: 2px solid var(--deep);
  outline-offset: 2px;
}

/* The active category branch lives directly under its audience. */
body.storefront .catalog-audience-section,
body.storefront .catalog-kind-section {
  min-width: 0;
}

body.storefront .catalog-navigation .catalog-audience-section > button[data-family],
body.storefront .catalog-navigation .catalog-kind-section > button[data-kind] {
  justify-content: space-between;
  gap: 10px;
}

/* Opening a branch is distinct from applying its product selection. */
body.storefront .catalog-navigation .catalog-audience-section > button[data-family][aria-expanded="true"]:not([aria-pressed="true"]) {
  color: var(--deep);
  font-weight: 600;
}

body.storefront .catalog-audience-section > button[data-family]::after,
body.storefront .catalog-kind-section > button[data-kind][aria-expanded]::after {
  content: '';
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .65;
  transform: rotate(-45deg);
}

body.storefront .catalog-audience-section > button[data-family][aria-expanded="true"]::after,
body.storefront .catalog-kind-section > button[data-kind][aria-expanded="true"]::after {
  transform: rotate(45deg);
}

body.storefront .catalog-category-panel {
  display: grid;
  grid-template-rows: 0fr;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
}

body.storefront .catalog-category-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
}

body.storefront .catalog-category-panel button:focus-visible {
  outline-offset: -2px;
}

body.storefront .catalog-category-panel-inner {
  min-width: 0;
  min-height: 0;
  margin-left: 13px;
  padding-left: 8px;
  overflow: hidden;
  border-left: 1px solid #ded6db;
}

body.storefront .catalog-nav-label {
  margin: 12px 12px 5px;
  padding: 0;
  border: 0;
  color: #796b72;
  font: 600 .64rem/1.4 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
}

body.storefront .catalog-navigation #categories {
  gap: 0;
  padding-bottom: 9px;
}

body.storefront .catalog-navigation #categories button {
  font-size: .82rem;
}

body.storefront .catalog-subcategories {
  display: flow-root;
  margin: 3px 0 8px 11px;
  padding-left: 6px;
  border-left: 1px solid #ded6db;
}

body.storefront .catalog-subcategories.is-animating,
body.storefront .catalog-branch-outgoing {
  overflow: hidden;
  min-height: 0;
}

body.storefront .catalog-branch-outgoing {
  pointer-events: none;
}

body.storefront .catalog-subcategories .catalog-nav-label {
  margin: 10px 12px 4px;
  font-size: .61rem;
  letter-spacing: .07em;
}

body.storefront .catalog-navigation .catalog-subcategories button {
  padding-inline: 10px;
  font-size: .78rem;
}

body.storefront .catalog-content {
  min-width: 0;
  padding: 24px;
  border: 1px solid #ebe6df;
  border-radius: 8px;
  background: var(--catalog-surface);
}

body.storefront .catalog-content .catalog-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  margin-bottom: 24px;
}

body.storefront .catalog-content .section-title {
  gap: 8px 12px;
  min-width: 0;
}

body.storefront .catalog-content .section-title h2 {
  font-size: clamp(1.8rem, 2.3vw, 2.2rem);
  overflow-wrap: anywhere;
}

body.storefront .catalog-content .catalog-intro {
  max-width: none;
  font-size: .84rem;
}

body.storefront .catalog-content .searchbar {
  grid-template-columns: minmax(140px, 1fr) auto auto minmax(165px, auto);
}

body.storefront .catalog-content .products {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 20px;
}

body.storefront .catalog-content .filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.storefront .catalog-content .active-filter-chips {
  margin-top: 0;
  margin-bottom: 20px;
}

body.storefront .catalog-navigation-footer,
body.storefront .close-catalog-navigation,
body.storefront .catalog-browse-toggle {
  display: none;
}

body.storefront #catalog-navigation-dialog:not([open]) {
  display: none;
}

@media (min-width: 1440px) {
  body.storefront .catalog-content .products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1099px) {
  body.storefront #coleccion {
    grid-template-columns: 184px minmax(0, 1fr);
    gap: 24px;
  }
  body.storefront .catalog-content { padding: 18px; }
  body.storefront .catalog-content .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.storefront .catalog-content .searchbar { grid-template-columns: auto auto minmax(0, 1fr); }
  body.storefront .catalog-content .searchbar .search { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body.storefront #coleccion { display: block; padding-top: 18px; }
  body.storefront .catalog-sidebar { position: static; margin-bottom: 24px; }
  body.storefront .catalog-sidebar .catalog-navigation { max-height: none; }
  body.storefront .catalog-content { padding: 20px; }
  body.storefront .catalog-content .catalog-toolbar { gap: 16px; margin-bottom: 22px; }
  body.storefront .catalog-content .searchbar { grid-template-columns: auto auto minmax(0, 1fr); }
  body.storefront .catalog-content .searchbar .search { grid-column: 1 / -1; }
  body.storefront .catalog-content .sort-control { grid-column: auto; width: auto; }
  body.storefront .catalog-content .section-title h2 { font-size: 1.95rem; }

  /* With no navigation script, the original controls remain available inline. */
  body.storefront.catalog-navigation-ready .catalog-sidebar { display: none; }
  body.storefront.catalog-navigation-ready .catalog-browse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    margin: 0 0 22px;
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--deep);
    font-size: .85rem;
    font-weight: 600;
    text-align: left;
  }
  body.storefront #catalog-browse-selection {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 400;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.storefront .catalog-browse-toggle::after {
    content: '';
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
  }

  body.storefront #catalog-navigation-dialog[open] {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(340px, calc(100vw - 24px));
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0 18px 18px 0;
    background: var(--catalog-surface);
    color: var(--ink);
    box-shadow: 12px 0 48px rgb(52 37 46 / 14%);
    scrollbar-gutter: auto;
  }
  body.storefront #catalog-navigation-dialog::backdrop {
    background: rgb(42 33 39 / 30%);
    backdrop-filter: blur(2px);
  }
  body.storefront #catalog-navigation-dialog .catalog-navigation {
    height: 100%;
    max-height: none;
  }
  body.storefront #catalog-navigation-dialog .catalog-navigation-header {
    padding: max(14px, env(safe-area-inset-top)) 18px 12px;
    border-bottom: 1px solid var(--line);
  }
  body.storefront #catalog-navigation-dialog .catalog-navigation-header h2 { font-size: 1.55rem; }
  body.storefront #catalog-navigation-dialog .catalog-navigation-body { flex: 1 1 auto; padding: 16px 20px 20px; }
  body.storefront #catalog-navigation-dialog .close-catalog-navigation {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--deep);
    font-size: 1.65rem;
    line-height: 1;
  }
  body.storefront #catalog-navigation-dialog .close-catalog-navigation:hover { background: #f1eaee; }
  body.storefront #catalog-navigation-dialog .catalog-navigation-footer {
    display: block;
    flex: 0 0 auto;
    padding: 14px 20px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--catalog-surface);
  }
  body.storefront #catalog-navigation-apply { width: 100%; min-height: 48px; }
}

@media (max-width: 600px) {
  body.storefront { background: #fdfcfb; }
  body.storefront .catalog-content { padding: 0; border: 0; border-radius: 0; background: transparent; }
  body.storefront .catalog-content .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 12px; }
  body.storefront .catalog-content .searchbar { grid-template-columns: 46px auto minmax(0, 1fr); }
  body.storefront .catalog-content .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.storefront .catalog-content .catalog-intro { font-size: .82rem; }
  body.storefront #catalog-browse-selection { max-width: 46%; }
}

@media (prefers-reduced-motion: no-preference) {
  body.storefront .catalog-navigation button,
  body.storefront .catalog-browse-toggle {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  }
  body.storefront .catalog-category-panel {
    transition: grid-template-rows 280ms cubic-bezier(.25, .1, .25, 1),
      opacity 180ms ease, visibility 0s linear 280ms;
  }
  body.storefront .catalog-category-panel.is-open {
    transition: grid-template-rows 280ms cubic-bezier(.25, .1, .25, 1),
      opacity 180ms ease, visibility 0s;
  }
  body.storefront .catalog-audience-section > button[data-family]::after,
  body.storefront .catalog-kind-section > button[data-kind][aria-expanded]::after {
    transition: transform 200ms cubic-bezier(.22, .68, .2, 1);
  }
  body.storefront #catalog-navigation-dialog[open] {
    animation: miloria-catalog-drawer 240ms cubic-bezier(.22, .68, .2, 1);
  }
  @keyframes miloria-catalog-drawer {
    from { opacity: .5; transform: translateX(-16px); }
    to { opacity: 1; transform: none; }
  }
}

@media (forced-colors: active) {
  body.storefront .catalog-navigation button[aria-pressed="true"] { border-left-color: Highlight; outline: 1px solid Highlight; }
  body.storefront .catalog-content { border-color: CanvasText; }
}
