/* Round 3 closes verified UX gaps without replacing the accepted Round 2 system. */
html[data-round3-ux-closure] {
  --round3-divider-light: rgba(17, 19, 24, 0.08);
  --round3-divider-dark: rgba(255, 255, 255, 0.1);
}

html.is-mobile-navigation-open,
html.is-mobile-navigation-open body {
  overflow: hidden;
}

/* One full-width separator is authoritative for every shared header. */
html[data-round3-ux-closure] .catalog-header[data-site-navigation-v4],
html[data-round3-ux-closure] .home-redesign-header {
  border: 0 !important;
  box-shadow: none !important;
}

html[data-round3-ux-closure] .catalog-header[data-site-navigation-v4]::after,
html[data-round3-ux-closure] .home-redesign-header::after {
  position: absolute;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--round3-divider-light);
  content: "";
  pointer-events: none;
}

html[data-round3-ux-closure] .home-redesign-header::after {
  background: var(--round3-divider-dark);
}

html[data-round3-ux-closure] .catalog-mobile-nav,
html[data-round3-ux-closure] .home-redesign-header .mobile-nav {
  border-top: 0 !important;
  border-bottom: 0 !important;
}

html[data-round3-ux-closure] .catalog-mobile-nav__inner > a:nth-child(-n + 3)::after,
html[data-round3-ux-closure] .mobile-nav-inner[data-home-navigation] > a:nth-child(-n + 3)::after {
  margin-left: auto;
  color: currentColor;
  content: "›";
  opacity: 0.5;
}

html[data-round3-ux-closure] .catalog-mobile-nav__inner > [data-account-link],
html[data-round3-ux-closure] .mobile-nav-inner[data-home-navigation] > .mobile-login-trigger {
  margin-top: 8px;
  border-top: 1px solid var(--site-navigation-line, #d7d8d5);
}

html[data-round3-ux-closure] .catalog-mobile-nav__workbench,
html[data-round3-ux-closure] .mobile-nav-inner[data-home-navigation] > .mobile-toolbox-trigger {
  min-height: 44px;
  justify-content: center;
  margin-top: 8px;
  border: 1px solid #151515 !important;
  border-radius: 4px;
  background: #151515;
  color: #fff !important;
  font-weight: 700;
}

/* Footer content remains complete, but no longer occupies an oversized band. */
html[data-round3-ux-closure] .site-footer-v3__main {
  min-height: 196px;
}

html[data-round3-ux-closure] .site-footer-v3__grid {
  gap: 32px;
  padding-block: 32px 28px;
}

html[data-round3-ux-closure] .site-footer-v3__social {
  margin-top: 14px;
}

html[data-round3-ux-closure] .site-footer-v3__legal,
html[data-round3-ux-closure] .site-footer-v3__legal-inner {
  min-height: 50px;
}

html[data-round3-ux-closure] .faq-breadcrumb a {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* Homepage micro-polish only. */
html[data-round3-ux-closure] .home-proof-stats > a {
  border-color: rgba(255, 255, 255, 0.065) !important;
}

/* Knowledge Center: replace viewport-edge tabs with compact in-page navigation. */
html[data-round3-ux-closure] .knowledge-round4-page main {
  padding-top: 42px;
}

html[data-round3-ux-closure] .round3-knowledge-intro {
  display: grid;
  max-width: 780px;
  margin-bottom: 28px;
  gap: 7px;
}

html[data-round3-ux-closure] .round3-knowledge-intro p,
html[data-round3-ux-closure] .round3-knowledge-intro h1,
html[data-round3-ux-closure] .round3-knowledge-intro span {
  margin: 0;
}

html[data-round3-ux-closure] .round3-knowledge-intro p {
  color: var(--round4-blue, #2b6bff);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

html[data-round3-ux-closure] .round3-knowledge-intro h1 {
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

html[data-round3-ux-closure] .round3-knowledge-intro span {
  color: var(--round4-muted, #62676f);
  font-size: 15px;
}

html[data-round3-ux-closure] .round4-knowledge-layout {
  display: block;
}

html[data-round3-ux-closure] .round4-map-sidebar {
  display: block;
  margin-bottom: 18px;
}

html[data-round3-ux-closure] .round4-map-sidebar__sticky {
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  display: flex;
  height: auto;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  gap: 8px;
}

html[data-round3-ux-closure] .round3-knowledge-all,
html[data-round3-ux-closure] .round4-map-sidebar__toggle,
html[data-round3-ux-closure] .round4-course-sidebar__toggle {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--round4-line, #d7d8d5);
  border-radius: 999px;
  background: transparent;
  color: var(--round4-ink, #151515);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  writing-mode: initial;
}

html[data-round3-ux-closure] .round3-knowledge-all {
  border-color: var(--round4-ink, #151515);
  background: var(--round4-ink, #151515);
  color: var(--round4-paper, #fff);
}

html[data-round3-ux-closure] .round4-map-sidebar__toggle [data-map-sidebar-label],
html[data-round3-ux-closure] .round4-course-sidebar__toggle span {
  letter-spacing: 0;
  writing-mode: initial;
}

html[data-round3-ux-closure] .round4-map-sidebar__back-icon {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
}

html[data-round3-ux-closure] .round4-map-sidebar__panel {
  position: absolute;
  z-index: 12;
  top: calc(100% + 10px);
  left: 0;
  width: min(1120px, calc(100vw - 48px));
  max-height: min(68vh, 620px);
  border-color: var(--round4-line, #d7d8d5);
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(21, 21, 21, 0.14);
}

html[data-round3-ux-closure] .round4-map-sidebar .round4-map-section {
  padding: 24px;
}

html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage,
html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:last-of-type {
  padding: 12px 16px;
  border-right: 1px solid var(--round4-line, #d7d8d5);
  border-bottom: 0;
}

html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:last-of-type {
  border-right: 0;
}

html[data-round3-ux-closure] .round4-results {
  min-width: 0;
}

/* Tools: the working interface is primary; the partner product remains compact. */
html[data-round3-ux-closure] .software-frequent-grid {
  grid-template-columns: minmax(0, 7fr) minmax(280px, 5fr);
  align-items: start;
}

html[data-round3-ux-closure] .software-frequent-card[data-product-id="youji"] .software-card__media--logo {
  aspect-ratio: 16 / 5;
}

html[data-round3-ux-closure] .software-card__verified-meta {
  margin: 8px 0 0;
  color: var(--text-secondary, #62676f);
  font-size: 12px;
  line-height: 1.5;
}

/* About: compact editorial blocks plus data-driven public proof. */
html[data-round3-ux-closure] .about-capability {
  min-height: 176px;
  padding: 22px 22px 0 0;
  border: 0;
  border-top: 1px solid var(--border-subtle, #d7d8d5);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html[data-round3-ux-closure] .about-capabilities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

html[data-round3-ux-closure] .round3-public-stats {
  display: grid;
  margin: 28px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--border-subtle, #d7d8d5);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

html[data-round3-ux-closure] .round3-public-stats > div {
  padding-inline: 22px;
  border-right: 1px solid var(--border-subtle, #d7d8d5);
}

html[data-round3-ux-closure] .round3-public-stats > div:first-child {
  padding-left: 0;
}

html[data-round3-ux-closure] .round3-public-stats > div:last-child {
  border-right: 0;
}

html[data-round3-ux-closure] .round3-public-stats dt,
html[data-round3-ux-closure] .round3-public-stats dd {
  margin: 0;
}

html[data-round3-ux-closure] .round3-public-stats strong {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 620;
  line-height: 1;
}

html[data-round3-ux-closure] .round3-public-stats dt span {
  margin-left: 5px;
  font-size: 13px;
}

html[data-round3-ux-closure] .round3-public-stats dd {
  margin-top: 7px;
  color: var(--text-secondary, #62676f);
  font-size: 13px;
}

/* Project portal: keep the interaction model and reduce unused vertical space. */
@media (min-width: 768px) {
  html[data-round3-ux-closure] .cooperation-immersive,
  html[data-round3-ux-closure] .cooperation-portal,
  html[data-round3-ux-closure] .cooperation-portal__grid,
  html[data-round3-ux-closure] .cooperation-entry {
    min-height: clamp(580px, 68vh, 710px);
  }
}

/* Initial-structure analysis adapts to the actual number of published plots. */
html[data-round3-ux-closure] .structure-figure-grid[data-figure-count="1"] {
  width: min(100%, 920px);
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr);
}

html[data-round3-ux-closure] .structure-figure-grid[data-figure-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-round3-ux-closure] .structure-figure-grid[data-figure-count="3"],
html[data-round3-ux-closure] .structure-figure-grid[data-figure-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Small verified typography and anchor fixes. */
html[data-round3-ux-closure] .pricing-card__price--quote,
html[data-round3-ux-closure] .pricing-card__term {
  word-break: keep-all;
  overflow-wrap: normal;
}

html[data-round3-ux-closure] :is(
  #course-comparison,
  #course-optical-design-foundation,
  #course-optical-design-advanced,
  #course-stray-light-analysis,
  #course-spectrometer-design,
  .article-prose [id]
) {
  scroll-margin-top: 96px;
}

@media (max-width: 1023px) {
  html[data-round3-ux-closure] .software-frequent-grid {
    grid-template-columns: 1fr;
  }

  html[data-round3-ux-closure] .about-capabilities {
    grid-template-columns: 1fr;
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:nth-child(2) {
    border-right: 0;
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage {
    border-bottom: 1px solid var(--round4-line, #d7d8d5);
  }
}

@media (max-width: 809px) {
  html[data-round3-ux-closure] .home-header-actions[data-home-navigation-actions] {
    display: none;
  }

  html[data-round3-ux-closure] .mobile-nav-inner[data-home-navigation] > a {
    min-height: 54px;
    font-size: 19px;
    line-height: 1.2;
  }

  html[data-round3-ux-closure] .mobile-nav-inner[data-home-navigation] > .mobile-toolbox-trigger {
    font-size: 16px;
  }

  html[data-round3-ux-closure] .site-footer-v3__grid {
    gap: 24px 20px;
    padding-block: 30px 26px;
  }

  html[data-round3-ux-closure] .site-footer-v3__social {
    margin-top: 10px;
  }
}

@media (max-width: 767px) {
  html[data-round3-ux-closure] .knowledge-round4-page main {
    padding-top: 28px;
  }

  html[data-round3-ux-closure] .round3-knowledge-intro {
    margin-bottom: 20px;
  }

  html[data-round3-ux-closure] .round3-knowledge-intro h1 {
    font-size: 34px;
  }

  html[data-round3-ux-closure] .round4-map-sidebar__sticky {
    flex-wrap: wrap;
  }

  html[data-round3-ux-closure] .round3-knowledge-all,
  html[data-round3-ux-closure] .round4-map-sidebar__toggle,
  html[data-round3-ux-closure] .round4-course-sidebar__toggle {
    flex: 1 1 auto;
    padding-inline: 12px;
  }

  html[data-round3-ux-closure] .round4-map-sidebar__panel {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    max-height: calc(100dvh - 160px);
  }

  html[data-round3-ux-closure] .round4-map-sidebar .round4-map-section {
    padding: 18px;
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored {
    grid-template-columns: 1fr;
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage,
  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:nth-child(2),
  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:last-of-type {
    border-right: 0;
    border-bottom: 1px solid var(--round4-line, #d7d8d5);
  }

  html[data-round3-ux-closure] .round4-map-sidebar .knowledge-map--restored .knowledge-map__stage:last-of-type {
    border-bottom: 0;
  }

  html[data-round3-ux-closure] .round3-public-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 0;
  }

  html[data-round3-ux-closure] .round3-public-stats > div:nth-child(2) {
    border-right: 0;
  }

  html[data-round3-ux-closure] .round3-public-stats > div:nth-child(3) {
    padding-left: 0;
  }

  html[data-round3-ux-closure] .structure-figure-grid[data-figure-count] {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-round3-ux-closure] *,
  html[data-round3-ux-closure] *::before,
  html[data-round3-ux-closure] *::after {
    scroll-behavior: auto !important;
  }
}

/* Keep article resource links comfortably tappable when the legacy discovery
   stylesheet is not part of a statically generated article route. */
html[data-round3-ux-closure] .article-related-knowledge .discovery-resource-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding-block: 11px;
}
