/**
 * Magnetiek extras - enqueued via functions.php.
 * Polish styles that don't belong in theme.json's styles.css
 * (card hovers + scroll-driven entry animations + WC variant-details).
 */

/* === Hover transitions (smooth border + transform + shadow) === */
.magnetiek-cat-tile,
.magnetiek-product-card,
.magnetiek-hero-card {
  transition:
    border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Card hover lift (speels-modern accent #2, design-brief sect 6.5) === */
@media (prefers-reduced-motion: no-preference) {
  .magnetiek-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 137, 188, 0.15);
  }
  .magnetiek-hero-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(41, 137, 188, 0.10);
  }
}

/* === Scroll-driven entry animation (speels-modern accent #3) ===
 * Uses CSS scroll-driven animations (Chrome/Edge 115+, others coming).
 * Graceful no-op in non-supporting browsers.
 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .magnetiek-cat-tile,
    .magnetiek-product-card,
    .magnetiek-hero-card,
    .has-mg-rule {
      animation: mg-snap-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 25%;
    }
    @keyframes mg-snap-in {
      from {
        opacity: 0;
        transform: translateY(16px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
  }
}

/* === Variant-detail-blok op WC product-pagina's (Fase B) === */
.magnetiek-variant-details {
  margin: 16px 0 20px;
}
.magnetiek-variant-details:empty {
  display: none;
}
.magnetiek-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  border-top: 1px solid var(--wp--preset--color--border);
  border-bottom: 1px solid var(--wp--preset--color--border);
  padding: 14px 0;
  margin-bottom: 16px;
}
.magnetiek-spec-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.magnetiek-spec-label {
  color: var(--wp--preset--color--foreground-soft);
}
.magnetiek-spec-value {
  color: var(--wp--preset--color--foreground);
  font-weight: 500;
}
.magnetiek-staffel {
  background: var(--wp--preset--color--background);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.magnetiek-staffel-label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wp--preset--color--foreground-soft);
  margin-bottom: 8px;
}
.magnetiek-staffel table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}
.magnetiek-staffel table tr:not(:last-child) {
  border-bottom: 1px dotted var(--wp--preset--color--border);
}
.magnetiek-staffel table td {
  padding: 6px 0;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  color: var(--wp--preset--color--foreground);
}
.magnetiek-staffel table td:first-child {
  color: var(--wp--preset--color--foreground-soft);
}
.magnetiek-staffel table td:last-child {
  text-align: right;
  font-weight: 600;
}
.magnetiek-staffel-note {
  font-family: var(--wp--preset--font-family--body);
  font-size: 11px;
  color: var(--wp--preset--color--foreground-soft);
  margin-top: 8px;
  font-style: italic;
}


/* === Compacte product-spec-tabel (PDP-beschrijving) === */
.magnetiek-spec-table {
  margin: 0 0 16px;
  overflow-x: auto;
}
.magnetiek-spec-table table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
}
.magnetiek-spec-table thead th {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--wp--preset--color--foreground-soft);
  padding: 8px 12px;
  border-bottom: 1px solid var(--wp--preset--color--border);
  text-align: left;
  white-space: nowrap;
  background: transparent;
}
.magnetiek-spec-table tbody td {
  padding: 5px 12px;
  border-bottom: 1px dotted var(--wp--preset--color--border);
  font-family: var(--wp--preset--font-family--mono);
  color: var(--wp--preset--color--foreground);
  white-space: nowrap;
}
.magnetiek-spec-table tbody td:first-child {
  font-weight: 600;
  color: var(--wp--preset--color--foreground);
  letter-spacing: 0.02em;
}
.magnetiek-spec-table thead th:not(:first-child),
.magnetiek-spec-table tbody td:not(:first-child) {
  text-align: right;
}
.magnetiek-spec-table tbody tr:last-child td {
  border-bottom: none;
}
.magnetiek-spec-table.is-style-stripes tbody tr:nth-child(odd) td {
  background: rgba(61, 71, 80, 0.025);
}

/* === Modern variations-form (attribuut-dropdowns) === */
.variations_form table.variations {
  width: 100%;
  border-collapse: collapse;
  border: none !important;
  margin: 0 0 var(--wp--preset--spacing--md);
  background: transparent;
}
.variations_form table.variations tbody,
.variations_form table.variations tr {
  border: none !important;
  background: transparent;
}
.variations_form table.variations th,
.variations_form table.variations td {
  border: none !important;
  background: transparent;
  padding: 6px 0;
  vertical-align: middle;
}
.variations_form table.variations th.label {
  width: 38%;
  padding-right: 16px;
  font-weight: normal;
}
.variations_form table.variations th.label label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--wp--preset--color--foreground-soft);
  margin: 0;
  line-height: 1.4;
}
.variations_form table.variations select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--wp--preset--color--foreground);
  background-color: var(--wp--preset--color--surface);
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='none' stroke='%235C6670' stroke-width='24' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='208 96 128 176 48 96'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 6px;
  padding: 11px 40px 11px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.variations_form table.variations select:hover {
  border-color: var(--wp--preset--color--brand);
}
.variations_form table.variations select:focus {
  border-color: var(--wp--preset--color--brand);
  box-shadow: 0 0 0 3px rgba(41, 137, 188, 0.15);
}
.variations_form .reset_variations {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  font-family: var(--wp--preset--font-family--mono) !important;
  font-size: 0.6875rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--wp--preset--color--foreground-soft) !important;
  background: none !important;
  text-decoration: none !important;
  border: none !important;
  border-bottom: 1px dotted currentColor !important;
  padding: 0 0 1px 0 !important;
  margin: 8px 0 0 0 !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
}
.variations_form .reset_variations::before {
  content: "\00d7";
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  margin-right: 2px;
}
.variations_form .reset_variations:hover,
.variations_form .reset_variations:focus,
.variations_form .reset_variations:active {
  color: var(--wp--preset--color--brand) !important;
  border-bottom-color: var(--wp--preset--color--brand) !important;
  text-decoration: none !important;
  background: none !important;
  outline: none;
}

@media (max-width: 540px) {
  .variations_form table.variations th.label,
  .variations_form table.variations td.value {
    display: block;
    width: 100%;
    padding: 0;
  }
  .variations_form table.variations th.label {
    padding-bottom: 4px;
  }
  .variations_form table.variations td.value {
    padding-bottom: 12px;
  }
}

/* === Compacte spec-strip (rendert direct onder dropdowns zodra beide attributen geselecteerd zijn) === */
.magnetiek-spec-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-top: 1px solid var(--wp--preset--color--border);
  border-bottom: 1px solid var(--wp--preset--color--border);
  padding: 14px 0;
  margin: 0 0 16px;
}
.magnetiek-spec-strip-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 14px;
  border-right: 1px solid var(--wp--preset--color--border);
  min-width: 0;
}
.magnetiek-spec-strip-cell:first-child {
  padding-left: 0;
}
.magnetiek-spec-strip-cell:last-child {
  border-right: none;
  padding-right: 0;
}
.magnetiek-spec-strip-label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wp--preset--color--foreground-soft);
  white-space: nowrap;
  line-height: 1.2;
}
.magnetiek-spec-strip-value {
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--wp--preset--color--foreground);
  letter-spacing: -0.005em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 540px) {
  .magnetiek-spec-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
    padding: 14px 0;
  }
  .magnetiek-spec-strip-cell {
    border-right: none;
    padding: 0;
  }
}

/* Hide WC variation-description (we tonen specs nu via spec-strip onder dropdowns) */
.woocommerce-variation-description,
.woocommerce-variation-description:empty {
  display: none !important;
}


/* === Shop archive product cards (kleiner, dichter, design-brief: 5 per rij) === */
.wp-block-woocommerce-product-template {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 1.75rem 1.25rem !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.wp-block-woocommerce-product-template > li,
.wp-block-woocommerce-product-template__product,
.wc-block-product {
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  max-width: none !important;
  background: transparent;
  list-style: none;
}

/* Image */
.wp-block-woocommerce-product-template .wp-block-woocommerce-product-image,
.wp-block-woocommerce-product-template .wc-block-components-product-image {
  margin: 0 0 10px 0 !important;
  background: var(--wp--preset--color--background);
  border-radius: 6px;
  overflow: hidden;
}
.wp-block-woocommerce-product-template .wp-block-woocommerce-product-image img,
.wp-block-woocommerce-product-template .wc-block-components-product-image img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  display: block !important;
}

/* Title */
.wp-block-woocommerce-product-template h2.wp-block-post-title,
.wp-block-woocommerce-product-template .wp-block-post-title {
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.005em !important;
  margin: 0 0 4px !important;
  text-align: left !important;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wp-block-woocommerce-product-template h2.wp-block-post-title a,
.wp-block-woocommerce-product-template .wp-block-post-title a {
  color: var(--wp--preset--color--foreground) !important;
  text-decoration: none !important;
}

/* Price */
.wp-block-woocommerce-product-template .wp-block-woocommerce-product-price,
.wp-block-woocommerce-product-template .wc-block-components-product-price {
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  color: var(--wp--preset--color--foreground) !important;
  text-align: left !important;
  margin: 0 !important;
}
.wp-block-woocommerce-product-template .wc-block-components-product-price__value {
  font-family: var(--wp--preset--font-family--body) !important;
}

/* Subtle hover lift */
@media (prefers-reduced-motion: no-preference) {
  .wp-block-woocommerce-product-template .wp-block-woocommerce-product-image,
  .wp-block-woocommerce-product-template .wc-block-components-product-image {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .wp-block-woocommerce-product-template > li:hover .wp-block-woocommerce-product-image,
  .wp-block-woocommerce-product-template > li:hover .wc-block-components-product-image,
  .wc-block-product:hover .wp-block-woocommerce-product-image,
  .wc-block-product:hover .wc-block-components-product-image {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 137, 188, 0.12);
  }
}

@media (max-width: 1100px) {
  .wp-block-woocommerce-product-template {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 800px) {
  .wp-block-woocommerce-product-template {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 540px) {
  .wp-block-woocommerce-product-template {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1.25rem 1rem !important;
  }
  .wp-block-woocommerce-product-template h2.wp-block-post-title,
  .wp-block-woocommerce-product-template .wp-block-post-title {
    font-size: 0.8125rem !important;
  }
}

/* === Shop archive 2-koloms layout (sidebar + producten) === */
.magnetiek-shop-grid {
  display: grid !important;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  align-items: start;
}
.magnetiek-shop-products {
  min-width: 0;
}
@media (max-width: 900px) {
  .magnetiek-shop-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* In 2-col-layout valt het productraster terug naar 4 cols (was 5) */
.magnetiek-shop-grid .wp-block-woocommerce-product-template {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
@media (max-width: 1100px) {
  .magnetiek-shop-grid .wp-block-woocommerce-product-template {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 800px) {
  .magnetiek-shop-grid .wp-block-woocommerce-product-template {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* === Shop sidebar (categorieën-selector) === */
.magnetiek-shop-sidebar {
  position: sticky;
  top: 24px;
  z-index: 100;
}
.magnetiek-shop-sidebar-eyebrow {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--wp--preset--color--foreground-soft);
  margin: 0 0 14px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--wp--preset--color--brand);
}
.magnetiek-shop-sidebar-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.magnetiek-shop-sidebar-list li {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}
.magnetiek-shop-sidebar-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wp--preset--color--border);
  color: var(--wp--preset--color--foreground);
  text-decoration: none !important;
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.15s ease, padding-left 0.15s ease, border-bottom-color 0.15s ease;
}
.magnetiek-shop-sidebar-list li:last-child a {
  border-bottom: none;
}
.magnetiek-shop-sidebar-list a:hover {
  color: var(--wp--preset--color--brand);
  padding-left: 4px;
}
.magnetiek-shop-sidebar-list a.is-active {
  color: var(--wp--preset--color--brand);
  font-weight: 600;
  border-bottom-color: var(--wp--preset--color--brand);
}
.magnetiek-shop-sidebar-name {
  flex: 1;
  min-width: 0;
}
.magnetiek-shop-sidebar-count {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--wp--preset--color--foreground-soft);
  background: var(--wp--preset--color--background);
  padding: 2px 9px;
  border-radius: 10px;
  min-width: 26px;
  text-align: center;
  flex-shrink: 0;
}
.magnetiek-shop-sidebar-list a.is-active .magnetiek-shop-sidebar-count {
  color: var(--wp--preset--color--brand);
  background: rgba(41, 137, 188, 0.1);
}

/* === Sidebar fly-out (subcategorieën met thumbnails) === */
.magnetiek-shop-sidebar-list li.has-subcats {
  /* anchored to .magnetiek-shop-sidebar (sticky) instead of self */
}
.magnetiek-shop-sidebar-list li.has-subcats > a::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 8px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.magnetiek-shop-sidebar-list li.has-subcats:hover > a::after,
.magnetiek-shop-sidebar-list li.has-subcats.is-current-branch > a::after {
  opacity: 1;
}
.magnetiek-shop-sidebar-flyout {
  position: absolute;
  top: 0;
  left: calc(100% + 24px);
  width: 320px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 20;
  pointer-events: none;
}
/* 24px invisible bridge zodat cursor van sidebar naar flyout kan zonder hover te verliezen */
.magnetiek-shop-sidebar-flyout::before {
  content: "";
  position: absolute;
  top: 0;
  left: -24px;
  width: 24px;
  height: 100%;
}
.magnetiek-shop-sidebar-list li.has-subcats:hover > .magnetiek-shop-sidebar-flyout,
.magnetiek-shop-sidebar-list li.has-subcats:focus-within > .magnetiek-shop-sidebar-flyout {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}
.magnetiek-shop-sidebar-flyout-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.magnetiek-shop-sidebar-flyout-list li {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}
.magnetiek-shop-sidebar-flyout-list a {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 8px 10px !important;
  border-bottom: none !important;
  border-radius: 4px;
  color: var(--wp--preset--color--foreground) !important;
  text-decoration: none !important;
  font-family: var(--wp--preset--font-family--body) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}
.magnetiek-shop-sidebar-flyout-list a:hover {
  background: var(--wp--preset--color--background) !important;
  color: var(--wp--preset--color--brand) !important;
  padding-left: 10px !important;
}
.magnetiek-shop-sidebar-flyout-list a.is-active {
  color: var(--wp--preset--color--brand) !important;
  background: rgba(41, 137, 188, 0.06) !important;
  font-weight: 600 !important;
}
.magnetiek-flyout-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--wp--preset--color--background);
  border-radius: 4px;
  flex-shrink: 0;
  color: var(--wp--preset--color--brand);
  overflow: hidden;
}
.magnetiek-flyout-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.magnetiek-flyout-thumb svg {
  width: 70%;
  height: 70%;
}
.magnetiek-flyout-name {
  flex: 1;
  min-width: 0;
}
.magnetiek-flyout-count {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--wp--preset--color--foreground-soft);
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  padding: 1px 7px;
  border-radius: 9px;
  flex-shrink: 0;
}
.magnetiek-shop-sidebar-flyout-list a.is-active .magnetiek-flyout-count {
  color: var(--wp--preset--color--brand);
  border-color: rgba(41, 137, 188, 0.3);
}
@media (max-width: 900px) {
  .magnetiek-shop-sidebar-list li.has-subcats > a::after {
    transform: rotate(135deg);
  }
  .magnetiek-shop-sidebar-flyout {
    position: static;
    width: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 4px 0 8px 16px;
    margin-bottom: 4px;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }
}

/* === Site logo (header) === */
.magnetiek-header-main .wp-block-site-logo {
  margin: 0;
}
.magnetiek-header-main .wp-block-site-logo .custom-logo {
  max-height: 48px;
  width: auto;
  height: auto;
  display: block;
}
.magnetiek-header-main .wp-block-site-logo a {
  display: inline-flex;
  align-items: center;
}