/* Your Pea lives at your place: Pea opens its home folder with its key, what it knows tucks
   inside, chats go out to the owner's AI app and come back, and last our box turns up, empty.
   Desktop lays out left to right; under 600px the frame stacks (container query). */

.anim-yourplace .yp-frame { container: yp / inline-size; margin-top: 40px; }
.anim-yourplace .yp-stage { position: relative; aspect-ratio: 9 / 4; overflow: hidden;
  background: radial-gradient(ellipse 34% 54% at 48% 58%, rgba(199, 222, 168, .55), rgba(199, 222, 168, 0) 70%), linear-gradient(180deg, var(--card), #f6f8f1); }

/* ---------- ground ---------- */
.anim-yourplace .yp-ground { position: absolute; left: 24%; width: 44%; top: 77.4%; height: 5.4%; border-radius: 50%; background: radial-gradient(closest-side, rgba(34, 56, 26, .17), rgba(34, 56, 26, 0)); }

/* ---------- the home folder ---------- */
.anim-yourplace .yp-home { position: absolute; z-index: 2; left: 36.5%; width: 27.5%; bottom: 20%; transform-origin: 50% 100%; }
.anim-yourplace .yp-house { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 14px 16px rgba(34, 56, 26, .14)); }
.anim-yourplace .yp-h-back { fill: color-mix(in srgb, var(--brass) 24%, var(--brass-soft)); stroke: color-mix(in srgb, var(--brass) 42%, var(--brass-soft)); stroke-width: 2; }
.anim-yourplace .yp-h-chim { fill: color-mix(in srgb, var(--brass) 36%, var(--brass-soft)); stroke: color-mix(in srgb, var(--brass) 52%, var(--brass-soft)); stroke-width: 2; }
.anim-yourplace .yp-h-puff { fill: var(--paper-2); stroke: var(--line); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; transform: translateY(10px) scale(.5); transition: opacity .7s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.anim-yourplace .yp-h-puff--2 { transition-delay: .35s; }
.anim-yourplace .yp-h-puff--3 { transition-delay: .7s; }
.anim-yourplace.is-lit .yp-h-puff { opacity: .95; transform: none; }
.anim-yourplace .yp-h-tab { font: 800 15px var(--display); letter-spacing: -.02em; fill: var(--brass); }
.anim-yourplace .yp-h-paper { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.anim-yourplace .yp-h-paper--2 { fill: #fff; }
.anim-yourplace .yp-h-front { fill: var(--brass-soft); stroke: color-mix(in srgb, var(--brass) 42%, var(--brass-soft)); stroke-width: 2; }
.anim-yourplace .yp-h-winlight { fill: var(--card); transition: fill .6s ease; }
.anim-yourplace .yp-h-winframe { fill: none; stroke: color-mix(in srgb, var(--brass) 55%, var(--brass-soft)); stroke-width: 4; }
.anim-yourplace .yp-h-winbars { fill: none; stroke: color-mix(in srgb, var(--brass) 55%, var(--brass-soft)); stroke-width: 3; }
.anim-yourplace .yp-h-doorway { fill: var(--band-2); }
.anim-yourplace .yp-h-glow { opacity: 0; transition: opacity .5s ease; }
.anim-yourplace .yp-door { transform-box: fill-box; transform-origin: 100% 50%; transition: transform .55s cubic-bezier(.2, .7, .2, 1); }
.anim-yourplace .yp-door__leaf { fill: var(--pea); }
.anim-yourplace .yp-door__panel { fill: none; stroke: var(--pea-hi); stroke-width: 2.5; }
.anim-yourplace .yp-door__knob { fill: #e2c891; stroke: var(--brass); stroke-width: 1.5; }
.anim-yourplace .yp-door__hole { fill: var(--band); }
.anim-yourplace .yp-h-mat { fill: color-mix(in srgb, var(--brass) 45%, var(--brass-soft)); }
.anim-yourplace .yp-home__tag { position: absolute; left: 50%; top: calc(100% + 12px); translate: -50% 0; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font: 700 clamp(11.5px, 1.25cqw, 13.5px)/1 var(--body); color: var(--muted); white-space: nowrap; }
.anim-yourplace .yp-home__tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pea-hi); }
.anim-yourplace .yp-spark { position: absolute; left: 28%; top: 90.8%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 2.5px solid #e2c891; box-shadow: 0 0 0 4px rgba(226, 200, 145, .35); opacity: 0; pointer-events: none; }

/* open door, lit window */
.anim-yourplace.is-open .yp-door { transform: scaleX(.12); }
.anim-yourplace.is-open .yp-h-glow { opacity: .75; }
.anim-yourplace.is-lit .yp-h-winlight { fill: var(--pea-glow); }

/* ---------- Pea ---------- */
.anim-yourplace .yp-pea { position: absolute; z-index: 3; left: 22%; bottom: 19.6%; height: 50%; aspect-ratio: 556 / 820; transform-origin: 50% 100%; }
.anim-yourplace .yp-pose { position: absolute; left: 50%; bottom: 0; translate: -50% 0; width: auto; max-width: none; height: 100%; opacity: 0; filter: drop-shadow(0 12px 12px rgba(34, 56, 26, .2)); }
.anim-yourplace .yp-pose.is-on { opacity: 1; }

/* ---------- what Pea knows ---------- */
.anim-yourplace .yp-item { position: absolute; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px 7px 7px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 14px 26px -16px rgba(34, 56, 26, .55); font: 700 clamp(11px, 1.5cqw, 16px)/1 var(--body); color: var(--ink); white-space: nowrap; }
.anim-yourplace .yp-item i { display: grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 9px; background: var(--pea-soft); color: var(--pea); }
.anim-yourplace .yp-item svg { width: 1.05em; height: 1.05em; }
/* one loose, tilted row above Pea and the home, spaced so no two touch at any width
   from 601px up (rows at least 8% from the top, the book at 6%) */
.anim-yourplace .yp-item--a { left: 13%; top: 11.5%; rotate: -4deg; }
.anim-yourplace .yp-item--b { left: 28.5%; top: 8%; rotate: 2deg; }
.anim-yourplace .yp-item--c { left: 47.5%; top: 12.5%; rotate: -2deg; }
.anim-yourplace .yp-item--d { left: 69%; top: 8.5%; rotate: 3deg; }
.anim-yourplace .yp-item--book { left: 84%; top: 6%; padding: 0; border: 0; background: none; box-shadow: none; rotate: 8deg; }
.anim-yourplace .yp-item--book svg { width: clamp(30px, 4.2cqw, 46px); height: auto; filter: drop-shadow(0 10px 10px rgba(34, 56, 26, .3)); }
.anim-yourplace .yp-book__cover { fill: var(--band-2); }
.anim-yourplace .yp-book__spine { fill: var(--band); }
.anim-yourplace .yp-book__band { fill: var(--pea-hi); }
.anim-yourplace .yp-book__label { fill: var(--pea-glow); }

/* ---------- the line to the AI app ---------- */
.anim-yourplace .yp-line { position: absolute; z-index: 4; left: 64.3%; width: 10.1%; top: 56.6%; height: 0; }
.anim-yourplace .yp-line__track { position: absolute; left: 0; right: 0; top: -1.5px; height: 3px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--pea-glow) 0 8px, transparent 8px 14px); transform-origin: 0 50%; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.anim-yourplace .yp-bub { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; gap: 4px; width: 46px; height: 30px; margin: -15px 0 0 -23px; border-radius: 15px 15px 15px 5px; background: #d9ecc4; box-shadow: 0 12px 20px -10px rgba(34, 56, 26, .55); opacity: 0; }
.anim-yourplace .yp-bub--back { left: 100%; top: 100%; background: #fff; border: 1.5px solid var(--pea-glow); border-radius: 15px 15px 5px 15px; }
.anim-yourplace .yp-bub b, .anim-yourplace .yp-app__think b { width: 6px; height: 6px; border-radius: 50%; background: var(--pea); }
.anim-yourplace .yp-bub--back b { background: var(--pea-hi); }

/* ---------- Your AI app ---------- */
.anim-yourplace .yp-app { position: absolute; z-index: 3; left: 74.6%; top: 33.5%; width: 22.4%; height: 46%; display: grid; align-content: center; justify-items: center; gap: clamp(8px, 1.2cqw, 14px); padding: 12px; border-radius: 22px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--shadow); text-align: center; transition: opacity .45s ease, transform .55s cubic-bezier(.3, 1.5, .5, 1), border-color .4s ease; }
.anim-yourplace .yp-app__label { font: 800 clamp(16px, 2.15cqw, 23px)/1.05 var(--display); letter-spacing: -.03em; color: var(--ink); }
.anim-yourplace .yp-app__tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.anim-yourplace .yp-app__tags b { padding: 5px 10px; border-radius: 999px; background: var(--paper-2); font: 700 clamp(11.5px, 1.3cqw, 14px)/1 var(--body); color: var(--ink); }
.anim-yourplace .yp-app__ico { display: grid; place-items: center; width: clamp(34px, 4.4cqw, 46px); height: clamp(34px, 4.4cqw, 46px); border-radius: 14px; background: var(--pea-soft); color: var(--pea); }
.anim-yourplace .yp-app__ico svg { width: 55%; height: 55%; }
.anim-yourplace .yp-app__think { position: absolute; left: 0; right: 0; bottom: 9%; display: flex; justify-content: center; gap: 5px; height: 8px; opacity: 0; transition: opacity .3s ease; }
.anim-yourplace.is-think .yp-app { border-color: var(--pea-glow); }
.anim-yourplace.is-think .yp-app__think { opacity: 1; }
.anim-yourplace.is-think .yp-app__think b { animation: yourplace-dot .9s ease-in-out infinite; }
.anim-yourplace .yp-app__think b:nth-child(2) { animation-delay: .15s; }
.anim-yourplace .yp-app__think b:nth-child(3) { animation-delay: .3s; }
@keyframes yourplace-dot { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-4px); opacity: 1; } }

/* ---------- Us ---------- */
.anim-yourplace .yp-us { position: absolute; z-index: 2; left: 3%; top: 36.6%; width: 15%; height: 40%; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding: 12px 12px 12px; border-radius: 20px; border: 2px dashed var(--line); background: rgba(232, 236, 223, .45); transition: border-color .5s ease, background-color .5s ease; }
.anim-yourplace .yp-us__label { font: 800 clamp(15px, 1.9cqw, 21px)/1 var(--display); letter-spacing: -.02em; color: var(--muted); }
.anim-yourplace .yp-us__empty { border-radius: 12px; background-image: radial-gradient(rgba(86, 96, 79, .22) 1.2px, transparent 1.6px); background-size: 12px 12px; }
.anim-yourplace .yp-us__note { font: 700 clamp(11.5px, 1.35cqw, 14.5px)/1.2 var(--body); color: var(--pea); transition: opacity .5s ease; }
.anim-yourplace.is-us .yp-us { border-color: var(--pea-glow); background-color: rgba(223, 232, 211, .55); }
.anim-yourplace .yp-us__note::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--pea-hi); vertical-align: .12em; }

/* ---------- caption ---------- */
.anim-yourplace .yp-cap { min-height: 1.3em; padding: 16px 20px 22px; border-top: 1px solid var(--line); text-align: center; font: 800 clamp(19px, 2.4cqw, 27px)/1.2 var(--display); letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }

/* ---------- start state (only once the script is running) ---------- */
.anim-yourplace.yp-ready .yp-pea { opacity: 0; }
.anim-yourplace.yp-ready.is-pea .yp-pea { opacity: 1; }
.anim-yourplace.yp-ready .yp-item { opacity: 0; }
.anim-yourplace.yp-ready .yp-line__track { transform: scaleX(0); }
.anim-yourplace.yp-ready.is-line .yp-line__track { transform: none; }
.anim-yourplace.yp-ready .yp-app { opacity: 0; transform: scale(.9); }
.anim-yourplace.yp-ready.is-app .yp-app { opacity: 1; transform: none; }
.anim-yourplace.yp-ready .yp-us { opacity: 0; transform: scale(.7); transition: opacity .35s ease, transform .55s cubic-bezier(.3, 1.5, .5, 1), border-color .5s ease, background-color .5s ease; }
.anim-yourplace.yp-ready.is-us .yp-us { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .anim-yourplace.yp-ready .yp-us { transform: scale(.94); } .anim-yourplace.yp-ready.is-us .yp-us { transform: none; } }
/* the control row shows from the first frame (the sound button, centred on its own while it
   plays); Watch again joins it at the end. The row keeps its height the whole time */
.anim-yourplace .anim-ctl { min-height: 44px; align-items: center; }
.anim-yourplace.yp-ready .yp-again { display: none; }
.anim-yourplace.yp-ready.yp-done .yp-again { display: inline-flex; animation: yourplace-in .4s ease both; }
@keyframes yourplace-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- phones and narrow frames: stack it ---------- */
@container yp (max-width: 600px) {
  .anim-yourplace .yp-stage { aspect-ratio: 16 / 23.5; background: radial-gradient(ellipse 60% 30% at 55% 36%, rgba(199, 222, 168, .55), rgba(199, 222, 168, 0) 70%), linear-gradient(180deg, var(--card), #f6f8f1); }
  .anim-yourplace .yp-ground { left: 10%; width: 82%; top: 49.6%; height: 4%; }
  .anim-yourplace .yp-home { left: 31%; width: 62%; bottom: 48%; }
  .anim-yourplace .yp-home__tag { top: calc(100% + 9px); left: 38%; }
  .anim-yourplace .yp-pea { left: 7.5%; bottom: 47.6%; height: 26.5%; }
  .anim-yourplace .yp-item { padding: 6px 10px 6px 6px; gap: 6px; border-radius: 12px; font-size: 12.5px; }
  .anim-yourplace .yp-item--a { left: 4%; top: 5.5%; }
  .anim-yourplace .yp-item--b { left: 31%; top: 3%; }
  .anim-yourplace .yp-item--c { left: 3%; top: 13.2%; }
  .anim-yourplace .yp-item--d { left: 60%; top: 11.2%; }
  .anim-yourplace .yp-item--book { left: 79%; top: 3%; }
  .anim-yourplace .yp-item--book svg { width: 32px; }
  .anim-yourplace .yp-line { left: 80%; width: 0; top: 52.6%; height: 11%; }
  .anim-yourplace .yp-line__track { left: -1.5px; right: auto; top: 0; bottom: 0; width: 3px; height: auto; background: repeating-linear-gradient(180deg, var(--pea-glow) 0 8px, transparent 8px 14px); transform-origin: 50% 0; }
  .anim-yourplace.yp-ready .yp-line__track { transform: scaleY(0); }
  .anim-yourplace .yp-app { left: 51%; top: 63.6%; width: 46%; height: 27%; padding: 10px; border-radius: 18px; gap: 8px; }
  .anim-yourplace .yp-app__label { font-size: 17px; }
  .anim-yourplace .yp-app__tags b { font-size: 12px; padding: 4px 8px; }
  .anim-yourplace .yp-us { left: 3%; top: 63.6%; width: 44%; height: 27%; padding: 10px; border-radius: 18px; }
  .anim-yourplace .yp-us__label { font-size: 17px; }
  .anim-yourplace .yp-us__note { font-size: 12.5px; }
  /* room for two lines (box-sizing is border-box, so the padding counts), so a one-line caption never makes the frame jump */
  .anim-yourplace .yp-cap { padding: 14px 16px 18px; min-height: calc(2.4em + 34px); font-size: 20px; }

  /* the Us and Your AI app row waits as a faint dashed outline from the start, so the
     bottom of the frame is never blank, and fills in on its beat */
  .anim-yourplace.yp-ready .yp-app, .anim-yourplace.yp-ready .yp-us { opacity: .35; transform: none; border: 2px dashed var(--line); background: transparent; box-shadow: none; }
  .anim-yourplace.yp-ready .yp-app > :not(.yp-app__think), .anim-yourplace.yp-ready .yp-us > * { opacity: 0; transition: opacity .45s ease .15s; }
  .anim-yourplace.yp-ready.is-app .yp-app { opacity: 1; border: 1.5px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
  .anim-yourplace.yp-ready.is-us .yp-us { opacity: 1; border: 2px dashed var(--pea-glow); background-color: rgba(223, 232, 211, .55); }
  .anim-yourplace.yp-ready.is-app .yp-app > :not(.yp-app__think), .anim-yourplace.yp-ready.is-us .yp-us > * { opacity: 1; }
  .anim-yourplace.yp-ready.is-think .yp-app { border-color: var(--pea-glow); }
}
