/* ============================================================================
   PORTFOLIO PAGE — corporate & modern
   Self-contained styles for the SESCOM portfolio page. Loaded only on the
   /portfolio route via @push('styles') in
   resources/views/public/portfolio/index.blade.php. Reuses the design tokens
   already defined in sescom.css (`--green`, `--amber`, `--charcoal`, `--line`,
   etc.) so it stays visually consistent with the rest of the public site.
   ============================================================================ */

/* ── Stats strip — overlapping the hero edge for visual elevation ────── */
.portfolio-stats {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.6rem 1rem;
    box-shadow: var(--shadow-md);
    margin-top: -2.5rem;          /* lift onto the hero edge */
    position: relative;
    z-index: 5;
}

.portfolio-stat {
    text-align: center;
    padding: 0.4rem 0.6rem;
    position: relative;
}

/* Vertical divider between stats — hidden on the last column */
.portfolio-stat::after {
    content: '';
    position: absolute;
    right: 0; top: 18%;
    width: 1px; height: 64%;
    background: var(--line);
}

.portfolio-stat:last-child::after { display: none; }

.portfolio-stat .icon {
    font-size: 1.5rem;
    color: var(--green);
    margin-bottom: 0.35rem;
    line-height: 1;
}

.portfolio-stat .number {
    font-family: var(--font-head);
    font-size: clamp(1.5rem, 2.2vw, 1.95rem);
    font-weight: 800;
    color: var(--charcoal);
    letter-spacing: -0.02em;
    line-height: 1;
    display: block;
}

.portfolio-stat .label {
    font-size: 0.74rem;
    color: var(--slate);
    margin-top: 0.45rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
    line-height: 1.35;
}

/* ── Filter pills (with category counts) ──────────────────────────────── */
.portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
    margin: 0 0 2.5rem;
}

.portfolio-filter {
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--slate);
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.84rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    line-height: 1.2;
}

.portfolio-filter:hover {
    border-color: var(--green);
    color: var(--green);
}

.portfolio-filter.active {
    border-color: var(--green);
    background: var(--green);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(26, 122, 60, 0.25);
}

.portfolio-filter .count {
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.08rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.4;
}

.portfolio-filter.active .count {
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
}

/* ── Project card grid ────────────────────────────────────────────────── */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.portfolio-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.portfolio-card:hover {
    border-color: transparent;
    box-shadow: 0 20px 44px -12px rgba(15, 23, 42, 0.18);
    transform: translateY(-4px);
}

/* Card header: gradient strip with project № and category icon
   (used as fallback when a project has no cover image) */
.portfolio-card-header {
    background: linear-gradient(135deg, var(--green-darker) 0%, var(--green-dark) 55%, var(--green) 100%);
    padding: 1.2rem 1.4rem;
    color: var(--white);
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    min-height: 110px;
}

/* Cover variant: real image with subtle dark overlay so the floating status
   badge stays legible. Hover scales the image without affecting layout. */
.portfolio-card-cover {
    position: relative;
    display: block;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--green-darker), var(--green));
    text-decoration: none;
}

.portfolio-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s var(--transition);
}

.portfolio-card:hover .portfolio-card-cover img {
    transform: scale(1.05);
}

.portfolio-card-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0.45) 100%);
    pointer-events: none;
}

/* Status badge — top-right, rendered both on the cover and on the gradient
   header (with .portfolio-card-status--floating to position it absolutely
   when it sits inside .portfolio-card-header). */
.portfolio-card-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
    backdrop-filter: blur(6px);
    background: rgba(255, 255, 255, 0.92);
    color: var(--charcoal);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.portfolio-card-status--floating { /* alias used by gradient-header variant */ }

/* Status-specific colours for stronger semantic cues */
.portfolio-card-status.status-active    { background: rgba(46, 160, 85, 0.95);   color: #fff; }
.portfolio-card-status.status-completed { background: rgba(15, 71, 34, 0.95);    color: #fff; }
.portfolio-card-status.status-planning  { background: rgba(245, 158, 11, 0.95);  color: var(--charcoal); }
.portfolio-card-status.status-on_hold   { background: rgba(217, 119, 6, 0.95);   color: #fff; }
.portfolio-card-status.status-cancelled { background: rgba(108, 117, 125, 0.95); color: #fff; }

.portfolio-card-header::before {
    content: '';
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M20 0L23 14L37 17L23 20L20 34L17 20L3 17L17 14L20 0Z'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.portfolio-card-header > * { position: relative; z-index: 1; }

.portfolio-card-num {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
}

.portfolio-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.18);
    color: var(--amber);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

/* Card body */
.portfolio-card-body {
    padding: 1.35rem 1.4rem 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.portfolio-card-year {
    color: var(--amber-dark);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.portfolio-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--charcoal);
    margin: 0 0 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;            /* keep grid rows aligned */
}

.portfolio-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s ease;
}

.portfolio-card-title a:hover { color: var(--green); }

.portfolio-card-loc {
    font-size: 0.83rem;
    color: var(--slate);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    line-height: 1.4;
}

.portfolio-card-loc i {
    color: var(--green);
    margin-top: 0.18rem;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.portfolio-card-summary {
    font-size: 0.85rem;
    color: var(--slate);
    line-height: 1.55;
    flex: 1;
    margin: 0 0 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card meta footer */
.portfolio-card-meta {
    border-top: 1px solid var(--line-soft);
    padding: 0.85rem 1.4rem;
    background: var(--off-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.portfolio-card-funder {
    font-size: 0.78rem;
    color: var(--slate);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 62%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portfolio-card-funder i {
    color: var(--green);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.portfolio-card-value {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.83rem;
    color: var(--green);
    background: var(--green-light);
    padding: 0.32rem 0.75rem;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Tiny "+N" badge next to the primary donor when a project has multiple donors */
.portfolio-card-funder-extra {
    background: var(--green-light);
    color: var(--green);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-left: 0.25rem;
}

/* CTA "Read more →" anchor in the card meta footer */
.portfolio-card-cta {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--green);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    transition: color 0.18s ease, gap 0.18s ease;
}

.portfolio-card-cta:hover {
    color: var(--green-dark);
    gap: 0.5rem;
}

/* Filter hide state with smooth collapse */
.portfolio-card.is-hidden {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    /* CSS Grid: hidden cards collapse out via display:none after the fade */
    animation: portfolioCardOut 0.22s ease forwards;
}

@keyframes portfolioCardOut {
    to {
        opacity: 0;
        transform: scale(0.96);
        height: 0;
        margin: 0;
        padding: 0;
        border-width: 0;
        overflow: hidden;
    }
}

/* Empty-state when no card matches */
.portfolio-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--slate);
    font-size: 0.95rem;
    background: var(--off-white);
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
}

.portfolio-empty i {
    font-size: 2.4rem;
    color: var(--muted);
    display: block;
    margin-bottom: 0.6rem;
}

/* ── Partners — refined logo grid ─────────────────────────────────────── */
.portfolio-partners {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.portfolio-partner {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1rem;
    text-align: center;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.portfolio-partner:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.portfolio-partner i {
    font-size: 1.55rem;
    color: var(--green);
    margin-bottom: 0.5rem;
    display: block;
}

.portfolio-partner strong {
    display: block;
    font-size: 0.92rem;
    color: var(--charcoal);
    line-height: 1.35;
}

.portfolio-partner .sub {
    display: block;
    font-size: 0.74rem;
    color: var(--muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .portfolio-stat::after { display: none; }
    .portfolio-stats {
        margin-top: 0;
        padding: 1.25rem 0.75rem;
    }
}

@media (max-width: 575px) {
    .portfolio-grid { grid-template-columns: 1fr; }
    .portfolio-card-meta { flex-direction: column; align-items: flex-start; }
    .portfolio-card-funder { max-width: 100%; white-space: normal; }
}
