/* ============================================================
   $hoocat — escena doodle
   Paleta del personaje: blanco puro #fff, negro puro #000 (contorno grueso),
   verde bosque #5d8143 (capucha), rojo-naranja #fb4710 (pluma, acento)
   ============================================================ */

/* fuentes auto-alojadas (sin depender de Google Fonts) */
@font-face {
  font-family: 'Patrick Hand';
  src: url('../assets/fonts/patrick-hand.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('../assets/fonts/caveat.woff2') format('woff2');
  font-weight: 600 700;
  font-display: swap;
}

:root {
  --neon: #5d8143;       /* verde bosque de la capucha del personaje */
  --neon-soft: rgba(93, 129, 67, 0.12);
  --red: #fb4710;        /* rojo-naranja de la pluma (acento) */
  --ink: #000000;        /* negro puro, contorno grueso (como el personaje) */
  --paper: #ffffff;      /* blanco puro (cuerpo del personaje) */
  --gray: #726d62;       /* gris apagado con contraste AA (~4.8:1) */
  --gray-light: #e6e0d2;
  --sketch-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --font-hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --font-title: 'Caveat', 'Patrick Hand', cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-hand);
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ============ capucha enmarcando el viewport ============ */

.hood-corner {
  position: fixed;
  top: -60px;
  width: 45vw;
  height: 130px;
  border-bottom: 4px solid var(--neon);
  pointer-events: none;
  z-index: 50;
  opacity: 0.9;
}
.hood-left  { left: -40px;  border-bottom-right-radius: 100% 90px; }
.hood-right { right: -40px; border-bottom-left-radius: 100% 90px; }

/* ============ escena: azotea ============ */

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--neon-soft) 0%, #f6faf4 38%, #f6faf4 48%, #eef1ea 48%, #dfe4da 100%);
}

.scene-title {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  text-align: center;
  z-index: 10;
}
.tagline {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  white-space: nowrap;
  line-height: 1;
}
.tagline::after {
  content: "";
  display: block;
  height: 5px;
  margin-top: 2px;
  background: var(--neon);
  border-radius: var(--sketch-radius);
  transform: rotate(0.8deg);
}
.sub {
  margin-top: 10px;
  font-size: 1.05rem;
  color: var(--gray);
}

/* ---- decoración ---- */

.scene-decor { position: absolute; pointer-events: none; }

.cloud-1 { top: 12%; left: 6%;  width: 11%; min-width: 110px; animation: drift 14s ease-in-out infinite; }
.cloud-2 { top: 7%; right: 13%; width: 9%; min-width: 90px; animation: drift 18s ease-in-out infinite reverse; }
@keyframes drift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(14px); }
}

.sun { top: 12%; right: 27%; width: 9.5%; min-width: 100px; animation: sun-rise 5s ease-in-out infinite; }
/* halo cálido de amanecer alrededor del sol rojo-naranja */
.sun svg { filter: drop-shadow(0 0 20px rgba(251, 71, 16, 0.4)) drop-shadow(0 0 8px rgba(251, 71, 16, 0.3)); }
@keyframes sun-rise {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* pájaros: cruzan el cielo mientras aletean */
.birds { top: 19%; left: -14%; width: 12%; min-width: 120px; z-index: 1; animation: birds-cross 24s linear infinite; }
.bird { transform-box: fill-box; transform-origin: center; animation: flap 0.9s ease-in-out infinite; }
.b-b { animation-delay: -0.45s; }
@keyframes birds-cross {
  0%   { transform: translateX(0) translateY(0); }
  50%  { transform: translateX(64vw) translateY(-16px); }
  100% { transform: translateX(128vw) translateY(0); }
}
@keyframes flap {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.55); }
}

.skyline {
  bottom: 52%;
  left: 0;
  width: 100%;
  opacity: 0.8;
}
.skyline svg { height: 15vh; width: 100%; }

.wall {
  top: 48%;
  left: 0;
  width: 100%;
  height: 9vh;
  z-index: 2;
}
.wall svg { width: 100%; height: 100%; }
/* sombra que el murete proyecta sobre el suelo: marca el cambio de plano */
.wall::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 16px;
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.12), transparent);
}

.floor {
  top: calc(48% + 9vh);
  left: 0;
  width: 100%;
  height: calc(52% - 9vh);
  z-index: 0;
}
.floor svg { width: 100%; height: 100%; }

/* sombras que apoyan los objetos en el suelo */
.tv::before, .clothesline::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: 82%;
  height: 18px;
  background: radial-gradient(ellipse at center, rgba(17, 17, 17, 0.22), transparent 70%);
  z-index: -1;
}
.clothesline::before { width: 96%; height: 12px; bottom: 26px; background: radial-gradient(ellipse at center, rgba(17, 17, 17, 0.14), transparent 70%); }
.giphy::after, .sofa::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 78%;
  height: 16px;
  background: radial-gradient(ellipse at center, rgba(17, 17, 17, 0.2), transparent 70%);
  z-index: -1;
}
/* sombra de contacto justo bajo las patas del caballete */
.giphy::after { width: 58%; bottom: 1px; height: 14px; }
.fire svg { filter: drop-shadow(0 4px 14px rgba(93, 129, 67, 0.4)); }
/* humo que ondea suavemente sobre la hoguera */
.fire-smoke {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: smoke 3.4s ease-in-out infinite;
}
@keyframes smoke {
  0%, 100% { transform: translateY(0) scaleY(1) rotate(0deg); opacity: 0.5; }
  50%      { transform: translateY(-4px) scaleY(1.1) rotate(3deg); opacity: 0.75; }
}
.fire-flame {
  animation: flicker 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
@keyframes flicker {
  0%, 100% { transform: scale(1, 1); }
  35% { transform: scale(1.05, 0.93); }
  70% { transform: scale(0.96, 1.06); }
}

/* ---- objetos interactivos y props ---- */

.obj, .prop {
  position: absolute;
  z-index: 5;
  cursor: pointer;
  /* scale/translate/rotate como propiedades separadas -> componen con el transform base de cada objeto */
  transition: scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), translate 0.2s ease, filter 0.2s ease;
}
/* hover: el objeto se "selecciona" — crece, se eleva y se enciende un contorno verde */
.obj:hover, .prop:hover {
  scale: 1.08;
  translate: 0 -7px;
  filter:
    drop-shadow(2px 0 0 #5d8143) drop-shadow(-2px 0 0 #5d8143)
    drop-shadow(0 2px 0 #5d8143) drop-shadow(0 -2px 0 #5d8143)
    drop-shadow(0 0 7px rgba(93, 129, 67, 0.9))
    drop-shadow(0 12px 9px rgba(0, 0, 0, 0.16));
  z-index: 20;
}
/* feedback táctil al clic */
.obj:active, .prop:active { scale: 0.95; translate: 0 -2px; transition-duration: 0.08s; }

/* foco visible por teclado (accesibilidad) */
.obj:focus-visible, .cat:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 4px;
  border-radius: 6px;
}
.footer-links a:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 3px;
  border-radius: 4px;
}

/* guiño "tócame": wiggle escalonado una vez tras la intro (rotate compone con el transform base) */
@keyframes attention {
  0%, 100% { rotate: 0deg; }
  30% { rotate: -5deg; }
  65% { rotate: 4deg; }
}
.obj.hint, .prop.hint { animation: attention 0.6s ease; }

/* etiqueta: oculta por defecto, aparece ENCIMA del objeto al pasar el ratón
   (encima para que no se salga de pantalla en objetos bajos como la TV o el gato) */
.chip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--gray);
  background: var(--paper);
  border: 2px solid var(--gray-light);
  border-radius: 14px;
  padding: 1px 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}
.obj:hover .chip, .cat:hover .chip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.chip-live {
  color: var(--ink);
  border-color: var(--neon);
  background: var(--neon-soft);
  font-weight: bold;
}

/* posiciones en la escena */
.plane       { top: 25%; left: 11%; width: 12%; min-width: 130px; z-index: 5; }
.plane svg   { animation: fly 5s ease-in-out infinite; }
@keyframes fly {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-9px) rotate(-3deg); }
}
.clothesline { top: 45%; left: 2%; width: 21%; min-width: 220px; }
.tv          { top: 68%; left: 4%; width: 13%; min-width: 148px; }
.tweets      {
  top: 34%; right: 4.5%; width: 15%; min-width: 180px; z-index: 3;
  transform: rotate(-3deg);
  transform-origin: bottom center;
}
/* sombra de contacto en la base, para que se apoye en el suelo/murete */
.tweets::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1%;
  transform: translateX(-50%);
  width: 82%;
  height: 15px;
  background: radial-gradient(ellipse at center, rgba(42, 38, 32, 0.28), transparent 70%);
  z-index: -1;
}
/* leve sombra proyectada sobre la pared (no la levanta) */
.tweets svg { filter: drop-shadow(2px 2px 1px rgba(42, 38, 32, 0.14)); }
.sofa        { top: 50%; left: 42%; width: 20%; min-width: 220px; z-index: 4; }
.fire        { top: 74%; left: 48.5%; width: 7%; min-width: 78px; z-index: 6; }

/* cartel de pie (giphy) */
.giphy {
  position: absolute;
  top: 54%;
  left: 25%;
  width: 12.5%;
  min-width: 140px;
  z-index: 5;
}

/* pelota que rebota dentro del lienzo (squash & stretch) */
.gif-ball {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: gif-bounce 1.1s ease-in-out infinite;
}
@keyframes gif-bounce {
  0%   { transform: translateY(-46px) scale(1, 1); }
  42%  { transform: translateY(0)     scale(1, 1); }
  50%  { transform: translateY(3px)   scale(1.35, 0.62); }
  58%  { transform: translateY(0)     scale(1, 1); }
  100% { transform: translateY(-46px) scale(1, 1); }
}
.gif-shadow {
  transform-box: fill-box;
  transform-origin: center;
  animation: gif-shadow 1.1s ease-in-out infinite;
}
@keyframes gif-shadow {
  0%, 100% { transform: scale(0.55); opacity: 0.18; }
  50%      { transform: scale(1);    opacity: 0.45; }
}

/* gato */
.cat {
  position: absolute;
  top: 62%;
  left: 65%;
  width: 11%;
  min-width: 130px;
  z-index: 6;
  text-align: center;
  cursor: pointer;
  transition: scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cat:hover { scale: 1.06; z-index: 21; }
.cat:active { scale: 0.97; transition-duration: 0.08s; }
.cat-img {
  width: 100%;
  height: auto;
  display: block;
  animation: cat-bob 4s ease-in-out infinite;
}
@keyframes cat-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.speech {
  display: inline-block;
  margin-bottom: 6px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius);
  padding: 5px 16px;
  font-size: 1.05rem;
  position: relative;
  transform: rotate(-1deg);
  min-width: 70px;
}
.speech::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 38%;
  width: 10px;
  height: 10px;
  background: var(--paper);
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

/* ============ intro: el gato estaba KO y revive ============ */

/* la escena entra con un fundido suave */
.scene { animation: scene-in 0.8s ease both; }
@keyframes scene-in { from { opacity: 0; } to { opacity: 1; } }

/* frame KO (fuera de combate, con el fantasmita) — se muestra primero y luego revive */
.cat-ko {
  position: absolute;
  left: -14%;
  bottom: 0;
  width: 128%;
  height: auto;
  z-index: 6;
  pointer-events: none;
  animation: ko-bob 1.7s ease-in-out infinite, ko-out 0.55s ease 1.35s forwards;
}
@keyframes ko-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}
@keyframes ko-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06) translateY(-18px); }
}

/* el gato de pie aparece (revive) cuando el KO se desvanece */
.cat-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  animation: cat-bob 4s ease-in-out infinite, cat-in 0.45s ease 1.5s forwards;
}
@keyframes cat-in { to { opacity: 1; } }

/* el gato se sobresalta al revivir (transform; el parallax usa translate, no colisiona) */
.cat { animation: cat-wake 0.6s ease 1.55s both; transform-origin: bottom center; }
@keyframes cat-wake {
  0%, 100% { transform: none; }
  35% { transform: scale(1.06, 0.94); }
  70% { transform: scale(0.98, 1.02) rotate(-1.5deg); }
}

/* el globo "who?" aparece cuando ya revivió */
.speech { opacity: 0; animation: speech-pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) 1.8s forwards; }
@keyframes speech-pop {
  0%   { opacity: 0; transform: rotate(-1deg) scale(0.5) translateY(8px); }
  100% { opacity: 1; transform: rotate(-1deg) scale(1) translateY(0); }
}

/* accesibilidad: sin animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  .scene, .cat, .speech, .cat-img, .cat-ko,
  .gif-ball, .gif-shadow, .fire-flame, .fire-smoke, .cloud-1, .cloud-2, .sun,
  .birds, .bird, .plane svg { animation: none !important; }
  .speech, .cat-img { opacity: 1; }
  .cat-ko, .birds { display: none; }
}

/* ============ footer ============ */

.footer {
  margin-top: 0;
  border-top: 4px solid var(--ink);
  padding: 40px 24px 50px;
  text-align: center;
  background: var(--neon-soft);
}
.footer-tagline {
  font-family: var(--font-title);
  font-size: 1.9rem;
  margin-bottom: 14px;
  transform: rotate(-1deg);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  margin-bottom: 16px;
}
.footer-links a {
  border-bottom: 2px solid var(--neon);
  font-weight: bold;
}
.soon-link { color: var(--gray); }
.disclaimer { font-size: 0.8rem; color: var(--gray); }

/* ============ toast ============ */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 22px;
  border-radius: var(--sketch-radius);
  font-size: 0.95rem;
  transition: transform 0.25s ease;
  z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============ botón de música ============ */
.music-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 0;
  cursor: pointer;
  z-index: 120;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  transition: scale 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.music-btn:hover { scale: 1.08; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18), 0 0 6px rgba(93, 129, 67, 0.6); }
.music-btn:active { scale: 0.94; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.music-btn:focus-visible { outline: 3px solid var(--neon); outline-offset: 3px; }
.music-btn svg { width: 100%; height: 100%; display: block; }

/* alterna icono nota <-> barras según estado */
.music-btn .ic-bars { display: none; }
.music-btn.playing .ic-note { display: none; }
.music-btn.playing .ic-bars { display: block; }

/* ecualizador animado cuando suena */
.music-btn.playing .bar {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}
.music-btn.playing .b1 { animation-delay: -0.2s; }
.music-btn.playing .b2 { animation-delay: -0.5s; }
.music-btn.playing .b3 { animation-delay: -0.35s; }
@keyframes eq {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.35); }
}

/* ============ mobile: la escena se apila ============ */

@media (max-width: 760px) {
  .hood-corner { width: 60vw; height: 90px; }

  .scene {
    min-height: unset;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 120px 24px 60px;
    background: linear-gradient(180deg, var(--neon-soft) 0%, var(--paper) 30%);
  }

  .scene-decor { display: none; }

  .scene-title { position: static; transform: none; order: -2; }
  .tagline { white-space: normal; }

  .obj, .prop, .cat {
    position: static;
    transform: none;
    width: 100%;
    max-width: 340px;
    min-width: unset;
  }

  .cat { order: -1; max-width: 250px; position: relative; left: auto; top: auto; }  /* relative: ancla el frame KO de la intro */
  .giphy { max-width: 150px; }

  .fire { max-width: 160px; }
  .sofa { max-width: 300px; }

  /* etiquetas en móvil: debajo, siempre visibles (no hay hover) */
  .chip { position: static; display: table; opacity: 1; transform: none; margin: 6px auto 0; }
}
