/* Shared public section borders. Brand accents remain in the content and controls. */
:root {
  --mf-section-border: #414c46;
}

/* Shared compact frames use these tokens for their section borders. */
:where(main#main-content, main#calendar) > section,
:where(main#main-content) > .hm-hero,
:where(main#main-content) > .mf-d2-shell > :is(header, section) {
  --mf-review-gold: var(--mf-section-border) !important;
  --mf-home-parity-gold: var(--mf-section-border) !important;
}

@layer mf-section-borders {
  /* Shared section shells and route-specific top rules. */
  body.site-app-ready.mf-layout-portal main#main-content > section,
  :where(main, [role="main"]) :is(
    .mf-template-hero, .mf-template-panel, .module--diaspora,
    .mf-coverage__hero, .mf-mc-hero, .mf-mc-coverage,
    section[id^="stl-section-"], #today-schedule, #stl-shared-live-desk, #official-lanes,
    #amb-matchday, #ambush-bottom-cards, #stl-v3-identity,
    .college-hero__rail, .college-section--surface, .mf-hs-panel,
    .hf-section--feature, .hf-pulse, .hm-hero, .mf-hbcu-hero, .mf-hbcu-section, .mf-hbcu-profile-lead,
    .mf-newsroom-desk, .mf-article-sidebar > section,
    .vd-hero, .mf-stats-intro, .mf-tribe-section, .inner-next-step, .final-cta,
    .desk-hero, .desk-section, .mf-tracker-map-page #people-directory,
    .mfpn-mast, .mf-od-rail, .mf-sp-hero, .mf-sp-share, #join-newsletter,
    .mf-pro-hub-page #club-lanes, .mf-youth-guide #girls,
    .mf-youth-field-guide, #youth-field-guide, #mf-official-content-network,
    .mf-v44-strip
  ),
  main:has(> .training-hero) .home-stack > :is(#programs, #player-stories) {
    border-top-color: var(--mf-section-border) !important;
  }

  /* Panels that used gold on their full perimeter. */
  :where(main, [role="main"]) :is(
    .module--hero, .score-panel--fixture, .score-panel--fixture .score-inner,
    #full-schedule .mf-matchday-hero,
    .mf-afcon-command, .mf-afcon-command__lead, .mf-afcon-command__teams,
    .mf-afcon-dashboard__section, .mf-afcon-mini-panel, .mf-afcon-country-directory,
    .mf-afcon-signal, .mf-afcon-news-featured, .mf-shape-feature__player, .mf-shape-feature__copy,
    .mf-africa-edition-rail__masthead,
    #wc2026-groups, .mf-wc-final-status, .mf-wc-final-match, .mf-forum-empty,
    .mf-compact-board, .mf-diaspora-fix-hero__copy, .mf-diaspora-fix-hero__panel,
    .citysc-team-hero__media, .citysc-team-hero__copy, .citysc-form-board, .citysc-panel,
    .mf-core-visual, .mf-v20-lane-panel, .mf-youth-panel, .mf-hs-panel,
    .mf-transfer-board, .mf-transfer-market-section > .stl-container,
    .mf-partner-page-panel, .mf-discovery-panel, .mf-mofutbol-source-board, .mf-official-source-board,
    .mf-roadmap-panel, .mf-command-shell, .sv-dashboard__hero, .sv-impact-preview__grid, .training-brand,
    .mf-ac-contact, .mf-ac-grid > article, .mf-contributor-value, .mf-home-spotlight-card,
    .mf-community__card, .mf-creator-panel, .mf-creators-preview, .mf-impact-grid,
    .mf-city-stage-card, .mf-hbcu-source-table-wrap, .mf-od-player, .mf-core-table-wrap,
    .mf-mwpl-home-hero__copy, .mf-mwpl-panel, .mf-mwpl-tournament, .mf-mwpl-note,
    .citysc-league-rail, .citysc-top-deck, .citysc-source-strip__grid, #city2-hub-app,
    .city2-live-card, .city2-panel, .mf-youth-next-step, .mf-youth-development-step,
    .mf-youth-action-card, .mf-youth-guide-card, .mf-youth-field-guide__grid,
    .mf-route-card, .mf-route-intro, .mlsw-hero__copy, .mf-local-league-hero__panel, .mf-local-league-source,
    .mf-v20-official-media__feature, .mf-v20-route-board__lead,
    .hscl-command-hero__board, .hscl-command-principles, .hscl-command-season-note,
    .hscl-command-school-welcome, .hscl-command-submit-band,
    .mf-wafcon-group, .mf-caf-hero__copy, .mf-caf-hero__board
  ),
  .mf-mc-option-one #full-schedule {
    border-color: var(--mf-section-border) !important;
  }

  :where(main, [role="main"]) :is(
    .mf-afcon-hero, .mf-hs-hero, .mf-stl-command-hero, .mf-hbcu-stories-campus,
    #youth-field-guide, #mf-official-content-network, .mf-od-intro,
    .mf-daily-hero, .mf-diaspora-hero, .mlsw-hero, .mf-local-league-hero, .citysc-team-hero
  ),
  body.mf-page-shell:not(.mf-home-taste, .mf-system-home) main :is(
    .mf-editorial-hero, .mf-polish-hero, .mf-unified-hero, .stl-city-hero,
    .mf-player-directory-hero, .mf-simple-page-hero, .hero, .page-hero
  ) {
    border-bottom-color: var(--mf-section-border) !important;
  }

  body.mf-stl-premium main :is(
    .stl-city-hero, .citysc-team-hero, .mf-mwpl-home-hero, .mf-hs-hero,
    .mf-hscl-hero, .mf-core-hero, .mf-youth-hero, .mf-policy-hero, .stl-pro-hero
  ) {
    border-block-color: var(--mf-section-border) !important;
  }

  /* Borders on match, standings, editorial, and resource cards. */
  :where(main, [role="main"]) :is(
    .standing-figure:first-child, .city2-metric, .city2-match-card,
    .citysc-status-ribbon, .citysc-player-card, .mf-league-metric,
    .mf-mwpl-match-card, .mf-mwpl-spotlights > article,
    .mf-core-club, .mf-core-source-row, .mf-ocn-card, .mf-ocn-card .mf-ocn__art, .mlsw-news-card,
    .mf-afcon-proof-row > article, .mf-afcon-route-card, .mf-afcon-host-card,
    .mf-afcon-map-directory, .mf-afcon-map-card, .mf-afcon-v2-country--fixture,
    .mf-diaspora-loading-card, .mf-fifa-tournament-card, .mf-wc-final-score,
    .mf-hbcu-update-card, .mf-hbcu-dashboard__spotlight-row,
    .mf-hscl-news-grid .mf-link-tile, .mf-proof-card, .mf-v20-media-card,
    .mf-v20-lane-switchboard > article, .mf-v20-route-board__steps > article,
    .vd-hero__media-card, .desk-lanes > article, .desk-inventory > article,
    .mf-network-contributor__card, .mf-africa-edition-rail__link, .mf-caf-table-wrap,
    .stl-section-header-row, .mf-mwpl-news-card, .mf-date-tile, .mf-today-stl__card,
    .mf-stl-v3-brand > article, .desk-contact-layout > .desk-form,
    .desk-contact-aside > article, .mf-contributor-accepted > article,
    .mf-daily-lead, .mf-daily-board, .mf-daily-card, .mf-daily-shell,
    .mf-diaspora-map-panel, .mlsw-route, .mf-wafcon-hero > aside, .mf-pro-club-card,
    .mf-static-match-card, .mf-static-directory-card, .sv-impact-preview__card
  ):not(:where(:focus-visible, button, [role="button"], .btn, .button, .stl-btn)),
  .mf-core-podcast-page main :is(.mf-core-card, .mf-core-panel):not(:focus-visible) {
    border-color: var(--mf-section-border) !important;
  }

  :where(main, [role="main"]) :is(
    .milestones > .milestone,
    .mf-diaspora-board--official .mf-diaspora-pro-card:nth-child(3n + 2),
    .mf-hscl-history-card, .mf-youth-guide .yg-card:nth-child(2),
    .hscl-command-explainer-card--national
  ):not(:focus-visible) {
    border-top-color: var(--mf-section-border) !important;
  }

  :where(main, [role="main"]) :is(.mf-map-policy, .info-note) {
    border-left-color: var(--mf-section-border) !important;
  }
}

/* These older frames declare their border inside the compact priority layer. */
@layer mfOwnerCompact {
  html:root body.site-app-ready:is(.mf-pro-hub-page, .mf-theme-school, .mf-tracker-map-page, .mf-stats-page, .mf-stl-directory-page)
    main#main-content > section:nth-of-type(odd),
  html:root body.mf-pro-hub-page main#main-content :is(#stl-section-1, #club-lanes, #stl-section-5),
  html:root body.mf-hbcu-page main#main-content :is(.hf-pulse, .mf-hbcu-hero, .mf-hbcu-section, .mf-hbcu-profile-lead),
  html:root body main#main-content.mf-diaspora-desk :is(
    .desk-hero, #afcon-2027-qualifiers, .desk-standings, #afcon-leaders,
    #hosts, #afcon-2025, #african-football-news, .mf-d2-home-lane--coaches
  ) {
    border-top-color: var(--mf-section-border) !important;
  }

  html:root body main :is(.mf-od-player, .sv-dashboard__hero, .mf-contributor-value) {
    border-color: var(--mf-section-border) !important;
  }
}
