/* Chapa — tokens e peças compartilhadas */

:root {
  color-scheme: light;

  --mostarda: #ffc72c;
  --mostarda-funda: #f0a800;
  --ketchup: #d62718;
  --ketchup-funda: #9e1a0f;
  --carvao: #2b1a12;
  --carvao-suave: #6d5b50;
  --picles: #4b741c;
  --papel: #ffffff;
  --fundo: #f3f2ef;
  --linha: #e5ddd3;
  --linha-forte: #cfc3b6;

  --brand: var(--ketchup);
  --brand-funda: var(--ketchup-funda);
  --brand-tinta: #ffffff;

  --fonte: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --t-xs: 0.8125rem;
  --t-s: 0.9375rem;
  --t-m: 1.0625rem;
  --t-l: 1.375rem;
  --t-xl: 1.875rem;
  --t-2xl: clamp(2.25rem, 5vw, 3.5rem);
  --t-3xl: clamp(2.75rem, 7.5vw, 5.75rem);

  --raio-s: 8px;
  --raio: 14px;
  --raio-l: 24px;

  --sombra: 0 1px 0 rgb(43 26 18 / 0.05), 0 12px 28px -18px rgb(43 26 18 / 0.45);
}

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

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

body {
  margin: 0;
  background: var(--fundo);
  color: var(--carvao);
  font-family: var(--fonte);
  font-size: var(--t-m);
  line-height: 1.5;
  font-stretch: 100%;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
}

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

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

[hidden] {
  display: none !important;
}

.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;
}

/* Tipografia de letreiro: a Archivo esticada ao máximo */
.letreiro {
  font-stretch: 125%;
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 0.98;
}

.condensada {
  font-stretch: 75%;
}

/* ---------- Botões ---------- */

.btn {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-tinta);
  --btn-sombra: var(--brand-funda);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.65em 1.15em;
  border: 0;
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: var(--t-s);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--btn-sombra);
  transition: transform 80ms ease, box-shadow 80ms ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--btn-sombra);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-grande {
  min-height: 54px;
  padding: 0.8em 1.4em;
  font-size: var(--t-m);
  border-radius: 14px;
}

.btn-sec {
  --btn-bg: var(--papel);
  --btn-fg: var(--carvao);
  --btn-sombra: var(--linha-forte);
  border: 1.5px solid var(--linha-forte);
}

.btn-carvao {
  --btn-bg: var(--carvao);
  --btn-fg: #fff;
  --btn-sombra: #000;
}

.btn-leve {
  min-height: 40px;
  padding: 0.5em 0.8em;
  background: transparent;
  color: var(--carvao);
  box-shadow: none;
  border-radius: var(--raio-s);
}

.btn-leve:hover {
  background: rgb(43 26 18 / 0.06);
}

.btn-leve:active {
  transform: none;
  box-shadow: none;
}

.btn-perigo {
  --btn-bg: var(--papel);
  --btn-fg: var(--ketchup-funda);
  --btn-sombra: transparent;
  border: 1.5px solid currentColor;
  box-shadow: none;
}

.btn-icone {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.btn svg,
.icone svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.icone {
  display: inline-flex;
}

/* ---------- Formulários ---------- */

.campo {
  display: grid;
  gap: 6px;
}

.campo > span:first-child,
.rotulo {
  font-weight: 600;
  font-size: var(--t-s);
}

.dica {
  color: var(--carvao-suave);
  font-size: var(--t-xs);
}

.input,
.campo input:not([type='checkbox'], [type='radio'], [type='color'], [type='file']),
.campo select,
.campo textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.6em 0.8em;
  border: 1.5px solid var(--linha-forte);
  border-radius: 10px;
  background: var(--papel);
  font-size: 1rem;
}

.campo textarea {
  min-height: 84px;
  resize: vertical;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus,
.input:focus {
  border-color: var(--carvao);
  outline: 3px solid rgb(255 199 44 / 0.7);
  outline-offset: 0;
}

.prefixo {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--linha-forte);
  border-radius: 10px;
  background: var(--papel);
  overflow: hidden;
}

.prefixo:focus-within {
  border-color: var(--carvao);
  outline: 3px solid rgb(255 199 44 / 0.7);
}

.prefixo > span {
  display: flex;
  align-items: center;
  padding: 0 0.2em 0 0.8em;
  color: var(--carvao-suave);
  white-space: nowrap;
}

.campo .prefixo input {
  border: 0;
  outline: 0;
  padding-left: 0.1em;
  min-width: 0;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--carvao);
  flex: none;
}

.erro {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fde8e5;
  color: var(--ketchup-funda);
  font-size: var(--t-s);
  font-weight: 600;
}

/* Interruptor (aberta/fechada, disponível) */
.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 46px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--linha-forte);
  cursor: pointer;
  transition: background 120ms ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 120ms ease;
}

.switch[aria-checked='true'] {
  background: var(--picles);
}

.switch[aria-checked='true']::after {
  transform: translateX(18px);
}

/* ---------- Diálogos ---------- */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--raio-l);
  background: var(--papel);
  color: var(--carvao);
  box-shadow: 0 30px 80px -20px rgb(43 26 18 / 0.5);
}

dialog::backdrop {
  background: rgb(43 26 18 / 0.55);
}

dialog[open] {
  animation: surgir 160ms ease-out;
}

@keyframes surgir {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.dialogo-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
}

.dialogo-corpo {
  display: grid;
  gap: 16px;
  padding: 4px 20px 20px;
}

.dialogo-acoes {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--linha);
  background: var(--papel);
}

/* ---------- Aviso flutuante ---------- */

.aviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--carvao);
  color: #fff;
  font-weight: 600;
  font-size: var(--t-s);
  transform: translateX(-50%);
  box-shadow: var(--sombra);
  animation: surgir 160ms ease-out;
}

.aviso.erro-aviso {
  background: var(--ketchup-funda);
}

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