/* ============================================
   Portfolio — Grid, filtri, card dettaglio
   ============================================ */

/* ---- PROJECT HERO (pagina dettaglio) ---- */
.project-hero {
    background: var(--color-charcoal);
    padding: clamp(var(--space-16), 10vw, var(--space-24)) 0 clamp(var(--space-12), 6vw, var(--space-20));
    text-align: center;
    position: relative;
    overflow: hidden;
}

.project-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 60% at 50% 100%, rgba(89,176,49,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.project-hero .container {
    position: relative;
}

.project-hero__cat {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-green-light);
    background: rgba(89,176,49,0.15);
    border: 1px solid rgba(89,176,49,0.3);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-5);
}

.project-hero__title {
    font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
    font-weight: 800;
    color: var(--color-white);
    line-height: 1.15;
    margin-bottom: var(--space-5);
    letter-spacing: -0.02em;
}

.project-hero__sub {
    font-size: clamp(var(--text-base), 2vw, var(--text-lg));
    color: rgba(255,255,255,0.65);
    max-width: 55ch;
    margin-inline: auto;
    line-height: 1.7;
    margin-bottom: var(--space-8);
}

.project-hero__actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* Breadcrumb dentro l'header scuro */
.project-hero .breadcrumb {
    justify-content: center;
    margin-bottom: var(--space-6);
}

.project-hero .breadcrumb a,
.project-hero .breadcrumb__sep,
.project-hero .breadcrumb span {
    color: rgba(255,255,255,0.5);
}

.project-hero .breadcrumb a:hover {
    color: var(--color-green-light);
}

/* ---- HEADER ---- */
.portfolio-header {
    background: var(--color-charcoal);
    padding: clamp(var(--space-16), 12vw, var(--space-24)) 0 clamp(var(--space-10), 6vw, var(--space-16));
    text-align: center;
    position: relative;
    overflow: hidden;
}

.portfolio-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 70% at 50% 100%, rgba(89,176,49,0.07) 0%, transparent 70%);
    pointer-events: none;
}

.portfolio-header .breadcrumb {
    justify-content: center;
    margin-bottom: var(--space-6);
}

.portfolio-header .breadcrumb a,
.portfolio-header .breadcrumb__sep,
.portfolio-header .breadcrumb span {
    color: rgba(255,255,255,0.5);
}

.portfolio-header .breadcrumb a:hover {
    color: var(--color-green-light);
}

.portfolio-header h1 {
    color: var(--color-white);
    margin-bottom: var(--space-5);
}

.portfolio-header p {
    color: rgba(255,255,255,0.65);
    font-size: var(--text-lg);
    max-width: 50ch;
    margin-inline: auto;
    line-height: 1.7;
}

/* ---- FILTRI CATEGORIA ---- */
.portfolio-filters {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-8) 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 64px; /* altezza nav */
    z-index: var(--z-sticky);
}

.filter-btn {
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-5);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-mid);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.filter-btn.active {
    background: var(--color-charcoal);
    border-color: var(--color-charcoal);
    color: var(--color-white);
}

/* ---- GRIGLIA PORTFOLIO ---- */
.portfolio-section {
    background: var(--color-bg);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-6);
    padding-top: var(--space-2);
}

/* ---- PROJECT CARD ---- */
.project-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    position: relative;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: transparent;
    transform: translateY(-6px);
}

/* Screenshot / placeholder */
.project-card__thumb {
    aspect-ratio: 16/9;
    background: var(--color-charcoal);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.project-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-card__thumb img {
    transform: scale(1.04);
}

/* Placeholder quando non c'è immagine */
.project-card__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a2a2a 0%, var(--color-charcoal) 100%);
}

.project-card__thumb--placeholder::before {
    content: attr(data-initials);
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: rgba(89,176,49,0.4);
    letter-spacing: -0.02em;
}

/* Overlay hover */
.project-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(68,68,68,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-card__overlay {
    opacity: 1;
}

.project-card__overlay-btn {
    background: var(--color-white);
    color: var(--color-charcoal);
    border: none;
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-5);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.project-card__overlay-btn:hover {
    background: var(--color-green);
    color: var(--color-white);
}

.project-card__overlay-btn--outline {
    background: transparent;
    color: var(--color-white);
    border: 1.5px solid rgba(255,255,255,0.5);
}

.project-card__overlay-btn--outline:hover {
    background: var(--color-white);
    color: var(--color-charcoal);
    border-color: var(--color-white);
}

/* Categoria badge sull'immagine */
.project-card__cat {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    background: rgba(0,0,0,0.65);
    color: rgba(255,255,255,0.85);
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-heading);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    letter-spacing: 0.06em;
}

/* Contenuto card */
.project-card__body {
    padding: var(--space-6);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card__title {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-charcoal);
    margin-bottom: var(--space-2);
    line-height: 1.3;
}

.project-card__desc {
    font-size: var(--text-sm);
    color: var(--color-text-mid);
    line-height: 1.65;
    flex: 1;
    margin-bottom: var(--space-4);
}

.project-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: auto;
}

.project-card__tag {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-heading);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* ---- MODALE PROGETTO ---- */
.project-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.project-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.project-modal {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
    scrollbar-width: thin;
}

.project-modal-backdrop.open .project-modal {
    transform: translateY(0) scale(1);
}

.project-modal__header {
    position: sticky;
    top: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1;
}

.project-modal__close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--color-bg);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-charcoal);
    transition: background var(--transition);
    line-height: 1;
}

.project-modal__close:hover {
    background: var(--color-border);
}

.project-modal__thumb {
    aspect-ratio: 16/9;
    background: var(--color-charcoal);
    overflow: hidden;
}

.project-modal__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-modal__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a2a2a 0%, var(--color-charcoal) 100%);
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 800;
    color: rgba(89,176,49,0.3);
}

.project-modal__body {
    padding: var(--space-8);
}

.project-modal__cat {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-green);
    margin-bottom: var(--space-3);
}

.project-modal__title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--color-charcoal);
    margin-bottom: var(--space-5);
}

.project-modal__desc {
    font-size: var(--text-base);
    color: var(--color-text-mid);
    line-height: 1.8;
    margin-bottom: var(--space-6);
}

.project-modal__tech-label {
    font-size: var(--text-xs);
    font-weight: 700;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-charcoal);
    margin-bottom: var(--space-3);
}

.project-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-7);
}

.project-modal__tag {
    background: var(--color-charcoal);
    color: rgba(255,255,255,0.85);
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-heading);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.04em;
}

.project-modal__actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* ---- EMPTY STATE ---- */
.portfolio-empty {
    text-align: center;
    padding: var(--space-16) var(--space-4);
    color: var(--color-text-light);
    grid-column: 1 / -1;
}

.portfolio-empty p {
    font-size: var(--text-lg);
    margin-top: var(--space-3);
}

/* ---- HIDE FILTERED ---- */
.project-card.hidden {
    display: none;
}

/* ---- PAGINA DETTAGLIO PROGETTO ---- */
.project-detail {
    background: var(--color-bg);
}

.project-detail__layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: clamp(var(--space-8), 5vw, var(--space-16));
    align-items: start;
}

/* Screenshot principale */
.project-detail__screenshot {
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #2a2a2a 0%, var(--color-charcoal) 100%);
    margin-bottom: var(--space-10);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-detail__screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-detail__screenshot-placeholder {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 800;
    color: rgba(89,176,49,0.35);
    letter-spacing: -0.03em;
}

/* Descrizione */
.project-detail__section-label {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-green);
    margin-bottom: var(--space-4);
    display: block;
}

.project-detail__desc {
    font-size: var(--text-lg);
    line-height: 1.8;
    color: var(--color-text-mid);
    margin-bottom: var(--space-10);
}

.project-detail__desc p {
    margin-bottom: var(--space-4);
}

/* Tech tags */
.project-detail__tech {
    margin-bottom: var(--space-10);
}

.project-detail__tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.project-detail__tech-tag {
    background: var(--color-charcoal);
    color: rgba(255,255,255,0.85);
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-heading);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

/* Sidebar */
.project-detail__sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.project-detail__info-box {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.project-detail__info-box h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--color-charcoal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-5);
}

.project-detail__info-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.project-detail__info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-detail__info-label {
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.project-detail__info-value {
    font-size: var(--text-sm);
    color: var(--color-charcoal);
    font-weight: 500;
}

.project-detail__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.project-detail__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--color-text-mid);
    text-decoration: none;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    border: 1.5px solid var(--color-border);
    transition: all var(--transition);
}

.project-detail__back:hover {
    border-color: var(--color-charcoal);
    color: var(--color-charcoal);
    background: var(--color-bg);
}

/* ---- RESPONSIVE DETAIL ---- */
@media (max-width: 900px) {
    .project-detail__layout {
        grid-template-columns: 1fr;
    }
    .project-detail__sidebar {
        position: static;
    }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .portfolio-filters {
        position: static;
        padding: var(--space-5) var(--space-4);
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .project-modal__body {
        padding: var(--space-5);
    }
}
