/* ==========================================================================
   Portinho — mascote do portfólio
   Um bloco roxo com rosto, inspirado no símbolo da marca. Fica no canto
   inferior direito: os olhos seguem o cursor, pisca sozinho, dorme depois de
   um tempo parado e, ao ser clicado, abre um mini terminal com comandos.
   Tudo é montado por assets/js/mascote.js; para remover, apague os dois
   arquivos e as duas linhas que os carregam no HTML.
   ========================================================================== */

.mascote {
  --mascote-size: 52px;
  position: fixed; z-index: 140;
  right: max(16px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
  width: var(--mascote-size); height: var(--mascote-size);
  font-family: var(--font-mono);
  pointer-events: none;
  opacity: 0; transform: translateY(18px) scale(.85);
  /* --mascote-lift: quanto ele sobe para não cobrir o rodapé ou a faixa (o JS calcula) */
  translate: 0 calc(var(--mascote-lift, 0px) * -1);
  transition: opacity .5s var(--ease-out), transform .7s var(--ease-out), translate .45s var(--ease-out);
}
.mascote.is-in { opacity: 1; transform: none; }
.mascote.is-in .mascote-btn, .mascote.is-in .mascote-term { pointer-events: auto; }

/* ---------- Personagem ---------- */
.mascote-btn {
  position: relative; display: block; width: 100%; height: 100%;
  padding: 0; border-radius: 18px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35));
}
:root[data-theme="light"] .mascote-btn { filter: drop-shadow(0 10px 16px rgba(30, 29, 29, .18)); }
.mascote-btn:focus-visible { outline-offset: 6px; border-radius: 18px; }
.mascote-btn svg { width: 100%; height: 100%; overflow: visible; }

.mascote-hop, .mascote-body, .mascote-eyes { transform-box: fill-box; }
.mascote-hop { transform-origin: 50% 100%; transition: transform .35s var(--ease-out); }
.mascote-btn:hover .mascote-hop { transform: translateY(-3px) rotate(-3deg); }
.mascote-btn:active .mascote-hop { transform: translateY(1px) scale(1.05, .93); transition-duration: .08s; }

.mascote-body { transform-origin: 50% 100%; animation: mascote-breathe 3.6s ease-in-out infinite; }
.mascote-main { fill: var(--brand-purple); }
.mascote-white { fill: #fff; }
.mascote-pupil { fill: #1E1D1D; transition: transform .14s linear; }
.mascote-mouth, .mascote-closed path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.mascote-mouth-o { fill: #1E1D1D; stroke: #fff; stroke-width: 1.6; }
.mascote-closed, .mascote-mouth-o { display: none; }

.mascote-eyes { transform-origin: 50% 50%; transition: transform .07s ease; }
.mascote.is-blink .mascote-eyes { transform: scaleY(.1); }

/* aberto: sorriso maior */
.mascote.is-open .mascote-mouth { stroke-width: 2.8; }

/* pensando: inclina de um lado para o outro e olha para cima */
.mascote.is-thinking .mascote-hop { animation: mascote-think 1s ease-in-out infinite; }

/* dormindo */
.mascote.is-sleeping .mascote-eyes, .mascote.is-sleeping .mascote-mouth { display: none; }
.mascote.is-sleeping .mascote-closed { display: inline; }
.mascote.is-sleeping .mascote-mouth-o { display: inline; transform: scale(.7); transform-box: fill-box; transform-origin: center; }
.mascote.is-sleeping .mascote-body { animation-duration: 5.5s; }
.mascote.is-sleeping .mascote-zzz { display: block; }

/* acordou assustado */
.mascote.is-startled .mascote-hop { animation: mascote-jump .55s var(--ease-out); }
.mascote.is-startled .mascote-mouth { display: none; }
.mascote.is-startled .mascote-mouth-o { display: inline; }

.mascote-zzz { display: none; position: absolute; right: 2px; top: -6px; pointer-events: none; color: var(--accent-ink); font-weight: 500; line-height: 1; }
.mascote-zzz i { position: absolute; right: 0; bottom: 0; font-style: normal; opacity: 0; animation: mascote-z 2.4s ease-in infinite; }
.mascote-zzz i:nth-child(1) { font-size: 10px; }
.mascote-zzz i:nth-child(2) { font-size: 13px; animation-delay: .8s; }
.mascote-zzz i:nth-child(3) { font-size: 16px; animation-delay: 1.6s; }

@keyframes mascote-breathe { 50% { transform: scale(.985, 1.03); } }
@keyframes mascote-think { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-1px); } }
@keyframes mascote-jump { 30% { transform: translateY(-12px) scale(.95, 1.06); } 60% { transform: translateY(0) scale(1.06, .94); } }
@keyframes mascote-z { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -24px); } }

/* ---------- Balão de fala ---------- */
.mascote-bubble {
  position: absolute; right: calc(100% + 10px); bottom: calc(var(--mascote-size) * .5);
  width: max-content; max-width: min(240px, calc(100vw - var(--mascote-size) - 60px));
  padding: 10px 14px; border-radius: 14px 14px 4px 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.45;
  opacity: 0; transform: translateY(6px) scale(.96); transform-origin: 100% 100%;
  transition: opacity .3s var(--ease-out), transform .4s var(--ease-out);
  pointer-events: none;
}
.mascote-bubble.is-on { opacity: 1; transform: none; }
.mascote.is-open .mascote-bubble { opacity: 0; }

/* ---------- Mini terminal ---------- */
.mascote-term {
  position: absolute; right: 0; bottom: calc(100% + 14px);
  display: flex; flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: min(460px, calc(100vh - var(--mascote-size) - 72px - var(--mascote-lift, 0px)));
  max-height: min(460px, calc(100dvh - var(--mascote-size) - 72px - var(--mascote-lift, 0px)));
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.55; overflow: hidden;
  transform-origin: 100% 100%;
  animation: mascote-pop .35s var(--ease-out);
}
.mascote-term[hidden] { display: none; }
@keyframes mascote-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.mascote-term-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.mascote-term-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.mascote-term-path { margin-left: auto; }
.mascote-term-close { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.mascote-term-close:hover { color: var(--text); background: var(--surface-2); }
.mascote-term-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.mascote-term-out {
  flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain;
  display: grid; align-content: start; gap: 3px;
  padding: 14px 16px 8px;
}
.mascote-term-out:focus { outline: none; }
.mascote-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.mascote-line.is-dim { color: var(--muted); }
.mascote-line.is-err { color: #FF8A8A; }
:root[data-theme="light"] .mascote-line.is-err { color: #C0392B; }
.mascote-line.is-cmd { margin-top: 6px; }
.mascote-line:first-child { margin-top: 0; }
.mascote-acc { color: var(--accent-ink); }
.mascote-line a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.mascote-line a:hover { color: var(--text); }
.mascote-help { display: grid; grid-template-columns: max-content 1fr; gap: 1px 14px; }
.mascote-help b { font-weight: 500; color: var(--accent-ink); }
.mascote-help span { color: var(--muted); }

.mascote-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px 12px; }
.mascote-chip { padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 12px; transition: color .2s, border-color .2s; }
.mascote-chip:hover { color: var(--text); border-color: var(--accent); }

.mascote-term-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); transition: background-color .2s; }
.mascote-term-in:focus-within { background: var(--accent-soft); }
.mascote-term-in input {
  flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none;
  color: var(--text); font: inherit; caret-color: var(--accent);
}
.mascote-term-in input::placeholder { color: var(--faint); }

/* ---------- Celular ---------- */
@media (max-width: 680px) {
  .mascote { --mascote-size: 44px; }
}
/* No iOS, campo com fonte menor que 16px dá zoom na página ao focar */
@media (pointer: coarse) {
  .mascote-term-in input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .mascote-zzz i { opacity: 1; animation: none; }
  .mascote-zzz i:nth-child(2) { right: 8px; bottom: 10px; }
  .mascote-zzz i:nth-child(3) { right: 18px; bottom: 22px; }
}

@media print { .mascote { display: none; } }

/* ==========================================================================
   Extras: óculos escuros (tema claro), café (manhã), bocejo (madrugada), tontura
   ========================================================================== */

/* ----- Óculos escuros: aparecem sozinhos no tema claro ----- */
.mascote-shades { display: none; transform-box: view-box; transition: transform .35s var(--ease-out); }
.mascote-shades rect { fill: #1E1D1D; }
.mascote-shades-line { fill: none; stroke: #1E1D1D; stroke-width: 2; stroke-linecap: round; }
.mascote-glint { fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; opacity: .55; }
:root[data-theme="light"] .mascote-shades { display: inline; animation: mascote-shades-in .5s var(--ease-out); }
/* dormindo, os óculos vão para a testa */
.mascote.is-sleeping .mascote-shades { transform: translateY(-11px); }
@keyframes mascote-shades-in { from { transform: translateY(-14px); opacity: 0; } }

/* ----- Café: xícara fumegando, segurada pela mãozinha ----- */
.mascote-mug {
  display: none;
  /* gira em torno do centro da xícara (coordenadas do desenho, 64×64) */
  transform-box: view-box; transform-origin: 53px 41px;
  transition: transform .45s var(--ease-out);
}
.mascote.is-coffee .mascote-mug { display: inline; animation: mascote-fade-in .4s var(--ease-out); }
.mascote-mug-cup { fill: #F2F2F1; stroke: #1E1D1D; stroke-width: 1.2; }
.mascote-mug-handle { fill: none; stroke: #F2F2F1; stroke-width: 2.2; stroke-linecap: round; }
.mascote-mug-coffee { fill: #7A4A2E; }
.mascote-hand { fill: #8C66FF; stroke: #1E1D1D; stroke-width: 1.1; }

/* gole: leva a xícara até a boca e fecha os olhos */
.mascote.is-sip .mascote-mug { transform: translate(-7px, -4px) rotate(-26deg); }
.mascote.is-sip .mascote-steam { visibility: hidden; }
.mascote.is-sip .mascote-eyes, .mascote.is-sip .mascote-mouth { display: none; }
.mascote.is-sip .mascote-closed { display: inline; }
/* tonto, a xícara cai */
.mascote.is-dizzy .mascote-mug { display: none; }
.mascote-steam {
  fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; opacity: 0;
  transform-box: fill-box; animation: mascote-steam 2.2s ease-out infinite;
}
.mascote-steam + .mascote-steam { animation-delay: 1.1s; }
@keyframes mascote-steam { 0% { opacity: 0; transform: translateY(2px); } 35% { opacity: .85; } 100% { opacity: 0; transform: translateY(-4px); } }
@keyframes mascote-fade-in { from { opacity: 0; } }

/* ----- Bocejo ----- */
.mascote.is-yawn .mascote-eyes { transform: scaleY(.35); }
.mascote.is-yawn .mascote-mouth { display: none; }
.mascote.is-yawn .mascote-mouth-o { display: inline; transform-box: fill-box; transform-origin: center; animation: mascote-yawn-mouth 1.7s ease-in-out; }
.mascote.is-yawn .mascote-body { animation: mascote-yawn 1.7s ease-in-out; }
@keyframes mascote-yawn { 40%, 70% { transform: scale(.97, 1.05); } }
@keyframes mascote-yawn-mouth { 0%, 100% { transform: scale(.6); } 40%, 70% { transform: scale(1.5, 1.7); } }

/* ----- Tontura: olhos em espiral, boca ondulada, cambaleando ----- */
.mascote-dizzy, .mascote-mouth-wavy { display: none; }
.mascote-dizzy path {
  fill: none; stroke: #1E1D1D; stroke-width: 1.3; stroke-linecap: round;
  transform-box: fill-box; transform-origin: 50% 50%; animation: mascote-spin .9s linear infinite;
}
.mascote-mouth-wavy { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mascote.is-dizzy .mascote-pupil, .mascote.is-dizzy .mascote-mouth, .mascote.is-dizzy .mascote-shades { display: none; }
.mascote.is-dizzy .mascote-dizzy, .mascote.is-dizzy .mascote-mouth-wavy { display: inline; }
.mascote.is-dizzy .mascote-hop { animation: mascote-wobble .8s ease-in-out infinite; }
@keyframes mascote-spin { to { transform: rotate(360deg); } }
@keyframes mascote-wobble { 0%, 100% { transform: rotate(-8deg) translateX(-1px); } 50% { transform: rotate(8deg) translateX(1px); } }

@media (prefers-reduced-motion: reduce) {
  .mascote-steam { opacity: .8; animation: none; }
}

/* ==========================================================================
   Bracinho acenando (entrada)
   ========================================================================== */

/* ----- Bracinho (esquerdo): sai do corpo, acena 2x e volta ----- */
.mascote-arm {
  display: none;
  transform-box: view-box; transform-origin: 17px 31px; /* ombro esquerdo */
}
.mascote-arm-limb { fill: none; stroke: var(--brand-purple); stroke-width: 5; stroke-linecap: round; }
.mascote-arm .mascote-hand { fill: #8C66FF; stroke: #1E1D1D; stroke-width: 1.1; }
.mascote-wave-marks { fill: none; stroke: var(--accent-ink); stroke-width: 1.4; stroke-linecap: round; opacity: 0; }
.mascote.is-wave .mascote-arm { display: inline; animation: mascote-wave 2.2s var(--ease-out) both; }
.mascote.is-wave .mascote-wave-marks { animation: mascote-wave-marks 2.2s ease both; }
@keyframes mascote-wave {
  0%   { transform: rotate(-75deg) scale(.2); opacity: 0; }
  12%  { transform: rotate(0) scale(1); opacity: 1; }
  25%  { transform: rotate(18deg); }
  38%  { transform: rotate(-14deg); }
  51%  { transform: rotate(18deg); }
  64%  { transform: rotate(-14deg); }
  78%  { transform: rotate(0); opacity: 1; }
  100% { transform: rotate(-75deg) scale(.2); opacity: 0; }
}
@keyframes mascote-wave-marks { 0%, 15% { opacity: 0; } 25%, 65% { opacity: 1; } 80%, 100% { opacity: 0; } }


/* ==========================================================================
   Vento, fim de semana, sem internet e datas especiais
   ========================================================================== */

/* ----- Vento (rolagem rápida): rosto achatado e linhas de vento ----- */
.mascote-windlines { display: none; fill: none; stroke: var(--accent-ink); stroke-width: 1.6; stroke-linecap: round; }
.mascote.is-windy .mascote-windlines { display: inline; animation: mascote-wind .35s linear infinite; }
.mascote.is-windy .mascote-body { animation: mascote-windy .18s ease-in-out infinite alternate; }
.mascote.is-windy .mascote-eyes { transform: scaleY(.5); }
.mascote.is-windy .mascote-mouth { display: none; }
.mascote.is-windy .mascote-mouth-o { display: inline; }
@keyframes mascote-windy { from { transform: scale(1.06, .92); } to { transform: scale(1.1, .88) skewX(-3deg); } }
@keyframes mascote-wind { from { transform: translateX(6px); opacity: 0; } 40% { opacity: 1; } to { transform: translateX(-6px); opacity: 0; } }

/* ----- Fim de semana: boné ----- */
.mascote-cap, .mascote-santa, .mascote-party, .mascote-antenna, .mascote-ghost { display: none; }
.mascote.is-cap .mascote-cap { display: inline; }
.mascote-cap-dome { fill: #FFB020; stroke: #1E1D1D; stroke-width: 1; stroke-linejoin: round; }
.mascote-cap-dot { fill: #1E1D1D; }

/* ----- Sem internet: antena com luz vermelha piscando ----- */
.mascote.is-offline .mascote-antenna { display: inline; }
.mascote-antenna-rod { stroke: #A6A3A3; stroke-width: 2; stroke-linecap: round; }
.mascote-antenna-led { fill: #FF6B6B; animation: blink 1s steps(1) infinite; }
/* com boné ou chapéu, a antena some (não cabe tudo na cabeça) */
.mascote.is-cap .mascote-antenna, .mascote.is-natal .mascote-antenna,
.mascote.is-aniversario .mascote-antenna { display: none; }

/* ----- Natal: gorro ----- */
.mascote.is-natal .mascote-santa { display: inline; }
.mascote-santa-red { fill: #E23B3B; stroke: #1E1D1D; stroke-width: .8; stroke-linejoin: round; }
.mascote-santa-fur { fill: #F2F2F1; stroke: rgba(30, 29, 29, .35); stroke-width: .8; }

/* ----- Aniversário: chapéu de festa + confete ----- */
.mascote.is-aniversario .mascote-party { display: inline; }
.mascote-party-cone { fill: #FFD86B; stroke: #1E1D1D; stroke-width: .9; stroke-linejoin: round; }
.mascote-party-stripe { fill: none; stroke: var(--brand-purple); stroke-width: 2; stroke-linecap: round; }
.mascote-party-pom { fill: #FF6B6B; stroke: #1E1D1D; stroke-width: .8; }

/* ----- Ano Novo e aniversário: confete caindo em volta ----- */
.mascote-confetti { display: none; position: absolute; inset: -34px -18px 0; pointer-events: none; }
.mascote.is-anonovo .mascote-confetti, .mascote.is-aniversario .mascote-confetti { display: block; }
.mascote-confetti i {
  position: absolute; top: 0; width: 4px; height: 7px; border-radius: 1px; opacity: 0;
  animation: mascote-confetti 2.4s linear infinite;
}
@keyframes mascote-confetti {
  0% { opacity: 0; transform: translateY(0) rotate(0); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateY(96px) rotate(540deg); }
}

/* ----- Halloween: lençol de fantasma (os olhos aparecem pelos furos) ----- */
.mascote.is-halloween .mascote-ghost { display: inline; }
.mascote-ghost { animation: mascote-flutter 2.6s ease-in-out infinite; }
.mascote-ghost-sheet { fill: #F2F2F1; fill-rule: evenodd; stroke: #1E1D1D; stroke-width: 1; stroke-linejoin: round; }
.mascote-ghost-mouth { fill: #1E1D1D; }
@keyframes mascote-flutter { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }

@media (prefers-reduced-motion: reduce) {
  .mascote-confetti i { opacity: 1; animation: none; }
}

/* ==========================================================================
   Diagnóstico (dentro do terminal)
   ========================================================================== */
.mascote-q { margin-top: 12px; color: var(--text); font-weight: 500; }
.mascote-q span { color: var(--accent-ink); font-weight: 400; }
.mascote-opts { display: grid; gap: 6px; margin: 8px 0 4px; }
.mascote-opt {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--text); font: inherit; text-align: left; line-height: 1.35;
  transition: border-color .2s, background-color .2s;
}
.mascote-opt b { color: var(--accent-ink); font-weight: 500; }
.mascote-opt:hover, .mascote-opt:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.mascote-line a.mascote-cta {
  display: inline-flex; align-items: center; margin: 10px 8px 4px 0; padding: 10px 14px;
  border-radius: 10px; background: var(--accent); color: var(--on-accent);
  text-decoration: none; font-weight: 500;
}
.mascote-line a.mascote-cta:hover { background: var(--accent-ink); color: var(--on-accent); }
.mascote-chips[hidden] { display: none; }

/* ==========================================================================
   Notebook (terminal aberto): espia por cima da tampa e digita ao responder
   ========================================================================== */
.mascote-laptop { display: none; }
.mascote.is-open .mascote-laptop { display: inline; animation: mascote-laptop-in .35s var(--ease-out); }
.mascote-laptop-lid { fill: #C9C6C6; stroke: #1E1D1D; stroke-width: .8; }
.mascote-laptop-logo { fill: var(--brand-purple); }
.mascote-laptop-base { fill: #A6A3A3; stroke: #1E1D1D; stroke-width: .8; stroke-linejoin: round; }
.mascote-laptop-glow { fill: #B9A3FF; opacity: 0; }
.mascote-tap-l, .mascote-tap-r { transform-box: fill-box; transform-origin: 50% 100%; }
/* com o notebook, a xícara fica de lado */
.mascote.is-open .mascote-mug { display: none; }
/* respondendo: as mãos batem no teclado e a tela pisca; sem o balanço de cabeça */
.mascote.is-open.is-thinking .mascote-hop { animation: none; }
.mascote.is-thinking .mascote-tap-l, .mascote.is-typing .mascote-tap-l { animation: mascote-tap .22s steps(2) infinite; }
.mascote.is-thinking .mascote-tap-r, .mascote.is-typing .mascote-tap-r { animation: mascote-tap .22s steps(2) infinite; animation-delay: -.11s; }
.mascote.is-thinking .mascote-laptop-glow, .mascote.is-typing .mascote-laptop-glow { animation: mascote-glow .5s steps(2) infinite; }
@keyframes mascote-laptop-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes mascote-tap { 0% { transform: translateY(0); } 100% { transform: translateY(-2px); } }
@keyframes mascote-glow { 0% { opacity: .35; } 100% { opacity: .9; } }

/* ==========================================================================
   Easter egg (7 cliques no logo): corrida pela tela
   ========================================================================== */
.mascote.is-running .mascote-hop { animation: mascote-run .16s ease-in-out infinite alternate; }
@keyframes mascote-run { from { transform: translateY(0) rotate(-5deg); } to { transform: translateY(-6px) rotate(5deg); } }
/* durante o tombo, o balão sai acima dele (no meio da tela, à esquerda poderia cortar) */
.mascote.is-bubble-up .mascote-bubble {
  right: auto; left: -8px; bottom: calc(100% + 12px);
  max-width: min(240px, calc(100vw - 40px));
  border-radius: 14px 14px 14px 4px; transform-origin: 0 100%;
}
