/* ============================================================
   BARREIRO RIO — Construção Civil
   Folha de estilos principal
   Estilo: minimalista / editorial, verde #237c4d sobre branco
   ============================================================ */

/* ------------------------------------------------------------
   1. RESET E VARIÁVEIS GLOBAIS
   ------------------------------------------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* --- Paleta da marca --- */
    --verde: #237c4d;          /* cor principal */
    --verde-escuro: #1b5f3b;   /* hover dos elementos verdes */
    --preto: #141414;          /* texto principal */
    --cinza: #6f6f6f;          /* texto secundário */
    --linha: #e6e6e6;          /* linhas finas de separação */
    --branco: #ffffff;         /* fundo base */

    /* --- Medidas --- */
    --largura-sidebar: 260px;
    --espaco-lateral: clamp(1.25rem, 5vw, 4.5rem); /* respiro lateral */
    --transicao: 0.25s ease;
}

/* Seleção de texto na cor da marca (micro-detalhe) */
::selection {
    background: var(--verde);
    color: var(--branco);
}

/* ------------------------------------------------------------
   SCROLLBAR PERSONALIZADA (estilo Barreiro Rio)
   Igual à do site www.grupobarreirorio.pt: verde, fina e
   arredondada, com trilho transparente.
   ------------------------------------------------------------ */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--verde) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--verde);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--verde-escuro);
    background-clip: padding-box;
}

/* ------------------------------------------------------------
   2. BASE TIPGRÁFICA
   Contraste de pesos: títulos pesados, corpo leve e arejado
   ------------------------------------------------------------ */
html {
    scroll-behavior: smooth; /* navegação suave entre secções */
}

body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.7;
    color: var(--preto);
    background: var(--branco);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

img, video {
    max-width: 100%;
    display: block;
}

/* ------------------------------------------------------------
   3. NAVBAR LATERAL FIXA
   Branca, linha fina à direita, botão Contacto fixo na base
   ------------------------------------------------------------ */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;              /* colado ao lado esquerdo */
    width: var(--largura-sidebar);
    background: var(--branco);
    border-right: 1px solid var(--linha);
    display: flex;
    flex-direction: column;
    padding: 2.25rem 0 2rem;
    z-index: 100;
}

/* --- Logótipo (centrado na navbar) --- */
.brand {
    display: block;
    padding: 0 2.25rem 2rem;
    border-bottom: 1px solid var(--linha);
    text-align: center;
}

.logo-img {
    height: 96px;          /* altura do logótipo na navbar */
    width: auto;
    margin: 0 auto;        /* centra a imagem block na navbar */
}

/* --- Links do menu --- */
.menu {
    list-style: none;
    margin-top: 1.75rem;
}

.menu a {
    position: relative;
    display: block;
    padding: 0.65rem 2.25rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--cinza);
    transition: color var(--transicao), padding-left var(--transicao);
}

/* Traço verde que cresce no link ativo/hover (micro-detalhe) */
.menu a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--verde);
    transition: height var(--transicao);
}

.menu a:hover {
    color: var(--verde);
    padding-left: 2.6rem;
}

.menu a.active {
    color: var(--verde);
    font-weight: 700;
}

.menu a.active::before,
.menu a:hover::before {
    height: 60%;
}

/* ------------------------------------------------------------
   4. BOTÃO DE MENU + OVERLAY (só em ecrãs pequenos)
   ------------------------------------------------------------ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    width: 44px;
    height: 44px;
    background: var(--branco);
    border: 1px solid var(--linha);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--preto);
    transition: transform var(--transicao), opacity var(--transicao);
}

/* Transforma o ícone num X quando o menu está aberto */
.menu-toggle.ativo span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.ativo span:nth-child(2) { opacity: 0; }
.menu-toggle.ativo span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(20, 20, 20, 0.45);
    opacity: 0;
    pointer-events: none;   /* invisível = não bloqueia cliques */
    transition: opacity var(--transicao);
}

.sidebar-overlay.visivel {
    opacity: 1;
    pointer-events: auto;
}

/* ------------------------------------------------------------
   5. ESTRUTURA DAS SECÇÕES
   ------------------------------------------------------------ */
.conteudo {
    margin-left: var(--largura-sidebar);
}

.conteudo section {
    padding: clamp(4rem, 9vh, 7rem) var(--espaco-lateral);
    max-width: 1280px;
}

/* --- Cabeçalho padrão: número + título + linha fina --- */
.sec-topo {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}

.sec-topo h2 {
    font-size: clamp(1.9rem, 3.2vw, 2.7rem);
}

.sec-linha {
    flex: 1;
    height: 1px;
    background: var(--linha);
    align-self: center;
}

/* ------------------------------------------------------------
   6. HERO (INÍCIO) — vídeo de fundo, conteúdo à esquerda
   ------------------------------------------------------------ */
.hero {
    position: relative;
    min-height: 72vh;
    max-width: none !important;   /* hero ocupa sempre toda a largura */
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--preto);
    padding: 0 var(--espaco-lateral) !important;
}

.hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 13, 0.55); /* escurece o vídeo p/ leitura */
}

.hero-conteudo {
    position: relative;
    z-index: 1;
    max-width: 720px;
    color: var(--branco);
}

.hero-etiqueta {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-size: clamp(2.3rem, 5.5vw, 4.2rem);
    margin-bottom: 1.5rem;
}

.hero-descricao {
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 2.5rem;
}

/* Botões do hero: contorno branco + link de texto */
.hero-acoes {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: all var(--transicao);
}

.btn-contorno {
    padding: 0.95rem 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: var(--branco);
    border-radius: 2px;
}

.btn-contorno:hover {
    background: var(--branco);
    color: var(--preto);
}

.btn-texto {
    color: rgba(255, 255, 255, 0.85);
}

.btn-texto:hover {
    color: var(--branco);
}

/* ------------------------------------------------------------
   7. SOBRE NÓS — grelha assimétrica texto/pontos-chave
   ------------------------------------------------------------ */
.sobre-grelha {
    display: grid;
    grid-template-columns: 1fr;   /* texto em cima, pontos em baixo */
    gap: clamp(2.5rem, 6vh, 4rem);
}

.texto-destaque {
    font-size: clamp(1.15rem, 1.8vw, 1.45rem);
    font-weight: 300;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.sobre-texto p:last-child {
    color: var(--cinza);
    max-width: 56ch;
}

/* Pontos-chave lado a lado (horizontal), por baixo do texto */
.pontos-chave {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 colunas iguais */
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.pontos-chave li {
    padding-top: 1.4rem;
    border-top: 1px solid var(--linha); /* linha fina no topo de cada */
}

.ponto-num {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--verde);
    padding-top: 0.35em;
}

.pontos-chave h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.pontos-chave li p {
    font-size: 0.92rem;
    color: var(--cinza);
}

/* ------------------------------------------------------------
   8. SERVIÇOS E DETALHES — lista numerada + etapas de trabalho
   ------------------------------------------------------------ */
.servicos-grelha {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: clamp(2.5rem, 6vw, 5.5rem);
    align-items: start;
}

.servicos-intro .texto-destaque {
    margin-bottom: 0;
}

/* Lista de serviços: número verde + título + descrição curta */
.serv-lista {
    list-style: none;
}

.serv-lista li {
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    column-gap: 1rem;
    padding: 1.35rem 0;
    border-top: 1px solid var(--linha);
}

.serv-lista li:last-child {
    border-bottom: 1px solid var(--linha);
}

.serv-lista h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.serv-lista li p {
    font-size: 0.92rem;
    color: var(--cinza);
}

/* Etapas de trabalho: 4 colunas separadas por linhas finas */
.passos {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    margin-top: clamp(3rem, 7vh, 5rem);
}

.passos li {
    border-top: 1px solid var(--preto); /* traço forte a marcar o início */
    padding-top: 1.1rem;
}

.passo-num {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--verde);
    margin-bottom: 0.35rem;
}

.passos h3 {
    font-size: 0.98rem;
    margin-bottom: 0.25rem;
}

.passos li p {
    font-size: 0.9rem;
    color: var(--cinza);
}

/* ------------------------------------------------------------
   9. FOTOGALERIA — seletor de projeto + galeria orgânica + vídeo
   ------------------------------------------------------------ */
/* Dropdown para escolher o projeto a visualizar */
.galeria-filtro {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    position: relative;
    z-index: 60;
}

.galeria-filtro-rotulo {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cinza);
}

/* --- Custom Dropdown (estilo Barreiro Rio) --- */
.galeria-dropdown {
    position: relative;
    flex: 1 1 260px;
    max-width: 420px;
    z-index: 60;
}

.galeria-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--preto);
    background: var(--branco);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color var(--transicao), box-shadow var(--transicao);
    text-align: left;
}

.galeria-dropdown .dropdown-toggle:hover,
.galeria-dropdown .dropdown-toggle:focus {
    border-color: var(--preto);
    outline: none;
}

.galeria-dropdown .dropdown-toggle[aria-expanded="true"] {
    border-color: var(--verde);
    box-shadow: 0 0 0 2px rgba(35, 124, 77, 0.15);
}

.galeria-dropdown .dropdown-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.galeria-dropdown .dropdown-arrow {
    flex-shrink: 0;
    margin-left: 0.75rem;
    font-size: 0.65rem;
    color: var(--cinza);
    transition: transform var(--transicao);
}

.galeria-dropdown .dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.galeria-dropdown .dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 70;
    list-style: none;
    background: var(--branco);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
    padding: 0;
}

.galeria-dropdown .dropdown-menu.aberto {
    max-height: 300px;
    opacity: 1;
    pointer-events: auto;
    padding: 0.35rem 0;
    overflow-y: auto;
}

.galeria-dropdown .dropdown-menu li {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--preto);
    cursor: pointer;
    transition: background var(--transicao), color var(--transicao);
}

.galeria-dropdown .dropdown-menu li:hover {
    background: rgba(35, 124, 77, 0.06);
    color: var(--verde);
}

.galeria-dropdown .dropdown-menu li.selected {
    color: var(--verde);
    font-weight: 600;
}

/* --- Custom Dropdown do formulário (indicativo do país) ---
   Mesmo estilo do dropdown da galeria (em comum, abrem para baixo) */
.campo-indicativo-wrap {
    position: relative;
    flex: 0 0 auto;
    z-index: 60;
}

.campo-indicativo-wrap .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.72rem 0.85rem;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--verde);
    background-color: var(--branco);
    border: 1px solid var(--linha);
    border-radius: 2px;
    cursor: pointer;
    transition: border-color var(--transicao), box-shadow var(--transicao);
    white-space: nowrap;
}

.campo-indicativo-wrap .dropdown-toggle:hover {
    border-color: var(--verde);
}

.campo-indicativo-wrap .dropdown-toggle:focus,
.campo-indicativo-wrap .dropdown-toggle[aria-expanded="true"] {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 2px rgba(35, 124, 77, 0.15);
}

.campo-indicativo-wrap .dropdown-arrow {
    font-size: 0.6rem;
    color: var(--verde);
    transition: transform var(--transicao);
}

.campo-indicativo-wrap .dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.campo-indicativo-wrap .dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    z-index: 70;
    list-style: none;
    background: var(--branco);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
    padding: 0;
}

.campo-indicativo-wrap .dropdown-menu.aberto {
    max-height: 300px;
    opacity: 1;
    pointer-events: auto;
    padding: 0.35rem 0;
    overflow-y: auto;
}

.campo-indicativo-wrap .dropdown-menu li {
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
    color: var(--preto);
    cursor: pointer;
    transition: background var(--transicao), color var(--transicao);
    white-space: nowrap;
}

.campo-indicativo-wrap .dropdown-menu li:hover {
    background: rgba(35, 124, 77, 0.06);
    color: var(--verde);
}

.campo-indicativo-wrap .dropdown-menu li.selected {
    color: var(--verde);
    font-weight: 600;
}

/* Mensagem antes de escolher um projeto */
.galeria-vazio {
    color: var(--cinza);
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

/* Título do projeto selecionado */
.galeria-titulo {
    margin: 0 0 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.galeria {
    columns: 3;
    column-gap: 14px;
}

.g-item {
    position: relative;
    display: block;
    break-inside: avoid;       /* cada foto fica inteira numa coluna */
    margin-bottom: 14px;
    overflow: hidden;
    text-decoration: none;
    background: #fafafa;       /* visível enquanto a foto carrega */
}

.g-item img {
    width: 100%;
    transition: transform 0.6s ease, filter 0.6s ease;
}

/* Zoom suave + legenda ao passar o rato */
.g-item:hover img {
    transform: scale(1.03);
    filter: brightness(0.75);
}

.g-legenda {
    position: absolute;
    left: 1rem;
    bottom: 0.85rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--branco);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity var(--transicao), transform var(--transicao);
}

.g-item:hover .g-legenda {
    opacity: 1;
    transform: translateY(0);
}

/* --- "Subpasta" — azulejo pasta na 6.ª posição (ver mais fotos) ---
   Tem as mesmas dimensões das outras fotos (imagem de capa de largura
   cheia) com uma contagem "+N" sobreposta. */
.g-subpasta {
    position: relative;
    display: block;
    break-inside: avoid;
    margin-bottom: 14px;
    overflow: hidden;
    cursor: pointer;
}

.g-subpasta img {
    width: 100%;
    display: block;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.g-subpasta:hover img {
    transform: scale(1.03);
    filter: brightness(0.75);
}

.g-subpasta-contagem {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--branco);
    background: rgba(0, 0, 0, 0.55);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: background var(--transicao);
}

.g-subpasta:hover .g-subpasta-contagem {
    background: rgba(0, 0, 0, 0.35);
}

/* --- Vídeo incorporado --- */
.video-bloco {
    margin-top: 14px;
}

.video-bloco video {
    width: 100%;
    background: var(--preto);
}

.video-bloco figcaption {
    margin-top: 0.75rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cinza);
}

/* ------------------------------------------------------------
   9. CONTACTO — info direta + formulário minimalista
   ------------------------------------------------------------ */
.contacto-grelha {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(2.5rem, 6vw, 5.5rem);
    /* estica o mapa até à altura do formulário */
    align-items: stretch;
}

/* Telefone + email em linha horizontal, por baixo do título */
.contacto-linha {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(2rem, 5vw, 4.5rem);
    margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.info-bloco {
    padding: 1.1rem 0;
    border-top: 1px solid var(--linha);
}

.info-bloco:last-of-type {
    border-bottom: 1px solid var(--linha);
}

.info-etiqueta {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cinza);
    margin-bottom: 0.2rem;
}

.info-valor {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--preto);
    text-decoration: none;
    transition: color var(--transicao);
}

.info-valor:hover {
    color: var(--verde);
}

/* --- Formulário: campos só com linha inferior --- */
.contacto-form label {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cinza);
    margin: 1.6rem 0 0.15rem;
}

/* O primeiro campo ("Nome") alinha com o topo do mapa */
.contacto-form label:first-child {
    margin-top: 0;
}

/* Campo telemóvel: indicativo (dropdown) + número lado a lado */
.campo-telefone {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.campo-telefone input {
    flex: 1;
}

.contacto-form input,
.contacto-form textarea {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--linha);
    background: transparent;
    font: inherit;
    color: var(--preto);
    padding: 0.6rem 0;
    resize: vertical;
    transition: border-color var(--transicao);
}

.contacto-form input:focus,
.contacto-form textarea:focus {
    outline: none;
    border-bottom-color: var(--verde);
}

.btn-enviar {
    width: 100%;              /* mesma largura dos campos do formulário */
    margin-top: 2.25rem;
    padding: 0.95rem;
    background: var(--verde);
    color: var(--branco);
    border: none;
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transicao);
}

.btn-enviar:hover {
    background: var(--verde-escuro);
}

/* --- Mapa do Google: acompanha a altura do formulário --- */
.contacto-mapa {
    border: 1px solid var(--linha);
    overflow: hidden;
}

.contacto-mapa iframe {
    display: block;
    width: 100%;
    height: 100%;
}

/* ------------------------------------------------------------
   10. RODAPÉ
   ------------------------------------------------------------ */
.rodape {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 2rem var(--espaco-lateral) 2.5rem;
    border-top: 1px solid var(--linha);
    font-size: 0.78rem;
    color: var(--cinza);
}

/* ------------------------------------------------------------
   11. LIGHTBOX — foto ampliada
   ------------------------------------------------------------ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(10, 10, 10, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transicao);
}

/* IMPORTANTE: quando tem o atributo hidden, o lightbox não pode
   aparecer nem bloquear os cliques da página (o display:flex
   acima anularia o hidden por defeito do browser). */
.lightbox[hidden] {
    display: none;
}

.lightbox.aberto {
    opacity: 1;
}

.lb-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(1100px, 86vw);
    height: 80vh;
    max-width: 86vw;
    max-height: 80vh;
}

.lb-figure img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
}

.lb-figure figcaption {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

/* Botões de fechar/navegar: caracteres tipográficos simples */
.lightbox button {
    position: absolute;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem;
    transition: color var(--transicao);
}

.lightbox button:hover {
    color: var(--branco);
}

.lb-fechar   { top: 1.25rem; right: 1.75rem; font-size: 2.8rem; }
.lb-anterior { left: 1.5rem;  top: 50%; transform: translateY(-50%); }
.lb-seguinte { right: 1.5rem; top: 50%; transform: translateY(-50%); }

/* ------------------------------------------------------------
   11b. MODAL SUBPASTA — todas as fotos restantes de um projeto
   ------------------------------------------------------------ */
.extra-modal {
    position: fixed;
    inset: 0;
    z-index: 450;
    background: rgba(10, 10, 10, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity var(--transicao);
}

.extra-modal[hidden] {
    display: none;
}

.extra-modal.aberto {
    opacity: 1;
}

.extra-caixa {
    position: relative;
    width: min(1000px, 100%);
    max-height: 90vh;
    background: var(--branco);
    border-radius: 2px;
    padding: 2.5rem 1.5rem 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.extra-fechar {
    position: absolute;
    top: 0.6rem;
    right: 1.1rem;
    background: none;
    border: none;
    font-size: 2.2rem;
    line-height: 1;
    color: var(--cinza, #666);
    cursor: pointer;
    transition: color var(--transicao);
}

.extra-fechar:hover {
    color: var(--preto);
}

.extra-titulo {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-right: 2.5rem;
}

.extra-grelha {
    columns: 3;
    column-gap: 14px;
    overflow-y: auto;
    padding: 2px;
}

.extra-grelha .g-item {
    position: relative;
    display: block;
    break-inside: avoid;
    margin-bottom: 14px;
    overflow: hidden;
    text-decoration: none;
    background: #fafafa;
}

.extra-grelha .g-item img {
    width: 100%;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.extra-grelha .g-item:hover img {
    transform: scale(1.03);
    filter: brightness(0.75);
}

/* ------------------------------------------------------------
   12. MODAL WHATSAPP — escolha entre Web e Aplicação
   ------------------------------------------------------------ */
.wa-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(10, 10, 10, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity var(--transicao);
}

/* Igual ao lightbox: hidden tem de ganhar ao display:flex */
.wa-modal[hidden] {
    display: none;
}

.wa-modal.aberto {
    opacity: 1;
}

.wa-caixa {
    position: relative;
    width: min(400px, 100%);
    background: var(--branco);
    padding: 2.5rem 2rem 2rem;
    border-radius: 2px;
}

.wa-caixa h3 {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.wa-texto {
    font-size: 0.9rem;
    color: var(--cinza);
    margin-bottom: 1.75rem;
}

/* As duas opções de abertura */
.wa-opcao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem;
    margin-top: 0.75rem;
    border-radius: 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all var(--transicao);
}

/* Opção principal: WhatsApp Web, na cor da marca */
.wa-opcao-web {
    background: var(--verde);
    color: var(--branco);
}

.wa-opcao-web:hover {
    background: var(--verde-escuro);
}

/* Opção secundária: aplicação, em contorno */
.wa-opcao-app {
    border: 1px solid var(--linha);
    color: var(--preto);
}

.wa-opcao-app:hover {
    border-color: var(--verde);
    color: var(--verde);
}

/* X de fechar no canto */
.wa-fechar {
    position: absolute;
    top: 0.6rem;
    right: 0.9rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--cinza);
    cursor: pointer;
    transition: color var(--transicao);
}

.wa-fechar:hover {
    color: var(--preto);
}

/* ------------------------------------------------------------
   13. ANIMAÇÃO DE ENTRADA (aplicada pelo JS ao fazer scroll)
   ------------------------------------------------------------ */
.animar {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animar.visivel {
    opacity: 1;
    transform: translateY(0);
}

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .animar { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------
   14. RESPONSIVIDADE
   ------------------------------------------------------------ */

/* Tablet: galeria a 2 colunas, grelhas passam a 1 coluna */
@media (max-width: 1024px) {
    .galeria { columns: 2; }
}

@media (max-width: 900px) {

    /* Sidebar sai fora do ecrã; entra com a classe .aberta */
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transicao);
    }

    .sidebar.aberta {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.12);
    }

    .menu-toggle {
        display: flex;
    }

    /* O conteúdo passa a ocupar todo o ecrã */
    .conteudo {
        margin-left: 0;
    }

    .sobre-grelha,
    .contacto-grelha,
    .servicos-grelha {
        grid-template-columns: 1fr;
    }

    /* No telemóvel o mapa passa a altura fixa (não quadrado) */
    .contacto-mapa {
        aspect-ratio: auto;
        height: 320px;
    }

    /* Pontos-chave voltam a empilhar no telemóvel/tablete */
    .pontos-chave {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .passos {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modal "subpasta": mesmas colunas da galeria em tablet-telemóvel */
@media (max-width: 1024px) {
    .extra-grelha { columns: 2; }
}

/* Telemóvel: galeria a 1 coluna */
@media (max-width: 560px) {
    .galeria { columns: 1; }

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

    .extra-grelha { columns: 1; }
}
