/*
 * Base visual compartilhada (login e página principal).
 * Direção: "cabine de rádio à noite" — tinta quente quase preta, texto cor de papel,
 * brilho de válvula âmbar e uma luz "no ar" vermelha. Tipografia: Fraunces (display),
 * Atkinson Hyperlegible (texto) e IBM Plex Mono (rótulos de painel).
 * Fontes locais, licença SIL OFL 1.1 (ver ./fonts/OFL-*.txt).
 */

/* ---------- Fontes ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("./fonts/fraunces-latin-full-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("./fonts/fraunces-latin-standard-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("./fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("./fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("./fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  --ink-0: #0e0c0a;
  --ink-1: #16120f;
  --ink-2: #1f1915;
  --ink-3: #2a221c;
  --line: #3a3029;
  --line-strong: #54473c;

  --paper: #f1e8da;
  --paper-dim: #bcae9b;
  --paper-faint: #a09280; /* ≥ 4.9:1 sobre todos os fundos escuros (AA para texto pequeno) */

  --ember: #f0a35e;
  --ember-deep: #c9763a;
  --ember-ink: #1c1009;
  --onair: #ff6a4d;
  --tide: #6fc6ba;
  --gold: #f7cb6e;
  --danger: #ff9580;
  --danger-bg: #2e1612;
  --focus: #ffe0a3;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-text: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 4vw, 40px);
}

/* ---------- Reset enxuto ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--ink-0);
  background-image:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgb(240 163 94 / 0.09), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 110%, rgb(255 106 77 / 0.05), transparent 70%);
  background-attachment: fixed;
  color: var(--paper);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Grão de filme bem leve por cima de tudo (SVG em data URI: permitido por img-src). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.9 0 0 0 0 0.8 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgb(240 163 94 / 0.35);
  color: var(--paper);
}

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

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

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink-0);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Marca ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
}

.brand__mark {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe2b8, var(--ember) 45%, var(--ember-deep) 100%);
  box-shadow: 0 0 0 3px rgb(240 163 94 / 0.14), 0 0 18px rgb(240 163 94 / 0.55);
}

.brand__name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 560;
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-faint);
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

/* ---------- Rótulos de painel ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s var(--ease-out);
}

.btn:hover {
  border-color: var(--paper-dim);
  background: rgb(241 232 218 / 0.05);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(180deg, #f6b273, var(--ember) 55%, #e48f4a);
  color: var(--ember-ink);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.25) inset, 0 10px 30px -12px rgb(240 163 94 / 0.6);
}

.btn--primary:hover {
  border-color: transparent;
  background: linear-gradient(180deg, #f9bf86, #f3ad6c 55%, #e89a57);
}

.btn--ghost {
  border-color: transparent;
  color: var(--paper-dim);
}

.btn--ghost:hover {
  color: var(--paper);
  border-color: var(--line);
}

.btn:disabled {
  opacity: 0.6;
  transform: none;
}

/* Indicador giratório usado em estados de carregamento. */
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Campos ---------- */
.field {
  display: grid;
  gap: 8px;
}

.field__label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--ink-0);
  color: var(--paper);
  font-size: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder {
  color: var(--paper-faint);
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus-visible {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgb(240 163 94 / 0.28);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Autopreenchimento do navegador sem fundo claro. */
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--paper);
  box-shadow: 0 0 0 1000px var(--ink-0) inset;
  caret-color: var(--paper);
}

/* ---------- Mensagens ---------- */
.message-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid rgb(255 149 128 / 0.35);
  border-radius: var(--radius-s);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.95rem;
}

.message-error:empty {
  display: none;
}

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

  .spinner {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.6;
  }
}
