/* ================================================================
   Home hero: Dash mascot stage, speech bubble and seasonal accents
   ================================================================ */

.hero--halloween {
  --accent: #ff8a1f;
  --accent-glow: rgba(255, 138, 31, 0.35);
}

.hero--halloween .btn--primary:hover {
  background: #ffa24a;
  box-shadow: 0 0 40px var(--accent-glow), 0 8px 32px rgba(255, 138, 31, 0.15);
}

/* Dash's home spot in the grid: it frames the camera and takes clicks, while he draws on the full-hero canvas.
   --dash-size scales him relative to the spot, so he can outgrow it without clipping. */
.hero-mascot {
  --dash-size: 1.4;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  justify-self: center;
  order: -1;
  cursor: pointer;
  touch-action: manipulation;
}

.hero-copy .hero-sub {
  max-width: 30em;
  color: var(--text-light);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.6;
  letter-spacing: 0.01em;
  text-transform: none;
  margin-bottom: 40px;
}

.hero-mascot-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  animation: heroMascotIn 1s var(--ease) 0.6s forwards;
}

@keyframes heroMascotIn {
  to { opacity: 1; }
}

/* JS sets --bubble_x/--bubble_y to the head anchor and --tail_x to where the tail meets the box. */
.speech_bubble {
  --bubble_x: 0px;
  --bubble_y: 0px;
  --tail_x: 22px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  max-width: 260px;
  transform: translate(var(--bubble_x), calc(var(--bubble_y) - 100% - 16px));
  pointer-events: none;
}

.speech_text {
  position: relative;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: rgba(16, 16, 26, 0.92);
  box-shadow: 0 0 22px var(--accent-glow);
  color: var(--text-white);
  font: 500 14px/1.35 var(--font);
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(0.85);
  transform-origin: var(--tail_x) 100%;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}

.speech_text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--tail_x);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  background: inherit;
  transform: rotate(45deg);
}

.speech_bubble.is_visible .speech_text {
  opacity: 1;
  transform: none;
}

.speech_word {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s var(--ease), transform 0.25s var(--ease);
}

.speech_word.is_shown {
  opacity: 1;
  transform: none;
}

/* Hover tools float above Dash's head; JS sets --near from 0 (pointer far) to 1 (on it), is_near makes them clickable. */
.hover_tools {
  --tools_x: 0px;
  --tools_y: 0px;
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transform: translate(var(--tools_x), var(--tools_y));
}

.tool_button {
  --near: 0;
  --grow: calc(0.5 + 0.65 * var(--near));
  opacity: var(--near);
  transform: scale(var(--grow));
  pointer-events: none;
  display: grid;
  appearance: none;
  -webkit-appearance: none;
  line-height: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-white);
  background: #2b2b33;
  box-shadow: 0 0 14px var(--accent-glow);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), box-shadow 0.25s var(--ease);
}

.tool_button.is_near {
  pointer-events: auto;
}

.tool_button:focus {
  outline: none;
}

.tool_button:focus-visible {
  --grow: 1;
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool_button:active {
  transform: scale(calc(var(--grow) * 0.94));
}

.tool_button:hover {
  background: #383842;
}

.logo_button {
  color: #c23a62;
  box-shadow: 0 0 14px rgba(154, 39, 72, 0.4);
}

.logo_button:focus-visible {
  outline-color: #9a2748;
}

.sound_toggle[aria-pressed="true"] {
  color: var(--accent);
}

.tool_icon,
.sound_icon {
  width: 14px;
  height: 14px;
  display: block;
}

.tool_icon path,
.sound_icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound_toggle[aria-pressed="false"] .sound_icon_on,
.sound_toggle[aria-pressed="true"] .sound_icon_off {
  display: none;
}

@media (hover: none) {
  .tool_button {
    --grow: 1;
    opacity: 1;
    pointer-events: auto;
  }
}

.hover_tools.is_asleep .tool_button,
.hover_tools.is_asleep .tool_button:focus-visible {
  opacity: var(--near);
  pointer-events: none;
}

@media (max-width: 900px) {
  .hero-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 88px 0 96px;
    text-align: center;
  }

  .hero-mascot {
    --dash-size: 1;
    max-width: 320px;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-bg img {
    object-position: 62% 60%;
  }
}

@media (max-width: 420px) {
  .hero-mascot {
    max-width: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .speech_text,
  .speech_word,
  .tool_button {
    transition: none;
  }

  .hover_tools {
    display: none;
  }
}
