/* NN Design: estilos
   Valores medidos em nndesign.framer.website (ver REFERENCIA-NNDESIGN.md) */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f0f0f;
  --fg: #ffffff;
  --muted: #a6a6a6;
  --line: #262626;
  /* 40px de margem; em ecrãs grandes o conteúdo fica limitado a 1840px */
  --gutter: max(40px, calc((100vw - 1840px) / 2));
  --gap: 20px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 68px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.04em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; }

:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--fg); color: var(--bg); padding: 8px 12px; font-size: 16px;
}
.skip:focus { top: 12px; }

/* ---------- Tipografia ---------- */
.t-display {
  font-size: clamp(56px, 9vw, 132px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  text-transform: uppercase;
}
.t-h2 {
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  text-transform: uppercase;
}
.t-small {
  font-size: 16px;
  letter-spacing: -0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.link {
  transition: color 0.25s ease;
}
.link:hover { color: var(--muted); }
.link--underline {
  white-space: nowrap;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background-color: transparent;
  transition: background-color 0.35s ease;
  animation: header-in 1s var(--ease-out) both;
}
/* Fundo sólido depois de descer (igual à referência) */
.header.is-solid { background-color: var(--bg); }
@keyframes header-in {
  from { transform: translateY(-118px); }
  to { transform: none; }
}
.header__logo img { width: 90px; height: auto; }
.header__nav { display: flex; gap: 24px; }
.header__clock { justify-self: end; font-variant-numeric: tabular-nums; }
.header__toggle { display: none; }
.header__panel { display: none; }

/* ---------- Animação de palavras (hero e títulos) ---------- */
.words .w {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(10px) scale(0.95);
  transition:
    opacity 1.2s var(--ease-soft),
    filter 1.2s var(--ease-soft),
    transform 1.2s var(--ease-soft);
  transition-delay: calc(var(--d, 0s) + var(--i, 0) * 0.1s);
}
.words--intro { --d: 0.55s; }
.words.is-in .w {
  opacity: 1;
  filter: blur(0);
  transform: none;
}
/* Sem JS, o texto aparece normalmente */
.no-js .words .w { opacity: 1; filter: none; transform: none; }

/* ---------- Hero ---------- */
.hero {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  background: var(--bg);
  overflow: hidden;
}
.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  text-align: center;
  will-change: filter, transform;
  /* Evita que o título fique selecionado a azul ao brincar com o rasto de fotos */
  -webkit-user-select: none;
  user-select: none;
}

/* Rasto de imagens que segue o rato no hero */
.trail {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.trail img {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  height: 250px;
  object-fit: cover;
  opacity: 0;
  will-change: transform, opacity, filter;
}

/* As secções seguintes tapam o hero */
.main > section:not(.hero),
.footer {
  position: relative;
  z-index: 2;
  background: var(--bg);
}

/* ---------- Secções ---------- */
.section {
  padding: 80px var(--gutter);
  border-top: 1px solid var(--line);
}
.section__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 40px;
}

/* ---------- Projetos ---------- */
.works {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 60px var(--gap);
}
.card { display: flex; flex-direction: column; gap: 20px; }
.card__media {
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #1a1a1a;
}
.card__media img,
.zoom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.45, 0, 0.55, 1);
}
.card:hover .card__media img,
.zoom:hover img { transform: scale(1.025); }
.card__info { display: flex; flex-direction: column; gap: 4px; }
.card__title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  text-transform: uppercase;
}

/* ---------- Serviços ---------- */
.services {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  list-style: none;
  margin: 0;
  padding: 0;
}
.service {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #1a1a1a;
  cursor: default;
}
.service__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
  transition: filter 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.service__body {
  position: absolute;
  inset: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  transition: backdrop-filter 0.6s var(--ease-out), -webkit-backdrop-filter 0.6s var(--ease-out);
}
.service__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.service__title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.service__icon { position: relative; flex: none; width: 20px; height: 20px; }
.service__icon::before,
.service__icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 20px;
  height: 1px;
  background: var(--fg);
  transition: transform 0.6s var(--ease-out);
}
.service__icon::before { transform: rotate(180deg); }
.service__icon::after { transform: rotate(-90deg); }
.service__text {
  max-width: 400px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.service:hover .service__img,
.service:focus-visible .service__img,
.service.is-active .service__img { filter: brightness(0.25); transform: scale(1.05); }
.service:hover .service__body,
.service:focus-visible .service__body,
.service.is-active .service__body { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.service:hover .service__icon::after,
.service:focus-visible .service__icon::after,
.service.is-active .service__icon::after { transform: rotate(-180deg); }
.service:hover .service__text,
.service:focus-visible .service__text,
.service.is-active .service__text { opacity: 1; }

/* ---------- Sobre mim ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 350px);
  gap: 40px var(--gap);
  align-items: start;
}
.facts { display: flex; flex-direction: column; gap: 40px; }
.fact {
  display: grid;
  grid-template-columns: 230px minmax(0, 420px);
  gap: 20px;
}
.fact p + p { margin-top: 24px; }
.fact strong { font-weight: 700; }
.link-inline {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.25s ease;
}
.link-inline:hover { color: var(--muted); }
.about__photo { width: 100%; filter: grayscale(1); }

/* ---------- Footer ---------- */
.footer {
  padding: 60px var(--gutter) 40px;
  border-top: 1px solid var(--line);
}
address { font-style: normal; }
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 40px;
}
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin-top: 80px;
}

/* ---------- Páginas internas ---------- */
.page-head {
  position: relative;
  z-index: 2;
  padding: calc(var(--header-h) + 100px) var(--gutter) 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-head .t-display { font-size: clamp(48px, 8vw, 120px); }

.project-cover {
  padding: 0 var(--gutter);
}
.project-cover img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.project-info {
  padding: 80px var(--gutter);
}
.project-info .fact { grid-template-columns: 230px minmax(0, 560px); }

/* Perguntas frequentes */
.faq { border-top: 1px solid var(--line); max-width: 1000px; }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
  cursor: pointer;
  list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq-page { border-top: 0; padding-top: 0; }
.faq__q h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
  transition: color 0.25s ease;
}
@media (hover: hover) { .faq__q:hover h2 { color: var(--muted); } }
.faq__item[open] .service__icon::after { transform: rotate(-180deg); }
.faq__a { max-width: 640px; padding-bottom: 24px; }

/* 404 */
.notfound { min-height: 80vh; justify-content: center; }
.notfound__links { display: flex; flex-wrap: wrap; gap: 16px 32px; margin-top: 16px; }

.gallery {
  padding: 0 var(--gutter) 80px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.gallery figure { margin: 0; }
.gallery .full { grid-column: 1 / -1; }
.gallery img { width: 100%; }
.gallery .crop img { aspect-ratio: 4 / 5; object-fit: cover; }
.gallery figcaption { margin-top: 12px; }

.next {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 80px var(--gutter);
  border-top: 1px solid var(--line);
}
.next__title { transition: color 0.25s ease; }
.next .t-small { white-space: nowrap; }
.next:hover .next__title { color: var(--muted); }

/* Arquivo: colunas tipo masonry, respeita o formato de cada imagem */
.masonry {
  columns: 3;
  column-gap: var(--gap);
}
.masonry figure {
  margin: 0 0 var(--gap);
  break-inside: avoid;
}
.masonry .zoom { overflow: hidden; background: #1a1a1a; }
.masonry figcaption { margin-top: 12px; }

/* ---------- Tablet ---------- */
@media (max-width: 1199.98px) {
  .t-h2 { font-size: 40px; }
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact { grid-template-columns: 160px minmax(0, 1fr); }
  .masonry { columns: 2; }
}

/* Menu compacto (tablet e mobile) */
@media (max-width: 1199.98px) {
  .header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 0;
  }
  .header__bar {
    height: 58px;
    padding: 0 var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .header__nav--desktop,
  .header__clock { display: none; }
  .header__toggle {
    display: block;
    height: 18px;
    overflow: hidden;
    font-size: 16px;
    text-transform: uppercase;
  }
  .header__toggle span {
    display: block;
    height: 18px;
    line-height: 18px;
    transition: transform 0.5s var(--ease-out);
  }
  .header__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.8s var(--ease-out);
  }
  .header__panel-inner {
    overflow: hidden;
    min-height: 0;
  }
  .header__panel nav {
    display: flex;
    flex-direction: column;
    padding: 30px var(--gutter) 0;
    min-height: calc(100svh - 58px);
  }
  .header__panel a {
    font-size: 48px;
    font-weight: 500;
    letter-spacing: -0.06em;
    line-height: 62px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), color 0.25s ease;
  }
  .header.is-open { background-color: var(--bg); }
  .header.is-open .header__panel { grid-template-rows: 1fr; }
  .header.is-open .header__panel a { opacity: 1; transform: none; }
  .header.is-open .header__panel a:nth-child(1) { transition-delay: 0.15s; }
  .header.is-open .header__panel a:nth-child(2) { transition-delay: 0.2s; }
  .header.is-open .header__panel a:nth-child(3) { transition-delay: 0.25s; }
  .header.is-open .header__panel a:nth-child(4) { transition-delay: 0.3s; }
  .header.is-open .header__toggle span { transform: translateY(-18px); }
}
@media (min-width: 1200px) {
  .header__bar { display: contents; }
}

/* ---------- Mobile ---------- */
@media (max-width: 809.98px) {
  :root { --gutter: 20px; }
  .t-h2 { font-size: 32px; }
  .section { padding: 60px var(--gutter); }
  .section__head { margin-bottom: 24px; }
  .works { grid-template-columns: 1fr; gap: 40px; }
  .services { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .about__photo { max-width: 350px; }
  .fact,
  .project-info .fact { grid-template-columns: 1fr; gap: 8px; }
  .facts { gap: 28px; }
  .gallery { grid-template-columns: 1fr; }
  .masonry { columns: 1; }
  .page-head { padding-top: calc(58px + 60px); }
  .footer__bottom { margin-top: 60px; }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .words .w { opacity: 1; filter: none; transform: none; }
  .hero__inner { filter: none !important; transform: none !important; }
}

@media (max-width: 809.98px) {
  .next { flex-direction: column; align-items: flex-start; }
}
address { font-style: normal; }
.footer__links { text-transform: none; }

@media (max-width: 809.98px) {
  .footer__bottom { flex-direction: column; gap: 4px; }
}
.footer__bottom .link:hover { color: var(--fg); }
