/* ---------- Audience (encore pass, 8 Nov 2026) ----------
   Near-black silhouettes, rim-lit by the stage. Before the lamp strikes they
   chat, fan and doze; when it strikes (.lamp-on) each settles toward the
   stage in turn, staggered by --d. Idle motion lives on inner groups so a
   state change never fights a running animation. */
.crowd { --lit: var(--aud-lit, 1); }
.crowd .figures { fill: url(#form); color: var(--rope-hi); }
.crowd .gl, .crowd .pearl { fill: var(--rope-hi); opacity: calc(0.22 + var(--lit) * 0.78); }
.crowd .pearl { fill: #f1e6cf; }
.crowd .net { opacity: calc(0.08 + var(--lit) * 0.26); }
.crowd .gls, .crowd .chain { fill: none; stroke: var(--rope-hi); stroke-linecap: round; opacity: calc(0.15 + var(--lit) * 0.85); }
.crowd .chain { stroke-width: 0.9; }
.crowd .linen { fill: #cfc6b4; opacity: calc(0.08 + var(--lit) * 0.32); }
.crowd .skin, .crowd .band, .crowd .collar, .crowd .seam { fill: #0b080c; }
.crowd .seam { fill: none; stroke: #1c1218; stroke-width: 2; }
.crowd .scalp { fill: #e9cf94; opacity: calc(0.05 + var(--lit) * 0.38); }
.crowd .glass { fill: #fff3d6; opacity: calc(0.1 + var(--lit) * 0.9); }
.crowd .tip { fill: url(#aud-tip); opacity: calc(0.25 + var(--lit) * 0.75); }
.crowd .barbs { fill: none; stroke: #050407; stroke-width: 1.4; stroke-linecap: round; }
.crowd .lace { fill: #f3d9a4; fill-opacity: calc(0.08 + var(--lit) * 0.3); stroke: none; }
.crowd .ribs { fill: none; stroke: #050407; stroke-width: 1.6; }
.crowd .paper { fill: #ffe0a8; opacity: calc(0.04 + var(--lit) * 0.42); }
.crowd .print .gls { stroke: #2a1a10; opacity: calc(0.15 + var(--lit) * 0.55); }
.curtain-live .crowd .p {
  filter: drop-shadow(0 -1.4px 0 rgb(227 201 131 / calc(0.35 + var(--lit) * 0.65)))
          drop-shadow(0 0 3px rgb(255 214 150 / calc(var(--lit) * 0.28)));
}
/* Fur and hair, strand by strand (hyper-fidelity pass, 8 Nov 2026).
   Dark strands break the silhouette edge; their outer ends catch the stage
   light. Marabou is translucent, so the stage glows through it. */
.crowd .fur, .crowd .furpale, .crowd .marabou { fill: none; stroke-linecap: round; }
.crowd .fur { stroke: #050407; stroke-width: 1.15; }
.crowd .furtip { fill: none; stroke: #e2b47a; stroke-width: 0.5; stroke-linecap: round; opacity: calc(0.08 + var(--lit) * 0.42); }
.crowd .furwhite { fill: #e9e1d0; opacity: calc(0.18 + var(--lit) * 0.5); }
.crowd .furpale { stroke: #e9e1d0; stroke-width: 0.9; opacity: calc(0.15 + var(--lit) * 0.45); }
.crowd .furpaletip { fill: none; stroke: #fff6e4; stroke-width: 0.6; stroke-linecap: round; opacity: calc(0.15 + var(--lit) * 0.6); }
.crowd .marabou { stroke: #f3d9a4; stroke-width: 0.6; opacity: calc(0.1 + var(--lit) * 0.38); }
.crowd .maraboutip { fill: none; stroke: #fff0cc; stroke-width: 0.5; stroke-linecap: round; opacity: calc(0.1 + var(--lit) * 0.55); }
.crowd .mink { fill: #0a0608; }
.crowd .nose { fill: #000; }
.crowd .curl { fill: none; stroke: var(--rope-hi); stroke-width: 0.7; opacity: calc(0.06 + var(--lit) * 0.3); }
.crowd .hair { fill: none; stroke: var(--rope-hi); stroke-width: 0.45; opacity: calc(0.04 + var(--lit) * 0.2); }
/* Stage lip (fidelity pass, 8 Nov 2026): apron, gilt nosing, hooded footlights */
.crowd .apron { fill: #0a0709; }
.crowd .nosing { stroke: var(--rope); stroke-width: 1.4; stroke-opacity: calc(0.25 + var(--lit) * 0.5); }
.crowd .hood { fill: #050407; }
.crowd .footglow { fill: #ffc77a; opacity: calc(var(--foot-o, 1) * 0.55); filter: blur(5px); }
/* Seats: purple velvet (hyper-fidelity pass, 8 Nov 2026). The whole row
   sits in house light until the lamp strikes, then warms. */
.crowd .seats { filter: brightness(calc(0.55 + var(--lit) * 0.45)); }
.crowd .velvet { fill: url(#seat-velvet); }
.crowd .chan { fill: url(#seat-chan); }
.crowd .pile { fill: url(#pile); opacity: 0.16; mix-blend-mode: screen; }
.crowd .seams { fill: none; stroke: #0c0409; stroke-width: 1.8; }
.crowd .roll { fill: url(#seat-roll); }
.crowd .rollrim { fill: none; stroke: #f2c9a0; stroke-width: 1.3; stroke-linecap: round; opacity: calc(0.12 + var(--lit) * 0.55); }
.crowd .arm { fill: #1c0a16; }
.crowd .armcap { fill: url(#walnut); }
.crowd .armhi { fill: none; stroke: #c99a6a; stroke-width: 0.9; stroke-linecap: round; opacity: calc(0.2 + var(--lit) * 0.5); }
.crowd .plate { fill: url(#brass); opacity: calc(0.55 + var(--lit) * 0.45); }
.crowd .platehi { stroke: #fff1c8; stroke-width: 0.6; opacity: 0.7; }
.crowd .screw { fill: #4a3816; }
.crowd .seatno { font: 600 7.6px/1 var(--label, "Barlow Condensed", sans-serif); fill: #2a1d0c; text-anchor: middle; letter-spacing: 0.06em; }
.crowd .piping { fill: none; stroke: var(--rope); stroke-width: 1.6; stroke-opacity: calc(0.35 + var(--lit) * 0.55); }

.crowd .p, .crowd g { transform-box: fill-box; }
.crowd .p { transform-origin: 50% 100%; transition: transform 1.2s cubic-bezier(0.3, 0.7, 0.2, 1) var(--d, 0s); }
.crowd .head { transform-origin: 50% 92%; transition: transform 1s cubic-bezier(0.3, 0.7, 0.2, 1) calc(var(--d, 0s) + 0.1s); }

/* Breathing, everyone, at their own pace */
.curtain-live .crowd .body { transform-origin: 50% 100%; animation: breath 5.6s ease-in-out infinite; }
.curtain-live .crowd .p:nth-child(2n) .body { animation-duration: 6.4s; animation-delay: -1.8s; }
.curtain-live .crowd .p:nth-child(3n) .body { animation-duration: 4.8s; animation-delay: -2.6s; }

/* Before the lamp: heads turned to a neighbour. After: faces front. */
.crowd .flapper .head { transform: rotate(10deg); }
.crowd .fanlady .head { transform: rotate(-9deg); }
.crowd .whisper { transform: rotate(6deg) translateX(6px); }
.crowd .snood { transform: rotate(-6deg) translateX(-6px); }
.crowd .glasses .head { transform: rotate(-7deg); }
.crowd .cloche .head { transform: rotate(8deg); }
.crowd .child .head { transform: rotate(-12deg); }
.lamp-on .crowd .whisper, .lamp-on .crowd .snood { transform: none; }
.lamp-on .crowd .head { transform: rotate(var(--look, 0deg)); transition-duration: .5s; transition-delay: 0s; }
.curtain-live .crowd .whisper .head { animation: murmur 2.4s ease-in-out infinite; }
.curtain-live .crowd .snood .head { animation: nod-yes 3.1s ease-in-out 0.6s infinite; }
.lamp-on .crowd .whisper .head, .lamp-on .crowd .snood .head { animation: none; }

/* The opera hat: lifted, folded flat, lowered under the seat. */
.crowd .operahat .hat { transform-origin: 50% 100%; transition: transform 0.8s cubic-bezier(0.5, 0, 0.7, 0.4) 0.9s, opacity 0.4s linear 1.4s; }
.crowd .operahat .lift { transform-origin: 50% 100%; transition: transform 0.35s ease-out 0.1s; }
.crowd .operahat .crown { transform-origin: 50% 96%; transition: transform 0.22s cubic-bezier(0.6, 0, 0.9, 0.5) 0.55s; }
.lamp-on .crowd .operahat .lift { transform: translateY(-12px); }
.lamp-on .crowd .operahat .crown { transform: scaleY(0.16); }
.lamp-on .crowd .operahat .hat { transform: translate(34px, 120px) rotate(70deg); opacity: 0; }
/* Closing again: the hat comes back up and pops open. */
.crowd .operahat .hat { transition-delay: 0s, 0s; }
.lamp-on .crowd .operahat .hat { transition-delay: 0.9s, 1.4s; }
.crowd .operahat .crown { transition-delay: 0.65s; }
.lamp-on .crowd .operahat .crown { transition-delay: 0.55s; }

/* Flapper: the pearl rope and the plume answer every movement. */
.curtain-live .crowd .pearls { transform-origin: 50% 0%; animation: swing 3.2s ease-in-out infinite; }
.curtain-live .crowd .feather { transform-origin: 30% 100%; animation: feather 3.8s ease-in-out infinite; }
.curtain-live .crowd .drops { transform-origin: 50% 0%; animation: drop 2.6s ease-in-out infinite; }

/* Fan: fluttering through the chatter, lowered and slowed for the show. */
.crowd .fanwrap, .crowd .fanwrap .fan { transform-box: view-box; transform-origin: 0 0; }
.curtain-live .crowd .fan { animation: flutter 0.62s ease-in-out infinite alternate; }
.lamp-on .crowd .fan { animation-duration: 1.6s; }
.crowd .fanlady .fanwrap { transition: transform 1s ease var(--d); }
.lamp-on .crowd .fanlady .fanwrap { transform: rotate(34deg) scale(0.84); }

/* Child: fidgets, then kneels up on the cushion to see, with a little bounce. */
.curtain-live .crowd .child .body { animation: fidget 6s ease-in-out 1s infinite; }
.lamp-on .crowd .child { transform: translateY(-14px); transition-timing-function: cubic-bezier(0.3, 1.6, 0.5, 1); }
.lamp-on .crowd .child .body { animation: bounce 1.9s ease-in-out infinite; }
.curtain-live .crowd .bow { transform-origin: 50% 100%; animation: drop 3s ease-in-out infinite; }

/* Opera glasses come up when the lights do. */
.crowd .glasses .raise { transform: translateY(46px); opacity: 0; transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) calc(var(--d) + 0.5s), opacity 0.3s linear calc(var(--d) + 0.5s); }
.lamp-on .crowd .glasses .raise { transform: none; opacity: 1; }
.lamp-on .crowd .glasses .glass { animation: glint 4.5s ease-in-out 2s infinite; }

/* Fox stole tail sways with her. */
.curtain-live .crowd .tail { transform-origin: 30% 0%; animation: tail 4.4s ease-in-out infinite; }

/* Ear trumpet: lowered in the chatter, up to the ear and leaning in for the show. */
.crowd .trumpet .horn { transform-origin: 0% 60%; transform: rotate(64deg) translate(6px, 46px); transition: transform 1s cubic-bezier(0.3, 0.7, 0.2, 1) calc(var(--d) + 0.3s); }
.lamp-on .crowd .trumpet .horn { transform: none; }
.lamp-on .crowd .trumpet { transform: rotate(-3deg) translateY(2px); }

/* Bowler: nods off during the overture. The lamp wakes him with a start. */
.crowd .doze { transform-origin: 50% 100%; }
.curtain-live .overture:not(.lamp-on) .crowd .doze { animation: doze 7s ease-in-out infinite; }
.crowd .bowlerhat { transform-origin: 50% 100%; transition: transform 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 0.8s; }
.lamp-on .crowd .bowlerhat { transform: rotate(-7deg) translateY(-2px); }
.crowd .programme { transform-origin: 100% 100%; transition: transform 0.9s ease 1s; }
.curtain-live .overture:not(.lamp-on) .crowd .programme { transform: rotate(22deg) translateY(74px); }

@keyframes breath { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.025) translateY(-2px); } }
@keyframes murmur { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(3deg); } 55% { transform: rotate(-1deg); } 75% { transform: rotate(2deg); } }
@keyframes nod-yes { 0%, 100% { transform: translateY(0); } 20% { transform: translateY(2.5px); } 35% { transform: translateY(0); } 50% { transform: translateY(2px); } 65% { transform: translateY(0); } }
@keyframes swing { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes feather { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(7deg); } }
@keyframes drop { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg); } }
@keyframes flutter { from { transform: rotate(-6deg); } to { transform: rotate(5deg); } }
@keyframes fidget { 0%, 70%, 100% { transform: translateY(0) rotate(0); } 76% { transform: translateY(-5px) rotate(-3deg); } 84% { transform: translateY(0) rotate(2deg); } 90% { transform: translateY(-3px) rotate(0); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-3px); } 55% { transform: translateY(0); } }
@keyframes glint { 0%, 80%, 100% { opacity: 0.85; } 86% { opacity: 1; filter: drop-shadow(0 0 3px #fff3d6); } }
@keyframes tail { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes doze { 0%, 18% { transform: translateY(0) rotate(0); } 62% { transform: translateY(9px) rotate(4deg); } 66% { transform: translateY(1px) rotate(-1deg); } 70% { transform: translateY(2px) rotate(0); } 100% { transform: translateY(0) rotate(0); } }

/* ---------- Tap a sitter, and the Scottish play (8 Nov 2026) ---------- */
.crowd .p.tapped .head { animation: shush 2.2s cubic-bezier(0.3, 0.7, 0.2, 1) 1; }
.crowd .p.tapped:nth-child(2n) .head { animation-name: shush-r; }
.lamp-on .crowd .child.tapped .body { animation: bounce-up 0.7s ease-in-out 3; }
.lamp-on .crowd .bowler.tapped .head { animation: none; }
.lamp-on .crowd .bowler.tapped .doze { animation: doze-again 2.3s ease-in-out 1; }
.overture.cursed .crowd .head { animation: look-back 3s cubic-bezier(0.3, 0.7, 0.2, 1) 1; }
.overture.cursed .crowd .p:nth-child(2n) .head { animation-name: look-back-r; }
.overture.cursed .crowd .child .body { animation: duck 3s ease-in-out 1; }
@keyframes shush { 0%, 100% { transform: rotate(0); } 18%, 70% { transform: rotate(-11deg) translateX(-3px); } }
@keyframes shush-r { 0%, 100% { transform: rotate(0); } 18%, 70% { transform: rotate(11deg) translateX(3px); } }
@keyframes bounce-up { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-9px); } }
@keyframes doze-again { 0% { transform: none; } 55% { transform: translateY(10px) rotate(5deg); } 62% { transform: translateY(-3px) rotate(-2deg); } 72%, 100% { transform: none; } }
@keyframes lamp-stutter { 0% { opacity: 0.2; } 12% { opacity: 1; } 22% { opacity: 0.35; } 30% { opacity: 0.9; } 46% { opacity: 0.5; } 60%, 100% { opacity: var(--beam-o, 1); } }
@keyframes look-back { 0%, 100% { transform: rotate(0); } 15%, 75% { transform: rotate(-17deg) translateX(-4px); } }
@keyframes look-back-r { 0%, 100% { transform: rotate(0); } 15%, 75% { transform: rotate(17deg) translateX(4px); } }
@keyframes duck { 0%, 100% { transform: translateY(0); } 15%, 75% { transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  .crowd .p.tapped .head, .overture.cursed .crowd .head, .overture.cursed .beam, .overture.cursed .pool { animation: none !important; }
}


/* ---------- Rebuild, 13 Nov 2026: the house comes alive ----------
   audience.js directs: heads follow the follow-spot (--look), one sitter at a
   time does a small piece of business (.bit), the row applauds when the
   curtain is fully up (see "The house responds" below). */
.audience { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: var(--aud-h); pointer-events: none; }
.audience svg { width: 100%; height: 100%; display: block; overflow: visible; }
.audience .p { pointer-events: auto; cursor: pointer; }
html:not(.curtain-live) .audience .p { pointer-events: none; }

/* business */
.lamp-on .crowd .p.bit-lean { transform: rotate(var(--lean, 4deg)) translateX(calc(var(--lean, 4deg) / 1deg * 1.2px)); }
.lamp-on .crowd .p.bit-look .head { animation: bit-look 2.6s cubic-bezier(.3, .7, .2, 1) 1; }
.lamp-on .crowd .p.bit-nod .head { animation: nod-yes 1.6s ease-in-out 1; }
.lamp-on .crowd .p.bit-sit { animation: bit-sit 1.8s cubic-bezier(.3, .7, .2, 1) 1; }
.lamp-on .crowd .fanlady.bit-fan .fanwrap { transform: none; }
.lamp-on .crowd .fanlady.bit-fan .fan { animation-duration: .3s; }
.lamp-on .crowd .glasses.bit-peer .raise { animation: bit-peer 3s ease-in-out 1; }
.lamp-on .crowd .glasses.bit-peer .head { animation: bit-crane 3s ease-in-out 1; }
.lamp-on .crowd .bowler.bit-doze .doze { animation: doze-again 3.2s ease-in-out 1; }
.lamp-on .crowd .child.bit-hop .body { animation: bounce-up .6s ease-in-out 3; }
.lamp-on .crowd .child.bit-hop .head { animation: bit-look 1.8s ease-in-out 1; }
.lamp-on .crowd .trumpet.bit-hark { transform: rotate(-8deg) translateY(1px); }
.lamp-on .crowd .flapper.bit-shimmy .body { animation: bit-shimmy .5s ease-in-out 4; }
.lamp-on .crowd .flapper.bit-shimmy .feather { animation-duration: .5s; }
.lamp-on .crowd .operahat.bit-sit, .lamp-on .crowd .cloche.bit-sit { animation: bit-sit 1.8s cubic-bezier(.3, .7, .2, 1) 1; }
@keyframes bit-look { 0%, 100% { transform: rotate(var(--look, 0deg)); } 22%, 62% { transform: rotate(var(--turn, 12deg)) translateX(calc(var(--turn, 12deg) / 1deg * .3px)); } }
@keyframes bit-sit { 0%, 100% { transform: none; } 30% { transform: translateY(-7px) rotate(-1.5deg); } 55% { transform: translateY(2px) rotate(1deg); } 75% { transform: translateY(-1px); } }
@keyframes bit-peer { 0%, 100% { transform: none; } 20%, 80% { transform: translateY(-9px); } }
@keyframes bit-crane { 0%, 100% { transform: rotate(var(--look, 0deg)); } 20%, 80% { transform: rotate(var(--look, 0deg)) translateY(-6px); } }
@keyframes bit-shimmy { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg) translateX(-2px); } 75% { transform: rotate(3deg) translateX(2px); } }

/* The house responds (18 Nov 2026). audience.js runs every sitter on their own
   clock; these rules only draw the hands, the light and the one rose. */
.crowd .hands { opacity: 0; pointer-events: none; }
.crowd .hands .hand, .crowd .hands .arm { fill: #0b080c; stroke: var(--rope-hi); stroke-width: 1.05; stroke-linejoin: round; stroke-opacity: calc(.3 + var(--lit, 1) * .6); }
.crowd .hands .arm { stroke-opacity: calc(.15 + var(--lit, 1) * .3); }
.crowd .hands.gloved .hand, .crowd .hands.gloved .arm { fill: #b8ab92; fill-opacity: calc(.1 + var(--lit, 1) * .34); }
.crowd .hands .cuff { fill: none; stroke: #e9dfc8; stroke-width: 2; stroke-linecap: round; opacity: calc(.15 + var(--lit, 1) * .55); }
.crowd .hands.gloved .cuff { stroke: var(--rope-hi); stroke-width: 1; }
.crowd .hands .lift-h, .crowd .hands .h-near, .crowd .hands .h-far { transform-box: view-box; transform-origin: 0 2px; }
/* a sitter who has joined in leans into the light */
.curtain-live .crowd .p { transition: transform 1.2s cubic-bezier(0.3, 0.7, 0.2, 1) var(--d, 0s), filter .9s ease; }
.curtain-live .crowd .p.warm {
  filter: drop-shadow(0 -1.5px 0 rgb(255 232 178)) drop-shadow(0 0 5px rgb(255 214 150 / .5));
}
/* the held breath: everything small stops */
.hush .crowd .fan, .hush .crowd .child .body, .hush .crowd .pearls, .hush .crowd .feather, .hush .crowd .tail, .hush .crowd .bow, .hush .crowd .drops { animation-play-state: paused; }
/* at the height of it: the fan beats time, the opera glasses catch the light, the programme goes up */
.ovation .crowd .fanlady .fanwrap { transform: rotate(8deg) scale(.96); }
.ovation .crowd .fan { animation-duration: .36s; }
.ovation .crowd .glasses .glass { animation: catch 2.3s ease-in-out 1; }
.ovation .crowd .bowler .programme { animation: programme 1.9s cubic-bezier(.4, 0, .3, 1) 1.1s 2; }
.ovation .crowd .trumpet { transform: rotate(-7deg) translateY(1px); }
.crowd .p.ov-wave .head { animation: bit-look 2.4s cubic-bezier(.3, .7, .2, 1) 1; --turn: 0deg; }
@keyframes catch { 0%, 100% { opacity: .85; filter: none; } 30% { opacity: 1; filter: drop-shadow(0 0 5px #fff3d6); } 46% { opacity: .8; filter: none; } 64% { opacity: 1; filter: drop-shadow(0 0 4px #fff3d6); } }
@keyframes programme { 0%, 100% { transform: none; } 35% { transform: translateY(-9px) rotate(-7deg); } 62% { transform: translateY(-7px) rotate(3deg); } }
/* the stage answers: the footlights warm while the house is on its feet */
.stage-spot { filter: brightness(calc(1 + var(--ovation, 0) * .7)); }
.stage-floor { filter: brightness(calc(1 + var(--ovation, 0) * .35)); }

.roses { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.rose { position: absolute; left: 0; top: 0; width: clamp(46px, 4.6vw, 72px); height: auto; will-change: transform; filter: drop-shadow(0 1px 0 rgba(255, 214, 150, .28)); }
.rose svg { display: block; width: 100%; height: auto; }
.rose-shade { position: absolute; left: 0; top: 0; width: clamp(50px, 5vw, 78px); height: 9px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .7), transparent); }

@media (prefers-reduced-motion: reduce) {
  .crowd .p, .crowd .head, .crowd .body, .crowd .hands g { animation: none !important; }
  .roses { display: none; }
}
