/* OUVIR DESIGN SYSTEM — tokens e componentes base.
   Escopo: classes .ofx-* e variáveis --ofx-* (nenhum seletor global é sobrescrito).
   Uso opcional: o restante da plataforma continua com app.css e os temas das rádios. */

:root {
  --ofx-cyan: #20d9ff;
  --ofx-cyan-deep: #0891b2;
  --ofx-violet: #a78bfa;
  --ofx-mint: #96f7b3;
  --ofx-amber: #ffd479;
  --ofx-rose: #ff7ab6;
  --ofx-bg: #050b18;
  --ofx-bg-soft: #071427;
  --ofx-surface: #0b1626;
  --ofx-surface-2: #102338;
  --ofx-line: #22405a;
  --ofx-line-soft: #17324a;
  --ofx-text: #eaf6ff;
  --ofx-muted: #9fb6cb;
  --ofx-focus: #7de3ff;
  --ofx-ok: #34d399;
  --ofx-warn: #fbbf24;
  --ofx-danger: #f87171;
  --ofx-radius-xs: 6px;
  --ofx-radius-sm: 10px;
  --ofx-radius-md: 14px;
  --ofx-radius-lg: 22px;
  --ofx-radius-pill: 999px;
  --ofx-space-1: 4px;
  --ofx-space-2: 8px;
  --ofx-space-3: 12px;
  --ofx-space-4: 16px;
  --ofx-space-5: 24px;
  --ofx-space-6: 32px;
  --ofx-space-7: 48px;
  --ofx-shadow-sm: 0 2px 8px rgba(1, 8, 18, .35);
  --ofx-shadow-md: 0 12px 32px rgba(1, 8, 18, .45);
  --ofx-shadow-lg: 0 28px 70px rgba(1, 8, 18, .55);
  --ofx-glow: 0 0 0 1px rgba(32, 217, 255, .28), 0 0 28px rgba(32, 217, 255, .18);
  --ofx-font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ofx-font-mono: "Cascadia Code", ui-monospace, Consolas, monospace;
  --ofx-dur-fast: 160ms;
  --ofx-dur-base: 260ms;
  --ofx-dur-slow: 480ms;
  --ofx-ease: cubic-bezier(.22, .61, .36, 1);
  --ofx-ease-out: cubic-bezier(.16, 1, .3, 1);
  --ofx-intensity: 1;
}

html[data-ofx-mode="economy"] {
  --ofx-dur-fast: 90ms;
  --ofx-dur-base: 140ms;
  --ofx-dur-slow: 200ms;
}

html[data-ofx-mode="ultra"] {
  --ofx-dur-base: 320ms;
  --ofx-dur-slow: 620ms;
}

html.ofx-reduced {
  --ofx-dur-fast: 1ms;
  --ofx-dur-base: 1ms;
  --ofx-dur-slow: 1ms;
}

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

/* Superfície e cartão */
:where(.ofx-card) {
  background: linear-gradient(160deg, var(--ofx-surface-2), var(--ofx-surface));
  border: 1px solid var(--ofx-line);
  border-radius: var(--ofx-radius-md);
  box-shadow: var(--ofx-shadow-md);
  color: var(--ofx-text);
  padding: var(--ofx-space-5);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
:where(.ofx-card--glow)::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, rgba(32, 217, 255, .22), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
:where(.ofx-card__title) {
  margin: 0 0 var(--ofx-space-2);
  font-size: 18px;
  line-height: 1.25;
  color: var(--ofx-text);
}
:where(.ofx-card__text) {
  margin: 0;
  color: var(--ofx-muted);
  line-height: 1.55;
}

/* Botões */
:where(.ofx-btn) {
  --ofx-btn-bg: var(--ofx-surface-2);
  --ofx-btn-fg: var(--ofx-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ofx-space-2);
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ofx-line);
  border-radius: var(--ofx-radius-pill);
  background: var(--ofx-btn-bg);
  color: var(--ofx-btn-fg);
  font: 700 14px/1 var(--ofx-font-sans);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--ofx-dur-fast) var(--ofx-ease),
              box-shadow var(--ofx-dur-fast) var(--ofx-ease),
              background-color var(--ofx-dur-fast) var(--ofx-ease),
              border-color var(--ofx-dur-fast) var(--ofx-ease);
}
:where(.ofx-btn):hover { transform: translateY(-1px); border-color: var(--ofx-focus); }
:where(.ofx-btn):active { transform: translateY(0) scale(.985); }
:where(.ofx-btn):focus-visible { outline: 2px solid var(--ofx-focus); outline-offset: 3px; }
:where(.ofx-btn--primary) {
  --ofx-btn-bg: linear-gradient(120deg, var(--ofx-cyan-deep), var(--ofx-cyan));
  --ofx-btn-fg: #021019;
  border-color: transparent;
  box-shadow: var(--ofx-glow);
}
:where(.ofx-btn--ghost) {
  --ofx-btn-bg: transparent;
}
:where(.ofx-btn--danger) {
  --ofx-btn-bg: linear-gradient(120deg, #7f1d1d, var(--ofx-danger));
  --ofx-btn-fg: #fff;
  border-color: transparent;
}
:where(.ofx-btn)[disabled],
:where(.ofx-btn)[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

/* Chips, etiquetas e estados */
:where(.ofx-chip) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--ofx-radius-pill);
  border: 1px solid var(--ofx-line);
  background: rgba(16, 35, 56, .7);
  color: var(--ofx-muted);
  font: 600 12px/1.4 var(--ofx-font-sans);
}
:where(.ofx-chip--on) { color: var(--ofx-mint); border-color: rgba(150, 247, 179, .45); }
:where(.ofx-chip--warn) { color: var(--ofx-amber); border-color: rgba(255, 212, 121, .45); }
:where(.ofx-chip--off) { color: var(--ofx-danger); border-color: rgba(248, 113, 113, .45); }

:where(.ofx-badge) {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--ofx-radius-pill);
  background: var(--ofx-cyan);
  color: #021019;
  font: 800 11px/1 var(--ofx-font-sans);
}

/* Formulários */
:where(.ofx-field) {
  display: grid;
  gap: 6px;
  margin: 0 0 var(--ofx-space-4);
  color: var(--ofx-muted);
  font: 600 13px/1.4 var(--ofx-font-sans);
}
:where(.ofx-field) :is(input, select, textarea) {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--ofx-line);
  border-radius: var(--ofx-radius-sm);
  background: var(--ofx-bg-soft);
  color: var(--ofx-text);
  font: 400 15px/1.4 var(--ofx-font-sans);
  transition: border-color var(--ofx-dur-fast) var(--ofx-ease),
              box-shadow var(--ofx-dur-fast) var(--ofx-ease);
}
:where(.ofx-field) :is(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--ofx-focus);
  box-shadow: 0 0 0 3px rgba(32, 217, 255, .22);
}

/* Avisos e progresso */
:where(.ofx-notice) {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--ofx-line);
  border-left: 3px solid var(--ofx-cyan);
  border-radius: var(--ofx-radius-sm);
  background: rgba(11, 22, 38, .85);
  color: var(--ofx-muted);
  line-height: 1.5;
}
:where(.ofx-notice--warn) { border-left-color: var(--ofx-amber); }
:where(.ofx-notice--danger) { border-left-color: var(--ofx-danger); }
:where(.ofx-notice--ok) { border-left-color: var(--ofx-ok); }

:where(.ofx-progress) {
  height: 8px;
  border-radius: var(--ofx-radius-pill);
  background: rgba(34, 64, 90, .65);
  overflow: hidden;
}
:where(.ofx-progress) > i {
  display: block;
  height: 100%;
  width: calc(var(--ofx-p, 0) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ofx-cyan-deep), var(--ofx-cyan), var(--ofx-mint));
  transition: width var(--ofx-dur-slow) var(--ofx-ease-out);
}

:where(.ofx-skeleton) {
  border-radius: var(--ofx-radius-sm);
  background: linear-gradient(100deg, rgba(34, 64, 90, .45) 20%, rgba(125, 227, 255, .18) 40%, rgba(34, 64, 90, .45) 60%);
  background-size: 220% 100%;
  animation: ofx-shimmer 1.6s linear infinite;
}

/* Revelação (só esconde quando o motor confirmou que está ativo) */
html.ofx-ready [data-ofx="reveal"]:not(.ofx-in),
html.ofx-ready [data-ofx-stagger] > *:not(.ofx-in) {
  opacity: 0;
  transform: translate3d(0, var(--ofx-reveal-y, 22px), 0);
}
[data-ofx="reveal"].ofx-in,
[data-ofx-stagger] > .ofx-in {
  animation: ofx-reveal var(--ofx-dur-slow) var(--ofx-ease-out) backwards;
}
@keyframes ofx-reveal {
  from { opacity: 0; transform: translate3d(0, var(--ofx-reveal-y, 22px), 0); }
  to { opacity: 1; transform: none; }
}

/* Superfícies com brilho que segue o ponteiro */
:where(.ofx-glow) { position: relative; overflow: hidden; }
:where(.ofx-glow)::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ofx-dur-base) var(--ofx-ease);
  background: radial-gradient(220px circle at var(--ofx-mx, 50%) var(--ofx-my, 50%),
              rgba(32, 217, 255, .20), transparent 62%);
}
:where(.ofx-glow):hover::before { opacity: 1; }

/* Tilt 3D */
:where(.ofx-tilt) {
  transform-style: preserve-3d;
  transition: transform var(--ofx-dur-fast) var(--ofx-ease);
  will-change: transform;
}
:where(.ofx-tilt) > * { transform: translateZ(.01px); }

/* Ondas do equalizador (fallback sem canvas) */
:where(.ofx-eq) {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 34px;
}
:where(.ofx-eq) > i {
  display: block;
  flex: 1;
  min-width: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--ofx-cyan), var(--ofx-cyan-deep));
  transform-origin: bottom;
  animation: ofx-eq 1.1s ease-in-out infinite;
  animation-delay: calc(var(--ofx-i, 0) * -90ms);
}
:where(.ofx-live-dot) {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ofx-danger);
  box-shadow: 0 0 0 0 rgba(248, 113, 113, .55);
  animation: ofx-pulse 2s ease-out infinite;
}

@keyframes ofx-shimmer { to { background-position: -220% 0; } }
@keyframes ofx-eq {
  0%, 100% { transform: scaleY(.35); }
  35% { transform: scaleY(1); }
  65% { transform: scaleY(.55); }
}
@keyframes ofx-pulse {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .55); }
  70% { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}
@keyframes ofx-ripple {
  from { transform: scale(0); opacity: .5; }
  to { transform: scale(2.6); opacity: 0; }
}
:where(.ofx-ripple-ink) {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: currentColor;
  opacity: .35;
  transform: scale(0);
  animation: ofx-ripple 620ms var(--ofx-ease-out) forwards;
}

/* Partículas e confete */
:where(.ofx-canvas) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
:where(.ofx-canvas-host) { position: relative; overflow: hidden; }
:where(.ofx-canvas-host) > :not(.ofx-canvas):not(.ofx-confetti) { position: relative; z-index: 1; }

html.ofx-reduced [data-ofx="reveal"],
html.ofx-reduced [data-ofx-stagger] > * {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
  animation: none !important;
}
html.ofx-reduced :where(.ofx-eq) > i,
html.ofx-reduced :where(.ofx-live-dot),
html.ofx-reduced :where(.ofx-skeleton) {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  :where(.ofx-eq) > i,
  :where(.ofx-live-dot),
  :where(.ofx-skeleton) { animation: none !important; }
}
