/* ══════════════════════════════════════════════════════
   South Pizza Hot Deals v5
   ══════════════════════════════════════════════════════ */

.sphdv5-section {
    width: 100%;
    padding: 32px 0 48px;
    background: var(--sphdv5-section-bg, #fff);
    box-sizing: border-box;
}

.sphdv5-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ── Top Banner ── */
.sphdv5-banner {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.sphdv5-banner__link {
    display: block;
    line-height: 0;
}

.sphdv5-banner__img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform .4s ease;
}

/* Only scale banner on hover when lightbox is off */
.sphdv5-banner:not(:has(.sphdv5-banner__lightbox-trigger)):hover .sphdv5-banner__img {
    transform: scale(1.015);
}

/* ── Cards Grid ── */
.sphdv5-cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, 1fr);
}
.sphdv5-cards[data-count="5"] { grid-template-columns: repeat(5, 1fr); }
.sphdv5-cards[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.sphdv5-cards[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.sphdv5-cards[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.sphdv5-cards[data-count="1"] { grid-template-columns: 1fr; }

/* ── Deal Card ── */
.sphdv5-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 14px rgba(0,0,0,.18);
    transition: transform .2s ease, box-shadow .2s ease;
    background: var(--sphdv5-card-bg, #1a0a00);
}

.sphdv5-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.sphdv5-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* ── Image wrap — button lives INSIDE here ── */
.sphdv5-card__img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;   /* default; overridden per-card via inline style */
    overflow: hidden;
    background: #222;
    display: block;
}

/* Inline style from admin overrides default aspect ratio */
.sphdv5-card__img-wrap[style] {
    aspect-ratio: unset;
}

.sphdv5-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

/* Only scale on hover for non-lightbox cards */
.sphdv5-card:not(.sphdv5-card--lightbox):hover .sphdv5-card__img {
    transform: scale(1.05);
}

.sphdv5-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    color: #555;
}

/* Gradient overlay — darker at bottom so button is readable */
.sphdv5-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 45%,
        rgba(0,0,0,.65) 100%
    );
    pointer-events: none;
}

/* ── Badge — top-left ── */
.sphdv5-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--sphdv5-badge-bg, #e74c3c);
    color: var(--sphdv5-badge-text, #fff);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 4px;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ── CTA Button — pinned bottom-right inside image ── */
.sphdv5-card__cta {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* colours set via inline style (per-card or global) */
    background: var(--sphdv5-btn-bg, #e74c3c);
    color: var(--sphdv5-btn-text, #fff);
    font-size: .78rem;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 20px;       /* pill shape like reference image */
    letter-spacing: .2px;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
    transition: filter .18s ease, transform .18s ease;
    pointer-events: none;      /* parent <a> handles the click */
}

.sphdv5-card:hover .sphdv5-card__cta {
    filter: brightness(1.15);
    transform: scale(1.05);
}

/* ── No-overlay mode ── */
.sphdv5-card--no-overlay .sphdv5-card__overlay { display: none; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 960px) {
    .sphdv5-cards[data-count="5"] { grid-template-columns: repeat(3, 1fr); }
    .sphdv5-cards[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .sphdv5-section { padding: 20px 0 32px; }
    .sphdv5-inner   { padding: 0 12px; }

    .sphdv5-cards,
    .sphdv5-cards[data-count] {
        grid-template-columns: repeat(2, 1fr);
    }

    .sphdv5-card__cta { font-size: .72rem; padding: 6px 11px; }
}

@media (max-width: 400px) {
    .sphdv5-cards,
    .sphdv5-cards[data-count] { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════ */

/* Prevent body scroll when lightbox is open */
body.sphdv5-no-scroll { overflow: hidden; }

/* Zoom hint icon — appears on hover over a lightbox card */
.sphdv5-card__zoom-hint {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 4;
    font-size: 1.1rem;
    background: rgba(0,0,0,.55);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.sphdv5-card--lightbox:hover .sphdv5-card__zoom-hint {
    opacity: 1;
    transform: scale(1);
}

/* Cursor cue */
.sphdv5-card__lightbox-trigger {
    display: block;
    cursor: zoom-in;
}

/* ── Lightbox overlay ── */
.sphdv5-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;               /* toggled by JS */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}

.sphdv5-lightbox--open {
    opacity: 1;
}

/* Dark backdrop */
.sphdv5-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    cursor: zoom-out;
}

/* Stage: image + button */
.sphdv5-lightbox__stage {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 1000px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transform: scale(.92);
    transition: transform .25s ease;
}

.sphdv5-lightbox--open .sphdv5-lightbox__stage {
    transform: scale(1);
}

/* Image */
.sphdv5-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(0,0,0,.7);
}

/* Close button */
.sphdv5-lightbox__close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #111;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
    transition: background .15s, transform .15s;
    z-index: 2;
}

.sphdv5-lightbox__close:hover {
    background: #e74c3c;
    color: #fff;
    transform: scale(1.1);
}

/* Order Now CTA inside lightbox */
.sphdv5-lightbox__cta {
    display: inline-flex;
    align-items: center;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none !important;
    letter-spacing: .3px;
    box-shadow: 0 4px 18px rgba(0,0,0,.35);
    transition: filter .18s ease, transform .15s ease;
    white-space: nowrap;
}

.sphdv5-lightbox__cta:hover {
    filter: brightness(1.15);
    transform: scale(1.04);
}

@media (max-width: 600px) {
    .sphdv5-lightbox__stage { max-width: 96vw; }
    .sphdv5-lightbox__close { top: -10px; right: -6px; }
    .sphdv5-lightbox__cta   { font-size: .9rem; padding: 10px 24px; }
}

/* ── Banner lightbox trigger ── */
.sphdv5-banner__lightbox-trigger {
    display: block;
    cursor: zoom-in;
    position: relative;
    line-height: 0;
}

.sphdv5-banner__zoom-hint {
    position: absolute;
    bottom: 14px;
    right: 14px;
    font-size: 1.2rem;
    background: rgba(0,0,0,.55);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    z-index: 2;
}

.sphdv5-banner__lightbox-trigger:hover .sphdv5-banner__zoom-hint {
    opacity: 1;
    transform: scale(1);
}

/* ── On touch devices: never show hover zoom hints (no hover state) ── */
body.sphdv5-touch .sphdv5-card__zoom-hint,
body.sphdv5-touch .sphdv5-banner__zoom-hint {
    display: none !important;
}

/* Also suppress any remaining image scale on touch hover */
body.sphdv5-touch .sphdv5-card:hover .sphdv5-card__img {
    transform: none !important;
}
body.sphdv5-touch .sphdv5-banner:hover .sphdv5-banner__img {
    transform: none !important;
}
