/* =========================================================
   Greatest Interactive — Project detail
   Reuses the shared tokens from main.css (--ink, --paper, --violet-*,
   accent chips, --font-*, --container, --radius-*, --shadow-soft) so
   this page follows the site-wide light/dark theme automatically.
   - .team-grid and .gallery-grid now use auto-fill (not auto-fit)
     with a capped column width, same fix as the Team and Projects
     pages: a single team member or gallery image no longer stretches
     to fill the entire row.
   ========================================================= */

.project-hero {
    position: relative;
    padding: 90px 20px 70px;
    background: var(--paper);
    overflow: hidden;
}

.project-hero .hero-inner {
    position: relative;
    max-width: var(--container);
    margin: 0 auto;
    z-index: 1;
}

.project-hero-card {
    padding: 42px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 28px);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: var(--shadow-soft);
}

.project-hero h1 {
    font-size: clamp(32px, 5vw, 50px);
    font-weight: 700;
    color: var(--text, var(--ink));
}

.project-hero .eyebrow {
    margin-bottom: 16px;
}

.project-hero p {
    margin-top: 16px;
    font-size: 18px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 620px;
}

.project-hero .hero-decor {
    position: absolute;
    top: 22%;
    right: 12%;
    color: var(--amber);
    opacity: 0.9;
}

/* ---------------------------------------------------------
   Generic section / copy
   --------------------------------------------------------- */

.section {
    padding: 64px 20px;
}

.section-inner {
    max-width: var(--container);
    margin: 0 auto;
}

.section-title {
    font-size: clamp(22px, 2.6vw, 28px);
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text, var(--ink));
}

.section-copy {
    font-size: 17px;
    line-height: 1.7;
    color: var(--muted);
    max-width: 780px;
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.project-description-card {
    max-width: 860px;
    margin: 0 auto;
    padding: 42px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 28px);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.project-description-card .section-title {
    margin-top: 14px;
}

.section-copy br + br {
    display: block;
    content: "";
    margin-top: 0.8em;
}

/* ---------------------------------------------------------
   Team — auto-fill + capped width + centered justify-content
   so 1–2 members can't stretch across the whole row; cards
   also get a fixed max-width so a lone avatar+name doesn't
   sit in an oversized box.
   --------------------------------------------------------- */

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 250px));
    justify-content: center;
    gap: 18px;
    max-width: 820px;
    margin: 0 auto;
}

.team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 236px;
    height: 100%;
    background: linear-gradient(180deg, var(--surface), rgba(45, 125, 246, 0.03));
    border: 1px solid var(--line);
    border-radius: var(--radius-md, 18px);
    padding: 20px 16px;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.team-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft, 0 20px 45px -25px rgba(27, 19, 48, 0.35));
    border-color: rgba(45, 125, 246, 0.18);
}

.team-card img {
    width: 96px;
    height: 96px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: block;
    border: 2px solid rgba(45, 125, 246, 0.12);
}

.team-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 16px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.22);
}

.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; }

.team-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text, var(--ink));
}

.team-card p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

/* ---------------------------------------------------------
   Gallery — same auto-fill fix: a single gallery image no
   longer stretches to the full section width.
   --------------------------------------------------------- */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: center;
    gap: 16px;
    max-width: 980px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    padding: 0;
    border: none;
    border-radius: 18px;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--surface);
    aspect-ratio: 4 / 3;
    min-height: 180px;
    border: 1px solid rgba(27, 19, 48, 0.06);
    box-shadow: 0 14px 26px -22px rgba(27, 19, 48, 0.32);
}

.gallery-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: 1 / 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(27, 19, 48, 0.35), transparent 45%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.project-links {
    padding-top: 0;
}

.project-links-card {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 28px);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.project-links-card .section-title {
    margin: 14px 0 0;
}

.gallery-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.gallery-link:hover {
    border-color: var(--brand-red);
    color: #fff;
    transform: translateY(-2px);
    background: var(--brand-red);
}

:root[data-theme="dark"] .gallery-link {
    background: var(--brand-yellow);
    border-color: var(--brand-yellow);
    color: var(--ink);
}

:root[data-theme="dark"] .gallery-link:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #fff;
}

/* ---------------------------------------------------------
   Lightbox
   --------------------------------------------------------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(18, 13, 28, 0.88);
    backdrop-filter: blur(8px);
    padding: clamp(20px, 4vw, 40px);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-figure {
    position: relative;
    margin: 0;
    width: min(100%, 980px);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-figure img {
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    border-radius: 18px;
    display: block;
    background: rgba(255,255,255,0.04);
}

.lightbox-figure figcaption {
    margin-top: 14px;
    text-align: center;
    color: #f1edfa;
    font-size: 14px;
}

.lightbox-close,
.lightbox-arrow {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 12px 24px -18px rgba(0,0,0,0.6);
}

.lightbox-close:hover,
.lightbox-arrow:hover {
    background: var(--brand-blue);
    transform: translateY(-1px);
}

.lightbox-close {
    top: 18px;
    right: 18px;
}

.lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }

/* ---------------------------------------------------------
   CTA (shared look with the home page)
   --------------------------------------------------------- */

.cta {
    padding: 24px 20px 80px;
}

.cta-inner {
    position: relative;
    max-width: var(--container);
    margin: 0 auto;
    padding: 64px 40px;
    text-align: center;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-blue));
    border-radius: var(--radius-lg, 28px);
}

.cta-inner h2 {
    color: #fff;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 700;
}

.cta-button {
    margin-top: 26px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--brand-yellow);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.4);
    background: var(--brand-red);
    color: #fff;
}

/* ---------------------------------------------------------
   Scroll reveal (progressive enhancement — see project_detail.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;
    }
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 720px) {
    .project-hero { padding: 64px 20px 48px; }
    .project-hero p { font-size: 16px; }
    .project-hero-card { padding: 30px 24px; }
    .section { padding: 40px 16px; }
    .project-description-card { padding: 30px 24px; }
    .cta-inner { padding: 48px 24px; }
    .cta { padding: 0 16px 56px; }

    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .team-card {
        padding: 22px 14px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .gallery-item:first-child {
        grid-column: span 2;
        grid-row: auto;
        aspect-ratio: 16 / 9;
    }

    .gallery-item {
        border-radius: 14px;
    }

    .lightbox { padding: 18px; }
    .lightbox-arrow { width: 40px; height: 40px; }
    .lightbox-close { top: 12px; right: 12px; }
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
    .lightbox-figure figcaption { font-size: 13px; }
}

@media (max-width: 480px) {
    .team-grid {
        grid-template-columns: 1fr;
    }

    .team-card {
        min-height: 0;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item:first-child {
        grid-column: auto;
        aspect-ratio: 4 / 3;
    }

    .lightbox-figure img {
        max-height: 62vh;
    }
}