/**
 * Open PhD position cards + rich scholarship institute cards (homepage, tags, search, cat 132).
 * Loaded after React common.css to override legacy .post-item layout.
 */

.category-page .post-grid,
.search-page .post-grid,
.tag-page--open-positions .post-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
    gap: 16px !important;
    padding: 0 !important;
    align-items: stretch !important;
}

@media (min-width: 1200px) {
    .category-page .post-grid,
    .search-page .post-grid,
    .tag-page--open-positions .post-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
        gap: 16px !important;
        padding: 0 !important;
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    .category-page .post-grid,
    .search-page .post-grid,
    .tag-page--open-positions .post-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    }
}

.category-page .post-item.post-item--open-position,
.search-page .post-item.post-item--open-position,
.tag-page--open-positions .post-item.post-item--open-position {
    height: 100%;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 16px !important;
    margin: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Rich scholarship cards on home/tags — content typography only (shell from ssr-common.css). */
.home-scholarship-cards .post-item.post-item--scholarship-rich .op-card-title,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-card-title {
    margin: 0 0 6px !important;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-card-title a,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-card-title a {
    font-size: 1.05rem;
    line-height: 1.25;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-card-pills,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-card-pills {
    margin-bottom: 6px;
    gap: 6px;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-pill,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-pill {
    padding: 3px 8px;
    font-size: 11px;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-card-meta,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-card-meta {
    margin: 0 0 10px;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-card-meta p,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-card-meta p {
    margin: 0 0 5px;
    font-size: 0.9rem;
    line-height: 1.35;
}
.home-scholarship-cards .post-item.post-item--scholarship-rich .op-icon,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-icon {
    width: 16px;
    margin-right: 4px;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .op-summary,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .op-summary {
    margin-top: 4px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .read-more-btn,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .read-more-btn {
    margin-top: auto;
    margin-bottom: 2px;
    align-self: flex-start;
    padding: 8px 16px;
    font-size: 0.88rem;
}

.category-page .post-item.post-item--open-position:hover,
.search-page .post-item.post-item--open-position:hover,
.tag-page--open-positions .post-item.post-item--open-position:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
    border-color: #d1d5db !important;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .post-content,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .post-content {
    padding: 20px 24px 24px !important;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.category-page .post-item.post-item--open-position .post-content,
.search-page .post-item.post-item--open-position .post-content,
.tag-page--open-positions .post-item.post-item--open-position .post-content {
    padding: 0 !important;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.home-scholarship-cards .post-item.post-item--scholarship-rich .post-thumbnail.op-card-logo,
.tag-scholarship-cards .post-item.post-item--scholarship-rich .post-thumbnail.op-card-logo,
.category-page .post-item.post-item--open-position .post-thumbnail.op-card-logo,
.search-page .post-item.post-item--open-position .post-thumbnail.op-card-logo,
.tag-page--open-positions .post-item.post-item--open-position .post-thumbnail.op-card-logo {
    display: flex !important;
    height: 72px !important;
    min-height: 72px !important;
    max-height: 72px !important;
    background: var(--gradient-bg) !important;
    color: #fff !important;
    text-decoration: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.op-card-head {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.op-card-head--scholarship {
    margin-bottom: 10px;
}

.op-card-meta .op-card-affordability {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    line-height: 1.5;
}

.op-card-affordability__label {
    font-weight: 600;
    color: #374151;
}

.op-card-meta .op-card-affordability__band {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    vertical-align: middle;
}

.op-card-affordability__score {
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
}

.op-card-logo {
    min-width: 72px;
    width: 72px;
    height: 72px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.op-card-logo .logo-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.op-card-logo .institution-acronym {
    font-size: calc(14px * 1.3);
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-align: center;
    padding: 0 3px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.op-card-university {
    font-size: 1.05rem;
    line-height: 1.25;
    font-weight: 700;
    color: #111827;
}

.op-card-location {
    margin-top: 4px;
    color: #6b7280;
    font-size: 0.94rem;
}

.op-icon {
    display: inline-block;
    width: 18px;
    margin-right: 6px;
}

.op-card-title {
    margin: 2px 0 10px !important;
}

.op-card-title a {
    color: #dc2626 !important;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.op-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.op-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.op-pill--status {
    background: #fee2e2;
    color: #b91c1c;
}

.op-pill--funding {
    background: #f3f4f6;
    color: #374151;
}

.op-card-meta p {
    margin: 0 0 6px;
    color: #374151;
    font-size: 0.98rem;
}

.op-supervisor-scholar-link {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: underline;
}

.op-supervisor-scholar-link:hover {
    color: #1e3a8a;
}

.op-summary {
    margin-top: 8px;
    margin-bottom: 14px;
    color: #4b5563;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 0;
}

.op-deadline-chip {
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
}

.op-deadline-chip--soon {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.op-deadline-chip--urgent {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.op-deadline-chip--expired {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
}

.category-page .post-item.post-item--open-position .read-more-btn,
.search-page .post-item.post-item--open-position .read-more-btn,
.tag-page--open-positions .post-item.post-item--open-position .read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: auto;
    align-self: flex-start;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--gradient-hero);
    color: var(--primary-white);
    text-decoration: none;
    border-radius: var(--border-radius-xl);
    font-weight: 500;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    border: none;
}

.category-page .post-item.post-item--open-position .read-more-btn:hover,
.search-page .post-item.post-item--open-position .read-more-btn:hover,
.tag-page--open-positions .post-item.post-item--open-position .read-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--secondary-dark-green) 0%, var(--primary-dark-green) 100%);
    color: var(--primary-white);
}

.category-page .post-item.post-item--open-position .read-more-btn .btn-icon,
.search-page .post-item.post-item--open-position .read-more-btn .btn-icon,
.tag-page--open-positions .post-item.post-item--open-position .read-more-btn .btn-icon {
    transition: transform var(--transition-fast);
}

.category-page .post-item.post-item--open-position .read-more-btn:hover .btn-icon,
.search-page .post-item.post-item--open-position .read-more-btn:hover .btn-icon,
.tag-page--open-positions .post-item.post-item--open-position .read-more-btn:hover .btn-icon {
    transform: translateX(4px);
}

@media (max-width: 640px) {
    .category-page .post-grid,
    .search-page .post-grid,
    .tag-page--open-positions .post-grid,
    .home-scholarship-cards .post-grid,
    .tag-scholarship-cards .post-grid {
        grid-template-columns: 1fr !important;
    }

    .op-card-title a {
        font-size: 1.08rem;
    }
}
