/* City View: keep the towers and their animation without a dashed street line. */
@media (max-width: 900px) {
  .forest-stage[data-scene="nyc"] .chest-pathways .cp-street { display: none; }
}

/* Give the introduction a little more space on City View phones only. */
@media (max-width: 680px) {
  body.home-view[data-site-scene="nyc"] .forest-landing .personal-introduction {
    padding-block-start: 30px;
  }
}

/* In City View on phones, the chest spills fruit down to the foot of the towers. */
.city-fruit-extra { display: none; }
@media (max-width: 680px) and (prefers-reduced-motion: no-preference) {
  body.motion-enabled .forest-stage[data-scene="nyc"] .connections:not(.still) .discovery.is-revealed .city-fruit-ready .fly {
    animation: city-fruit-cascade var(--fruit-time, 1.1s) var(--fruit-delay, 0ms) linear both;
    pointer-events: none;
  }
  body.motion-enabled .forest-stage[data-scene="nyc"] .connections:not(.still) .discovery.is-revealed .city-fruit-ready .city-fruit-extra {
    display: block;
  }
  .forest-stage[data-scene="nyc"] .discovery.is-revealed > .revealed-label { z-index: 1; }
}
@keyframes city-fruit-cascade {
  0% { translate: 0 0; scale: .24; rotate: 0deg; opacity: 0; }
  9% { opacity: 1; }
  28% { translate: calc(var(--fruit-x) * .56) var(--fruit-rise); scale: 1; rotate: calc(var(--fruit-spin) * .33); opacity: 1; animation-timing-function: cubic-bezier(.42, .02, .82, .58); }
  91% { translate: var(--fruit-x) var(--city-fruit-drop); scale: .95; rotate: var(--fruit-spin); opacity: 1; }
  100% { translate: var(--fruit-x) calc(var(--city-fruit-drop) + 5px); scale: .83; rotate: var(--fruit-spin); opacity: 0; }
}

/* Desktop City View: three fruit palettes, with the same falling arc as the phone. */
.city-fruit-desktop-extra { display: none; }
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  body.motion-enabled .forest-stage[data-scene="nyc"] .connections:not(.still) .discovery.is-revealed .city-fruit-desktop-ready .fly:not(.city-fruit-extra) {
    --piece: var(--desk-fruit-size, 21px);
    --fruit: var(--desk-fruit);
    animation:
      city-fruit-desktop-arc var(--desk-fruit-time) var(--desk-fruit-delay) linear both,
      city-fruit-desktop-tumble var(--desk-fruit-time) var(--desk-fruit-delay) linear both;
    pointer-events: none;
  }
  body.motion-enabled .forest-stage[data-scene="nyc"] .connections:not(.still) .discovery.is-revealed .city-fruit-desktop-ready .city-fruit-desktop-extra {
    display: block;
  }
  .forest-stage[data-scene="nyc"] .discovery.is-revealed > .revealed-label { z-index: 1; }
}

@keyframes city-fruit-desktop-arc {
  0% { translate: var(--desk-arc-0); }
  10% { translate: var(--desk-arc-1); }
  20% { translate: var(--desk-arc-2); }
  30% { translate: var(--desk-arc-3); }
  40% { translate: var(--desk-arc-4); }
  50% { translate: var(--desk-arc-5); }
  60% { translate: var(--desk-arc-6); }
  70% { translate: var(--desk-arc-7); }
  80% { translate: var(--desk-arc-8); }
  90% { translate: var(--desk-arc-9); }
  100% { translate: var(--desk-arc-10); }
}
@keyframes city-fruit-desktop-tumble {
  0% { scale: .38; rotate: 0deg; opacity: 0; }
  10% { opacity: 1; }
  24% { scale: 1; }
  75% { opacity: 1; }
  100% { scale: .8; rotate: var(--desk-fruit-spin); opacity: 0; }
}

/* Phone Treetops: each chest gets its own jewel palette and silhouette of motion. */
@media (max-width: 680px) and (prefers-reduced-motion: no-preference) {
  .forest-stage[data-scene="treetop"] {
    --jewel-blue: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%232868ff%22%20stroke%3D%22%23bce8ff%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M2%208%207%203h10l5%205-10%2013Z%22/%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%23bce8ff%22%20stroke-width%3D%22.65%22%20stroke-linecap%3D%22round%22%20d%3D%22M2%208h20M7%203l1%205%204%2013%204-13%201-5%22/%3E%3C/svg%3E");
    --jewel-blue-spark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%2335c8ff%22%20stroke%3D%22%23e8f8ff%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M12%201%2014.7%209.3%2023%2012%2014.7%2014.7%2012%2023%209.3%2014.7%201%2012%209.3%209.3Z%22/%3E%3C/svg%3E");
    --jewel-violet: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23a348ff%22%20stroke%3D%22%23ead2ff%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M12%201.4%2015.1%208.1%2022.4%209%2017%2014.1%2018.5%2021.6%2012%2018%205.5%2021.6%207%2014.1%201.6%209%208.9%208.1Z%22/%3E%3C/svg%3E");
    --jewel-gold: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffcf16%22%20stroke%3D%22%23fff1ae%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M12%201.4%2015.1%208.1%2022.4%209%2017%2014.1%2018.5%2021.6%2012%2018%205.5%2021.6%207%2014.1%201.6%209%208.9%208.1Z%22/%3E%3C/svg%3E");
    --jewel-red: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ff234f%22%20stroke%3D%22%23ffd2db%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M12%2021%203.5%2012.7C-1%208.3%205.1%201.5%2010.1%205.7L12%207.3l1.9-1.6c5-4.2%2011.1%202.6%206.6%207Z%22/%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%23ffd2db%22%20stroke-width%3D%22.65%22%20stroke-linecap%3D%22round%22%20d%3D%22M5.5%209.4c.1-1%20.7-1.7%201.6-2%22/%3E%3C/svg%3E");
    --jewel-red-gem: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23eb1847%22%20stroke%3D%22%23ffabbf%22%20stroke-width%3D%221%22%20stroke-linejoin%3D%22round%22%20d%3D%22M12%202%2021%2012%2012%2022%203%2012Z%22/%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%23ffabbf%22%20stroke-width%3D%22.65%22%20stroke-linecap%3D%22round%22%20d%3D%22M3%2012h18M12%202l-3%2010%203%2010%203-10Z%22/%3E%3C/svg%3E");
  }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed .fly { animation: treetop-jewel-burst var(--jewel-time, 1.26s) calc(160ms + var(--delay, 0ms)) both; pointer-events: none; }
  /* Start the petals with the lid, keeping the original individual petal offsets. */
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) > .chest-pathways:not(.is-settled) .cp-petal {
    animation-delay: max(0ms, calc(var(--d, 1120ms) - 1120ms));
  }
  .forest-stage[data-scene="treetop"] .discovery.is-revealed > .revealed-label { z-index: 1; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly { --jewel-time: 1.20s; filter: drop-shadow(0 0 4px #4785ff); }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-1 { --shape: var(--jewel-blue); --piece: 19px; --dx: clamp(-22vw, 0px, 22vw); --dy: -111px; --jewel-end: -96px; --r: -8deg; --delay: 0ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-2 { --shape: var(--jewel-blue); --piece: 19px; --dx: clamp(-22vw, -26px, 22vw); --dy: -88px; --jewel-end: -76px; --r: -32deg; --delay: 19ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-3 { --shape: var(--jewel-blue-spark); --piece: 16px; --dx: clamp(-22vw, 31px, 22vw); --dy: -97px; --jewel-end: -82px; --r: 36deg; --delay: 38ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-4 { --shape: var(--jewel-blue); --piece: 19px; --dx: clamp(-22vw, -12px, 22vw); --dy: -132px; --jewel-end: -115px; --r: -18deg; --delay: 57ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-5 { --shape: var(--jewel-blue-spark); --piece: 16px; --dx: clamp(-22vw, 19px, 22vw); --dy: -118px; --jewel-end: -101px; --r: 25deg; --delay: 76ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="research"] .fly-6 { --shape: var(--jewel-blue); --piece: 19px; --dx: clamp(-22vw, 48px, 22vw); --dy: -73px; --jewel-end: -61px; --r: 46deg; --delay: 95ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly { --jewel-time: 1.18s; filter: drop-shadow(0 0 4px #9d44ff); }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-1 { --shape: var(--jewel-violet); --piece: 19px; --dx: clamp(-22vw, -86px, 22vw); --dy: -27px; --jewel-end: -16px; --r: -38deg; --delay: 0ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-2 { --shape: var(--jewel-gold); --piece: 16px; --dx: clamp(-22vw, 78px, 22vw); --dy: -23px; --jewel-end: -10px; --r: 32deg; --delay: 19ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-3 { --shape: var(--jewel-violet); --piece: 19px; --dx: clamp(-22vw, -73px, 22vw); --dy: -48px; --jewel-end: -32px; --r: -25deg; --delay: 38ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-4 { --shape: var(--jewel-violet); --piece: 19px; --dx: clamp(-22vw, 93px, 22vw); --dy: -42px; --jewel-end: -28px; --r: 39deg; --delay: 57ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-5 { --shape: var(--jewel-gold); --piece: 16px; --dx: clamp(-22vw, -51px, 22vw); --dy: -62px; --jewel-end: -49px; --r: -20deg; --delay: 76ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="practice"] .fly-6 { --shape: var(--jewel-gold); --piece: 16px; --dx: clamp(-22vw, 58px, 22vw); --dy: -53px; --jewel-end: -39px; --r: 26deg; --delay: 95ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly { --jewel-time: 1.28s; filter: drop-shadow(0 0 4px #ff345b); }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-1 { --shape: var(--jewel-red); --piece: 19px; --dx: clamp(-22vw, -48px, 22vw); --dy: -22px; --jewel-end: 44px; --r: -28deg; --delay: 0ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-2 { --shape: var(--jewel-red); --piece: 19px; --dx: clamp(-22vw, 55px, 22vw); --dy: -17px; --jewel-end: 40px; --r: 38deg; --delay: 19ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-3 { --shape: var(--jewel-red-gem); --piece: 16px; --dx: clamp(-22vw, -66px, 22vw); --dy: -8px; --jewel-end: 48px; --r: -46deg; --delay: 38ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-4 { --shape: var(--jewel-red); --piece: 19px; --dx: clamp(-22vw, 71px, 22vw); --dy: -26px; --jewel-end: 33px; --r: 47deg; --delay: 57ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-5 { --shape: var(--jewel-red); --piece: 19px; --dx: clamp(-22vw, -33px, 22vw); --dy: -14px; --jewel-end: 30px; --r: -22deg; --delay: 76ms; }
  body.motion-enabled .forest-stage[data-scene="treetop"] .connections:not(.still) .discovery.is-revealed[data-place="books"] .fly-6 { --shape: var(--jewel-red-gem); --piece: 16px; --dx: clamp(-22vw, 37px, 22vw); --dy: -25px; --jewel-end: 49px; --r: 35deg; --delay: 95ms; }
}
@keyframes treetop-jewel-burst {
  0% { translate: 0 0; scale: .22; rotate: 0deg; opacity: 0; animation-timing-function: cubic-bezier(.12, .8, .3, 1); }
  38% { translate: calc(var(--dx) * .83) var(--dy); scale: 1.1; rotate: var(--r); opacity: 1; }
  85% { translate: var(--dx) var(--jewel-end); scale: .94; rotate: var(--r); opacity: .95; }
  100% { translate: var(--dx) calc(var(--jewel-end) + 4px); scale: .72; rotate: var(--r); opacity: 0; }
}

/* Phone home: the upper stops clear the name strip, without moving Books or the introduction. */
@media (max-width: 680px) {
  body.home-view .forest-stage:is([data-scene="nyc"], [data-scene="treetop"]) .discovery-research {
    margin-block-start: 28px;
  }
  body.home-view .forest-stage:is([data-scene="nyc"], [data-scene="treetop"]) .discovery-practice {
    margin-block-start: 12px;
  }
}

/* Desktop Treetops: cool Research, warm Practice, and mixed Books. */
@media (min-width: 901px) {
  .forest-stage[data-scene="treetop"] .connections {
    --cw-cool-1: #368dff; --cw-cool-2: #37efde; --cw-cool-3: #5488ff; --cw-cool-4: #8cdbff;
    --cw-warm-1: #ffce46; --cw-warm-2: #ff8838; --cw-warm-3: #ff5e59; --cw-warm-4: #ffe3a0;
    --cw-mixed-1: #a16bff; --cw-mixed-2: #ff609c; --cw-mixed-3: #ffc857; --cw-mixed-4: #6c9aff;
  }
  .forest-stage[data-scene="treetop"] .connections[data-selected="research"] .cw-show,
  .forest-stage[data-scene="treetop"] .connections.still .cw-show > .cw-ring:nth-child(1 of .cw-ring) {
    --cw-1: var(--cw-cool-1); --cw-2: var(--cw-cool-2);
    --cw-3: var(--cw-cool-3); --cw-4: var(--cw-cool-4);
  }
  .forest-stage[data-scene="treetop"] .connections[data-selected="practice"] .cw-show,
  .forest-stage[data-scene="treetop"] .connections.still .cw-show > .cw-ring:nth-child(2 of .cw-ring) {
    --cw-1: var(--cw-warm-1); --cw-2: var(--cw-warm-2);
    --cw-3: var(--cw-warm-3); --cw-4: var(--cw-warm-4);
  }
  .forest-stage[data-scene="treetop"] .connections[data-selected="books"] .cw-show,
  .forest-stage[data-scene="treetop"] .connections.still .cw-show > .cw-ring:nth-child(3 of .cw-ring) {
    --cw-1: var(--cw-mixed-1); --cw-2: var(--cw-mixed-2);
    --cw-3: var(--cw-mixed-3); --cw-4: var(--cw-mixed-4);
  }
  .forest-stage[data-scene="treetop"] .cw-stream:nth-child(1 of .cw-stream),
  .forest-stage[data-scene="treetop"] .cw-ring > .cw-flow:nth-child(4n+1) { --cw-tone: var(--cw-1); }
  .forest-stage[data-scene="treetop"] .cw-stream:nth-child(2 of .cw-stream),
  .forest-stage[data-scene="treetop"] .cw-ring > .cw-flow:nth-child(4n+2) { --cw-tone: var(--cw-2); }
  .forest-stage[data-scene="treetop"] .cw-stream:nth-child(3 of .cw-stream),
  .forest-stage[data-scene="treetop"] .cw-ring > .cw-flow:nth-child(4n+3) { --cw-tone: var(--cw-3); }
  .forest-stage[data-scene="treetop"] .cw-stream:nth-child(4 of .cw-stream),
  .forest-stage[data-scene="treetop"] .cw-ring > .cw-flow:nth-child(4n+4) { --cw-tone: var(--cw-4); }
  .forest-stage[data-scene="treetop"] .cw-stream {
    filter: drop-shadow(0 0 4px var(--cw-tone, var(--c))) drop-shadow(0 0 12px var(--cw-tone, var(--c)));
  }
  .forest-stage[data-scene="treetop"] .cw-show .cw-flow {
    fill: color-mix(in srgb, var(--cw-tone) 70%, white);
  }
  .forest-stage[data-scene="treetop"] .cw-ring > .cw-flow {
    filter: drop-shadow(0 0 3px var(--cw-tone)) drop-shadow(0 0 7px var(--cw-tone)) !important;
  }
}

/* More breathing room above the desktop City View and Treetops introduction. */
@media (min-width: 901px) {
  body.home-view:is([data-site-scene="nyc"], [data-site-scene="treetop"]) .landscape-introduction-host {
    padding-top: 16px;
  }
}
