/* ROUTE-5 shared public shell — loaded after page-local styles. */

:root {
  color-scheme: light;
  --shell-accent-text: #0a3dff;
  --shell-page-bg: #f4f7fc;
  --shell-surface: rgba(255, 255, 255, .88);
  --shell-surface-strong: #ffffff;
  --shell-border: rgba(10, 61, 255, .12);
  --shell-shadow: 0 24px 72px rgba(18, 46, 102, .12);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --shell-accent-text: #78b8ff;
  --color-text-primary: #f2f6ff;
  --color-text-secondary: #c2cce0;
  --color-text-tertiary: #8f9cb4;
  --color-text-link: #76a8ff;
  --color-text-link-hover: #a8c8ff;
  --color-bg-primary: #091426;
  --color-bg-secondary: #0f1d33;
  --color-bg-tertiary: #132844;
  --color-bg-inverse: #030a16;
  --color-border-default: rgba(153, 181, 226, .15);
  --color-border-light: rgba(153, 181, 226, .09);
  --color-border-strong: rgba(153, 181, 226, .24);
  --color-primary-light: rgba(64, 124, 255, .18);
  --color-primary-subtle: rgba(64, 124, 255, .1);
  --btn-secondary-gradient-bg: rgba(118, 168, 255, .08);
  --btn-secondary-gradient-border: rgba(118, 168, 255, .28);
  --btn-secondary-text: #edf4ff;
  --btn-secondary-gradient-hover-bg: rgba(118, 168, 255, .16);
  --btn-secondary-gradient-hover-text: #ffffff;
  --shell-page-bg: #060f1f;
  --shell-surface: rgba(11, 25, 46, .9);
  --shell-surface-strong: #0d1a2f;
  --shell-border: rgba(118, 168, 255, .18);
  --shell-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 12% -12%, rgba(10, 61, 255, .08), transparent 34rem),
    var(--shell-page-bg);
}

body.MobileNavLock { overflow: hidden !important; }

.BodyTextFloor { font-size: 16px !important; }

html[data-theme="dark"] body,
html[data-theme="dark"] .Hero,
html[data-theme="dark"] .section,
html[data-theme="dark"] .Section,
html[data-theme="dark"] .legal-container,
html[data-theme="dark"] .article-body,
html[data-theme="dark"] .case-content {
  background-color: var(--color-bg-primary) !important;
  color: var(--color-text-primary);
}

html[data-theme="dark"] .Hero {
  background:
    radial-gradient(ellipse at 72% 22%, rgba(22, 119, 255, .22), transparent 46%),
    radial-gradient(ellipse at 35% 72%, rgba(123, 97, 255, .15), transparent 45%),
    #071324 !important;
}

html[data-theme="dark"] .Section--alt,
html[data-theme="dark"] .section--alt,
html[data-theme="dark"] [class*="Card"],
html[data-theme="dark"] [class*="card"] {
  border-color: var(--color-border-default);
}

html[data-theme="dark"] img:not([src$=".svg"]) { opacity: .94; }

/* The public navigation remains a light, stable brand surface in both themes. */
html[data-theme="dark"] .SiteHeader,
html[data-theme="dark"] .MobileNav {
  color-scheme: light;
  --color-primary: #0a3dff;
  --color-primary-hover: #0830d6;
  --color-primary-active: #0626b0;
  --color-primary-light: rgba(10, 61, 255, .1);
  --color-text-primary: #1f2329;
  --color-text-secondary: #1f2329;
  --color-text-tertiary: #1f2329;
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f2f4f7;
  --color-bg-tertiary: #e6f2ff;
  --color-border-default: rgba(0, 0, 0, .06);
  --color-border-strong: rgba(0, 0, 0, .1);
}

html[data-theme="dark"] .SiteHeader,
html[data-theme="dark"] .SiteHeader.SiteHeader--scrolled {
  background: rgba(255, 255, 255, .94) !important;
  border-bottom: 1px solid rgba(10, 61, 255, .1);
  box-shadow: 0 10px 34px rgba(13, 41, 92, .08);
  backdrop-filter: blur(14px) saturate(165%);
  -webkit-backdrop-filter: blur(14px) saturate(165%);
}

html[data-theme="dark"] .MobileNav { background: #ffffff; }

/* Inner-page Heroes stay light, so their typography must keep light-theme contrast. */
html[data-theme="dark"] .BrandHero:not(.BrandHero--case-detail) {
  color-scheme: light;
  --color-primary: #0a3dff;
  --color-primary-hover: #0830d6;
  --color-primary-active: #0626b0;
  --color-primary-light: rgba(10, 61, 255, .1);
  --color-primary-subtle: rgba(10, 61, 255, .06);
  --color-text-primary: #172033;
  --color-text-secondary: #3e4b60;
  --color-text-tertiary: #5e6b80;
  --color-text-link: #0a3dff;
  --color-text-link-hover: #0830d6;
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f5f7fb;
  --color-bg-tertiary: #eaf2ff;
  --color-border-default: rgba(23, 32, 51, .1);
  --color-border-light: rgba(23, 32, 51, .06);
  --color-border-strong: rgba(23, 32, 51, .16);
  color: var(--color-text-primary);
}

/* Low-contrast blue, purple and red content accents converge on bright blue. */
html[data-theme="dark"] body :is(
  [class*="--blue"],
  [class*="--purple"],
  [class*="--red"],
  [class*="--info"],
  .section-label,
  .SectionLabel,
  .CompanyPos__statValue,
  .CapModule__num,
  .ServeCard__tag,
  .TimelineItem__year,
  .tab-nav__btn[aria-selected="true"],
  .product-panel__feature-icon,
  .product-panel__usecase-tag,
  .dataflow-visual__node--source,
  .dataflow-visual__node--process,
  .network-visual__node--1,
  .network-visual__node--3,
  .products-grid__item-link,
  .service-dashboard__card-trend--stable,
  .policy-insight-card__tag,
  .hero-report-card__scoreValue,
  .report-sample__scoreValue--primary,
  .report-sample__riskBadge--high,
  .form-group__required,
  .form-group__error,
  .form-global-error,
  [style*="color:var(--color-primary)"],
  [style*="color: var(--color-primary)"],
  [style*="color:var(--color-info)"],
  [style*="color: var(--color-info)"],
  [style*="color:var(--color-error)"],
  [style*="color: var(--color-error)"],
  [style*="color:var(--color-brand-accent-purple)"],
  [style*="color: var(--color-brand-accent-purple)"]
):not(.SiteHeader *, .MobileNav *, .Footer *, .BrandHero *, .CtaSection *, .cta-section *) {
  color: var(--shell-accent-text) !important;
}

.SiteHeader--scrolled {
  background: color-mix(in srgb, var(--color-bg-primary) 88%, transparent);
  box-shadow: 0 10px 34px rgba(13, 41, 92, .06);
}

.SiteHeader__navLink:focus-visible,
.MegaMenu__link:focus-visible,
.MegaMenu__highlightLink:focus-visible,
.MobileNav a:focus-visible,
.MobileNav button:focus-visible,
.Footer a:focus-visible,
.ThemeToggle:focus-visible,
.xlx-floating-btn:focus-visible {
  outline: 3px solid rgba(22, 119, 255, .38);
  outline-offset: 3px;
  border-radius: 8px;
}

.ThemeToggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border-default);
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-bg-primary) 84%, transparent);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s ease, color .2s ease, background .2s ease, border-color .2s ease;
}

.ThemeToggle:hover {
  transform: translateY(-1px);
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-color: rgba(10, 61, 255, .28);
}

.ThemeToggle svg { width: 19px; height: 19px; }
.ThemeToggle__moon { display: none; }
html[data-theme="dark"] .ThemeToggle__sun { display: none; }
html[data-theme="dark"] .ThemeToggle__moon { display: block; }

.Footer {
  --footer-container-main: min(72vw, 1280px);
  --footer-padding-inline: clamp(24px, 2.5vw, 48px);
  box-sizing: border-box;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-secondary) 92%, var(--color-primary) 8%), var(--color-bg-secondary));
  border-top: 1px solid var(--color-border-default);
  padding: clamp(40px, 4vw, 64px) 0 clamp(24px, 2vw, 40px);
}

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

.Footer > .site-container {
  width: 100%;
  max-width: var(--footer-container-main);
  margin: 0 auto;
  padding: 0 var(--footer-padding-inline);
}

.Footer__grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 3vw, 48px);
  align-items: start;
}

.Footer__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.Footer__brand img {
  display: block;
  width: auto;
  height: 32px;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}

html[data-theme="dark"] .Footer__brand img {
  height: 44px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
}

.Footer__brand p {
  max-width: 280px;
  margin: 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-small);
  line-height: 1.65;
}

.Footer__col { min-width: 0; }

.Footer__col h5 {
  margin: 0 0 16px;
  color: var(--color-text-primary);
  font-size: var(--text-small);
  font-weight: var(--font-weight-semibold);
}

.Footer__col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.Footer__col li { margin: 0 0 8px; }

.Footer__col a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--color-text-tertiary);
  font-size: var(--text-small);
  line-height: 1.45;
  text-decoration: none;
  transition: color .2s ease;
}

.Footer__col a:hover { color: var(--color-text-primary); }

.Footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border-default);
  color: var(--color-text-tertiary);
  font-size: var(--text-small);
}

.xlx-floating-widget {
  position: fixed;
  right: 20px;
  bottom: 32px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.xlx-floating-btn {
  min-width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
  box-shadow: 0 12px 34px rgba(10, 35, 78, .15);
  color: var(--color-text-secondary);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  transition: transform .22s ease, background .22s ease, color .22s ease, opacity .22s ease;
}

.xlx-floating-btn:hover {
  transform: translateY(-2px);
  background: var(--btn-gradient);
  color: #fff;
}

.xlx-floating-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.xlx-floating-btn__label { font-size: 13px; font-weight: var(--font-weight-medium); white-space: nowrap; }
.xlx-floating-btn--top { width: 46px; padding: 0; opacity: 0; pointer-events: none; transform: translateY(10px); }
.xlx-floating-btn--top.xlx-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.CookieNotice {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 95;
  width: min(calc(100% - 32px), 760px);
  transform: translate(-50%, 24px);
  opacity: 0;
  visibility: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--shell-border);
  border-radius: 18px;
  background: var(--shell-surface);
  box-shadow: var(--shell-shadow);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

.CookieNotice--visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.CookieNotice__title { margin: 0 0 4px; font-size: 16px; font-weight: var(--font-weight-semibold); color: var(--color-text-primary); }
.CookieNotice__text { margin: 0; font-size: 14px; line-height: 1.65; color: var(--color-text-secondary); }
.CookieNotice__text a { white-space: nowrap; }
.CookieNotice__actions { display: flex; align-items: center; gap: 8px; }

body.MobileNavLock .CookieNotice,
body.MobileNavLock .xlx-floating-widget {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.SystemPage,
.LegalPage {
  min-height: 100vh;
  padding: clamp(120px, 13vw, 180px) var(--container-padding-inline) clamp(72px, 9vw, 120px);
  background:
    radial-gradient(circle at 72% 18%, rgba(0, 212, 255, .13), transparent 24rem),
    radial-gradient(circle at 20% 35%, rgba(123, 97, 255, .1), transparent 27rem),
    var(--shell-page-bg);
}

.SystemPage__inner,
.LegalPage__inner {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.SystemPage__panel,
.LegalPage__panel {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 68px);
  border: 1px solid var(--shell-border);
  border-radius: clamp(22px, 3vw, 36px);
  background: var(--shell-surface);
  box-shadow: var(--shell-shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.SystemPage__code,
.LegalPage__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}

.SystemPage h1,
.LegalPage h1 {
  margin: 0 0 20px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.08;
}

.SystemPage__lead,
.LegalPage__lead {
  max-width: 760px;
  margin: 0 0 30px;
  font-size: clamp(17px, 1.4vw, 21px);
  line-height: 1.8;
  color: var(--color-text-secondary);
}

.SystemPage__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.LegalPage__content { max-width: 820px; }
.LegalPage__content h2 { margin: 42px 0 14px; font-size: clamp(24px, 2.4vw, 34px); }
.LegalPage__content h3 { margin: 28px 0 10px; }
.LegalPage__content p,
.LegalPage__content li { font-size: max(16px, var(--text-body)); line-height: 1.85; color: var(--color-text-secondary); }
.LegalPage__content ul { padding-left: 1.3em; }
.LegalPage__meta { margin-bottom: 30px; color: var(--color-text-tertiary); font-size: 14px; }

@media (max-width: 768px) {
  .ThemeToggle { width: 42px; height: 42px; }
  .SiteHeader__actions { gap: 7px; }
  .xlx-floating-widget { right: 12px; bottom: 16px; }
  .xlx-floating-btn { min-width: 44px; height: 44px; padding: 0 11px; }
  .xlx-floating-btn__label { display: none; }
  .xlx-floating-btn--top { width: 44px; padding: 0; }
  .CookieNotice { grid-template-columns: 1fr; bottom: 12px; padding: 16px; }
  .CookieNotice__actions { justify-content: flex-end; }
  .SystemPage,
  .LegalPage { padding-left: 18px; padding-right: 18px; }
  .SystemPage__actions .btn { width: 100%; }
  .Footer {
    --footer-container-main: 100%;
    --footer-padding-inline: 20px;
  }
  .Footer__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .Footer__bottom { margin-top: 32px; text-align: center; justify-content: center; }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .Footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .Hero__inner {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .Hero__content,
  .Hero__visual,
  .Hero__actions,
  .ComplianceConsole {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .CookieNotice,
  .ThemeToggle,
  .xlx-floating-btn { transition: none; }
}
