/* Scoped polish for the existing four-page identity. Load after page styles. */
:root {
  --focus-on-light: #1a62c4;
  --focus-on-dark: #a8ceff;
  --detail-on-dark: #b8cce6;
  --control-on-dark: #e8f1ff;
  --control-border-on-dark: #526c91;
  --consultation-surface: #fff;
  --consultation-backdrop: rgb(4 16 34 / .72);
}

.consultation-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--consultation-surface);
  color: var(--ink);
}
.consultation-dialog::backdrop { background: var(--consultation-backdrop); }
.consultation-dialog-inner { position: relative; padding: 32px 24px 20px; text-align: center; }
.page-shell .consultation-dialog h2 { margin: 8px 40px 10px; font-size: 26px; line-height: 1.4; }
.page-shell .consultation-dialog p { margin: 0; color: var(--muted); font-size: 14px; }
.consultation-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.consultation-close svg { width: 22px; height: 22px; }
.consultation-qr {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 24px auto 12px;
  object-fit: contain;
}
.consultation-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding-inline: 16px;
  color: var(--accent);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .consultation-close:hover { background: var(--line); }
}

.page-shell :is(a, button, summary):focus-visible {
  outline: 2px solid var(--focus-on-light);
  outline-offset: 5px;
}
.page-shell :is(.site-header, .hero, .analysis-hero, .network-hero, .openings) :is(a, button):focus-visible,
.page-shell[data-page="home"] .contact-section :is(a, button):focus-visible {
  outline-color: var(--focus-on-dark);
}
.page-shell :is(.brand, .text-link, .footer-return, .contact-phone, .mini-program-trigger, .hero-scroll, .network-scroll-cue, .motion-toggle) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.page-shell .skip-link {
  position: fixed;
  inset: 12px auto auto 12px;
  z-index: 40;
  padding: 14px 20px;
  background: var(--ink);
  color: var(--control-on-dark);
  transform: translateY(-160%);
}
.page-shell .skip-link:focus { transform: translateY(0); }
.page-shell .footer-brand > strong { white-space: nowrap; }
.page-shell .footer-brand > strong span { display: inline; }
.page-shell .footer .icp-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  font-size: 12px;
  text-underline-offset: 4px;
}
.page-shell .footer .icp-link:hover { text-decoration: underline; }
.network-page .site-footer .network-footer-return { color: var(--ink); }
.network-page .network-footer-return :is(span, svg) { color: inherit; }
.network-page .network-legal h2 { font-size: clamp(32px, 3.3vw, 48px); }
.network-page .network-selector-tabs .network-node strong { color: var(--ink); }
.network-page .network-selector-tabs .network-node.is-active strong { color: var(--accent); }
.network-page .network-selector-tabs .network-node small,
.network-page .network-panel-label span:last-child,
.network-page .network-service-illustration :is(small, figcaption),
.network-page .network-illustration-heading > span { color: var(--muted); }
.service-tabs button { padding-inline-end: 10px; }
.insight-visual :is(li small, figcaption) { color: var(--detail-on-dark); font-size: 12px; }

.page-shell .ambient-toggle {
  position: absolute;
  z-index: 3;
  right: var(--interior-gutter);
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control-border-on-dark);
  border-radius: 6px;
  background: var(--night);
  color: var(--control-on-dark);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ambient-toggle::before { content: "Ⅱ"; font-size: 14px; }
.ambient-toggle[aria-pressed="true"]::before { content: "▷"; }
.ambient-toggle:disabled { cursor: default; color: var(--detail-on-dark); }
.ambient-toggle:disabled::before { display: none; }
/* The legacy hero applies position:relative through three :not() clauses. */
.page-shell.analysis-page .analysis-hero .ambient-toggle { position: absolute; z-index: 3; }

@media (max-width: 600px) {
  .page-shell[data-page="home"] :is(.source-grid p, .section-intro > p:last-child, .service-description > p, .collaboration-services span, .team-method-roles p) {
    font-size: 14px;
    line-height: 1.85;
  }
  .service-tabs button { padding-inline-end: 0; }
  .insight-visual li { padding-right: 4px; }
  .insight-visual li small { font-size: 11px; }
  .ambient-toggle { bottom: 12px; }
}

@media (max-width: 480px) {
  .analysis-page .insight-grid { grid-template-columns: minmax(0, 1fr); }
  .analysis-page .insight-grid article {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 14px;
    min-height: 0;
    padding: 28px 0;
  }
  .analysis-page .insight-grid article:nth-child(n) { border-right: 0; }
  .analysis-page .insight-grid article > span { grid-row: 1 / span 2; padding-top: 4px; }
  .analysis-page .insight-grid h2 { margin: 0 0 10px; }
  .analysis-page .insight-grid p { grid-column: 2; font-size: 16px; line-height: 1.85; }
}
