/* ============================================
   Portfolio Grid Block - Main Styles
   ============================================ */

:root {
    --pgb-gap: 24px;
    --pgb-radius: 16px;
    --pgb-card-min-height-wide: 480px;
    --pgb-card-min-height-half: 420px;
    --pgb-font-title: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --pgb-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --pgb-tag-bg: rgba(255, 255, 255, 0.15);
    --pgb-tag-color: #fff;
    --pgb-transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Grid Container */
.pgb-portfolio-grid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.pgb-grid-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 56px 32px;
}

/* ============================================
   Card Base
   ============================================ */
.pgb-card {
    position: relative;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.50);
    border-radius: 12px;
    background: #1a1a1a;
    transition: transform var(--pgb-transition), box-shadow var(--pgb-transition);
    animation: pgbFadeInUp 0.6s ease-out both;
}

.pgb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Wide card: full width */
.pgb-card--wide {
    width: 100%;
    min-height: 700px;
}

/* Half card: takes ~half minus gap */
.pgb-card--half {
    width: calc(50% - 32px / 2);
    min-height: 700px;
}

/* Link wrapper */
.pgb-card__link {
    display: block;
    width: 100%;
    height: 100%;
    min-height: inherit;
    text-decoration: none;
    color: #fff;
    position: relative;
}

/* ============================================
   Image
   ============================================ */
.pgb-card__image-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.pgb-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pgb-card:hover .pgb-card__image {
    transform: scale(1.05);
}

/* Gradient overlay */
.pgb-card__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 0%, #000 100%) !important;
    z-index: 1;
}

/* ============================================
   Content
   ============================================ */
.pgb-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 32px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pgb-card.pgb-card--half .pgb-card__content {
    padding: 32px;
}

.pgb-card__title {
    font-family: var(--pgb-font-title);
    font-size: 40px;
    font-weight: 700;
    line-height: 56px;
    margin: 0;
    color: #fff;
}

.pgb-card__excerpt {
    font-family: var(--pgb-font-body);
    font-size: 18px;
    font-weight: 500;
    line-height: 28.8px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    max-width: 486px;
}

/* ============================================
   Tags
   ============================================ */
.pgb-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}

.pgb-card__tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 48px;
    background: #949494;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--pgb-font-body);
    font-size: 16px;
    line-height: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.64px;
    color: var(--pgb-tag-color);
    white-space: nowrap;
}

/* ============================================
   Loader & Sentinel
   ============================================ */
.pgb-scroll-sentinel {
    width: 100%;
    height: 1px;
    visibility: hidden;
}

.pgb-loader {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
}

.pgb-loader.pgb-loading {
    display: flex;
}

.pgb-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255);
    border-top-color: #000000;
    border-radius: 50%;
    animation: pgbSpin 0.8s linear infinite;
}

/* Dark theme spinner fallback */
@media (prefers-color-scheme: light) {
    .pgb-spinner {
        border-color: rgba(0, 0, 0, 0.5);
        border-top-color: #333;
    }
}

.pgb-no-posts {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #888;
}

/* ============================================
   Animations
   ============================================ */
@keyframes pgbFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pgbSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Stagger animation for initial load */
.pgb-card:nth-child(1) { animation-delay: 0s; }
.pgb-card:nth-child(2) { animation-delay: 0.08s; }
.pgb-card:nth-child(3) { animation-delay: 0.16s; }
.pgb-card:nth-child(4) { animation-delay: 0.24s; }
.pgb-card:nth-child(5) { animation-delay: 0.32s; }
.pgb-card:nth-child(6) { animation-delay: 0.40s; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .pgb-card--wide {
        min-height: 400px;
    }

    /* Half card: takes ~half minus gap */
    .pgb-card--half {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    :root {
        --pgb-gap: 16px;
        --pgb-card-min-height-wide: 360px;
        --pgb-card-min-height-half: 320px;
    }

    .pgb-grid-inner {
        gap: 32px;
    }

    .pgb-card--half {
        width: 100%;
    }

    .pgb-card__title {
        font-size: 24px;
        line-height: 34px;
    }

    .pgb-card__excerpt {
        font-size: 16px;
        line-height: 24px;
    }

    .pgb-card__tags {
        gap: 12px;
    }

    .pgb-card__content,
    .pgb-card.pgb-card--half .pgb-card__content {
        padding: 20px 18px;
    }

    .pgb-card__tag {
        font-size: 13px;
        line-height: 20px;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --pgb-card-min-height-wide: 300px;
        --pgb-card-min-height-half: 280px;
        --pgb-radius: 12px;
    }
}
