/* Kiln enhancements (enh10): native dialogs + popover toast resets, lei, FIRST10 saving, delivery estimate,
   product facts, RUO by Add to cart, <picture> wrapper, tile titles by container size. Inter only, clay + sand. */

/* ---------- 10 · native <dialog> for drawer / search / quick view: neutralise UA dialog styles ----------
   :where() keeps these at zero specificity so the existing .kiln-drawer / .kiln-search / .kiln-qv rules win. */
:where(dialog.kiln-dlg) { inset: auto; margin: 0; padding: 0; border: 0; max-width: none; max-height: none; background: none; color: inherit; overflow: visible; }
dialog.kiln-dlg:not([open]) { display: none !important; }
dialog.kiln-dlg::backdrop { background: transparent; } /* the existing .kiln-scrim stays the visible scrim */
dialog.kiln-search { width: auto; height: auto; }
dialog.kiln-search[open] { display: block; }
dialog.kiln-drawer[open] { display: flex; }
/* Old browsers without <dialog>: same element, toggled with the open attribute (ux.js fallback). */
.kiln-drawer:focus-visible, .kiln-search:focus-visible, .kiln-qv:focus-visible { outline: none; }

/* ---------- 10 · toast as popover="manual" (top layer) with a close button ---------- */
:where(.kiln-toast[popover]) { inset: auto; margin: 0; border: 0; overflow: visible; width: auto; height: auto; }
.kiln-toast[popover]:not(:popover-open) { display: none; }
.kiln-toast { align-items: center; gap: 12px; }
.kiln-toast.is-on { pointer-events: auto; }
.kiln-toast-x { flex: 0 0 auto; display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -6px -10px -6px 2px; padding: 0; border: 0; border-radius: var(--k-r-s, 4px); background: transparent; color: inherit; opacity: .75; cursor: pointer; }
.kiln-toast-x:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.kiln-toast-x:focus-visible { outline: 2px solid var(--k-paper, #fff); outline-offset: 1px; opacity: 1; }
@media (max-width: 599px) { body.kiln-locked .kiln-toast { pointer-events: none !important; } }
@media (min-width: 600px) and (max-width: 759px) { body.kiln-locked .kiln-toast { pointer-events: none !important; } }
@media (min-width: 900px) and (max-width: 1039px) { body.kiln-locked:has(.kiln-drawer .kiln-sugg) .kiln-toast { pointer-events: none !important; } }

/* ---------- 1 · lei next to euro (display only) ---------- */
html body.kiln .kiln-lei { display: inline-block; margin-left: 4px; font: 400 .86em/1.2 var(--k-font) !important; color: var(--k-mute) !important; letter-spacing: 0 !important; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
html body.kiln .kiln-dl-price .kiln-lei, html body.kiln .woocommerce-cart-form .product-subtotal .kiln-lei,
html body.kiln .woocommerce-cart-form .product-price .kiln-lei { display: block; margin: 2px 0 0; }
html body.kiln .kiln-dl-sub .kiln-lei { display: inline; font-size: 14px !important; }

/* ---------- 2 · FIRST10 saving / hint ---------- */
html body.kiln .kiln-save { margin: 0 !important; font: 500 13.5px/1.4 var(--k-font) !important; color: var(--k-moss); max-width: none !important; }
html body.kiln .kiln-save.is-saving { color: var(--k-clay); font-weight: 600 !important; }
html body.kiln .kiln-save.is-hint { color: var(--k-mute); font-weight: 400 !important; }
html body.kiln .kiln-save--drawer { margin: -4px 0 0 !important; text-align: right; }
html body.kiln .cart_totals tr.kiln-save-row td { padding-top: 10px !important; padding-bottom: 10px !important; text-align: right; border-top: 0 !important; }

/* ---------- 3 · delivery estimate ---------- */
html body.kiln .kiln-eta { display: flex; align-items: center; gap: 8px; margin: 0 !important; max-width: none !important; font: 500 13px/1.4 var(--k-font) !important; color: var(--k-ink); font-variant-numeric: lining-nums tabular-nums; }
html body.kiln .kiln-eta-ico { flex: 0 0 auto; color: var(--k-moss); }
html body.kiln .kiln-eta--product { margin: 14px 0 0 !important; }
html body.kiln .kiln-eta--cart { margin: 0 0 18px !important; }
html body.kiln .kiln-eta-slot { margin: -6px 0 18px; }
html body.kiln .kiln-eta-slot[hidden] { display: none !important; }
html body.kiln .kiln-eta--drawer { color: var(--k-mute); font-weight: 400 !important; }

/* ---------- 4 · product facts + RUO by Add to cart ---------- */
html body.kiln .kiln-facts { margin: 0 0 22px; border-top: 1px solid var(--k-line); border-bottom: 1px solid var(--k-line); }
html body.kiln .kiln-facts dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin: 0 !important; }
html body.kiln .kiln-facts dl > div { padding: 12px 14px 12px 0; }
html body.kiln .kiln-facts dt { margin: 0 0 3px; font: 500 11px/1.2 var(--k-font) !important; letter-spacing: .08em; text-transform: uppercase; color: var(--k-mute); }
html body.kiln .kiln-facts dd { margin: 0 !important; font: 500 14px/1.35 var(--k-font) !important; color: var(--k-ink); }
html body.kiln .kiln-ruo-cta { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0 !important; max-width: none !important; font: 400 13px/1.45 var(--k-font) !important; color: var(--k-mute); }
html body.kiln .kiln-ruo-cta svg { flex: 0 0 auto; margin-top: 2px; color: var(--k-clay); }

/* ---------- 9 · <picture> wrapper is layout-neutral (img keeps its existing box rules) ---------- */
picture.kiln-pic { display: contents; }

/* ---------- 10 · tile titles sized by the tile, not the viewport (same 14 / 15 px steps as before) ---------- */
@supports (container-type: inline-size) {
  html body.kiln ul.products li.product { container: kiln-tile / inline-size; }
  html body.kiln .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body.kiln ul.products li.product .woocommerce-loop-product__title { font-size: 14px !important; }
  @container kiln-tile (min-width: 278px) {
    html body.kiln .woocommerce ul.products li.product .woocommerce-loop-product__title,
    html body.kiln ul.products li.product .woocommerce-loop-product__title { font-size: clamp(14px, 5.4cqi, 15px) !important; }
  }
}
