/* NM VISUALS V2 — GUIA DE EDIÇÃO: procurar por «CAPA PRINCIPAL», «SECÇÕES», «CAPAS» ou «CONTACTOS». */

/* 01 · VARIÁVEIS GERAIS — fonte do site, cores e espaçamento */
:root {
  --ink: #191919;
  --paper: #eceee9;
  --accent: #504638;
  --gap: 3px;
  --font: Montserrat,Arial,sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
  object-fit: cover;
}

button {
  font: inherit;
}

/* 02 · CAPA PRINCIPAL — imagem de fundo e altura */
.hero {
  min-height: clamp(550px,82vh,850px);
  position: relative;
  display: flex;
  align-items: center;
  color: #fff;
  background: #242424 url("../images/head/head_2.jpg") center/cover no-repeat;
}

.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,rgba(0,0,0,.76),rgba(0,0,0,.26) 70%);
}

/* CAPA PRINCIPAL — transição entre head_2.jpg e head_1.jpg.
   A quadrícula anima apenas a fotografia; o gradiente e os textos ficam fixos. */
.hero-mosaic {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  pointer-events: none;
}
.hero-mosaic-tile {
  opacity: 0;
  background-repeat: no-repeat;
  background-size: 1200% 700%;
  transition: opacity 360ms ease-in-out;
}
.hero::before { z-index: 1; pointer-events: none; }
.hero-content { z-index: 2; }

/* CAPA PRINCIPAL — posição do conjunto de textos */
.hero-content {
  position: relative;
  margin-left: 8.3%;
  max-width: 760px;
}

/* CAPA PRINCIPAL — nome «NELSON MARTINS» */
.hero-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .16em;
  margin: 0;
}

/* CAPA PRINCIPAL — texto pequeno acima do título */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
}

/* CAPA PRINCIPAL — TÍTULO GRANDE: tamanho, entrelinha e espaçamento */
.hero h1 {
  font-size: clamp(46px,5.7vw,84px);
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 24px 0;
}

/* CAPA PRINCIPAL — peso das palavras destacadas no título */
.hero h1 strong {
  font-weight: 700;
}

/* CAPA PRINCIPAL — parágrafo de apresentação */
.hero-copy {
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: .025em;
  max-width: 680px;
}

/* HOME — 3D HIGHLIGHTS: duas filas quadradas, sem esticar imagens. */
.home-highlights {
  --highlight-columns: 16;
  --highlight-size: 100px;
  display: grid;
  grid-template-columns: repeat(var(--highlight-columns),minmax(0,1fr));
  grid-auto-rows: var(--highlight-size);
  gap: 2px;
  width: 100%;
  overflow: hidden;
  background: #111;
  color: #fff;
  border-top: 3px solid #111;
  border-bottom: 3px solid #111;
}

/* MINI-GALERIA — pré-visualização ao passar o rato (650 px no lado maior). */
.home-highlights-preview {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  padding: 3px;
  background: #fff;
  box-shadow: 0 2px 12px rgb(0 0 0 / 18%);
  pointer-events: none;
  transform: translate(-50%, -100%);
}
.home-highlights-preview[hidden] { display: none; }
.home-highlights-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(650px, calc(100vw - 30px));
  max-height: min(650px, calc(100vh - 30px));
  object-fit: contain;
}
.home-highlights-preview::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--preview-arrow-x, 50%);
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: #fff;
}
.home-highlights-preview.is-below {
  transform: translate(-50%, 0);
}
.home-highlights-preview.is-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #fff;
}
@media (hover: none) {
  .home-highlights-preview { display: none; }
}

/* MINI-GALERIA — título «3D HIGHLIGHTS» */
.home-highlights-label {
  grid-column: span 3;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: clamp(15px,1.5vw,27px);
  font-weight: 400;
  white-space: nowrap;
  background: #080808;
}

.home-highlights-track {
  display: contents;
}

.home-highlights-track img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  cursor: pointer;
  background: #111;
}

.home-highlights-track img:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.section {
  padding: 0 0 0;
  background: var(--paper);
}

.section:nth-of-type(even) {
  background: #1d1d1d;
  color: #fff;
}

/* 03 · SECÇÕES — espaço e disposição dos cabeçalhos */
.section-intro {
  min-height: 310px;
  padding: 66px 11% 55px;
  display: grid;
  grid-template-columns: 90px minmax(270px,1fr) minmax(300px,1fr);
  gap: 25px;
}

/* SECÇÕES — número e legenda (01, 02, 03, 04, 05) */
.section-index {
  font-size: 10px;
  letter-spacing: .06em;
}

/* SECÇÕES — número grande */
.section-index strong {
  display: block;
  font-size: 35px;
  font-weight: 300;
  color: #777;
}

/* SECÇÕES — legenda pequena do número */
.section-index span {
  font-size: 9px;
}

/* SECÇÕES — TÍTULOS GRANDES (Architecture, 3D, etc.) */
.section-heading h2 {
  margin: 0;
  font-size: clamp(38px,4.2vw,62px);
  line-height: .97;
  letter-spacing: -.055em;
  font-weight: 600;
}

.accent {
  color: var(--accent);
}

.section:nth-of-type(even) .accent {
  color: #fff;
}

/* SECÇÕES — CONTADOR AUTOMÁTICO de artigos/projetos/estudos.
   A quantidade é calculada em js/site.js a partir das capas existentes. */
.section-article-count {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .01em;
}

/* SECÇÕES — textos de apresentação */
.section-copy {
  font-size: 15px;
  line-height: 1.7;
}

.section-copy .lead {
  margin: 0 0 22px;
}

.section-read-more {
  display: block;
  margin-bottom: 14px;
  font-size: 12px;
}

.section-pt {
  font-size: 11px;
}

.section-pt summary {
  cursor: pointer;
}

.section-pt-content {
  max-width: 550px;
  padding: 12px 0;
}

/* 04 · GALERIAS DE CAPAS — deslize horizontal */
/* Numeração automática: cada galeria começa em 01. */
.cover-track {
  counter-reset: cover-number;
  display: flex;
  overflow-x: auto;
  gap: 3px;
  border-top: 3px solid #191919;
  border-bottom: 3px solid #191919;
  background: #191919;
  scrollbar-width: none;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.cover-track::-webkit-scrollbar {
  display: none;
}

/* CAPAS — dimensões gerais da capa */
.cover {
  position: relative;
  display: block;
  flex: 0 0 clamp(220px,17vw,310px);
  height: 420px;
  min-width: 0;
  border: 0;
  background: #191919;
  color: #111;
  overflow: hidden;
}

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

/* CAPAS — número automático (.01, .02, .03...) no canto superior direito.
   Cada capa incrementa o contador da sua própria galeria. */
.cover-track > .cover {
  counter-increment: cover-number;
}

.cover-track > .cover::before {
  content: "." counter(cover-number, decimal-leading-zero);
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  text-shadow: none;
  opacity: .5;
  pointer-events: none;
}

/* Secção 01: capas sem numeração; contador de artigos mantém-se na descrição. */
#photography .cover-track > .cover::before {
  content: none;
}

/* CAPAS — caixa branca e espaçamento interior; altura acompanha o texto */
.cover-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  min-height: 0;
  padding: 12px 13px;
  background: #fff;
  color: #111;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 3px solid #191919;
}

/* CAPAS — TÍTULOS DAS CAIXAS BRANCAS: tamanho, peso e entrelinha */
.cover-caption strong {
  font-size: clamp(21px,1.8vw,28px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -.035em;
}

/* CAPAS — TEXTO PEQUENO DAS CAIXAS BRANCAS */
.cover-caption small {
  font-size: 10px;
  line-height: 1.4;
}

/* SECÇÃO 03 — palavras Tests. e Experience. em castanho */
.experience-section .accent-light {
  color: var(--accent);
}

.experience-section {
  padding-bottom: 140px;
}

.experience-section .cover-track,.experience-section .cover {
  background: var(--paper);
}

.experience-section .cover-track {
  border-top-color: var(--paper);
  border-bottom-color: var(--paper);
}

.experience-section .cover-caption {
  border-top-color: var(--paper);
}

.personal-journal-section {
  background: var(--paper);
  color: var(--ink);
}

.personal-journal-section .cover img {
  filter: grayscale(1);
}

.contact-section {
  background: var(--paper);
  color: var(--ink);
}

.contact-section .section-intro {
  min-height: 540px;
  padding-top: 90px;
  padding-bottom: 105px;
}

/* CONTACTOS — tamanho do título da secção 05 */
.contact-section .section-heading h2 {
  font-size: clamp(48px,5vw,72px);
}

.contact-copy p {
  margin: 0 0 15px;
}

.contact-copy .contact-bio {
  margin: 22px 0 18px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 13px;
  margin-top: 30px;
}

.contact-comments-link {
  font-weight: 600;
}

/* RODAPÉ — texto e espaçamento */
.site-footer {
  padding: 28px 11%;
  background: #1d1d1d;
  color: #fff;
  font-size: 9px;
  letter-spacing: .1em;
}

.cover:focus-visible {
  outline: 3px solid #777;
  outline-offset: -3px;
}

@media (max-width:800px) {
  /* 02 · CAPA PRINCIPAL — imagem de fundo e altura */
  .hero {
    min-height: 600px;
  }

  /* CAPA PRINCIPAL — posição do conjunto de textos */
  .hero-content {
    margin: 0 7%;
  }

  /* MINI-GALERIA — título «3D HIGHLIGHTS» */
  .home-highlights-label {
    grid-column: span 2;
    padding: 0 10px;
    font-size: 12px;
  }

  /* 03 · SECÇÕES — espaço e disposição dos cabeçalhos */
  .section-intro {
    padding: 55px 7%;
    grid-template-columns: 65px 1fr;
    min-height: 0;
  }

  /* SECÇÕES — textos de apresentação */
  .section-copy {
    grid-column: 2;
  }

  /* CAPAS — dimensões gerais da capa */
  .cover {
    flex-basis: 78vw;
  }

  /* CAPAS — no móvel, reservar altura para a fotografia acima da legenda.
     O recorte é feito com object-fit: cover, sem deformar o JPG. */
  .cover {
    height: clamp(440px, 125vw, 560px);
  }

  .cover img {
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  /* CAPAS — caixa branca e espaçamento interior; altura acompanha o texto */
  .cover-caption {
    min-height: 0;
  }

  /* SECÇÕES — TÍTULOS GRANDES (Architecture, 3D, etc.) */
  .section-heading h2 {
    font-size: clamp(36px,7vw,56px);
  }

  .contact-section .section-intro {
    min-height: 0;
    padding-top: 65px;
    padding-bottom: 95px;
  }

  /* CONTACTOS — tamanho do título da secção 05 */
  .contact-section .section-heading h2 {
    font-size: clamp(40px,8vw,62px);
  }

  /* RODAPÉ — texto e espaçamento */
  .site-footer {
    padding: 25px 7%;
  }

}

@media (prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto;
  }

}

/* Lightbox: fotografia e botão de fechar. */
.image-lightbox[hidden] {
  display: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.image-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.lightbox-open {
  overflow: hidden;
}

.image-lightbox-close {
  position: absolute;
  top: max(12px,env(safe-area-inset-top));
  right: max(12px,env(safe-area-inset-right));
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,.95);
  color: #191919;
  font-size: 32px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
}

.image-lightbox-close:focus-visible {
  outline: 2px solid #191919;
  outline-offset: 2px;
}

/* Galerias de capas: impedir seleção e arrastamento nativo das imagens. */
.cover-track.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.cover-track .cover img {
  -webkit-user-drag: none;
  user-select: none;
}

/* MOBILE — cabeçalho e introduções em coluna, sem cortes horizontais. */
@media (max-width: 620px) {
  .hero { min-height: min(760px, 100svh); height: auto; padding: 62px 0 66px; align-items: center; }
  .hero-content { width: auto; min-width: 0; max-width: none; margin: 0 7%; }
  .hero-name { font-size: clamp(13px, 4vw, 18px); letter-spacing: .12em; }
  .eyebrow { font-size: 9px; letter-spacing: .13em; }
  .hero h1 { font-size: clamp(29px, 8.4vw, 45px); line-height: 1.09; letter-spacing: -.035em; margin: 23px 0; overflow-wrap: anywhere; }
  .hero-copy { font-size: clamp(12px, 3.5vw, 15px); line-height: 1.65; letter-spacing: 0; max-width: 100%; overflow-wrap: break-word; }
  .section-intro, .contact-section .section-intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 48px 7% 54px; }
  .section-index, .section-heading, .section-copy { grid-column: 1; min-width: 0; }
  .section-index { grid-row: 1; }
  .section-index strong { font-size: 29px; }
  .section-heading { grid-row: 2; }
  .section-copy { grid-row: 3; }
  .section-heading h2 { font-size: clamp(32px, 9.1vw, 48px); line-height: 1.03; overflow-wrap: anywhere; }
  .contact-section .section-heading h2 { font-size: clamp(36px, 9vw, 50px); }
}

/* A mini-galeria é exclusiva do desktop; no telemóvel não ocupa espaço. */
@media (max-width: 620px) {
  .home-highlights { display: none; }
}
