/*
  CWADM Astro Chrome CSS
  Purpose: tiny Astro-only chrome deltas after exact live base CSS.

  Ownership:
  - allowed here: header positioning, anchor offsets, footer/octopus framing deltas
  - forbidden here: page interiors, Holdings cards, Dispatches cards, CwHeading
*/

/* =========================================================
   HEADER LOCK
   =========================================================
   Sticky failed in the active cascade. Use fixed behavior with a measured
   spacer variable. This keeps the header visible without a huge guessed gap.
*/

:root {
  --cwadm-header-h: 76px;
}

html {
  scroll-padding-top: calc(var(--cwadm-header-h) + 0.8rem) !important;
}

body {
  padding-top: var(--cwadm-header-h) !important;
  margin-top: 0 !important;
  overflow-x: hidden !important;
}

.site-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9000 !important;
  margin-top: 0 !important;
}

#main,
main[id],
section[id] {
  scroll-margin-top: calc(var(--cwadm-header-h) + 0.8rem) !important;
}

/* =========================================================
   FOOTER-CONTAINED OCTOPUS STABILIZATION
   =========================================================
   Live base remains live-derived. This Astro chrome layer neutralizes the
   older awake/stalking cascade by defining one stable footer-contained model.
   No pre-footer flash. No fixed/stalking state. No scroll trigger.
*/

.site-footer {
  overflow: hidden !important;
}

.site-footer .octopus-system {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: 0 !important;
  width: min(1600px, 104vw) !important;
  transform: translateX(-50%) !important;
  opacity: 0.24 !important;
  z-index: 1 !important;
  pointer-events: none !important;
  transition: none !important;
}

.site-footer .octopus-system img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
}

.site-footer .footer-reach-grid {
  position: relative !important;
  z-index: 3 !important;
}

@media (max-width: 980px) {
  .site-footer .octopus-system {
    width: 132vw !important;
  }
}

@media (max-width: 760px) {
  .site-footer .octopus-system {
    width: 124vw !important;
  }
}

@media (max-width: 430px) {
  .site-footer .octopus-system {
    width: 118vw !important;
  }
}

/* =========================================================
   CONTROLLED OCTOPUS STALKING RESTORATION — 2026-07-01
   =========================================================
   Ownership: Astro chrome only.
   JS state owner: assets/js/octopus-system.js.
   Purpose: restore the canon-weighted stalking/footer hook without giving
   site.js, page CSS, or live base competing ownership.
*/

html.cwadm-octopus-stalking-enabled .site-footer {
  overflow: visible !important;
  isolation: isolate !important;
}

html.cwadm-octopus-stalking-enabled .site-footer .octopus-system {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: -1.4rem !important;
  width: min(1850px, 112vw) !important;
  transform: translateX(-50%) translateY(8px) scale(0.985) !important;
  opacity: 0.16 !important;
  z-index: 1 !important;
  pointer-events: none !important;
  transition: opacity 520ms ease, transform 720ms ease, filter 720ms ease !important;
  filter: saturate(0.9) contrast(0.92) !important;
  will-change: opacity, transform !important;
}

html.cwadm-octopus-stalking-enabled .site-footer .octopus-system img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
}

body.octopus-awake .site-footer .octopus-system {
  opacity: 0.34 !important;
  transform: translateX(-50%) translateY(-4px) scale(1) !important;
  filter: saturate(1) contrast(1) !important;
}

body.octopus-awake.octopus-stalking .site-footer .octopus-system {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(-3.5vw, -4.8rem) !important;
  width: min(1920px, 122vw) !important;
  transform: translateX(-50%) translateY(0) scale(1.015) !important;
  opacity: 0.28 !important;
  z-index: 2 !important;
}

html.cwadm-octopus-stalking-enabled .site-footer .footer-reach-grid {
  position: relative !important;
  z-index: 4 !important;
}

@media (max-width: 980px) {
  html.cwadm-octopus-stalking-enabled .site-footer .octopus-system {
    width: 140vw !important;
  }
  body.octopus-awake.octopus-stalking .site-footer .octopus-system {
    width: 150vw !important;
    bottom: -3.2rem !important;
    opacity: 0.24 !important;
  }
}

@media (max-width: 560px) {
  html.cwadm-octopus-stalking-enabled .site-footer .octopus-system {
    width: 178vw !important;
    left: 48% !important;
  }
  body.octopus-awake.octopus-stalking .site-footer .octopus-system {
    width: 190vw !important;
    left: 48% !important;
    opacity: 0.22 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.cwadm-octopus-stalking-enabled .site-footer .octopus-system {
    transition: none !important;
  }
  body.octopus-awake.octopus-stalking .site-footer .octopus-system {
    position: absolute !important;
    bottom: -1.4rem !important;
    opacity: 0.34 !important;
    transform: translateX(-50%) translateY(-4px) scale(1) !important;
  }
}
