/* ============================================================================
   AFS BRANDS — UNIFIED SITE SHELL (HEADER, MEGA-MENU, FOOTER & ACCESSIBILITY)
   Single Source of Truth across all canonical routes (P0 / P2)
   WCAG 2.2 AA contrast | 44x44px mobile touch targets | Reduced-motion safe
   ============================================================================ */

/* Global Reduced Motion Guardrail (P2) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   1. UNIFIED STICKY HEADER & NAVIGATION
   ============================================================================ */
header#afs-utility-top.afs-shell-header,
body[data-afs-pilot-layout] > header#afs-utility-top.afs-shell-header,
body.afs-stable-header > header#afs-utility-top.afs-shell-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 950 !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  inline-size: 100% !important;
  max-width: none !important;
  max-inline-size: none !important;
  margin: 0 !important;
  margin-inline: 0 !important;
  padding: 0 !important;
  padding-inline: 0 !important;
  padding-block: 0 !important;
  min-height: 70px !important;
  background: rgba(250, 250, 250, 0.97) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--afs-border-subtle, #e5e3db) !important;
  box-shadow: 0 1px 0 rgba(24, 25, 23, 0.04);
  font-family: var(--afs-font-sans, 'DM Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif) !important;
}

.afs-shell-header-inner {
  position: relative;
  box-sizing: border-box;
  width: min(1240px, calc(100% - 80px));
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.4vw, 20px);
}

.afs-shell-brand {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0;
  text-decoration: none !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1;
}

body header#afs-utility-top.afs-shell-header .afs-sprig-header,
body header#afs-utility-top.afs-shell-header .afs-sprig-header.afs-logo-kit-header--standard,
body header#afs-utility-top.afs-shell-header .afs-logo-kit-header {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  padding-block: 0 !important;
  margin: 0 !important;
  --afs-sprig-size: clamp(166px, 14vw, 204px);
}

body header#afs-utility-top.afs-shell-header .afs-shell-brand img,
body header#afs-utility-top.afs-shell-header .afs-sprig-header img,
body header#afs-utility-top.afs-shell-header .afs-logo-kit-header img {
  display: block !important;
  width: clamp(166px, 14vw, 204px) !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 28px !important;
  object-fit: contain;
  margin: 0 !important;
}

/* Primary Nav Bar */
nav#afs-shell-nav.afs-shell-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: center;
  gap: clamp(4px, 1vw, 14px) !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
  position: static !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

nav#afs-shell-nav.afs-shell-nav > a,
nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 6px 8px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 6px;
  background: transparent !important;
  color: var(--afs-ink-primary, #181917) !important;
  font: 600 14px/1.2 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  letter-spacing: -0.005em;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary::-webkit-details-marker {
  display: none;
}

nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-top: -2px;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
  opacity: 0.72;
}

nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 2px;
}

nav#afs-shell-nav.afs-shell-nav > a:hover,
nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary:hover {
  color: var(--afs-ink-primary, #181917) !important;
  background: #f1efe8 !important;
}

nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown[open] > summary {
  color: var(--afs-ink-primary, #181917) !important;
  background: #eae7de !important;
}

nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary:focus:not(:focus-visible) {
  box-shadow: none !important;
  outline: none !important;
}

nav#afs-shell-nav.afs-shell-nav > a[aria-current="page"],
nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary[aria-current="true"] {
  color: var(--afs-terracotta, #a65339) !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 6px !important;
}

/* Dropdown & Mega-Menu Containers */
.afs-shell-dropdown {
  position: relative;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.afs-shell-dropdown--mega {
  position: static;
}

.afs-shell-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1000;
  min-width: 248px;
  padding: 12px;
  background: #ffffff !important;
  border: 1px solid var(--afs-border-default, #d4d2c9) !important;
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(24, 25, 23, 0.14);
  color: var(--afs-ink-primary, #181917);
  text-align: left;
}

.afs-shell-dropdown--mega > .afs-shell-panel {
  box-sizing: border-box;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: 24px 28px 20px;
  border-radius: 0 0 12px 12px;
  border-top: 2px solid var(--afs-terracotta, #a65339) !important;
}

/* Simple Dropdown List */
.afs-shell-panel--compact ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.afs-shell-panel--compact a {
  display: flex !important;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px !important;
  border-radius: 7px;
  color: var(--afs-ink-primary, #181917) !important;
  text-decoration: none !important;
  font: 600 14px/1.25 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.afs-shell-panel--compact a span {
  font-size: 12px;
  font-weight: 400;
  color: var(--afs-ink-muted, #5c615a);
  line-height: 1.3;
}

.afs-shell-panel--compact a:hover,
.afs-shell-panel--compact a[aria-current="page"] {
  background: var(--afs-bg-subtle, #f4f2eb) !important;
  color: var(--afs-terracotta, #a65339) !important;
}

/* Mega-Menu Grids */
.afs-mega-grid {
  display: grid;
  gap: 22px 24px;
  align-items: start;
}

.afs-mega-grid--products {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.afs-mega-grid--sectors {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.afs-mega-col {
  min-width: 0;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.afs-mega-col h2 {
  margin: 0 0 10px !important;
  padding: 0 0 6px !important;
  border-bottom: 1px solid var(--afs-border-subtle, #e5e3db);
  font: 700 12px/1.25 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--afs-olive, #4f583c) !important;
}

.afs-mega-col h2 a {
  color: inherit !important;
  text-decoration: none !important;
}

.afs-mega-col h2 a:hover {
  color: var(--afs-terracotta, #a65339) !important;
  text-decoration: underline !important;
}

.afs-mega-subhead {
  margin: 10px 0 4px !important;
  font: 700 11px/1.2 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--afs-ink-muted, #5c615a) !important;
}

.afs-mega-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.afs-mega-col ul a {
  display: block !important;
  padding: 5px 6px !important;
  margin-inline: -6px;
  border-radius: 5px;
  color: var(--afs-ink-primary, #181917) !important;
  font: 500 13.5px/1.35 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  text-decoration: none !important;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.afs-mega-col ul a:hover,
.afs-mega-col ul a[aria-current="page"] {
  background: var(--afs-bg-subtle, #f4f2eb) !important;
  color: var(--afs-terracotta, #a65339) !important;
}

.afs-mega-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--afs-border-subtle, #e5e3db);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  font-size: 13px;
  color: var(--afs-ink-secondary, #4a4e49);
}

.afs-mega-foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.afs-mega-foot a {
  color: var(--afs-ink-primary, #181917) !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

.afs-mega-foot a:hover {
  color: var(--afs-terracotta, #a65339) !important;
  text-decoration: underline !important;
}

/* Header Right Utility Slot */
.afs-shell-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

body header#afs-utility-top.afs-shell-header .afs-header-quote-btn {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 16px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  background: var(--afs-terracotta, #a65339) !important;
  border: 1px solid var(--afs-terracotta, #a65339) !important;
  color: #ffffff !important;
  font: 700 13.5px/1 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
  letter-spacing: 0 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  flex-shrink: 0;
}

body header#afs-utility-top.afs-shell-header .afs-header-quote-btn:hover {
  background: var(--afs-terracotta-hover, #8c422b) !important;
  border-color: var(--afs-terracotta-hover, #8c422b) !important;
}

.afs-shell-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--afs-border-default, #d4d2c9);
  border-radius: 8px;
  background: #ffffff;
  color: var(--afs-ink-primary, #181917);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.afs-shell-mobile-toggle:hover {
  background: var(--afs-bg-subtle, #f4f2eb);
  border-color: var(--afs-ink-primary, #181917);
}

/* Tablet / Medium Desktop Responsive Adjustments */
@media (max-width: 1220px) {
  .afs-mega-grid--products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  nav#afs-shell-nav.afs-shell-nav {
    gap: 2px !important;
  }
  nav#afs-shell-nav.afs-shell-nav > a,
  nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary {
    padding: 6px 6px !important;
    font-size: 13.5px !important;
  }
}

/* Mobile Drawer Breakpoint */
@media (max-width: 1060px) {
  .afs-shell-header-inner {
    width: calc(100% - 44px);
    padding: 10px 0;
    gap: 8px;
  }

  .afs-shell-brand {
    min-width: 0;
    flex: 0 1 auto;
    max-width: calc(100% - 180px);
  }

  body header#afs-utility-top.afs-shell-header .afs-sprig-header,
  body header#afs-utility-top.afs-shell-header .afs-sprig-header.afs-logo-kit-header--standard {
    width: auto !important;
    max-width: 136px !important;
    --afs-sprig-size: 132px;
    --afs-sprig-phone-size: 132px;
  }

  body header#afs-utility-top.afs-shell-header .afs-shell-brand img,
  body header#afs-utility-top.afs-shell-header .afs-sprig-header img {
    width: 132px !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .afs-shell-actions {
    gap: 6px;
  }

  .afs-shell-mobile-toggle {
    display: inline-flex;
    flex-shrink: 0;
  }

  nav#afs-shell-nav.afs-shell-nav {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 980 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
    padding: 14px 16px 24px !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--afs-border-default, #d4d2c9) !important;
    box-shadow: 0 20px 40px rgba(24, 25, 23, 0.16) !important;
  }

  nav#afs-shell-nav.afs-shell-nav.is-open {
    display: flex !important;
  }

  nav#afs-shell-nav.afs-shell-nav > a,
  nav#afs-shell-nav.afs-shell-nav > .afs-shell-dropdown > summary {
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    min-height: 46px;
    padding: 10px 12px !important;
    font-size: 15px !important;
    border-bottom: 1px solid #f0efe9 !important;
    border-radius: 6px;
  }

  .afs-shell-panel,
  .afs-shell-dropdown--mega > .afs-shell-panel {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin: 4px 0 8px !important;
    padding: 12px 14px !important;
    border: 1px solid #e7e5dd !important;
    border-radius: 8px !important;
    background: #fafafa !important;
    box-shadow: none !important;
  }

  .afs-mega-grid--products,
  .afs-mega-grid--sectors {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .afs-mega-col ul a,
  .afs-shell-panel--compact a {
    min-height: 44px;
    display: flex !important;
    align-items: center;
  }

  header#afs-utility-top.afs-shell-header .afs-header-quote-btn {
    min-height: 44px;
    padding: 8px 10px !important;
    font-size: 12.5px !important;
  }

  header#afs-utility-top.afs-shell-header .afs-header-shortlist-pill {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .afs-shell-header-inner {
    width: calc(100% - 32px);
  }
}

/* ============================================================================
   2. HIDE LEGACY BACK-TO-PREVIOUS-PAGE INJECTIONS
   ============================================================================ */
nav.afs-single-back[data-afs-page-navigation],
.afs-enquiry-heading-tools > .afs-contact-back {
  display: none !important;
}

/* ============================================================================
   3. UNIFIED 5-COLUMN FOOTER (GUARANTEED IDENTICAL ACROSS ALL PAGES)
   ============================================================================ */
footer.full-footer.afs-site-footer {
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
  margin-bottom: 0 !important;
  border-radius: 0 !important;
  background: #181917 !important;
  color: #dedede !important;
  font-family: var(--afs-font-sans, 'DM Sans', system-ui, sans-serif) !important;
}

footer.full-footer.afs-site-footer > .afs-footer-inner {
  width: min(1240px, calc(100% - 80px)) !important;
  max-width: 1240px !important;
  margin-inline: auto !important;
  padding: clamp(40px, 4vw, 56px) 0 28px !important;
  box-sizing: border-box;
}

footer.full-footer.afs-site-footer .afs-footer-grid--5col {
  display: grid !important;
  grid-template-columns: minmax(0, 1.45fr) repeat(4, minmax(0, 1fr)) !important;
  gap: 28px clamp(18px, 2.5vw, 38px) !important;
  align-items: start;
}

@media (max-width: 1020px) {
  footer.full-footer.afs-site-footer .afs-footer-grid--5col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  footer.full-footer.afs-site-footer .afs-footer-grid--5col > .afs-footer-contact {
    grid-column: 1 / -1;
    padding-bottom: 20px;
    border-bottom: 1px solid #353734;
  }
}

@media (max-width: 520px) {
  footer.full-footer.afs-site-footer .afs-footer-grid--5col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px 14px !important;
  }
}

footer.full-footer.afs-site-footer .afs-utility-row {
  width: min(1240px, calc(100% - 80px));
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 0 20px;
  border-top: 1px solid #2b2d2a;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  box-sizing: border-box;
}

@media (max-width: 1000px) {
  footer.full-footer.afs-site-footer > .afs-footer-inner,
  footer.full-footer.afs-site-footer .afs-utility-row,
  nav.afs-breadcrumb {
    width: calc(100% - 44px) !important;
  }
}

@media (max-width: 760px) {
  footer.full-footer.afs-site-footer > .afs-footer-inner,
  footer.full-footer.afs-site-footer .afs-utility-row,
  nav.afs-breadcrumb {
    width: calc(100% - 32px) !important;
  }
}

footer.full-footer.afs-site-footer .afs-utility-row a {
  display: inline-flex !important;
  align-items: center;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 600;
  color: #e6e8e2 !important;
}

/* ============================================================================
   4. SEMANTIC BREADCRUMB TRAIL (P2)
   ============================================================================ */
nav.afs-breadcrumb {
  box-sizing: border-box;
  width: min(1240px, calc(100% - 80px));
  margin: 0 auto;
  padding: 8px 0 0;
  font: 500 13.5px/1.3 var(--afs-font-sans, 'DM Sans', system-ui, sans-serif);
  color: var(--afs-ink-muted, #5c615a);
}

nav.afs-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.afs-breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

nav.afs-breadcrumb li + li::before {
  content: "/";
  color: #8b8f88;
}

nav.afs-breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--afs-ink-secondary, #4a4e49);
  text-decoration: none;
  font-weight: 600;
}

nav.afs-breadcrumb a:hover {
  color: var(--afs-terracotta, #a65339);
  text-decoration: underline;
  text-underline-offset: 3px;
}

nav.afs-breadcrumb [aria-current="page"] {
  color: var(--afs-ink-primary, #181917);
  font-weight: 700;
}

@media (max-width: 760px) {
  nav.afs-breadcrumb a {
    min-height: 44px;
  }
}
