/* Dark-mode completion for surfaces that were locked to light colors.
   Loaded after the inline stylesheet so equal-specificity rules win.
   Text reds use --red-text. Filled buttons keep a darker red with white type. */

@media (max-width: 1200px) {
  .education-path { grid-template-columns: 1fr; }
  .education-path > i { transform: rotate(90deg); justify-self: center; }
}

@media (prefers-color-scheme: dark) {
  .nav-highlight { color: var(--red-text) !important; }
  .give-button,
  .button-primary,
  .legacy-red-button,
  .btn-ptc {
    background: #c4232b !important;
    border-color: #c4232b !important;
    color: #fff !important;
  }
  .give-button:hover,
  .button-primary:hover,
  .btn-ptc:hover { background: #9e1a21 !important; }

  .legacy-host {
    background: #14161a;
    color: #f3f4f6;
    --legacy-red: #ff9aa0;
    --legacy-ink: #f3f4f6;
    --legacy-muted: #c5cdd6;
    --legacy-line: #3a414b;
    --legacy-soft: #1c2128;
  }
  .legacy-product-hero,
  .legacy-map-section,
  .legacy-footprint-foot,
  .legacy-operation,
  .legacy-directory,
  .legacy-sponsor,
  .people-profile-body,
  .o326-map-figure .fpWrap {
    background: #14161a;
    color: #f3f4f6;
  }
  .legacy-map-card,
  .legacy-stat-band,
  .legacy-profile-card,
  .legacy-metrics-card,
  .legacy-funding-card,
  .legacy-pillars article,
  .legacy-directory-map .legacy-map-card,
  .profile-layout aside,
  .fpDetail,
  .fpStamp,
  .home-footprint-shell,
  .home-footprint-shell .fpDetail {
    background: #1e242c;
    color: #f3f4f6;
    border-color: #3a414b;
  }
  .fpPill { background: #2a313a; color: #e6ebf1; border-color: #3a414b; }
  .fpDetailText,
  .fpHint,
  .fp-caption,
  .fp-statline,
  .fpSource,
  .fpRegional,
  .fpLegend,
  .legacy-map-layout header > p:last-child,
  .legacy-footprint-copy > p,
  .legacy-directory-head > p,
  .legacy-directory-map-copy p,
  .legacy-sponsor p,
  .legacy-additions span,
  .profile-layout main p,
  .profile-layout aside p {
    color: #c5cdd6;
  }
  .fp-statline strong,
  .fpDetailHead b,
  .legacy-map-layout h2,
  .legacy-footprint-copy h2,
  .legacy-operation h2,
  .legacy-directory h2,
  .legacy-sponsor h2,
  .profile-layout h2 { color: #f7f8fa; }
  .fpSource a,
  .fp-caption svg,
  .legacy-kicker { color: #ff9aa0 !important; }
  .fpBadge.reported { background: #4a2428; color: #ffd0d3; }
  .fpLegend .sw.u { background: #3a414b; border-color: #5c6672; }
  .footprint-product-hero .legacy-kicker { color: #9fd4ff !important; }

  .home-footprint-shell { background: #1e242c; color: #f4f1eb; }
  .map-section .home-footprint-link { color: #fff; }

  .native-opening,
  .native-action { background: #1c1814; color: #f6f0e7; }
  .native-people-section,
  .native-story-room { background: #161311; color: #f6f0e7; }
  .native-present-section { background: #2a241c; color: #f6f0e7; }
  .native-era-panel { background: #2c261f; color: #f6f0e7; }
  .native-timeline button.active { background: #3a3229; color: #f6f0e7; }
  .native-opening .lead,
  .native-fact-ribbon span,
  .native-people-grid p,
  .native-current-grid p,
  .native-story-grid > div:first-child > p:last-child,
  .native-action-grid p,
  .native-source-line,
  .native-era-panel p,
  .native-era-panel figcaption,
  .native-people-section .section-intro p,
  .native-present-head p { color: #e4d5c6 !important; }
  .native-deep .eyebrow,
  .education-deep .eyebrow,
  .research-deep .eyebrow,
  .frontier-destination .eyebrow { color: var(--red-text); }
  .native-fact-ribbon,
  .native-people-grid,
  .native-current-grid article,
  .native-action-grid article { border-color: #5c4d40; }
  .native-fact-ribbon article,
  .native-people-grid article { border-color: #5c4d40; }
  .native-action-grid a,
  .native-people-grid span,
  .native-fact-ribbon strong,
  .native-current-grid b { color: #e7a08a; }

  .education-thesis,
  .education-partners,
  .education-profile { background: #12181c; color: #f4f7f8; }
  .education-programs { background: #1a242b; color: #f4f7f8; }
  .education-uttermost { background: #1c3338; color: #f4f7f8; }
  .education-path > div,
  .education-program-grid article,
  .uttermost-curriculum article { background: #243038; color: #f4f7f8; border-color: #3d515b; }
  .education-thesis h2,
  .education-programs h2,
  .education-partners h2,
  .education-uttermost h2,
  .education-profile h2,
  .education-program-grid h3,
  .education-path strong,
  .education-thesis h2 span,
  .education-program-grid article > span,
  .education-network b { color: #f4f7f8; }
  .education-path span,
  .education-section-head > p,
  .education-program-grid p,
  .education-program-grid footer,
  .education-network p,
  .education-uttermost p,
  .education-profile p,
  .education-profile figcaption,
  .uttermost-curriculum p { color: #d5e2e8 !important; }
  .education-program-grid footer,
  .education-network,
  .education-network article { border-color: #3d515b; }
  .uttermost-curriculum span,
  .education-path small { color: #e2b86a; }

  .frontier-brief,
  .research-canonical,
  .publication-feature { background: #12181c; color: #f3f6f6; }
  .research-stream,
  .research-cloud-callout,
  .brief-index { background: #1a2428; color: #f3f6f6; }
  .research-method { background: #1c2e2b; color: #f3f6f6; }
  .frontier-destination { background: #12181c; color: #f3f6f6; }
  .brief-reading { background: #12181c; color: #f3f6f6; }
  .publication-masthead,
  .publication-feature h3,
  .research-section-head h2,
  .research-method h2,
  .research-canonical h2,
  .research-cloud-callout h2,
  .brief-reading article h2,
  .brief-index h2,
  .brief-index-grid h3,
  .research-stream-grid h3 { color: #f7fbfb; }
  .publication-masthead { border-bottom-color: #d5e4e0; }
  .publication-masthead p:last-child,
  .publication-feature p,
  .canonical-note,
  .research-section-head > p,
  .research-stream-grid p,
  .research-stream-grid strong,
  .research-method p,
  .research-cloud-callout p,
  .brief-reading article p,
  .brief-index-grid p,
  .canonical-flow span { color: #d5e0e4 !important; }
  .publication-key span,
  .research-stream-grid,
  .research-stream-grid article,
  .research-tier-grid,
  .research-tier-grid article,
  .canonical-flow div,
  .brief-index-grid,
  .brief-index-grid article { border-color: #3e5158; }
  .publication-feature,
  .canonical-flow div,
  .research-tier-grid article { background: #1e2a30; }
  .canonical-flow div:first-child { background: #0e1619; color: #fff; }
  .research-relation-grid a.active { background: #24343a; color: #f4f7f7; }
  .research-relation-grid .active span { color: #c5d4d8; }
  .publication-side article { background: #0e1619; }
  .brief-reading aside { background: #0e1619; color: #fff; }

  .o326-pipeline-system { background: #1a2128; color: #f3f5f7; }
  .o326-pipeline-head > p,
  .o326-pipeline-stage span,
  .o326-pipeline-focus { color: #c5ced6; }
  .o326-pipeline-focus strong,
  .o326-pipeline-stage strong { color: #f7f8fa; }
  .o326-pipeline-board,
  .o326-pipeline-stage { background: #12181d; border-color: #3a4650; color: #f3f5f7; }
  .o326-pipeline-stage.active { background: #0c1218; color: #fff; }
  .o326-pipeline-stage b { color: #ff9aa0; }
  .o326-map-panel,
  .o326-profile-panel { background: #1c232b; color: #f3f5f7; }
  .o326-map-toolbar,
  .o326-record-path,
  .o326-record-path span,
  .o326-profile-grid,
  .o326-feed-item { border-color: #3a4650; }
  .o326-search,
  .o326-filter { background: #12181d; color: #f3f5f7; border-color: #3a4650; }
  .o326-filter.active { background: #c4232b; border-color: #c4232b; color: #fff; }
  .o326-map-stage { background: #12181d; }
  .o326-map-stage .frontier-country { fill: #3a4450; stroke: #1c232b; }
  .o326-map-stage .frontier-country.has-records { fill: #5c6b78; }
  .o326-group-row,
  .o326-profile-note,
  .o326-feed-layout > header p { color: #d5dee6; }
  .o326-review-gate { background: #3a2e18; color: #ffe3b0; border-left-color: #e2b15a; }

  .seo-hub,
  .moe-partner { color: var(--ink); }
  .form-group input,
  .form-group select,
  .form-group textarea { background: var(--surface); color: var(--ink); border-color: var(--line); }
}
