/* The collector's archive: shelf, set index and single-card folio. */
body:is([data-page="catalog"], [data-page="collection"]) #catalogo,
body[data-page="product"] #store-page-content {
  --folio-ink: #edf2fb;
  --folio-muted: #b7c5d9;
  --folio-rim: #92a8c64d;
  --folio-gold: #efcf97;
  --folio-mat: #111d2d;
  --folio-back: #18283e;
}

/* Browse in reading order: search, then collection tabs, then the set index. */
body:is([data-page="catalog"], [data-page="collection"]) #catalogo {
  padding-block-start: clamp(24px, 5vw, 58px);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-heading {
  margin-block-end: clamp(17px, 2.8vw, 28px);
  text-align: center;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #catalog-title {
  color: var(--folio-ink);
  font-size: clamp(2.625rem, 5vw, 4.5rem);
  text-wrap: balance;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #catalog-status {
  max-inline-size: 58ch;
  margin-inline: auto;
  text-wrap: balance;
  color: var(--folio-muted);
  font-size: clamp(.9375rem, 1.4vw, 1.0625rem);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-toolbar {
  align-items: end;
  max-inline-size: 68rem;
  margin-inline: auto;
  gap: 8px;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-controls {
  width: min(100%, 42rem);
  justify-self: center;
  min-width: 0;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo :is(.search-box, .filter-toggle) {
  border-color: var(--folio-rim);
  background-color: var(--folio-mat);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .filter-toggle[aria-expanded="true"] {
  border-color: var(--folio-gold);
  background-color: var(--folio-back);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-tabs {
  justify-content: center;
  border-bottom-color: var(--folio-rim);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-tabs .tab[aria-pressed="true"] {
  color: var(--folio-gold);
  border-block-end-color: var(--folio-gold);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .collection-overview {
  margin-block: 14px 16px;
  border-color: var(--folio-rim);
  border-radius: 9px;
  background: var(--folio-mat);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .collection-sets > summary {
  min-height: 48px;
  line-height: 1.4;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .collection-set-browser {
  border-top-color: var(--folio-rim);
  background: linear-gradient(172deg, #16253a, var(--folio-mat) 56%);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .collection-set-group h3 {
  color: var(--folio-ink);
  line-height: 1.3;
  text-wrap: pretty;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .collection-set-group a[aria-current] {
  padding-inline: 8px;
  background: var(--folio-back);
  border-radius: 4px;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-results-bar {
  align-items: baseline;
  margin-block: 12px 18px;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #results-count { font-weight: 650; }
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .sort-label { flex-wrap: wrap; }

/* Keep the real card photo prominent and the peer actions on one visual rail. */
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid {
  align-items: stretch;
  --archive-column-gap: clamp(12px, 2vw, 24px);
  gap: clamp(22px, 3vw, 36px) var(--archive-column-gap);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid > .product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-image {
  border-color: var(--folio-rim);
  border-radius: 9px;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-image:is(:focus-visible, .is-holo-active, .is-holo-focus, .is-holo-pressed) {
  border-color: var(--folio-gold);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid > .product-card:only-child {
  grid-column: 1 / -1;
  inline-size: min(100%, 18rem);
  justify-self: center;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-card-title {
  margin-block: 12px 4px;
  overflow-wrap: anywhere;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card > :is(.catalog-card-title, .product-set, .product-meta) {
  text-align: start;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card > .product-meta {
  display: block;
  overflow-wrap: anywhere;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-name {
  color: var(--folio-ink);
  font-size: clamp(1.25rem, 2.25vw, 1.78rem);
  line-height: 1.08;
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-bottom {
  margin-block-start: auto;
  border-top-color: var(--folio-rim);
}
body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card :is(.product-favorite, .product-compare):not([aria-pressed="true"]) {
  border-color: var(--shop-control-line, var(--folio-rim));
  color: var(--folio-muted);
}

/* A lit photographic plate beside a ruled, readable card record. */
body[data-page="product"] #store-page-content > .store-breadcrumb { margin-block-end: clamp(9px, 2vw, 22px); }
body[data-page="product"] #store-page-content .store-product .detail-intro {
  box-sizing: border-box;
  inline-size: 100%;
  justify-self: stretch;
  text-align: start;
}
body[data-page="product"] #store-page-content .store-product .detail-intro h1 {
  color: var(--folio-ink);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.01;
  letter-spacing: -.025em;
  text-wrap: balance;
}
body[data-page="product"] #store-page-content .store-product .detail-intro .detail-set-line {
  color: var(--folio-muted);
  margin-block-end: 0;
  font-variant-numeric: tabular-nums;
}
body[data-page="product"] #store-page-content .store-product .detail-visual {
  padding: clamp(18px, 3.2vw, 45px) clamp(15px, 3vw, 38px) clamp(12px, 2vw, 24px);
  border: 1px solid var(--shop-line);
  border-radius: clamp(8px, 1.35vw, 18px);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--shop-gold) 60%, transparent), transparent 82%) 0 0 / 100% 1px no-repeat,
    radial-gradient(ellipse at 70% 22%, color-mix(in srgb, var(--shop-blue-ambient) 43%, transparent), transparent 61%),
    radial-gradient(ellipse at 16% 73%, color-mix(in srgb, var(--shop-red-ambient) 29%, transparent), transparent 51%),
    linear-gradient(162deg, var(--shop-panel-raised), var(--shop-canvas) 79%);
  box-shadow: inset 0 0 0 1px #ffffff07, 0 19px 36px -29px var(--shop-shadow);
}
body[data-page="product"] #store-page-content .store-product .detail-photo-caption {
  justify-content: flex-start;
  color: var(--folio-muted);
  font-size: .8125rem;
  line-height: 1.5;
}
body[data-page="product"] #store-page-content .store-product .detail-intro .detail-offer {
  display: flex;
  inline-size: fit-content;
  max-inline-size: 100%;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: clamp(9px, 1.7vw, 20px) 0 0;
  padding: clamp(7px, 1.05vw, 13px) 0 0;
  border-block-start-color: var(--folio-rim);
}
body[data-page="product"] #store-page-content .store-product .detail-intro .detail-offer:empty { display: none; }
body[data-page="product"] #store-page-content .store-product .detail-intro .detail-availability {
  margin: 0;
  line-height: 1.45;
}
body[data-page="product"] #store-page-content .store-product .detail-intro .detail-price { justify-content: flex-start; }
body[data-page="product"] #store-page-content .store-related > header {
  align-items: center;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
body[data-page="product"] #store-page-content .store-related > header > .button { max-inline-size: 100%; }
body[data-page="product"] #store-page-content .store-related-copy { text-align: center; }
body[data-page="product"] #store-page-content .store-related-price { justify-content: center; }
body[data-page="product"] #store-page-content .store-product .detail-selection .detail-actions { align-items: stretch; }
body[data-page="product"] #store-page-content .store-product :is(.detail-description, .detail-story > p) {
  max-inline-size: 64ch;
  text-wrap: pretty;
}
body[data-page="product"] #store-page-content .store-product .detail-story {
  padding: clamp(16px, 2.4vw, 29px);
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--shop-panel) 92%, var(--shop-canvas));
}
body[data-page="product"] #store-page-content .store-product .detail-section-title { color: var(--folio-ink); }
body[data-page="product"] #store-page-content .store-product .detail-facts {
  gap: 0 16px;
  margin-block: 0 7px;
  border-block-end: 1px solid var(--shop-line);
}
body[data-page="product"] #store-page-content .store-product .detail-facts > div {
  padding-block: 8px 10px;
  border: 0;
  border-block-start: 1px solid var(--shop-line);
}
body[data-page="product"] #store-page-content .store-product .detail-facts > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
body[data-page="product"] #store-page-content .store-product .detail-facts dd {
  margin-block-start: 2px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1000px) {
  body[data-page="product"] #store-page-content .store-product .product-detail-grid {
    --detail-gutter: clamp(24px, 3.25vw, 52px);
    --detail-photo-width: clamp(314px, 29vw, 425px);
    grid-template-columns: minmax(0, 1.07fr) minmax(0, .93fr);
  }
  body[data-page="product"] #store-page-content .store-product .product-detail-grid > .detail-intro {
    padding-block-start: clamp(5px, 1.8vw, 24px);
  }
}

@media (min-width: 741px) {
  /* At tablet size, keep the full-width heading above the paired columns. */
  body[data-page="product"] #store-page-content .store-product .product-detail-grid {
    grid-template-areas: "intro intro" "photo details";
    grid-template-rows: auto auto;
    row-gap: clamp(18px, 3vw, 36px);
  }
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 202px), 1fr));
  }
}
@media (min-width: 1050px) {
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-toolbar {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 20px;
  }
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 224px), 1fr));
  }
}
@media (min-width: 741px) and (max-width: 980px) {
  body[data-page="product"] #store-page-content .store-product .product-detail-grid {
    --detail-gutter: clamp(22px, 4vw, 39px);
    --detail-photo-width: clamp(220px, 28vw, 290px);
  }
}
@media (max-width: 740px) {
  /* Keep the same photo size when the last shelf item is alone. */
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo #product-grid > .product-card:last-child:nth-child(odd):not(:only-child) {
    grid-column: 1 / -1;
    inline-size: calc((100% - var(--archive-column-gap)) / 2);
    justify-self: center;
  }
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .search-box input { font-size: 1rem; }
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-results-bar { align-items: center; }
  body[data-page="product"] #store-page-content .store-product .detail-intro h1 { font-size: clamp(2.45rem, 11vw, 3.75rem); }
  body[data-page="product"] #store-page-content .store-product .detail-visual { padding-block-start: 13px; }
  body[data-page="product"] #store-page-content .store-product .detail-story { padding-inline: 14px; }
}
@media (max-width: 380px) {
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .catalog-card-title { margin-block-start: 9px; }
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-name { font-size: 1.125rem; }
}
@media (width < 22.375em), (min-width: 481px) and (max-width: 980px) and (pointer: coarse) {
  /* A narrow photo or enlarged viewport has room for a second utility row. */
  body[data-page="product"] #store-page-content .store-product .detail-photo-stage .studio-mode-controls {
    position: static;
    inset: auto;
    align-self: center;
    flex-wrap: wrap;
    justify-content: center;
    width: min(100%, var(--studio-utility-width, 280px));
    min-width: 0;
    gap: 4px;
  }
  body[data-page="product"] #store-page-content .store-product .studio-mode-controls > button {
    max-width: 100%;
    min-height: 44px;
    overflow-wrap: anywhere;
  }
  body[data-page="product"] #store-page-content .store-product .studio-image-open .detail-photo-hint {
    justify-content: center;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--folio-rim);
    border-radius: 6px;
    background: var(--folio-back);
    text-align: center;
  }
}
@media (min-width: 22.375em) and (max-width: 480px) {
  body[data-page="product"] #store-page-content .store-product .detail-photo-stage .studio-mode-controls {
    gap: 0;
  }
  body[data-page="product"] #store-page-content .store-product .detail-photo-stage .studio-mode-controls > button {
    min-inline-size: 44px;
    padding-inline: 6px;
    font-size: .8125rem;
  }
  body[data-page="product"] #store-page-content .store-product .detail-photo-stage[data-studio-ready]:not([data-studio-state="static"]) .studio-image-open .detail-photo-hint {
    padding-inline-end: 8rem;
  }
}
@media (hover: hover) and (pointer: fine) {
  body:is([data-page="catalog"], [data-page="collection"]) #catalogo .product-card .product-image:hover { border-color: #b49b70; }
}

/* The count gets a short foil underline only after a deliberate update.
   It never obscures the new result, changes layout or competes with the cards. */
body[data-page="catalog"] #catalogo #results-count { position: relative; }
@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  html:not([data-motion-paused]) body[data-page="catalog"]:not(.motion-off, .reduce-motion, .page-inactive)
  #catalogo #results-count[data-catalog-refresh="true"]::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-end: -4px;
    block-size: 2px;
    border-radius: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--folio-gold, #efcd87) 40% 72%, transparent);
    transform-origin: center;
    animation: zii-catalog-refresh 205ms cubic-bezier(.16, 1, .3, 1) both;
  }
}
@keyframes zii-catalog-refresh {
  from { transform: scaleX(.24); opacity: .8; }
  60% { transform: scaleX(1); opacity: .95; }
  to { transform: scaleX(1); opacity: 0; }
}

/* The existing results rail remains in the reading flow. On small screens
   it docks below the masthead while the cards scroll, without a bottom overlay. */
body[data-page="catalog"] #catalog-quick-filters { display: none; }
@media (max-width: 740px), (max-width: 1024px) and (pointer: coarse) {
  body[data-page="catalog"] #catalog-results[data-quick-filters] {
    position: sticky;
    inset-block-start: calc(77px + env(safe-area-inset-top, 0px));
    z-index: 4;
    margin-block-end: 14px;
    background: #101927;
    border-block: 1px solid var(--folio-rim, #40506a);
  }
  body[data-page="catalog"] #catalog-results[data-quick-filters] .catalog-results-bar {
    display: grid;
    grid-template-columns: minmax(0, max-content) max-content minmax(0, 1fr);
    align-items: center;
    gap: clamp(5px, 1.8vw, 12px);
    margin: 0;
    padding: 5px 9px;
  }
  body[data-page="catalog"] #catalog-quick-filters:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
    gap: 6px;
    border: 1px solid var(--folio-rim, #40506a);
    border-radius: 6px;
    padding: 4px 11px;
    color: #f0d7a4;
    background: #23324a;
    font: 650 .875rem/1.1 var(--body, system-ui, sans-serif);
  }
  body[data-page="catalog"] #catalog-quick-filters:focus-visible {
    outline: 2px solid #f0d7a4;
    outline-offset: -3px;
  }
  body[data-page="catalog"] #catalog-quick-filters:active { background-color: #31435f; }
  body[data-page="catalog"] #catalog-quick-filters .icon { inline-size: 16px; block-size: 16px; }
  body[data-page="catalog"] .catalog-quick-filters-count:not([hidden]) {
    display: inline-grid;
    place-items: center;
    min-inline-size: 1.15rem;
    block-size: 1.15rem;
    padding-inline: 3px;
    color: #141d2a;
    background: #e8c684;
    border-radius: 999px;
    font: 800 .7rem/1 var(--body, system-ui, sans-serif);
  }
  body[data-page="catalog"] #catalog-results[data-quick-filters] .sort-label {
    justify-self: end;
    min-inline-size: 0;
    max-inline-size: 100%;
    font-size: .8125rem;
  }
  body[data-page="catalog"] #catalog-results[data-quick-filters] .sort-label select {
    box-sizing: border-box;
    inline-size: 100%;
    min-inline-size: 0;
    text-overflow: ellipsis;
  }
  body[data-page="catalog"] #product-grid :is(a,button) {
    scroll-margin-block-start: 55px;
  }
}
@media (max-width: 740px) {
  body[data-page="catalog"] #catalog-results[data-quick-filters] { inset-block-start: calc(65px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 459px) {
  body[data-page="catalog"] #catalog-results[data-quick-filters] .catalog-sort-label-text {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (max-height: 420px) {
  body[data-page="catalog"] #catalog-results[data-quick-filters] { position: static; }
}

/* The native submit is only rendered when JavaScript is unavailable. */
#catalogo .catalog-native-search {
  min-height: 44px;
  padding-inline: .62rem;
  color: #ffe4af;
  background: #263445;
  border: 0;
  border-radius: .45rem;
  cursor: pointer;
}
#catalogo .catalog-fallback p a { color: #f0d39a; text-decoration: underline; text-underline-offset: .22em; }
#catalogo .catalog-native-search:focus-visible { outline: 2px solid #ffe4af; outline-offset: -2px; }

#catalogo .catalog-native-facets { margin-block: 1rem; border-block: 1px solid #e8c78836; }
#catalogo .catalog-native-facets summary { min-height: 44px; padding: .65rem 0; cursor: pointer; color: #ffe4af; }
#catalogo .catalog-native-facets form { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem 1rem; padding-block-end: 1rem; }
#catalogo .catalog-native-facets label { display: grid; flex: 1 1 9rem; gap: .32rem; font-size: .9rem; }
#catalogo .catalog-native-facets select { width: 100%; min-width: 0; min-height: 44px; padding-inline: .5rem; border: 1px solid #d5bb8b52; border-radius: .45rem; color: inherit; background: #151f2c; }
#catalogo .catalog-native-facets form a { margin-inline-start: .45rem; color: #f0d39a; text-decoration: underline; }
