/* Modern Gallery Redesign Styles */
:root {
    --g-bg: #ffffff;
    --g-text: #1a1a1a;
    --g-text-muted: #666666;
    --g-accent: #6366f1; /* Indigo 500 */
    --g-accent-hover: #4f46e5; /* Indigo 600 */
    --g-card-bg: #f8fafc;
    --g-card-border: #e2e8f0;
    --g-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --g-shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --g-skeleton: #e2e8f0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --g-bg: #0f172a;
        --g-text: #f8fafc;
        --g-text-muted: #94a3b8;
        --g-accent: #818cf8;
        --g-accent-hover: #6366f1;
        --g-card-bg: #1e293b;
        --g-card-border: #334155;
        --g-skeleton: #334155;
    }
}

/* Base Styles */
.g-section {
    padding: 100px 0;
    background-color: var(--g-bg);
    color: var(--g-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.g-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.g-header {
    text-align: center;
    margin-bottom: 60px;
}

.g-header h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -0.025em;
}

.g-header p {
    color: var(--g-text-muted);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Simple Grid (for Certificates) */
.simple-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.simple-card {
    background: var(--g-card-bg);
    border: 1px solid var(--g-card-border);
    border-radius: 12px; /* Smoother corner like gallery */
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: var(--g-shadow);
    display: flex;
    flex-direction: column;
}

.simple-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--g-shadow-hover);
}

.simple-card .card-img {
    height: 240px; /* Better height for certificates */
    overflow: hidden;
    position: relative;
    background-color: #fff; /* In case of contain */
    border-bottom: 1px solid var(--g-card-border);
}

.simple-card .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover is usually best, but center top can help prevent cutting off logos */
    object-position: center;
    transition: transform 0.6s ease;
}

.simple-card:hover .card-img img {
    transform: scale(1.08); /* Smooth zoom-in effect on hover */
}

.simple-card .card-body {
    padding: 24px 20px;
    text-align: center;
    flex-grow: 1; /* Ensures buttons/text align if heights differ */
    background: var(--g-card-bg);
    z-index: 2; /* Sits above the zoomed image */
}

.simple-card h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--g-text);
}

.simple-card p {
    font-size: 0.9rem;
    color: var(--g-text-muted);
}

/* Masonry Grid (Photos) - Justified Row Gallery */
.masonry-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.masonry-item {
    flex: 1 1 calc(25% - 8px); /* Base width for ~4 per row */
    min-width: 200px;
    height: 320px; /* Uniform height */
    position: relative;
    overflow: hidden;
    background: transparent;
    border: none;
    border-radius: 8px; /* Clean modern UI */
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: none;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--g-shadow-hover);
}

.masonry-item:last-child {
    flex-grow: 0; /* Prevents the last item from stretching too wide */
}

.masonry-img {
    width: 100%;
    height: 100%;
}

.masonry-img a {
    display: block;
    width: 100%;
    height: 100%;
}

.masonry-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.masonry-item:hover .masonry-img img {
    transform: scale(1.1); /* Hover zoom effect */
}

.masonry-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    text-align: left;
    pointer-events: none; /* Let pointer events through to the image link */
}

.masonry-item:hover .masonry-info {
    transform: translateY(0);
}

.masonry-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #ffffff;
}

.masonry-info p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Skeleton Loading */
.skeleton {
    background: var(--g-skeleton);
    background-image: linear-gradient(
        90deg, 
        rgba(255,255,255,0) 0, 
        rgba(255,255,255,0.2) 20%, 
        rgba(255,255,255,0.5) 60%, 
        rgba(255,255,255,0)
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

.skeleton-card {
    height: 320px;
    border-radius: 8px;
    margin-bottom: 0;
    flex: 1 1 calc(25% - 8px);
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: 50px;
}

.btn-load-more {
    background: var(--g-accent);
    color: white;
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-load-more:hover {
    background: var(--g-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
}

.btn-load-more:disabled {
    background: var(--g-card-border);
    cursor: not-allowed;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1199px) {
    .simple-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .masonry-item {
        flex-basis: calc(33.333% - 8px);
    }
}

@media (max-width: 991px) {
    .simple-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .masonry-item {
        flex-basis: calc(50% - 8px);
    }
}

@media (max-width: 575px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    .bento-item.large, .bento-item.tall, .bento-item.wide {
        grid-column: span 1;
        grid-row: span 1;
    }
    .masonry-item {
        flex-basis: 100%;
    }
    .g-header h2 {
        font-size: 2rem;
    }
}
