/*
 * Zone `catalogo`: the catalog listings: the grid, the filter column and the pagination.
 *
 * Rules only that family of pages needs. Every page of it links this file
 * last of all, after `site.css`, so a rule written here answers for a rule of
 * the whole site at the same specificity; no other page links it at all.
 *
 * The theme already dresses every element a listing prints — it is the
 * stylesheet of the origin, copied whole. What it never styled is what its own
 * scripts used to do after the page had loaded: the slides slick builds out of
 * the anchors of a card, the panel a group slides open, the state of an option.
 * Those are what is written here, and nothing else.
 */

/* --------------------------------------------------------------- the cards */

/*
 * The photo of a card, put back in the flow.
 *
 * The origin never meets this: it names each card photo after the gallery
 * entry it came from — `product-image-photo-55696` — so the one rule of the
 * theme that lifts a photo out of the flow, `.product-image-photo:not(:where(
 * .page-bottom *)){position:absolute}`, never reaches it. This delivery writes
 * the plain class, because the numbers are not in the data it was given, so
 * the rule does reach it and would leave every card with no height at all.
 *
 * What is undone here is that, and only that. **The width is left alone**: the
 * theme sizes a card photo by a `max-width` that steps with the screen — 195,
 * 233, 320, 424 and 308 px — and a photo wider than its card is clipped by the
 * slider, which is how the origin crops them. Forcing the photo to the width
 * of the card instead made every card shorter than the origin's: 266.5 → 183.2
 * at 480, 433.3 → 311.2 at 768, and 6 px out even where the two agreed.
 */
.product-gallery-slider .product-image-photo {
  position: static;
  height: auto;
}

/*
 * The grid of the origin prints the name of a dress in capitals and its own
 * page prints it as a word, so the catalog holds the word: the capitals are
 * the listing speaking, and that is where they are written.
 */
.product-item-name .product-item-link {
  text-transform: uppercase;
}

/*
 * The slides. The origin hands its carousel `fade: true, speed: 500`, which
 * stacks the photos of a card and fades one into the next over half a second
 * rather than sliding them. The theme carries the boxes slick builds
 * (`.slick-list`, `.slick-track`, `.slick-slide`) but not what fading does to
 * them, because that is written into the elements by the library itself.
 */
.product-gallery-slider.slick-slider .slick-track {
  position: relative;
}

.product-gallery-slider.slick-slider .slick-slide {
  float: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 500ms ease;
  pointer-events: none;
}

.product-gallery-slider.slick-slider .slick-slide.slick-current {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

/* A slide this screen is not shown, which the origin takes out of the row. */
.product-gallery-slider.slick-slider .slick-slide.slick-filtered {
  display: none;
}

/* ------------------------------------------------------- the filter column */

/* The heading of a group opens and shuts it, which is a thing to press. */
.filter-options-title {
  cursor: pointer;
}

/*
 * Which option of a group is the one ticked. The server of the origin said so
 * by serving the listing again with that option marked; here the page says it
 * without reloading, so the mark is the only thing that needs dressing.
 */
.filter-options-content .item.selected > a.js-filter-param .label {
  font-weight: 700;
  text-decoration: underline;
}

/*
 * The window the column opens as.
 *
 * The theme keeps `.sidebar-main` fixed off the screen (`top: -120%`) all the
 * way up to 1339 and only brings it back below 1024, where `.show` has a rule.
 * Between the two there is no width at which the filters can be reached at all:
 * the column is off the screen and the only switch on the page folds away a
 * column that was never there. These give `.show` the same meaning over the
 * whole band the column is a window over, which is what the one switch of the
 * page needs to be able to do anything there.
 */
@media only screen and (min-width: 1024px) and (max-width: 1339px) {
  /*
   * Below 1024 the two columns are a plain box and the window — which the theme
   * gives `z-index: 201` — rises over the header, which has nine. From 1024 the
   * box is `position: relative; z-index: 1`, so everything inside it is capped
   * at one and the header paints over the window. The box is lifted while the
   * window is open, and only then.
   */
  .page-products .columns:has(.sidebar-main.show) {
    z-index: 201;
  }

  .page-products .columns .sidebar-main {
    transition: top 0.5s ease;
  }

  .page-products .columns .sidebar-main.show {
    top: 0;
    box-shadow: 0 100vh 0 100vh rgba(0, 0, 0, 0.5);
  }

  /* The theme takes these three away where the column is a column. Where it is
   * a window they are what names it and what closes it. */
  .page-products .sidebar-main.show .close.filters,
  .page-products .sidebar-main.show .block-subtitle,
  .page-products .sidebar-main.show .filter-category {
    display: block;
  }

  .page-products .sidebar-main.show .filter-focusable-start,
  .page-products .sidebar-main.show .filter-focusable-end {
    display: block;
  }
}

/*
 * A chip of what was ticked. The theme dresses the pill, the word inside it and
 * the cross that drops it — `.filter-current .item`, `.filter-value`,
 * `.action.remove` — and says nothing at all about the name of the group, which
 * is the one part of the template it never shows. So the name is written, for a
 * reader that needs it, and left out of the pill, which is what the theme draws.
 */
.filter-current .filter-label {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}
