/* =========================================================================
   Perth Mega Menu — brand tokens
   Palette: signal red, charcoal, white, warm-grey neutrals. Anton carries
   weight on the trigger/category names; IBM Plex Mono handles the
   breadcrumb and CTA text as a nod to spec-sheet/trade-catalogue material.
   ========================================================================= */
.pmm {
  --pmm-red: #E23038;
  --pmm-red-dark: #B4202A;
  --pmm-red-tint: #FBE9E9;
  --pmm-charcoal: #1B1B1D;
  --pmm-charcoal-soft: #2A2A2D;
  --pmm-white: #FFFFFF;
  --pmm-grey-100: #F5F4F2;
  --pmm-grey-200: #ECEAE6;
  --pmm-grey-300: #DCDAD6;
  --pmm-grey-500: #8B8983;
  --pmm-font-display: 'Anton', Impact, sans-serif;
  --pmm-font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --pmm-font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --pmm-radius: 3px;
  --pmm-speed: 180ms;
  --pmm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pmm-panel-max-height: 560px; /* JS overwrites this per-open based on real viewport space */

  position: relative;
  font-family: var(--pmm-font-body);
  color: var(--pmm-charcoal);
}

.pmm *, .pmm *::before, .pmm *::after { box-sizing: border-box; }

/* Defensive reset — theme global styles routinely beat scoped rules on
   specificity; forcing the handful of properties that matter for
   legibility rather than trusting cascade order. */
.pmm h1, .pmm h2, .pmm h3, .pmm h4, .pmm h5, .pmm h6 {
  margin: 0 !important; padding: 0 !important; line-height: 1.2 !important;
}
.pmm ul, .pmm ol { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.pmm p { margin: 0 !important; }
.pmm a, .pmm button { text-decoration: none !important; box-shadow: none !important; }

/* ---------- Trigger ---------- */
.pmm__trigger {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--pmm-charcoal) !important;
  color: var(--pmm-white) !important;
  border: none; padding: 14px 22px;
  font-family: var(--pmm-font-display);
  font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; border-radius: var(--pmm-radius);
  transition: background var(--pmm-speed) var(--pmm-ease);
}
.pmm__trigger:hover,
.pmm__trigger[aria-expanded="true"] { background: var(--pmm-red) !important; }
.pmm__trigger:focus-visible { outline: 3px solid var(--pmm-red); outline-offset: 2px; }
.pmm__trigger-icon { display: inline-flex; flex-direction: column; gap: 4px; width: 18px; }
.pmm__trigger-icon span { display: block; height: 2px; background: currentColor; }

/* ---------- Panel shell ---------- */
.pmm__backdrop {
  position: fixed; inset: 0; background: rgba(27,27,29,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity var(--pmm-speed) var(--pmm-ease);
  z-index: 999998;
}
.pmm__backdrop.is-visible { opacity: 1; pointer-events: auto; }

.pmm__panel {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: max-content; max-width: min(1280px, 94vw);
  background: var(--pmm-white) !important;
  border: 1px solid var(--pmm-grey-300);
  box-shadow: 0 24px 48px -12px rgba(27,27,29,0.28);
  border-radius: var(--pmm-radius);
  z-index: 999999;
  opacity: 0; transform: translateY(-6px); visibility: hidden;
  display: flex; flex-direction: column;
  max-height: var(--pmm-panel-max-height);
  transition: opacity var(--pmm-speed) var(--pmm-ease),
              transform var(--pmm-speed) var(--pmm-ease),
              visibility 0s linear var(--pmm-speed);
}
.pmm__panel.is-open {
  opacity: 1; transform: translateY(0); visibility: visible;
  transition: opacity var(--pmm-speed) var(--pmm-ease), transform var(--pmm-speed) var(--pmm-ease);
}
.pmm__panel::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }

.pmm__close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border: none; background: transparent; color: var(--pmm-grey-500);
  font-size: 22px; line-height: 1; cursor: pointer; z-index: 2;
}
.pmm__close:hover { color: var(--pmm-red); }

/* ---------- Breadcrumb ---------- */
.pmm__breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 12px 44px 12px 20px;
  border-bottom: 1px solid var(--pmm-grey-300);
  background: var(--pmm-grey-100);
  font-family: var(--pmm-font-mono);
  font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase;
  flex: 0 0 auto;
}
.pmm__breadcrumb:empty { display: none; }
.pmm__crumb {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  color: var(--pmm-grey-500) !important;
}
.pmm__crumb:hover { color: var(--pmm-red) !important; }
.pmm__crumb.is-current { color: var(--pmm-charcoal) !important; font-weight: 700; }
.pmm__crumb-sep { color: var(--pmm-grey-300); }

/* ---------- Body: levels + feature ---------- */
.pmm__body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0; /* required so children can actually be scrollable inside a flex box */
  overflow: hidden;
}

.pmm__levels {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;      /* Firefox: scroll works, bar hidden */
  -ms-overflow-style: none;   /* old Edge/IE */
}
.pmm__levels::-webkit-scrollbar { display: none; } /* Chrome/Safari: scroll works, bar hidden */

.pmm__level {
  flex: 0 0 232px;
  width: 232px;
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--pmm-grey-300);
  padding: 8px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pmm__level::-webkit-scrollbar { display: none; }
.pmm__level:first-child { background: var(--pmm-grey-100); flex-basis: 248px; width: 248px; }

.pmm__item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 11px 18px;
  border: none; background: transparent;
  border-left: 3px solid transparent;
  font-size: 14px; color: var(--pmm-charcoal) !important;
  cursor: pointer;
  transition: background var(--pmm-speed) var(--pmm-ease), border-color var(--pmm-speed) var(--pmm-ease);
}
.pmm__level:first-child .pmm__item {
  font-family: var(--pmm-font-display); font-size: 13px;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.pmm__item:hover, .pmm__item:focus-visible { background: var(--pmm-grey-100) !important; }
.pmm__level:first-child .pmm__item:hover { background: var(--pmm-white) !important; }
.pmm__item.is-active {
  background: var(--pmm-red-tint) !important;
  border-left-color: var(--pmm-red);
  color: var(--pmm-red-dark) !important;
  font-weight: 600;
}
.pmm__item-arrow { opacity: 0.5; font-size: 13px; flex: 0 0 auto; }
.pmm__item.is-active .pmm__item-arrow { opacity: 1; color: var(--pmm-red); }

/* ---------- Feature / image panel ---------- */
.pmm__feature {
  flex: 0 0 300px; width: 300px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px;
  color: var(--pmm-white) !important;
}
.pmm__feature-media {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--pmm-charcoal) 0%, var(--pmm-charcoal-soft) 100%);
}
.pmm__feature-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.pmm__feature-media::after {
  /* overlay so white text stays legible over any photo */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(27,27,29,0.15) 0%, rgba(27,27,29,0.75) 100%);
}
/* Designed fallback pattern used when a category has no thumbnail set —
   deliberately typographic/architectural rather than a generic stock photo. */
.pmm__feature-media.is-fallback {
  background:
    repeating-linear-gradient(135deg, rgba(226,48,56,0.10) 0 2px, transparent 2px 26px),
    linear-gradient(160deg, var(--pmm-charcoal) 0%, var(--pmm-charcoal-soft) 100%);
}
.pmm__feature-media.is-fallback::before {
  content: attr(data-initial);
  position: absolute; right: 8px; bottom: -18px;
  font-family: var(--pmm-font-display);
  font-size: 148px; line-height: 1; color: rgba(255,255,255,0.06);
}

.pmm__feature-body { position: relative; z-index: 1; }
.pmm__feature-eyebrow {
  font-family: var(--pmm-font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--pmm-red) !important; display: block; margin-bottom: 6px !important;
}
.pmm__feature-title {
  font-family: var(--pmm-font-display); text-transform: uppercase; font-size: 22px;
  color: var(--pmm-white) !important;
}
.pmm__feature-desc {
  font-size: 12.5px; color: rgba(255,255,255,0.75) !important; margin-top: 6px !important;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pmm__feature-cta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  color: var(--pmm-white) !important; font-family: var(--pmm-font-mono);
  font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase;
  border-bottom: 1px solid var(--pmm-red);
}
.pmm__feature-cta:hover { color: var(--pmm-red) !important; }

/* focus visibility everywhere inside the menu */
.pmm a:focus-visible, .pmm button:focus-visible {
  outline: 3px solid var(--pmm-red); outline-offset: -2px;
}

/* ---------- Mobile accordion ---------- */
.pmm-mobile { display: none; }

@media (max-width: 900px) {
  .pmm__panel { display: none !important; }

  .pmm-mobile {
    position: fixed; inset: 0; z-index: 1000000;
    background: var(--pmm-white);
    transform: translateX(-100%);
    transition: transform var(--pmm-speed) var(--pmm-ease);
    display: flex; flex-direction: column;
  }
  .pmm-mobile.is-open { transform: translateX(0); }

  .pmm-mobile__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; background: var(--pmm-charcoal); color: var(--pmm-white);
    font-family: var(--pmm-font-display); text-transform: uppercase; letter-spacing: 0.03em;
    flex: 0 0 auto;
  }
  .pmm-mobile__header .pmm__close { position: static; color: var(--pmm-white); }

  .pmm-mobile__breadcrumb {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 18px;
    background: var(--pmm-grey-100); border-bottom: 1px solid var(--pmm-grey-300);
    font-family: var(--pmm-font-mono); font-size: 11px; text-transform: uppercase;
    flex: 0 0 auto;
  }
  .pmm-mobile__breadcrumb:empty { display: none; }
  .pmm-mobile__breadcrumb button { background: none; border: none; color: var(--pmm-grey-500) !important; cursor: pointer; }
  .pmm-mobile__breadcrumb button.is-current { color: var(--pmm-charcoal) !important; font-weight: 700; }

  .pmm-mobile__list { overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: none; -ms-overflow-style: none; }
  .pmm-mobile__list::-webkit-scrollbar { display: none; }

  .pmm-acc-item { border-bottom: 1px solid var(--pmm-grey-300); }
  .pmm-acc-row {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: none; border: none; text-align: left;
    font-size: 15px; font-weight: 600; color: var(--pmm-charcoal) !important; cursor: pointer;
  }
  .pmm-acc-row[aria-expanded="true"] { color: var(--pmm-red) !important; }
  .pmm-acc-caret {
    transition: transform var(--pmm-speed) var(--pmm-ease);
    font-size: 12px; color: var(--pmm-grey-500);
  }
  .pmm-acc-row[aria-expanded="true"] .pmm-acc-caret { transform: rotate(90deg); color: var(--pmm-red); }

  .pmm-acc-panel {
    max-height: 0; overflow: hidden;
    transition: max-height var(--pmm-speed) var(--pmm-ease);
    background: var(--pmm-grey-100);
  }
  .pmm-acc-panel.is-open { max-height: 3000px; }
  .pmm-acc-panel a {
    display: block; padding: 10px 18px 10px 32px;
    font-size: 14px; color: var(--pmm-charcoal-soft) !important;
  }
  .pmm-acc-panel a:hover { color: var(--pmm-red) !important; }
  .pmm-acc-view-all {
    font-weight: 700; text-transform: uppercase; font-size: 12px;
    letter-spacing: 0.03em; color: var(--pmm-red) !important;
    border-bottom: 1px solid var(--pmm-grey-300);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pmm * { transition-duration: 0.01ms !important; }
}
