/* =============================================================
   Ricardo Carvalho — made by rc
   Direção: papel acromático. A única cor da página vive
   dentro dos screenshots do trabalho.
   ============================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Cor — sem qualquer croma. */
  --paper:    #F8F8F6;
  --ink:      #111112;
  --graphite: #4A4A4E;
  --mute:     #6E6E72;
  --rule:     #DEDEDA;
  --wash:     #EFEFEC;

  /* Tipografia */
  --sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", Times, serif;

  --fs-display: clamp(2.85rem, 7.6vw, 6.75rem);
  --fs-xl:      clamp(2.1rem, 5.2vw, 4.25rem);
  --fs-l:       clamp(1.375rem, 2.1vw, 1.75rem);
  --fs-lead:    clamp(1.0625rem, 1.35vw, 1.1875rem);
  --fs-body:    1.0625rem;
  --fs-small:   0.9375rem;
  --fs-label:   0.6875rem;

  /* Ritmo */
  --gutter: 1.5rem;
  --measure: 34ch;
  --section-gap: clamp(5.5rem, 13vw, 11rem);

  /* Movimento */
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure, ol { margin: 0; }
ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 1px;
}

::selection { background: var(--ink); color: var(--paper); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: 0;
  transform: translateY(-140%);
  z-index: 20;
  background: var(--ink); color: var(--paper);
  padding: .7em 1.1em;
  font-size: var(--fs-small);
  text-decoration: none;
  transition: transform .25s var(--ease);
}
.skip:focus { transform: translateY(.75rem); }

/* ---------- 3. Layout ---------- */
.wrap {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 700px)  { :root { --gutter: 2.5rem; } }
@media (min-width: 1100px) { :root { --gutter: 4rem; } }

.section { padding-block: 0 var(--section-gap); }
.section--work { padding-top: var(--section-gap); }

/* ---------- 4. Etiquetas e regras ---------- */
.eyebrow {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--mute);
  line-height: 1.4;
}

.section__label {
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}

/* ---------- 5. Cabeçalho ---------- */
.masthead {
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
}

.masthead__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.masthead__name {
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: -.005em;
  text-decoration: none;
}

.masthead__nav {
  display: flex;
  gap: clamp(1.1rem, 2.4vw, 2rem);
  font-size: var(--fs-small);
  color: var(--graphite);
}

/* Sublinhado que corre da esquerda — usado em toda a navegação. */
.masthead__nav a,
.note__body a {
  position: relative;
  text-decoration: none;
  padding-bottom: 2px;
}
.masthead__nav a::after,
.note__body a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--ease);
}
.masthead__nav a:hover { color: var(--ink); }
.masthead__nav a:hover::after,
.masthead__nav a:focus-visible::after { transform: scaleX(1); }

/* ---------- 6. Hero ---------- */
/* Sem padding inferior: o espaço até «Trabalho» é dado pela secção seguinte. */
.hero { padding-top: clamp(3rem, 9vw, 7rem); }

.hero__eyebrow { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.hero__title {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -.035em;
  text-wrap: balance;
  max-width: 15ch;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.hero__foot {
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.hero__lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--graphite);
  max-width: 46ch;
}

@media (min-width: 860px) {
  .hero__foot {
    grid-template-columns: 1fr minmax(0, 46ch);
    align-items: start;
    justify-content: space-between;
  }
}

/* ---------- 7. Chamadas ---------- */
.cta {
  display: inline-flex;
  align-items: baseline;
  gap: .55em;
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--ink);
  width: max-content;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.cta__arrow {
  display: inline-block;
  transition: transform .45s var(--ease);
}
.cta:hover .cta__arrow { transform: translateY(.28em); }
.cta--out:hover .cta__arrow { transform: translate(.22em, -.22em); }

/* ---------- 8. Projeto ---------- */
.project__head {
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.project__name {
  font-size: var(--fs-xl);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: .55em;
}

.project__desc {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--graphite);
  max-width: 42ch;
}

.project__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

/* Ficha técnica: uma disciplina por linha. */
.project__disciplines {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
  line-height: 1.9;
}

@media (min-width: 860px) {
  .project__head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .project__meta { align-items: flex-end; text-align: right; }
  .project__disciplines {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }
}

/* ---------- 9. Screenshots ---------- */
.shot { margin: 0; }

.shot__frame {
  position: relative;
  aspect-ratio: var(--ar, 16 / 10);
  overflow: hidden;
  background: var(--wash);
  border: 1px solid var(--rule);
}

.shot--mobile .shot__frame { --ar: 9 / 19.5; }

/* Em telemóvel um screenshot de desktop a 342px é ilegível. Recorte
   quadrado: mostra a altura toda e a zona central, ao dobro da escala. */
@media (max-width: 859px) {
  .shot--wide .shot__frame,
  .shot--journal .shot__frame { --ar: 1 / 1; }
}

.shot__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform: scale(1);
  transition: transform 1s var(--ease);
}
.shot:hover .shot__frame img { transform: scale(1.015); }

.shot figcaption {
  margin-top: .9rem;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
}

/* Estado de espera: enquanto o ficheiro não existir. */
.shot__missing { display: none; }

.shot[data-shot="missing"] .shot__frame img { display: none; }
.shot[data-shot="missing"] .shot__missing {
  display: flex;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-align: center;
  padding: 1.5rem;
  background:
    repeating-linear-gradient(-45deg, transparent 0 9px, rgba(17,17,18,.028) 9px 10px),
    var(--wash);
}
.shot__missing-title {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--graphite);
}
.shot__missing-path {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .75rem;
  color: var(--mute);
  word-break: break-all;
}
.shot__missing-size {
  font-size: .75rem;
  color: var(--mute);
}

/* Par Journal + mobile: alinhados pela base, topo escalonado. */
.shot-pair {
  display: grid;
  gap: clamp(2rem, 5vw, 3rem);
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

@media (min-width: 860px) {
  .shot-pair {
    grid-template-columns: 8fr 3fr;
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: end;
  }
}

@media (max-width: 859px) {
  .shot--mobile { width: 62%; margin-left: auto; }
}

/* ---------- 10. Nota de contexto ---------- */
.note {
  display: grid;
  gap: 1rem;
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.note__body {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--graphite);
  max-width: 58ch;
}

@media (min-width: 860px) {
  .note {
    grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
    gap: var(--gutter);
  }
  .note__label { padding-top: .35em; }
}

/* ---------- 11. Método ---------- */
.method__intro {
  font-size: var(--fs-l);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.25;
  max-width: 24ch;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.method {
  display: grid;
  gap: 2.25rem clamp(1.5rem, 3vw, 2.5rem);
}

.step {
  position: relative;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.step__mark {
  position: absolute;
  top: 1.1rem;
  right: 0;
  font-size: var(--fs-small);
  color: var(--mute);
  line-height: 1.4;
}

.step__term {
  font-size: var(--fs-l);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.15;
  margin-bottom: .5rem;
}

.step__body {
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--graphite);
  max-width: 30ch;
}

/* Em coluna única a ordem já é dada pela leitura de cima para baixo. */
@media (max-width: 759px) {
  .step__mark { display: none; }
}

@media (min-width: 760px) {
  .method { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 12. Contacto ---------- */
.contact__question {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: var(--fs-xl);
  line-height: 1.05;
  letter-spacing: -.015em;
  max-width: 17ch;
  text-wrap: balance;
  margin-bottom: 1.25rem;
}

.contact__body {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--graphite);
  max-width: 42ch;
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.contact__mail {
  display: inline-block;
  font-size: clamp(1.75rem, 4.6vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.1;
  text-decoration: none;
  position: relative;
  padding-bottom: .12em;
  word-break: break-word;
}
.contact__mail::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .55s var(--ease);
}
.contact__mail:hover::after,
.contact__mail:focus-visible::after { transform: scaleX(1); }

/* ---------- 13. Rodapé / assinatura ---------- */
.colophon {
  padding-bottom: clamp(2rem, 4vw, 3rem);
}

.colophon__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.colophon__meta {
  font-size: var(--fs-label);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
  padding-bottom: .4em;
}

/* A assinatura: o único outro sítio onde o serifado aparece. */
.colophon__mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2rem, 6.5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--mute);
}

/* ---------- 14. Movimento ---------- */
@keyframes word-rise {
  from { transform: translateY(105%); }
  to   { transform: translateY(0); }
}

.hero__title .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: .14em;
  margin-bottom: -.14em;
}
.hero__title .w > span {
  display: inline-block;
  transform: translateY(105%);
  animation: word-rise .9s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 55ms + 140ms);
}

.hero__eyebrow,
.hero__foot,
.masthead__inner {
  opacity: 0;
  animation: fade-in .8s var(--ease) forwards;
}
.masthead__inner { animation-delay: .05s; }
.hero__eyebrow   { animation-delay: .15s; }
.hero__foot      { animation-delay: .7s; }

@keyframes fade-in { to { opacity: 1; } }

/* Só se esconde quando há JavaScript para voltar a mostrar. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

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

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .hero__title .w > span { transform: none; }
  .hero__eyebrow, .hero__foot, .masthead__inner { opacity: 1; }
  .js .reveal { opacity: 1; transform: none; }
  .shot:hover .shot__frame img { transform: none; }
}
