/* Core styles: page, Bruno, basket, bubble and the shared dream animation kit.
   Plugin-specific styles live in plugins/<kind>/<id>/style.css. */

:root {
  --sky-top: #1d2147;
  --sky-bottom: #3a3f74;
  --text: #f6efe4;
  --muted: #c9c3e0;
  --fur: #8a4b25;
  --fur-dark: #5e2f15;
  --fur-light: #a9643a;
  --basket: #c98f4e;
  --basket-dark: #9a6630;
  --cushion: #e7a6a1;
  --cushion-dark: #c9837f;
  --zzz: #fff6d8;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  background-color: var(--sky-top);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
  min-height: 100vh;
}

header, main { position: relative; z-index: 1; text-align: center; }

h1 {
  font-weight: 600;
  font-size: clamp(2.2rem, 7vw, 4rem);
  margin: 0;
  letter-spacing: .02em;
}
.tagline { color: var(--muted); margin: .4em 0 0; font-size: clamp(1rem, 2.6vw, 1.25rem); }

main { width: 100%; max-width: 760px; margin-top: 8px; }
svg { width: 100%; height: auto; display: block; overflow: visible; }

/* breathing body */
.breathe {
  transform-origin: 300px 300px;
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.012, 1.05); }
}

/* slow sleepy tail wag, pivoting at the base */
.tail {
  transform-origin: 170px 262px;
  animation: wag 3.2s ease-in-out infinite;
}
@keyframes wag {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(10deg); }
}

/* pivots and transitions behaviours can rely on */
.ear  { transform-origin: 416px 236px; }
.head { transform-origin: 405px 285px; }
.head, .brow { transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.open-eye { display: none; }

/* dream thought bubble */
.bubble {
  opacity: 0;
  transform: scale(.4);
  transform-box: fill-box;
  transform-origin: 90% 100%;
  transition: opacity .8s ease, transform .8s cubic-bezier(.3, 1.4, .5, 1);
}
.bubble.show { opacity: 1; transform: scale(1); }
.dream { display: none; }
.dream.active { display: inline; }

/* ---- shared dream animation kit ---- */

/* rotate/scale around the element's own center */
.fb { transform-box: fill-box; transform-origin: center; }

.d-sparkle { animation: d-sparkle 1.6s ease-in-out infinite; }
@keyframes d-sparkle {
  0%, 100% { transform: scale(.3); opacity: .3; }
  50%      { transform: scale(1.2); opacity: 1; }
}

.d-spin { animation: d-spin 4s linear infinite; }
@keyframes d-spin { to { transform: rotate(360deg); } }

/* run across the bubble from left to right */
.d-run { animation: d-run 3.4s linear infinite; }
@keyframes d-run {
  from { transform: translateX(-140px); }
  to   { transform: translateX(140px); }
}

.d-blink { animation: d-blink 3s infinite; }
@keyframes d-blink {
  0%, 88%, 100% { transform: scaleY(1); }
  93%           { transform: scaleY(.1); }
}
