:root {
  --ink: #1a1a1a;
  --muted: #7a756c;
  --paper: #ffffff;
  --sand: #ebe6dd;
  --mosaic: #693c1b;
  --accent: #c8453b;
  --header-h: 84px;

  /* comprimento da rolagem que controla a animação, e quanto a seção Projetos sobe sobre o palco */
  --scroll-len: 520vh;
  --overlap: 45vh;

  /* Identidade tipográfica
     brand   → fonte do logo: logo, menu, botões, rótulos e títulos
     body    → texto corrido */
  --font-brand: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-brand);
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
}

img { display: block; }

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  color: #fff;
  background: transparent;
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease;
}

/* degradê sutil só enquanto transparente, para manter legibilidade sobre a imagem */
.header::before {
  content: "";
  position: absolute;
  inset: 0 0 -56px 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .58), rgba(0, 0, 0, 0));
  pointer-events: none;
  transition: opacity .35s ease;
  z-index: -1;
}

/* Sem fundo em nenhuma seção: o fundo do cabeçalho só deve entrar quando o cliente pedir.
   Sobre a seção clara (Projetos) só o texto escurece. */
.header.on-light { color: var(--ink); }
.header.on-light::before { opacity: 0; }

.header__inner {
  height: var(--header-h);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

/* ---------- Logo ---------- */
.logo {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-brand);
}

.logo__mark {
  display: grid;
  grid-template-rows: auto auto;
  width: 54px;
  height: 54px;
  border: 1.5px solid currentColor;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .22em;
  line-height: 1;
  transition: border-color .35s ease;
}
.logo__top { align-self: start; justify-self: end; padding: 7px 5px 0 0; }
.logo__bottom { align-self: end; padding: 0 0 7px 8px; }

.logo__sub {
  font-size: 7px;
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: .75;
  padding-left: 1px;
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  gap: clamp(32px, 6vw, 88px);
}

.nav__link {
  position: relative;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-brand);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 8px 0;
  transition: color .25s ease, opacity .25s ease;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.nav__link:hover::after,
.nav__link:focus-visible::after { transform: scaleX(1); }
.nav__link.is-active { color: #fff; }
.nav__link.is-active::after { transform: scaleX(1); }
.header.on-light .nav__link.is-active { color: var(--accent); }

/* ---------- Mobile toggle ---------- */
.menu-toggle {
  display: none;
  justify-self: end;
  grid-column: 3;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  position: relative;
}
.menu-toggle span {
  position: absolute;
  left: 11px; right: 11px;
  height: 1.5px;
  background: currentColor;
  transition: transform .3s ease, top .3s ease;
}
.menu-toggle span:first-child { top: 18px; }
.menu-toggle span:last-child { top: 26px; }
.menu-toggle[aria-expanded="true"] span:first-child { top: 22px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { top: 22px; transform: rotate(-45deg); }

/* ---------- Hero + transição (palco) ----------
   Sem JS ou com prefers-reduced-motion: hero estática em tela cheia.
   Com .story-on: o palco fica fixo (sticky) e o JS posiciona os cards conforme a rolagem. */
.story { position: relative; }

.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  overflow: clip;
  background: var(--mosaic);
  color: #fff;
  display: grid;
  place-items: center;
}

.story-on .story {
  height: calc(100vh + var(--scroll-len));
  height: calc(100svh + var(--scroll-len));
}
.story-on .stage {
  position: sticky;
  top: 0;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: block;
  z-index: 2;
  background: #4a2a12;
  contain: layout paint;
  transform-origin: 0 0;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card--main { z-index: 6; }
.card--main img { object-position: center 60%; }

/* sem animação só a hero aparece; os demais cards ficam para a seção Projetos */
.card:not(.card--main) { display: none; }
.story-on .card:not(.card--main) { display: block; visibility: hidden; }

.card__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, .42) 0%, rgba(0, 0, 0, 0) 62%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .35) 100%);
}

.hero__content {
  position: relative;
  z-index: 8;
  grid-area: 1 / 1;
  text-align: center;
  padding: calc(var(--header-h) + 24px) 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  will-change: opacity, transform;
}

.hero__title {
  margin: 0;
  max-width: 16ch;
  text-wrap: balance;
  font-family: var(--font-display);
  font-size: clamp(32px, 4.1vw, 62px);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -.015em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}

.hero__lead {
  margin: 0;
  max-width: 38ch;
  font-size: clamp(15px, 1.3vw, 19px);
  font-weight: 300;
  line-height: 1.5;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 14px rgba(0, 0, 0, .4);
}

.btn {
  display: inline-block;
  margin-top: 10px;
  padding: 15px 34px;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  font-family: var(--font-brand);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .25s ease, color .25s ease, transform .25s ease;
}
.btn:hover,
.btn:focus-visible {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

@media (min-width: 861px) {
  .hero__title { max-width: none; }
}

/* ---------- Projetos ---------- */
.projects {
  position: relative;
  z-index: 3;
  background: var(--sand);
  color: var(--ink);
  padding: calc(var(--header-h) + 72px) 0 140px;
}

/* a seção sobe sobre o palco fixo, abrindo caminho depois que os cards passam */
.story-on .projects {
  margin-top: calc(var(--overlap) * -1);
  border-radius: 36px 36px 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .1);
}

.projects__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

.projects__head { margin-bottom: 64px; }

.eyebrow {
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.projects__title {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 64px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.015em;
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 64px 32px;
}
.projects__grid .project:nth-child(3n + 2) { margin-top: 56px; }

.project {
  display: block;
  color: inherit;
  text-decoration: none;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.project__img {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 28px;
  background: #cfc8bb;
}
.project__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.project:hover .project__img img,
.project:focus-visible .project__img img { transform: scale(1.05); }
.project:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; border-radius: 4px; }

.project__meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 14px;
  margin-top: 18px;
}
.project__num {
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .2em;
  color: var(--muted);
}
.project__name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -.005em;
}
.project__soon {
  font-family: var(--font-brand);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
  .projects__grid .project:nth-child(3n + 2) { margin-top: 0; }
  .projects__grid .project:nth-child(2n) { margin-top: 48px; }
}

@media (max-width: 860px) {
  :root { --header-h: 72px; --scroll-len: 560vh; --overlap: 40vh; }

  .header__inner { padding: 0 20px; grid-template-columns: 1fr auto; }
  .menu-toggle { display: block; grid-column: 2; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    padding: 8px 20px 20px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__link { color: var(--ink); padding: 14px 0; border-bottom: 1px solid rgba(0, 0, 0, .06); }
  .nav__link.is-active { color: var(--accent); }
  .nav__link::after { display: none; }

  .logo__mark { width: 46px; height: 46px; font-size: 8.5px; }
  .hero__content { gap: 20px; }
  .hero__title { font-size: clamp(30px, 8.6vw, 44px); }

  .projects { padding: calc(var(--header-h) + 48px) 0 96px; }
  .story-on .projects { border-radius: 28px 28px 0 0; }
  .projects__inner { padding: 0 20px; }
  .projects__head { margin-bottom: 40px; }
  .projects__grid { grid-template-columns: 1fr; gap: 40px; }
  .projects__grid .project:nth-child(n) { margin-top: 0; }
  .project__img { border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .header, .header::before { transition: none; }
  .project__img img { transition: none; }
}
