/* =========================================================
   Malzon IA | Em construção
   1. Tokens  2. Base  3. Componentes  4. Seções  5. Responsivo
   ========================================================= */

/* ---------- 0. Fontes (self-hosted, subset latin) ---------- */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/bricolage-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ---------- 1. Tokens ---------- */
:root {
  /* primitivos */
  --graphite-950: #0d0c0a;
  --graphite-900: #14120f;
  --graphite-850: #1a1814;
  --sand-50: #f2ede4;
  --sand-300: #b3ab9e;
  --sand-500: #8c8578; /* 4.85:1 no surface mais claro */
  --copper-400: #f08a4b;
  --copper-500: #e8743b;
  --copper-700: #9c4a20;

  /* semânticos */
  --background: var(--graphite-950);
  --surface: var(--graphite-900);
  --surface-raised: var(--graphite-850);
  --foreground: var(--sand-50);
  --muted-foreground: var(--sand-300);
  --subtle-foreground: var(--sand-500);
  --border: rgba(242, 237, 228, 0.09);
  --border-strong: rgba(242, 237, 228, 0.18);
  --primary: var(--copper-500);
  --primary-hover: var(--copper-400);
  --primary-deep: var(--copper-700);
  --primary-foreground: var(--graphite-950);
  --primary-soft: rgba(232, 116, 59, 0.14);
  --focus-ring: rgba(240, 138, 75, 0.55);
  --grid-dot: rgba(242, 237, 228, 0.055);

  /* tipografia */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-display: clamp(2.5rem, 1.4rem + 4.4vw, 4.75rem);

  /* espaçamento 8pt */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-panel: 0 24px 64px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-cta: 0 8px 24px rgba(232, 116, 59, 0.28);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --page-gutter: clamp(20px, 5vw, 64px);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--foreground);
  font-family: var(--font-display);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--primary); color: var(--primary-foreground); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---------- 3. Componentes ---------- */

/* fita de obra no topo */
.tape {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--primary) 0 12px,
    var(--background) 12px 24px
  );
  background-size: 34px 6px;
  animation: tape-move 1.6s linear infinite;
  opacity: 0.9;
}

@keyframes tape-move { to { background-position: 34px 0; } }

/* marca */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.03em;
}

.brand__tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 4px;
}

/* pílula de status */
.status {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 var(--focus-ring);
  animation: pulse 2s var(--ease-out) infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--focus-ring); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(240, 138, 75, 0); }
}

/* botão principal */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 var(--space-4);
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  text-decoration: none;
  box-shadow: var(--shadow-cta);
  transition: background-color 150ms ease-out, transform 150ms ease-out;
}

.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }

.btn__icon { width: 22px; height: 22px; flex: none; }

.btn__arrow {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 150ms ease-out;
}

.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---------- 4. Seções ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--page-gutter);
}

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: var(--space-7);
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-6) var(--page-gutter) var(--space-7);
}

/* coluna de texto */
.eyebrow {
  margin: 0 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.headline {
  margin: 0;
  max-width: 13ch;
  font-size: var(--text-display);
  font-weight: 700;
  font-variation-settings: "opsz" 96;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lede {
  margin: var(--space-4) 0 0;
  max-width: 46ch;
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.roadmap {
  list-style: none;
  margin: var(--space-5) 0 0;
  padding: 0;
  max-width: 420px;
  border-top: 1px solid var(--border);
}

.roadmap li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  font-weight: 500;
}

.roadmap__idx {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--subtle-foreground);
}

.cta { margin-top: var(--space-5); }

.cta__micro {
  margin: 12px 0 0;
  font-size: var(--text-sm);
  color: var(--subtle-foreground);
}

/* coluna visual */
.rig__frame {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.rig__corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--primary);
  border-style: solid;
  border-width: 0;
  z-index: 2;
  pointer-events: none;
}
.rig__corner--tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.rig__corner--tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.rig__corner--bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.rig__corner--br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }

.rig__meta {
  position: absolute;
  top: var(--space-3);
  left: var(--space-5);
  right: var(--space-5);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle-foreground);
  z-index: 1;
}

.rig__stage { position: relative; }

.rig__canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
}

/* área clicável sobre o chip do canvas (posição definida no JS) */
.rig__chip {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.rig__hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--primary);
  padding: 2px 8px;
  background: var(--surface);
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease-out;
}

.rig__hint.is-ready { opacity: 1; }
.rig__hint::before { content: "↑ "; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* terminal */
.terminal {
  border-top: 1px solid var(--border);
  background: var(--background);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
}

.terminal__head {
  display: flex;
  justify-content: space-between;
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--subtle-foreground);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.terminal__log {
  list-style: none;
  margin: 0;
  padding: var(--space-3) var(--space-4) 0;
  height: calc(7 * 1.7em + var(--space-3));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--muted-foreground);
}

.terminal__log li { white-space: pre-wrap; word-break: break-word; }
.terminal__log .prompt { color: var(--primary); }
.terminal__log .ok { color: var(--foreground); }
.terminal__log .joke { color: var(--primary-hover); }
.terminal__log .next { color: var(--foreground); }

.terminal__log .caret {
  display: inline-block;
  width: 7px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--primary);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.progress__track {
  flex: 1;
  height: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface);
}

.progress__fill {
  --p: 0;
  height: 100%;
  width: 100%;
  clip-path: inset(0 calc(100% - var(--p) * 100%) 0 0);
  background: repeating-linear-gradient(
    -45deg,
    var(--primary) 0 6px,
    var(--primary-deep) 6px 12px
  );
  background-size: 17px 10px;
  animation: tape-move-sm 0.9s linear infinite;
  transition: clip-path 600ms var(--ease-out);
}

@keyframes tape-move-sm { to { background-position: 17px 0; } }

.progress__value {
  min-width: 4ch;
  text-align: right;
  color: var(--foreground);
  font-size: 12px;
}

/* rodapé */
.foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--page-gutter);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle-foreground);
}

/* entrada */
.copy > * {
  animation: rise 700ms var(--ease-out) both;
}
.copy > *:nth-child(2) { animation-delay: 60ms; }
.copy > *:nth-child(3) { animation-delay: 120ms; }
.copy > *:nth-child(4) { animation-delay: 180ms; }
.copy > *:nth-child(5) { animation-delay: 240ms; }
.rig { animation: rise 900ms 200ms var(--ease-out) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 5. Responsivo ---------- */
@media (max-width: 960px) {
  .stage {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding-top: var(--space-5);
  }
  .headline { max-width: 14ch; }
}

@media (max-width: 560px) {
  :root { --text-lg: 1.125rem; }
  .topbar { padding-block: var(--space-3); }
  .stage { padding-bottom: var(--space-6); }
  .btn { width: 100%; justify-content: center; }
  .rig__canvas { aspect-ratio: 1 / 1; }
  .terminal__log { height: auto; min-height: calc(7 * 1.7em + var(--space-3)); justify-content: flex-start; }
  .rig__meta { left: var(--space-4); right: var(--space-4); }
  .terminal { font-size: 11.5px; }
  .terminal__head, .terminal__log, .progress { padding-left: var(--space-3); padding-right: var(--space-3); }
  .foot { flex-direction: column; gap: var(--space-1); }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
