/* =========================================================
   Greatest Interactive — Projects
   Reuses the shared tokens from main.css.
   - .cards uses auto-fill (not auto-fit) + a capped column width
     so a lone project card can't stretch across the whole row,
     same fix applied to the Team page grid.
   - .card-image is now a fixed-aspect-ratio frame (position:
     relative + absolute-fill img) instead of min-height, so every
     card's image area is identically sized regardless of the
     source image's real dimensions.
   ========================================================= */

.projects-hero {
    position: relative;
    padding: 90px 24px 56px;
    background: var(--paper);
    overflow: hidden;
}

.projects-hero .hero-decor {
    position: absolute;
    top: 24%;
    right: 12%;
    color: var(--amber);
    opacity: 0.9;
}

.projects-hero .hero-inner {
    position: relative;
    max-width: var(--container);
    margin: 0 auto;
    z-index: 1;
}

.projects-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--text, var(--ink));
}

.projects-hero .eyebrow {
    margin-bottom: 16px;
}

.section {
    padding: 40px 40px 80px;
}

.section-inner {
    max-width: var(--container);
    margin: 0 auto;
}

/* ---------------------------------------------------------
   Card grid — auto-fill keeps phantom empty tracks in the
   layout instead of collapsing them, so 1–2 cards can't
   stretch to fill the whole row; the max in minmax() caps a
   single card's width, and justify-content centers a partial
   row instead of pinning it to the left with dead space.
   --------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
    justify-content: center;
    gap: 24px;
    align-items: stretch;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
    border-color: transparent;
}

/* Fixed-ratio frame: the real <img> and the fallback chip both
   fill this box exactly via absolute positioning, so every
   card's image area is the same size no matter the source
   image's dimensions. */
.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--line);
    overflow: hidden;
    flex-shrink: 0;
}

.card-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image-fallback span {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 42px;
    text-transform: uppercase;
    opacity: 0.85;
}

.chip-coral { background: var(--coral); color: #fff; }
.chip-sky { background: var(--sky); color: #10324a; }
.chip-mint { background: var(--mint); color: #0f3d2e; }
.chip-amber { background: var(--amber); color: #4a2c00; }

.card-content {
    flex-grow: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-content-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-content h3 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text, var(--ink));
    flex: 1 1 auto;
    min-width: 0;
}

.project-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.card:nth-child(3n + 1) .project-status {
    background: var(--brand-red-soft);
    color: var(--brand-red);
}

.card:nth-child(3n + 2) .project-status {
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
}

.card:nth-child(3n) .project-status {
    background: var(--brand-yellow-soft);
    color: #7d5e00;
}

.card-content p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.project-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-description.is-expanded {
    display: block;
}

.project-description-toggle {
    align-self: flex-start;
    width: fit-content;
    margin: -6px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand-blue);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.project-description-toggle:hover {
    color: var(--brand-red);
}

.empty-state {
    grid-column: 1 / -1;
    padding: 2.5rem 0;
    color: var(--muted);
    text-align: center;
}

/* ---------------------------------------------------------
   Scroll reveal (progressive enhancement — see projects.js)
   --------------------------------------------------------- */

[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

@media (max-width: 900px) {
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
    }
}

@media (max-width: 720px) {
    .projects-hero { padding: 64px 20px 40px; }
    .section { padding: 24px 20px 56px; }
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 18px;
    }
}