/* Hamashia Studio — logo interativo
   Uso: <a href="/" class="hm-logo" data-hm-logo aria-label="Hamashia Studio, início"><img src="logo/logo.svg" alt="Hamashia Studio"></a>
   + logo.js. Sem JS fica a imagem parada (logo.svg). */

.hm-logo {
  --hm-paprica: #E4572E;
  --hm-berinjela: #2B1B2F;
  --hm-creme: #FFF4E8;
  --hm-ink: var(--hm-creme);      /* cor do nome (fundo escuro) */
  --hm-tilt-x: 0deg;
  --hm-tilt-y: 0deg;
  --hm-shift-x: 0px;
  --hm-shift-y: 0px;
  display: inline-block;
  width: clamp(180px, 42vw, 300px);
  line-height: 0;
  color: var(--hm-ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 12px;
}
.hm-logo--claro { --hm-ink: var(--hm-berinjela); } /* só se um dia for sobre fundo claro */
.hm-logo--icone { width: clamp(44px, 12vw, 64px); }
.hm-logo--icone .hm-logo__word { display: none; }

.hm-logo img,
.hm-logo svg { display: block; width: 100%; height: auto; overflow: visible; }

.hm-logo:focus-visible { outline: 3px solid var(--hm-paprica); outline-offset: 6px; }

.hm-logo__name {
  font-family: 'Archivo Black', 'Poppins', 'Segoe UI Black', 'Segoe UI', sans-serif;
  font-weight: 900;
  font-size: 30px;
  fill: var(--hm-ink);
}
.hm-logo__studio {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 11px;
  fill: var(--hm-paprica);
}
.hm-logo__rule { fill: var(--hm-paprica); }
.hm-logo__crumbs circle { fill: var(--hm-paprica); }

/* Todas as partes animadas giram/escalam em torno do próprio centro */
.hm-logo__mark,
.hm-logo__chew,
.hm-logo__pop,
.hm-logo__float,
.hm-logo__h,
.hm-logo__bite,
.hm-logo__crumbs circle,
.hm-logo__word,
.hm-logo__rule {
  transform-box: fill-box;
  transform-origin: center;
}
.hm-logo__rule { transform-origin: left center; }
.hm-logo__chew { transform-origin: 50% 85%; }

/* ---------- Movimento (só quem não pediu menos movimento) ---------- */
@media (prefers-reduced-motion: no-preference) {

  /* Ícone "olha" para o cursor */
  .hm-logo__mark {
    transform: rotate(var(--hm-tilt-x)) translateY(var(--hm-tilt-y));
    transition: transform .45s cubic-bezier(.2,.8,.2,1);
  }
  .hm-logo__h {
    transform: translate(var(--hm-shift-x), var(--hm-shift-y));
    transition: transform .35s cubic-bezier(.2,.8,.2,1);
  }
  .hm-logo__rule { transition: transform .4s cubic-bezier(.2,.8,.2,1); }
  .hm-logo:hover .hm-logo__rule,
  .hm-logo:focus-visible .hm-logo__rule { transform: scaleX(1.1); }

  /* 1) Entrada: o quadrado aparece inteiro, o H sobe, e a mordida acontece */
  .hm-logo.is-intro .hm-logo__pop    { animation: hm-pop .52s cubic-bezier(.2,1.4,.4,1) both; }
  .hm-logo.is-intro .hm-logo__h      { animation: hm-rise .42s .18s cubic-bezier(.2,.9,.3,1) both; }
  .hm-logo.is-intro .hm-logo__bite   { animation: hm-chomp .46s .64s cubic-bezier(.3,1.6,.5,1) both; }
  .hm-logo.is-intro .hm-logo__chew   { animation: hm-chew .44s .64s ease-out both; }
  .hm-logo.is-intro .hm-logo__crumbs circle { animation: hm-fly .55s cubic-bezier(.2,.9,.3,1) both; }
  .hm-logo.is-intro .hm-logo__crumbs circle:nth-child(1) { animation-delay: .74s; }
  .hm-logo.is-intro .hm-logo__crumbs circle:nth-child(2) { animation-delay: .80s; }
  .hm-logo.is-intro .hm-logo__crumbs circle:nth-child(3) { animation-delay: .86s; }
  .hm-logo.is-intro .hm-logo__word   { animation: hm-word .5s .5s cubic-bezier(.2,.9,.3,1) both; }
  .hm-logo.is-intro .hm-logo__rule   { animation: hm-rule .5s .95s cubic-bezier(.2,.9,.3,1) both; }

  /* 2) Parado: flutua de leve e os farelos piscam */
  .hm-logo.is-live .hm-logo__float { animation: hm-float 6s ease-in-out infinite alternate; }
  .hm-logo.is-live .hm-logo__crumbs circle { animation: hm-twinkle 3.2s ease-in-out infinite; }
  .hm-logo.is-live .hm-logo__crumbs circle:nth-child(2) { animation-delay: -1.1s; }
  .hm-logo.is-live .hm-logo__crumbs circle:nth-child(3) { animation-delay: -2.2s; }

  /* 3) Mouse passa / dedo toca / foco do teclado: mordida maior + mastigada + farelos */
  .hm-logo.is-biting .hm-logo__bite { animation: hm-bite-big .8s cubic-bezier(.3,1.5,.5,1); }
  .hm-logo.is-biting .hm-logo__chew { animation: hm-chew .5s ease-out; }
  .hm-logo.is-biting .hm-logo__crumbs circle { animation: hm-burst .7s cubic-bezier(.2,.9,.3,1); }
  .hm-logo.is-biting .hm-logo__crumbs circle:nth-child(2) { animation-delay: .04s; }
  .hm-logo.is-biting .hm-logo__crumbs circle:nth-child(3) { animation-delay: .08s; }

  /* Fora da tela: pausa tudo */
  .hm-logo.is-off * { animation-play-state: paused !important; }

  .hm-logo__float, .hm-logo__chew, .hm-logo__bite { will-change: transform; }
}

@keyframes hm-pop {
  0%   { transform: scale(.55); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes hm-rise {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes hm-chomp {
  0%   { transform: scale(0); }
  55%  { transform: scale(1.3); }
  78%  { transform: scale(.9); }
  100% { transform: scale(1); }
}
@keyframes hm-chew {
  0%   { transform: scale(1, 1); }
  30%  { transform: scale(1.05, .93); }
  60%  { transform: scale(.97, 1.03); }
  100% { transform: scale(1, 1); }
}
@keyframes hm-fly {
  0%   { transform: translate(-9px, 7px) scale(0); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; }
}
@keyframes hm-word {
  from { transform: translateX(-10px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes hm-rule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes hm-float {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(-1.6px) rotate(-1.4deg); }
}
@keyframes hm-twinkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(.6) translateY(-1px); opacity: .55; }
}
@keyframes hm-bite-big {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.6); }
  70%  { transform: scale(1.42); }
  100% { transform: scale(1); }
}
@keyframes hm-burst {
  0%   { transform: translate(-8px, 6px) scale(.3); opacity: 0; }
  40%  { transform: translate(4px, -3px) scale(1.4); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 1; }
}
