/* =========================================================
   Bar Salotto – What's Happening  |  Front-End Styles
   ========================================================= */

/* ── Grid ────────────────────────────────────────────────── */
.bswh-grid {
    display: grid;
    grid-template-columns: repeat(var(--bswh-cols-desktop, 3), 1fr);
    gap: var(--bswh-gap, 24px);
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

/* ── Carousel ────────────────────────────────────────────── */
.bswh-carousel {
    width: 100%;
    padding: 0 56px;
    box-sizing: border-box;
}

/*
 * Pre-Flickity fallback: flex keeps tiles in a row while Flickity loads.
 * Flickity adds .flickity-enabled and takes over layout from that point.
 */
.bswh-carousel:not(.flickity-enabled) {
    display: flex;
    overflow: hidden;
    gap: var(--bswh-gap, 24px);
}

.bswh-carousel .bswh-tile {
    width: calc((100% - var(--bswh-gap, 24px) * (var(--bswh-cols-desktop, 3) - 1)) / var(--bswh-cols-desktop, 3));
    flex-shrink: 0; /* holds width in pre-Flickity flex state */
    margin-right: var(--bswh-gap, 24px); /* Flickity uses this for cell spacing */
}

/* Flickity dot theming */
.bswh-carousel .flickity-page-dots .dot {
    background: var(--bswh-dot-color, #c3922e);
    opacity: 0.35;
}
.bswh-carousel .flickity-page-dots .dot.is-selected {
    opacity: 1;
}

/* Arrows */
.bswh-carousel .flickity-prev-next-button {
    background: #fff;
    border: 2px solid var(--bswh-arrow-color, #c3922e);
    width: var(--bswh-arrow-size, 40px);
    height: var(--bswh-arrow-size, 40px);
}
.bswh-carousel .flickity-prev-next-button.previous { left: 4px; }
.bswh-carousel .flickity-prev-next-button.next     { right: 4px; }

.bswh-carousel .flickity-prev-next-button .arrow {
    fill: var(--bswh-arrow-color, #c3922e);
}
.bswh-carousel .flickity-prev-next-button:hover {
    background: var(--bswh-arrow-color, #c3922e);
}
.bswh-carousel .flickity-prev-next-button:hover .arrow { fill: #fff; }

/* Solid-background arrow variant */
.bswh-carousel.bswh-arrow-solid .flickity-prev-next-button {
    background: var(--bswh-arrow-color, #c3922e);
    border-color: var(--bswh-arrow-color, #c3922e);
}
.bswh-carousel.bswh-arrow-solid .flickity-prev-next-button .arrow { fill: #fff; }
.bswh-carousel.bswh-arrow-solid .flickity-prev-next-button:hover  { opacity: 0.85; }

/* Bottom padding for dots */
.bswh-carousel.flickity-enabled { padding-bottom: 44px; }

/* ── Individual tile ─────────────────────────────────────── */
.bswh-tile {
    background:      var(--bswh-tile-bg, #ffffff);
    border:          var(--bswh-border-width, 1px) solid var(--bswh-border, #c3922e);
    border-top:      var(--bswh-top-border, 3px) solid var(--bswh-accent, #c3922e);
    border-radius:   var(--bswh-radius, 4px);
    overflow:        hidden;
    display:         flex;
    flex-direction:  column;
    text-decoration: none;
    color:           inherit;
    font-family:     var(--bswh-font, inherit);
    box-sizing:      border-box;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

a.bswh-tile:hover {
    box-shadow: var(--bswh-shadow, none);
    transform:  translateY(-3px);
    cursor:     pointer;
}

/* ── Image ───────────────────────────────────────────────── */
.bswh-tile-image {
    position:     relative;
    width:        100%;
    aspect-ratio: var(--bswh-img-ratio, 1/1);
    overflow:     hidden;
    background:   #f0ece4;
    flex-shrink:  0;
}

/* Freeform ratio: image drives the height */
.bswh-ratio-free .bswh-tile-image {
    aspect-ratio: auto;
}
.bswh-ratio-free .bswh-tile-image img {
    height: auto;
    object-fit: contain;
}

.bswh-tile-image img {
    width:           100%;
    height:          100%;
    object-fit:      cover;
    object-position: center;
    display:         block;
    transition:      transform 0.35s ease;
}

a.bswh-tile:hover .bswh-tile-image img {
    transform: scale(1.04);
}

/* ── Badge ───────────────────────────────────────────────── */
.bswh-tile-badge {
    position:      absolute;
    top:           10px;
    left:          10px;
    display:       inline-block;
    background:    var(--bswh-badge-bg, #c3922e);
    color:         var(--bswh-badge-color, #ffffff);
    font-size:     11px;
    font-weight:   700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding:       3px 10px;
    border-radius: 999px;
    line-height:   1.4;
    pointer-events: none;
}

/* ── Body ────────────────────────────────────────────────── */
.bswh-tile-body {
    padding:        var(--bswh-body-pv, 20px) var(--bswh-body-ph, 22px);
    display:        flex;
    flex-direction: column;
    flex:           1;
}

/* ── Tile title ──────────────────────────────────────────── */
.bswh-tile-title {
    margin:         0 0 var(--bswh-title-gap, 6px);
    color:          var(--bswh-title-color, var(--bswh-text, #111112));
    font-family:    var(--bswh-title-font, inherit);
    font-size:      var(--bswh-title-size, 16px);
    font-weight:    var(--bswh-title-weight, 700);
    font-style:     var(--bswh-title-style, normal);
    text-align:     var(--bswh-title-align, left);
    line-height:    var(--bswh-title-lh, 1.3);
    letter-spacing: var(--bswh-title-ls, 0em);
}

/* ── Copy ────────────────────────────────────────────────── */
.bswh-tile-copy {
    margin:         0;
    color:          var(--bswh-copy-color, var(--bswh-text, #111112));
    font-family:    var(--bswh-copy-font, inherit);
    font-size:      var(--bswh-copy-size, 15px);
    font-weight:    var(--bswh-copy-weight, 400);
    font-style:     var(--bswh-copy-style, normal);
    text-align:     var(--bswh-copy-align, left);
    line-height:    var(--bswh-copy-lh, 1.6);
    letter-spacing: var(--bswh-copy-ls, 0em);
    flex:           1;
}

/* ── CTA pill button ─────────────────────────────────────── */
.bswh-tile-cta {
    display:         inline-block;
    margin-top:      var(--bswh-cta-gap, 14px);
    align-self:      flex-start;
    color:           var(--bswh-cta-color, #c3922e);
    background:      var(--bswh-cta-bg, transparent);
    border:          var(--bswh-cta-bw, 2px) solid var(--bswh-cta-border-color, #c3922e);
    border-radius:   var(--bswh-cta-radius, 999px);
    font-family:     var(--bswh-cta-font, inherit);
    font-size:       var(--bswh-cta-size, 12px);
    font-weight:     var(--bswh-cta-weight, 700);
    text-transform:  var(--bswh-cta-transform, uppercase);
    padding:         var(--bswh-cta-pv, 8px) var(--bswh-cta-ph, 22px);
    letter-spacing:  0.07em;
    text-decoration: none;
    cursor:          pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

a.bswh-tile:hover .bswh-tile-cta {
    background: var(--bswh-cta-border-color, #c3922e);
    color:      #ffffff;
}

/* ── Priority ────────────────────────────────────────────── */
.bswh-tile.bswh-priority {
    border-top-width: calc(var(--bswh-top-border, 3px) + 1px);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .bswh-grid {
        grid-template-columns: repeat(var(--bswh-cols-tablet, 2), 1fr);
    }
    .bswh-carousel .bswh-tile {
        width: calc((100% - var(--bswh-gap, 24px) * (var(--bswh-cols-tablet, 2) - 1)) / var(--bswh-cols-tablet, 2));
    }
}

@media (max-width: 540px) {
    .bswh-grid {
        grid-template-columns: repeat(var(--bswh-cols-mobile, 1), 1fr);
    }
    .bswh-carousel .bswh-tile {
        width: calc((100% - var(--bswh-gap, 24px) * (var(--bswh-cols-mobile, 1) - 1)) / var(--bswh-cols-mobile, 1));
    }
}

/* ── Countdown timer ─────────────────────────────────────── */
.bswh-countdown {
    display:        flex;
    gap:            6px;
    margin-top:     10px;
    font-size:      12px;
    color:          var(--bswh-copy-color, var(--bswh-text, #111112));
    opacity:        0.75;
    flex-wrap:      wrap;
}

.bswh-cd-block {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    min-width:      36px;
    background:     rgba(0,0,0,0.05);
    border-radius:  4px;
    padding:        4px 6px 3px;
    line-height:    1;
}

.bswh-cd-block span:first-child {
    font-size:   16px;
    font-weight: 700;
    line-height: 1.1;
}

.bswh-cd-label {
    font-size:      9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity:        0.7;
    margin-top:     2px;
}

.bswh-countdown.bswh-cd-expired .bswh-cd-block {
    opacity: 0.4;
}

/* ── Banner / notification bar ───────────────────────────── */
.bswh-banner {
    position:   relative;
    width:      100%;
    box-sizing: border-box;
    background: var(--bswh-banner-bg, #1a1a1a);
    color:      var(--bswh-banner-text, #ffffff);
    overflow:   hidden;
}

.bswh-banner-item {
    display:         none;
    align-items:     center;
    justify-content: center;
    gap:             14px;
    width:           100%;
    min-height:      48px;
    padding:         10px 56px;
    box-sizing:      border-box;
    flex-wrap:       wrap;
}

.bswh-banner-item.is-active {
    display: flex;
}

.bswh-banner-badge {
    display:        inline-block;
    background:     var(--bswh-badge-bg, #c3922e);
    color:          var(--bswh-badge-color, #ffffff);
    font-size:      10px;
    font-weight:    700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding:        2px 9px;
    border-radius:  999px;
    white-space:    nowrap;
    flex-shrink:    0;
}

.bswh-banner-text {
    font-size:   14px;
    line-height: 1.4;
    text-align:  center;
}

.bswh-banner-cta {
    display:         inline-block;
    color:           var(--bswh-banner-accent, #c3922e);
    border:          1.5px solid var(--bswh-banner-accent, #c3922e);
    border-radius:   999px;
    font-size:       11px;
    font-weight:     700;
    letter-spacing:  0.06em;
    text-transform:  uppercase;
    text-decoration: none;
    padding:         4px 14px;
    white-space:     nowrap;
    flex-shrink:     0;
    transition:      background 0.2s ease, color 0.2s ease;
}

.bswh-banner-cta:hover {
    background: var(--bswh-banner-accent, #c3922e);
    color:      #fff;
}

/* Prev / next nav buttons */
.bswh-banner-prev,
.bswh-banner-next {
    position:   absolute;
    top:        50%;
    transform:  translateY(-50%);
    background: transparent;
    border:     none;
    color:      var(--bswh-banner-text, #ffffff);
    font-size:  20px;
    line-height: 1;
    padding:    0 10px;
    cursor:     pointer;
    opacity:    0.6;
    transition: opacity 0.2s ease;
}
.bswh-banner-prev:hover,
.bswh-banner-next:hover { opacity: 1; }
.bswh-banner-prev { left: 4px; }
.bswh-banner-next { right: 28px; }

/* Dismiss button */
.bswh-banner-dismiss {
    position:   absolute;
    top:        50%;
    right:      6px;
    transform:  translateY(-50%);
    background: transparent;
    border:     none;
    color:      var(--bswh-banner-text, #ffffff);
    font-size:  18px;
    line-height: 1;
    padding:    0 4px;
    cursor:     pointer;
    opacity:    0.5;
    transition: opacity 0.2s ease;
}
.bswh-banner-dismiss:hover { opacity: 1; }

/* Dot indicators */
.bswh-banner-dots {
    display:         flex;
    justify-content: center;
    gap:             5px;
    padding:         6px 0 4px;
    background:      var(--bswh-banner-bg, #1a1a1a);
}
.bswh-banner-dots button {
    width:        7px;
    height:       7px;
    border-radius: 50%;
    border:       none;
    background:   var(--bswh-banner-text, #ffffff);
    opacity:      0.35;
    padding:      0;
    cursor:       pointer;
    transition:   opacity 0.2s ease;
}
.bswh-banner-dots button.is-active { opacity: 1; }
