:root {
  --portal-navy: #0a2a66;
  --portal-blue: #168fd2;
  --portal-sky: #32b5ff;
  --portal-ink: #172033;
  --portal-muted: #596579;
  --portal-soft: #f5f7fb;
  --portal-border: #dfe5ee;
  --portal-white: #fff;
  --portal-topbar-h: 72px;
  --portal-nav-h: 47px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.portal-page {
  margin: 0;
  color: var(--portal-ink);
  background: var(--portal-white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--portal-navy); }

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--portal-sky);
  outline-offset: 3px;
}

.portal-header {
  min-height: var(--portal-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px max(18px, calc((100% - 1240px) / 2));
  background: var(--portal-navy);
  color: var(--portal-white);
}

.portal-brandline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-weight: 750;
}

.portal-wordmark { font-size: 1.25rem; white-space: nowrap; }
.portal-wordmark .nova { color: var(--portal-white); }
.portal-wordmark .mobility { color: var(--portal-sky); }
.portal-separator { color: #91a9cd; }
.portal-project-name { font-size: 1.05rem; }

.portal-subtitle {
  margin-top: 2px;
  color: #cad8ed;
  font-size: .78rem;
  letter-spacing: .01em;
}

.portal-logo {
  width: auto;
  height: 38px;
  flex: 0 0 auto;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--portal-white);
}

.portal-nav {
  height: var(--portal-nav-h);
  overflow-x: auto;
  border-bottom: 1px solid var(--portal-border);
  background: var(--portal-white);
  scrollbar-width: thin;
}

.portal-nav-inner {
  width: min(1240px, calc(100% - 36px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 28px;
  white-space: nowrap;
}

.portal-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #526074;
  font-size: .91rem;
  font-weight: 650;
  text-decoration: none;
}

.portal-nav a:hover { color: var(--portal-navy); }

.portal-nav a[aria-current="page"] { color: var(--portal-navy); }

.portal-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--portal-blue);
}

.portal-main { min-height: calc(100vh - 295px); }

.portal-container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.portal-section { padding: 64px 0; }
.portal-section.soft { background: var(--portal-soft); }
.portal-section.compact { padding: 40px 0; }
.portal-section[id] { scroll-margin-top: 24px; }

.portal-eyebrow {
  margin: 0 0 8px;
  color: var(--portal-blue);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.portal-hero {
  padding: 76px 0 68px;
  border-bottom: 1px solid var(--portal-border);
  background: #f9fbfe;
}

.portal-hero h1,
.page-intro h1 {
  max-width: 860px;
  margin: 0;
  color: var(--portal-navy);
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.portal-hero h1 { font-size: clamp(2rem, 4vw, 3.4rem); }

.portal-hero p.hero-copy {
  max-width: 760px;
  margin: 22px 0 0;
  color: #46546a;
  font-size: 1.16rem;
}

.page-intro {
  padding: 58px 0 46px;
  border-bottom: 1px solid var(--portal-border);
  background: #f9fbfe;
}

.page-intro h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); }
.page-intro p { max-width: 760px; margin: 16px 0 0; color: var(--portal-muted); font-size: 1.06rem; }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--portal-navy);
  border-radius: 6px;
  background: var(--portal-navy);
  color: var(--portal-white);
  font-size: .92rem;
  font-weight: 750;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}

.portal-button:hover { background: #123d84; }
.portal-button.secondary { background: var(--portal-white); color: var(--portal-navy); }
.portal-button.secondary:hover { background: #edf3fb; }

.portal-button.is-disabled,
.portal-button[aria-disabled="true"] {
  border-color: #b7bfcc;
  background: #edf0f4;
  color: #697487;
  cursor: not-allowed;
}

.portal-note {
  max-width: 850px;
  margin-top: 24px;
  padding: 13px 16px;
  border-left: 4px solid var(--portal-blue);
  border-radius: 0 5px 5px 0;
  background: #edf6fc;
  color: #34445b;
  font-size: .9rem;
}

.portal-section h2 { margin: 0 0 14px; color: var(--portal-navy); font-size: clamp(1.6rem, 3vw, 2.15rem); line-height: 1.2; }
.portal-section h3 { margin-top: 0; color: var(--portal-navy); }
.section-lead { max-width: 800px; margin: 0 0 30px; color: var(--portal-muted); }

.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.card-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.portal-card {
  padding: 22px;
  border: 1px solid var(--portal-border);
  border-radius: 9px;
  background: var(--portal-white);
  box-shadow: 0 5px 16px rgba(30, 49, 80, .045);
}

.portal-card h3 { margin-bottom: 8px; font-size: 1.05rem; }
.portal-card p { margin: 0; color: var(--portal-muted); font-size: .92rem; }
.portal-card a.stretched-link { display: inline-block; margin-top: 14px; font-weight: 750; text-decoration: none; }
.portal-card a.stretched-link:hover { text-decoration: underline; }

.stat-value { display: block; color: var(--portal-navy); font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 820; line-height: 1.15; }
.stat-label { display: block; margin-top: 7px; color: var(--portal-muted); font-size: .88rem; }

.mode-bar { height: 5px; margin: 18px 0 12px; border-radius: 4px; background: #e7ebf2; overflow: hidden; }
.mode-bar span { display: block; height: 100%; background: var(--portal-blue); }

.workflow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px; counter-reset: stage; }
.workflow.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workflow-step { position: relative; padding: 18px 14px; border: 1px solid var(--portal-border); border-radius: 8px; background: var(--portal-white); color: var(--portal-navy); font-size: .88rem; font-weight: 750; text-align: center; }
.workflow-step::before { counter-increment: stage; content: counter(stage); display: block; width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%; background: var(--portal-navy); color: #fff; line-height: 26px; }
.workflow-step:not(:last-child)::after { content: "›"; position: absolute; right: -17px; top: 50%; color: #8795aa; font-size: 1.5rem; transform: translateY(-50%); }

.content-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.clean-list { margin: 14px 0 0; padding-left: 20px; }
.clean-list li + li { margin-top: 7px; }

.anchor-nav { display: flex; flex-wrap: wrap; gap: 9px; padding: 18px 0; }
.anchor-nav a { padding: 6px 11px; border: 1px solid var(--portal-border); border-radius: 999px; background: #fff; font-size: .84rem; font-weight: 700; text-decoration: none; }
.anchor-nav a:hover { border-color: var(--portal-blue); }

.table-wrap { overflow-x: auto; border: 1px solid var(--portal-border); border-radius: 8px; }
.portal-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
.portal-table th, .portal-table td { padding: 12px 14px; border-bottom: 1px solid var(--portal-border); text-align: left; vertical-align: top; }
.portal-table th { width: 30%; background: #f6f8fb; color: var(--portal-navy); font-weight: 750; }
.portal-table tr:last-child th, .portal-table tr:last-child td { border-bottom: 0; }

.code-block { position: relative; overflow-x: auto; margin: 16px 0 0; padding: 18px; border: 1px solid #253b60; border-radius: 7px; background: #11213d; color: #e8eef7; font: .84rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }
.code-block.light { border-color: var(--portal-border); background: #f7f9fc; color: #263348; }

.faq-list details { padding: 18px 0; border-bottom: 1px solid var(--portal-border); }
.faq-list summary { color: var(--portal-navy); font-weight: 750; cursor: pointer; }
.faq-list details p { max-width: 820px; margin: 10px 0 0; color: var(--portal-muted); }

.paper-meta { display: grid; grid-template-columns: 160px 1fr; gap: 8px 24px; margin: 24px 0; }
.paper-meta dt { color: var(--portal-muted); font-weight: 700; }
.paper-meta dd { margin: 0; }

.portal-footer { padding: 36px 0; border-top: 1px solid var(--portal-border); background: #0b234e; color: #d4deed; font-size: .86rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; }
.portal-footer strong { display: block; color: #fff; font-size: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 20px; }
.footer-links a { color: #fff; }
.footer-use { flex-basis: 100%; text-align: right; color: #acbbd1; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.explorer-portal .portal-header { flex: 0 0 var(--portal-topbar-h); }
body.explorer-portal .portal-nav { flex: 0 0 var(--portal-nav-h); }
body.explorer-portal #app-shell { height: 100vh; }
body.explorer-portal #layout { min-height: 0; }
body.explorer-portal .mobile-od-bar { flex-shrink: 0; }
.stats-definition { margin-top: 5px; color: #5b6576; font-size: 10px; line-height: 1.3; }
.explorer-footer { flex: 0 0 31px; padding: 6px 14px; font-size: 10px; }
.explorer-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; white-space: nowrap; }
.explorer-footer strong { display: inline; font-size: inherit; }
.explorer-footer a { color: #fff; }

@media (max-width: 980px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-step:nth-child(3)::after,
  .workflow.four .workflow-step:nth-child(2)::after { display: none; }
}

@media (max-width: 720px) {
  :root { --portal-topbar-h: 78px; }
  .portal-header { padding: 9px 12px; gap: 10px; }
  .portal-brandline { display: block; line-height: 1.25; }
  .portal-separator { display: none; }
  .portal-project-name { display: block; margin-top: 3px; font-size: .84rem; }
  .portal-subtitle { font-size: .68rem; }
  .portal-logo { height: 31px; }
  .portal-nav-inner { width: max-content; min-width: 100%; padding: 0 14px; gap: 22px; }
  .portal-hero { padding: 52px 0; }
  .portal-section { padding: 48px 0; }
  .content-columns, .card-grid.two, .card-grid.three { grid-template-columns: 1fr; gap: 22px; }
  .footer-inner { flex-direction: column; }
  .footer-links { justify-content: flex-start; }
  .footer-use { text-align: left; }
  body.explorer-portal .portal-subtitle { display: none; }
  .explorer-footer { flex-basis: 29px; padding: 5px 9px; }
  .explorer-footer-inner { justify-content: center; }
  .explorer-footer-inner span:first-child { display: none; }
}

@media (max-width: 520px) {
  .portal-container { width: min(100% - 28px, 1180px); }
  .card-grid, .card-grid.five, .workflow, .workflow.four { grid-template-columns: 1fr; }
  .workflow-step::after { display: none; }
  .portal-hero h1 { font-size: 1.9rem; }
  .page-intro h1 { font-size: 2.1rem; }
  .button-row { flex-direction: column; align-items: stretch; }
  .portal-button { width: 100%; }
  .paper-meta { grid-template-columns: 1fr; gap: 2px; }
  .paper-meta dd { margin-bottom: 12px; }
  body.explorer-portal .portal-wordmark { font-size: .92rem; }
  body.explorer-portal .portal-project-name { font-size: .72rem; }
  body.explorer-portal .portal-logo { height: 27px; }
}
