@layer components {
  .home-main { align-items: start; padding-block-start: 0; }
  .hero-lockup {
    --art-size: clamp(220px, 27vw, 295px);
    --sky-room: clamp(156px, 27svh, 480px);
    position: relative;
    isolation: isolate;
    padding-top: var(--sky-room);
  }

  .hero-art {
    position: relative;
    container-type: inline-size;
    width: var(--art-size);
    margin: 0 auto 12px;
  }

  .hero-art img { width: 100%; }
  .car-details { position: absolute; inset: 0; width: 100%; pointer-events: none; }
  .wheel { animation: wheel-roll .38s steps(4) infinite; }
  @keyframes wheel-roll { to { transform: translateX(-128px); } }
  .wiper { animation: wipe 2.4s steps(9) infinite; }
  @keyframes wipe {
    0%, 49%, 100% { transform: rotate(0); }
    24% { transform: rotate(75deg); }
  }

  .patrol-panorama {
    position: absolute;
    width: 400%;
    left: -150%;
    top: calc(var(--art-size) * -.45652);
    pointer-events: none;
  }
  .sky {
    z-index: 1;
    top: max(4px, env(safe-area-inset-top));
    width: calc(var(--art-size) * 4);
    left: 50%;
    transform: translateX(-50%);
    overflow: visible;
  }
  .cloud-drift { animation: cloud-drift 48s ease-in-out infinite alternate; }
  @keyframes cloud-drift { from { transform: translateX(-36px); } to { transform: translateX(45px); } }
  .lightning { opacity: 0; animation: distant-strike 19s linear -11s infinite; }
  @keyframes distant-strike {
    0%, 88%, 91%, 100% { opacity: 0; }
    88.4% { opacity: .86; }
    89.2% { opacity: .23; }
  }
  .hero-lockup[data-effects-off] :is(.patrol-panorama, .car-details) { display: none; }
  .landscape {
    z-index: -1;
    top: calc(var(--art-size) * -420 / 460);
    mask-image: radial-gradient(ellipse 53% 54% at 50% 52%, #000 54%, transparent 100%);
  }
  .treeline { animation: forest-pass 18s linear infinite; }
  @keyframes forest-pass { to { transform: translateX(-179px); } }
  .road-travel { animation: road-travel .54s linear infinite; }
  @keyframes road-travel { to { transform: scale(.75); } }
  .rain { mask-image: radial-gradient(ellipse 55% 55% at 50% 47%, #000 20%, transparent 100%); }
  .drizzle { animation: drizzle .94s steps(20) infinite; }
  .downpour { animation: downpour .68s steps(16) infinite; }
  @keyframes drizzle { to { transform: translateY(148px); } }
  @keyframes downpour { to { transform: translateY(236px); } }
  .hero-lockup:is([data-lighting-paused], [data-effects-off]) .scene-motion { animation-play-state: paused; }

  /* Keep the light above BOTH the artwork and the lettering. Blending inside
     the artwork's size container cannot illuminate its sibling wordmark. */
  .headlights {
    display: none;
    position: absolute;
    z-index: 2;
    top: var(--sky-room);
    left: 50%;
    width: var(--art-size);
    height: var(--art-size);
    transform: translateX(-50%);
    overflow: visible;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: .56;
  }

  .siren, .lamp { display: none; position: absolute; pointer-events: none; }
  /* One clock per color keeps the emitter, glass and wet pavement in phase. */
  .beacon-red { --light: 255 47 35; --phase: -.22s; }
  .beacon-blue { --light: 55 113 255; --phase: -1.02s; }
  .beacon-pulse { color: rgb(var(--light)); animation: beacon-sweep 1.6s linear var(--phase) infinite; }
  @keyframes beacon-sweep {
    0%, 50%, 100% { opacity: .035; }
    8% { opacity: .25; }
    13%, 16% { opacity: 1; }
    22% { opacity: .58; }
    35% { opacity: .15; }
  }
  .siren {
    width: 5.65%;
    height: 2.9%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, #fffdf5 0 18%, #ffe9df 25%, currentColor 66%);
  }
  .siren.beacon-red { left: 52.8%; top: 22.3%; }
  .siren.beacon-blue { left: 38.5%; top: 29.1%; }
  .siren::before, .siren::after { content: ""; position: absolute; }
  /* A broad, low-intensity halo in the rain surrounds a narrow optical streak. */
  .siren::before {
    inset: -600% -320%;
    background: radial-gradient(ellipse, rgb(var(--light) / .65), rgb(var(--light) / .28) 30%, transparent 71%);
  }
  .siren::after {
    inset: 32% -215%;
    background: radial-gradient(ellipse, #fff 3%, rgb(var(--light) / .94) 25%, transparent 72%);
  }
  .hero-lockup[data-lighting-paused] .beacon-pulse { animation-play-state: paused; }

  /* Cover the painted cruiser rather than just its roof lights. */
  .siren-toggle {
    position: absolute;
    z-index: 3;
    left: 4%;
    top: 17%;
    width: 92%;
    height: 65%;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
  }
  .siren-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  .lamp {
    width: 4.35%;
    height: 4.35%;
    background: #fff9d6;
    border-radius: 25%;
    filter: blur(.65cqw);
    box-shadow: 0 0 3cqw 1cqw #fff0a970, 0 0 7cqw 2cqw #fff0a91a;
  }
  .lamp-left { left: 61.52%; top: 60.43%; }
  .lamp-right { left: 78.7%; top: 51.96%; }

  .wordmark img { filter: invert(.75); }
  :is(.headlights, .siren, .lamp) { display: block; }
  :root .hero-lockup[data-effects-off] .siren { display: none; }
  .hero-lockup:not([data-effects-off]) { touch-action: pan-y pinch-zoom; }
  .hero-lockup img { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }

  /* Keep the scene on at first paint; use a calmer cadence for reduced motion.
     The OS preference never overrides the cruiser's on/off switch. */
  @media (prefers-reduced-motion: reduce) {
    .drizzle, .downpour, .treeline, .cloud-drift, .lightning, .wiper { animation: none; }
    .road-travel { animation-duration: 3s; }
    .wheel { animation-duration: 2s; }
    .beacon-pulse { animation: gentle-beacon 4s ease-in-out infinite alternate; }
    .beacon-blue { animation-direction: alternate-reverse; }
  }
  @keyframes gentle-beacon { from { opacity: .1; } to { opacity: .55; } }

  @media (max-width: 700px) {
    .hero-lockup { --art-size: clamp(165px, 49vw, 240px); --sky-room: clamp(132px, 32svh, 360px); }
  }

}
