/* =====================================================
   MAKHASWA HOLDINGS — SITE JOURNAL PAGE STYLESHEET
   Asymmetric masonry card layout, premium lightbox,
   and dynamic loading controls.
   ===================================================== */

/* ── Page Container ── */
.recent-photos-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 20px 96px;
}

/* ── Portfolio Phase Filters ── */
.portfolio-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

.portfolio-filters .filter-btn {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 10px 22px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.portfolio-filters .filter-btn:hover {
    background: rgba(8, 45, 90, 0.03);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.portfolio-filters .filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(8, 45, 90, 0.15);
}

.portfolio-filters .filter-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .portfolio-filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 20px 16px;
        margin-left: -20px;
        margin-right: -20px;
        margin-bottom: 24px;
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE and Edge */
    }

    .portfolio-filters::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }

    .portfolio-filters .filter-btn {
        flex-shrink: 0;
    }
}

/* ── Count Label ── */
.journal-count {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 32px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ── Masonry Grid Layout ── */
.journal-grid {
    column-count: 3;
    column-gap: 24px;
    width: 100%;
}

@media (max-width: 900px) {
    .journal-grid {
        column-count: 2;
        column-gap: 16px;
    }
}

@media (max-width: 600px) {
    .journal-grid {
        column-count: 1;
        column-gap: 0;
    }
}

/* ── Journal Card ── */
.journal-card {
    break-inside: avoid;
    margin-bottom: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        border-color 0.3s ease;

    /* Animation initial states (Observer target class) */
    opacity: 0;
    transform: translateY(20px);
}

.journal-card.fade-in {
    animation: journalCardFadeIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes journalCardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Journal Card Media ── */
.journal-card-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f7f9fa;
}

.journal-card-media img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Hover effects */
.journal-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(8, 45, 90, 0.08);
    border-color: rgba(200, 169, 81, 0.4);
    /* subtle gold */
}

.journal-card:hover .journal-card-media img {
    transform: scale(1.03);
}

/* ── Card Footer ── */
.journal-card-footer {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.journal-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.journal-log-badge {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.journal-cat-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

/* Zoom/Expand Icon */
.journal-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(8, 45, 90, 0.04);
    color: var(--primary);
    transition: all 0.3s ease;
}

.journal-card:hover .journal-card-action {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.1);
}

.journal-zoom-icon {
    width: 14px;
    height: 14px;
}

/* ── Load More Container ── */
.journal-load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 48px;
    min-height: 50px;
}

/* Button styling */
.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    background: var(--white);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.btn-load-more:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(8, 45, 90, 0.15);
}

.btn-load-more:active {
    transform: translateY(0);
}

.btn-load-more svg {
    transition: transform 0.3s ease;
}

.btn-load-more:hover svg {
    transform: translateY(2px);
}

/* End of updates message */
.journal-end-message {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
    padding: 24px 48px;
    text-align: center;
    width: 100%;
    max-width: 600px;
    text-transform: uppercase;
}

/* ── Premium Lightbox Modal ── */
.lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 45, 90, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lightbox-modal.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        opacity 0.3s ease;
}

.lightbox-modal.active .lightbox-content img {
    transform: scale(1);
}

/* Elegant Lightbox Footer Area */
.lightbox-caption {
    margin-top: 20px;
    color: #fff;
    text-align: center;
    max-width: 640px;
    width: 100%;
    line-height: 1.5;
    padding: 0 24px;
}

.lightbox-caption-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.lightbox-log-badge {
    font-size: 10px;
    font-weight: 800;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lightbox-category {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lightbox-caption-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.lightbox-counter {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
}

/* Buttons inside Lightbox */
.lightbox-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    z-index: 10;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--gold);
    transform: scale(1.08);
}

.lightbox-btn:active {
    transform: scale(0.95);
}

.lightbox-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Position overrides */
.lightbox-close {
    top: -68px;
    right: 0;
}

.lightbox-prev {
    left: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.08);
}

.lightbox-next {
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.08);
}

/* Responsiveness for Lightbox */
@media (max-width: 900px) {
    .lightbox-prev {
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(8, 45, 90, 0.8);
    }

    .lightbox-prev:hover {
        transform: translateY(-50%) scale(1.05);
    }

    .lightbox-next {
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(8, 45, 90, 0.8);
    }

    .lightbox-next:hover {
        transform: translateY(-50%) scale(1.05);
    }

    .lightbox-close {
        top: 16px;
        right: 16px;
        background: rgba(8, 45, 90, 0.8);
        position: fixed;
    }
}

/* =====================================================
   MAKHASWA HOLDINGS — RESILIENCE & LOADING UPGRADES
   Skeleton Screens, Retry states, active pagination spinner,
   and Lightbox spinner/error screens.
   ===================================================== */

/* ── Project Card Skeleton Shimmer ── */
.project-card.project-card--loading {
    /* Allow early clicking on slow/budget devices */
    pointer-events: auto;
}

.project-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            var(--off-white) 25%,
            #eef0f3 50%,
            var(--off-white) 75%);
    background-size: 200% 100%;
    animation: project-shimmer 1.5s infinite linear;
    z-index: 1;
}

@keyframes project-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Project Card Error/Retry State ── */
.project-card.project-card--error {
    background: var(--off-white);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px;
    cursor: default;
}

.project-card.project-card--error:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    border-color: var(--border);
}

.project-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    color: var(--text-light);
    width: 100%;
    height: 100%;
}

.project-error-state .error-icon {
    color: var(--text-muted);
}

.project-error-state span {
    font-size: 13px;
    font-weight: 500;
}

.project-error-state .btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.project-error-state .btn-retry:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

.project-error-state .btn-retry i,
.project-error-state .btn-retry svg {
    transition: transform 0.3s ease;
}

.project-error-state .btn-retry:hover i,
.project-error-state .btn-retry:hover svg {
    transform: rotate(180deg);
}

/* ── Paginator Loading State ── */
.btn-load-more.is-loading {
    cursor: not-allowed;
    background: var(--off-white) !important;
    border-color: var(--border) !important;
    color: var(--text-light) !important;
}

.btn-load-more.is-loading:hover {
    background: var(--off-white) !important;
    border-color: var(--border) !important;
    color: var(--text-light) !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(8, 45, 90, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: btn-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Lightbox Spinner & Error Panel ── */
.lightbox-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: lb-spin 1s ease-in-out infinite;
    position: absolute;
    z-index: 5;
}

@keyframes lb-spin {
    to {
        transform: rotate(360deg);
    }
}

.lightbox-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    padding: 32px;
    border-radius: 8px;
    max-width: 320px;
    text-align: center;
    position: absolute;
    z-index: 5;
}

.lightbox-error-container p {
    font-size: 14px;
    font-weight: 500;
}

.lightbox-error-container .error-icon {
    color: var(--gold);
}

.lightbox-error-container .lightbox-retry {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gold);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-error-container .lightbox-retry:hover {
    background: var(--white);
    color: var(--primary);
    transform: translateY(-1px);
}

.lightbox-error-container .lightbox-retry i,
.lightbox-error-container .lightbox-retry svg {
    transition: transform 0.3s ease;
}

.lightbox-error-container .lightbox-retry:hover i,
.lightbox-error-container .lightbox-retry:hover svg {
    transform: rotate(180deg);
}