/* ================================================================
   QB Services v2 — Main Stylesheet
   ================================================================ */

/* ---------- SVG defs element (hidden, placed in body) ---------- */
.qb-svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ================================================================
   CARD — base
   Primary clip uses CSS polygon (works everywhere including
   Elementor iframe/preview). The SVG clipPath is kept as
   enhancement only for browsers where url(#id) works reliably
   in the same document context.
   ================================================================ */
.qb-card {
    --qb-color: #D4B15F;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 520px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    background: var(--qb-color);

    /* ---- Islamic arch: CSS polygon as PRIMARY (reliable everywhere) ---- */
    clip-path: polygon(
        50% 0%,
        57% 0.4%, 64% 1.4%, 71% 3%, 77% 5.5%,
        83% 8.5%, 88% 12%, 92% 15.5%, 96% 19%,
        98.5% 22%, 100% 25.2%,
        100% 100%, 0% 100%, 0% 25.2%,
        1.5% 22%, 4% 19%, 8% 15.5%,
        12% 12%, 17% 8.5%, 23% 5.5%,
        29% 3%, 36% 1.4%, 43% 0.4%
    );

    transition: transform 0.42s cubic-bezier(.22,.68,0,1.15),
                box-shadow 0.42s ease;
    will-change: transform;
}

/* Hover */
.qb-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.35);
}

/* ----------------------------------------------------------------
   TWO DOTS — near top center
   ---------------------------------------------------------------- */
.qb-card__dots {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}
.qb-card__dots span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transition: background 0.3s;
}
.qb-card:hover .qb-card__dots span {
    background: rgba(255, 255, 255, 0.95);
}

/* ----------------------------------------------------------------
   BODY — text area (upper ~52%)
   ---------------------------------------------------------------- */
.qb-card__body {
    position: relative;
    z-index: 3;
    padding: 50px 26px 18px;
    text-align: center;
    flex: 0 0 auto;
}

.qb-card__cat {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.qb-card__title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin: 0 0 14px;
    transition: transform 0.35s ease;
}
.qb-card:hover .qb-card__title {
    transform: translateY(-2px);
}

.qb-card__excerpt {
    font-size: 13.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.88);
}

/* ----------------------------------------------------------------
   PHOTO WRAP — lower portion (flex: 1, fills remaining height)
   ---------------------------------------------------------------- */
.qb-card__photo-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ----------------------------------------------------------------
   PETALS — two SVG teardrops at the TOP of the photo area
   ---------------------------------------------------------------- */
.qb-card__petals {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 3;
    pointer-events: none;
}

.qb-petal {
    width: 52px;
    height: 70px;
    flex-shrink: 0;
    display: block;
    transition: transform 0.4s cubic-bezier(.22,.68,0,1.2);
    transform-origin: top center;
}
.qb-card:hover .qb-petal {
    transform: scaleY(1.1);
}

/* ----------------------------------------------------------------
   PHOTO — actual background image, fills photo-wrap
   ---------------------------------------------------------------- */
.qb-card__photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    z-index: 1;
    transition: transform 0.6s cubic-bezier(.22,.68,0,1.1);
}
.qb-card__photo--empty {
    background-color: rgba(0, 0, 0, 0.18);
}
.qb-card:hover .qb-card__photo {
    transform: scale(1.06);
}

/* ================================================================
   GRID
   ================================================================ */
.qb-grid {
    display: grid;
    gap: 24px;
    align-items: start;
}
.qb-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.qb-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.qb-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

/*
 * Grid items animation:
 * Default state: visible (opacity:1, no transform).
 * When JS is active AND animation != 'none', JS adds .qb--anim-ready
 * to the grid BEFORE observing, which hides items. This prevents
 * items from being invisible if JS fails or IntersectionObserver
 * never fires (e.g. already in viewport on load in editor).
 */
.qb-grid-item {
    opacity: 1;
    transform: none;
}

/* JS sets this class on the grid when it's ready to animate */
.qb-grid.qb--anim-ready > .qb-grid-item {
    opacity: 0;
    transform: translateY(30px);
}

.qb-grid.qb--anim-ready > .qb-grid-item.qb--visible {
    animation: qbSlideUp 0.55s cubic-bezier(.22,.68,0,1.2) var(--qb-delay, 0ms) both;
}
.qb-grid[data-anim="fade"].qb--anim-ready > .qb-grid-item.qb--visible {
    animation-name: qbFadeIn;
}
.qb-grid[data-anim="zoom"].qb--anim-ready > .qb-grid-item.qb--visible {
    opacity: 0;
    transform: scale(0.88);
    animation-name: qbZoomIn;
}
.qb-grid[data-anim="none"] > .qb-grid-item,
.qb-grid[data-anim="none"].qb--anim-ready > .qb-grid-item {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

@keyframes qbSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes qbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; transform: none; }
}
@keyframes qbZoomIn {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

/* ================================================================
   CAROUSEL
   ================================================================ */
.qb-carousel-wrap {
    position: relative;
    padding: 0 30px;
}

.qb-track-outer {
    overflow: hidden;
    padding-top: 18px;
    margin-top: -18px;
}

.qb-track {
    display: flex;
    will-change: transform;
    align-items: flex-start;
    cursor: grab;
}
.qb-track:active {
    cursor: grabbing;
}

.qb-slide {
    flex-shrink: 0;
    padding: 0 10px;
    box-sizing: border-box;
}

/* ---- Arrows ---- */
.qb-arrow {
    --qb-arrow-color: #D4B15F;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--qb-arrow-color);
    background: transparent;
    color: var(--qb-arrow-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s, color 0.25s, transform 0.25s;
    padding: 0;
    line-height: 1;
}
.qb-arrow:hover {
    background: var(--qb-arrow-color);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}
.qb-arrow--prev { left: 0; }
.qb-arrow--next { right: 0; }
.qb-arrow--hidden { display: none !important; }

/* ---- Dots ---- */
.qb-dots {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 22px;
}
.qb-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(14, 52, 88, 0.2);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s, transform 0.3s;
}
.qb-dot.is-active {
    background: #D4B15F;
    transform: scale(1.4);
}

/* ================================================================
   MISC
   ================================================================ */
.qb-no-posts {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
    .qb-grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
    .qb-grid--cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .qb-grid--cols-4,
    .qb-grid--cols-3,
    .qb-grid--cols-2 { grid-template-columns: 1fr; }
    .qb-card { height: 440px; }
    .qb-carousel-wrap { padding: 0 14px; }
}
