/* Public pages share Material roles with the administration console. */
html:root body { font: var(--md-body-large); }
html:root :is(body, .site-shell) { color: var(--ink); background: var(--md-surface); }
html:root .site-header { background: color-mix(in srgb, var(--md-surface) 94%, transparent); border-color: var(--line); }
html:root .site-brand { color: var(--ink); font: var(--md-title-large); font-weight: 600; }
html:root .brand-mark { border-radius: 12px; color: var(--md-on-primary); background: var(--md-primary); font: var(--md-title-medium); font-weight: 600; }
html:root .site-nav a { height: 42px; border-radius: 24px; color: var(--ink-soft); font: var(--md-label-large); }
html:root .site-nav a:hover { color: var(--primary); background: var(--md-surface-high); }
html:root .site-nav a.nav-current { color: var(--md-on-primary-container); background: var(--primary-container); }
html:root .site-nav a.nav-current::after { display: none; }
html:root :is(.page-heading h1, .article-page h1, .detail-heading h1, .local-ip-heading h1) { color: var(--ink); font: var(--md-heading-1); letter-spacing: 0; overflow-wrap: anywhere; }
html:root :is(.eyebrow, .local-ip-eyebrow) { color: var(--primary); font: var(--md-label-large); }
html:root :is(.page-heading p, .merchant-heading .merchant-intro, .method-summary p, .article-summary) { color: var(--ink-soft); font: var(--md-body-large); }
html:root :is(.panel-heading h2, .content-panel > h2, .chart-heading h2, .method-summary h2, .cpu-benchmark-heading, .network-source-heading) { color: var(--ink); font: var(--md-heading-2); }
html:root .result-heading { color: var(--ink); font: var(--md-heading-3); }
html:root .benchmark-card h2 { color: var(--ink); font: var(--md-heading-2); }
html:root :is(.panel-heading p, .chart-heading p, .updated-time, .detail-address, .detail-window, .merchant-heading .merchant-regions, .section-intro, .route-caption, .panel-intro, .method-caveat, .table-footnote, .inventory-meta, .inventory-fields dt, .chart-footer, .chart-coverage, .news-meta, .article-page time, .local-ip-heading p) { color: var(--muted); font: var(--md-body-medium); }
html:root :is(.directory-panel, .content-panel, .news-card, .detail-metrics, .page-stats) { border-color: var(--line); border-radius: var(--md-radius); background: var(--surface); box-shadow: none; }
html:root .page-stats { gap: 8px; padding: 12px 18px; color: var(--md-on-primary-container); background: var(--primary-container); border-color: transparent; font: var(--md-body-medium); }
html:root .page-stats b { color: inherit; font: var(--md-headline-small); }
html:root .filter-bar { background: var(--md-surface-low); border-color: var(--line-soft); padding-top: 16px; padding-bottom: 16px; }
html:root :is(.search-field, .select-field, .filter-select-trigger, .public-form input, .public-form select, .public-form textarea, .detail-controls select, .history-target-form select) { color: var(--ink); border-color: var(--md-outline); border-radius: 10px; background: var(--surface); min-height: 48px; }
html:root :is(.search-field input, .select-field select, .filter-select-trigger, .public-form input, .public-form textarea) { color: var(--ink); font: var(--md-body-large); }
html:root :is(.public-form label, .detail-controls label, .history-target-form label, .selected-probe, .result-meta) { color: var(--ink-soft); font: var(--md-body-medium); }
html:root :is(input, textarea)::placeholder { color: var(--muted); opacity: .8; }
html:root :is(.search-field:focus-within, .select-field:focus-within, .public-form input:focus, .public-form textarea:focus, .public-form select:focus) { border-color: var(--primary); box-shadow: var(--md-focus); }
html:root :is(.selected-probe, .filter-select-menu, .chart-tooltip) { color: var(--ink-soft); background: var(--surface); border-color: var(--line); }
html:root .filter-select-menu { border-radius: 12px; box-shadow: var(--md-shadow); }
html:root :is(.selected-probe b, .result-meta b, .last-test b) { color: var(--ink); font-weight: 500; }
html:root :is(.filter-select-option, .filter-select-trigger) { color: var(--ink); }
html:root :is(.filter-select-option:hover, .filter-select-option:focus-visible) { background: var(--md-surface-high); }
html:root .filter-select-option.is-selected { background: var(--primary-container); color: var(--md-on-primary-container); }
html:root .filter-select-chevron { border-color: var(--muted); }
html:root :is(.breadcrumbs, .result-block > p, .route-result > p, .tcp-mini-canvas) { color: var(--muted); }
html:root :is(.network-table thead, .data-table thead, .result-meta) { background: var(--md-surface-container); }
html:root :is(.network-table th, .data-table th) { color: var(--ink-soft); font: var(--md-title-small); }
html:root :is(.network-table td, .data-table td) { color: var(--ink); font: var(--md-body-medium); }
html:root :is(.network-table tbody tr, .data-table tbody tr, .detail-metric + .detail-metric, .facts-list > div, .server-facts, .server-facts > div, .article-body, .inventory-fields > div, .inventory-meta) { border-color: var(--line-soft); }
html:root :is(.network-table tbody tr:hover, .data-table tbody tr:hover) { background: var(--md-surface-low); }
html:root :is(.merchant-name, .table-link) { color: var(--ink); font: var(--md-title-medium); }
html:root :is(.public-ip, .detail-address code, .data-table td code) { color: var(--ink); font-family: var(--md-mono); font-size: .875rem; font-weight: 500; }
html:root :is(.network-table td > small, .network-table th small, .last-test small, .merchant-cell > span, .metric-value span, .metric-value b small, .availability + small, .trend-wrap small) { color: var(--muted); font: var(--md-body-small); }
html:root :is(.metric-value b, .availability, .data-table td.benchmark-score) { color: var(--primary); font: var(--md-title-medium); font-variant-numeric: tabular-nums; }
html:root :is(.detail-metric > span, .detail-metric > small, .facts-list dt, .server-facts span, .benchmark-meta, .benchmark-unit, .benchmark-scores span, .inventory-fields dd) { color: var(--ink-soft); font: var(--md-body-medium); }
html:root .detail-metric > b { color: var(--primary); font: var(--md-headline-medium); font-variant-numeric: tabular-nums; }
html:root .detail-metric > b.route-value { color: var(--ink); font: var(--md-body-large); }
html:root .benchmark-scores b { color: var(--primary); font: var(--md-display); font-variant-numeric: tabular-nums; }
html:root :is(.facts-list dd, .server-facts b, .inventory-section h3, .news-card h2 a) { color: var(--ink); font-weight: 500; }
html:root :is(.detail-anchor, .text-link, .breadcrumbs a, .login-footnote a, .ip-detail-link, .merchant-name:hover, .table-link:hover, .sort-button:hover, .sort-button.sort-selected) { color: var(--primary); text-decoration-color: currentColor; }
html:root :is(.primary-button, .outlined-button, .outlined-link, .text-button, .login-link, .merchant-website-link) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 24px; padding: 10px 20px; font: var(--md-label-large); }
html:root .primary-button { color: var(--md-on-primary); background: var(--primary); border-color: var(--primary); }
html:root .primary-button:hover { color: var(--md-on-primary); background: color-mix(in srgb, var(--primary) 90%, var(--md-on-primary)); }
html:root :is(.outlined-button, .outlined-link, .login-link) { color: var(--primary); border-color: var(--md-outline); background: transparent; }
html:root :is(.outlined-button:hover, .outlined-link:hover, .login-link:hover, .text-button:hover) { color: var(--primary); background: var(--md-surface-high); }
html:root .text-button { color: var(--primary); }
html:root :is(.detail-tabs, .admin-tabs) { gap: 24px; border-color: var(--line); }
html:root :is(.detail-tabs a, .detail-tabs button, .admin-tabs button) { color: var(--ink-soft); font: var(--md-label-large); min-height: 48px; }
html:root :is(.detail-tabs a.tab-current, .detail-tabs button.tab-current, .admin-tabs button.admin-tab-active) { color: var(--primary); font-weight: 600; }
html:root :is(.detail-tabs a.tab-current, .detail-tabs button.tab-current, .admin-tabs button.admin-tab-active)::after { background: var(--primary); }
html:root .route-label { color: var(--md-on-primary-container); border-color: transparent; background: var(--primary-container); border-radius: 8px; font: var(--md-label-medium); }
html:root :is(.route-mixed, .carrier-line--standard) { color: var(--md-on-warning-container); background: var(--md-warning-container); border-color: transparent; }
html:root :is(.route-direct) { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }
html:root :is(.route-unknown, .route-external, .carrier-line--unknown) { color: var(--ink-soft); background: var(--md-surface-container); border-color: var(--line); }
html:root .carrier-line--premium { color: var(--md-on-success-container); background: var(--md-success-container); border-color: transparent; }
html:root .carrier-line { font: var(--md-label-medium); padding: 5px 10px; border-radius: 8px; }
html:root .carrier-lines-caption { color: var(--muted); font: var(--md-body-medium); }
html:root :is(.route-hop-scroll, .route-hop-table, .result-block pre, .inventory-instructions p) { color: var(--ink); background: var(--md-surface-low); border-color: var(--line); }
html:root .route-hop-table { font-family: var(--md-font); font-size: .875rem; line-height: 1.65; }
html:root .route-hop-table code { font-family: var(--md-mono); }
html:root .route-hop-table :is(th, td) { border-color: var(--line-soft); }
html:root :is(.route-hop-table th, .route-hop-table small, .route-caption, .route-raw summary) { color: var(--muted); }
html:root :is(.chart-ranges, .chart-status, .cpu-chart-empty) { background: var(--md-surface-low); border-color: var(--line); color: var(--muted); }
html:root .chart-ranges { border-radius: 24px; padding: 4px; }
html:root .chart-ranges button { color: var(--ink-soft); min-height: 36px; border-radius: 24px; font: var(--md-label-large); }
html:root .chart-ranges button[aria-pressed="true"] { color: var(--md-on-primary-container); background: var(--primary-container); box-shadow: none; }
html:root :is(.chart-tooltip-time, .chart-tooltip-row > b) { color: var(--ink); }
html:root :is(.chart-tooltip-name, .chart-tooltip-row > small, .chart-tooltip-time > small, .chart-eyebrow, .chart-series-toggle, .chart-granularity) { color: var(--muted); }
html:root .chart-eyebrow { font: var(--md-label-medium); letter-spacing: .025rem; }
html:root :is(.chart-series-toggle, .chart-tooltip-name, .chart-tooltip-row > small, .chart-tooltip-time > small) { font-size: .75rem; line-height: 1.5; }
html:root :is(.chart-axis-label, .cpu-axis-label, .cpu-axis-time) { fill: var(--muted); }
html:root :is(.chart-gridline, .cpu-grid-line) { stroke: var(--line); }
html:root .chart-tooltip-row { border-color: var(--line-soft); }
html:root :is(.article-body, .article-body p, .news-card p) { color: var(--ink); font: var(--md-body-large); line-height: 1.85; }
html:root .article-body h2 { color: var(--ink); font: var(--md-heading-2); margin: 1.5em 0 .65em; }
html:root .article-body h3 { color: var(--ink); font: var(--md-heading-3); }
html:root .news-card { padding: 24px; }
html:root .news-card h2 { font: var(--md-heading-2); }
html:root :is(.news-categories a, .news-pagination a, .article-term) { border-radius: 10px; font: var(--md-label-large); }
html:root :is(.news-categories a.selected, .article-category) { color: var(--md-on-primary-container); background: var(--primary-container); border-color: transparent; }
html:root .site-footer { background: var(--surface); border-color: var(--line); }
html:root .site-footer > div > a { color: var(--ink); font: var(--md-title-medium); }
html:root :is(.site-footer > div > span, .site-footer nav a, .site-footer small) { color: var(--muted); font: var(--md-body-small); }
html:root :is(.demo-note, .detail-demo-note, .admin-notice) { color: var(--md-on-warning-container); background: var(--md-warning-container); border-color: transparent; }
html:root :is(.demo-note, .detail-demo-note, .admin-notice) :is(b, span) { color: inherit; }
html:root :is(.form-success, .admin-feedback) { color: var(--md-on-success-container); background: var(--md-success-container); }
html:root :is(.form-message, .availability-low) { color: var(--md-warning); }
html:root .destructive-text { color: var(--md-error); }
html:root .theme-toggle { color: var(--ink-soft); width: 44px; height: 44px; flex-basis: 44px; }
html:root .theme-toggle:hover { color: var(--primary); background: var(--md-surface-high); }
/* Legacy dark selectors include compound hover selectors inside :is(). Keep
   these semantic roles explicit so they win without !important declarations. */
html:root[data-theme="dark"] :is(.breadcrumbs a, .detail-anchor, .text-link, .ip-detail-link:hover, .outlined-link, .outlined-button, .login-link, .text-button, .site-nav a:hover, .sort-button.sort-selected) { color: var(--primary); }
html:root[data-theme="dark"] :is(.detail-tabs a.tab-current, .detail-tabs button.tab-current, .admin-tabs button.admin-tab-active) { color: var(--primary); }
html:root[data-theme="dark"] :is(.detail-tabs a.tab-current, .detail-tabs button.tab-current, .admin-tabs button.admin-tab-active)::after { background: var(--primary); }
/* Local diagnostics retain their row-based results and visitor-only execution. */
html:root #local-ip-tool {
  --local-accent: var(--md-primary); --local-strong: var(--md-on-primary-container); --local-tint: var(--md-primary-container);
  --local-ink: var(--md-on-surface); --local-muted: var(--md-on-surface-variant); --local-line: var(--md-outline-variant);
  --local-bg: var(--md-surface); --local-card: var(--surface); --local-soft: var(--md-surface-low);
  --probe-fast: var(--md-success); --probe-medium: var(--md-secondary); --probe-slow: var(--md-warning); --probe-failed: var(--md-error);
}
html:root #local-ip-tool .primary-button { color: var(--md-on-primary); background: var(--primary); border-color: var(--primary); border-radius: 24px; box-shadow: none; }
html:root #local-ip-tool .outlined-button { border-radius: 24px; }
html:root #local-ip-tool .primary-button:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 90%, var(--md-on-primary)); border-color: var(--primary); }
html:root :is(body, .site-shell):has(#local-ip-tool) { background: var(--md-surface); }
html:root #local-ip-tool .local-ip-split-address[data-empty="true"] { color: var(--local-muted); }
html:root #local-ip-tool :is(.local-ip-card-label, .local-ip-card p, .local-ip-card-source, .local-ip-summary-footer, .local-ip-mask, .local-ip-exits, .local-ip-exit, .local-ip-privacy, .local-ip-site-info small, .local-ip-mobile-meta, .local-ip-mobile-meta .local-ip-split-state, .local-ip-note, .local-ip-legend, .local-ip-group-summary, .local-ip-method summary, .local-ip-method p, .local-ip-probe small, #local-finished) { font: var(--md-body-small); }
html:root #local-ip-tool :is(.local-ip-statusbar p, .local-ip-section-header p, .local-ip-secondary, .local-ip-search input, .local-ip-group-header > button, .local-ip-site-name) { font: var(--md-body-medium); }
html:root #local-ip-tool :is(.local-ip-split-table th, .local-ip-tabs > button) { font: var(--md-label-large); }
html:root #local-ip-tool :is(.local-ip-secondary, .outlined-button, .primary-button) { min-height: 44px; }
html:root :is(.risk-fields dt, .risk-time, .risk-dnsbl-intro) { color: var(--muted); opacity: 1; font: var(--md-body-small); }
html:root .risk-dnsbl-status[data-tone="clear"] { color: var(--md-on-success-container); background: var(--md-success-container); }
html:root :is(.risk-dnsbl-status[data-tone="error"], .risk-dnsbl-status[data-tone="listed"]) { color: var(--md-on-error-container); background: var(--md-error-container); }
html:root .risk-dnsbl-status[data-tone="policy"] { color: var(--md-on-warning-container); background: var(--md-warning-container); }
@media (max-width: 760px) {
  html:root :is(.page-heading h1, .detail-heading h1, .article-page h1, .local-ip-heading h1) { font: var(--md-heading-1); }
  html:root .site-nav { gap: 4px; }
  html:root .site-nav a { height: 40px; padding: 0 14px; }
  html:root .news-card { padding: 20px; }
  html:root .result-heading { font: var(--md-heading-3); }
}


/* IBM palette selected by the site owner. Keep the page and cards neutral. */
html:root .site-header { background: var(--shell-header); border-color: var(--shell-outline); }
html:root .site-header .site-brand { color: var(--shell-on-header); }
html:root .site-header .site-nav a { color: var(--shell-muted); }
html:root .site-header .site-nav a:hover,
html:root .site-header .site-nav a.nav-current { color: var(--shell-on-header); background: var(--shell-selected); }
html:root .site-header .theme-toggle { color: var(--shell-muted); }
html:root .site-header .theme-toggle:hover { color: var(--shell-on-header); background: var(--shell-selected); }
html:root .site-header .login-link { color: var(--shell-on-header); border-color: var(--shell-muted); }
html:root .site-header .login-link:hover { background: var(--shell-selected); }
html:root .page-stats { color: var(--ink-soft); background: var(--surface); border-color: var(--line); }
html:root :is(.eyebrow, .local-ip-eyebrow) { color: var(--muted); }
html:root :is(.metric-value b, .detail-metric > b, .benchmark-scores b, .data-table td.benchmark-score) { color: var(--ink); }
html:root :is(.network-table, .data-table) td .availability { color: var(--md-success); }
/* Region names are body text, not a document heading; keep 18px on mobile too. */
html:root .overseas-route-title { margin: 0; color: var(--ink); font: 400 1.125rem/1.6 var(--md-font); }
html:root .route-heading .route-arrow { color: var(--muted); }
html:root #local-ip-tool .local-ip-card-primary .local-ip-protocol,
html:root #local-ip-tool .local-ip-tabs > button span { color: var(--md-on-primary-container); }

/* Keep the complete detail navigation below the actual main header height. */
html:root {
  --site-header-height: 68px;
  --detail-tabs-height: 0px;
  scroll-padding-top: calc(var(--site-header-height) + var(--detail-tabs-height));
}
html:root .detail-section-tabs {
  position: sticky;
  top: var(--site-header-height);
  z-index: 9;
  flex-wrap: wrap;
  gap: 0 24px;
  background: var(--md-surface);
  border-bottom: 1px solid var(--line);
}
html:root .detail-section-tabs a { padding: 0 8px; }
html:root .detail-section-tabs a:hover { background: var(--md-surface-high); color: var(--primary); }
html:root .site-content :is([id], .result-block, .result-heading) { scroll-margin-top: 16px; }
html:root [data-chart="handshake"] .chart-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 8px 20px;
}
html:root [data-chart="handshake"] .handshake-phase-legend { grid-column: 1 / -1; }
html:root [data-chart="handshake"] .chart-series-toggle { text-align: left; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  html:root { --site-header-height: 109px; }
  html:root:has(.detail-section-tabs) { --detail-tabs-height: 97px; }
  html:root .detail-section-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: visible;
  }
  html:root .detail-section-tabs a {
    justify-content: center;
    min-width: 0;
    padding: 8px 4px;
    white-space: normal;
    text-align: center;
  }
}
@media (max-width: 360px) {
  html:root:has(.detail-section-tabs) { --detail-tabs-height: 145px; }
  html:root .detail-section-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
