/* ==========================================================================
   Devine Tiles — /tiles/ listing and category pages
   Builds on shop.css (hero, card and sidebar list styles). Categories sit in
   a left sidebar; the other filters are dropdowns in a bar above the grid.
   ========================================================================== */

.dt-tiles-listing .screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Breadcrumb in the hero (category pages) */
.dt-tiles-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}
.dt-tiles-crumbs a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.dt-tiles-crumbs a:hover { color: var(--dt-primary); }
.dt-tiles-crumbs [aria-current] { color: var(--dt-white); }

.dt-tiles-wrap { padding: 32px 0 80px; }

/* ---------- layout: categories sidebar + main column ---------- */
.dt-tiles-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
.dt-tiles-side { position: sticky; top: 96px; padding-top: 14px; }
.dt-tiles-main { min-width: 0; }

/* ---------- filter bar ---------- */
.dt-tiles-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--dt-border);
}
.dt-tiles-bar__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.dt-dd { position: relative; }
.dt-dd__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px 0 18px;
    border: 1px solid var(--dt-border);
    border-radius: 999px;
    background: var(--dt-white);
    font-size: 14px;
    font-weight: 600;
    color: var(--dt-dark);
    white-space: nowrap;
    transition: border-color .2s, color .2s, background .2s;
}
.dt-dd__btn:hover { border-color: var(--dt-primary); color: var(--dt-primary); }
.dt-dd__btn:focus-visible { outline: 2px solid var(--dt-primary); outline-offset: 2px; }
.dt-dd__btn.is-active { border-color: var(--dt-primary); background: var(--dt-primary-light); color: var(--dt-primary); }
.dt-dd__n { font-weight: 700; }
.dt-dd__arrow { stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.dt-dd.is-open .dt-dd__arrow { transform: rotate(180deg); }

.dt-dd__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    min-width: 250px;
    max-height: min(380px, 60vh);
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--dt-border);
    border-radius: var(--dt-radius);
    background: var(--dt-white);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .1);
}
.dt-dd__panel[hidden] { display: none; }

.dt-dd__count {
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--dt-cream);
    font-size: 11px;
    font-weight: 500;
    color: var(--dt-gray);
    text-align: center;
}

/* Checkbox options */
.dt-tiles-options { list-style: none; margin: 0; padding: 0; }
.dt-tiles-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--dt-dark);
    cursor: pointer;
}
.dt-tiles-option:hover { background: var(--dt-primary-light); color: var(--dt-primary); }
.dt-tiles-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--dt-primary);
    cursor: pointer;
}
.dt-tiles-option__text { flex: 1; white-space: nowrap; }
.dt-tiles-option input:checked ~ .dt-tiles-option__text { color: var(--dt-primary); font-weight: 600; }
.dt-tiles-option.is-empty { opacity: .45; cursor: default; }
.dt-tiles-option.is-empty:hover { background: none; color: var(--dt-dark); }

/* Colour swatches */
.dt-swatch { width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.dt-swatch--white { background: #fff; }
.dt-swatch--grey { background: #9a9a9a; }
.dt-swatch--beige { background: #d9c6a5; }
.dt-swatch--black { background: #1f1f1f; }
.dt-swatch--brown { background: #7a5236; }
.dt-swatch--blue { background: #3f6b9a; }
.dt-swatch--green { background: #6f8f5f; }
.dt-swatch--terracotta { background: #c0704d; }

.dt-tiles-clear {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 14px;
    border: 0;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--dt-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.dt-tiles-clear[hidden] { display: none; }
.dt-tiles-clear:hover { color: var(--dt-primary-dark); }

.dt-tiles-count { margin: 0; font-size: 14px; color: var(--dt-gray); white-space: nowrap; }

/* Active filter chips */
.dt-tiles-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.dt-tiles-chips[hidden] { display: none; }
.dt-tiles-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 14px;
    border: 1px solid var(--dt-primary);
    border-radius: 999px;
    background: var(--dt-primary-light);
    font-size: 13px;
    font-weight: 600;
    color: var(--dt-dark);
}
.dt-tiles-chip svg { stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.dt-tiles-chip:hover { background: var(--dt-primary); color: var(--dt-white); }

/* ---------- grid: 3 across beside the sidebar ---------- */
.dt-tiles-wrap ul.products.dt-tiles-grid { grid-template-columns: repeat(3, 1fr) !important; margin-top: 8px !important; }
.dt-tiles-grid .dt-tile-card[hidden] { display: none !important; }
.dt-tiles-grid .dt-product-card__image,
.dt-tiles-grid .dt-product-card__image-wrap img { height: 220px !important; }
.dt-tiles-grid .dt-product-card__info { padding-bottom: 12px; }
.dt-tile-card__ref {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    color: var(--dt-gray);
}

.dt-tiles-empty {
    padding: 28px;
    border: 1px dashed var(--dt-border);
    border-radius: var(--dt-radius);
    background: var(--dt-cream);
    text-align: center;
}
.dt-tiles-empty[hidden] { display: none; }
.dt-tiles-empty p { margin: 0 0 8px; font-size: 15px; color: var(--dt-dark); }
.dt-tiles-empty a { color: var(--dt-primary); font-weight: 600; }

@media (max-width: 1024px) {
    .dt-tiles-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 28px; }
    .dt-tiles-bar { flex-direction: column; align-items: stretch; }
    .dt-tiles-count { order: -1; }
    .dt-tiles-wrap ul.products.dt-tiles-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 16px !important; }
}
@media (max-width: 768px) {
    .dt-tiles-wrap { padding-top: 20px; }
    /* Sidebar moves above the grid; categories scroll sideways as pills */
    .dt-tiles-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .dt-tiles-side { position: static; min-width: 0; padding-top: 0; }
    .dt-tiles-side .dt-filter-group__title { font-size: 14px; margin-bottom: 10px; }
    .dt-tiles-side .dt-filter-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
    .dt-tiles-side .dt-filter-cat > a { gap: 8px; padding: 7px 8px 7px 14px; border: 1px solid var(--dt-border); border-radius: 999px; white-space: nowrap; }
    .dt-tiles-side .dt-filter-cat--active > a { border-color: var(--dt-primary); }
    /* Panels open full width under the bar */
    .dt-dd { position: static; }
    .dt-dd__panel { left: 0; right: 0; top: auto; margin-top: 8px; min-width: 0; max-height: 55vh; }
    .dt-dd__btn { height: 40px; padding: 0 12px 0 14px; font-size: 13px; }
}
@media (max-width: 480px) {
    .dt-tiles-wrap ul.products.dt-tiles-grid { grid-template-columns: 1fr !important; }
    .dt-tiles-grid .dt-product-card__image,
    .dt-tiles-grid .dt-product-card__image-wrap img { height: 220px !important; }
}

/* ---------- landing pages with a doc: banner, intro, FAQ ---------- */
.dt-tiles-banner { background: var(--dt-cream); line-height: 0; }
.dt-tiles-banner img { display: block; width: 100%; height: auto; }

.dt-tiles-intro { padding: 36px 0 8px; }
.dt-tiles-intro .dt-tiles-crumbs { color: var(--dt-gray); margin-bottom: 14px; }
.dt-tiles-intro .dt-tiles-crumbs a { color: var(--dt-dark); }
.dt-tiles-intro .dt-tiles-crumbs a:hover { color: var(--dt-primary); }
.dt-tiles-intro .dt-tiles-crumbs [aria-current] { color: var(--dt-gray); }
.dt-tiles-intro__title { margin: 0 0 14px; font-family: var(--dt-font-heading); font-weight: 600; font-size: clamp(30px, 4vw, 46px); line-height: 1.15; color: var(--dt-black); }
.dt-tiles-intro__text { max-width: 880px; margin: 0; font-size: 16px; line-height: 1.75; color: var(--dt-gray); }
.dt-tiles-intro__text a,
.dt-tiles-faq__a a { color: var(--dt-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.dt-tiles-faq { padding: 8px 0 80px; }
.dt-tiles-faq__title { margin: 0 0 24px; font-family: var(--dt-font-heading); font-size: clamp(24px, 3vw, 34px); color: var(--dt-black); }
.dt-tiles-faq__list { max-width: 900px; border-top: 1px solid var(--dt-border); }
.dt-tiles-faq__item { border-bottom: 1px solid var(--dt-border); }
.dt-tiles-faq__item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    cursor: pointer;
    list-style: none;
}
.dt-tiles-faq__item summary::-webkit-details-marker { display: none; }
.dt-tiles-faq__item summary::after {
    content: '+';
    flex-shrink: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--dt-primary);
    transition: transform .2s;
}
.dt-tiles-faq__item[open] summary::after { transform: rotate(45deg); }
.dt-tiles-faq__item summary:focus-visible { outline: 2px solid var(--dt-primary); outline-offset: 2px; }
.dt-tiles-faq__q { margin: 0; font-family: var(--dt-font-body); font-size: 17px; font-weight: 600; line-height: 1.45; color: var(--dt-dark); }
.dt-tiles-faq__item summary:hover .dt-tiles-faq__q { color: var(--dt-primary); }
.dt-tiles-faq__a p { margin: 0 0 20px; font-size: 15px; line-height: 1.75; color: var(--dt-gray); }

@media (max-width: 768px) {
    .dt-tiles-intro { padding-top: 24px; }
    .dt-tiles-faq { padding-bottom: 56px; }
    .dt-tiles-faq__q { font-size: 16px; }
}
