/* Talent visits (talent-visit.js): the "coming up the lane" banner, the truck arriving, the chat, the badge. */
.tv-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(620px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--fh-surface, #fff);
  color: var(--fh-ink, #14291e);
  border: 1px solid var(--fh-line-strong, #0003);
  box-shadow: 0 18px 50px #0006;
  animation: tv-rise 0.5s ease-out;
}
.tv-banner-art {
  flex: 0 0 120px;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  line-height: 0;
}
.tv-banner-art svg,
.tv-banner-art img {
  width: 120px;
  height: auto;
  display: block;
}
.tv-banner-art img {
  aspect-ratio: 10 / 9;
  object-fit: cover;
  transition: transform 0.3s;
}
.tv-banner-art:hover img,
.tv-banner-art:focus-visible img {
  transform: scale(1.06);
}
.tv-play {
  position: absolute;
  inset: auto 6px 6px auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #000a;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  padding-left: 2px;
}
.tv-banner-text {
  flex: 1;
  display: grid;
  gap: 2px;
}
.tv-banner-text span {
  color: var(--fh-muted, #4c5d50);
  font-size: 0.9em;
}
.tv-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@keyframes tv-rise {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
}

/* The scene: a farm lane at golden hour. Photo and video modes fill the screen. */
.tv-scene.video,
.tv-scene.still {
  background: #000;
}
.tv-video,
.tv-still,
.tv-still img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tv-scene.still.arrive .tv-still img {
  animation: tv-push 7.6s cubic-bezier(0.2, 0.5, 0.4, 1) both;
  transform-origin: 54% 62%;
}
.tv-scene.still.leave .tv-still img {
  animation: tv-pull 4.2s ease-in both;
  transform-origin: 54% 62%;
}
.tv-scene.still .tv-dust {
  position: absolute;
  left: 30%;
  right: 25%;
  bottom: 14%;
  height: 30%;
  background: radial-gradient(closest-side, #e8d6b080, #e8d6b000);
  filter: blur(8px);
  animation: tv-dust 2.4s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes tv-push {
  from {
    transform: scale(1.02) translateY(1.5%);
    filter: brightness(0.85);
  }
  to {
    transform: scale(1.22);
    filter: none;
  }
}
@keyframes tv-pull {
  from {
    transform: scale(1.22);
  }
  to {
    transform: scale(1);
    filter: brightness(0.7);
  }
}
@keyframes tv-dust {
  to {
    transform: translateX(-4%) scale(1.15);
    opacity: 0.6;
  }
}
/* Photo frames, in story order (coming up the lane, pulling in, the door, climbing down, walking up): each one
   dissolves in over the last with a soft focus pull, and every picture keeps its own camera move (`data-move`)
   running while the next fades in over it, so the cut reads as one shot. */
.tv-frames {
  position: absolute;
  inset: 0;
}
.tv-frame {
  opacity: 0;
  transition:
    opacity 1.1s cubic-bezier(0.4, 0, 0.2, 1),
    filter 1.1s ease;
  filter: blur(6px) brightness(1.08);
}
.tv-frame.on {
  opacity: 1;
  filter: none;
  z-index: 1;
}
.tv-scene.frames.arrive .tv-frame img {
  animation: none;
  will-change: transform;
}
.tv-scene.frames.arrive .tv-frame.play img {
  animation-duration: 5.2s;
  animation-timing-function: cubic-bezier(0.25, 0.4, 0.4, 1);
  animation-fill-mode: both;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='push'] img {
  animation-name: tv-f-push;
  transform-origin: 55% 55%;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='pan-l'] img {
  animation-name: tv-f-pan-l;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='pan-r'] img {
  animation-name: tv-f-pan-r;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='rise'] img {
  animation-name: tv-f-rise;
  transform-origin: 50% 40%;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='walk'] img {
  animation-name: tv-f-walk;
  transform-origin: 66% 30%;
}
.tv-scene.frames.arrive .tv-frame.play[data-move='drift'] img {
  animation-name: tv-drift;
}
.tv-scene.frames.arrive .tv-frame:first-child.play img {
  animation-duration: 4.6s;
}
@keyframes tv-f-push {
  from {
    transform: scale(1.04);
  }
  to {
    transform: scale(1.16);
  }
}
/* The truck faces left: the camera follows it as it rolls in. */
@keyframes tv-f-pan-l {
  from {
    transform: scale(1.14) translateX(4%);
  }
  to {
    transform: scale(1.1) translateX(-2.5%);
  }
}
@keyframes tv-f-pan-r {
  from {
    transform: scale(1.14) translateX(-4%);
  }
  to {
    transform: scale(1.1) translateX(2.5%);
  }
}
/* Climbing down: the frame settles from the cab toward his boots. */
@keyframes tv-f-rise {
  from {
    transform: scale(1.14) translateY(3%);
  }
  to {
    transform: scale(1.08) translateY(-1.5%);
  }
}
/* Walking up: he grows in the frame as he comes toward the camera. */
@keyframes tv-f-walk {
  from {
    transform: scale(1.02);
  }
  to {
    transform: scale(1.2);
  }
}
@keyframes tv-drift {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1.01);
  }
}
.tv-scene.calm .tv-frame {
  transition: opacity 0.35s ease;
  filter: none;
}
.tv-scene.calm .tv-frame img {
  animation: none !important;
}
/* The photos have their own dust. */
.tv-scene.frames .tv-dust {
  display: none;
}

/* His welcome video, after he's out of the truck. */
.tv-scene.welcome {
  background: radial-gradient(ellipse at center, #1d1a12f0, #000f 75%);
  display: grid;
  place-items: center;
  z-index: 1220;
}
.tv-welcome {
  width: min(1100px, 92vw, calc((100vh - 140px) * 16 / 9));
  animation: tv-rise-in 0.5s ease-out both;
}
.tv-welcome-eyebrow {
  margin: 0 0 10px;
  color: #f2cf63;
  font:
    800 15px/1 'Barlow Condensed',
    Impact,
    sans-serif;
  letter-spacing: 0.14em;
}
.tv-welcome-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px #000c;
}
.tv-welcome-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.tv-unmute {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  border: 0;
  background: #f2cf63;
  color: #1a1408;
  font-weight: 700;
  cursor: pointer;
}
.tv-scene.welcome .tv-skip {
  font-weight: 700;
}
@keyframes tv-rise-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}
.tv-panel.tv-hidden {
  display: none;
}

.tv-caption {
  position: absolute;
  left: 20px;
  bottom: 18px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: #0009;
  color: #fff;
  font-size: 0.95em;
  letter-spacing: 0.02em;
}
.tv-scene.drawn .tv-caption {
  display: none;
}
.tv-scene.calm .tv-still img,
.tv-scene.calm .tv-dust {
  animation: none !important;
}
.tv-scene {
  position: fixed;
  inset: 0;
  z-index: 1190;
  overflow: hidden;
  background: #0007;
  transition: opacity 0.45s;
}
.tv-scene.out {
  opacity: 0;
}
.tv-sky {
  position: absolute;
  inset: 8% 0 30%;
  background: linear-gradient(#7fb4e0, #f4d9a6 85%);
  border-radius: 0;
}
.tv-hills {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  height: 14%;
  background:
    radial-gradient(120% 100% at 20% 100%, #6f8f3e 60%, transparent 61%),
    radial-gradient(120% 120% at 80% 100%, #5f7f34 60%, transparent 61%);
}
.tv-lane {
  position: absolute;
  left: 0;
  right: 0;
  top: 70%;
  bottom: 0;
  background: linear-gradient(#b9a37a, #8c7650 40%, #4d5a2a 41%, #3f4b22);
}
.tv-truck {
  position: absolute;
  left: 50%;
  top: 70%;
  width: min(560px, 80vw);
  transform: translate(-50%, -88%);
}
.tv-truck svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 8px #0005);
}
.tv-scene.arrive .tv-truck {
  animation: tv-drive-in 4.2s cubic-bezier(0.15, 0.6, 0.3, 1) both;
}
.tv-scene.leave .tv-truck {
  animation: tv-drive-out 3.6s cubic-bezier(0.6, 0, 0.9, 0.6) 1s both;
}
.tv-scene .tv-wheel {
  animation: tv-roll 0.5s linear infinite;
}
.tv-scene.arrive .tv-wheel {
  animation-duration: 0.45s;
  animation-iteration-count: 9;
  animation-timing-function: cubic-bezier(0.3, 0.4, 0.6, 1);
}
.tv-scene.leave .tv-wheel {
  animation-delay: 1s;
}
.tv-scene .tv-body {
  animation: tv-bounce 0.36s ease-in-out infinite alternate;
}
.tv-truck.parked .tv-body {
  animation: tv-idle 0.12s ease-in-out infinite alternate;
}
.tv-puffs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tv-puff {
  position: absolute;
  top: 2%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(#5559, #5550 70%);
  animation: tv-puff 1.6s ease-out forwards;
}
@keyframes tv-puff {
  to {
    transform: translate(-60px, -70px) scale(4);
    opacity: 0;
  }
}
@keyframes tv-drive-in {
  from {
    transform: translate(calc(-50% - 100vw), -88%);
  }
}
@keyframes tv-drive-out {
  to {
    transform: translate(calc(-50% + 100vw), -88%);
  }
}
@keyframes tv-roll {
  to {
    transform: rotate(360deg);
  }
}
@keyframes tv-bounce {
  to {
    transform: translateY(-3px) rotate(-0.4deg);
  }
}
@keyframes tv-idle {
  to {
    transform: translateY(-0.8px);
  }
}
.tv-scene.calm .tv-truck,
.tv-scene.calm .tv-wheel,
.tv-scene.calm .tv-body {
  animation: none !important;
}
.tv-skip {
  position: absolute;
  right: 16px;
  top: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 0;
  background: #000a;
  color: #fff;
  cursor: pointer;
}

/* The chat. */
.tv-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1210;
  width: min(440px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--fh-surface, #fff);
  color: var(--fh-ink, #14291e);
  border: 1px solid var(--fh-line-strong, #0003);
  box-shadow: 0 24px 60px #0007;
  animation: tv-slide 0.4s ease-out;
}
@keyframes tv-slide {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
}
.tv-panel header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--fh-line, #0001);
}
.tv-face {
  position: relative;
  flex: 0 0 64px;
}
.tv-face img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--lime, #b5d334);
}
.tv-wave {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid var(--lime, #b5d334);
  opacity: 0;
}
.tv-panel.talking .tv-wave {
  animation: tv-wave 0.9s ease-out infinite;
}
@keyframes tv-wave {
  from {
    opacity: 0.8;
  }
  to {
    transform: scale(1.25);
    opacity: 0;
  }
}
.tv-who {
  flex: 1;
  display: grid;
  gap: 1px;
  min-width: 0;
}
.tv-who b {
  font-size: 1.08em;
}
.tv-who small {
  color: var(--fh-muted, #4c5d50);
}
.tv-ai {
  font-size: 0.78em;
}
.tv-icon {
  border: 0;
  background: transparent;
  font-size: 1.1em;
  cursor: pointer;
  color: inherit;
  padding: 6px;
}
.tv-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 120px;
}
.tv-msg {
  max-width: 92%;
  padding: 9px 12px;
  border-radius: 12px;
  line-height: 1.4;
}
.tv-msg p {
  margin: 0;
}
.tv-msg.me {
  justify-self: end;
  background: var(--fh-accent-soft, #b5d3342e);
}
.tv-msg.guest {
  background: var(--fh-surface-2, #f5f6f0);
  border: 1px solid var(--fh-line, #0001);
}
.tv-msg.thinking p {
  font-style: italic;
  color: var(--fh-muted, #4c5d50);
}
.tv-acts,
.tv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tv-chips {
  margin: 0;
  padding: 0 12px 8px;
}
.tv-act,
.tv-chips button {
  border: 1px solid var(--fh-line-strong, #0003);
  background: var(--fh-surface, #fff);
  color: inherit;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.86em;
  cursor: pointer;
}
.tv-chips button:hover,
.tv-act:hover {
  border-color: var(--fh-accent-ink, #6b5a00);
}
.tv-clip {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--fh-line-strong, #0003);
  background: var(--fh-surface, #fff);
  color: inherit;
  cursor: pointer;
}
.tv-clip span:last-child {
  display: grid;
  gap: 2px;
}
.tv-clip em {
  font-size: 0.86em;
  color: var(--fh-muted, #4c5d50);
}
.tv-clip small {
  color: var(--fh-muted, #4c5d50);
}
.tv-clip .tv-clip-gift {
  color: var(--fh-good, #1a6e33);
  font-weight: 600;
}
.tv-clip-play {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #c8102e;
  color: #fff;
}
.tv-form {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--fh-line, #0001);
}
.tv-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--fh-line-strong, #0003);
  background: var(--fh-input, #fff);
  color: inherit;
}
.tv-notes {
  padding: 0 12px;
  font-size: 0.88em;
}
.tv-notes:empty {
  display: none;
}
.tv-notes summary {
  cursor: pointer;
  padding: 4px 0;
}
.tv-notes ul {
  margin: 4px 0 8px;
  padding-left: 18px;
}
.tv-panel footer {
  padding: 4px 12px 10px;
  text-align: right;
}

/* He's on the farm: a badge with his face. */
.tv-badge-dock {
  position: fixed;
  left: 16px;
  bottom: 86px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Follow him: only on the 3D farm. */
.tv-follow {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 2px solid var(--lime, #b5d334);
  background: #14291ee6;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px #0005;
}
.tv-follow.on {
  background: var(--lime, #b5d334);
  color: #14291e;
}
body.playing:not(.farm-mode):not(.library-mode):not(.talent-mode) .tv-follow {
  display: inline-flex;
}
.tv-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  border: 2px solid var(--lime, #b5d334);
  background: var(--fh-surface, #fff);
  color: var(--fh-ink, #14291e);
  box-shadow: 0 8px 24px #0005;
  cursor: pointer;
  animation: tv-rise-badge 0.5s ease-out;
}
.tv-badge img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.tv-badge span {
  display: grid;
  text-align: left;
  line-height: 1.15;
}
.tv-badge small {
  color: var(--fh-muted, #4c5d50);
}
@keyframes tv-rise-badge {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
}
.tv-toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 1300;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 16px;
  border-radius: 10px;
  background: #14291e;
  color: #fff;
  box-shadow: 0 10px 30px #0006;
  transition: opacity 0.6s;
}
.tv-toast.out {
  opacity: 0;
}
@media (max-width: 700px) {
  .tv-panel {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-height: 78vh;
  }
  .tv-banner-art {
    display: none;
  }
  .tv-badge-dock {
    bottom: 120px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tv-scene *,
  .tv-panel,
  .tv-banner,
  .tv-badge-dock,
  .tv-badge {
    animation: none !important;
  }
}
:root[data-motion='calm'] .tv-scene *,
:root[data-motion='calm'] .tv-panel.talking .tv-wave {
  animation: none !important;
}

/* His countdown on the badge: a ring round a little clock that empties as the visit runs out. */
.tv-badge {
  position: relative;
}
.tv-clock {
  --tv-left: 1;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--lime, #b5d334) calc(var(--tv-left) * 360deg), #14291e26 0);
  -webkit-mask: radial-gradient(circle, transparent 6px, #000 7px);
  mask: radial-gradient(circle, transparent 6px, #000 7px);
}
.tv-badge-dock.soon .tv-badge {
  border-color: #e8a13a;
}
.tv-badge-dock.soon .tv-clock {
  background: conic-gradient(#e8a13a calc(var(--tv-left) * 360deg), #14291e26 0);
}
.tv-badge-dock.soon .tv-left {
  color: #b5651d;
  font-weight: 700;
}
/* "He heads home in about 10 minutes" */
.tv-leaving {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  z-index: 1250;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: min(460px, calc(100vw - 24px));
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #e8a13a;
  background: var(--fh-surface, #fff);
  color: var(--fh-ink, #14291e);
  box-shadow: 0 14px 40px #0006;
  transition: opacity 0.8s;
}
.tv-leaving.last {
  border-color: #d6452f;
}
.tv-leaving.out {
  opacity: 0;
}
.tv-leaving img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.tv-leaving b {
  display: block;
  font-size: 1.02rem;
}
.tv-leaving p {
  margin: 4px 0 10px;
  color: var(--fh-muted, #4c5d50);
  font-size: 0.9rem;
}
.tv-leaving-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tv-leaving-acts button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #14291e40;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tv-leaving-acts .primary {
  background: var(--lime, #b5d334);
  border-color: transparent;
  color: #14291e;
}
.tv-leaving-acts .text-button {
  border: 0;
  font-weight: 400;
  text-decoration: underline;
}
