/* ═══════════════════════════════════════════════════════════════════════════
   ESTILO DE TODO O SITE

   A identidade é a mesma do teu site no Squarespace: fundo branco, texto
   preto, fonte Roboto, sem maiúsculas forçadas.

   Partilhado pelas cinco páginas. Mudas aqui, muda em todas.
   Tudo o que define o aspeto está no bloco :root, logo a seguir.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');

:root {
  /* ---- Cores ---- */
  --fundo: #ffffff;          /* fundo das páginas */
  --tinta: #000000;          /* texto principal */
  --cinza: #6b6b6b;          /* texto secundário */
  --tom: #fafafa;            /* cinzento leve das secções */
  --linha: rgba(0, 0, 0, 0.12);

  /* ---- Tipografia ---- */
  --fonte: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --aperto: -0.02em;         /* espaçamento entre letras, como no Squarespace */

  /* ---- Medidas ---- */
  --largura: 1360px;
  --margem: 56px;
  --velocidade: 0.4s;
}

/* ───────────────────────────────────────────────────────────────────────────
   PÁGINA ESCURA
   A página do CV é escura. Basta pôr class="escuro" no <body> e todas as
   cores acima são trocadas — o cabeçalho e o rodapé acompanham.
   ─────────────────────────────────────────────────────────────────────────── */
body.escuro {
  --fundo: #0a0a0a;
  --tinta: #f1f0ec;
  --cinza: #86857f;
  --tom: #0a0a0a;
  --linha: rgba(255, 255, 255, 0.18);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fundo);
  color: var(--tinta);
  font-family: var(--fonte);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: var(--aperto);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.55; }

h1, h2 { margin: 0; font-weight: 400; letter-spacing: var(--aperto); }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--tinta); outline-offset: 3px; }

main { flex: 1 0 auto; }

.envolve {
  width: 100%;
  max-width: var(--largura);
  margin: 0 auto;
  padding-left: var(--margem);
  padding-right: var(--margem);
}

.salta {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--tinta);
  color: var(--fundo);
  font-size: 13px;
}
.salta:focus { left: 8px; top: 8px; }


/* ═══════════════════ CABEÇALHO ═══════════════════ */
.cabecalho {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--fundo);
  /*border-bottom: 1px solid var(--linha); */
}

.barra {
  padding-top: 26px;
  padding-bottom: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 40px;
  justify-content: space-between;
  align-items: center;
}

/* O teu nome, tal como no Squarespace: 28px, sem maiúsculas */
.marca {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: var(--aperto);
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  font-size: 14px;
  letter-spacing: var(--aperto);
}

.menu a {
  color: var(--tinta);
  opacity: 0.55;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}
.menu a:hover { opacity: 1; }

/* A página em que estás fica marcada. Faz-se com class="ativa" no link. */
.menu a.ativa {
  opacity: 1;
  border-bottom-color: var(--tinta);
}


/* ═══════════════════ ABERTURA DAS PÁGINAS ═══════════════════ */
.abertura {
  padding-top: 10px;
  padding-bottom: 0px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px 56px;
  align-items: baseline;
  justify-content: space-between;
}

.abertura h1 {
  flex: 1 1 400px;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.1;
}

.abertura .nota {
  flex: 0 1 380px;
  font-size: 15px;
  color: var(--cinza);
  line-height: 1.6;
}


/* ═══════════════════ GRELHA DE VÍDEOS ═══════════════════ */
.grelha {
  --colunas: 2;
  --espaco: 10px;
  --proporcao: 16 / 9;
  --escurecer: 0.6;
  --zoom: 1.03;

  display: grid;
  grid-template-columns: repeat(var(--colunas), minmax(0, 1fr));
  gap: var(--espaco);
}

.item {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: var(--proporcao);
  background: #111;
  cursor: pointer;
}
.item:hover { opacity: 1; }

.item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform calc(var(--velocidade) * 2) ease;
}

.sombra {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  opacity: 0;
  transition: opacity var(--velocidade) ease;
}

/* O texto fica sempre por cima da imagem, por isso é branco nas duas
   versões do site, clara e escura. */
.legenda {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 1.5em;
  text-align: center;
  color: #ffffff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--velocidade) ease, transform var(--velocidade) ease;
  pointer-events: none;
}

.legenda .titulo {
  width: 100%;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}

.legenda .subtitulo {
  font-size: 13px;
  opacity: 0.75;
}

.item:hover .sombra,
.item:focus-visible .sombra { opacity: var(--escurecer); }
.item:hover .legenda,
.item:focus-visible .legenda { opacity: 1; transform: none; }
.item:hover img,
.item:focus-visible img { transform: scale(var(--zoom)); }

/* No telemóvel não há rato: títulos sempre visíveis */
@media (hover: none) {
  .sombra { opacity: calc(var(--escurecer) * 0.5); }
  .legenda { opacity: 1; transform: none; }
}


/* ═══════════════════ GALERIA DE FOTOS ═══════════════════ */
.galeria {
  --espaco: 10px;
  --altura: 340px;   /* altura ideal de cada linha */
  display: flex;
  flex-wrap: wrap;
  gap: var(--espaco);
}

.moldura {
  /* Cada foto cresce em proporção à sua largura, por isso cada linha
     enche-se toda e nenhuma foto é cortada. */
  flex-grow: var(--r);
  flex-basis: calc(var(--r) * var(--altura));
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--tom);
  cursor: zoom-in;
  overflow: hidden;
}

.moldura img {
  width: 100%;
  aspect-ratio: var(--r);
  object-fit: cover;
  transition: opacity var(--velocidade) ease, transform calc(var(--velocidade) * 2) ease;
}

.moldura:hover img,
.moldura:focus-visible img { opacity: 0.85; transform: scale(1.02); }

/* Impede que a última linha estique as fotos de forma estranha */
.galeria::after { content: ''; flex-grow: 999999; flex-basis: 0; }


/* ═══════════════════ LIGHTBOX (vídeos e fotos) ═══════════════════
   A lightbox é sempre escura, nas duas versões do site. */
.lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 72px 88px;
  background: rgba(0, 0, 0, 0.95);
  color: #ffffff;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--velocidade) ease, visibility var(--velocidade) ease;
}
.lb.aberta { opacity: 1; visibility: visible; }

.lb-interior {
  margin: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: scale(0.98);
  transition: transform var(--velocidade) ease;
}
.lb.aberta .lb-interior { transform: none; }

/* Vídeo */
.lb-player {
  position: relative;
  width: min(1200px, 90vw, calc((100vh - 200px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
}
.lb-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Foto */
.lb-imagem {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  width: auto;
  object-fit: contain;
}

.lb-titulo,
.lb-legenda,
.lb-contador {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}
.lb-legenda:empty, .lb-titulo:empty { display: none; }

.lb-contador {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
}

.lb-botao {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 0;
  background: none;
  color: #ffffff;
  opacity: 0.65;
  cursor: pointer;
  appearance: none;
  z-index: 1;
}
.lb-botao:hover, .lb-botao:focus-visible { opacity: 1; }
.lb-botao svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; }

.lb-fechar { top: 16px; right: 16px; }
.lb-anterior { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-seguinte { right: 12px; top: 50%; transform: translateY(-50%); }


/* ═══════════════════ RODAPÉ ═══════════════════ */
.rodape {
  margin-top: 72px;
  padding-bottom: 48px;
}

.rodape .linha {
  padding-top: 24px;
  border-top: 1px solid var(--linha);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
  font-size: 14px;
  color: var(--cinza);
}


/* ═══════════════════ Footer ═══════════════════ */

.rodape-imagem {
  padding-bottom: 24px;
}

.rodape-imagem img {
  display: block;
  margin-inline: auto;
  width: 15%;
  height: auto;
}

/* ═══════════════════ TELEMÓVEL ═══════════════════ */
@media (max-width: 900px) {
  :root { --margem: 24px; }

  .barra { padding-top: 18px; padding-bottom: 18px; gap: 8px 24px; }
  .marca { font-size: 22px; }
  .menu { gap: 8px 20px; font-size: 13px; }

  .abertura { padding-top: 40px; padding-bottom: 40px; gap: 16px; }

  .grelha { --colunas: 1; }
  .galeria { --altura: 200px; }

  .lb { padding: 64px 16px 80px; }
  .lb-anterior { left: 2px; }
  .lb-seguinte { right: 2px; }

  .rodape { margin-top: 48px; }
  .rodape-imagem img { width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
