/* Corbe. Tokens da marca em marca/design-guide.md */
:root {
  --bg: #0E0E0C;
  --surface: #161614;
  --text: #FFFBF0;
  --muted: rgba(255, 251, 240, 0.58);
  --faint: rgba(255, 251, 240, 0.38);
  --line: rgba(255, 251, 240, 0.12);
  --accent: #F2452A;
  --on-accent: #141412;
  --header-bg: rgba(14, 14, 12, 0.86);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 3vw, 44px);
  --radius: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

/* Modo claro: mesmo sistema, tons invertidos. O laranja fica um tom mais
   fechado para manter contraste de texto (4,8:1 sobre o fundo claro) */
html[data-theme="light"] {
  --bg: #F7F4EC;
  --surface: #ECE8DD;
  --text: #141412;
  --muted: rgba(20, 20, 18, 0.66);
  --faint: rgba(20, 20, 18, 0.56);
  --line: rgba(20, 20, 18, 0.14);
  --accent: #C8341B;
  --on-accent: #FFFBF0;
  --header-bg: rgba(247, 244, 236, 0.88);
  color-scheme: light;
}

/* Logos: versão Bone no escuro, Ink no claro */
html[data-theme="light"] .on-dark,
html:not([data-theme="light"]) .on-light {
  display: none;
}

/* Troca de tema suave (classe aplicada por meio segundo pelo script.js) */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, fill 0.45s ease !important;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

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

ul {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 0.98;
}

h1 em,
h2 em {
  font-style: italic;
}

.dot {
  color: var(--accent);
  font-style: normal;
}

.kicker,
.meta {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn-solid {
  background: var(--text);
  color: var(--bg);
}

.btn-line {
  border: 1px solid var(--line);
}

.btn span {
  transition: transform 0.3s var(--ease);
}

@media (hover: hover) {
  .btn-solid:hover {
    background: var(--accent);
    color: var(--on-accent);
  }

  .btn-line:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .btn:hover span {
    transform: translateX(4px);
  }

  .card:hover .media::before {
    transform: scale(1.03);
  }
}

/* Abertura */
.intro {
  display: none;
}

.js .intro {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  /* Se o script falhar, a abertura some sozinha */
  animation: intro-failsafe 0s 6s forwards;
}

@keyframes intro-failsafe {
  to { visibility: hidden; }
}

html.intro-on {
  overflow: hidden;
}

.intro-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--text);
  transition: transform 1.1s cubic-bezier(0.76, 0, 0.24, 1);
}

.intro-top {
  top: 0;
  display: flex;
  justify-content: center;
  padding: var(--gutter);
}

.intro-bottom {
  bottom: 0;
}

/* Logo no topo, centralizado, acima da linha */
.intro-logo {
  display: block;
  align-self: flex-start;
  width: min(100%, 40vh * 3.5);
  height: auto;
  aspect-ratio: 252 / 72;
  color: var(--bg);
  overflow: visible;
}

/* Cada letra começa logo acima da borda da tela e desce até o lugar,
   do centro para as pontas: primeiro o r, depois o e o b, por último C, e e ™.
   --drop (em unidades do SVG) é calculado pelo script.js conforme a tela */
.intro-logo .lt {
  transform: translateY(calc(var(--drop, 110) * -1px));
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro-logo .lt-o,
.intro-logo .lt-b {
  transition-delay: 0.14s;
}

.intro-logo .lt-c,
.intro-logo .lt-e,
.intro-logo .lt-tm {
  transition-delay: 0.28s;
}

.intro.logo-in .intro-logo .lt {
  transform: none;
}

/* Celular: o logo fica logo acima da linha e as letras sobem de dentro dela.
   --rise (em unidades do SVG) é calculado pelo script.js */
@media (max-width: 700px) {
  .intro-top {
    align-items: flex-end;
    padding-bottom: 1.6rem;
    overflow: hidden;
  }

  .intro-logo {
    align-self: flex-end;
    width: 74vw;
  }

  .intro-logo .lt {
    transform: translateY(calc(var(--rise, 100) * 1px));
  }
}

.intro.open .intro-top {
  transform: translateY(-100%);
}

.intro.open .intro-bottom {
  transform: translateY(100%);
}

.intro-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  padding: 0 var(--gutter);
  transform: translateY(-50%);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  transition: opacity 0.3s ease;
}

.intro.open .intro-line {
  opacity: 0;
}

.intro-count {
  font-variant-numeric: tabular-nums;
}

.intro-track {
  position: relative;
  height: 1px;
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--bg) 40%, transparent) 50%, transparent 50%);
  background-size: 8px 1px;
}

.intro-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* Header: aparece depois que o logo grande sai da tela */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 18px var(--gutter);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-101%);
  transition: transform 0.5s var(--ease);
}

.header.show {
  transform: none;
}

.logo img {
  width: 92px;
  height: auto;
}

.nav {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  margin-right: 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--text);
}

.header .btn-line {
  padding: 0.6rem 1rem;
  font-size: 0.7rem;
}

.header .theme-toggle {
  margin-right: -1rem;
}

/* Botão de tema: quadrado como os outros botões, com um círculo meio preenchido */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.theme-toggle span {
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform 0.6s var(--ease);
}

html[data-theme="light"] .theme-toggle span {
  transform: rotate(180deg);
}

@media (hover: hover) {
  .theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* Hero: começa pela barra e ocupa quase a tela toda */
.hero {
  display: flex;
  flex-direction: column;
  min-height: 86vh;
  min-height: 86svh;
  padding: var(--gutter) var(--gutter) clamp(3rem, 8vh, 5rem);
}

.hero-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hero-bar-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hero-bar-end a {
  transition: color 0.2s ease;
}

.hero-nav {
  display: flex;
  gap: 2rem;
}

.hero-nav a {
  transition: color 0.2s ease;
}

.hero-bar a:hover {
  color: var(--text);
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: end;
  gap: 2.5rem 4rem;
  margin-top: auto;
  padding-top: clamp(4rem, 12vh, 8rem);
}

.hero h1 {
  font-size: clamp(3rem, 7.4vw, 7.5rem);
  line-height: 0.94;
  justify-self: end;
}

.hero-side p {
  max-width: 40ch;
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* Entrada do hero quando a abertura termina */
.js .hero-in {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(12px);
  transition: opacity 1.1s var(--ease), filter 1.1s var(--ease), transform 1.1s var(--ease);
}

.js .hero-in.active {
  opacity: 1;
  filter: none;
  transform: none;
}

/* Criação + Produção + Digital = Uma direção, em loop da direita para a esquerda */
.equation {
  overflow: hidden;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.eq-track {
  display: flex;
  width: max-content;
}

.eq-track.run {
  animation: eq-scroll var(--eq-dur, 40s) linear infinite;
}

@media (hover: hover) {
  .equation:hover .eq-track {
    animation-play-state: paused;
  }
}

@keyframes eq-scroll {
  to { transform: translateX(-50%); }
}

.eq-group {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 1.75rem;
  padding-right: 1.75rem;
  font-size: clamp(0.8rem, 1.3vw, 1.05rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.eq-group i {
  font-style: normal;
  color: var(--faint);
}

.eq-group .eq-result {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.6em;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text);
}

.eq-sep {
  width: 6px;
  height: 6px;
  margin-left: 1rem;
  background: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Seções */
.section {
  padding: clamp(4.5rem, 12vh, 8rem) var(--gutter);
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "kicker kicker"
    "title side";
  align-items: end;
  gap: 1.5rem 4rem;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.section-head .kicker { grid-area: kicker; }
.section-head h2 { grid-area: title; }
.section-head .side { grid-area: side; }

.section h2,
.footer h2 {
  font-size: clamp(2.6rem, 6vw, 5.4rem);
}

.side {
  max-width: 40ch;
  color: var(--muted);
}

.side a {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--accent);
}

/* Serviços em linhas (acordeão animado pelo script.js) */
.rows {
  border-top: 1px solid var(--line);
}

.row {
  position: relative;
  border-bottom: 1px solid var(--line);
}

/* Linha laranja que corre por baixo no hover e na linha aberta */
.row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.7s var(--ease);
}

.row.is-open::after {
  transform: scaleX(1);
}

.row summary {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) minmax(0, 1.3fr) 2rem;
  align-items: center;
  gap: 1.5rem;
  padding: 1.6rem 0;
  cursor: pointer;
  list-style: none;
}

.row summary::-webkit-details-marker {
  display: none;
}

.row summary:focus-visible {
  outline-offset: -2px;
}

.num {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  transition: color 0.3s ease;
}

.row-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.3s ease;
}

.row.is-open .row-title {
  font-style: italic;
}

.row.is-open .num {
  color: var(--accent);
}

.row-desc {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 46ch;
}

.plus {
  position: relative;
  justify-self: end;
  width: 16px;
  height: 16px;
  transition: transform 0.5s var(--ease);
}

.plus::before,
.plus::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--text);
  transition: transform 0.5s var(--ease), background-color 0.3s ease;
}

.plus::after {
  transform: rotate(90deg);
}

.row.is-open .plus {
  transform: rotate(180deg);
}

.row.is-open .plus::after {
  transform: rotate(0deg);
}

.row.is-open .plus::before,
.row.is-open .plus::after {
  background: var(--accent);
}

@media (hover: hover) {
  .row:hover::after {
    transform: scaleX(1);
  }

  .row summary:hover .row-title {
    font-style: italic;
    color: var(--accent);
  }

  .row summary:hover .num {
    color: var(--accent);
  }

  .row summary:hover .plus::before,
  .row summary:hover .plus::after {
    background: var(--accent);
  }
}

/* Conteúdo que abre: alinhado com as colunas da linha */
.row-body {
  overflow: hidden;
}

.row-inner {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) minmax(0, 1.3fr) 2rem;
  gap: 1.5rem;
  padding: 0.25rem 0 2.2rem;
}

.row-list {
  grid-column: 3;
  grid-row: 1;
}

.row-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.row-list li::before {
  content: "";
  flex: 0 0 5px;
  height: 5px;
  background: var(--accent);
}

.row-cta {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  justify-self: start;
  display: inline-flex;
  gap: 0.6rem;
  padding-bottom: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--accent);
  transition: color 0.25s ease;
}

.row-cta span {
  transition: transform 0.3s var(--ease);
}

@media (hover: hover) {
  .row-cta:hover {
    color: var(--accent);
  }

  .row-cta:hover span {
    transform: translateX(4px);
  }
}

.row.is-open .row-list li,
.row.is-open .row-cta {
  animation: blur-in 0.7s var(--ease) both;
}

.row.is-open .row-list li:nth-child(1) { animation-delay: 0.08s; }
.row.is-open .row-list li:nth-child(2) { animation-delay: 0.14s; }
.row.is-open .row-list li:nth-child(3) { animation-delay: 0.2s; }
.row.is-open .row-list li:nth-child(4) { animation-delay: 0.26s; }
.row.is-open .row-list li:nth-child(5) { animation-delay: 0.32s; }
.row.is-open .row-cta { animation-delay: 0.3s; }

@keyframes blur-in {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

/* Trabalhos */
.work {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
}

.card .media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--surface);
}

.card .media::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  transition: transform 0.9s var(--ease);
}

/* Imagem em WebGL com ruído no scroll (script.js). Sem WebGL, vale o ::before */
.media canvas.gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.media.has-gl::before {
  display: none;
}

.js .card.reveal {
  transition-delay: var(--d, 0s);
}

.card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.9rem;
  font-size: 0.9rem;
}

.card figcaption b {
  font-weight: 500;
  color: var(--faint);
  margin-right: 0.35rem;
}

.card figcaption span:last-child {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-align: right;
}

/* Estúdio */
.studio .kicker {
  margin-bottom: 1.5rem;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
  gap: 2rem 4rem;
}

.studio-text p {
  max-width: 42ch;
  color: var(--muted);
}

.studio-text .sign {
  margin-top: 1.5rem;
  color: var(--text);
  font-weight: 500;
}

/* Contato */
.footer {
  padding: clamp(4.5rem, 12vh, 8rem) var(--gutter) 1.75rem;
  border-top: 1px solid var(--line);
}

.footer h2 {
  margin-top: 1.5rem;
}

.email {
  display: inline-block;
  margin-top: clamp(2rem, 5vh, 3rem);
  font-size: clamp(1.6rem, 4.4vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.1em;
  transition: color 0.25s ease;
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: clamp(4rem, 12vh, 7rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--faint);
}

.footer-bottom span:last-child {
  margin-left: auto;
}

/* Entrada com opacidade e desfoque. Sem JS, tudo aparece */
.js .reveal {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(14px);
  transition: opacity 1.1s var(--ease), filter 1.1s var(--ease), transform 1.1s var(--ease);
}

.js .reveal.active {
  opacity: 1;
  filter: none;
  transform: none;
}

/* Títulos palavra por palavra */
.js h1:not(.split) {
  visibility: hidden;
}

.split .w {
  display: inline-block;
}

.js .split .w {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(0.18em);
  transition: opacity 1.2s var(--ease), filter 1.2s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--i) * 90ms);
}

.js .split.active .w {
  opacity: 1;
  filter: none;
  transform: none;
}

/* Responsivo */
@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .header .theme-toggle {
    margin-left: auto;
  }

  .hero-main,
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .hero-main h1 {
    order: -1;
    justify-self: start;
  }

  .hero-bar {
    grid-template-columns: 1fr auto;
  }

  .hero-nav {
    display: none;
  }

  .section-head {
    grid-template-columns: 1fr;
    grid-template-areas: "kicker" "title" "side";
  }

  .row summary {
    grid-template-columns: 2.5rem minmax(0, 1fr) 1.5rem;
    grid-template-areas:
      "num title plus"
      ". desc .";
    row-gap: 0.4rem;
  }

  .num { grid-area: num; }
  .row-title { grid-area: title; }
  .row-desc { grid-area: desc; }
  .plus { grid-area: plus; }

  .row-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-left: calc(2.5rem + 1.5rem);
  }

  .row-list,
  .row-cta {
    grid-column: 1;
    grid-row: auto;
  }

  .work {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
  }

  .card {
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .hero-bar {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .hero-bar-end {
    justify-self: stretch;
    justify-content: space-between;
  }

  .actions .btn {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .row-inner {
    padding-left: 0;
  }

  .work {
    grid-template-columns: repeat(3, 78%);
  }
}

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

  .js .reveal,
  .js .split .w,
  .js .hero-in {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  .row.is-open .row-list li,
  .row.is-open .row-cta {
    animation: none;
  }

  .row::after,
  .plus,
  .plus::before,
  .plus::after {
    transition: none;
  }

  .card .media::before {
    transition: none;
  }
}
