/* =====================================================================
   AudioFB · Hero "Exploded View" + Blocos
   Arquivo isolado (prefixo .afb-) — não conflita com o style.css atual.
   Carregar DEPOIS do style.css.
   ===================================================================== */

:root {
  /* Base — herda a identidade escura do site */
  --afb-bg: #0a0a0d;
  --afb-panel: #14141b;
  --afb-panel-2: #1c1c26;
  --afb-ink: #f5f5f2;
  --afb-muted: #8a8a99;
  --afb-line: rgba(255, 255, 255, 0.10);
  --afb-line-soft: rgba(255, 255, 255, 0.06);

  /* Uma cor por camada do exploded view = significado, não enfeite */
  --afb-ui:      #ffb454;  /* 01 · INTERFACE  (âmbar)  */
  --afb-signal:  #35d0e6;  /* 02 · SIGNAL FLOW (ciano)  */
  --afb-code:    #7ef29a;  /* 03 · DSP CODE   (verde)  */
  --afb-core:    #c77dff;  /* 04 · AI CORE    (violeta)*/

  --afb-radius: 14px;
  --afb-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- HERO WRAPPER ---------------------------------------------- */
.afb-hero {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 1.5rem clamp(1rem, 3vw, 2rem);
  text-align: center;
}

.afb-hero__eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--afb-muted);
  margin: 0 0 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.afb-hero__eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--afb-signal));
}
.afb-hero__eyebrow::after {
  content: "";
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--afb-core), transparent);
}

.afb-hero__title {
  font-family: "Bricolage Grotesque", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 6vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--afb-ink);
  margin: 0 auto 1rem;
  max-width: 15ch;
}
.afb-hero__title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--afb-ui), var(--afb-core));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.afb-hero__sub {
  font-family: "Inter", sans-serif;
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  line-height: 1.6;
  color: var(--afb-muted);
  max-width: 46ch;
  margin: 0 auto clamp(2rem, 5vw, 3.2rem);
}

/* ---------- STAGE (perspectiva 3D) ----------------------------------- */
.afb-stage-wrap {
  perspective: 1600px;
  perspective-origin: 50% 42%;
  margin: 0 auto;
  width: min(560px, 90vw);
  aspect-ratio: 4 / 3;
  position: relative;
}

.afb-stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--afb-rx, 8deg)) rotateY(var(--afb-ry, -14deg));
  transition: transform 0.25s ease-out;
  cursor: pointer;
}
.afb-stage.is-exploded {
  transition: transform 0.25s ease-out;
}

/* Camadas base */
.afb-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--afb-radius);
  transform-style: preserve-3d;
  transition:
    transform 0.75s var(--afb-ease),
    opacity 0.55s ease;
  will-change: transform, opacity;
  overflow: hidden;
  background: var(--afb-panel);
  border: 1px solid var(--afb-line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}

/* --- Estado de REPOUSO: só a interface aparece (parece um VST) ------- */
.afb-layer--ui       { transform: translateZ(0);      opacity: 1; }
.afb-layer--modules  { transform: translateZ(-24px) scale(0.98); opacity: 0; }
.afb-layer--code     { transform: translateZ(-48px) scale(0.96); opacity: 0; }
.afb-layer--brain    { transform: translateZ(-72px) scale(0.94); opacity: 0; }

/* --- Estado EXPLODIDO: as camadas se afastam em Z + Y ---------------- */
.is-exploded .afb-layer--ui {
  transform: translate3d(0, -46px, 230px);
}
.is-exploded .afb-layer--modules {
  transform: translate3d(0, -14px, 70px);
  opacity: 1;
}
.is-exploded .afb-layer--code {
  transform: translate3d(0, 16px, -110px);
  opacity: 1;
}
.is-exploded .afb-layer--brain {
  transform: translate3d(0, 46px, -320px);
  opacity: 1;
}

/* Etiqueta de cada camada (aparece ao explodir) */
.afb-layer__tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  border: 1px solid currentColor;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 5;
}
.is-exploded .afb-layer__tag { opacity: 1; transform: translateY(0); }
.afb-layer--ui      .afb-layer__tag { color: var(--afb-ui); }
.afb-layer--modules .afb-layer__tag { color: var(--afb-signal); }
.afb-layer--code    .afb-layer__tag { color: var(--afb-code); }
.afb-layer--brain   .afb-layer__tag { color: var(--afb-core); }

/* =====================================================================
   CAMADA 01 · INTERFACE (VST fake)
   ===================================================================== */
.afb-ui-panel {
  position: absolute;
  inset: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  background:
    radial-gradient(120% 90% at 80% -10%, rgba(255, 180, 84, 0.12), transparent 55%),
    linear-gradient(180deg, #191118, #0e0b10);
}
.afb-ui-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.afb-ui-brand {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--afb-ui);
  border: 1px solid rgba(255, 180, 84, 0.4);
  padding: 3px 8px;
  border-radius: 6px;
}
.afb-ui-name {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--afb-ink);
  letter-spacing: -0.01em;
}
.afb-ui-ver {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.55rem;
  color: var(--afb-muted);
}
.afb-ui-scope {
  position: relative;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 180, 84, 0.18);
  overflow: hidden;
}
.afb-ui-scope svg { width: 100%; height: 100%; display: block; }
.afb-ui-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 1.2fr;
  gap: 10px;
  align-items: end;
}
.afb-knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.afb-knob__dial {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    conic-gradient(var(--afb-ui) 0 var(--k, 65%), rgba(255,255,255,0.08) var(--k, 65%) 100%);
  padding: 4px;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), inset 0 0 12px rgba(0,0,0,0.6);
}
.afb-knob__dial::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a2a34, #101015);
}
.afb-knob__dial::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 2px;
  height: 12px;
  background: var(--afb-ui);
  border-radius: 2px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(calc((var(--k, 65) - 50) * 2.4deg));
}
.afb-knob__lbl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--afb-muted);
  text-transform: uppercase;
}
.afb-xy {
  border-radius: 8px;
  background:
    linear-gradient(rgba(53,208,230,0.06), rgba(53,208,230,0.06)),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(255,255,255,0.04) 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(255,255,255,0.04) 11px 12px);
  border: 1px solid rgba(53,208,230,0.2);
  position: relative;
}
.afb-xy__dot {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  left: 62%; top: 40%;
  background: var(--afb-signal);
  box-shadow: 0 0 14px var(--afb-signal);
}

/* =====================================================================
   CAMADA 02 · SIGNAL FLOW (blocos + fios)
   ===================================================================== */
.afb-mod {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(53,208,230,0.10), transparent 55%),
    linear-gradient(180deg, #0b1416, #08090d);
}
.afb-mod svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* =====================================================================
   CAMADA 03 · DSP CODE
   ===================================================================== */
.afb-code {
  position: absolute;
  inset: 0;
  padding: 20px 18px;
  background:
    radial-gradient(120% 90% at 80% 100%, rgba(126,242,154,0.09), transparent 55%),
    linear-gradient(180deg, #0a120c, #070a08);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  line-height: 1.75;
  color: #6f7d72;
  overflow: hidden;
}
.afb-code__scroll { animation: afb-code-drift 14s linear infinite; }
@keyframes afb-code-drift {
  from { transform: translateY(0); }
  to   { transform: translateY(-40%); }
}
.afb-code .k { color: var(--afb-core); }   /* keyword  */
.afb-code .f { color: var(--afb-signal); } /* função   */
.afb-code .s { color: var(--afb-code); }   /* string   */
.afb-code .n { color: var(--afb-ui); }     /* número   */
.afb-code .c { color: #4a5750; }           /* comentário */

/* =====================================================================
   CAMADA 04 · AI CORE (cérebro)
   ===================================================================== */
.afb-brain {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60% 55% at 50% 48%, rgba(199,125,255,0.16), transparent 70%),
    linear-gradient(180deg, #100a16, #07060a);
}
.afb-brain svg { width: 74%; height: 74%; overflow: visible; }
.afb-brain__node { fill: var(--afb-core); }
.afb-brain__node--pulse {
  animation: afb-pulse 2.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes afb-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ---------- Dica de interação ---------------------------------------- */
.afb-stage__hint {
  position: absolute;
  left: 50%;
  bottom: -2.6rem;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--afb-muted);
  white-space: nowrap;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.afb-stage__hint b { color: var(--afb-ink); font-weight: 600; }
.is-exploded ~ .afb-stage__hint,
.afb-stage-wrap.is-open .afb-stage__hint { opacity: 0.35; }

/* =====================================================================
   BLOCOS (Audio Plugins · Projects Beyond)
   ===================================================================== */
.afb-blocks {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: clamp(4rem, 9vw, 7rem) auto 0;
  padding: 0 1.5rem clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}
.afb-block {
  position: relative;
  display: block;
  text-decoration: none;
  padding: clamp(1.6rem, 3vw, 2.4rem);
  min-height: 260px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
  border: 1px solid var(--afb-line);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--afb-ease), border-color 0.4s ease;
}
.afb-block::after {
  /* brilho de acento que sobe no hover */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 70% at 50% 120%, var(--afb-accent), transparent 70%);
  opacity: 0.12;
  transition: opacity 0.5s ease, transform 0.6s var(--afb-ease);
  transform: translateY(30%);
  z-index: -1;
}
.afb-block:hover,
.afb-block:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--afb-accent) 55%, transparent);
}
.afb-block:hover::after,
.afb-block:focus-visible::after { opacity: 0.22; transform: translateY(0); }
.afb-block:focus-visible { outline: 2px solid var(--afb-accent); outline-offset: 3px; }

.afb-block--plugins  { --afb-accent: var(--afb-ui); }
.afb-block--projects { --afb-accent: var(--afb-core); }

.afb-block__index {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--afb-accent);
}
.afb-block__title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--afb-ink);
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.6rem;
}
.afb-block__desc {
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--afb-muted);
  max-width: 34ch;
  margin: 0;
}
.afb-block__cta {
  position: absolute;
  left: clamp(1.6rem, 3vw, 2.4rem);
  bottom: clamp(1.4rem, 3vw, 2rem);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--afb-ink);
}
.afb-block__cta svg { transition: transform 0.4s var(--afb-ease); }
.afb-block:hover .afb-block__cta svg,
.afb-block:focus-visible .afb-block__cta svg { transform: translateX(5px); }

/* mini-visual decorativo do bloco */
.afb-block__viz {
  position: absolute;
  right: clamp(1.2rem, 2.5vw, 2rem);
  top: clamp(1.2rem, 2.5vw, 2rem);
  width: 92px; height: 92px;
  opacity: 0.85;
}
.afb-block__viz svg { width: 100%; height: 100%; overflow: visible; }

/* =====================================================================
   RESPONSIVO
   ===================================================================== */
@media (max-width: 720px) {
  .afb-blocks { grid-template-columns: 1fr; }
  .afb-block { min-height: 220px; }
  .afb-block__viz { width: 72px; height: 72px; }
}

/* =====================================================================
   ACESSIBILIDADE — respeita reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .afb-stage,
  .afb-layer,
  .afb-block,
  .afb-block::after { transition: none !important; }
  .afb-code__scroll,
  .afb-brain__node--pulse { animation: none !important; }
}

/* =====================================================================
   MÓDULOS · nós + fios (camada 02) — usado dentro do SVG
   ===================================================================== */
.afb-node {
  fill: #0e1a1d;
  stroke: rgba(53, 208, 230, 0.55);
  stroke-width: 1.2;
}
.afb-node--ai { stroke: var(--afb-core); fill: #150e1c; }
.afb-node-lbl {
  fill: var(--afb-signal);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-anchor: middle;
  dominant-baseline: middle;
}
.afb-node-lbl--ai { fill: var(--afb-core); }
.afb-pin { fill: var(--afb-signal); }
.afb-pin--ai { fill: var(--afb-core); }

.afb-wire {
  fill: none;
  stroke: var(--afb-signal);
  stroke-width: 1.8;
  stroke-dasharray: 5 7;
  filter: drop-shadow(0 0 3px rgba(53, 208, 230, 0.5));
  animation: afb-flow 1.1s linear infinite;
}
.afb-wire--ai { stroke: var(--afb-core); filter: drop-shadow(0 0 3px rgba(199, 125, 255, 0.5)); }
@keyframes afb-flow { to { stroke-dashoffset: -24; } }

/* mini-visual dos blocos */
.afb-viz-line {
  fill: none;
  stroke: var(--afb-accent);
  stroke-width: 2;
  opacity: 0.9;
}
.afb-viz-dot { fill: var(--afb-accent); }

@media (prefers-reduced-motion: reduce) {
  .afb-wire { animation: none !important; }
}
