/* ============================================================
   QB – Projects Accordion  |  style.css  v2.0
   ============================================================ */

/* ---- Grid ---- */
.qb-pa-grid {
    --cols:        3;
    --cols-tablet: 2;
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    gap: 24px;
    align-items: start;
    padding: 40px 0;
}

@media (max-width: 1024px) {
    .qb-pa-grid { grid-template-columns: repeat(var(--cols-tablet), 1fr); }
}

@media (max-width: 767px) {
    .qb-pa-grid { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
}

/* ---- Card ---- */
.qb-pa-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .28s cubic-bezier(.16,1,.3,1),
                box-shadow .28s cubic-bezier(.16,1,.3,1);
    will-change: transform;
}

.qb-pa-card:hover {
    transform: translateY(-4px) scale(1.013);
    box-shadow: 0 10px 36px rgba(0,0,0,.13);
}

/* ---- Image banner ---- */
.qb-pa-image-wrap {
    background: #CDE5E4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 20px;
    transition: background .3s ease;
}

.qb-pa-card:hover .qb-pa-image-wrap {
    background: #b8d9d8;
}

.qb-pa-image-wrap img.qb-pa-img {
    width: 100px;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    display: block;
    border-radius: 24px 24px 24px 24px;
    transition: transform .32s cubic-bezier(.16,1,.3,1);
}

.qb-pa-card:hover .qb-pa-image-wrap img.qb-pa-img {
    transform: scale(1.07);
}

/* ---- Body ---- */
.qb-pa-body {
    padding: 22px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* ---- Title ---- */
.qb-pa-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    color: #070807;
    margin: 0;
    padding: 0;
}

/* ---- Description ---- */
.qb-pa-desc-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qb-pa-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(7,8,7,0.9);
    overflow: hidden;
    max-height: calc(14px * 1.65 * 3);  /* ~3 lines */
    transition: max-height .48s cubic-bezier(.16,1,.3,1),
                opacity   .3s  ease;
    opacity: 1;
}

.qb-pa-desc.is-expanded {
    max-height: 2000px;
}

/* ---- Toggle button ---- */
.qb-pa-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #007973;
    cursor: pointer;
    letter-spacing: .01em;
    width: fit-content;
    position: relative;
    line-height: 1.4;
    transition: color .18s ease, opacity .15s ease;
}

/* animated underline */
.qb-pa-toggle::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
    transition: width .24s ease;
}

.qb-pa-toggle:hover { color: #005f5a; }
.qb-pa-toggle:hover::after { width: 100%; }
.qb-pa-toggle:focus-visible::after { width: 100%; }

.qb-pa-toggle:active {
    transform: scale(.96);
    opacity: .8;
}

.qb-pa-toggle:focus-visible {
    outline: 2px solid #007973;
    outline-offset: 3px;
    border-radius: 3px;
}

/* ---- Open state ---- */
.qb-pa-card.is-open {
    box-shadow: 0 6px 28px rgba(0,121,115,.15);
}

/* ---- Entrance animation ---- */
@keyframes qb-pa-fadein {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qb-pa-card {
    animation: qb-pa-fadein .44s both;
    animation-play-state: paused; /* JS triggers via IO */
}

.qb-pa-card.qb-pa-visible {
    animation-play-state: running;
}

/* stagger for first 12 */
.qb-pa-card:nth-child(1)  { animation-delay: .03s; }
.qb-pa-card:nth-child(2)  { animation-delay: .07s; }
.qb-pa-card:nth-child(3)  { animation-delay: .11s; }
.qb-pa-card:nth-child(4)  { animation-delay: .15s; }
.qb-pa-card:nth-child(5)  { animation-delay: .19s; }
.qb-pa-card:nth-child(6)  { animation-delay: .23s; }
.qb-pa-card:nth-child(7)  { animation-delay: .27s; }
.qb-pa-card:nth-child(8)  { animation-delay: .31s; }
.qb-pa-card:nth-child(9)  { animation-delay: .35s; }
.qb-pa-card:nth-child(10) { animation-delay: .39s; }
.qb-pa-card:nth-child(11) { animation-delay: .43s; }
.qb-pa-card:nth-child(12) { animation-delay: .47s; }
.qb-pa-card:nth-child(n+13) { animation-delay: .50s; }

/* ---- CSS custom properties driven by data attrs (set via JS) ---- */

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .qb-pa-card,
    .qb-pa-desc,
    .qb-pa-toggle,
    .qb-pa-toggle::after,
    .qb-pa-image-wrap img.qb-pa-img {
        animation: none !important;
        transition: none !important;
    }
}
