/* Base Bento do Mural (painel e páginas públicas): cores e fontes do app (BentoColors.kt),
   claro e escuro, e as peças comuns — botões, selos, capas, mensagens e diálogos.
   Tema: theme.js põe data-theme no <html>; sem JavaScript, vale o do aparelho. */

@font-face { font-family: 'Bricolage Display'; src: url('fonts/bricolage_display_extrabold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage_title_bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage_title_extrabold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('fonts/dmsans_regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('fonts/dmsans_medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('fonts/dmsans_bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ── Cores ─────────────────────────────────────────────────────────────────── */

:root, [data-theme='light'] {
  color-scheme: light;
  --bg: #ECEEF4;
  --surface: #FFFFFF;
  --muted-bg: #ECEEF4;
  --soft: #F5F6FA;
  --field: #FFFFFF;
  --ink: #10111A;
  --muted: #555A6B;
  --subtle: #8D92A3;
  --hairline: #E3E6EE;
  --line: #DADDE6;
  --dashed: #B9BDCB;
  --strong: #10111A;
  --on-strong: #FFFFFF;
  --strong-selected: #2A2C3D;
  --on-strong-muted: #A3A7B8;
  --indigo: #3A34D2;
  --indigo-press: #2A25A8;
  --on-indigo: #FFFFFF;
  --on-indigo-muted: #DCDAFF;
  --link: #3A34D2;
  --lime: #D4F56A;
  --coral: #FF8C69;
  --on-vivid: #10111A;
  --positive: #1B7A56;
  --negative: #D23F24;
  --warning: #B86A00;
  --lilac: #E4DBFF;
  --peach: #FFE1D3;
  --sky: #BFD7FF;
  --mint: #CFF3E4;
  --rose: #FFD6E4;
  --on-pastel: #10111A;
  --heart: #D23F24;
  --scrim: rgba(16, 17, 26, .45);
  --shadow: 0 1px 2px rgba(16, 17, 26, .06), 0 12px 32px rgba(16, 17, 26, .12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #000000; --surface: #191A24; --muted-bg: #242634; --soft: #20212D; --field: #242634;
    --ink: #F3F4F8; --muted: #A6AABB; --subtle: #6E7285; --hairline: #2A2C3A; --line: #33364A; --dashed: #3D4052;
    --strong: #242634; --on-strong: #FFFFFF; --strong-selected: #363949; --on-strong-muted: #9CA0B3;
    --indigo: #5B55E8; --indigo-press: #4B45D6; --on-indigo: #FFFFFF; --on-indigo-muted: #D9D7FF; --link: #A29EFF;
    --positive: #4FD19A; --negative: #FF7A5C; --warning: #FFB547;
    --lilac: #332E5C; --peach: #4D3027; --sky: #1F3354; --mint: #16423A; --rose: #4D2338; --on-pastel: #F3F4F8;
    --heart: #FF8C69; --scrim: rgba(0, 0, 0, .7); --shadow: 0 16px 40px rgba(0, 0, 0, .55);
  }
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #000000; --surface: #191A24; --muted-bg: #242634; --soft: #20212D; --field: #242634;
  --ink: #F3F4F8; --muted: #A6AABB; --subtle: #6E7285; --hairline: #2A2C3A; --line: #33364A; --dashed: #3D4052;
  --strong: #242634; --on-strong: #FFFFFF; --strong-selected: #363949; --on-strong-muted: #9CA0B3;
  --indigo: #5B55E8; --indigo-press: #4B45D6; --on-indigo: #FFFFFF; --on-indigo-muted: #D9D7FF; --link: #A29EFF;
  --positive: #4FD19A; --negative: #FF7A5C; --warning: #FFB547;
  --lilac: #332E5C; --peach: #4D3027; --sky: #1F3354; --mint: #16423A; --rose: #4D2338; --on-pastel: #F3F4F8;
  --heart: #FF8C69; --scrim: rgba(0, 0, 0, .7); --shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

/* Troca de tema: as cores passam de uma para a outra em vez de piscar. */
html.theme-fade, html.theme-fade * , html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease !important;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

/* Ícone do app (o mesmo do celular): bloco branco nos dois temas. */
.app-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; }

/* ── Botões ────────────────────────────────────────────────────────────────── */

/* "Apertar" do app (bentoClickable): encolhe 3% no toque. */
.press { transition: transform .16s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, color .2s ease; }
.press:active { transform: scale(.97); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--muted-bg); color: var(--ink);
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .16s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--hairline); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--indigo); color: var(--on-indigo); }
.btn.primary:hover { background: var(--indigo-press); }
.btn.ink { background: var(--strong); color: var(--on-strong); }
.btn.ink:hover { background: var(--strong-selected); }
.btn.lime { background: var(--lime); color: var(--on-vivid); }
.btn.lime:hover { background: #C6EA55; }
.btn.danger { background: var(--negative); color: #FFFFFF; }
.btn.danger:hover { filter: brightness(.92); background: var(--negative); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--muted-bg); }
.btn.ghost.bad { color: var(--negative); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-color: var(--on-indigo) transparent var(--on-indigo) transparent;
  animation: spin .8s linear infinite;
}
.btn:not(.primary).busy::after { border-color: var(--ink) transparent var(--ink) transparent; }

.icon-btn {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  display: inline-grid; place-items: center; background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform .16s cubic-bezier(.2, .8, .2, 1), background-color .2s ease;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { background: var(--hairline); }
.icon-btn svg { width: 21px; height: 21px; }

/* Botão de tema: o ícone gira ao trocar. */
.theme-toggle svg { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.theme-toggle.spin svg { transform: rotate(180deg); }

/* ── Selos ─────────────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; font-weight: 700; line-height: 1.35; white-space: nowrap;
  background: var(--muted-bg); color: var(--ink);
}
.chip svg { width: 13px; height: 13px; }
.kind-novidade { background: var(--lilac); color: var(--on-pastel); }
.kind-dica { background: var(--mint); color: var(--on-pastel); }
.kind-aviso { background: var(--peach); color: var(--on-pastel); }

/* ── Capa desenhada (MuralCover do app): cor, círculos, bloco do ícone e texto grande ── */

.tone-indigo { --tone-bg: var(--indigo); --tone-ink: var(--on-indigo); }
.tone-lime { --tone-bg: var(--lime); --tone-ink: var(--on-vivid); }
.tone-coral { --tone-bg: var(--coral); --tone-ink: var(--on-vivid); }
.tone-mint { --tone-bg: var(--mint); --tone-ink: var(--on-pastel); }
.tone-rose { --tone-bg: var(--rose); --tone-ink: var(--on-pastel); }
.tone-peach { --tone-bg: var(--peach); --tone-ink: var(--on-pastel); }
.tone-sky { --tone-bg: var(--sky); --tone-ink: var(--on-pastel); }
.tone-lilac { --tone-bg: var(--lilac); --tone-ink: var(--on-pastel); }

.cover { position: relative; overflow: hidden; background: var(--muted-bg); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.drawn { background: var(--tone-bg); color: var(--tone-ink); }
.cover.drawn::before, .cover.drawn::after {
  content: ''; position: absolute; border-radius: 50%; background: currentColor; opacity: .08; pointer-events: none;
}
.cover.drawn::before { width: 220px; height: 220px; right: -60px; top: -70px; }
.cover.drawn::after { width: 120px; height: 120px; right: 90px; bottom: -70px; }
.cover .tile {
  position: absolute; left: 18px; bottom: 18px; width: var(--tile, 60px); height: var(--tile, 60px);
  border-radius: calc(var(--tile, 60px) / 3); background: var(--tone-ink); color: var(--tone-bg);
  display: grid; place-items: center;
}
.cover .tile svg { width: 50%; height: 50%; }
.cover .big {
  position: absolute; right: 20px; bottom: 4px; font: 800 var(--big, 72px)/1 'Bricolage Display', 'Bricolage', sans-serif;
  letter-spacing: -.04em; color: var(--tone-ink); white-space: nowrap;
}

/* ── Curtidas: o coração pulsa quando chega curtida nova ───────────────────── */

.likes { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.likes svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.likes.has { color: var(--heart); }
.likes.has svg { fill: currentColor; }
.likes.bump svg { animation: heart-pop .6s cubic-bezier(.2, .8, .2, 1); }
.likes.bump .likes-n { animation: count-up .45s cubic-bezier(.2, .8, .2, 1); }
.likes.drop .likes-n { animation: count-down .45s cubic-bezier(.2, .8, .2, 1); }
.likes-n { display: inline-block; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); flex: none; }
.live-dot.on { background: var(--positive); box-shadow: 0 0 0 0 var(--positive); animation: live-ring 2.4s ease-out infinite; }

@keyframes heart-pop { 0% { transform: scale(1); } 30% { transform: scale(1.35); } 55% { transform: scale(.9); } 100% { transform: scale(1); } }
@keyframes count-up { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes count-down { from { transform: translateY(-60%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes live-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--positive) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mensagens (toasts) ────────────────────────────────────────────────────── */

.toasts {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  width: min(440px, calc(100% - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%;
  background: var(--strong); color: var(--on-strong); border-radius: 18px; padding: 12px 14px 12px 12px;
  font-weight: 600; font-size: 14.5px; line-height: 1.35; box-shadow: var(--shadow);
  animation: toast-in .32s cubic-bezier(.2, .8, .2, 1) both;
}
.toast .mark { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: var(--on-vivid); }
.toast .mark svg { width: 15px; height: 15px; }
.toast.bad .mark { background: var(--coral); }
.toast.info .mark { background: var(--lilac); color: var(--on-pastel); }
.toast .act { margin-left: 4px; border: 0; background: transparent; color: var(--lime); font-weight: 800; cursor: pointer; padding: 6px 4px; }
.toast.out { animation: toast-out .24s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ── Diálogo (BentoDialog) ─────────────────────────────────────────────────── */

dialog.dlg {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(420px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); overflow: visible;
}
dialog.dlg::backdrop { background: var(--scrim); animation: fade-in .22s ease both; }
dialog.dlg .dlg-card {
  background: var(--surface); border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow); animation: dlg-in .3s cubic-bezier(.2, .8, .2, 1) both;
}
dialog.dlg .dlg-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--muted-bg); }
dialog.dlg .dlg-icon svg { width: 24px; height: 24px; }
dialog.dlg .dlg-icon.bad { background: var(--peach); color: var(--negative); }
dialog.dlg .dlg-icon.go { background: var(--lime); color: var(--on-vivid); }
dialog.dlg h2 { margin: 0; font: 800 22px/1.2 'Bricolage', sans-serif; letter-spacing: -.02em; }
dialog.dlg p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 15px; }
dialog.dlg .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
dialog.dlg.closing::backdrop { animation: fade-out .2s ease both; }
dialog.dlg.closing .dlg-card { animation: dlg-out .2s ease-in both; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* Carregando: blocos que brilham no lugar do conteúdo. */
.skeleton { background: linear-gradient(90deg, var(--muted-bg) 0%, var(--soft) 50%, var(--muted-bg) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 14px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

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