/* Shared presentation overrides for the Daochong template and its language mirrors. */

/* The active state is set by ncc-nav-active.js. Keep it visually equivalent
   to a hover state for both the source site and language mirrors. */
.main-nav a.ncc-nav-link--active {
  color: var(--blue-dark) !important;
}

.main-nav a.ncc-nav-link--active::after {
  transform: scaleX(1);
}

/* Footer meta keeps the ICP record on a single line. */
.footer-modern .footer-modern-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Header language switch
   The CMS renders <%language_switch%> as a <details> widget whose trigger
   carries a globe glyph and the full language name ("中文简体" / "English").
   In the header there is no room for that, so the trigger is narrowed down to
   a short CN / EN code and the dropdown items are shortened the same way.
   Colour is set on .header-lang because the generated <summary> hard-codes
   color:inherit inline.
   --------------------------------------------------------------------------- */
.header-actions .header-lang {
  display: inline-flex;
  align-items: center;
  color: var(--navy);
}

.header-lang .ncc-language-switch > summary {
  gap: 3px;
  padding: 8px 9px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .1em;
  transition: border-color .25s, background .25s, color .25s;
}

.header-lang .ncc-language-switch > summary:hover {
  border-color: var(--blue);
  background: var(--soft);
  color: var(--blue-dark);
}

.header-lang .ncc-language-switch > summary > svg:first-child,
.header-lang .ncc-language-switch > summary > span {
  display: none;
}

.header-lang .ncc-language-switch > summary::before {
  content: "CN";
}

html[lang^="en"] .header-lang .ncc-language-switch > summary::before {
  content: "EN";
}

.header-lang .ncc-language-switch > summary > .ncc-language-switch-chevron {
  width: 11px;
  height: 11px;
}

.header-lang .ncc-language-switch > div {
  min-width: 108px !important;
}

.header-lang .ncc-language-switch > div > span,
.header-lang .ncc-language-switch > div > a {
  font-size: 0;
  letter-spacing: .08em;
}

.header-lang .ncc-language-switch > div > span::after,
.header-lang .ncc-language-switch > div > a::after {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
}

.header-lang .ncc-language-switch > div > span[aria-current="true"]::after {
  content: "CN";
}

.header-lang .ncc-language-switch > div > a[data-ncc-language^="en"]::after {
  content: "EN";
}

html[lang^="en"] .header-lang .ncc-language-switch > div > span[aria-current="true"]::after {
  content: "EN";
}

.header-lang .ncc-language-switch > div > a[data-ncc-language^="zh"]::after {
  content: "CN";
}

/* The header hides its action cluster on narrow screens. Keep the language
   switch reachable there by showing the cluster with only the switch inside. */
@media (max-width: 760px) {
  /* Three children stay visible in the mobile bar (brand, action cluster,
     menu button). The base rule is justify-content:space-between, which
     strands the action cluster in the middle of the bar; the auto margin
     pulls it and the menu button together against the right edge. */
  .site-header .brand {
    margin-right: auto;
  }

  /* Only the column gap is tightened, so the wrapped-open nav keeps the
     row spacing the base stylesheet gives it. */
  .site-header .header-inner {
    column-gap: 12px;
  }

  .site-header .header-actions {
    display: inline-flex;
    gap: 10px;
    flex: none;
  }

  .site-header .header-actions .nav-phone,
  .site-header .header-actions .nav-contact {
    display: none;
  }

  .header-lang {
    flex: none;
  }

  .header-lang .ncc-language-switch > summary {
    padding: 7px 8px 7px 10px;
  }

  /* -----------------------------------------------------------------------
     Mobile menu button
     The trigger used to be the word 菜单 / Menu. It is now an icon so the bar
     reads as brand + CN + ☰. It is styled as a chip that matches the language
     switch, and the icon morphs into a close cross while .menu-open is set on
     .site-header (the class script.min.js already toggles).
     ----------------------------------------------------------------------- */
  .site-header .menu-toggle {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--navy);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .25s, background .25s, color .25s;
  }

  /* Widen the touch target to ~44px without changing the visual size. */
  .site-header .menu-toggle::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: inherit;
  }

  .site-header .menu-toggle:hover,
  .site-header .menu-toggle:focus-visible {
    border-color: var(--blue);
    background: var(--soft);
    color: var(--blue-dark);
  }

  .menu-toggle-bars,
  .menu-toggle-bars::before,
  .menu-toggle-bars::after {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .menu-toggle-bars {
    position: relative;
    transition: background .2s .06s;
  }

  .menu-toggle-bars::before,
  .menu-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
  }

  .menu-toggle-bars::before {
    top: -5px;
  }

  .menu-toggle-bars::after {
    top: 5px;
  }

  .site-header.menu-open .menu-toggle-bars {
    background: transparent;
  }

  .site-header.menu-open .menu-toggle-bars::before {
    transform: translateY(5px) rotate(45deg);
  }

  .site-header.menu-open .menu-toggle-bars::after {
    transform: translateY(-5px) rotate(-45deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .menu-toggle,
  .menu-toggle-bars,
  .menu-toggle-bars::before,
  .menu-toggle-bars::after {
    transition: none;
  }
}

/* English copy is substantially longer than Chinese. Scale only the major headings. */
html[lang^="en"] .slide-content h1,
html[lang^="en"] .slide-content h2 {
  max-width: 680px;
  font-size: clamp(34px, 3.1vw, 46px);
  line-height: 1.12;
  letter-spacing: -.025em;
}

html[lang^="en"] .section-intro h2,
html[lang^="en"] .platform-copy h2,
html[lang^="en"] .cta-layout h2,
html[lang^="en"] .page-hero h1,
html[lang^="en"] .subpage-title h2,
html[lang^="en"] .prod-terminal-header h2,
html[lang^="en"] .platform-header h2,
html[lang^="en"] .solution-row-copy h2,
html[lang^="en"] .news-feature h2,
html[lang^="en"] .about-copy h2,
html[lang^="en"] .contact-info h2,
html[lang^="en"] .detail-product-copy h1,
html[lang^="en"] .detail-section-heading h2,
html[lang^="en"] .detail-recommend-header h2,
html[lang^="en"] .service-band-copy h2,
html[lang^="en"] .client-cases-heading h2,
html[lang^="en"] .showcase-content h2,
html[lang^="en"] .company-intro-copy h2,
html[lang^="en"] .solution-detail-hero-copy h1,
html[lang^="en"] .solution-detail-related h2,
html[lang^="en"] .solution-detail-service h2,
html[lang^="en"] .support-hero h1,
html[lang^="en"] .support-faq h2,
html[lang^="en"] .faq-detail-hero-copy h1,
html[lang^="en"] .about-cases-head h2 {
  font-size: clamp(30px, 2.7vw, 40px);
  line-height: 1.2;
  letter-spacing: -.03em;
}

html[lang^="en"] .platform-copy h2 {
  max-width: 700px;
  margin-right: auto;
  margin-left: auto;
  white-space: normal;
}

html[lang^="en"] .platform-copy h2 br {
  display: block;
}

/* CTA bands are shallow horizontal areas; long English calls to action need
   a quieter scale than page-section headings so they do not dominate the image. */
html[lang^="en"] .cta-layout h2 {
  max-width: 760px;
  font-size: clamp(24px, 2vw, 28px);
  line-height: 1.18;
  letter-spacing: -.025em;
}

/* Keep product terminal capabilities legible over the city-network artwork
   even before a card is hovered. */
html[lang^="en"] .prod-terminal-item {
  border: 1px solid rgba(133, 211, 245, .16);
  background: rgba(2, 18, 31, .52);
  box-shadow: 0 12px 28px rgba(0, 9, 18, .2);
  backdrop-filter: blur(3px);
}

html[lang^="en"] .prod-terminal-item:hover {
  background: rgba(6, 53, 77, .72);
  border-color: rgba(94, 200, 242, .38);
}

/* Product-platform figures use concise Chinese measurements in the source;
   their English equivalents need a calmer scale to stay balanced. */
html[lang^="en"] .platform-stat-card .stat-num {
  font-size: 26px;
  line-height: 1.18;
}

html[lang^="en"] .platform-stat-card .stat-num .stat-unit {
  font-size: 17px;
}

html[lang^="en"] .platform-stat-card .stat-label {
  font-size: 12px;
}

/* Capability-panel labels are often longer in English. Show the complete
   label across lines instead of truncating it with an ellipsis. */
html[lang^="en"] .accordion-panel .panel-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

/* English news headlines can be materially longer than their source titles.
   Keep the detail-page banner clear without overpowering the article summary. */
html[lang^="en"] .news-detail-page .page-hero h1 {
  font-size: clamp(28px, 2.3vw, 35px);
  line-height: 1.16;
}

@media (max-width: 760px) {
  .footer-modern .footer-modern-meta {
    gap: 16px;
  }

  html[lang^="en"] .slide-content h1,
  html[lang^="en"] .slide-content h2 {
    font-size: clamp(32px, 9vw, 40px);
  }

  html[lang^="en"] .cta-layout h2 {
    font-size: clamp(23px, 6.5vw, 27px);
  }

  html[lang^="en"] .prod-terminal-item {
    background: rgba(2, 18, 31, .64);
  }

  html[lang^="en"] .platform-stat-card .stat-num {
    font-size: 24px;
  }

  html[lang^="en"] .news-detail-page .page-hero h1 {
    font-size: clamp(27px, 7vw, 32px);
  }

  html[lang^="en"] .section-intro h2,
  html[lang^="en"] .platform-copy h2,
  html[lang^="en"] .cta-layout h2,
  html[lang^="en"] .page-hero h1,
  html[lang^="en"] .subpage-title h2,
  html[lang^="en"] .prod-terminal-header h2,
  html[lang^="en"] .platform-header h2,
  html[lang^="en"] .solution-row-copy h2,
  html[lang^="en"] .news-feature h2,
  html[lang^="en"] .about-copy h2,
  html[lang^="en"] .contact-info h2,
  html[lang^="en"] .detail-product-copy h1,
  html[lang^="en"] .detail-section-heading h2,
  html[lang^="en"] .detail-recommend-header h2,
  html[lang^="en"] .service-band-copy h2,
  html[lang^="en"] .client-cases-heading h2,
  html[lang^="en"] .showcase-content h2,
  html[lang^="en"] .company-intro-copy h2,
  html[lang^="en"] .solution-detail-hero-copy h1,
  html[lang^="en"] .solution-detail-related h2,
  html[lang^="en"] .solution-detail-service h2,
  html[lang^="en"] .support-hero h1,
  html[lang^="en"] .support-faq h2,
  html[lang^="en"] .faq-detail-hero-copy h1,
  html[lang^="en"] .about-cases-head h2 {
    font-size: clamp(28px, 7.5vw, 34px);
  }
}
