/* Product page: gallery, lightbox, specs, swatches, buy row, accordions. */
@layer pages {
    .pdp {
        display: grid;
        grid-template-columns: 1.25fr 1fr;
        gap: clamp(32px, 5vw, 80px);
        padding-top: 28px;
        padding-bottom: 120px;
        /* Lets the thumbnail row scroll instead of widening the page on phones. */
        > * {
            min-width: 0;
        }
        & h1 {
            margin: 10px 0 14px;
        }
        .char {
            font-size: 1.25rem;
            line-height: 1.45;
            color: var(--soft);
            max-width: 34ch;
        }
        .grid.pairs {
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
    }
    .pdp-vis {
        position: sticky;
        top: calc(92px + var(--kz-adminbar));
        align-self: start;
    }
    @media (max-width: 900px) {
        .pdp {
            grid-template-columns: 1fr;
        }
        .pdp-vis {
            position: static;
        }
    }
    /* Gallery */
    .viewer {
        position: relative;
        aspect-ratio: 1/1;
        border-radius: 3px;
        overflow: hidden;
        background: radial-gradient(110% 85% at 26% 16%, #fafbfb 0, var(--concrete) 52%, #cfd7d7 100%);
        cursor: zoom-in;
        touch-action: auto;
        &.single {
            cursor: default;
        }
        & img {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
        }
        .vimg {
            position: absolute;
            inset: 6%;
            width: 88%;
            height: 88%;
            object-fit: contain;
            transition: opacity var(--t1) var(--ease);
        }
        .vimg.cover {
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            mix-blend-mode: normal !important;
        }
        .vimg.out {
            opacity: 0;
        }
    }
    .g-nav {
        position: absolute;
        top: 50%;
        z-index: 2;
        width: 44px;
        height: 44px;
        margin-top: -22px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.88);
        border: 1px solid var(--line);
        display: grid;
        place-items: center;
        opacity: 0;
        transition:
            opacity var(--t1) var(--ease),
            background var(--t1) var(--ease);
        & svg {
            width: 14px;
            height: 14px;
            stroke: var(--graphite);
            stroke-width: 1.8;
            fill: none;
        }
        &.prev {
            left: 14px;
        }
        &.next {
            right: 14px;
        }
        &:hover {
            background: #fff;
        }
    }
    .viewer:hover .g-nav,
    .g-nav:focus-visible {
        opacity: 1;
    }
    @media (hover: none) {
        .g-nav {
            opacity: 1;
        }
    }
    .g-cnt {
        position: absolute;
        left: 14px;
        bottom: 14px;
        z-index: 2;
        font-size: 0.78125rem;
        font-weight: 600;
        background: rgba(33, 33, 33, 0.78);
        color: #fff;
        padding: 4px 10px;
        border-radius: 12px;
        pointer-events: none;
    }
    .g-zoom {
        position: absolute;
        right: 14px;
        bottom: 14px;
        z-index: 2;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.88);
        border: 1px solid var(--line);
        display: grid;
        place-items: center;
        & svg {
            width: 15px;
            height: 15px;
            stroke: var(--graphite);
            stroke-width: 1.6;
            fill: none;
        }
    }
    .gthumbs {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 8px;
        margin-top: 10px;
    }
    .gt {
        position: relative;
        aspect-ratio: 1/1;
        border-radius: 3px;
        overflow: hidden;
        background: radial-gradient(110% 85% at 26% 16%, #fafbfb 0, var(--concrete) 52%, #cfd7d7 100%);
        border: 1.5px solid transparent;
        transition:
            border-color var(--t1) var(--ease),
            opacity var(--t1) var(--ease);
        opacity: 0.72;
        & img {
            position: absolute;
            inset: 8%;
            width: 84%;
            height: 84%;
            object-fit: contain;
        }
        &.cover img {
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        &:hover {
            opacity: 1;
        }
        &.on {
            border-color: var(--graphite);
            opacity: 1;
        }
    }
    @media (max-width: 700px) {
        .gthumbs {
            display: flex;
            overflow-x: auto;
            scrollbar-width: none;
            &::-webkit-scrollbar {
                display: none;
            }
        }
        .gt {
            flex: none;
            width: 64px;
        }
    }
    /* Lightbox */
    .lbx {
        position: fixed;
        inset: 0;
        z-index: 120;
        background: radial-gradient(120% 90% at 30% 20%, #fafbfb 0, var(--concrete) 60%, #d3dada 100%);
        color: var(--graphite);
        display: grid;
        grid-template-rows: auto 1fr auto;
        opacity: 0;
        transition: opacity var(--t2) var(--ease);
        &.on {
            opacity: 1;
        }
    }
    .lbx-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 18px var(--pad);
        font-size: 0.875rem;
        & b {
            font-weight: 600;
        }
        & span {
            color: var(--soft);
            margin-left: 10px;
        }
    }
    .lbx-x {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 1.5px solid var(--graphite);
        display: grid;
        place-items: center;
        & svg {
            width: 13px;
            height: 13px;
            stroke: var(--graphite);
            stroke-width: 1.6;
            fill: none;
        }
    }
    .lbx-stage {
        position: relative;
        min-height: 0;
        touch-action: pan-y;
        & img {
            position: absolute;
            inset: 0 clamp(16px, 7vw, 110px);
            width: calc(100% - 2 * clamp(16px, 7vw, 110px));
            height: 100%;
            object-fit: contain;
            transition: opacity var(--t1) var(--ease);
        }
        & img.out {
            opacity: 0;
        }
        & img.cover {
            mix-blend-mode: normal !important;
            border-radius: 3px;
        }
    }
    .lbx {
        .g-nav {
            opacity: 1;
            background: #fff;
        }
        .g-nav.prev {
            left: var(--pad);
        }
        .g-nav.next {
            right: var(--pad);
        }
    }
    .lbx-th {
        display: flex;
        justify-content: center;
        gap: 8px;
        padding: 16px var(--pad) 22px;
        overflow-x: auto;
        .gt {
            width: 58px;
            flex: none;
            opacity: 0.5;
        }
        .gt.on {
            border-color: var(--graphite);
            opacity: 1;
        }
    }
    /* Details: spec table, colours, buy row, contents, accordions */
    .spectable {
        margin: 36px 0;
        border-top: 1px solid var(--ink);
        & div {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px solid var(--line);
            font-size: 0.9375rem;
        }
        & span {
            color: var(--soft);
        }
        & b {
            font-weight: 600;
        }
    }
    .fl {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 12px;
        display: flex;
        justify-content: space-between;
        & span {
            color: var(--soft);
            font-weight: 450;
        }
        .kz-fl-t {
            color: inherit;
            font-weight: inherit;
        }
    }
    .swatches {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        margin-bottom: 32px;
    }
    .sw {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        position: relative;
        box-shadow:
            inset 0 -6px 10px rgba(0, 0, 0, 0.18),
            inset 0 3px 5px rgba(255, 255, 255, 0.3),
            0 0 0 1px rgba(0, 0, 0, 0.1);
        &.on::after {
            content: '';
            position: absolute;
            inset: -5px;
            border-radius: 50%;
            border: 1.5px solid var(--ink);
        }
    }
    .buy {
        display: flex;
        gap: 10px;
        margin-bottom: 16px;
        .btn {
            flex: 1;
            min-width: 0;
            padding-left: 16px;
            padding-right: 16px;
        }
    }
    .qty {
        display: flex;
        align-items: center;
        border: 1px solid var(--ink);
        border-radius: 2px;
        height: 54px;
        & button {
            width: 44px;
            height: 100%;
            font-size: 1.125rem;
        }
        & button:hover {
            color: var(--orange);
        }
        & input {
            width: 40px;
            text-align: center;
            border: 0;
            font-weight: 600;
            background: transparent;
            outline: 0;
            -moz-appearance: textfield;
        }
        & input::-webkit-outer-spin-button,
        & input::-webkit-inner-spin-button {
            -webkit-appearance: none;
        }
    }
    .block {
        margin-top: 56px;
    }
    .contents {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
        & div {
            aspect-ratio: 1;
            background: var(--concrete);
            border-radius: 2px;
            position: relative;
        }
        & div img {
            width: 100%;
            height: 100%;
        }
        & div small {
            position: absolute;
            left: 6px;
            top: 4px;
            font-size: 0.6875rem;
            color: var(--soft);
        }
    }
    @media (max-width: 520px) {
        .contents {
            grid-template-columns: repeat(4, 1fr);
        }
    }
    details.acc {
        border-top: 1px solid var(--line);
        &:last-of-type {
            border-bottom: 1px solid var(--line);
        }
        & summary {
            list-style: none;
            cursor: pointer;
            padding: 18px 0;
            font-weight: 600;
            font-size: 1rem;
            display: flex;
            justify-content: space-between;
        }
        & summary::-webkit-details-marker {
            display: none;
        }
        /* A plus drawn from two bars; the upright bar folds away when open. */
        & summary::after {
            content: '';
            flex: none;
            width: 12px;
            height: 12px;
            align-self: center;
            margin-right: 2px;
            background:
                linear-gradient(currentColor, currentColor) center / 12px 1.5px no-repeat,
                linear-gradient(currentColor, currentColor) center / 1.5px 12px no-repeat;
            transition: background-size var(--t1) var(--ease);
        }
        .ab {
            padding: 0 0 22px;
            color: var(--soft);
            max-width: 56ch;
        }
        .ab a {
            border-bottom: 1px solid currentColor;
            color: var(--ink);
        }
        .ab p + p {
            margin-top: 12px;
        }
    }
    details.acc[open]:not(.shutting) summary::after {
        background-size:
            12px 1.5px,
            1.5px 0;
    }
    /* B2C: where to buy */
    .wtb {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 18px 0 4px;
        padding: 14px 16px;
        border: 1px solid var(--line);
        border-radius: 3px;
        background: #fff;
        > svg {
            flex: none;
            width: 22px;
            height: 22px;
            stroke: var(--graphite);
            fill: none;
            stroke-width: 1.5;
        }
        & div {
            flex: 1;
            min-width: 0;
            font-size: 0.875rem;
            line-height: 1.4;
        }
        & div b {
            display: block;
            font-weight: 600;
            font-size: 0.90625rem;
        }
        & div span {
            color: var(--soft);
        }
        .btn {
            flex: none;
            white-space: nowrap;
        }
    }
    @media (max-width: 520px) {
        .wtb {
            flex-wrap: wrap;
            .btn {
                width: 100%;
            }
        }
    }
}
