/* ==========================================================================
   WT Visual & Motion — COMPONENTES (ver DESIGN_SYSTEM.md §7)
   Proibido hex aqui: use tokens.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 0.25em; }
a:hover { text-decoration-color: var(--accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: var(--track-tight); line-height: 1.05; }
p { margin: 0 0 var(--s-4); max-width: var(--measure); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--c-noite-950); }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: var(--z-toast);
  background: var(--fg); color: var(--bg); padding: var(--s-3) var(--s-4);
}
.skip-link:focus { top: var(--s-4); }

.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* ---- Tipografia utilitária ---- */
.display { font-size: var(--fs-display); line-height: 0.95; }
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); line-height: 1.2; letter-spacing: -0.02em; }
.lead { font-size: var(--fs-lead); color: var(--fg-2); line-height: 1.5; }
.muted { color: var(--fg-3); }
.small { font-size: var(--fs-small); }
.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500;
  letter-spacing: var(--track-label); text-transform: uppercase; color: var(--fg-3);
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
.eyebrow .num { color: var(--fg); }

/* ---- Botões ---- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--fg); --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  min-height: 52px; padding: 0 var(--s-6);
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-line);
  border-radius: var(--r-0); cursor: pointer;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease), border-color var(--t-base) var(--ease), transform var(--t-fast) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; transition: transform var(--t-base) var(--ease); }
.btn:hover svg.arrow { transform: translateX(4px); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.btn--primary, .btn--wa {
  --btn-bg: var(--c-osso-50); --btn-fg: var(--c-noite-950); --btn-line: transparent;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}
.btn--primary:hover, .btn--wa:hover { --btn-bg: var(--accent); }
.theme-osso .btn--primary, .theme-osso .btn--wa { --btn-bg: var(--c-noite-950); --btn-fg: var(--c-osso-50); }
.theme-osso .btn--primary:hover, .theme-osso .btn--wa:hover { --btn-bg: var(--c-marco-500); --btn-fg: var(--c-noite-950); }
.btn--ghost:hover { --btn-line: var(--fg); }
.btn--sm { min-height: 40px; padding: 0 var(--s-4); letter-spacing: 0.14em; }
.btn--danger { --btn-fg: var(--c-erro); --btn-line: color-mix(in srgb, var(--c-erro) 50%, transparent); }
.btn--danger:hover { --btn-bg: var(--c-erro); --btn-fg: var(--c-noite-950); }
.btn--block { width: 100%; }

/* ---- Moldura (viewfinder) ---- */
.frame { position: relative; }
.frame::before, .frame::after, .frame > .frame__c1, .frame > .frame__c2 {
  content: ""; position: absolute; width: var(--frame-arm); height: var(--frame-arm);
  border: 0 solid var(--fg-3); border-width: 0; pointer-events: none; z-index: 2;
  transition: border-color var(--t-base) var(--ease);
}
.frame::before { top: -1px; left: -1px; border-top-width: var(--frame-weight); border-left-width: var(--frame-weight); }
.frame::after { bottom: -1px; right: -1px; border-bottom-width: var(--frame-weight); border-right-width: var(--frame-weight); }
.frame > .frame__c1 { top: -1px; right: -1px; border-top-width: var(--frame-weight); border-right-width: var(--frame-weight); }
.frame > .frame__c2 { bottom: -1px; left: -1px; border-bottom-width: var(--frame-weight); border-left-width: var(--frame-weight); }
.frame:hover::before, .frame:hover::after, .frame:hover > .frame__c1, .frame:hover > .frame__c2 { border-color: var(--accent); }

/* ---- Tag / chip ---- */
.tag {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-4);
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
  color: var(--fg-2); background: transparent; border: 1px solid var(--line-strong); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tag:hover { border-color: var(--fg); }
.tag[aria-pressed="true"], .tag.is-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ---- Campos ---- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label, .field > .label {
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-3);
}
.field .req { color: var(--accent); }
.input, .select, .textarea {
  width: 100%; min-height: 52px; padding: var(--s-3) var(--s-4);
  background: var(--surface-2); color: var(--fg);
  border: 1px solid transparent; border-bottom-color: var(--line-strong); border-radius: var(--r-1);
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: var(--s-7); }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .select:hover, .textarea:hover { background: var(--surface-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-bottom-color: var(--accent); background: var(--surface-3); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-bottom-color: var(--c-erro); }
.field__error { min-height: 1.25em; font-size: var(--fs-small); color: var(--c-erro); }
.field__hint { font-size: var(--fs-small); color: var(--fg-3); }
.check { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--fs-small); color: var(--fg-3); line-height: 1.5; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check a { color: var(--fg); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Alertas / badges ---- */
.alert {
  padding: var(--s-4) var(--s-5); background: var(--surface-2); border-left: 2px solid var(--fg-3);
  font-size: var(--fs-small); color: var(--fg-2);
}
.alert--ok { border-left-color: var(--c-ok); }
.alert--warn { border-left-color: var(--c-warn); }
.alert--erro { border-left-color: var(--c-erro); }
.alert p:last-child { margin-bottom: 0; }

.badge { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-4); }
.badge--ok::before { background: var(--c-ok); }
.badge--warn::before { background: var(--c-warn); }
.badge--erro::before { background: var(--c-erro); }
.badge--accent::before { background: var(--accent); }

/* ---- Tabela ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table th { text-align: left; padding: var(--s-3) var(--s-4); font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-3); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) { background: var(--surface-1); }
.table tbody tr:hover { background: var(--surface-3); }
.table a { text-decoration: none; }

/* ---- KPI ---- */
.kpi { padding: var(--s-5); background: var(--surface-1); border: 1px solid var(--line); }
.kpi__label { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-3); }
.kpi__value { margin-top: var(--s-2); font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 700; letter-spacing: var(--track-tight); line-height: 1; }
.kpi__note { margin-top: var(--s-2); font-size: var(--fs-small); color: var(--fg-3); }

/* ---- Revelar ao rolar (JS marca .is-pending só fora da dobra; sem JS tudo visível) ---- */
.reveal.is-pending { opacity: 0; transform: translateY(16px); transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease); transition-delay: calc(var(--i, 0) * 60ms); }
.reveal.is-pending.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal.is-pending { opacity: 1; transform: none; }
}
