/* =========================================================================
   NN Front Door - the mixed grid that greets a visitor (ticket 09).
   Only what is new to the house is written here: the grid's column count,
   the world's name on the card, the "Price on request" words, the pager and
   the trail's own margins. The card's picture, crop, type and colour are the
   child theme's house rules and are not restated.
   House tokens only: ivory ground, charcoal words, sand and stone rules.
   ========================================================================= */

/* --- 0. Full width -----------------------------------------------------
   The front door is the shop's own window: it runs the whole width of the
   screen instead of sitting inside the builder's narrow column, so one row
   of pieces fills the screen. The frame of breathing space is set once here
   and shared by the container, the grid and the pager. */

:root {
  --nn-fd-edge: 24px;
  --nn-fd-gap: 16px;
}

@media (max-width: 767px) {
  :root {
    --nn-fd-edge: 16px;
    --nn-fd-gap: 10px;
  }
}

/* Widen whichever builder container holds the grid, without naming the
   page or the element: only the box that has the grid as its own child. */
.e-con:has(> .nn-fd),
.elementor-element:has(> .nn-fd) {
  max-width: none !important;
  padding-left: var(--nn-fd-edge, 24px) !important;
  padding-right: var(--nn-fd-edge, 24px) !important;
  box-sizing: border-box;
}

/* The shop opens its goods sooner: the builder column that holds the shop's
   own grid keeps a smaller breath under the header than the builder sets,
   because the folded Filter word is already there. Brand pages (which have
   no Filter word) keep their roomy opening. */
.e-con:has(> .nn-fd .nn-fd-filters),
.elementor-element:has(> .nn-fd .nn-fd-filters) {
  padding-top: 10px !important;
}

@media (max-width: 767px) {
  .e-con:has(> .nn-fd .nn-fd-filters),
  .elementor-element:has(> .nn-fd .nn-fd-filters) {
    padding-top: 6px !important;
  }
}

/* --- 1. The grid: whole rows, and a short last row kept in the middle ----
   Two columns on a phone, three from a small tablet up, and never more: the
   owner's call. A row spans the whole screen, so the columns simply grow.

   The grid wraps as a centred row of cards rather than as fixed columns, so
   the last row of a short page sits in the middle of the screen instead of
   hanging off the left with a gap beside it. With eighteen pieces to a page
   that row is the only place a short row can appear at all. */

.nn-fd ul.products {
  --nn-fd-cols: 2;
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--nn-fd-gap, 16px);
  row-gap: 40px;
  grid-template-columns: none;
}

.nn-fd ul.products li.product {
  flex: 0 0 calc((100% - (var(--nn-fd-cols) - 1) * var(--nn-fd-gap, 16px)) / var(--nn-fd-cols));
  max-width: calc((100% - (var(--nn-fd-cols) - 1) * var(--nn-fd-gap, 16px)) / var(--nn-fd-cols));
}

@media (min-width: 768px) {
  .nn-fd ul.products {
    --nn-fd-cols: 3;
  }
}

/* --- 1b. Every picture is the same portrait shape ----------------------
   Three of four, cropped from the middle, on every card, so a row of
   pieces lines up whatever shape the photographs arrived in. */

.nn-fd ul.products li.product > a.woocommerce-LoopProduct-link img:not(.nn-fd-second) {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
}

/* --- 1c. The pointer: no zoom, and the piece's second photograph ---------
   The theme leans a picture in by 3% under the pointer. That is turned off
   here: instead, where a piece has a second view, it fades in over the
   first and the first comes back as the pointer leaves. A piece with one
   picture simply keeps it - nothing else moves. */

.nn-fd ul.products li.product > a.woocommerce-LoopProduct-link {
  position: relative;
}

.nn-fd ul.products li.product img {
  transition: none !important;
}

.nn-fd ul.products li.product:hover img,
.nn-fd ul.products li.product a:hover img,
.nn-fd ul.products li.product a:focus img,
.nn-fd ul.products li.product a:focus-visible img {
  transform: none !important;
}

.nn-fd ul.products li.product .nn-fd-second {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.nn-fd ul.products li.product:hover .nn-fd-second,
.nn-fd ul.products li.product > a.woocommerce-LoopProduct-link:focus-visible .nn-fd-second {
  opacity: 1;
}

/* A finger cannot hover, so the second picture never shows on a touch
   screen or at a phone's width; the first picture is the only one a
   shopper scrolls past, and nothing extra is downloaded there. */
@media (max-width: 767px), (hover: none) {
  .nn-fd ul.products li.product .nn-fd-second {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nn-fd ul.products li.product .nn-fd-second {
    transition: none;
  }
}

/* --- 2. The world's name, above the piece's name -----------------------
   The world wears the same clothes as the piece's name: same family, size,
   weight and colour. Only its place in the card tells them apart. */

.nn-fd ul.products li.product .nn-fd-world,
.nn-fd ul.products li.product .woocommerce-loop-product__title {
  display: block;
  margin: 0;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-charcoal, #20201F);
}

/* Tight rhythm under the picture: the three lines read as one block. */
.nn-fd ul.products li.product > a.woocommerce-LoopProduct-link {
  gap: 2px;
}

.nn-fd ul.products li.product > a.woocommerce-LoopProduct-link img:not(.nn-fd-second) {
  margin-bottom: 6px;
}

.nn-fd ul.products li.product .price {
  margin-top: 2px;
  line-height: 1.3;
}

/* --- 3. "Price on request" -------------------------------------------
   Permanent shop wording, in the price's own place and type. It is not a
   sample mark: no dashed box, no note, nothing to switch off. */

.nn-fd ul.products li.product .nn-fd-onrequest {
  display: block;
  font-size: var(--type-body-md-size, 14px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-charcoal, #20201F);
}

/* --- 4. The pager under the grid --------------------------------------
   The strip itself (arrows and numbers) is the shop's one pager module.
   Only its own breathing room belongs here: a rule above it and a wide
   space between the last row of pieces and the numbers. */

.nn-fd-pager {
  margin: 64px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--color-border, #DDD6CA);
}

.nn-fd-empty {
  margin: 0;
  font-size: var(--type-body-md-size, 14px);
  color: var(--color-charcoal, #20201F);
}

/* --- 5. The drop clock above the goods -------------------------------- */

.nn-fd-drop {
  margin: 0 0 36px;
}

/* --- 6. The trail -----------------------------------------------------
   A world page's trail is written in front of the builder page, so it
   keeps the same inner width the world's own panels use. */

.nn-crumbs--page {
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 0;
}

.nn-crumbs--piece {
  margin-bottom: 24px;
}

@media (max-width: 767px) {
  .nn-crumbs--page {
    padding: 20px 20px 0;
  }
}

/* --- 7. The shopper's four dropdowns ----------------------------------
   Folded away behind one plain word so the shop opens on its goods. One tap
   unfolds them. Quiet boxes on the ivory ground, hairline borders, no fill -
   the same restraint the rest of the house keeps. */

.nn-fd-filters {
  margin: 0 0 30px;
}

/* The word that unfolds the boxes. It reads as part of the page, not as a
   button: a small uppercase line, a chevron, and nothing else. The default
   marker a browser draws on a fold is taken away. */
.nn-fd-filters__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-overline-size, 10px);
  font-weight: var(--type-overline-weight, 500);
  letter-spacing: var(--type-overline-tracking, 0.14em);
  text-transform: uppercase;
  color: var(--color-charcoal, #20201F);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nn-fd-filters__toggle::-webkit-details-marker {
  display: none;
}

.nn-fd-filters__toggle::marker {
  content: '';
}

.nn-fd-filters__toggle:hover,
.nn-fd-filters__toggle:focus-visible {
  outline: none;
}

.nn-fd-filters__toggle:hover .nn-fd-filters__toggle-word,
.nn-fd-filters__toggle:focus-visible .nn-fd-filters__toggle-word {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nn-fd-filters__toggle:focus-visible {
  outline: 1px solid var(--color-charcoal, #20201F);
  outline-offset: 4px;
}

.nn-fd-filters__chev {
  width: 12px;
  height: 12px;
  flex: none;
  transition: transform 0.2s ease;
}

.nn-fd-filters[open] .nn-fd-filters__chev {
  transform: rotate(180deg);
}

/* What is narrowed, printed beside the word when the boxes are folded away
   again. Quiet, so it never shouts. */
.nn-fd-filters__toggle-on {
  font-size: var(--type-body-sm-size, 12px);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-stone, #A79D91);
}

@media (prefers-reduced-motion: reduce) {
  .nn-fd-filters__chev {
    transition: none;
  }
}

.nn-fd-filters__form {
  margin: 0;
  padding: 18px 0 0;
}

.nn-fd-filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 20px;
}

.nn-fd-filters__field {
  display: flex;
  flex: 1 1 200px;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 260px;
}

.nn-fd-filters__label {
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-overline-size, 10px);
  font-weight: var(--type-overline-weight, 500);
  letter-spacing: var(--type-overline-tracking, 0.14em);
  text-transform: uppercase;
  color: var(--color-charcoal, #20201F);
}

.nn-fd-filters select {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 34px 11px 12px;
  border: 1px solid var(--color-border, #E8E1D6);
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2320201F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-body-md-size, 14px);
  line-height: 1.3;
  color: var(--color-charcoal, #20201F);
  cursor: pointer;
}

.nn-fd-filters select:focus-visible {
  border-color: var(--color-charcoal, #20201F);
  outline: 2px solid var(--color-charcoal, #20201F);
  outline-offset: 2px;
}

.nn-fd-filters .nn-fd-filters__go {
  padding: 11px 22px;
  border: 1px solid var(--color-charcoal, #20201F);
  border-radius: 0;
  background: var(--color-charcoal, #20201F);
  color: var(--color-ivory, #F4F1EA);
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-label-sm-size, 11px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.nn-fd-filters .nn-fd-filters__go:hover,
.nn-fd-filters .nn-fd-filters__go:focus-visible {
  background: transparent;
  color: var(--color-charcoal, #20201F);
}

.nn-fd-filters__clear {
  padding: 11px 2px;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-body-md-size, 14px);
  color: var(--color-stone, #A79D91);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nn-fd-filters__clear:hover,
.nn-fd-filters__clear:focus-visible {
  color: var(--color-charcoal, #20201F);
}

.nn-fd-filters__count {
  margin: 18px 0 0;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--type-label-sm-size, 11px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-stone, #A79D91);
}

.nn-fd-empty a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 767px) {
  .nn-fd-filters {
    margin-bottom: 22px;
  }

  .nn-fd-filters__form {
    padding-top: 14px;
  }

  .nn-fd-filters__row {
    gap: 14px 10px;
  }

  .nn-fd-filters__field {
    flex: 1 1 calc(50% - 5px);
    max-width: none;
  }

  .nn-fd-filters .nn-fd-filters__go {
    flex: 1 1 100%;
  }

  .nn-fd-filters__clear {
    flex: 0 0 auto;
    text-align: center;
  }
}


