/****
 * Theme Name:        twentytwentyfour-child
 * Theme URI:         https://wildernisatelier.nl
 * Template:          twentytwentyfour
 * Description:       Child theme tweaks for Wildernis Atelier
 * Version:           1.0.0
 * Author:            Jasper Kuipers, Can Guner
 * Tags:              block-patterns, full-site-editing
 */

/* ==========================
   Utility visibility classes
   ========================== */

/* Basis: verberg alle varianten om overlap te voorkomen */
.mobile, .tablet, .desktop { display: none !important; }

/* Mobiel (≤ 767px) */
@media (max-width: 767px) {
  .mobile { display: block !important; }
}

/* Desktop + Tablet (≥ 768px) */
@media (min-width: 768px) {
  .desktop { display: block !important; }
}

/* Add-to-cart icons */
/* Centreer en dimensioneer de 'in winkelmand' knop in productkaarten */
.wc-block-grid__product .wp-block-button__link,
.wc-block-components-product-button__button,
button.add_to_cart_button.product_type_simple,
button.single_add_to_cart_button.product_type_simple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;         /* geen baseline-verschil */
  padding: 10px;          /* gelijke padding rondom voor perfecte centrering */
}

/* Icoon exact in het midden en passend formaat */
.wc-block-grid__product .wp-block-button__link::before,
.wc-block-components-product-button__button::before,
button.add_to_cart_button.product_type_simple::before,
button.single_add_to_cart_button.product_type_simple::before {
  display: block;
  font-family: FontAwesome;
  content: "\f217";
  font-weight: 300;
  font-size: 18px;        /* iets kleiner zodat het niet tegen de randen komt */
  line-height: 1;
  margin: 0;
}

/* ==========================
   WOO: CATALOG – MOBILE IMAGE LAYOUT
   ========================== */
@media (max-width: 767px) {
  /* Maak van elke kaart een gestapelde 'card' met een grote afbeelding bovenaan */
  .woocommerce li.wc-block-product { display: block !important; }

  /* Afbeelding full-width en niet begrensd door een max-width van het theme */
  .woocommerce li.wc-block-product .wc-block-grid__product-image,
  .woocommerce li.wc-block-product .wc-block-components-product-image,
  .woocommerce li.wc-block-product .wp-block-woocommerce-product-image { 
    width: 100% !important; 
    max-width: none !important; 
    margin: 0 0 8px 0; 
    align-self: stretch;
    padding: 0; 
    border: 0;
  }

  /* Forceer een mooi, consistent vierkant kader voor thumbnails */
  .woocommerce li.wc-block-product .wc-block-grid__product-image a,
  .woocommerce li.wc-block-product .wc-block-components-product-image a,
  .woocommerce li.wc-block-product .wp-block-woocommerce-product-image a {
    position: relative;
    display: block; 
    width: 100%; 
    aspect-ratio: 1 / 1;   /* vierkant: pas aan indien gewenst */
    overflow: hidden;
  }

  /* Vul het kader volledig en snijd netjes bij waar nodig */
  .woocommerce li.wc-block-product .wc-block-grid__product-image a img,
  .woocommerce li.wc-block-product .wc-block-components-product-image a img,
  .woocommerce li.wc-block-product .wp-block-woocommerce-product-image a img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;     /* beeld vullend, netjes bijsnijden */
    display: block;
    border-radius: 6px;
  }

  /* Beperk titel tot 2 regels (mobiel compacter) */
  .woocommerce li.wc-block-product :is(.wc-block-grid__product-title, .wc-block-components-product-title) {
    -webkit-line-clamp: 2;
  }
}

/* ——— WC Blocks kaarten: titel gelijk + knop onderaan (specifiek voor jouw DOM) ——— */

/* Kaart = kolom */
.woocommerce li.wc-block-product {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

/* De directe group met titel/prijs/knop laten rekken */
.woocommerce li.wc-block-product > .wp-block-group.is-vertical.is-layout-flex {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
}

/* Titel: altijd ruimte voor 2 regels */
.woocommerce li.wc-block-product :is(.wc-block-grid__product-title, .wc-block-components-product-title) {
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1em * 1.35);
  margin: 0;
}

/* Prijs stabiel */
.woocommerce li.wc-block-product :is(.wc-block-components-product-price, .wc-block-grid__product-price) {
  display: block;
  margin: 8px 0;
  min-height: 1.2em;
}

/* Het LAATSTE kind in die group (meestal de knop) naar onderen duwen */
.woocommerce li.wc-block-product > .wp-block-group.is-vertical.is-layout-flex > *:last-child {
  margin-top: auto !important;
  align-self: stretch;
  position: static !important;
}

/* Knopinhoud netjes centreren */
.woocommerce li.wc-block-product :is(.wp-block-button__link, .wc-block-components-product-button__button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  line-height: 1;
}

/* ==========================
   WOO: PRODUCT PAGE TWEAKS
   ========================== */
.tabs.wc-tabs { display: none; }
.woocommerce-tabs .woocommerce-Tabs-panel { display: block !important; }
.wc-block-components-product-sku { display: none; }

/* Sale badge */
.woocommerce .wp-block-woocommerce-product-image-gallery span.onsale {
  background: #fff; color: #43454b; border-radius: 4px; font-weight: 600;
  position: absolute; left: .5em; top: 1em; z-index: 9;
  padding: .25em .75em; text-transform: uppercase; line-height: 1; min-height: 0; width: auto;
}

/* Hide attributes & in-stock line */
.woocommerce table.shop_attributes { display: none; }
.woocommerce div.product p.stock.in-stock { display: none; }
.outofstock .price, .outofstock .amount { display: none; }

/* Notices */
.wc-block-components-notice-banner.is-success { background: transparent; border-color: #5F8569 !important; }
.wc-block-components-notice-banner.is-success>svg { background: #5F8569; border-color: #5F8569; fill: #fff; }
.wc-block-components-notice-banner.is-error { background: transparent; border-color: #774C60 !important; }
.wc-block-components-notice-banner.is-error>svg { background: #774C60; border-color: #774C60; fill: #fff; }


/* Blog excerpt spacing (avoid aggressive widths/heights) */
.blog .wp-block-post-excerpt__excerpt,
.archive .wp-block-post-excerpt__excerpt {
  margin: 0;
}

/* Horizontal scroll pill bar */
div.scrollmenu { overflow: auto; white-space: nowrap; -ms-overflow-style: none; scrollbar-width: none; }
.scrollmenu::-webkit-scrollbar { display: none; }

/* Pill button (category chips) */
.pillbutton {
  background-color: var(--wp--preset--color--base-2);
  border-radius: 50px;
  border: 0;
  color: var(--wp--preset--color--base);
  font-family: var(--wp--preset--font-family--work-sans);
  font-size: var(--wp--preset--font-size--small);
  font-weight: 500;
  padding: 0 .75rem; /* horizontal only */
  text-decoration: none;
}

/* ==========================
   FORMS / CF7
   ========================== */
.wpcf7 {
  font: inherit;
  color: var(--wp--preset--color--contrast);
  padding: .5rem;
  border-color: var(--wp--preset--color--contrast);
  border-radius: 0;
  background: var(--wp--preset--color--background);
  width: 100%;
}

/* ==========================
   WOO: CATALOG CONTROLS
   ========================== */
/* Order-by select at top of grid */
.woocommerce.wc-block-catalog-sorting select.orderby,
.woocommerce-ordering select {
  font: inherit;
  color: var(--wp--preset--color--contrast);
  padding: .5rem;
  border: 1px solid var(--wp--preset--color--contrast) !important;
  margin: 0;
  background-color: var(--wp--preset--color--background);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M12 17.414 3.293 8.707l1.414-1.414L12 14.586l7.293-7.293 1.414 1.414L12 17.414z" /></svg>');
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 10px 10px;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  position: relative;
}

/* Filter tokens */
.wc-blocks-components-form-token-field-wrapper:not(.is-loading) {
  border: 1px solid var(--wp--preset--color--contrast) !important;
  border-radius: 0;
}
.wc-blocks-components-form-token-field-wrapper .components-form-token-field__input-container input[type=text].components-form-token-field__input {
  border-radius: 0; border-color: transparent; margin-left: 0;
  background: var(--wp--preset--color--background); color: var(--wp--preset--color--contrast);
  font-family: var(--wp--preset--font-family--work-sans);
  font-size: var(--wp--preset--font-size--small);
  line-height: 1.55; font-weight: 300;
}
.wp-block-woocommerce-filter-wrapper { width: 100%; min-width: 0; }
@media (min-width: 992px) {
  .wp-block-woocommerce-filter-wrapper { width: max-content; min-width: 40vw; }
}
.wc-block-stock-filter__actions { display: none; }

/* ==========================
   MOBILE LIST-VIEW: GELIJKE AFBEELDINGSKOLOM (≤767px)
   ========================== */
@media (max-width: 767px) {
  /* Zorg dat elke product-tegel in de klassieke loop een consistente lay-out heeft */
  ul.products li.product { 
    display: flex !important; 
    align-items: flex-start; 
    gap: 12px; 
  }

  /* Link met de afbeelding = vaste, schaalbare kolom links */
  ul.products li.product > a:first-child {
    position: relative !important;
    flex: 0 0 42vw !important;          /* breedte van de beeldkolom */
    width: 42vw !important;
    max-width: 42vw !important;
    aspect-ratio: 1 / 1 !important;     /* vierkant; pas naar 4/5 indien gewenst */
    overflow: hidden !important;
    margin: 0 !important;
  }

  /* Afbeelding vult altijd het kader volledig */
  ul.products li.product > a:first-child img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }

  /* Tekstkolom kan gewoon de rest van de ruimte gebruiken */
  ul.products li.product .price,
  ul.products li.product .woocommerce-loop-product__title,
  ul.products li.product .woocommerce-product-details__short-description { max-width: 100%; }
}

/* ==========================
   HOMEPAGE – Categorie cover tiles (simplified)
   Doel: volledige tegel klikbaar, gecentreerde titel, B/W en gecentreerde afbeelding
   ========================== */

/* Ruimte tussen de twee tegels */
.home .wp-block-columns.alignwide { gap: 32px; }
/* Forceer gelijke kolomhoogte en laat cover uitrekken */
.home .wp-block-columns.alignwide { align-items: stretch; }
.home .wp-block-columns.alignwide .wp-block-column { display: flex; }
.home .wp-block-columns.alignwide .wp-block-column > .wp-block-cover { flex: 1 1 auto; }

/* Basis cover-setup */
.home .wp-block-columns.alignwide .wp-block-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 320px;
  aspect-ratio: auto;
  overflow: hidden;
}

/* Variant 1: IMG achtergrond */
.home .wp-block-columns.alignwide .wp-block-cover__image-background {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: 70% 30% !important; /* custom focus (no negative Y) */
  filter: grayscale(100%) contrast(1.05);
}

/* Variant 2: span met background-image */
.home .wp-block-columns.alignwide .wp-block-cover__background {
  background-size: cover !important;
  background-position: 50% 50% !important; /* exact midden */
  filter: grayscale(100%) contrast(1.05);
}

/* Maak de hele tegel klikbaar via de bestaande knop-link */
.home .wp-block-columns.alignwide .wp-block-cover a.wp-block-button__link {
  position: absolute !important;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
  z-index: 20 !important;
  border: 5px solid transparent !important;
  border: 0 !important; /* debug off – overlay blijft full-cover */
  box-sizing: border-box !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  text-decoration: none !important;
  color: #fff !important;
  font-family: var(--wp--preset--font-family--work-sans, inherit);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .5px;
  font-size: clamp(24px, 2.6vw, 48px);
}

/* Verberg de oorspronkelijke knop-wrapper zodat er geen extra ruimte of tweede knop ontstaat */
.home .wp-block-columns.alignwide .wp-block-cover .wp-block-button { display: contents; }

/* Responsieve hoogte-aanpassingen */
@media (max-width: 991px) {
  .home .wp-block-columns.alignwide .wp-block-cover { height: 260px; aspect-ratio: auto; }
}
@media (max-width: 600px) {
  .home .wp-block-columns.alignwide .wp-block-cover { height: 220px; aspect-ratio: auto; }
}

