/* =============================================================================
   PlanWatch audience switch: "For homes | For trades"
   Direction B, "Site Plan". Built to sit inside B's floating pill header.

   Markup comes from render.js (or audience-switch.ejs, byte-identical). It works
   with no JavaScript: the side you are on is baked into the markup and the thumb
   is placed by CSS. audience-switch.js adds the motion: the hammer and house
   sequences, press feedback, the idle hint and the arrival hello.

   Rules this file keeps:
   - Motion is transform and opacity only. Nothing changes the page's layout; in Chromium the moving SVG
     parts re-lay-out only their own 30 px icon, about 0.1 ms a frame (proof/report.json).
   - prefers-reduced-motion: static icons, opacity fades only.
   - Uses B's tokens (tokens.css) when the page has them; works without them.
   ========================================================================== */

.pw-aud {
  /* ---- size: desktop, inside B's 60 px pill ---- */
  --aud-h: 46px;            /* track height; each option's hit area is the full height */
  --aud-in: 4px;            /* how far the thumb sits inside the track */
  --aud-ico: 30px;
  --aud-gap: 6px;
  --aud-pl: 9px;            /* option padding, left (includes the inset) */
  --aud-pr: 17px;           /* option padding, right */
  --aud-fs: 15px;

  /* ---- colour ---- */
  --aud-track: rgba(17, 18, 20, .055);
  --aud-track-edge: rgba(17, 18, 20, .07);
  --aud-ink: var(--ink-2, #3F434A);        /* the side you can switch to: full ink, never greyed out */
  --aud-ink-hi: var(--ink, #111214);
  --aud-ink-on: #111214;                   /* on the amber thumb: 11.3:1 */
  --aud-hover: rgba(17, 18, 20, .06);
  --aud-press: rgba(17, 18, 20, .1);
  --aud-thumb: var(--amber-field, #FFBE3B);
  --aud-thumb-edge: rgba(138, 75, 4, .2);
  --aud-thumb-glow: rgba(217, 119, 6, .42);
  --aud-ring: #B45309;                     /* focus ring: 4.9:1 on the light pill */

  /* ---- motion ---- */
  --aud-out: cubic-bezier(.16, 1, .3, 1);  /* B's expo-out */
  --aud-spring: cubic-bezier(.34, 1.36, .64, 1);
  --aud-spring-press: cubic-bezier(.34, 1.56, .64, 1);

  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;                  /* equal halves: the thumb fits either side exactly */
  flex-shrink: 0;
  height: var(--aud-h);
  border-radius: 999px;
  background: var(--aud-track);
  box-shadow: inset 0 0 0 1px var(--aud-track-edge);
  isolation: isolate;
  font-family: var(--font-sans, "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}

/* A real spring where the browser supports linear() (Chrome 113, Safari 17.2, Firefox 112).
   Slide: 3.8% overshoot at 245 ms, settled by 560 ms. Press release: a quick bounce. */
@supports (transition-timing-function: linear(0, 1)) {
  .pw-aud {
    --aud-spring: linear(0, 0.047, 0.1591, 0.3017, 0.4509, 0.5911, 0.7135, 0.8143, 0.8929, 0.951, 0.9912, 1.0169, 1.0313, 1.0375, 1.0381, 1.0352, 1.0303, 1.0246, 1.019, 1.0138, 1.0094, 1.0059, 1.0032, 1.0012, 0.9999, 0.9991, 0.9987, 0.9985, 0.9986, 0.9987, 0.9989, 0.9991, 1);
    --aud-spring-press: linear(0, 0.0732, 0.2486, 0.4678, 0.6859, 0.8734, 1.015, 1.1068, 1.1529, 1.1626, 1.1467, 1.1161, 1.0799, 1.045, 1.0157, 0.9941, 0.9807, 0.9744, 0.9737, 0.9769, 0.9822, 0.9881, 0.9937, 0.9982, 1);
  }
}

/* ---------------------------------------------------------------- thumb ---- */
.pw-aud-thumb {
  position: absolute; z-index: 0;
  top: var(--aud-in); bottom: var(--aud-in); left: var(--aud-in);
  width: calc(50% - 2 * var(--aud-in));
  border-radius: 999px;
  pointer-events: none;
  transition: transform 560ms var(--aud-spring);
}
.pw-aud-thumb::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--aud-thumb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 0 0 1px var(--aud-thumb-edge), 0 6px 14px -6px var(--aud-thumb-glow);
}
.pw-aud--trade .pw-aud-thumb { transform: translateX(calc(100% + 2 * var(--aud-in))); }
/* The slide: the thumb springs across, stretches in flight and squashes against the end of the track at the
   top of its overshoot, so it never pokes past the track's edge. */
.pw-aud.is-sliding .pw-aud-thumb::before { animation: aud-stretch 560ms linear both; }
/* Arriving on the other page after a switch: the thumb lands. */
.pw-aud.is-arriving .pw-aud-thumb::before { animation: aud-land 460ms cubic-bezier(.3, .7, .4, 1) both; }
@keyframes aud-stretch {
  0% { transform: none; animation-timing-function: cubic-bezier(.3, .7, .4, 1); }
  18% { transform: scale(1.07, .92); animation-timing-function: ease-in-out; }
  44% { transform: scale(.965, 1.05); animation-timing-function: ease-in-out; }
  68% { transform: scale(1.01, .99); animation-timing-function: ease-in-out; }
  100% { transform: none; }
}
@keyframes aud-land {
  0% { transform: scale(1.06, .9); }
  45% { transform: scale(.98, 1.03); }
  100% { transform: none; }
}
/* First visit (audience-switch.js, once per visitor): the thumb leans toward the other side, then springs home,
   so people see it switches. Leaning toward a hovered side says the same thing to a pointer. Neither runs under
   prefers-reduced-motion. */
.pw-aud { --aud-dir: 1; }
.pw-aud--trade { --aud-dir: -1; }
.pw-aud.is-nudging .pw-aud-thumb::before { animation: aud-nudge 1000ms both; }
@keyframes aud-nudge {
  0% { transform: none; animation-timing-function: cubic-bezier(.3, .7, .4, 1); }
  34% { transform: translateX(calc(var(--aud-dir) * max(8px, 14%))) scale(1.04, .96); animation-timing-function: cubic-bezier(.5, 0, .3, 1); }
  66% { transform: translateX(calc(var(--aud-dir) * -3%)) scale(.99, 1.01); animation-timing-function: ease-in-out; }
  100% { transform: none; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pw-aud--homeowner:has(a.pw-aud-opt[data-side="trade"]:hover) .pw-aud-thumb { transform: translateX(6px); }
  .pw-aud--trade:has(a.pw-aud-opt[data-side="homeowner"]:hover) .pw-aud-thumb { transform: translateX(calc(100% + 2 * var(--aud-in) - 6px)); }
}

/* -------------------------------------------------------------- options ---- */
.pw-aud-opt {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-width: 0;
  padding: 0 var(--aud-pr) 0 var(--aud-pl);
  border-radius: 999px;
  font-size: var(--aud-fs); font-weight: 600; line-height: 1; letter-spacing: -0.01em;
  white-space: nowrap; text-decoration: none;
  color: var(--aud-ink);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
a.pw-aud-opt { cursor: pointer; }
.pw-aud-opt.is-active { cursor: default; }
/* Label colour follows the container, so it changes with the thumb, not with the page load.
   During a slide it swaps 90 ms in, when the thumb is most of the way across. */
.pw-aud.pw-aud--homeowner .pw-aud-opt[data-side="homeowner"],
.pw-aud.pw-aud--trade .pw-aud-opt[data-side="trade"] { color: var(--aud-ink-on); }
.pw-aud.is-sliding .pw-aud-opt { transition: color 0s linear 90ms; }

.pw-aud-in {
  display: flex; align-items: center; gap: var(--aud-gap);
  transition: transform 420ms var(--aud-spring-press);
}
.pw-aud-label { display: block; }
.pw-aud-ico { display: block; flex: none; width: var(--aud-ico); height: var(--aud-ico); max-width: none; overflow: visible; }

/* Hover face: grows in under the side you can switch to. */
.pw-aud-opt::after {
  content: ""; position: absolute; z-index: -1; inset: var(--aud-in); border-radius: 999px;
  background: var(--aud-hover);
  opacity: 0; transform: scale(.9);
  transition: opacity 200ms var(--aud-out), transform 280ms var(--aud-out);
}
/* Focus ring: a clear pill round the option, inside the track edge, eased in. */
.pw-aud-opt::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--aud-ring);
  opacity: 0; transform: scale(1.06);
  transition: opacity 160ms ease-out, transform 260ms var(--aud-out);
}
.pw-aud-opt:focus-visible { outline: none; box-shadow: none; border-radius: 999px; }   /* beats B's global :focus-visible halo */
.pw-aud-opt:focus-visible::before, .pw-aud-opt.is-focus::before { opacity: 1; transform: none; }

@media (hover: hover) {
  .pw-aud a.pw-aud-opt:not(.is-active):hover { color: var(--aud-ink-hi); }
  .pw-aud a.pw-aud-opt:not(.is-active):hover::after { opacity: 1; transform: none; }
}
.pw-aud a.pw-aud-opt.is-hover { color: var(--aud-ink-hi); }
.pw-aud a.pw-aud-opt.is-hover::after, .pw-aud a.pw-aud-opt:not(.is-active):focus-visible::after { opacity: 1; transform: none; }

/* Press: the option sinks and the face darkens; it springs back on release. */
.pw-aud a.pw-aud-opt:not(.is-active):active .pw-aud-in, .pw-aud-opt.is-pressed .pw-aud-in { transform: scale(.94); transition: transform 90ms ease-out; }
.pw-aud a.pw-aud-opt:not(.is-active):active::after, .pw-aud-opt.is-pressed::after { opacity: 1; transform: scale(.97); background: var(--aud-press); }

/* The side you are on keeps the thumb; no hover face over it (also mid-slide, under the pointer). */
.pw-aud.pw-aud--homeowner .pw-aud-opt[data-side="homeowner"]::after,
.pw-aud.pw-aud--trade .pw-aud-opt[data-side="trade"]::after { opacity: 0; }
.pw-aud.pw-aud--homeowner .pw-aud-opt[data-side="homeowner"],
.pw-aud.pw-aud--trade .pw-aud-opt[data-side="trade"] { --aud-hover: transparent; --aud-press: transparent; }

/* --------------------------------------------------------------- sizes ---- */
/* Picked by viewport to fit B's pill (measured on both pages, 320 to 1440 px wide):
     1200 px and up   "For homes | For trades"
     700 to 1199 px   "Homes | Trades"
     699 px and down  icons only; labels stay for screen readers; each side at least 40 x 44 px
   .pw-aud--full, --short and --compact force a size anywhere; the menu variant always has labels.
   The automatic sizes use :where() so a header can tune --aud-* with a plain .nav .pw-aud rule. */
.pw-aud--short { --aud-pr: 15px; }
.pw-aud--short .pw-aud-for { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.pw-aud--short .pw-aud-noun { display: inline-block; }
.pw-aud--short .pw-aud-noun::first-letter { text-transform: uppercase; }
@media (max-width: 1199px) {
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--compact, .pw-aud--menu)) { --aud-pr: 15px; }
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--compact, .pw-aud--menu)) .pw-aud-for { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--compact, .pw-aud--menu)) .pw-aud-noun { display: inline-block; }
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--compact, .pw-aud--menu)) .pw-aud-noun::first-letter { text-transform: uppercase; }
}
.pw-aud--compact { --aud-h: 44px; --aud-in: 4px; --aud-ico: 28px; --aud-pl: 7px; --aud-pr: 7px; }
.pw-aud--compact .pw-aud-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 699px) {
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--short, .pw-aud--menu)) { --aud-h: 44px; --aud-in: 4px; --aud-ico: 28px; --aud-pl: 7px; --aud-pr: 7px; }
  .pw-aud:where(:not(.pw-aud--full, .pw-aud--short, .pw-aud--menu)) .pw-aud-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
}

/* Menu: full width, labels on, for the top of a phone menu card. */
.pw-aud--menu { display: grid; width: 100%; --aud-h: 54px; --aud-ico: 30px; --aud-fs: 16px; --aud-pl: 10px; --aud-pr: 16px; }

/* ---------------------------------------------------------------- dark ---- */
:root[data-theme="dark"] .pw-aud, .theme-dark .pw-aud, .pw-aud.pw-aud--dark {
  --aud-track: rgba(255, 255, 255, .075);
  --aud-track-edge: rgba(255, 255, 255, .07);
  --aud-ink: #C4C7CE;
  --aud-ink-hi: #F4F2EC;
  --aud-ink-on: #111214;
  --aud-hover: rgba(255, 255, 255, .08);
  --aud-press: rgba(255, 255, 255, .13);
  --aud-thumb: #FFB52E;
  --aud-thumb-edge: rgba(0, 0, 0, .3);
  --aud-thumb-glow: rgba(255, 181, 46, .32);
  --aud-ring: #FFC95C;
}

/* =============================================================== icons ===== */
/* One palette per theme, chosen so each icon reads on the track and on the amber thumb. */
.pw-aud-ico {
  --i-line: #1C1E22;
  --hs-wall: #F4E9DA; --hs-roof: #5B6170; --hs-chimney: #B9826A; --hs-cap: #9A6853; --hs-door: #2E62F0; --hs-knob: #FFE6A6;
  --hs-glass: #DCE4EE; --hs-lit: #FFD04F; --hs-glow: #FFB938; --hs-smoke: #BDB6A9; --hs-sheet: #FFE45C; --hs-ping: #F59E0B;
  --hm-wood: #EBCF9E; --hm-grain: #C99A5B; --hm-nail: #6B6F77; --hm-nail-head: #4A4E56;
  --hm-handle: #F59E0B; --hm-grip: #1C1E22; --hm-head: #2B2F36; --hm-shine: #A9B0BB;
  --hm-spark-o: #D97706; --hm-spark-i: #FFF4CC; --hm-dust: #D6C9B2; --hm-smear: rgba(17, 18, 20, .3);
}
:root[data-theme="dark"] .pw-aud-ico, .theme-dark .pw-aud-ico, .pw-aud--dark .pw-aud-ico {
  --hs-roof: #7A8295; --hs-glass: #313846; --hs-smoke: #8E918F;
  --hm-head: #9AA1AC; --hm-shine: #E6E9EE; --hm-grip: #5E6472; --hm-nail: #9AA0A9; --hm-nail-head: #B9BEC6;
  --hm-dust: #9C9384; --hm-smear: rgba(255, 255, 255, .45);
}
.pw-aud-ico * { transform-box: view-box; transform-origin: 0 0; }

/* ---- house: static ---- */
.hs-wall { fill: var(--hs-wall); stroke: var(--i-line); stroke-width: 1.2; }
.hs-roof { fill: var(--hs-roof); stroke: var(--i-line); stroke-width: 1.2; stroke-linejoin: round; }
.hs-chimney { fill: var(--hs-chimney); stroke: var(--i-line); stroke-width: 1.1; }
.hs-pot { fill: var(--hs-cap); stroke: var(--i-line); stroke-width: 1; }
.hs-glass { fill: var(--hs-glass); }
.hs-lit { fill: var(--hs-lit); opacity: 0; transition: opacity 360ms ease-in; }
.hs-frame { fill: none; stroke: var(--i-line); stroke-width: 1.05; }
.hs-bars { fill: none; stroke: var(--i-line); stroke-width: .75; }
.hs-glow { opacity: 0; transition: opacity 360ms ease-in; }
.hs-glow circle { fill: var(--hs-glow); opacity: .16; }
.hs-glow circle + circle { opacity: .2; }
.hs-glow circle + circle + circle { opacity: .28; }
.hs-inside { fill: var(--hs-lit); stroke: var(--i-line); stroke-width: 1; }
.hs-door { transition: transform 320ms cubic-bezier(.45, 0, .3, 1); }
.hs-panel { fill: var(--hs-door); stroke: var(--i-line); stroke-width: 1.05; }
.hs-knob { fill: var(--hs-knob); }
.hs-ground { fill: none; stroke: var(--i-line); stroke-width: 1.2; stroke-linecap: round; }
.hs-smoke { fill: var(--hs-smoke); opacity: 0; }
.hs-notice { opacity: 0; transform: scale(0); }
.hs-stake { fill: none; stroke: var(--i-line); stroke-width: 1.1; stroke-linecap: round; }
.hs-sheet { fill: var(--hs-sheet); stroke: var(--i-line); stroke-width: .9; }
.hs-sheet-lines { fill: none; stroke: var(--i-line); stroke-width: .6; stroke-linecap: round; opacity: .7; }
.hs-ping { fill: none; stroke: var(--hs-ping); stroke-width: 1.2; opacity: 0; }
.hs-press { transform-origin: 16px 28px; transition: transform 420ms var(--aud-spring-press); }

/* ---- house: states (CSS only; no script needed) ---- */
/* The side you are on: lights on, someone's home. */
.pw-aud.pw-aud--homeowner .pw-aud-opt[data-side="homeowner"] .hs-lit,
.pw-aud.pw-aud--homeowner .pw-aud-opt[data-side="homeowner"] .hs-glow { opacity: 1; transition: opacity 300ms ease-out 120ms; }
/* Hover or keyboard focus: the lights come on one after another and the door swings open. */
@media (hover: hover) {
  .pw-aud a.pw-aud-opt:not(.is-active):hover .hs-lit-a { opacity: 1; transition: opacity 200ms ease-out; }
  .pw-aud a.pw-aud-opt:not(.is-active):hover .hs-lit-w, .pw-aud a.pw-aud-opt:not(.is-active):hover .hs-glow { opacity: 1; transition: opacity 260ms ease-out 90ms; }
  .pw-aud a.pw-aud-opt:not(.is-active):hover .hs-door { transform: scaleX(.22); transition: transform 440ms cubic-bezier(.2, .8, .2, 1) 60ms; }
}
.pw-aud a.pw-aud-opt:not(.is-active):focus-visible .hs-lit-a, .pw-aud a.pw-aud-opt.is-hover .hs-lit-a { opacity: 1; transition: opacity 200ms ease-out; }
.pw-aud a.pw-aud-opt:not(.is-active):focus-visible .hs-lit-w, .pw-aud a.pw-aud-opt:not(.is-active):focus-visible .hs-glow,
.pw-aud a.pw-aud-opt.is-hover .hs-lit-w, .pw-aud a.pw-aud-opt.is-hover .hs-glow { opacity: 1; transition: opacity 260ms ease-out 90ms; }
.pw-aud a.pw-aud-opt:not(.is-active):focus-visible .hs-door, .pw-aud a.pw-aud-opt.is-hover .hs-door { transform: scaleX(.22); transition: transform 440ms cubic-bezier(.2, .8, .2, 1) 60ms; }
/* Press: the house squashes down on its ground line. */
.pw-aud a.pw-aud-opt:not(.is-active):active .hs-press, .pw-aud-opt.is-pressed .hs-press { transform: scale(1.05, .9); transition: transform 100ms ease-out; }

/* ---- house: sequences (classes added by audience-switch.js) ---- */
/* Hover: three puffs of chimney smoke (lights and door are the CSS states above). 1.8 s */
.pw-ico-house.play-puff .s1 { animation: hs-smoke-a 1100ms 0ms both; }
.pw-ico-house.play-puff .s2 { animation: hs-smoke-b 1100ms 300ms both; }
.pw-ico-house.play-puff .s3 { animation: hs-smoke-a 1100ms 600ms both; }
/* Idle hint: a window light flicks on and off, two puffs. 1.7 s */
.pw-ico-house.play-hint .hs-lit-w, .pw-ico-house.play-hint .hs-glow { animation: hs-hint-w 1700ms ease-in-out both; }
.pw-ico-house.play-hint .hs-lit-a { animation: hs-hint-a 1700ms ease-in-out both; }
.pw-ico-house.play-hint .s1 { animation: hs-smoke-a 1100ms 150ms both; }
.pw-ico-house.play-hint .s2 { animation: hs-smoke-b 1100ms 450ms both; }
/* Hello: lights, door, smoke, the planning notice pops up and an alert pings over the roof. 2.4 s */
.pw-ico-house.play-hello .hs-lit-a { animation: hs-hello-a-off 2400ms ease-out both; }
.pw-ico-house.play-hello .hs-lit-w, .pw-ico-house.play-hello .hs-glow { animation: hs-hello-w-off 2400ms ease-out both; }
.pw-aud--homeowner [data-side="homeowner"] .pw-ico-house.play-hello .hs-lit-a { animation-name: hs-hello-a-on; }
.pw-aud--homeowner [data-side="homeowner"] .pw-ico-house.play-hello .hs-lit-w,
.pw-aud--homeowner [data-side="homeowner"] .pw-ico-house.play-hello .hs-glow { animation-name: hs-hello-w-on; }
.pw-ico-house.play-hello .hs-door { animation: hs-hello-door 2400ms both; }
.pw-ico-house.play-hello .s1 { animation: hs-smoke-a 1100ms 240ms both; }
.pw-ico-house.play-hello .s2 { animation: hs-smoke-b 1100ms 560ms both; }
.pw-ico-house.play-hello .s3 { animation: hs-smoke-a 1100ms 880ms both; }
.pw-ico-house.play-hello .hs-notice { animation: hs-hello-notice 2400ms both; }
.pw-ico-house.play-hello .hs-ping { animation: hs-hello-ping 2400ms ease-out both; }

@keyframes hs-smoke-a {
  0% { opacity: 0; transform: translate(0, 0) scale(.35); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  18% { opacity: .95; transform: translate(.6px, -2.2px) scale(.75); animation-timing-function: linear; }
  55% { opacity: .65; transform: translate(1.4px, -5.4px) scale(1.12); animation-timing-function: cubic-bezier(.3, 0, .7, 1); }
  100% { opacity: 0; transform: translate(3.8px, -9.6px) scale(1.7); }
}
@keyframes hs-smoke-b {
  0% { opacity: 0; transform: translate(0, 0) scale(.35); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  18% { opacity: .95; transform: translate(-.5px, -2.4px) scale(.75); animation-timing-function: linear; }
  55% { opacity: .65; transform: translate(.5px, -5.6px) scale(1.1); animation-timing-function: cubic-bezier(.3, 0, .7, 1); }
  100% { opacity: 0; transform: translate(2.6px, -10px) scale(1.6); }
}
@keyframes hs-hint-w { 0% { opacity: 0; } 10% { opacity: 1; } 66% { opacity: 1; } 84%, 100% { opacity: 0; } }
@keyframes hs-hint-a { 0%, 8% { opacity: 0; } 18% { opacity: 1; } 60% { opacity: 1; } 78%, 100% { opacity: 0; } }
@keyframes hs-hello-a-on { 0% { opacity: 0; } 7%, 100% { opacity: 1; } }
@keyframes hs-hello-a-off { 0% { opacity: 0; } 7%, 80% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes hs-hello-w-on { 0%, 5% { opacity: 0; } 14%, 100% { opacity: 1; } }
@keyframes hs-hello-w-off { 0%, 5% { opacity: 0; } 14%, 84% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes hs-hello-door {
  0%, 12% { transform: none; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  27%, 50% { transform: scaleX(.22); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  62%, 100% { transform: none; }
}
@keyframes hs-hello-notice {
  0%, 26% { opacity: 0; transform: scale(0) rotate(-14deg); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
  32% { opacity: 1; transform: scale(1.16) rotate(7deg); animation-timing-function: ease-in-out; }
  37% { transform: scale(.94) rotate(-3deg); animation-timing-function: ease-in-out; }
  42% { transform: scale(1.03) rotate(1deg); animation-timing-function: ease-in-out; }
  46%, 82% { opacity: 1; transform: none; animation-timing-function: cubic-bezier(.5, 0, .75, 0); }
  92%, 100% { opacity: 0; transform: scale(0) rotate(-8deg); }
}
@keyframes hs-hello-ping {
  0%, 40% { opacity: 0; transform: scale(.5); }
  42% { opacity: .95; transform: scale(.6); }
  66%, 100% { opacity: 0; transform: scale(2.4); }
}

/* ---- hammer: static ---- */
.hm-wood { fill: var(--hm-wood); stroke: var(--i-line); stroke-width: 1.15; }
.hm-grain { fill: none; stroke: var(--hm-grain); stroke-width: .8; stroke-linecap: round; }
.hm-shank { fill: none; stroke: var(--hm-nail); stroke-width: 1.3; stroke-linecap: butt; }
.hm-nailhead { fill: var(--hm-nail-head); stroke: var(--i-line); stroke-width: .7; }
.hm-handle { fill: var(--hm-handle); stroke: var(--i-line); stroke-width: 1.15; }
.hm-grip { fill: var(--hm-grip); stroke: var(--i-line); stroke-width: 1.15; }
.hm-claw, .hm-head { fill: var(--hm-head); stroke: var(--i-line); stroke-width: 1.15; stroke-linejoin: round; }
.hm-shine { fill: none; stroke: var(--hm-shine); stroke-width: .9; stroke-linecap: round; }
.hm-spark .o { fill: none; stroke: var(--hm-spark-o); stroke-width: 1.8; stroke-linecap: round; }
.hm-spark .i { fill: none; stroke: var(--hm-spark-i); stroke-width: .8; stroke-linecap: round; }
.hm-star { fill: var(--hm-spark-i); stroke: var(--hm-spark-o); stroke-width: .7; stroke-linejoin: round; }
.hm-dust { fill: var(--hm-dust); }
.hm-smear { fill: none; stroke: var(--hm-smear); stroke-width: 1.1; stroke-linecap: round; }
.hm-spark, .hm-star, .hm-dust, .hm-smear { opacity: 0; }
.hm-all { transform-origin: 16px 30px; }
.hm-toss { transform-origin: 12px 0; }
.hm-press { transition: transform 420ms var(--aud-spring-press); }
/* Press: the hammer draws back, ready. */
.pw-aud a.pw-aud-opt:not(.is-active):active .hm-press, .pw-aud-opt.is-pressed .hm-press { transform: rotate(-10deg); transition: transform 100ms ease-out; }

/* ---- hammer: sequences (classes added by audience-switch.js) ---- */
/* Hover: wind up, strike, strike. Sparks on both hits, dust on the second, nail driven flush,
   then a fresh nail drops in. 1.5 s */
.pw-ico-hammer.play-swing .hm-arm { animation: hm-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-nail { animation: hm-nail-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-plank { animation: hm-plank-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-impact { animation: hm-impact-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-spark { animation: hm-spark-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-dust { animation: hm-dust-swing 1500ms both; }
.pw-ico-hammer.play-swing .hm-smear { animation: hm-smear-swing 1500ms both; }
/* Idle hint: two light taps on the nail head, a couple of small sparks. 0.9 s */
.pw-ico-hammer.play-tap .hm-arm { animation: hm-tap 900ms both; }
.pw-ico-hammer.play-tap .hm-impact { transform: translate(.4px, -1.7px); }
.pw-ico-hammer.play-tap .hm-spark { animation: hm-spark-tap 900ms both; }
.pw-ico-hammer.play-tap .hm-spark.k1, .pw-ico-hammer.play-tap .hm-spark.k4 { animation: none; }
/* Hello: the hammer is tossed, flips once, is caught, and drives the nail home in one blow:
   flash, sparks, dust, a jolt through the icon. 2 s */
.pw-ico-hammer.play-hello .hm-arm { animation: hm-hello-arm 2000ms both; }
.pw-ico-hammer.play-hello .hm-toss { animation: hm-hello-toss 2000ms both; }
.pw-ico-hammer.play-hello .hm-nail { animation: hm-hello-nail 2000ms both; }
.pw-ico-hammer.play-hello .hm-plank { animation: hm-hello-plank 2000ms both; }
.pw-ico-hammer.play-hello .hm-all { animation: hm-hello-all 2000ms both; }
.pw-ico-hammer.play-hello .hm-impact { transform: translate(-.8px, 1.7px); }
.pw-ico-hammer.play-hello .hm-spark { animation: hm-hello-spark 2000ms both; }
.pw-ico-hammer.play-hello .hm-star { animation: hm-hello-star 2000ms both; }
.pw-ico-hammer.play-hello .hm-dust { animation: hm-hello-dust 2000ms both; }
.pw-ico-hammer.play-hello .hm-smear { animation: hm-hello-smear 2000ms both; }
.pw-ico-hammer .hm-spark.k2 { animation-delay: 12ms; }
.pw-ico-hammer .hm-spark.k3 { animation-delay: 20ms; }

/* Angles are relative to rest (-32deg). +29 touches the nail head, +34.8 drives it 1.7 down, +41 drives it flush. */
@keyframes hm-swing {
  0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.2, .75, .3, 1); }
  10.67% { transform: rotate(-26deg); animation-timing-function: cubic-bezier(.65, 0, .9, .55); }
  15.67% { transform: rotate(34.8deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  22% { transform: rotate(17deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  31.33% { transform: rotate(-16deg); animation-timing-function: cubic-bezier(.65, 0, .9, .55); }
  35.67% { transform: rotate(41deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  42.67% { transform: rotate(27deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  54.67% { transform: rotate(-5deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  64% { transform: rotate(1.5deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  72%, 100% { transform: rotate(0deg); }
}
@keyframes hm-nail-swing {
  0%, 15.2% { transform: translateY(0); opacity: 1; }
  15.67%, 35.2% { transform: translateY(1.7px); opacity: 1; }
  35.67%, 80% { transform: translateY(3.4px); opacity: 1; }
  84% { transform: translateY(3.4px); opacity: 0; }
  84.1% { transform: translateY(-5px); opacity: 0; animation-timing-function: cubic-bezier(.3, 1.5, .6, 1); }
  95%, 100% { transform: translateY(0); opacity: 1; }
}
@keyframes hm-plank-swing {
  0%, 15.6% { transform: translateY(0); }
  15.67% { transform: translateY(.5px); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  20%, 35.6% { transform: translateY(0); }
  35.67% { transform: translateY(.8px); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  41%, 100% { transform: translateY(0); }
}
@keyframes hm-impact-swing { 0%, 35.6% { transform: translate(0, 0); } 35.67%, 100% { transform: translate(-.8px, 1.7px); } }
@keyframes hm-spark-swing {
  0%, 15.6% { opacity: 0; transform: translateX(0) scaleX(.3); }
  15.67% { opacity: 1; transform: translateX(0) scaleX(1.2); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  27% { opacity: 0; transform: translateX(3.4px) scaleX(.3); }
  35.6% { opacity: 0; transform: translateX(0) scaleX(.3); }
  35.67% { opacity: 1; transform: translateX(0) scaleX(1.35); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  49% { opacity: 0; transform: translateX(4.2px) scaleX(.3); }
  100% { opacity: 0; transform: translateX(0) scaleX(.3); }
}
@keyframes hm-dust-swing {
  0%, 35.6% { opacity: 0; transform: translateX(0) scale(.3); }
  35.67% { opacity: .9; transform: translateX(.6px) scale(.5); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  60%, 100% { opacity: 0; transform: translateX(3.6px) scale(1.5); }
}
@keyframes hm-smear-swing { 0%, 32% { opacity: 0; } 34.6% { opacity: .9; } 37.5%, 100% { opacity: 0; } }
@keyframes hm-tap {
  0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.2, .75, .3, 1); }
  13.3% { transform: rotate(-11deg); animation-timing-function: cubic-bezier(.65, 0, .9, .55); }
  21.1% { transform: rotate(29deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  30% { transform: rotate(15deg); animation-timing-function: cubic-bezier(.65, 0, .9, .55); }
  37.8% { transform: rotate(29deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  55.6% { transform: rotate(-4deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  68.9% { transform: rotate(1deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  78%, 100% { transform: rotate(0deg); }
}
@keyframes hm-spark-tap {
  0%, 21% { opacity: 0; transform: translateX(0) scaleX(.3); }
  21.1% { opacity: 1; transform: translateX(0) scaleX(.9); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  31% { opacity: 0; transform: translateX(2.2px) scaleX(.3); }
  37.7% { opacity: 0; transform: translateX(0) scaleX(.3); }
  37.8% { opacity: 1; transform: translateX(0) scaleX(.9); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  48%, 100% { opacity: 0; transform: translateX(2.4px) scaleX(.3); }
}
@keyframes hm-hello-arm {
  0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.3, 0, .5, 1); }
  6% { transform: rotate(7deg); animation-timing-function: cubic-bezier(.3, 0, .5, 1); }
  10%, 30% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.2, .75, .3, 1); }
  36% { transform: rotate(-34deg); animation-timing-function: cubic-bezier(.7, 0, .95, .5); }
  39.5% { transform: rotate(41deg); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  45% { transform: rotate(28deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  54% { transform: rotate(-6deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  61% { transform: rotate(2deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  67%, 100% { transform: rotate(0deg); }
}
@keyframes hm-hello-toss {
  0%, 9% { transform: translate(0, 0) rotate(0deg); animation-timing-function: cubic-bezier(.15, .6, .35, 1); }
  19.5% { transform: translate(4px, -6px) rotate(-180deg); animation-timing-function: cubic-bezier(.6, 0, .85, .4); }
  30% { transform: translate(0, 0) rotate(-360deg); }
  30.1%, 100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes hm-hello-nail {
  0%, 39.2% { transform: translateY(0); opacity: 1; }
  39.5%, 82% { transform: translateY(3.4px); opacity: 1; }
  86% { transform: translateY(3.4px); opacity: 0; }
  86.1% { transform: translateY(-5px); opacity: 0; animation-timing-function: cubic-bezier(.3, 1.5, .6, 1); }
  96%, 100% { transform: translateY(0); opacity: 1; }
}
@keyframes hm-hello-plank {
  0%, 39.4% { transform: translateY(0); }
  39.5% { transform: translateY(1px); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  46%, 100% { transform: translateY(0); }
}
@keyframes hm-hello-all {
  0%, 39.4% { transform: none; }
  39.5% { transform: scale(1.04, .95); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  45% { transform: scale(.985, 1.015); animation-timing-function: ease-in-out; }
  51%, 100% { transform: none; }
}
@keyframes hm-hello-spark {
  0%, 39.4% { opacity: 0; transform: translateX(0) scaleX(.3); }
  39.5% { opacity: 1; transform: translateX(0) scaleX(1.5); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  54%, 100% { opacity: 0; transform: translateX(5px) scaleX(.3); }
}
@keyframes hm-hello-star {
  0%, 39.4% { opacity: 0; transform: scale(.2) rotate(0deg); }
  39.5% { opacity: 1; transform: scale(.7) rotate(0deg); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  43% { opacity: 1; transform: scale(1.3) rotate(20deg); }
  50%, 100% { opacity: 0; transform: scale(1.6) rotate(35deg); }
}
@keyframes hm-hello-dust {
  0%, 39.4% { opacity: 0; transform: translateX(0) scale(.3); }
  39.5% { opacity: .95; transform: translateX(.6px) scale(.6); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  64%, 100% { opacity: 0; transform: translateX(4.6px) scale(1.8); }
}
@keyframes hm-hello-smear { 0%, 35.5% { opacity: 0; } 38.2% { opacity: .9; } 40.5%, 100% { opacity: 0; } }

/* ====================================================== reduced motion ===== */
/* Static icons and simple fades: the hover face and the house lights fade; nothing moves. */
@media (prefers-reduced-motion: reduce) {
  .pw-aud .pw-aud-ico *, .pw-aud .pw-aud-thumb::before { animation: none !important; }
  .pw-aud .pw-aud-thumb { transition: none; }
  .pw-aud.is-sliding .pw-aud-thumb::before { animation: aud-fade 220ms ease-out both !important; }
  .pw-aud .pw-aud-in, .pw-aud .hm-press, .pw-aud .hs-press, .pw-aud .hs-door { transition: none !important; transform: none !important; }
  .pw-aud .pw-aud-opt::after, .pw-aud .pw-aud-opt::before { transform: none !important; }
}
@keyframes aud-fade { from { opacity: 0; } to { opacity: 1; } }

/* ======================================================= first-visit hint ===== */
/* "Trade or business? Switch here": a small note under the business side, once per visitor, gone on any click or
   scroll. Fixed and placed by audience-switch.js, so it never moves the page. */
.pw-aud-hint {
  position: fixed; z-index: 101; top: 0; left: 0;
  display: flex; align-items: center; gap: 4px; max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 14px; border-radius: 12px;
  background: var(--ink, #111214); color: var(--paper, #fff);
  box-shadow: 0 14px 30px -12px rgba(17, 18, 20, .45);
  font: 500 14px/1.25 var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif); letter-spacing: -0.01em; white-space: nowrap;
  opacity: 0; transform: translateY(-4px); transition: opacity 220ms var(--aud-out, ease), transform 320ms var(--aud-out, ease);
}
.pw-aud-hint.is-on { opacity: 1; transform: none; }
.pw-aud-hint::before {
  content: ""; position: absolute; top: -5px; left: var(--hint-arrow, 50%); width: 10px; height: 10px; margin-left: -5px;
  background: inherit; border-radius: 2px; transform: rotate(45deg);
}
.pw-aud-hint-x {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: inherit; opacity: .7; cursor: pointer;
}
.pw-aud-hint-x:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.pw-aud-hint-x:focus-visible { outline: 2px solid var(--amber, #F59E0B); outline-offset: 1px; }
:root[data-theme="dark"] .pw-aud-hint-x:hover { background: rgba(17, 18, 20, .08); }
/* While the note shows on a page that starts right under the header, the page below slides down to clear it
   (audience-switch.js sets --pw-aud-push to the gap needed, then back to 0px). Transform only: no reflow, no layout shift. */
.pw-aud-pushed { transform: translateY(var(--pw-aud-push, 0px)); transition: transform 320ms cubic-bezier(.16, 1, .3, 1); }
@media (prefers-reduced-motion: reduce) {
  .pw-aud-hint { transform: none; transition: opacity 160ms linear; }
  .pw-aud-pushed { transition: none; }
}
