/*
 * Fundacao visual. Todas as paginas (bio, cardapio, acompanhamento, painel)
 * carregam este arquivo e nada mais de CSS global.
 *
 * A paleta vem validada de test/palette.mjs — nao troque um hex aqui sem
 * rodar `npm run paleta`. Foi assim que o cobre saiu de #a9683a (4.44:1 com
 * texto branco, reprova em AA por 0.06) para o atual.
 *
 * Sem modo escuro, de proposito. O mesmo caminho que o link da bio da Allevi
 * seguiu: a marca e clara e quente, e um tema escuro automatico inventaria
 * uma identidade que a cafeteria nao tem. `--accent` e `--accent-2` sao
 * sobrescritos em tempo de execucao pelas configuracoes da loja.
 */

:root {
  --ink: #221912;
  --muted: #6b5d4f;
  --paper: #fbf7f1;
  --cream: #f4ece0;
  --line: #e5d7c4;
  --accent: #a36133;
  --accent-2: #85502c;
  --accent-deep: #4a3320;
  --on-accent: #ffffff;
  --success: #3d7a4b;
  --warn: #9a4a2b;
  --wa: #118445; /* verde do WhatsApp escurecido: o oficial reprova AA com branco */

  --sombra: 0 10px 30px -18px rgba(34, 25, 18, 0.34);
  --sombra-alta: 0 -14px 44px rgba(34, 25, 18, 0.28);
  --raio: 18px;
  --raio-g: 24px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* Respiro para a barra de gestos do iPhone e para a barra fixa do carrinho. */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.18; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }

a { color: inherit; }

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

/* Alvo de toque de 44px em tudo que se clica: a tela e usada com uma mao so,
   em pe, muitas vezes com o cafe na outra. */
button, .btn, .linha-produto, .chip { min-height: 44px; }

button { font: inherit; color: inherit; cursor: pointer; }

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

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

/* ---------------------------------------------------------------- layout */

.pagina { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.pagina-larga { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.pilha { display: flex; flex-direction: column; }
.pilha-6 { gap: 6px; } .pilha-10 { gap: 10px; } .pilha-14 { gap: 14px; }
.pilha-20 { gap: 20px; } .pilha-28 { gap: 28px; }
.linha { display: flex; align-items: center; gap: 10px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cresce { flex: 1; min-width: 0; }

.eyebrow {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--accent-2);
}
.discreto { color: var(--muted); font-size: 0.88rem; }
.mini { font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------- cartao */

.cartao {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--raio);
  padding: 16px;
}
.cartao-limpo { background: var(--paper); border-radius: var(--raio); border: 1px solid var(--line); overflow: hidden; }

/* ---------------------------------------------------------------- botoes */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  background: var(--paper); color: var(--ink);
  font-size: 0.94rem; font-weight: 600; text-decoration: none;
  transition: background 0.16s ease, transform 0.14s ease, border-color 0.16s ease;
}
.btn:active { transform: scale(0.985); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }

.btn-primario { background: var(--accent); color: var(--on-accent); }
.btn-primario:hover { background: var(--accent-2); }

.btn-contorno { background: transparent; border-color: var(--line); }
.btn-contorno:hover { border-color: var(--accent); }

.btn-fantasma { background: transparent; padding: 10px 14px; }
.btn-fantasma:hover { background: rgba(163, 97, 51, 0.08); }

.btn-wa { background: var(--wa); color: #fff; }

.btn-bloco { width: 100%; }
.btn-g { padding: 16px 26px; font-size: 1rem; }
.btn-p { padding: 8px 14px; font-size: 0.84rem; min-height: 36px; }

/* ---------------------------------------------------------------- selos */

.selo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--cream); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.selo-aberto { background: rgba(61, 122, 75, 0.12); color: var(--success); border-color: rgba(61, 122, 75, 0.3); }
.selo-fechado { background: rgba(154, 74, 43, 0.1); color: var(--warn); border-color: rgba(154, 74, 43, 0.28); }
.selo-cobre { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.selo .ponto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------------------------------------------------------------- campos */

.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea {
  font: inherit; color: var(--ink);
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper);
  width: 100%; min-height: 46px;
}
.campo textarea { min-height: 76px; resize: vertical; }
/* O seletor de cor nativo nao tem por que ocupar a linha toda. */
.campo input[type='color'] { width: 80px; padding: 4px; cursor: pointer; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(163, 97, 51, 0.16);
}
.campo.erro input, .campo.erro select, .campo.erro textarea { border-color: var(--warn); }
.campo .msg-erro { font-size: 0.78rem; color: var(--warn); font-weight: 600; }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 400px) { .grade-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- chips */

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 0.86rem; font-weight: 600; white-space: nowrap;
}
.chip[aria-pressed='true'], .chip.ativo {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
}
.chip[disabled] { opacity: 0.45; }

/* --------------------------------------------------------------- folha */
/* Bottom sheet: sobe de baixo no celular, vira caixa centrada no desktop. */

.folha-fundo {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(34, 25, 18, 0.55);
  display: none; align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.folha-fundo.aberta { display: flex; }
.folha {
  position: relative; width: 100%; max-width: 520px;
  background: var(--paper); color: var(--ink);
  border-radius: var(--raio-g) var(--raio-g) 0 0;
  max-height: 92dvh; display: flex; flex-direction: column;
  box-shadow: var(--sombra-alta);
  animation: sobe 0.26s ease;
}
@keyframes sobe { from { transform: translateY(26px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@media (min-width: 540px) {
  .folha-fundo { align-items: center; padding: 20px; }
  .folha { border-radius: var(--raio-g); }
}
.folha-topo {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex: none;
}
.folha-corpo { padding: 18px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.folha-pe {
  padding: 14px 18px calc(14px + var(--safe-b));
  border-top: 1px solid var(--line); flex: none; background: var(--paper);
  border-radius: 0 0 var(--raio-g) var(--raio-g);
}
.fechar {
  margin-left: auto; flex: none;
  width: 38px; height: 38px; min-height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--cream);
  display: grid; place-items: center;
}
.fechar svg { width: 17px; height: 17px; }

/* --------------------------------------------------------------- valores */
/* Vive aqui, e nao no <style> do cardapio, porque o painel mostra o mesmo
   bloco de subtotal/entrega/total na folha do pedido. Enquanto so o cardapio
   tinha estas regras, os valores apareciam grudados no painel. */

.resumo { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.resumo .linha-valor { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: .92rem; color: var(--muted); }
.resumo .linha-valor.total { font-size: 1.12rem; font-weight: 700; color: var(--ink); padding-top: 10px; }
.resumo .gratis { color: var(--success); font-weight: 700; }

/* ---------------------------------------------------------------- toast */

.toast-area {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + var(--safe-b)); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: calc(100% - 32px); max-width: 460px;
}
.toast {
  background: var(--accent-deep); color: #fff;
  padding: 12px 18px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600; text-align: center;
  box-shadow: var(--sombra); animation: sobe 0.2s ease;
}
.toast.ruim { background: var(--warn); }

/* --------------------------------------------------------------- carga */

.carregando { padding: 60px 0; text-align: center; color: var(--muted); }
.esqueleto {
  background: linear-gradient(90deg, var(--line) 25%, var(--cream) 50%, var(--line) 75%);
  background-size: 400% 100%; animation: brilho 1.3s ease-in-out infinite;
  border-radius: 10px;
}
@keyframes brilho { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.vazio { text-align: center; padding: 44px 18px; color: var(--muted); }
.vazio h3 { color: var(--ink); margin-bottom: 8px; }

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