/* chest-pathways.css · goes with chest-pathways.js (see README.md)
   Phones and small tablets (900px and below), City View and Treetops home scenes. */

@media (max-width: 900px) {
  /* The new art replaces the plain loop while the script is running. */
  .connections.has-chest-pathways > .journey-trail > .trail-leg { display: none; }
}

.connections > svg.chest-pathways {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1; /* above the old trail, under the chests (3) and the ghost */
}
@media (min-width: 901px) {
  .connections > svg.chest-pathways { display: none; }
}

/* ---------- City View: blueprints, then a tower rises ---------- */

.chest-pathways .cp-blueprint {
  fill: none;
  stroke: #fff1c4;
  stroke-width: 1.1;
  stroke-dasharray: 3 3.5;
  stroke-linejoin: round;
  opacity: .42;
  animation: cp-show .6s ease-out both;
}
.chest-pathways .cp-blueprint.is-leaving {
  opacity: 0;
  animation: cp-leave .7s ease-out both;
}
.chest-pathways .cp-street {
  fill: none;
  stroke: #fff1c4;
  stroke-width: 1.2;
  stroke-dasharray: 14 6;
  opacity: .7;
  filter: drop-shadow(0 0 2px #ffe09b);
  animation: cp-show .45s ease-out both;
}
.chest-pathways .cp-rise { animation: cp-rise .85s cubic-bezier(.2, .85, .25, 1) both; }
.chest-pathways .cp-body { fill: rgba(16, 18, 26, .5); stroke: none; }
.chest-pathways .cp-halo {
  fill: none;
  stroke: #ffdb83;
  stroke-width: 5;
  stroke-linejoin: round;
  opacity: .4;
  filter: blur(3px);
}
.chest-pathways .cp-line {
  fill: none;
  stroke: #fff1c4;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px #ffe09b);
}
.chest-pathways .cp-line.cp-thin { stroke-width: 1.2; }
.chest-pathways .cp-windows { filter: drop-shadow(0 0 2px rgba(250, 202, 87, .9)); }
.chest-pathways .cp-window {
  fill: #ffe6a0;
  animation: cp-show .3s var(--d, 0ms) ease-out both; /* floor by floor, bottom to top */
}
.chest-pathways .cp-crown {
  filter: drop-shadow(0 0 4px var(--glow));
  animation: cp-show .7s 1.35s ease-out both;
}
.chest-pathways .cp-fin { fill: none; stroke-width: 1.1; stroke-linecap: round; }
.chest-pathways .cp-crown-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chest-pathways .cp-beacon {
  fill: #ff7b7b;
  filter: drop-shadow(0 0 3px #ff6b6b);
  animation: cp-blink 2.4s var(--d, 1.7s) ease-in-out infinite both;
}

/* ---------- Treetops: sprouts, then vines grow to the chest ---------- */

.chest-pathways .cp-sprout { animation: cp-show .6s ease-out both; }
.chest-pathways .cp-sprout-stem { fill: none; stroke: #f4f1d0; stroke-width: 1.2; stroke-linecap: round; opacity: .85; }
.chest-pathways .cp-sprout-leaf { fill: rgba(210, 244, 196, .85); stroke: #f4f1d0; stroke-width: .5; }
.chest-pathways .cp-vine { filter: drop-shadow(0 0 2.5px var(--glow)); }
.chest-pathways .cp-stem {
  fill: none;
  stroke: #f4f1d0;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: var(--len) var(--len);
  animation: cp-grow 1.2s linear both; /* same length as GROW in the script */
}
.chest-pathways .cp-leaf {
  fill: rgba(210, 244, 196, .92);
  stroke: #f4f1d0;
  stroke-width: .6;
  animation: cp-leaf .45s var(--d, 0ms) cubic-bezier(.3, 1.6, .5, 1) both;
}
.chest-pathways .cp-tendril {
  fill: none;
  stroke: #f4f1d0;
  stroke-width: .9;
  stroke-linecap: round;
  opacity: .85;
  stroke-dasharray: var(--len) var(--len);
  animation: cp-grow .45s var(--d, 0ms) ease-out both;
}
/* Flowers: the colours are set on each petal in the script. */
.chest-pathways .cp-blossom { filter: drop-shadow(0 0 6px var(--glow)); }
.chest-pathways .cp-petal {
  stroke-width: .7;
  animation: cp-bloom .55s var(--d, 0ms) cubic-bezier(.3, 1.5, .5, 1) both;
}

/* ---------- no motion: show the finished picture ---------- */

.chest-pathways.is-settled *:not(.cp-beacon),
.connections.still .chest-pathways *,
body.motion-paused .chest-pathways * { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .chest-pathways * { animation: none !important; }
}

@keyframes cp-show { from { opacity: 0; } }
@keyframes cp-leave { from { opacity: .42; } to { opacity: 0; } }
@keyframes cp-rise { from { transform: translateY(var(--rise, 300px)); } to { transform: translateY(0); } }
@keyframes cp-blink { 0%, 100% { opacity: .2; } 10%, 28% { opacity: 1; } }
@keyframes cp-grow { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes cp-leaf {
  from { transform: scale(0) rotate(-28deg); opacity: 0; }
  40% { opacity: 1; }
  to { transform: none; opacity: 1; }
}
@keyframes cp-bloom {
  from { transform: scale(0) rotate(-40deg); opacity: 0; }
  50% { opacity: 1; }
  to { transform: none; opacity: 1; }
}
