/* Fontes: ES (Extraset) em versão TRIAL, só para teste online.
   Antes de divulgar o site, licenciar as fontes e trocar pelos arquivos definitivos. */
@font-face {
  font-family: "Quarz";
  src: url("fonts/ESQuarzTRIAL-Regular.otf") format("opentype");
  font-display: swap;
}
@font-face {
  font-family: "Klarheit Mono";
  font-weight: 400;
  src: url("fonts/ESKlarheitGroteskMono-Rg-TRIAL.otf") format("opentype");
  font-display: swap;
}
@font-face {
  font-family: "Klarheit Mono";
  font-weight: 700;
  src: url("fonts/ESKlarheitGroteskMono-Bd-TRIAL.otf") format("opentype");
  font-display: swap;
}
@font-face {
  font-family: "Kurrent Mono";
  src: url("fonts/ESKlarheitKurrentMono-Rg-TRIAL.otf") format("opentype");
  font-display: swap;
}
@font-face {
  font-family: "Face";
  font-style: italic;
  src: url("fonts/ESFaceTRIAL-BookItalic.otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #000;
  --surface: #0a0a0a;
  --fg: #fff;
  --line: rgb(255 255 255 / 0.28);
  --line-soft: rgb(255 255 255 / 0.15);
  --muted: rgb(255 255 255 / 0.41);
  --dim: rgb(255 255 255 / 0.34);

  --display: "Quarz", "Didot", "Bodoni 72", "Bodoni MT", serif;
  --mono: "Klarheit Mono", "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --mono-alt: "Kurrent Mono", var(--mono);
  --serif: "Face", Georgia, "Times New Roman", serif;

  --gutter: 40px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  padding-block: 40px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.53;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
ul, dl, dd, p, h1, h2, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }

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

/* Saída da página ao navegar (transition.js) */
body { transition: opacity 0.35s ease; }
html.is-leaving body { opacity: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: var(--gutter); top: -100px;
  padding: 6px 10px; background: var(--fg); color: var(--bg); z-index: 10;
}
.skip:focus { top: 8px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px;
  border: 1px solid var(--fg);
  font-size: 16px; line-height: 1.53;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn-lg { font-size: 20px; }

.link-muted {
  padding: 3px 10px;
  font-size: 16px;
  color: var(--muted);
  transition: color 0.25s var(--ease);
}
.link-muted:hover { color: var(--fg); }

/* ---------- Hero ---------- */
.hero {
  container-type: inline-size;
  padding-inline: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
}
.hero-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.disciplines {
  display: flex;
  gap: 72px;
  font-size: 14px;
  text-transform: uppercase;
}

/* unidade = 1px do Figma dentro da largura útil de 1360px */
.name {
  --u: calc(100cqi / 1360);
  display: flex;
  align-items: flex-end;
  gap: calc(19 * var(--u));
  padding-block: calc(8 * var(--u));
  font-family: var(--display);
  font-weight: 400;
  font-size: calc(241 * var(--u));
  line-height: 0.62;
  letter-spacing: 0;
  white-space: nowrap;
}
.name-word { display: block; position: relative; z-index: 2; }
.ch { display: inline-block; }
.name-photo {
  position: relative;
  z-index: 1;
  display: block;
  width: calc(109 * var(--u));
  height: calc(151 * var(--u));
  overflow: hidden;
  flex: none;
}
.name-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Texto centralizado embaixo de ARIOZI (centro da palavra = 907px do Figma, na mesma escala do nome) */
.intro {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  width: min(573px, 100%);
  margin-left: max(0px, min(calc(907 * 100cqi / 1360 - 286.5px), calc(100cqi - 573px)));
  font-size: 12px;
  text-transform: uppercase;
}

/* Símbolos decorativos girando devagar */
.symbol {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
  pointer-events: none;
  user-select: none;
  animation: spin 20s linear infinite;
}
.symbol-b { animation-duration: 28s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Símbolos do Figma (✺, ✱, ✧): a peça se move, a imagem de dentro gira */
.hero { position: relative; }
.star-in { display: block; width: 100%; height: 100%; }
.hero-star img,
.intro-asterisk img,
.disciplines .sep img {
  display: block;
  width: 100%;
  height: 100%;
  animation: spin 40s linear infinite;
}
.intro-asterisk img { animation-direction: reverse; animation-duration: 48s; }
.disciplines .sep img { animation-duration: 18s; }

/* ✺ no canto direito do hero, cortado pela borda da tela e pela seção de cases (Figma: 1353,220, 175px) */
.hero-star {
  position: absolute;
  z-index: 0;
  left: calc(40px + 1313.3 * 100cqi / 1360);
  top: calc(179.7 * 100cqi / 1360);
  width: calc(175.4 * 100cqi / 1360);
  height: calc(175.4 * 100cqi / 1360);
  pointer-events: none;
}
.disciplines .sep {
  display: grid;
  place-items: center;
  width: 13px;
  height: 21px;
}
.disciplines .sep img { width: 10.8px; height: 10.8px; }

/* ✱ só na tela inicial; posição e tamanho vêm do intro.js */
.intro-asterisk {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 0;
  display: none;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4) rotate(-40deg);
  transition: opacity 0.6s var(--ease), transform 1s cubic-bezier(0.77, 0, 0.18, 1);
}
html.intro-on .intro-asterisk { opacity: 1; transform: none; }

/* O ✺ é cortado na borda direita da tela (sem gerar rolagem lateral) e os cases passam por cima dele */
.hero { overflow-x: clip; }
.projects-track { position: relative; z-index: 1; }

/* Botão de idioma BR / EN, logo abaixo do CONTACT */
.lang {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.53;
  color: var(--muted);
  white-space: nowrap;
}
.lang a { transition: color 0.25s var(--ease); }
.lang a:hover,
.lang a[aria-current] { color: var(--fg); }

.actions {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* ---------- Projetos ---------- */
.projects {
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.project { border-bottom: 1px solid var(--line-soft); }
.project.is-open { border-bottom: 0; padding-block: 50px; }
.project.is-open + .project { border-top: 1px solid var(--line-soft); }

.project-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  line-height: 1.1;
}
.project-title button {
  display: block;
  width: 100%;
  padding: 34px var(--gutter);
  color: var(--dim);
  transition: color 0.3s var(--ease);
}
.project-title button:hover { color: var(--fg); }

/* Projeto aberto: coluna de 325px + galeria */
.project.is-open {
  display: grid;
  grid-template-columns: 325px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "title gallery"
    "meta  gallery"
    "cta   gallery";
  column-gap: 21px;
  padding-left: var(--gutter);
}
.project.is-open .project-title { grid-area: title; }
.project.is-open .project-title button { padding: 0; color: var(--fg); cursor: default; }
.project.is-open .project-body { display: contents; }

.project-meta {
  grid-area: meta;
  align-self: center;
  display: grid;
  grid-template-columns: 161px 137px;
  font-family: var(--mono-alt);
  font-size: 12px;
  text-transform: uppercase;
}
.project-tags { display: flex; flex-direction: column; gap: 8px; }
.project-cta { grid-area: cta; justify-self: start; }

.gallery {
  grid-area: gallery;
  min-width: 0;
  overflow: hidden;
}
.gallery-rail {
  display: flex;
  gap: 21px;
  width: max-content;
  padding-right: var(--gutter);
  will-change: transform;
}
.shot {
  flex: none;
  height: 503px;
  aspect-ratio: 440 / 503;
  background: var(--fg);
  overflow: hidden;
  transform: skewX(var(--skew, 0deg)) scale(var(--squash, 1));
  transition: opacity 0.45s var(--ease);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: transform 0.7s var(--ease);
}

/* Galeria sensorial: arrasta com inércia, a imagem sob o cursor acende */
.gallery { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gallery.is-hovering .shot:not(.is-focus) { opacity: 0.4; }
.gallery.is-dragging .shot:not(.is-focus) { opacity: 0.65; }
.shot.is-focus img { transform: scale(1.04); }

@media (hover: hover) and (pointer: fine) {
  .gallery { cursor: none; }
}
.drag-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  mix-blend-mode: difference;
}
.drag-cursor span {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 12px;
  letter-spacing: 0.08em;
  transform: scale(0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.drag-cursor.is-visible span { transform: scale(1); }
.drag-cursor.is-visible.is-pressed span { transform: scale(0.72); }
@media (hover: none), (pointer: coarse) {
  .drag-cursor { display: none; }
}

/* Entrada dos itens: ao chegar na segunda parte (is-arriving) e ao trocar de tópico (is-entering).
   fill "backwards" solta o estilo no fim, para o hover das imagens continuar funcionando. */
.project.is-entering .project-title button,
.project.is-entering .project-year,
.project.is-entering .project-tags li,
.project.is-entering .project-cta,
.project.is-entering .shot,
.projects.is-arriving .project:not(.is-open) .project-title button {
  animation: item-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--base, 0s) + var(--d, 0s));
}
/* Título sobe de dentro de uma máscara */
.project.is-entering .project-title button {
  animation-name: title-in;
  animation-duration: 1.2s;
}
/* Ano e tags entram da esquerda, em sequência */
.project.is-entering .project-year,
.project.is-entering .project-tags li { animation-name: meta-in; }
.project.is-entering .project-year { --d: 0.3s; }
.project.is-entering .project-tags li { --d: calc(0.4s + var(--i, 0) * 0.1s); }
/* Botão se desenha da esquerda para a direita */
.project.is-entering .project-cta {
  --d: 0.75s;
  animation-name: cta-in;
  animation-duration: 0.9s;
  animation-timing-function: cubic-bezier(0.77, 0, 0.18, 1);
}
.project.is-entering .shot {
  --d: calc(0.15s + var(--i, 0) * 0.1s);
  animation-name: shot-in;
  animation-duration: 1.1s;
}
.projects.is-arriving .project:not(.is-open) .project-title button { --d: calc(0.7s + var(--r, 0) * 0.12s); }

@keyframes item-in {
  from { opacity: 0; transform: translateY(24px); }
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(60%); clip-path: inset(100% -10% -20% -10%); }
  to { opacity: 1; transform: none; clip-path: inset(-10% -10% -20% -10%); }
}
@keyframes meta-in {
  from { opacity: 0; transform: translateX(-28px); }
}
@keyframes cta-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes shot-in {
  from { opacity: 0; transform: translateY(64px); }
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 32px;
  padding: 28px var(--gutter) 0;
  font-size: 12px;
  text-transform: uppercase;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--fg);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Tela inicial ----------
   intro-pending: esperando fontes para medir · intro-on: tela inicial ativa
   intro-transition: peças animando entre os estados · intro-leaving: saindo para o hero */
.hero-piece { transform-origin: 0 0; }

html.intro-pending,
html.intro-on,
html.intro-lock { overflow: hidden; }

html.intro-pending .hero-piece,
html.intro-pending .actions,
html.intro-pending .projects-track,
html.intro-pending .footer { opacity: 0; }

.actions { transition: opacity 0.7s var(--ease), transform 1s var(--ease); }
html.intro-on .actions {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* Cases e footer esperam abaixo da tela e sobem juntos, como um scroll de verdade */
.projects-track,
.footer { transition: transform 1.15s cubic-bezier(0.77, 0, 0.18, 1); }
html.intro-on .projects-track,
html.intro-on .footer {
  transform: translateY(100vh);
  pointer-events: none;
}
html.intro-leaving .projects-track,
html.intro-leaving .footer { transition-delay: 0.12s; }
html.intro-leaving .actions { transition-delay: 0.7s; }

html.intro-transition .hero-piece {
  transition: transform 1.15s cubic-bezier(0.77, 0, 0.18, 1);
}
html.intro-transition [data-piece="isaque"],
html.intro-transition [data-piece="ariozi"] { transition-delay: 0.04s; }
html.intro-transition [data-piece="disc"],
html.intro-transition [data-piece="intro"] { transition-delay: 0.08s; }
html.intro-measure .hero-piece,
html.intro-instant .actions,
html.intro-instant .projects-track,
html.intro-instant .footer { transition: none !important; }

/* Entrada de cada peça */
html.intro-enter .name-photo { animation: photo-reveal 1.3s cubic-bezier(0.77, 0, 0.18, 1) both; }
html.intro-enter .name-photo img { animation: photo-zoom 2s cubic-bezier(0.22, 1, 0.36, 1) both; }
html.intro-enter .ch { animation: char-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(0.45s + var(--i) * 0.055s); }
html.intro-enter .disciplines li { animation: fade-up 0.8s var(--ease) both; animation-delay: calc(1.05s + var(--i) * 0.08s); }
html.intro-enter .intro { animation: fade-in 1s var(--ease) 1.3s both; }
html.intro-enter .hero-star .star-in { animation: star-in 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.9s backwards; }
html.intro-enter .intro-asterisk .star-in { animation: star-in 1.6s cubic-bezier(0.22, 1, 0.36, 1) 1.15s backwards; }

@keyframes star-in {
  from { opacity: 0; transform: scale(0.3) rotate(-120deg); }
}

@keyframes photo-reveal {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes photo-zoom {
  from { transform: scale(1.3); }
  to { transform: scale(1); }
}
@keyframes char-rise {
  from { opacity: 0; transform: translateY(45%); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1199px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "disc actions" "name name" "intro intro";
    align-items: center;
    row-gap: 14px;
  }
  .hero-main { display: contents; }
  /* Em telas menores o ✺ só aparece na tela inicial */
  .hero-star { transition: opacity 0.6s var(--ease); }
  html:not(.intro-on) .hero-star { opacity: 0; }
  .actions .lang { position: static; }
  .disciplines { grid-area: disc; }
  .name { grid-area: name; }
  .intro { grid-area: intro; justify-self: start; }
  .actions { grid-area: actions; flex-direction: row; align-items: center; }
}

@media (max-width: 1023px) {
  .project.is-open {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "title" "meta" "gallery" "cta";
    row-gap: 28px;
    min-height: 0;
    padding-right: 0;
  }
  .project-meta { align-self: start; }
  /* Tablet e celular: galeria de ponta a ponta, rolando sozinha */
  .gallery { margin-left: calc(var(--gutter) * -1); }
  .gallery-rail { padding-left: var(--gutter); }
  .shot { width: min(440px, 72vw); height: auto; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  :root { --gutter: 20px; }
  body { padding-block: 24px; }
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "disc" "name" "intro" "actions";
    row-gap: 20px;
  }
  .actions { justify-content: flex-start; }
  .actions .link-muted { padding-inline: 0; }
  .disciplines { gap: 24px; font-size: 12px; }
  /* ISAQUE na primeira linha, foto + ARIOZI na segunda */
  .name {
    --u: calc(100cqi / 644);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    row-gap: calc(76 * var(--u));
    padding-block: 0;
  }
  .name-word:first-child { grid-column: 1 / -1; }
  .name-photo { grid-row: 2; grid-column: 1; }
  .name-word:last-child { grid-row: 2; grid-column: 2; }
  .intro { justify-self: stretch; width: 100%; margin-left: 0; }
  .project-title { font-size: 24px; }
  .project-title button { padding-block: 24px; }
  .project.is-open { padding-block: 32px; }
  .btn-lg { font-size: 16px; }
  .footer { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .gallery { scroll-behavior: auto; }
}
