/* ==================================================
   PAGINA INDIVIDUAL DE PROJETO - /projetos/{slug}/
   ==================================================
   Escrito a mao e versionado (o HTML da pagina e que e gerado por
   scripts/prerender-projetos.js).

   REAPROVEITA, nao duplica:
   - /shared/cosmic-bg.css      fundo
   - /shared/navbar-site.css    navbar pill flutuante
   - /shared/page-header.css    .page-hero (espaco do navbar + h1)
   - /projetos/style.css        body, .spec-badge, .projeto-category, footer, .fab

   Aqui vive SO o que e exclusivo da pagina de projeto (prefixo .pg-).

   PROFUNDIDADE SEM MOLDURA (preferencia permanente do dono): nenhum card, bloco
   de midia ou caixa de info leva borda/outline externo. A hierarquia vem de
   fundo + sombra suave + radius 10-14px. Reguas horizontais INTERNAS sao ok.
   ================================================== */

/* ========== CABECALHO ========== */
.pg-head {
    padding-bottom: 6px;
}

.pg-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 14px;
}

.pg-breadcrumb a {
    color: #00D4FF;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pg-breadcrumb a:hover {
    color: #00FF88;
}

.pg-breadcrumb span[aria-hidden] {
    color: rgba(255, 255, 255, 0.25);
}

.pg-breadcrumb [aria-current] {
    color: rgba(255, 255, 255, 0.7);
    max-width: 42ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pg-head h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.45rem, 3.2vw, 2.05rem);
    line-height: 1.25;
    color: #fff;
    margin: 0 0 16px;
}

.pg-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ========== ESTRUTURA ========== */
.pg-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 24px 70px;
    position: relative;
    z-index: 2;
}

.pg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 38px;
    align-items: start;
}

/* ========== GALERIA ========== */
.pg-gallery {
    position: sticky;
    top: 116px;
    min-width: 0;
}

/* ZERO CLS: o palco reserva a area ANTES de qualquer foto chegar.
   A reserva mora aqui, no container, e nao em width/height na <img>: as fotos do portfolio
   tem orientacao variada e o Firestore nao guarda as dimensoes, entao chutar 4/3 na propria
   tag faria a imagem PULAR quando a proporcao real (retrato) substituisse o palpite —
   exatamente o defeito que se quer evitar. Com o palco fixo, retrato apenas fica
   pillarboxed (object-fit: contain) e nada na pagina se move. */
.pg-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
    aspect-ratio: 4 / 3;
}

.pg-media {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

.pg-media-image {
    cursor: zoom-in;
}

.pg-media[hidden] {
    display: none;
}

.pg-media-video {
    width: 100%;
    background: #05070a;
}

/* Miniaturas: sem moldura. Ativa = opacidade cheia + regua ciano embaixo. */
.pg-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding-bottom: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.5) transparent;
}

.pg-thumbs::-webkit-scrollbar {
    height: 5px;
}

.pg-thumbs::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 3px;
}

.pg-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    padding: 0;
    background: rgba(15, 23, 42, 0.7);
    border: none;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.pg-thumb:hover {
    opacity: 0.85;
}

.pg-thumb.is-active {
    opacity: 1;
    transform: translateY(-2px);
}

.pg-thumb.is-active::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 0;
    height: 2px;
    background: #00D4FF;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}

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

.pg-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

/* ========== COLUNA DE INFORMACOES ========== */
.pg-info {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.pg-block {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 14px;
    padding: 24px 26px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.pg-section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #00D4FF;
    margin: 0 0 18px;
    padding-bottom: 12px;
    /* Regua INTERNA (permitida) - separa o titulo do conteudo sem criar moldura */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pg-desc p {
    color: #d0d8e0;
    font-size: 1rem;
    line-height: 1.85;
    margin: 0 0 1.05em;
}

.pg-desc p:last-child {
    margin-bottom: 0;
}

/* Logo do cliente */
.pg-client {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pg-client img {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 5px;
}

.pg-client span {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

/* ========== CTA ========== */
.pg-cta {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.09), rgba(15, 23, 42, 0.6));
}

.pg-cta p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0 0 20px;
}

.pg-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.3);
}

.pg-cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(37, 211, 102, 0.45);
}

.pg-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: #00D4FF;
    font-size: 0.88rem;
    text-decoration: none;
    transition: gap 0.25s ease, color 0.25s ease;
}

.pg-back:hover {
    gap: 12px;
    color: #00FF88;
}

/* ========== RELACIONADOS ========== */
.pg-related {
    margin-top: 52px;
}

.pg-related .pg-section-title {
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 22px;
}

.pg-related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.pg-related-card {
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pg-related-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 38px rgba(0, 212, 255, 0.18);
}

.pg-related-thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: rgba(5, 7, 10, 0.6);
}

.pg-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.pg-related-card:hover .pg-related-thumb img {
    transform: scale(1.07);
}

.pg-related-info {
    padding: 14px 16px 16px;
}

.pg-related-info h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pg-related-info span {
    display: block;
    margin-top: 8px;
    font-size: 0.72rem;
    color: #00D4FF;
}

/* ========== LIGHTBOX (opcional - so com JS) ========== */
.pg-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: rgba(5, 7, 10, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--z-loading, 9999);
}

.pg-lightbox.is-open {
    display: flex;
}

.pg-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.pg-lightbox-close {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}

.pg-lightbox-close:hover {
    background: rgba(0, 212, 255, 0.25);
    transform: scale(1.08);
}

/* ==================================================
   RESPONSIVO
   ================================================== */

/* ----- Tablet ----- */
@media (max-width: 900px) {
    .pg-wrap {
        padding: 18px 20px 60px;
    }

    .pg-layout {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    /* Sticky nao faz sentido em coluna unica */
    .pg-gallery {
        position: static;
        top: auto;
    }

    .pg-block {
        padding: 22px;
    }

    .pg-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .pg-related {
        margin-top: 40px;
    }
}

/* ----- Mobile ----- */
@media (max-width: 600px) {
    .pg-wrap {
        padding: 14px 15px 50px;
    }

    .pg-breadcrumb {
        font-size: 0.78rem;
        gap: 6px;
    }

    .pg-breadcrumb [aria-current] {
        max-width: 18ch;
    }

    .pg-stage {
        padding: 8px;
        border-radius: 12px;
    }

    .pg-media {
        border-radius: 8px;
    }

    .pg-thumbs {
        gap: 8px;
        margin-top: 10px;
    }

    .pg-thumb {
        width: 56px;
        height: 56px;
    }

    .pg-block {
        padding: 18px 16px;
        border-radius: 12px;
    }

    .pg-section-title {
        font-size: 0.85rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .pg-desc p {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .pg-cta-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .pg-lightbox {
        padding: 16px;
    }

    .pg-lightbox-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
    }
}

/* ----- Mobile pequeno ----- */
@media (max-width: 380px) {
    .pg-head h1 {
        font-size: 1.15rem;
    }

    .pg-badges {
        gap: 6px;
    }

    .pg-thumb {
        width: 48px;
        height: 48px;
    }

    .pg-block {
        padding: 16px 14px;
    }

    .pg-desc p {
        font-size: 0.9rem;
    }

    /* Uma coluna: card relacionado ganha a largura toda */
    .pg-related-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- Touch: sem hover "grudado" ----- */
@media (hover: none) and (pointer: coarse) {
    .pg-related-card:hover {
        transform: none;
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    }

    .pg-related-card:active {
        transform: scale(0.985);
    }

    .pg-cta-btn:hover {
        transform: none;
    }

    .pg-cta-btn:active {
        transform: scale(0.98);
    }
}
