/* The rooftop room's stages and the launch ribbon (barsati.js). Shapes reuse art.css classes where they can;
   the new colours below have day and night values. */

:root,
html[data-scene="day"] {
  --bs-plinth: #a29d95;
  --bs-slab: #b3aea5;
  --bs-plaster: #ddd0ba;
  --bs-paint: #eeb68f;
  --bs-paint-dk: #d6966d;
  --bs-trim: #f5efe4;
  --bs-glass: #a9cde3;
  --bs-curtain: #c96f5a;
  --bs-inside: #ffe3a6;
  --bs-mud: #8f8a84;
  --bs-barrow: #2f7d6a;
  --bs-iron: #3d4250;
  --bs-bamboo: #b8935a;
}
html[data-scene="night"] {
  --bs-plinth: #77726b;
  --bs-slab: #86827b;
  --bs-plaster: #aa9a82;
  --bs-paint: #b97f60;
  --bs-paint-dk: #9c6649;
  --bs-trim: #cfc5b4;
  --bs-glass: #ffd27a;
  --bs-curtain: #b4553f;
  --bs-inside: #ffc96a;
  --bs-mud: #6e6a65;
  --bs-barrow: #276656;
  --bs-iron: #2a2e3a;
  --bs-bamboo: #9a7a4a;
}

/* Fills */
.bs-plinth { fill: var(--bs-plinth); }
.bs-slab { fill: var(--bs-slab); }
.bs-plaster { fill: var(--bs-plaster); }
.bs-paint { fill: var(--bs-paint); }
.bs-paint-dk { fill: var(--bs-paint-dk); }
.bs-trim { fill: var(--bs-trim); }
.bs-door { fill: var(--door); }
.bs-glass { fill: var(--bs-glass); }
.bs-curtain { fill: var(--bs-curtain); }
.bs-inside { fill: var(--bs-inside); }
.bs-inside-floor { fill: rgba(120, 60, 20, 0.25); }
.bs-shadow { fill: rgba(0, 0, 0, 0.12); }
.bs-wet { fill: rgba(255, 255, 255, 0.2); }
.bs-mud { fill: var(--bs-mud); }
.bs-barrow { fill: var(--bs-barrow); }
.bs-pan { fill: #5d6170; }
.bs-bucket { fill: #e2a03f; }
.bs-float { fill: #b9bec6; }
.bs-roller { fill: #f6e7d0; }
.bs-step { fill: var(--bs-plinth); }
.bs-sack-band { fill: #c0392b; opacity: 0.75; }
.bs-loose { stroke: var(--mortar); stroke-width: 0.5; }
.bs-mari { fill: #f59e0b; }
.bs-mari2 { fill: #f97316; }
.bs-ribbon-f { fill: #d62839; }
.bs-ribbon-k { fill: #a51d2c; }
.bs-new { fill: #ffd23f; stroke: #e85d04; stroke-width: 1; stroke-linejoin: round; }
.bs-blade { fill: #dfe3e8; stroke: #7d838d; stroke-width: 0.4; stroke-linejoin: round; }
.bs-sign-sm, .bs-new-txt { font: 700 7px "Work Sans", system-ui, sans-serif; fill: #b5121b; }
.bs-new-txt { font-size: 8px; }

/* Strokes */
.bs-bamboo, .bs-node, .bs-stake, .bs-string, .bs-rebar, .bs-frame, .bs-iron, .bs-grille, .bs-ribbon, .bs-handle, .bs-brim,
.bs-slab-line, .bs-plinth-top, .bs-panel, .bs-board-edge, .bs-bristle, .bs-shovel, .bs-pole, .bs-thread {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.bs-bamboo { stroke: var(--bs-bamboo); stroke-width: 2.2; }
.bs-node { stroke: rgba(0, 0, 0, 0.3); stroke-width: 0.9; }
.bs-stake { stroke: var(--wood2); stroke-width: 1.6; }
.bs-string { stroke: #f3ece0; stroke-width: 0.5; }
.bs-rebar { stroke: #7a4e3a; stroke-width: 1.1; }
.bs-frame { stroke: var(--wood); stroke-width: 2.2; }
.bs-iron { stroke: var(--bs-iron); stroke-width: 1.3; }
.bs-grille { stroke: #3a2a31; stroke-width: 0.8; }
.bs-brim { stroke: #d9a91c; stroke-width: 1; }
.bs-slab-line { stroke: rgba(0, 0, 0, 0.15); stroke-width: 0.8; }
.bs-plinth-top { stroke: rgba(255, 255, 255, 0.35); stroke-width: 0.8; }
.bs-panel { stroke: rgba(0, 0, 0, 0.25); stroke-width: 0.7; }
.bs-board-edge { stroke: #c0392b; stroke-width: 0.9; }
.bs-bristle { stroke: #f4ead6; stroke-width: 1.8; stroke-linecap: butt; }
.bs-shovel { stroke: var(--wood); stroke-width: 1.4; }
.bs-pole { stroke: var(--wood2); stroke-width: 1.2; }
.bs-thread { stroke: #4c8748; stroke-width: 0.6; }
.bs-ribbon { stroke: #d62839; stroke-width: 2.4; stroke-linecap: butt; }
.bs-ribbon.thin { stroke-width: 1.5; }
.bs-handle { stroke: #d62839; stroke-width: 1.4; }

/* Night: lit windows glow */
html[data-scene="night"] .barsati .bs-glass,
html[data-scene="night"] .barsati .bs-inside { filter: drop-shadow(0 0 3px #ffcf7a); }

/* ---------- The ribbon. The cut pose is static (also for reduced motion and return visits). ---------- */
.bs .bs-rib-l, .bs .bs-rib-r, .bs .bs-bow, .bs .bs-leaf, .bs .bs-sc-a, .bs .bs-sc-b { transform-box: view-box; }
.bs .bs-scissors { opacity: 0; }
.bs.cutting .bs-scissors { opacity: 1; }
.bs.cut .bs-rib-l { transform: rotate(78deg); }
.bs.cut .bs-rib-r { transform: rotate(-78deg); }
.bs.cut .bs-bow { transform: translate(1px, 16px) rotate(28deg); }
.bs.cut .bs-leaf { transform: scaleX(0.18); }
.bs.cut .bs-glass { fill: var(--bs-inside); }
.barsati .bs.cut .bs-glass, .barsati .bs.cut .bs-inside { filter: drop-shadow(0 0 3px #ffcf7a); }

/* The new project's window on the building, after the ribbon is cut. */
.win-wrap.bs-new-win { z-index: 2; box-shadow: 0 0 0 4px #ffd36b, 0 0 28px 10px rgba(255, 196, 90, 0.7); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .bs .bs-plaster-arm, .bs .bs-brush, .bs .bs-new-g, .bs .bs-tails { transform-box: view-box; }

  /* Builders at work. (The trowel and the swinging work lamp come from art.css.) */
  .bs .bs-plaster-arm { animation: bs-plaster 1.1s ease-in-out infinite alternate; }
  @keyframes bs-plaster { from { transform: rotate(-9deg); } to { transform: rotate(11deg); } }
  .bs .bs-brush { animation: bs-brush 0.7s ease-in-out infinite alternate; }
  @keyframes bs-brush { from { transform: rotate(-10deg); } to { transform: rotate(8deg); } }
  .bs .bs-bob { animation: bs-bob 1.3s ease-in-out infinite alternate; }
  @keyframes bs-bob { to { transform: translateY(-3px); } }

  /* Launch day: the bow and its tails flutter, the halves sway, the star wobbles. */
  .bs .bs-new-g { animation: bs-wobble 2.4s ease-in-out infinite alternate; }
  @keyframes bs-wobble { from { transform: rotate(-6deg) scale(0.97); } to { transform: rotate(6deg) scale(1.03); } }
  .bs .bs-tails { animation: bs-flutter 0.9s ease-in-out infinite alternate; }
  @keyframes bs-flutter { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
  .bs .bs-bow { animation: bs-bow 2.2s ease-in-out infinite alternate; }
  @keyframes bs-bow { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
  .bs .bs-rib-l { animation: bs-sway 2.6s ease-in-out infinite alternate; }
  .bs .bs-rib-r { animation: bs-sway 2.6s ease-in-out infinite alternate-reverse; }
  @keyframes bs-sway { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }

  /* The cut: scissors snip three times, then the halves drop, the bow falls and the doors open. */
  .bs .bs-scissors { transition: opacity 0.25s; }
  .bs .bs-glass { transition: fill 0.8s; }
  .bs.cutting .bs-sc-a { animation: bs-snip-a 0.26s ease-in-out 3 alternate both; }
  .bs.cutting .bs-sc-b { animation: bs-snip-b 0.26s ease-in-out 3 alternate both; }
  @keyframes bs-snip-a { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }
  @keyframes bs-snip-b { from { transform: rotate(12deg); } to { transform: rotate(-14deg); } }
  .bs.cut .bs-rib-l, .bs.cut .bs-rib-r, .bs.cut .bs-bow, .bs.cut .bs-tails { animation: none; }
  .bs .bs-rib-l, .bs .bs-rib-r { transition: transform 0.9s cubic-bezier(0.3, 1.45, 0.55, 1); }
  .bs .bs-bow { transition: transform 0.7s cubic-bezier(0.55, 0, 0.8, 0.6); }
  .bs .bs-leaf { transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1) 0.45s; }

  .win-wrap.bs-new-win { animation: bs-win 0.75s ease-in-out 5 alternate; }
  @keyframes bs-win {
    from { box-shadow: 0 0 0 0 rgba(255, 211, 107, 0), 0 0 0 0 rgba(255, 196, 90, 0); }
    to { box-shadow: 0 0 0 5px #ffd36b, 0 0 40px 16px rgba(255, 196, 90, 0.8); }
  }
}
