/* Winch identity: lockup sizes, the footer's mechanism and its closing beat. Generated by the identity
   scene's tools from the mark's own construction (two circles, one tangent run, one vertical fall, the hub
   and the load ring), so the numbers below match the inline drawings in chrome-footer.html and page-brand.html.

   The static markup is the latched frame: the reduced motion, no JS and print state. With JS and full motion
   a mount starts at slack (data-state="armed", every animation paused at its start) and mechanism.js plays it
   once when it is half in view: slack, haul, the catch and hold (the pawl drops and takes the load), latch
   (the hook's gate closes with the one overshoot), a one second hold on the latched frame, then the hardware
   fades and leaves the mark exactly where it stands. 4.8 s in all. Transform and opacity only. Paused
   offscreen and in hidden tabs. */

/* ---------- Lockups, sized by the wordmark's x-height (the lockup is 1.7 x-heights tall) ---------- */
.site-header__lockup { height: 23.76px; width: auto; }
@media (max-width: 767px) { .site-header__lockup { height: 22.06px; } }
.site-footer__lockup { height: 30.55px; width: auto; }

/* ---------- Footer: the machine closes the top row (no panel; the end card is the mark where it stands) ---------- */
.site-footer__top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand machine" "links links"; column-gap: var(--s-5); }
.site-footer__brand { grid-area: brand; min-width: 0; }
.site-footer__links { grid-area: links; }
.site-footer__mechanism {
  grid-area: machine;
  position: relative;
  height: 152px;
  aspect-ratio: 183.12 / 236.88;
  margin: 0;
  border-radius: 0;
  background: none;
  overflow: visible;
}
@media (max-width: 379px) {
  .site-footer__top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "links" "machine"; }
  .site-footer__mechanism { height: 144px; }
}
@media (min-width: 768px) { .site-footer__mechanism { height: 184px; } }
@media (min-width: 1024px) {
  .site-footer__top { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-areas: none; column-gap: var(--grid-gap); }
  .site-footer__brand { grid-area: auto; grid-column: 1 / span 4; }
  .site-footer__links { grid-area: auto; grid-column: 5 / span 5; }
  .site-footer__mechanism { grid-area: auto; grid-column: 10 / span 3; justify-self: end; height: 216px; }
}

/* ---------- Mounts ---------- */
[data-winch-mechanism] { container-type: size; }
.wm {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.site-footer__mechanism .wm { place-items: start end; }
.wm svg { display: block; height: 100cqh; width: auto; max-width: none; overflow: visible; }
.wm-slack { stroke-width: calc(20 * 100cqh / var(--wm-vh)); }

/* ---------- The beat (JS and full motion only) ---------- */
html.js[data-motion="full"] .wm[data-state] .wm-turn { transform-origin: 100px 120px; animation: wm-turn 1.8s 0.2s both; }
html.js[data-motion="full"] .wm[data-state] .wm-slack { transform-origin: 0 0; animation: wm-squash 0.55s var(--e-roll) 0.2s both, wm-off 1ms linear 0.76s both; }
html.js[data-motion="full"] .wm[data-state] .wm-run { animation: wm-on 1ms linear 0.74s both; }
html.js[data-motion="full"] .wm[data-state] .wm-fall { transform-origin: 193.75px 55.12px; animation: wm-fall 1.25s 0.75s both; }
html.js[data-motion="full"] .wm[data-state] .wm-load { animation: wm-lift 1.25s 0.75s both; }
html.js[data-motion="full"] .wm[data-state] .wm-pawl { transform-origin: 58.63px 87.68px; animation: wm-pawl 0.52s 1.07s both; }
html.js[data-motion="full"] .wm[data-state] .wm-gate { transform-origin: 193.75px 147px; animation: wm-gate 0.35s var(--e-latch) 2.7s both; }
html.js[data-motion="full"] .wm[data-state] .wm-flash { animation: wm-flash 0.5s var(--e-glide) 2.78s both; }
html.js[data-motion="full"] .wm[data-state] .wm-hw { animation: wm-fade 0.7s var(--e-glide) 4.1s both; }
html.js[data-motion="full"] .wm[data-state]:not([data-state="playing"]) * { animation-play-state: paused; }
.motion-failsafe .wm * { animation: none !important; }
@media print { .wm * { animation: none !important; } }

/* ---------- Forced colours: the footer's machine takes the visitor's colours ----------
   SVG keeps its own paint in forced colours, and the footer's ink is gone, so the chalk mark would vanish
   on a light canvas and the dark body on a dark one. The drawing's tokens become system colours instead:
   the mark in the text colour, the hardware muted, the body and the ratchet as outlines and the latch's
   flash in the highlight colour. The end card is still the mark where it stands. The brand page's copies
   sit on their own dark panels, which keep their colours (brand.css). */
@media (forced-colors: active) {
  .site-footer__mechanism { --chalk: CanvasText; --on-dark-2: GrayText; --on-dark-3: GrayText; --ink-4: Canvas; --instrument-raised: Canvas; --instrument: Canvas; --rust-light: Highlight; }
  .site-footer__mechanism :is(.wm-plate, .wm-ratchet) { stroke: GrayText; stroke-width: 1.5px; }
}

@keyframes wm-turn { 0% { transform: rotate(0deg); animation-timing-function: var(--e-haul); } 88.89% { transform: rotate(-184deg); animation-timing-function: var(--e-settle); } 100% { transform: rotate(-180deg); } }
@keyframes wm-squash { from { transform: scaleY(1); } to { transform: scaleY(.01); } }
@keyframes wm-fall { 0% { transform: scaleY(1.7); animation-timing-function: var(--e-haul); } 84% { transform: scaleY(0.9652); animation-timing-function: var(--e-settle); } 100% { transform: scaleY(1); } }
@keyframes wm-lift { 0% { transform: translateY(40px); animation-timing-function: var(--e-haul); } 84% { transform: translateY(-2px); animation-timing-function: var(--e-settle); } 100% { transform: translateY(0); } }
@keyframes wm-pawl { 0% { transform: rotate(0deg); animation-timing-function: linear; } 14.42% { transform: rotate(5.01deg); animation-timing-function: linear; } 28.84% { transform: rotate(8.18deg); animation-timing-function: linear; } 43.27% { transform: rotate(10.31deg); animation-timing-function: linear; } 57.69% { transform: rotate(11.8deg); animation-timing-function: linear; } 72.11% { transform: rotate(12.85deg); animation-timing-function: linear; } 86.53% { transform: rotate(13.58deg); animation-timing-function: var(--e-rise); } 100% { transform: rotate(0deg); } }
@keyframes wm-gate { from { transform: rotate(-58deg); } to { transform: rotate(0deg); } }
@keyframes wm-flash { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wm-on { from { opacity: 0; } to { opacity: 1; } }
@keyframes wm-off { from { opacity: 1; } to { opacity: 0; } }
@keyframes wm-fade { from { opacity: 1; } to { opacity: 0; } }
