/* Shared light-DOM public header and footer (v5). v3/v4 remain for cached pages. */

iproam-public-header,
iproam-public-footer {
  display: block;
}

iproam-public-header {
  position: sticky;
  top: 0;
  z-index: 60;
}

html.route-auth iproam-public-header {
  display: none;
}

:root {
  --ips-header-h: 78px;
}

@media (max-width: 900px) {
  :root {
    --ips-header-h: 68px;
  }
}

.iproam-shell {
  --ips-ink: #10261d;
  --ips-ink-soft: #274236;
  --ips-muted: #4c6157;
  --ips-soft: #6b7d74;
  --ips-line: #dbe5df;
  --ips-surface: #ffffff;
  --ips-alt: #f6f9f7;
  --ips-teal: #12b886;
  --ips-teal-strong: #0c9877;
  --ips-teal-soft: #e6f7f0;
  --ips-focus: #0c9877;
  --ips-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: block;
  color: var(--ips-ink);
  font-family: var(--ips-sans);
}

.iproam-shell *,
.iproam-shell *::before,
.iproam-shell *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

/* Header */

iproam-public-header .ips-nav {
  position: relative;
  top: auto;
  z-index: auto;
  min-height: var(--ips-header-h);
  border-bottom: 1px solid var(--ips-line);
  color: var(--ips-ink);
  background: #ffffff;
}

/* Home route only: let the hero own the first viewport, then solidify the shell on scroll. */
html.route-home iproam-public-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
}

html.route-home iproam-public-header .ips-nav {
  border-bottom-color: transparent;
  background: transparent;
  box-shadow: none;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

html.route-home.shell-scrolled iproam-public-header .ips-nav,
html.route-home iproam-public-header .ips-nav.is-open {
  border-bottom-color: var(--ips-line);
  background: #ffffff;
}

html.route-home.shell-scrolled iproam-public-header .ips-nav {
  box-shadow: 0 1px 2px rgba(16, 38, 29, 0.05), 0 10px 28px rgba(16, 38, 29, 0.06);
}

/* The homepage keeps a few legacy route selectors for its light palette;
   match their specificity so this overlay state wins without !important. */
html.route-home:not(.route-promotions):not(.route-auth) iproam-public-header .ips-nav {
  border-bottom-color: transparent;
  background: transparent;
  box-shadow: none;
}

html.route-home.shell-scrolled:not(.route-promotions):not(.route-auth) iproam-public-header .ips-nav {
  border-bottom-color: var(--ips-line);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 38, 29, 0.05), 0 10px 28px rgba(16, 38, 29, 0.06);
}

/* Open mobile sheet stays opaque even before the scroll threshold. */
html.route-home iproam-public-header .ips-nav.is-open .ips-nav-menu {
  background: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  html.route-home iproam-public-header .ips-nav {
    transition: none !important;
  }
}

iproam-public-header .ips-nav-inner {
  width: min(1200px, calc(100% - 44px));
  min-height: var(--ips-header-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Resource Center routes: align the lockup with the docs rail text column.
   Docs shell = max 1560px, rail 280px, rail inner padding 18px. */
html.route-docs iproam-public-header .ips-nav-inner {
  width: min(1560px, 100%);
  padding-right: 18px;
  padding-left: 18px;
}

iproam-public-header .ips-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

iproam-public-header .ips-brand-lockup {
  display: block;
  width: 198px;
  height: 38px;
  max-width: 198px;
  object-fit: contain;
  filter: none;
}

html.route-promotions iproam-public-header .ips-brand-lockup { filter: none; }

iproam-public-header .ips-nav-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  flex: 1 1 auto;
  min-width: 0;
}

iproam-public-header .ips-nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  min-width: 0;
}

iproam-public-header .ips-nav-links > a,
iproam-public-header .ips-products-btn {
  color: var(--ips-muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: color 150ms ease;
}

iproam-public-header .ips-nav-links > a {
  padding: 6px 0;
}

iproam-public-header .ips-nav-links > a:hover,
iproam-public-header .ips-nav-links > a.active,
iproam-public-header .ips-nav-links > a[aria-current="page"],
iproam-public-header .ips-products-btn:hover,
iproam-public-header .ips-products-btn.active,
iproam-public-header .ips-products-btn[aria-current="page"],
iproam-public-header .ips-products-btn[aria-expanded="true"] {
  color: var(--ips-teal-strong);
}

iproam-public-header .ips-products {
  position: relative;
  display: flex;
  align-items: center;
}

iproam-public-header .ips-products-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

iproam-public-header .ips-products-chevron,
iproam-public-header .lang-chevron {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  transition: transform 160ms ease;
}

iproam-public-header .ips-products-btn[aria-expanded="true"] .ips-products-chevron,
iproam-public-header .lang-dropdown-btn[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

iproam-public-header .ips-products-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: -80px;
  z-index: 120;
  width: 520px;
  max-width: calc(100vw - 32px);
  padding: 10px;
  border: 1px solid var(--ips-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(16, 38, 29, 0.13);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

iproam-public-header .ips-products-menu[hidden],
iproam-public-header .lang-dropdown-menu[hidden] {
  display: none;
}

iproam-public-header .ips-products-menu:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---------- Resource Center panel (v4) ---------- */

iproam-public-header .ips-resources-menu {
  left: auto;
  right: -20px;
  width: 384px;
  padding: 8px;
}

iproam-public-header .rm-group {
  margin: 4px 12px 6px;
  color: var(--ips-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

iproam-public-header .rm-list { gap: 2px; }

iproam-public-header .rm-link {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ips-ink);
  background: #ffffff;
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

iproam-public-header .rm-icon {
  display: block;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex: 0 0 auto;
  color: var(--ips-soft);
  transition: color 150ms ease;
}

iproam-public-header .rm-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

iproam-public-header .rm-body { min-width: 0; }

iproam-public-header .rm-title {
  display: block;
  color: var(--ips-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

iproam-public-header .rm-desc {
  display: block;
  margin-top: 3px;
  color: var(--ips-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: break-word;
}

iproam-public-header .rm-link:hover,
iproam-public-header .rm-link:focus-visible,
iproam-public-header .rm-link.active,
iproam-public-header .rm-link[aria-current="page"] {
  border-color: var(--ips-line);
  background: var(--ips-teal-soft);
}

iproam-public-header .rm-link:hover .rm-title,
iproam-public-header .rm-link:focus-visible .rm-title,
iproam-public-header .rm-link.active .rm-title,
iproam-public-header .rm-link[aria-current="page"] .rm-title {
  color: var(--ips-teal-strong);
}

iproam-public-header .rm-link:hover .rm-icon,
iproam-public-header .rm-link:focus-visible .rm-icon,
iproam-public-header .rm-link.active .rm-icon,
iproam-public-header .rm-link[aria-current="page"] .rm-icon {
  color: var(--ips-teal-strong);
}

/* ---------- Product panel (unchanged structure) ---------- */

iproam-public-header .pm-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

iproam-public-header .pm-card {
  --pm-accent: #1f6b45;
  --pm-soft: #eef5f0;
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 12px 34px 12px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ips-ink);
  background: #ffffff;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}

iproam-public-header .pm-card[data-product-link="mobile"] { --pm-accent: #0d7d94; --pm-soft: #eaf6f9; }
iproam-public-header .pm-card[data-product-link="tunnel"] { --pm-accent: #a96b08; --pm-soft: #fdf4e6; }

iproam-public-header .pm-card:hover,
iproam-public-header .pm-card:focus-visible,
iproam-public-header .pm-card.active,
iproam-public-header .pm-card[aria-current="page"] {
  border-color: var(--pm-accent);
  background: var(--pm-soft);
}

iproam-public-header .pm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  padding: 2px;
  overflow: hidden;
  border: 1px solid var(--ips-line);
  border-radius: 8px;
  background: #ffffff;
}

iproam-public-header .pm-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: scale(1.08);
  transform-origin: center;
}

iproam-public-header .pm-body { min-width: 0; }

iproam-public-header .pm-title {
  display: block;
  color: var(--ips-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

iproam-public-header .pm-desc {
  display: block;
  margin-top: 3px;
  color: var(--ips-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: break-word;
}

iproam-public-header .pm-meta {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ips-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

iproam-public-header .pm-card[data-menu-empty] .pm-meta { display: none; }
iproam-public-header .pm-amount { color: var(--pm-accent); font-size: 15px; font-weight: 900; }

iproam-public-header .pm-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--pm-accent);
  border-right: 2px solid var(--pm-accent);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 150ms ease;
}

iproam-public-header .pm-card:hover .pm-arrow,
iproam-public-header .pm-card:focus-visible .pm-arrow { transform: translate(2px, -50%) rotate(45deg); }

/* Language and auth controls */

iproam-public-header .lang-dropdown { position: relative; display: inline-block; flex: 0 0 auto; }

iproam-public-header .ips-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ips-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

iproam-public-header .ips-btn.ghost { color: var(--ips-muted); background: transparent; }
iproam-public-header .ips-btn.ghost:hover { color: var(--ips-teal-strong); background: var(--ips-teal-soft); }
iproam-public-header .ips-btn.outline { border-color: var(--ips-line); background: #ffffff; }
iproam-public-header .ips-btn.outline:hover { border-color: var(--ips-teal-strong); background: var(--ips-teal-soft); }
iproam-public-header .ips-btn.primary { border-color: var(--ips-teal); color: #ffffff; background: var(--ips-teal); }
iproam-public-header .ips-btn.primary:hover { border-color: var(--ips-teal-strong); background: var(--ips-teal-strong); }

/* Utility-styled language selector: bordered, softly tinted, globe-led. */
iproam-public-header .ips-lang-btn {
  gap: 8px;
  padding: 0 12px;
  border-color: var(--ips-line);
  color: var(--ips-ink-soft);
  background: var(--ips-alt);
}

iproam-public-header .ips-lang-btn:hover,
iproam-public-header .ips-lang-btn[aria-expanded="true"] {
  border-color: var(--ips-teal-strong);
  color: var(--ips-teal-strong);
  background: var(--ips-teal-soft);
}

iproam-public-header .lang-globe {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--ips-soft);
  transition: color 150ms ease;
}

iproam-public-header .ips-lang-btn:hover .lang-globe,
iproam-public-header .ips-lang-btn[aria-expanded="true"] .lang-globe { color: currentColor; }

iproam-public-header .lang-current { min-width: 54px; text-align: left; }

iproam-public-header .lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: max-content;
  min-width: 148px;
  max-height: min(360px, calc(100vh - 120px));
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--ips-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(16, 38, 29, 0.13);
  list-style: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

iproam-public-header .lang-dropdown-menu:not([hidden]) { opacity: 1; pointer-events: auto; transform: translateY(0); }

iproam-public-header .lang-option {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ips-muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
}

iproam-public-header .lang-option:hover,
iproam-public-header .lang-option:focus-visible,
iproam-public-header .lang-option[aria-selected="true"] { color: var(--ips-teal-strong); background: var(--ips-teal-soft); }

iproam-public-header .ips-nav-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
iproam-public-header .ips-nav-actions[data-auth] { display: none !important; }
html.auth-hint-logged-out iproam-public-header .ips-nav-actions[data-auth="unlogged"],
html.auth-hint-logged-in iproam-public-header .ips-nav-actions[data-auth="logged"] { display: flex !important; }
iproam-public-header .ips-nav-actions[hidden] { display: none !important; }

/* Right-hand utility cluster: language and auth controls share one divider. */
iproam-public-header .ips-nav-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
  margin-left: 4px;
  padding-left: 22px;
}

iproam-public-header .ips-nav-tools .ips-nav-actions {
  min-width: 0;
  margin-left: 0;
}

iproam-public-header .ips-nav-tools::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 1px;
  height: 22px;
  background: var(--ips-line);
  transform: translateY(-50%);
  pointer-events: none;
}

html.route-home:not(.shell-scrolled) iproam-public-header .ips-nav-tools::before {
  background: rgba(16, 38, 29, 0.16);
}

iproam-public-header .ips-mobile-toggle {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border: 1px solid var(--ips-line);
  border-radius: 8px;
  color: var(--ips-ink);
  background: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

iproam-public-header .ips-nav a:focus-visible,
iproam-public-header .ips-nav button:focus-visible,
iproam-public-header .ips-nav [tabindex]:focus-visible,
iproam-public-footer a:focus-visible {
  outline: 2px solid var(--ips-focus);
  outline-offset: 2px;
}

/* Footer */

iproam-public-footer .ips-footer {
  border-top: 1px solid var(--ips-line);
  padding: 32px 0 28px;
  color: var(--ips-muted);
  background: #ffffff;
}

iproam-public-footer .ips-footer-inner {
  width: min(1200px, calc(100% - 44px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

iproam-public-footer .ips-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  flex-direction: row;
  flex-wrap: nowrap;
}

iproam-public-footer .ips-footer-copyright,
iproam-public-footer .ips-footer-disclaimer,
iproam-public-footer .ips-footer-registration { font-size: 13px; line-height: 1.5; }
iproam-public-footer .ips-footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; list-style: none; }
iproam-public-footer .ips-footer-links a,
iproam-public-footer .ips-footer-registration a { color: var(--ips-muted); text-decoration: none; }
iproam-public-footer .ips-footer-links a { font-size: 13px; font-weight: 600; }
iproam-public-footer .ips-footer-links a:hover,
iproam-public-footer .ips-footer-registration a:hover { color: var(--ips-teal-strong); }
iproam-public-footer .ips-footer-disclaimer { margin: 0; overflow-wrap: break-word; }
iproam-public-footer .ips-footer-registration { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; }
iproam-public-footer .ips-footer-filing { display: inline-flex; align-items: center; gap: 5px; }
iproam-public-footer .ips-footer-security-icon { width: 18px; height: 20px; flex: 0 0 auto; object-fit: contain; }

@media (max-width: 1120px) and (min-width: 901px) {
  iproam-public-header .ips-nav-inner { gap: 16px; }
  iproam-public-header .ips-nav-menu { gap: 16px; }
  iproam-public-header .ips-nav-links { gap: 16px; }
  iproam-public-header .ips-nav-links > a,
  iproam-public-header .ips-products-btn { font-size: 14px; }
  iproam-public-header .ips-btn { padding: 0 12px; font-size: 13px; }
  iproam-public-header .ips-lang-btn { padding: 0 10px; }
  iproam-public-header .ips-nav-tools { gap: 8px; margin-left: 0; padding-left: 14px; }
}

/* Below the docs three-column breakpoint the rail becomes a drawer and the
   article gutter is 16px, so the header returns to a normal centered rail. */
@media (max-width: 1024px) {
  html.route-docs iproam-public-header .ips-nav-inner {
    width: min(1200px, calc(100% - 32px));
    padding-right: 0;
    padding-left: 0;
  }
}

@media (max-width: 900px) {
  iproam-public-header .ips-nav-inner { min-height: var(--ips-header-h); }
  iproam-public-header .ips-brand-lockup { width: auto; height: 34px; max-width: 177px; }
  iproam-public-header .ips-mobile-toggle { display: inline-flex; }
  iproam-public-header .ips-nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 22px 22px 26px;
    border-bottom: 1px solid var(--ips-line);
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(16, 38, 29, 0.12);
  }
  iproam-public-header .ips-nav.is-open .ips-nav-menu { display: flex; }
  iproam-public-header .ips-nav-links { flex-direction: column; align-items: stretch; width: 100%; gap: 4px; }
  iproam-public-header .ips-nav-links > a { padding: 12px 0; font-size: 16px; }
  iproam-public-header .ips-products { flex-direction: column; align-items: stretch; width: 100%; }
  iproam-public-header .ips-products-btn { width: 100%; justify-content: space-between; padding: 12px 0; font-size: 16px; }
  iproam-public-header .ips-products-menu { position: static; width: 100%; max-width: none; margin-top: 6px; padding: 8px; box-shadow: none; transform: translateY(-4px); }
  iproam-public-header .ips-resources-menu { right: auto; width: 100%; max-width: none; }
  iproam-public-header .ips-products-menu:not([hidden]) { transform: translateY(0); }
  iproam-public-header .rm-link { padding: 12px; }
  iproam-public-header .lang-dropdown { width: 100%; }
  iproam-public-header .lang-dropdown-btn { width: 100%; justify-content: flex-start; }
  iproam-public-header .lang-dropdown-btn .lang-chevron { margin-left: auto; }
  iproam-public-header .lang-dropdown-menu { position: static; width: 100%; margin-top: 8px; box-shadow: none; transform: none; }
  iproam-public-header .ips-nav-actions { width: 100%; flex-direction: column; align-items: stretch; gap: 10px; }
  iproam-public-header .ips-nav-actions .ips-btn { width: 100%; }
  iproam-public-header .ips-nav-tools {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 12px;
    margin-left: 0;
    padding-left: 0;
    padding-top: 18px;
    border-top: 1px solid var(--ips-line);
  }
  iproam-public-header .ips-nav-tools::before { display: none; }
}

@media (max-width: 420px) {
  iproam-public-header .ips-nav-inner { width: min(100% - 28px, 1200px); }
  iproam-public-header .ips-brand-lockup { height: 31px; max-width: 161px; }
}

@media (max-width: 720px) {
  iproam-public-footer .ips-footer { padding: 28px 0 24px; }
  iproam-public-footer .ips-footer-inner { gap: 14px; }
  iproam-public-footer .ips-footer-top {
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }
  iproam-public-footer .ips-footer-links { gap: 8px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .iproam-shell *,
  .iproam-shell *::before,
  .iproam-shell *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Product menu: keep the taller thumbnail from bloating the mobile sheet. */
@media (max-width: 420px) {
  iproam-public-header .pm-card {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    padding: 10px 28px 10px 10px;
  }

  iproam-public-header .pm-icon {
    width: 42px;
    height: 42px;
  }

  iproam-public-header .pm-meta {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding-left: 55px;
  }

  iproam-public-header .pm-arrow {
    right: 11px;
  }
}
