/* =========================================================
   Primo Paints — catalogue (products list + product details)
   Extends primo.css; uses the same brand tokens.
   ========================================================= */

/* ---------- Shop layout ---------- */
.shop-layout { display: grid; grid-template-columns: 260px 1fr; gap: 40px; align-items: start; }
.shop-side { position: sticky; top: 96px; }

.shop-search { position: relative; margin-bottom: 28px; }
.shop-search input {
    width: 100%; font: inherit; font-size: .94rem; color: var(--ink);
    padding: 13px 46px 13px 16px; border: 1px solid var(--line); border-radius: 100px;
    background: #fff; transition: border-color .2s, box-shadow .2s;
}
.shop-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(27, 60, 140, .1); }
.shop-search button {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--brand); color: #fff; display: grid; place-items: center; transition: background .2s;
}
.shop-search button:hover { background: var(--brand-dark); }

.side-block { margin-bottom: 30px; }
.side-block h4 {
    font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 14px;
}

.cat-list, .cat-sub { list-style: none; }
.cat-list > li { border-bottom: 1px solid var(--line); }
.cat-list > li:last-child { border-bottom: 0; }
.cat-list a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 2px; font-size: .95rem; color: var(--ink-soft); transition: color .2s, padding-left .2s;
}
.cat-list a:hover { color: var(--brand); padding-left: 5px; }
.cat-list a.is-active { color: var(--brand); font-weight: 600; }
.cat-list .n { font-size: .78rem; color: var(--muted); background: var(--bg-soft); padding: 2px 9px; border-radius: 100px; }
.cat-sub { padding: 0 0 8px 14px; border-left: 2px solid var(--line); margin-left: 2px; }
.cat-sub a { padding: 7px 2px; font-size: .89rem; }

.side-toggle { display: inline-flex; align-items: center; gap: 10px; font-size: .94rem; color: var(--ink-soft); cursor: pointer; }
.side-toggle .box {
    width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 6px; flex: none;
    display: grid; place-items: center; transition: background .2s, border-color .2s;
}
.side-toggle:hover .box { border-color: var(--brand); }
.side-toggle.is-on { color: var(--brand); font-weight: 600; }
.side-toggle.is-on .box { background: var(--brand); border-color: var(--brand); }
.side-toggle.is-on .box::after {
    content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.side-clear { font-size: .88rem; color: var(--accent); font-weight: 600; }
.side-clear:hover { text-decoration: underline; }

/* ---------- Toolbar ---------- */
.shop-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.shop-count { color: var(--ink-soft); font-size: .95rem; }
.shop-count strong { color: var(--ink); }
.shop-sort { display: flex; align-items: center; gap: 10px; }
.shop-sort label { font-size: .85rem; color: var(--muted); }
.shop-sort select {
    font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer;
    padding: 10px 14px; border: 1px solid var(--line); border-radius: 100px; background: #fff;
}
.shop-sort select:focus { outline: none; border-color: var(--brand); }

/* =========================================================
   Catalogue cards
   Scoped to .product-grid so the home-page carousel keeps its
   own icon-tile look.
   ========================================================= */
.product-grid { grid-template-columns: repeat(auto-fill, minmax(266px, 1fr)); gap: 28px; }

.product-grid .product-card {
    position: relative; background: #fff; border: 1px solid var(--line);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
}
.product-grid .product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.product-grid .product-card:focus-within { border-color: var(--brand); }

/* ---- Media ---- */
/* .product-top is an <a> here; keep primo.css's centering for the fallback icon. */
.product-card .product-top { display: grid; place-items: center; padding: 0; }
.product-grid .product-top {
    height: auto; aspect-ratio: 4 / 3;
    background: linear-gradient(165deg, #fff 0%, var(--bg-soft) 100%);
    border-bottom: 1px solid var(--line);
}
.product-grid .product-top::before { display: none; }
.product-card .product-top img {
    width: 100%; height: 100%; object-fit: contain; padding: 20px;
    position: absolute; inset: 0;
    transition: transform .5s var(--ease);
}
.product-grid .product-card:hover .product-top img { transform: scale(1.05); }

/* No photo (or a broken one): fall back to the product's accent tile. */
.product-grid .product-top.is-blank,
.product-grid .product-top.no-img {
    background: var(--tint, var(--brand)); border-bottom-color: transparent;
}
.product-grid .product-top.is-blank::before { display: block; }
.product-top.no-img img { display: none; }
.product-top.no-img::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 46px; height: 46px;
    background: rgba(255, 255, 255, .9);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2s7 8 7 13a7 7 0 1 1-14 0c0-5 7-13 7-13z'/></svg>") center/contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2s7 8 7 13a7 7 0 1 1-14 0c0-5 7-13 7-13z'/></svg>") center/contain no-repeat;
}

.product-card .product-top .chip, .product-card .product-top .badge { z-index: 2; }
.product-grid .product-top .chip {
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(20, 22, 28, .08); max-width: calc(100% - 28px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.p-badges { position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; gap: 6px; justify-items: end; }
.badge {
    font-family: 'Sora', sans-serif; font-weight: 700; font-size: .72rem; letter-spacing: .04em;
    padding: 6px 12px; border-radius: 100px; color: #fff; white-space: nowrap;
}
/* Product details page keeps the single absolutely-placed badge. */
.pd-main .badge { position: absolute; }
.badge--sale { background: var(--accent); box-shadow: 0 6px 16px rgba(230, 57, 70, .35); }
.badge--out { background: rgba(20, 22, 28, .78); }

/* Hover affordance over the image (pointer devices only). */
.p-peek {
    position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translate(-50%, 12px);
    font-family: 'Sora', sans-serif; font-weight: 600; font-size: .82rem; color: var(--brand);
    background: rgba(255, 255, 255, .95); padding: 8px 18px; border-radius: 100px;
    box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
}
@media (hover: hover) {
    .product-grid .product-card:hover .p-peek { opacity: 1; transform: translate(-50%, 0); }
}

/* Out of stock reads as muted rather than broken. */
.product-card.is-out .product-top img { filter: grayscale(.7); opacity: .65; }
.product-card.is-out .p-price .now { color: var(--ink-soft); }

/* ---- Body ---- */
.product-grid .product-body { padding: 20px 22px 22px; }
.p-brand {
    display: block; font-family: 'Sora', sans-serif; font-size: .7rem; font-weight: 600;
    letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.product-grid .product-body h3 {
    font-size: 1.06rem; line-height: 1.35; margin-bottom: 8px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-body h3 a { transition: color .2s; }
.product-body h3 a:hover { color: var(--brand); }
.product-grid .product-body p {
    flex: none; font-size: .89rem; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.p-foot {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    margin-top: auto; padding-top: 16px;
}
.p-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; font-family: 'Sora', sans-serif; }
.p-price .from { width: 100%; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.p-price .now { font-size: 1.3rem; font-weight: 700; color: var(--brand); letter-spacing: -.01em; }
.p-price .was { font-size: .9rem; color: var(--muted); text-decoration: line-through; }
.p-merchant { display: block; font-size: .76rem; color: var(--accent); font-weight: 600; margin-top: 10px; }

/* Arrow button replaces the old inline "View details" link. */
.product-grid .product-body .more {
    flex: none; width: 40px; height: 40px; margin: 0; border-radius: 50%;
    display: grid; place-items: center; color: var(--brand); background: var(--brand-light);
    transition: background .25s, color .25s, transform .25s var(--ease);
}
.product-grid .product-card:hover .more { background: var(--brand); color: #fff; transform: translateX(3px); }
.product-grid .product-body .more:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .product-grid .product-card,
    .product-grid .product-card:hover,
    .product-grid .product-top img,
    .product-grid .product-card:hover .product-top img,
    .product-grid .product-card:hover .more { transform: none; transition: none; }
}

/* ---------- Empty state & pager ---------- */
.shop-empty {
    text-align: center; padding: 64px 24px; border: 1px dashed var(--line);
    border-radius: var(--radius); background: var(--bg-soft);
}
.shop-empty h3 { font-size: 1.35rem; margin-bottom: 10px; }
.shop-empty p { color: var(--ink-soft); max-width: 460px; margin: 0 auto; }
.shop-empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

.pager { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 46px; }
.pager .pg {
    min-width: 42px; height: 42px; padding: 0 15px; border-radius: 100px; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: 'Sora', sans-serif; font-weight: 600; font-size: .9rem; color: var(--ink-soft);
    transition: border-color .2s, color .2s, background .2s;
}
.pager .pg:hover { border-color: var(--brand); color: var(--brand); }
.pager .pg.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* =========================================================
   Product details
   ========================================================= */
.page-hero--slim { padding: 28px 0 24px; }
.page-hero--slim .crumbs { margin-bottom: 0; }
.section--tight { padding: 52px 0 72px; }

.pd-layout { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: start; }

/* Gallery */
.pd-main {
    position: relative; border-radius: var(--radius-lg); overflow: hidden;
    aspect-ratio: 4 / 3; display: grid; place-items: center; box-shadow: var(--shadow);
}
.pd-main img { width: 100%; height: 100%; object-fit: cover; }
.pd-main svg { width: 84px; height: 84px; opacity: .9; }
.pd-main.no-img img { display: none; }
.pd-main.no-img::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 84px; height: 84px;
    background: rgba(255, 255, 255, .9);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2s7 8 7 13a7 7 0 1 1-14 0c0-5 7-13 7-13z'/></svg>") center/contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2s7 8 7 13a7 7 0 1 1-14 0c0-5 7-13 7-13z'/></svg>") center/contain no-repeat;
}
.pd-main .badge { top: 18px; right: 18px; font-size: .8rem; padding: 8px 15px; }

.pd-thumbs { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pd-thumb {
    width: 78px; height: 78px; padding: 0; border-radius: 14px; overflow: hidden; cursor: pointer;
    border: 2px solid var(--line); background: var(--bg-soft); transition: border-color .2s, transform .2s var(--ease);
}
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumb:hover { transform: translateY(-3px); border-color: var(--brand-light); }
.pd-thumb.is-active { border-color: var(--brand); }
.pd-thumb[hidden] { display: none; }

/* Info column */
.pd-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pd-cat {
    font-family: 'Sora', sans-serif; font-size: .74rem; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: var(--brand); background: var(--brand-light);
    padding: 6px 13px; border-radius: 100px; transition: background .2s;
}
.pd-cat:hover { background: #dbe4f7; }

.pd-info h1 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 800; margin-bottom: 14px; }
.pd-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; color: var(--muted); font-size: .88rem; }
.pd-stock { font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.pd-stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pd-stock.ok { color: #2FA36B; }
.pd-stock.no { color: var(--accent); }

.pd-price {
    display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
    font-family: 'Sora', sans-serif; margin: 26px 0 6px;
    padding-top: 24px; border-top: 1px solid var(--line);
}
.pd-price .now { font-size: 2.2rem; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.pd-price .was { font-size: 1.05rem; color: var(--muted); text-decoration: line-through; }
.pd-price .tag {
    font-size: .76rem; font-weight: 700; color: #fff; background: var(--accent);
    padding: 5px 12px; border-radius: 100px; letter-spacing: .04em;
}
.pd-merchant { font-size: .88rem; color: var(--accent); font-weight: 600; }
.pd-merchant--hint { color: var(--ink-soft); font-weight: 400; }
.pd-merchant--hint a { color: var(--brand); font-weight: 600; }
.pd-merchant--hint a:hover { text-decoration: underline; }

/* Variants */
.pd-variants { margin-top: 28px; }
.pd-variants h4 {
    font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 12px;
}
.pd-variant-list { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-variant {
    display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
    font: inherit; font-family: 'Sora', sans-serif; font-size: .9rem; font-weight: 600; color: var(--ink-soft);
    background: #fff; border: 2px solid var(--line); border-radius: 100px; padding: 10px 18px;
    transition: border-color .2s, color .2s, transform .2s var(--ease);
}
.pd-variant:hover { border-color: var(--brand-light); transform: translateY(-2px); }
.pd-variant.is-active { border-color: var(--brand); color: var(--brand); }
.pd-variant .dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.pd-variant-note { font-size: .85rem; color: var(--muted); margin-top: 10px; min-height: 1.2em; }

.pd-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.pd-assurances { list-style: none; margin-top: 30px; display: grid; gap: 10px; }
.pd-assurances li {
    position: relative; padding-left: 28px; color: var(--ink-soft); font-size: .93rem;
}
.pd-assurances li::before {
    content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--brand-light);
}
.pd-assurances li::after {
    content: ""; position: absolute; left: 5px; top: 10px; width: 4px; height: 8px;
    border: solid var(--brand); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Description & specs */
.pd-details { display: grid; grid-template-columns: 1.6fr 1fr; gap: 46px; margin-top: 72px; padding-top: 52px; border-top: 1px solid var(--line); }
.pd-desc h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 18px; }
.pd-desc { color: var(--ink-soft); line-height: 1.75; }
.pd-desc a { color: var(--brand); font-weight: 600; }

.pd-specs { background: var(--bg-soft); border-radius: var(--radius); padding: 30px; }
.pd-specs h3 { font-size: 1.15rem; margin-bottom: 18px; }
.pd-specs dl { display: grid; grid-template-columns: auto 1fr; gap: 12px 20px; font-size: .92rem; }
.pd-specs dt { color: var(--muted); }
.pd-specs dd { color: var(--ink); font-weight: 500; text-align: right; }

/* ---------- Mobile filter toggle (hidden on desktop) ---------- */
.shop-filter-toggle { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .shop-layout { grid-template-columns: 1fr; gap: 22px; }
    .shop-side { position: static; }

    /* Filters collapse behind a button. Without JS the panel stays open. */
    .shop-filter-toggle {
        display: flex; align-items: center; gap: 10px; width: 100%;
        font: inherit; font-family: 'Sora', sans-serif; font-weight: 600; font-size: .95rem;
        color: var(--ink); background: #fff; cursor: pointer;
        border: 1px solid var(--line); border-radius: 100px; padding: 13px 20px;
        transition: border-color .2s, box-shadow .2s;
    }
    .shop-filter-toggle:hover, .shop-filter-toggle[aria-expanded="true"] { border-color: var(--brand); }
    .shop-filter-toggle .lbl { margin-right: auto; }
    .shop-filter-toggle .n {
        min-width: 22px; height: 22px; padding: 0 7px; border-radius: 100px;
        background: var(--brand); color: #fff; font-size: .76rem;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .shop-filter-toggle .caret { transition: transform .25s var(--ease); color: var(--muted); }
    .shop-filter-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

    .shop-layout.has-js .shop-side { display: none; }
    .shop-layout.has-js .shop-side.is-open { display: block; }
    .shop-side {
        background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        padding: 22px 20px 6px;
    }
    .shop-search { margin-bottom: 22px; }
    .side-block { margin-bottom: 22px; }
    .side-clear { display: inline-block; margin-bottom: 20px; }

    /* Keep the list vertical inside the panel so sub-categories stay usable. */
    .cat-list a:hover { padding-left: 2px; }

    .pd-layout { grid-template-columns: 1fr; gap: 36px; }
    .pd-details { grid-template-columns: 1fr; gap: 32px; margin-top: 52px; padding-top: 40px; }
}

/* Tablet: two columns inside the open panel so it isn't a long scroll. */
@media (min-width: 700px) and (max-width: 1024px) {
    .shop-layout.has-js .shop-side.is-open,
    .shop-layout:not(.has-js) .shop-side {
        display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; align-items: start;
    }
    .shop-search, .side-clear { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

/* Phones keep two columns — denser than one tall card per screen. */
@media (max-width: 620px) {
    .product-grid { gap: 14px; }
    .product-grid .product-body { padding: 14px 15px 16px; }
    .product-grid .product-body h3 { font-size: .97rem; }
    .product-grid .product-body p { display: none; }
    .product-grid .product-top img { padding: 14px; }
    .product-grid .product-top .chip { font-size: .64rem; padding: 5px 9px; top: 10px; left: 10px; }
    .p-badges { top: 10px; right: 10px; }
    .badge { font-size: .66rem; padding: 5px 9px; }
    .p-foot { padding-top: 12px; }
    .p-price .now { font-size: 1.1rem; }
    .product-grid .product-body .more { width: 34px; height: 34px; }
    .shop-toolbar {
        flex-direction: column; align-items: stretch; gap: 14px;
        padding-bottom: 16px; margin-bottom: 20px;
    }
    .shop-sort { width: 100%; }
    .shop-sort select { flex: 1; min-width: 0; }
    /* Comfortable tap targets in the filter panel */
    .cat-list a { padding: 13px 2px; }
    .cat-sub a { padding: 10px 2px; }
    .side-toggle { padding: 6px 0; }
    .pd-price .now { font-size: 1.8rem; }
    .pd-actions .btn { width: 100%; justify-content: center; }
    .pd-specs dl { grid-template-columns: 1fr; gap: 4px 0; }
    .pd-specs dd { text-align: left; margin-bottom: 10px; }
}
