/*!
 * B2 Project Cards — Elementor widget "Project Cards"
 * Figma: B2 STRUCTURAL → node 5440:4443
 *
 * A three-across grid of project cards: tall portrait image, a muted client /
 * location line, title, description and a wrapping row of outlined orange tag
 * pills. The frame draws each card at a fixed 405px, but the grid here is
 * fractional so the cards fill whatever container width Elementor gives them
 * and the image simply keeps its ratio.
 *
 * A card's image area is a carousel whenever the project has more than one
 * image: the slides sit side by side in a flex track that js/b2-project-cards.js
 * translates a card-width at a time. Each slide is an Elementor lightbox anchor,
 * so a click opens that project's gallery. The project link can therefore no
 * longer wrap the whole card — it sits on the title and is stretched over the
 * text block with a pseudo-element.
 */

.b2pc {
    /* Grid */
    --b2pc-cols:        3;
    --b2pc-column-gap:  var(--cp-l, 32px);
    --b2pc-row-gap:     var(--cp-2xl, 64px);

    /* Card */
    --b2pc-ratio:       405 / 517;
    --b2pc-media-gap:   var(--cp-m, 20px);
    --b2pc-meta-gap:    var(--cp-m, 20px);
    --b2pc-title-gap:   var(--cp-s, 16px);
    --b2pc-tags-gap:    var(--cp-m, 20px);
    --b2pc-tag-gap:     var(--cp-2xs, 8px);
    --b2pc-zoom:        1.04;

    /* Carousel */
    --b2pc-nav-size:    40px;
    --b2pc-nav-inset:   12px;
    --b2pc-nav-color:   #fff;
    --b2pc-nav-bg:      rgba(0, 35, 67, 0.65);
    --b2pc-dot-color:   rgba(255, 255, 255, 0.55);
    --b2pc-dot-active:  var(--orange-o300, #ee4c01);
    --b2pc-dot-w:       18px;
    --b2pc-dot-h:       3px;
    --b2pc-dot-gap:     6px;
    --b2pc-dot-inset:   12px;
    --b2pc-slide-speed: 520ms;

    /* Tag pill */
    --b2pc-tag-border:  var(--orange-o300, #ee4c01);
    --b2pc-tag-pad-y:   2px;
    --b2pc-tag-pad-x:   6px;

    /* Colour */
    --b2pc-meta-color:  var(--navy-n75, #96a5b2);
    --b2pc-title-color: var(--navy-n300, #002343);
    --b2pc-desc-color:  var(--navy-n300, #002343);
    --b2pc-tag-color:   var(--orange-o300, #ee4c01);

    --b2pc-speed:       420ms;
    --b2pc-ease:        cubic-bezier(0.4, 0, 0.2, 1);

    display:               grid;
    grid-template-columns: repeat(var(--b2pc-cols), minmax(0, 1fr));
    column-gap:            var(--b2pc-column-gap);
    row-gap:               var(--b2pc-row-gap);
    width:                 100%;
}

.b2pc__card {
    display:        flex;
    flex-direction: column;
    gap:            var(--b2pc-media-gap);
    min-width:      0;
}

.b2pc .b2pc__card {
    color: inherit;
}


/* Media
--------------------------------------------- */
.b2pc__media {
    position:     relative;
    width:        100%;
    aspect-ratio: var(--b2pc-ratio);
    overflow:     hidden;
    background:   var(--concrete-c300, #ececec);
}

/* The track is as wide as the card and each slide fills it, so a move is one
   translate of -100% per slide — nothing here depends on measured widths. */
.b2pc__slides {
    display:    flex;
    width:      100%;
    height:     100%;
    transform:  translate3d(0, 0, 0);
    transition: transform var(--b2pc-slide-speed) var(--b2pc-ease);
    touch-action: pan-y;
}

.b2pc__media.is-dragging .b2pc__slides {
    transition: none;
}

.b2pc__slide {
    position:  relative;
    flex:      0 0 100%;
    width:     100%;
    height:    100%;
    display:   block;
    overflow:  hidden;
}

a.b2pc__slide {
    cursor: zoom-in;
}

.b2pc__slide img {
    display:      block;
    width:        100%;
    height:       100%;
    object-fit:   cover;
    transform:    scale(1);
    transition:   transform var(--b2pc-speed) var(--b2pc-ease);
    user-select:  none;
    -webkit-user-drag: none;
}

.b2pc__media:hover .b2pc__slide img,
.b2pc__card--linked:hover .b2pc__slide img,
.b2pc__card:focus-within .b2pc__slide img {
    transform: scale(var(--b2pc-zoom));
}

.b2pc a.b2pc__slide:focus-visible {
    outline:        2px solid var(--b2pc-tag-border);
    outline-offset: -4px;
}


/* Carousel controls — quiet until the card is hovered, always on for touch.
--------------------------------------------- */
.b2pc .b2pc__nav {
    position:        absolute;
    top:             50%;
    z-index:         2;
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           var(--b2pc-nav-size);
    height:          var(--b2pc-nav-size);
    min-height:      0;
    padding:         0;
    border:          0;
    border-radius:   0;
    background:      var(--b2pc-nav-bg);
    color:           var(--b2pc-nav-color);
    cursor:          pointer;
    opacity:         0;
    transform:       translateY(-50%);
    transition:      opacity var(--b2pc-speed) var(--b2pc-ease);
}

.b2pc__nav--prev { left:  var(--b2pc-nav-inset); }
.b2pc__nav--next { right: var(--b2pc-nav-inset); }

.b2pc__nav svg {
    width:  40%;
    height: 40%;
}

.b2pc__media:hover .b2pc__nav,
.b2pc__media:focus-within .b2pc__nav {
    opacity: 1;
}

.b2pc .b2pc__nav:focus-visible {
    opacity:        1;
    outline:        2px solid var(--b2pc-nav-color);
    outline-offset: -4px;
}

.b2pc__dots {
    position:        absolute;
    left:            0;
    right:           0;
    bottom:          var(--b2pc-dot-inset);
    z-index:         2;
    display:         flex;
    justify-content: center;
    gap:             var(--b2pc-dot-gap);
    pointer-events:  none;
}

.b2pc .b2pc__dot {
    display:       block;
    flex:          0 0 auto;
    width:         var(--b2pc-dot-w);
    height:        var(--b2pc-dot-h);
    min-height:    0;
    padding:       0;
    border:        0;
    border-radius: 0;
    background:    var(--b2pc-dot-color);
    cursor:        pointer;
    pointer-events: auto;
    transition:    background-color var(--b2pc-speed) var(--b2pc-ease);
}

.b2pc .b2pc__dot.is-active {
    background: var(--b2pc-dot-active);
    cursor:     default;
}

.b2pc .b2pc__dot:focus-visible {
    outline:        2px solid var(--b2pc-dot-active);
    outline-offset: 3px;
}

@media (hover: none) {
    .b2pc .b2pc__nav { opacity: 1; }
}


/* Text
--------------------------------------------- */
.b2pc__text {
    position:       relative;
    display:        flex;
    flex-direction: column;
    gap:            var(--b2pc-meta-gap);
}

/* The title carries the project link; the pseudo-element stretches it over the
   whole text block, which keeps one anchor per card and no nesting. */
.b2pc__link {
    color:           inherit;
    text-decoration: none;
}

.b2pc__link::after {
    content:  "";
    position: absolute;
    inset:    0;
}

.b2pc__card--linked:hover .b2pc__title,
.b2pc__link:focus-visible {
    color: var(--b2pc-tag-color);
}

.b2pc__link:focus-visible {
    outline:        2px solid var(--b2pc-tag-border);
    outline-offset: 4px;
}

.b2pc__body {
    display:        flex;
    flex-direction: column;
    gap:            var(--b2pc-tags-gap);
}

.b2pc__copy {
    display:        flex;
    flex-direction: column;
    gap:            var(--b2pc-title-gap);
}

.b2pc__meta {
    margin:         0;
    color:          var(--b2pc-meta-color);
    font-family:    var(--bodyFont);
    font-size:      0.625rem; /* 10 */
    font-weight:    var(--fw-semibold);
    line-height:    var(--line-caption, 1.5);
    letter-spacing: var(--tracking-body, 0.02em);
    text-transform: uppercase;
}

.b2pc .b2pc__title {
    margin:         0;
    color:          var(--b2pc-title-color);
    font-family:    var(--titleFont);
    font-size:      var(--heading-h4, 1.5rem);
    font-weight:    400;
    line-height:    var(--line-h4, 1.4);
    letter-spacing: var(--tracking-heading, 0.02em);
}

.b2pc__desc {
    margin:         0;
    color:          var(--b2pc-desc-color);
    font-family:    var(--bodyFont);
    font-size:      var(--body-body-sm, 1.125rem);
    font-weight:    400;
    line-height:    var(--line-body-sm, 1.4);
    letter-spacing: var(--tracking-body, 0.02em);
}


/* Tags — outlined pills, wrapping onto as many rows as the card needs.
--------------------------------------------- */
.b2pc__tags {
    display:    flex;
    flex-wrap:  wrap;
    gap:        var(--b2pc-tag-gap);
    margin:     0;
    padding:    0;
    list-style: none;
}

.b2pc__tag {
    display:        inline-flex;
    align-items:    center;
    padding:        var(--b2pc-tag-pad-y) var(--b2pc-tag-pad-x);
    border:         1px solid var(--b2pc-tag-border);
    color:          var(--b2pc-tag-color);
    font-family:    var(--bodyFont);
    font-size:      0.625rem; /* 10 */
    font-weight:    var(--fw-semibold);
    line-height:    var(--line-caption, 1.5);
    letter-spacing: var(--tracking-body, 0.02em);
    text-transform: uppercase;
}


/* Responsive
--------------------------------------------- */
@media all and (max-width: 1200px) {
    .b2pc { --b2pc-cols: 2; }
}

@media all and (max-width: 767px) {
    .b2pc {
        --b2pc-cols:    1;
        --b2pc-row-gap: var(--cp-2xl, 48px);
    }
}


/* Motion preferences
--------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .b2pc { --b2pc-zoom: 1; --b2pc-speed: 1ms; --b2pc-slide-speed: 1ms; }
}
