/*==================================================
  AL FAJR FOUNDATION
  INSTITUTIONS SECTION — PERFECT FIT ILLUSTRATIONS
==================================================*/

/*=========================================
  SECTION BASE
=========================================*/

.institutions-section {
    position: relative;
    overflow: hidden;
    padding: 80px 0 90px;
    background: linear-gradient(
        160deg,
        #fffefb 0%,
        #fdf9f0 45%,
        #f5f0e2 100%
    );
    scroll-margin-top: 90px;
}

/*=========================================
  AMBIENT LIGHT ORBS
=========================================*/

.institutions-light {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(70px);
}

.institutions-light.one {
    width: 550px;
    height: 550px;
    left: -180px;
    top: -120px;
    background: rgba(212, 175, 55, 0.09);
}

.institutions-light.two {
    width: 450px;
    height: 450px;
    right: -140px;
    bottom: -90px;
    background: rgba(6, 20, 45, 0.05);
}

/*=========================================
  SECTION HEADING (Matching About & Projects)
=========================================*/

.institutions-section .section-heading {
    margin-bottom: 0;
}

.institutions-section .section-subtitle {
    margin-bottom: 8px;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
}

.institutions-section .section-heading h2 {
    font-size: clamp(1.6rem, 2.3vw, 2.1rem);
    line-height: 1.25;
}

.institutions-section .heading-divider {
    margin: 12px auto;
    width: 70px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #C9A227 0%, #E5C768 60%, #C9A227 100%);
}

.institutions-section .section-heading p {
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 580px;
    margin: 0 auto;
    color: #6B6254;
}

/*=========================================
  INSTITUTIONS GRID (Strict 3 Columns Desktop)
=========================================*/

.institutions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 42px;
    align-items: stretch;
}

/*=========================================
  INSTITUTION CARD — Premium Equal-Height Flexbox
=========================================*/

.institution-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    background: #FFFEF7;
    border: 1px solid rgba(212, 175, 55, 0.20);
    box-shadow: 0 8px 30px rgba(7, 26, 54, 0.07);
    transition: 
        transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.35s cubic-bezier(0.165, 0.84, 0.44, 1),
        border-color 0.35s ease;
}

.institution-card:hover {
    transform: translateY(-8px);
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 
        0 22px 55px rgba(7, 26, 54, 0.12),
        0 4px 16px rgba(212, 175, 55, 0.12);
}

/* Top Subtle Gold Accent Bar on Hover */
.institution-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gold, #D4AF37), #f3d36f);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
    z-index: 6;
}

.institution-card:hover::before {
    transform: scaleX(1);
}

/*=========================================
  IMAGE AREA — PERFECT FIT (FULL DESK & ARCH VISIBLE)
=========================================*/

.institution-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 275px;
    flex-shrink: 0;
    background: #FAF5EB;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.institution-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #FAF5EB;
    display: block;
    transition: 
        transform 0.45s cubic-bezier(0.165, 0.84, 0.44, 1),
        filter 0.45s ease;
}

.institution-card:hover .institution-image img {
    transform: scale(1.05);
    filter: brightness(1.03);
}

/* Dark Gradient Overlay — deepens on hover */
.institution-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(6, 20, 45, 0.35) 0%,
        rgba(6, 20, 45, 0.02) 60%
    );
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.institution-card:hover .institution-overlay {
    opacity: 0.75;
}

/*=========================================
  CARD CONTENT AREA
=========================================*/

.institution-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 24px 26px 22px;
}

/* Category Label */
.institution-category {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--gold, #D4AF37);
    background: rgba(212, 175, 55, 0.10);
    border: 1px solid rgba(212, 175, 55, 0.25);
    width: fit-content;
    margin-bottom: 10px;
}

/* Title */
.institution-title {
    margin: 0 0 8px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.3rem;
    line-height: 1.3;
    color: var(--navy, #06142D);
    font-weight: 700;
    transition: color 0.3s ease;
}

.institution-card:hover .institution-title {
    color: #8B6A14;
}

/* Description */
.institution-description {
    margin: 0;
    color: #6B6254;
    line-height: 1.6;
    font-size: 0.90rem;
    font-family: "Inter", sans-serif;
}

/* Flex Spacer for perfect alignment */
.institution-spacer {
    flex: 1;
    min-height: 16px;
}

/* Card Footer */
.institution-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(212, 175, 55, 0.14);
    margin-top: auto;
}

/* Button: Primary Gold Outline Style */
.btn-institution-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1.5px solid var(--gold, #D4AF37);
    background: transparent;
    color: var(--navy, #06142D);
    font-weight: 700;
    font-size: 0.90rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    text-align: center;
}

.btn-institution-outline:hover {
    background: linear-gradient(135deg, var(--gold, #D4AF37), #c49a26);
    color: #06142D;
    border-color: var(--gold, #D4AF37);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(212, 175, 55, 0.22);
}

/*=========================================
  RESPONSIVE BREAKPOINTS
=========================================*/

/* Desktop (Strict 3 Columns down to 992px) */
@media (min-width: 992px) {
    .institutions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
}

/* Tablet (2 Columns) */
@media (max-width: 991px) and (min-width: 641px) {
    .institutions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
    .institution-image {
        height: 250px;
    }
}

/* Mobile (1 Column) */
@media (max-width: 640px) {
    .institutions-section {
        padding: 50px 0 60px;
    }

    .institutions-grid {
        grid-template-columns: 1fr;
        gap: 22px;
        margin-top: 28px;
    }

    .institution-card {
        border-radius: 20px;
    }

    .institution-image {
        height: 240px;
    }

    .institution-content {
        padding: 18px 18px 18px;
    }

    .institution-title {
        font-size: 1.2rem;
    }
}