/* Homepage: the pixel scene fills the window; HTML sits on top for chat, bubbles and hotspots.
   Colors, fonts and easing come from the Tailwind @theme tokens in index.html. */

html, body { height: 100%; }
body.home { overflow: hidden; }

.scene { position: fixed; inset: 0; overflow: hidden; }
#world {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Hidden admin entrance: top-left corner, no visual at all. */
.secret {
  position: fixed; top: 0; left: 0; z-index: 50;
  width: 28px; height: 28px;
  cursor: default;
}

.title {
  margin: 0;
  padding-left: .4rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  line-height: .85;
  text-transform: uppercase;
  color: var(--color-ink);
  text-shadow: 3px 3px 0 rgb(255 255 255 / .55);
}

.navlink {
  padding: .35rem .95rem;
  border: 3px solid var(--color-ink);
  border-radius: .8rem;
  background: var(--color-tee-light);
  box-shadow: 3px 3px 0 var(--color-ink);
  font-size: .98rem;
  transition: transform .12s, box-shadow .12s;
}
.navlink:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--color-ink); }
.navlink:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--color-ink); }
.navlink:focus-visible { outline: 3px solid var(--color-tee-deep); outline-offset: 2px; }

/* Invisible buttons over the cow, drone, mailbox and Hayden */
.hotspot {
  position: absolute;
  z-index: 4;
  display: block;
  padding: 0; border: 0; background: none;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.hotspot:focus-visible { outline: 3px dashed var(--color-ink); outline-offset: 2px; }

/* ---------- Speech bubble ---------- */
.bubble {
  position: absolute;
  z-index: 6;
  width: max-content;
  max-width: min(22rem, 38vw);
  padding: .9rem 1.15rem 1rem;
  background: var(--color-tee-light);
  color: var(--color-ink);
  border: 3px solid var(--color-ink);
  border-radius: 1.4rem 1.4rem 1.4rem .35rem;
  box-shadow: 5px 5px 0 var(--color-ink);
  font-size: clamp(1.02rem, 1.3vw, 1.22rem);
  line-height: 1.38;
  font-variation-settings: "BNCE" 40, "INFM" 55;
  translate: 0 -100%;
  transform-origin: 0% 100%;
  animation: pop .38s var(--ease-spring);
}
.bubble::before {
  content: "";
  position: absolute; left: -3px; bottom: -20px;
  width: 22px; height: 20px;
  background: var(--color-tee-light);
  border-left: 3px solid var(--color-ink);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.bubble::after {
  content: "";
  position: absolute; left: -3px; bottom: -20px;
  width: 22px; height: 20px;
  background: linear-gradient(to top right, transparent calc(50% - 2px), var(--color-ink) calc(50% - 2px), var(--color-ink) calc(50% + 1px), transparent calc(50% + 1px));
}
.bubble-text { margin: 0; text-wrap: pretty; }
.bubble .dots { display: none; gap: .35rem; padding: .35rem .2rem; }
.bubble.is-thinking .bubble-text { display: none; }
.bubble.is-thinking .dots { display: flex; }
.dots i { width: .6rem; height: .6rem; border-radius: 50%; background: var(--color-ink); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-6px); opacity: 1; } }
@keyframes pop { from { transform: scale(.6) rotate(-3deg); opacity: 0; } }

.moo {
  position: absolute; z-index: 6;
  padding: .3rem .7rem;
  background: #fff;
  border: 3px solid var(--color-ink);
  border-radius: 1rem 1rem 1rem .2rem;
  box-shadow: 3px 3px 0 var(--color-ink);
  font-size: 1.05rem; font-weight: 700;
  translate: 0 -100%;
  transform-origin: 0 100%;
  animation: pop .3s var(--ease-spring);
  pointer-events: none;
}

/* ---------- Chat chips ---------- */
.chip {
  flex: none;
  padding: .4rem .9rem;
  border-radius: 999px;
  border: 2.5px solid var(--color-ink);
  background: rgb(255 255 255 / .92);
  color: var(--color-ink);
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--color-ink);
  transition: transform .12s, background-color .12s;
}
.chip:hover { background: var(--color-tee-light); }
.chip:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--color-ink); }
.chip:focus-visible { outline: 3px solid var(--color-tee-deep); outline-offset: 2px; }
.chips { scrollbar-width: none; }

/* ---------- Transcript ---------- */
#log-list li { list-style: none; }
#log-list .who { display: block; font-size: .85rem; color: var(--color-tee-deep); font-weight: 700; }
#log-list .from-you .who { color: var(--color-barn); }
#log-list p { margin: .1rem 0 0; line-height: 1.45; }
#log-list .logged { display: inline-block; margin-top: .35rem; font-size: .8rem; padding: .1rem .55rem; border-radius: 999px; background: var(--color-tee); }

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
  .bubble {
    max-width: none;
    width: min(calc(100vw - 2rem), 24rem);
    translate: -50% -100%;
    border-radius: 1.3rem;
    transform-origin: 50% 100%;
    font-size: 1.04rem;
  }
  .bubble::before, .bubble::after { left: calc(50% - 11px); }
  .bubble::before { clip-path: polygon(0 0, 100% 0, 50% 100%); border-left: 0; }
  .bubble::after {
    background:
      linear-gradient(to bottom left, transparent calc(50% - 2px), var(--color-ink) calc(50% - 2px), var(--color-ink) calc(50% + 1px), transparent calc(50% + 1px)) left / 50% 100% no-repeat,
      linear-gradient(to bottom right, transparent calc(50% - 2px), var(--color-ink) calc(50% - 2px), var(--color-ink) calc(50% + 1px), transparent calc(50% + 1px)) right / 50% 100% no-repeat;
  }
  .title { font-size: 2.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
