/*
 * Cartão Digital — componentes.
 * Regra: nenhum valor solto. Cores, espaços, raios e tamanhos vêm de tokens.css
 * (gerado de design/design-tokens.json). Os mesmos nomes existem no app nativo.
 */

@font-face {
  font-family: 'Outfit Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/outfit-latin.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-base);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--c-brand); }
h1, h2, h3, p, ul, address { margin: 0; }
ul { padding: 0; list-style: none; }
address { font-style: normal; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-sm); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: var(--size-icon); height: var(--size-icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 32px; height: 32px; }

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 10;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-brand); font-weight: var(--fw-semibold);
}
.skip-link:focus { top: var(--s-4); }

/* ---------- Estrutura da página ---------- */
.page { min-height: 100dvh; display: flex; justify-content: center; align-items: flex-start; gap: var(--s-8); }
.card {
  width: 100%;
  max-width: var(--size-sheet);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  overflow: hidden;
}

@media (min-width: 560px) {
  .page { padding: var(--s-10) var(--s-6); }
  .card { min-height: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
}

/* ---------- Cabeçalho (hero) ---------- */
.hero {
  background: var(--c-hero);
  color: var(--c-on-hero);
  text-align: center;
  padding: calc(var(--s-10) + env(safe-area-inset-top)) var(--s-6) calc(var(--s-8) + var(--s-6));
}
.hero__photo { display: inline-block; }
.avatar { object-fit: cover; background: var(--c-brand-soft); }
.avatar--lg {
  width: var(--size-avatar-lg); height: var(--size-avatar-lg);
  border-radius: var(--r-xl);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .10);
}
.avatar--sm { width: var(--size-avatar-sm); height: var(--size-avatar-sm); border-radius: var(--r-md); flex: none; }

.hero__name {
  margin-top: var(--s-5);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.signature {
  display: block;
  width: 28px; height: 6px;
  margin: var(--s-3) auto;
  border-radius: var(--r-pill);
  background: var(--c-signal);
  transform-origin: center;
  animation: sign var(--motion-base) var(--motion-ease) 200ms both;
}
@keyframes sign { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hero__role { font-size: var(--fs-lg); font-weight: var(--fw-light); color: var(--c-on-hero-muted); line-height: var(--lh-snug); text-wrap: balance; }
.hero__meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2) var(--s-4);
  margin-top: var(--s-4);
  font-size: var(--fs-sm); color: var(--c-on-hero-muted);
}
.hero__meta li { display: inline-flex; align-items: center; gap: var(--s-1); }
.hero__code { font-size: var(--fs-3xl); font-weight: var(--fw-light); color: var(--c-on-hero-muted); }

.hero--compact {
  display: flex; align-items: center; gap: var(--s-3);
  text-align: left;
  padding: calc(var(--s-4) + env(safe-area-inset-top)) var(--s-4) calc(var(--s-4) + var(--s-6));
}
.hero__id { display: flex; align-items: center; gap: var(--s-3); min-width: 0; color: inherit; text-decoration: none; }
.hero__id > span { display: flex; flex-direction: column; min-width: 0; }
.hero__id-name { font-weight: var(--fw-semibold); line-height: var(--lh-snug); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero__id-role { font-size: var(--fs-sm); color: var(--c-on-hero-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero--directory { padding-bottom: calc(var(--s-10) + var(--s-6)); }

/* ---------- Folha de conteúdo ---------- */
.sheet {
  position: relative;
  flex: 1;
  margin-top: calc(var(--s-6) * -1);
  padding: var(--s-6) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.sheet__title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -.01em; }
.sheet__lead { margin: var(--s-2) 0 var(--s-6); color: var(--c-muted); }
.sheet__title + .panel, .sheet__title + .stack, .sheet__title + .alert, .sheet__title + .form { margin-top: var(--s-6); }
.section-title { margin: var(--s-8) 0 var(--s-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-muted); }

/* ---------- Cores por canal ----------
 * Cada item recebe .tone--{canal}. Sem classe, usa a cor da marca.
 * --tone      cor pura (botões preenchidos)
 * --tone-fg   cor do ícone (clareada no modo escuro)
 * --tone-soft fundo suave do bloco do ícone
 */
:root { --tone: var(--c-brand); }
.tone--phone     { --tone: var(--ch-phone); }
.tone--whatsapp  { --tone: var(--ch-whatsapp); }
.tone--telegram  { --tone: var(--ch-telegram); }
.tone--instagram { --tone: var(--ch-instagram); }
.tone--facebook  { --tone: var(--ch-facebook); }
.tone--linkedin  { --tone: var(--ch-linkedin); }
.tone--youtube   { --tone: var(--ch-youtube); }
.tone--email     { --tone: var(--ch-email); }
.tone--message   { --tone: var(--ch-message); }
.tone--location  { --tone: var(--ch-location); }
.tone--website   { --tone: var(--ch-website); }
.tone--maps      { --tone: var(--ch-maps); }
.tone--waze      { --tone: var(--ch-waze); }
.tone--neutral   { --tone: var(--ch-neutral); }

.quick__item, .action__icon, .btn, .icon-btn, .foot__link {
  --tone-fg: var(--tone);
  --tone-soft: color-mix(in srgb, var(--tone) 12%, var(--c-surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .quick__item,
  :root:not([data-theme="light"]) .action__icon,
  :root:not([data-theme="light"]) .btn,
  :root:not([data-theme="light"]) .icon-btn,
  :root:not([data-theme="light"]) .foot__link {
    --tone-fg: color-mix(in srgb, var(--tone) 70%, #fff);
    --tone-soft: color-mix(in srgb, var(--tone) 28%, var(--c-surface));
  }
}

/* ---------- Ações rápidas ---------- */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.quick__item {
  min-height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  border-radius: var(--r-lg);
  background: var(--tone-soft);
  color: var(--c-ink);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.quick__item .icon { width: 26px; height: 26px; color: var(--tone-fg); }
.quick__item:active { transform: scale(.97); }

/* ---------- Sobre ---------- */
.about__lead { font-size: var(--fs-lg); font-weight: var(--fw-medium); line-height: var(--lh-snug); }
.about__text { margin-top: var(--s-2); color: var(--c-muted); }

/* ---------- Lista de ações ---------- */
.actions { border-top: 1px solid var(--c-line); }
.action {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: var(--size-action);
  padding: var(--s-3) var(--s-1);
  border-bottom: 1px solid var(--c-line);
  color: var(--c-ink);
  text-decoration: none;
  transition: background var(--motion-fast);
}
.action:hover { background: var(--c-surface-2); }
.action__icon {
  width: var(--size-icon-tile); height: var(--size-icon-tile); flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--tone-soft); color: var(--tone-fg);
}
.action__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.action__label { font-weight: var(--fw-medium); line-height: var(--lh-snug); }
.action__sub { font-size: var(--fs-sm); color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action__end { color: var(--c-muted); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--size-button);
  padding: 0 var(--s-5);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn--primary { background: var(--c-brand); color: var(--c-on-brand); }
.btn--primary:hover { background: var(--c-brand-strong); }
.btn--secondary { background: var(--c-surface); border-color: var(--c-line); color: var(--c-brand); }
.btn--secondary:hover { border-color: var(--c-brand); }
.btn--ghost { background: transparent; color: var(--c-brand); }
.btn--ghost:hover { background: var(--c-surface-2); }
/* Botão de canal: preenchido com a cor do canal (Ligar, WhatsApp, Como chegar, Waze) */
.btn--tone { background: var(--tone); color: #fff; }
.btn--tone:hover { background: color-mix(in srgb, var(--tone) 85%, #000); }
/* Ícone colorido em botões claros quando o botão tem canal */
.btn--secondary[class*="tone--"] .icon, .btn--ghost[class*="tone--"] .icon { color: var(--tone-fg); }
.btn--sm { min-height: var(--size-button-sm); padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn--block { width: 100%; margin-top: var(--s-2); }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-6); }
.button-row > :only-child { grid-column: 1 / -1; }
.panel .button-row { margin-top: var(--s-4); }

.icon-btn {
  width: var(--size-touch); height: var(--size-touch); flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-md);
  background: var(--c-surface-2); color: var(--c-brand);
  cursor: pointer;
}
.icon-btn--on-hero { background: rgba(255, 255, 255, .10); color: var(--c-on-hero); }
.icon-btn[class*="tone--"] { background: var(--tone-soft); color: var(--tone-fg); }

/* ---------- Painéis ---------- */
.stack { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); }
.panel { padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--r-lg); }
.panel__head { display: flex; align-items: center; gap: var(--s-4); }
.panel__value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-snug); font-variant-numeric: tabular-nums; }
address .panel__value { font-size: var(--fs-lg); }

/* ---------- Mapa (carrega sob demanda) ---------- */
.map {
  position: relative;
  aspect-ratio: 16 / 10;
  margin-top: var(--s-4);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-3);
  padding: var(--s-6);
  border: 1.5px dashed var(--c-line); border-radius: var(--r-lg);
  background: var(--c-surface-2); color: var(--c-muted);
  text-align: center; overflow: hidden;
}
.map__text { font-size: var(--fs-sm); max-width: 30ch; }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map.is-loaded { border-style: solid; padding: 0; }

/* ---------- Formulário ---------- */
.form { margin-top: var(--s-2); }
.field { margin-bottom: var(--s-4); }
.field__label { display: block; margin-bottom: var(--s-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.field__optional { color: var(--c-muted); font-weight: var(--fw-regular); }
.field__input {
  width: 100%;
  min-height: var(--size-button);
  padding: 0 var(--s-4);
  border: 1.5px solid var(--c-line); border-radius: var(--r-md);
  background: var(--c-surface-2); color: var(--c-ink);
  font: inherit;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.field__input:focus { outline: none; border-color: var(--c-brand); background: var(--c-surface); box-shadow: 0 0 0 3px var(--c-brand-soft); }
.field__input--area { padding: var(--s-3) var(--s-4); min-height: 144px; resize: vertical; line-height: var(--lh-base); }
.field__input[aria-invalid="true"] { border-color: var(--c-danger); }
.field__error { margin-top: var(--s-1); font-size: var(--fs-sm); color: var(--c-danger); }
.field--check { display: grid; grid-template-columns: 24px 1fr; gap: var(--s-3); align-items: start; font-size: var(--fs-sm); color: var(--c-muted); }
.field--check .field__error { grid-column: 2; }
.check { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--c-brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile, .g-recaptcha { margin-bottom: var(--s-4); }

.alert { margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); font-weight: var(--fw-medium); }
.alert--success { background: color-mix(in srgb, var(--c-success) 12%, var(--c-surface)); color: var(--c-success); }
.alert--danger { background: color-mix(in srgb, var(--c-danger) 10%, var(--c-surface)); color: var(--c-danger); }

/* ---------- Texto longo ---------- */
.prose { max-width: 65ch; }
.prose h2 { margin: var(--s-6) 0 var(--s-2); font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.prose p { color: var(--c-ink); }
.prose__meta { margin-top: var(--s-6); font-size: var(--fs-sm); color: var(--c-muted) !important; }
.empty { color: var(--c-muted); }

/* ---------- Rodapé ---------- */
.foot {
  margin-top: var(--s-8); padding-top: var(--s-5);
  border-top: 1px solid var(--c-line);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  font-size: var(--fs-sm); color: var(--c-muted);
}
.foot a { color: var(--c-muted); text-decoration: none; display: inline-flex; align-items: center; gap: var(--s-1); }
.foot a:hover { color: var(--c-brand); }
.wordmark { color: var(--c-ink); letter-spacing: .01em; }
.wordmark span { font-weight: var(--fw-light); }
.wordmark b { font-weight: var(--fw-bold); }

/* ---------- Abrir no celular (desktop) ---------- */
.handoff { display: none; }
@media (min-width: 1000px) {
  .page { max-width: var(--size-page); margin: 0 auto; }
  .handoff {
    position: sticky; top: var(--s-10);
    display: block;
    width: 280px; padding: var(--s-8) var(--s-6);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    text-align: center;
  }
  .handoff__qr { width: 216px; height: 216px; margin: 0 auto var(--s-5); color: var(--c-hero); }
  .handoff__title { font-weight: var(--fw-semibold); font-size: var(--fs-lg); }
  .handoff__text { margin-top: var(--s-1); font-size: var(--fs-sm); color: var(--c-muted); }
}
[data-qr] svg { width: 100%; height: 100%; }

/* ---------- Diálogo e aviso ---------- */
.dialog {
  width: min(360px, calc(100vw - var(--s-8)));
  padding: var(--s-6);
  border: 0; border-radius: var(--r-xl);
  background: var(--c-surface); color: var(--c-ink);
  box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: rgba(4, 18, 27, .6); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.dialog__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.dialog__qr { width: 100%; aspect-ratio: 1; margin: var(--s-5) 0; padding: var(--s-3); border-radius: var(--r-lg); background: #fff; color: #0A2F47; }
.dialog__text { font-size: var(--fs-sm); color: var(--c-muted); text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--s-6) + env(safe-area-inset-bottom)); z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - var(--s-8));
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  background: var(--c-ink); color: var(--c-surface);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  box-shadow: var(--shadow-pop);
}

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

/* Botões lado a lado em telas estreitas: menos respiro lateral, texto sem quebra */
.button-row .btn { padding: 0 var(--s-3); white-space: nowrap; }
@media (max-width: 340px) { .button-row { grid-template-columns: 1fr; } }
.panel .action__sub { white-space: normal; }
.map[class*="tone--"] > .icon { color: var(--tone); }
