/* ===========================
   GRANTS ARCHIVE — SECTION
   =========================== */

.grants-section {
    padding: 48px 0 80px;
    background: #f8f9fa;
}

/* ===========================
   FILTER TABS
   =========================== */

.grants-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.grants-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 24px;
    border: 1.5px solid #d0d7e2;
    background: #fff;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.grants-filter-tab:hover {
    border-color: #1D3557;
    color: #1D3557;
}

.grants-filter-tab.is-active {
    background: #1D3557;
    border-color: #1D3557;
    color: #fff;
}

.grants-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.1);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.grants-filter-tab.is-active .grants-filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ===========================
   GRANTS GRID
   =========================== */

.grants-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ===========================
   GRANT CARD
   =========================== */

.grant-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.grant-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.grant-card--closed {
    opacity: 0.8;
}

/* Card header: title + badge */
.grant-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.grant-card__title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    line-height: 1.35;
    flex: 1;
}

.grant-card__title-link {
    color: #1D3557;
    text-decoration: none;
    transition: color 0.2s ease;
}

.grant-card__title-link:hover {
    color: #3C78B4;
}

.grant-card--closed .grant-card__title-link {
    color: #555;
}

/* Short description */
.grant-card__desc {
    font-size: 14px;
    color: #555;
    line-height: 1.65;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta list */
.grant-card__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grant-card__meta-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #555;
}

.grant-card__meta-item svg {
    flex-shrink: 0;
    color: #3C78B4;
}

/* Card footer */
.grant-card__footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

/* ===========================
   STATUS BADGES
   =========================== */

.grant-status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.grant-status-badge--open {
    background: #d6f0e3;
    color: #00783C;
}

.grant-status-badge--closed {
    background: #ebebeb;
    color: #888888;
}

/* ===========================
   EMPTY STATE
   =========================== */

.grants-empty {
    text-align: center;
    color: #888;
    font-size: 16px;
    padding: 56px 0;
}

/* Small button variant */
.btn--sm {
    padding: 7px 16px;
    font-size: 13px;
}

/* ===========================
   SINGLE GRANT — HERO
   =========================== */

.grant-hero {
    background: #1D3557;
    color: #fff;
    padding: 140px 0 60px;
}

.grant-hero__content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 760px;
}

.grant-hero__back {
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    width: fit-content;
}

.grant-hero__back:hover {
    color: #fff;
}

.grant-hero__top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.grant-hero__title {
    font-size: clamp(24px, 4vw, 40px);
    font-weight: 800;
    margin: 0;
    color: #fff;
    line-height: 1.25;
    flex: 1;
}

/* Details strip */
.grant-details-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.grant-detail-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.grant-detail-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.grant-detail-item--deadline {
    color: #ffd166;
}

/* ===========================
   SINGLE GRANT — BODY
   =========================== */

.grant-body {
    padding: 56px 0 80px;
    background: #fff;
}

.grant-body__inner {
    max-width: 760px;
}

.grant-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.grant-content h2,
.grant-content h3 {
    color: #1D3557;
    margin-top: 1.5em;
}

.grant-content ul,
.grant-content ol {
    padding-left: 1.5em;
}

/* Eligibility section */
.grant-eligibility {
    margin-top: 40px;
    padding: 24px;
    background: #f4f8ff;
    border-left: 4px solid #3C78B4;
    border-radius: 0 8px 8px 0;
}

.grant-eligibility__title {
    font-size: 18px;
    font-weight: 700;
    color: #1D3557;
    margin: 0 0 12px;
}

.grant-eligibility__body {
    font-size: 15px;
    line-height: 1.75;
    color: #444;
}

.grant-apply-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

/* ===========================
   RTL OVERRIDES
   =========================== */

[dir="rtl"] .grant-card__header {
    flex-direction: row-reverse;
}

[dir="rtl"] .grant-card__meta-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .grants-filter-tabs {
    flex-direction: row-reverse;
}

[dir="rtl"] .grant-eligibility {
    border-left: none;
    border-right: 4px solid #3C78B4;
    border-radius: 8px 0 0 8px;
}

[dir="rtl"] .grant-content ul,
[dir="rtl"] .grant-content ol {
    padding-left: 0;
    padding-right: 1.5em;
}

[dir="rtl"] .grant-eligibility__body ul,
[dir="rtl"] .grant-eligibility__body ol {
    padding-left: 0;
    padding-right: 1.5em;
}

/* ===========================
   RESPONSIVE — TABLET PORTRAIT
   =========================== */

@media (max-width: 1024px) and (orientation: portrait) {
    .grants-grid {
        grid-template-columns: 1fr;
    }

    .grant-card {
        padding: 20px;
    }

    .grant-hero {
        padding: 120px 0 48px;
    }

    .grant-hero__top {
        flex-direction: column;
        gap: 10px;
    }
}

/* ===========================
   RESPONSIVE — TABLET LANDSCAPE
   =========================== */

@media (max-width: 1024px) and (orientation: landscape) {
    .grants-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grant-hero {
        padding: 110px 0 48px;
    }
}

/* ── Homepage Grants Section ── */
.grants-home-section { padding: 60px 0; background: #F0F4FA; }
.grants-home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.grants-home-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); display: flex; flex-direction: column; overflow: hidden; border-top: 4px solid #00783C; }
.grants-home-card__body { padding: 24px; flex: 1; }
.grants-home-card__donor { font-size: 12px; font-weight: 700; color: #3C78B4; text-transform: uppercase; letter-spacing: 1px; }
.grants-home-card__title { font-size: 17px; font-weight: 700; color: #1D3557; margin: 8px 0 12px; line-height: 1.4; }
.grants-home-card__title a { color: inherit; text-decoration: none; }
.grants-home-card__title a:hover { color: #3C78B4; }
.grants-home-card__desc { font-size: 14px; color: #555; line-height: 1.6; margin-bottom: 16px; }
.grants-home-card__meta { display: flex; flex-wrap: wrap; gap: 12px; }
.grants-home-card__amount, .grants-home-card__deadline { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #666; }
.grants-home-card__footer { padding: 16px 24px; border-top: 1px solid #E0E8F0; }
.grants-home-card__btn { display: inline-block; background: #00783C; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 700; text-decoration: none; transition: background 0.2s; }
.grants-home-card__btn:hover { background: #005c2e; }

@media (max-width: 1024px) and (orientation: portrait) {
    .grants-home-grid { grid-template-columns: 1fr; }
}

[dir="rtl"] .grants-home-card__meta { flex-direction: row-reverse; }
