/* ============================================
   Projects Hub Page Styles
   ============================================ */

.projects-hero {
    margin-top: 70px;
    padding: calc(var(--spacing-xl) + var(--spacing-md)) 0 var(--spacing-xl);
    background: linear-gradient(130deg, rgba(122, 162, 255, 0.14), rgba(0, 0, 0, 0.02));
    position: relative;
    overflow: hidden;
}

.projects-hero::before {
    content: '';
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(122, 162, 255, 0.2);
    top: -180px;
    right: -120px;
}

.projects-hero::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 32px;
    border: 1px solid rgba(122, 162, 255, 0.35);
    bottom: -120px;
    left: -80px;
    transform: rotate(12deg);
}

.projects-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: var(--spacing-xl);
    align-items: center;
    position: relative;
    z-index: 1;
}

.projects-hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.projects-hero-copy h1 {
    font-size: clamp(2.5rem, 3.5vw, 3.5rem);
    margin-bottom: var(--spacing-md);
}

.projects-hero-lead {
    font-size: 1.125rem;
    color: var(--text-light);
    max-width: 56ch;
}

.projects-hero-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-md);
}

.projects-hero-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.projects-hero-panel h3 {
    margin-bottom: var(--spacing-sm);
}

.projects-hero-list {
    list-style: none;
    display: grid;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-md);
    padding: 0;
}

.projects-hero-list li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.projects-hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

.projects-hero-note {
    color: var(--text-light);
    margin-bottom: 0;
}

.projects-hero-note a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.projects-gallery-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.projects-gallery-subtitle {
    color: var(--text-light);
    max-width: 60ch;
    margin-bottom: 0;
}

.projects-gallery-blurb {
    color: var(--text-light);
    margin-top: 0.35rem;
    max-width: 58ch;
}

.projects-gallery {
    margin-top: 70px;
}

.projects-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.projects-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-pill {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.filter-pill.is-active {
    background-color: var(--accent-alt);
    border-color: var(--accent-alt);
    color: #fff;
}

.filter-pill:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.project-tile.is-hidden {
    display: none;
}

.projects-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-md);
    max-width: 1400px;
    margin: 0 auto;
}

.project-tile {
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-tile:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.project-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
    border-color: var(--text);
}

.project-tile-image {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius-md) - 2px);
    border: 1px solid var(--border);
    background: var(--background-alt);
    aspect-ratio: 4 / 3;
}

.project-tile-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: var(--badge-bg);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1;
}

.project-tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-tile:hover .project-tile-image img {
    transform: scale(1.05);
}

.project-tile-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: var(--spacing-sm);
}

.project-tile-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
}

.project-tile-meta {
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.project-tile--placeholder {
    border-style: dashed;
    background: transparent;
    pointer-events: none;
}

.project-tile--placeholder:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}

.project-tile-image--placeholder {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.08),
        rgba(0, 0, 0, 0.08) 8px,
        transparent 8px,
        transparent 16px
    );
}

.projects-page.is-revealed .project-tile {
    animation: reveal-rise 0.6s ease forwards;
    opacity: 0;
}

.projects-page.is-revealed .project-tile.is-refreshing {
    animation: reveal-rise 0.5s ease forwards;
    animation-delay: var(--reveal-delay, 0s);
    opacity: 0;
    transform: translateY(12px);
}

.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(1) { animation-delay: 0.05s; }
.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(2) { animation-delay: 0.1s; }
.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(3) { animation-delay: 0.15s; }
.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(4) { animation-delay: 0.2s; }
.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(5) { animation-delay: 0.25s; }
.projects-page.is-revealed .project-tile:not(.is-refreshing):nth-child(6) { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    .projects-page.is-revealed .project-tile {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .project-tile.is-refreshing {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .project-tile:hover {
        transform: none;
    }

    .project-tile:hover .project-tile-image img {
        transform: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .filter-pill.is-active {
        background-color: #5b7adf;
        border-color: #5b7adf;
    }

    :root:not([data-theme="light"]) .projects-hero {
        background: linear-gradient(130deg, rgba(122, 162, 255, 0.14), rgba(0, 0, 0, 0));
    }

    :root:not([data-theme="light"]) .projects-hero::before {
        background: rgba(122, 162, 255, 0.2);
    }

    :root:not([data-theme="light"]) .projects-hero::after {
        border-color: rgba(122, 162, 255, 0.35);
    }

    :root:not([data-theme="light"]) .project-tile-image--placeholder {
        background-image: repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.1),
            rgba(255, 255, 255, 0.1) 8px,
            transparent 8px,
            transparent 16px
        );
    }
}

@media (max-width: 1024px) {
    .projects-hero-grid {
        grid-template-columns: 1fr;
    }

    .projects-hero-panel {
        order: 2;
    }

    .projects-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .projects-hero {
        margin-top: 60px;
        padding: var(--spacing-xl) 0;
    }

    .projects-gallery-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects-gallery {
        margin-top: 60px;
    }

    .projects-controls {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .projects-gallery-grid {
        grid-template-columns: 1fr;
    }
}
