/* Camada de profundidade. Carrega depois de style.css e usa só os tokens dele (um único accent). */

/* granulado fino e estático: tira o ar "digital" dos campos lisos */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 49; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.17  0 0 0 0 0.11  0 0 0 0 0.08  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::after { opacity: .1; filter: invert(1); } }

/* ---------- 1. Capa em 3D ----------
   A parede deita para trás (--tilt), cada coluna fica numa profundidade diferente e a câmera
   acompanha o mouse (--mx, --my). Rolando a página, a parede deita mais, como uma grua subindo. */
@property --tilt { syntax: '<angle>'; inherits: true; initial-value: 16deg; }
.hero { perspective: 1400px; perspective-origin: 50% 35%; }
.wall {
  transform-style: preserve-3d;
  transform:
    translate3d(calc(var(--mx, 0) * -36px), calc(var(--my, 0) * -24px), 0)
    rotateX(calc(var(--tilt) - var(--my, 0) * 5deg))
    rotateY(calc(var(--mx, 0) * 7deg))
    rotateZ(-8deg) scale(1.1);
}
/* mosaico infinito (depth.js): colunas posicionadas por JS, cada uma numa profundidade */
/* a parede (plano z = 0) não pode ficar na frente das colunas mais ao fundo no hit-test: só as telas recebem o mouse */
.wall.mz { display: block; pointer-events: none; }
.wall.mz .mz-tile { pointer-events: auto; }
.mz-col { position: absolute; top: 0; left: 0; height: 100%; will-change: transform; }
.mz-track { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.mz-tile { position: absolute; left: 0; width: 100%; }
.mz-tile img { pointer-events: none; -webkit-user-drag: none; }
.hero { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.hero.dragging { cursor: grabbing; }
.hero.dragging .mz-tile { pointer-events: none; }
.hero a, .hero button:not(.mz-tile) { cursor: pointer; }
.mz-hint {
  display: inline-flex; align-items: center; gap: 10px; margin: 28px 0 0; padding: 8px 14px; border-radius: 999px;
  font-size: .7rem; color: var(--screen-ink); background: oklch(0.12 0.03 50 / .62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.mz-hint span { font-size: .95rem; letter-spacing: 0; }
.hero.dragged .mz-hint { opacity: 0; transform: translateY(6px); }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero { animation: crane linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    @keyframes crane { to { --tilt: 42deg; } }
  }
}

/* ---------- 2. Tipografia cinética ---------- */
.kw { display: inline-block; white-space: nowrap; }
.kl { display: inline-block; font-weight: calc(900 - 500 * var(--k, 0)); transform: translateY(calc(var(--k, 0) * -.03em)); }
.hero-title em .kl { text-shadow: none; }

/* ---------- 3. Números ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px clamp(16px, 3vw, 40px); max-width: 560px; margin: 28px 0 4px; padding-top: 22px; border-top: 1px solid var(--line); }
.stats dt { line-height: 1.35; }
.stats div { display: flex; flex-direction: column-reverse; gap: 6px; }
.stats dd { margin: 0; font-family: var(--f-display); font-weight: 900; font-variation-settings: "wdth" 70; font-size: var(--s3); line-height: .85; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats div:first-child dd { color: var(--accent); }
.stats dt { color: var(--muted); font-size: .7rem; }

/* ---------- 5. Grade: card como timeline ---------- */
@media (hover: hover) and (pointer: fine) {
  .proj-media { transform: perspective(900px) rotateY(calc(var(--tx, 0) * 3deg)) rotateX(calc(var(--ty, 0) * -3deg)); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
  .proj:hover .proj-media { box-shadow: 0 22px 44px -24px rgb(43 29 20 / .55); }
  .proj-media.scrubbing { transition: box-shadow .35s var(--ease); }
}
.proj-media.scrubbing .proj-scrub::after { transform: scaleX(var(--x, 0)); transition: none; }
.scrub-head { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .15s; }
.proj-media.scrubbing .scrub-head { opacity: 1; }
.scrub-head.still { display: none; }
.scrub-head i { position: absolute; top: 0; bottom: 0; left: calc(var(--x, 0) * 100%); width: 2px; margin-left: -1px; background: var(--screen-ink); box-shadow: 0 0 0 1px oklch(0.12 0.03 50 / .35); }
.scrub-head b {
  position: absolute; top: 12px; left: 12px; padding: 5px 8px; border-radius: 6px; background: oklch(0.12 0.03 50 / .72); color: var(--screen-ink);
  font: 500 .68rem/1 var(--f-mono); letter-spacing: .06em; font-variant-numeric: tabular-nums;
}
.proj-led + .proj-cue ~ .scrub-head b { top: 12px; }

/* ---------- 6. Case ---------- */
.case-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: var(--ease); }

@media (max-width: 720px) {
  .stats { gap: 14px 28px; }
  .stats dd { font-size: var(--s2); }
  .mz-hint { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .kl { font-weight: inherit; transform: none; }
}
