/*
 * Component defaults stay in a low-priority layer. Unlayered theme rules win.
 * Public --pbm-sd-* hooks are consumed, never assigned here,
 * so overrides supplied by a parent container remain inherited by every module.
 */
@layer pbm-sports-data {
  :where(.pbm-sd, .pbm-sd-hub) {
    --_sd-bg: var(--pbm-sd-background, var(--wp--preset--color--base, #ffffff));
    --_sd-surface: var(--pbm-sd-surface, var(--wp--preset--color--surface, #f5f7f8));
    --_sd-line: var(--pbm-sd-border, var(--wp--preset--color--border, #dfe5e8));
    --_sd-text: var(--pbm-sd-text, var(--wp--preset--color--contrast, #24323d));
    --_sd-muted: var(--pbm-sd-muted, var(--wp--preset--color--muted, #66747d));
    --_sd-accent: var(--pbm-sd-accent, var(--wp--preset--color--primary, #266759));
    --_sd-on-accent: var(--pbm-sd-on-accent, var(--wp--preset--color--on-primary, #ffffff));
    --_sd-live: var(--pbm-sd-live, #19745c);
    --_sd-waiting: var(--pbm-sd-waiting, #8b651d);
    --_sd-radius: var(--pbm-sd-radius, 1rem);
    --_sd-shadow: var(--pbm-sd-shadow, 0 3px 14px #1e344008);
    --_sd-font-body: var(--pbm-sd-font-body, var(--wp--preset--font-family--body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif));
    --_sd-font-heading: var(--pbm-sd-font-heading, var(--wp--preset--font-family--heading, var(--_sd-font-body)));
    color: var(--_sd-text);
    font-family: var(--_sd-font-body);
    font-size: 1rem;
    line-height: 1.5;
    min-width: 0;
    max-width: 100%;
    text-align: start;
  }

  /* Explicit appearance is optional; auto resolves the active theme presets. */
  :where(.pbm-sd--light) {
    --_sd-bg: var(--pbm-sd-background, #ffffff);
    --_sd-surface: var(--pbm-sd-surface, #f5f7f8);
    --_sd-line: var(--pbm-sd-border, #dfe5e8);
    --_sd-text: var(--pbm-sd-text, #24323d);
    --_sd-muted: var(--pbm-sd-muted, #66747d);
    --_sd-accent: var(--pbm-sd-accent, #266759);
    --_sd-on-accent: var(--pbm-sd-on-accent, #ffffff);
  }
  :where(.pbm-sd--dark) {
    --_sd-bg: var(--pbm-sd-background, #15212b);
    --_sd-surface: var(--pbm-sd-surface, #1d2d39);
    --_sd-line: var(--pbm-sd-border, #405463);
    --_sd-text: var(--pbm-sd-text, #eff5f8);
    --_sd-muted: var(--pbm-sd-muted, #b3c3cf);
    --_sd-accent: var(--pbm-sd-accent, #b2decb);
    --_sd-on-accent: var(--pbm-sd-on-accent, #173327);
    --_sd-live: var(--pbm-sd-live, #8ed5b9);
    --_sd-waiting: var(--pbm-sd-waiting, #e2c480);
  }

  :where(.pbm-sd, .pbm-sd-hub, .pbm-sd *, .pbm-sd-hub *) { box-sizing: border-box; }
  :where(.pbm-sd, .pbm-sd-hub) { container-type: inline-size; }
  :where(.pbm-sd) {
    padding: clamp(1rem, 3%, 1.5rem);
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: var(--_sd-radius);
    box-shadow: var(--_sd-shadow);
  }
  :where(.pbm-sd-hub > .pbm-sd) {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  :where(.pbm-sd-hub .pbm-sd-intro) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0 0 1.4rem;
  }
  :where(.pbm-sd-hub .pbm-sd-intro > div) { min-width: 0; }
  :where(.pbm-sd-eyebrow, .pbm-sd-kicker) {
    display: block;
    color: var(--_sd-accent);
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .1em;
    line-height: 1.5;
    text-transform: uppercase;
  }
  :where(.pbm-sd-hub .pbm-sd-intro h2) {
    margin: .4rem 0 .5rem;
    color: var(--_sd-text);
    font-family: var(--_sd-font-heading);
    font-size: clamp(1.6rem, 3.7cqi, 2.3rem);
    font-style: normal;
    font-weight: 750;
    letter-spacing: -.035em;
    line-height: 1.15;
  }
  :where(.pbm-sd-hub .pbm-sd-intro p) {
    margin: 0;
    color: var(--_sd-muted);
    font-size: .875rem;
    line-height: 1.5;
  }
  :where(.pbm-sd-hub .pbm-sd-intro > img) {
    display: block;
    width: 11rem;
    max-width: 28%;
    height: auto;
    aspect-ratio: 31 / 18;
    object-fit: contain;
    border-radius: .75rem;
  }

  /* Large neutral numerals keep the data prominent; brand color is an accent. */
  :where(.pbm-sd-hub .pbm-sd-counts) {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .875rem;
    padding: 0;
    margin: 0 0 1.25rem;
  }
  :where(.pbm-sd-hub .pbm-sd-counts > div) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .55rem;
    min-width: 0;
    padding: 1.15rem 1.2rem;
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: .8rem;
    box-shadow: var(--_sd-shadow);
  }
  :where(.pbm-sd-hub .pbm-sd-counts > div:first-child) {
    background: var(--_sd-surface);
    background: color-mix(in srgb, var(--_sd-accent) 5%, var(--_sd-bg));
    border-color: color-mix(in srgb, var(--_sd-accent) 18%, var(--_sd-line));
  }
  :where(.pbm-sd-hub .pbm-sd-counts dt) {
    margin: 0;
    color: var(--_sd-muted);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.35;
  }
  :where(.pbm-sd-hub .pbm-sd-counts dd) {
    order: -1;
    margin: 0;
    color: var(--_sd-text);
    font-family: var(--_sd-font-heading);
    font-size: clamp(1.9rem, 4.5cqi, 2.6rem);
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    letter-spacing: -.045em;
    line-height: 1;
  }
  :where(.pbm-sd-hub .pbm-sd-counts > div:first-child dd) { color: var(--_sd-accent); }

  /* A compact event card, not a page hero or a second site header. */
  :where(.pbm-sd-feature) {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    overflow: hidden;
    margin: 0 0 1.75rem;
    padding: 1.4rem 1.6rem;
    background: var(--_sd-bg);
    background: linear-gradient(120deg, var(--_sd-bg), var(--_sd-surface));
    border: 1px solid var(--_sd-line);
    border-radius: var(--_sd-radius);
    box-shadow: var(--_sd-shadow);
  }
  :where(.pbm-sd-feature-art) {
    order: 2;
    align-self: center;
    display: block;
    width: 28%;
    max-width: 15rem;
    height: auto;
    aspect-ratio: 31 / 18;
    object-fit: contain;
    border-radius: .75rem;
  }
  :where(.pbm-sd-feature-body) { flex: 1; min-width: 0; }
  :where(.pbm-sd-feature .pbm-sd-kicker) { color: var(--_sd-muted); font-size: .6875rem; }
  :where(.pbm-sd-matchup) {
    display: flex;
    align-items: center;
    gap: clamp(.8rem, 2.4cqi, 2rem);
    margin: .9rem 0 1rem;
  }
  :where(.pbm-sd-matchup-team) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    min-width: 0;
    flex: 1;
  }
  :where(.pbm-sd-matchup-team > span:not(.pbm-sd-mark)) {
    color: var(--_sd-text);
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -.025em;
  }
  :where(.pbm-sd-matchup-team small) {
    flex-basis: 100%;
    color: var(--_sd-muted);
    font-size: .75rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  :where(.pbm-sd-matchup-score) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    color: var(--_sd-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  :where(.pbm-sd-matchup-score strong) {
    font-family: var(--_sd-font-heading);
    font-size: clamp(1.8rem, 4.6cqi, 3rem);
    font-weight: 750;
    letter-spacing: -.055em;
    line-height: 1;
  }
  :where(.pbm-sd-matchup-score > span) { color: var(--_sd-muted); font-size: 1.4rem; font-weight: 400; }
  :where(.pbm-sd-feature-meta) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    color: var(--_sd-muted);
    font-size: .75rem;
    line-height: 1.5;
  }

  :where(.pbm-sd-hub .pbm-sd-nav) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .35rem;
    margin: 0 0 1rem;
    background: var(--_sd-surface);
    border: 1px solid var(--_sd-line);
    border-radius: .75rem;
  }
  :where(.pbm-sd-hub .pbm-sd-nav a) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    padding: .55rem 1.2rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: .5rem;
    color: var(--_sd-muted);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 650;
    line-height: 1.4;
    text-decoration: none;
  }
  :where(.pbm-sd-hub .pbm-sd-nav a:hover) { background: var(--_sd-bg); color: var(--_sd-text); }
  :where(.pbm-sd-hub .pbm-sd-nav a[aria-current="page"]) {
    background: var(--_sd-bg);
    border-color: var(--_sd-line);
    box-shadow: 0 2px 5px #1e34400a;
    color: var(--_sd-accent);
  }
  :where(.pbm-sd-hub .pbm-sd-nav a[aria-current="page"])::before {
    content: '';
    width: .35rem;
    height: .35rem;
    margin-inline-end: .5rem;
    border-radius: 50%;
    background: currentColor;
  }
  :where(.pbm-sd-hub .pbm-sd-filters) {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .8rem;
    margin: 0 0 1.75rem;
    padding: 1rem 1.1rem;
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: .75rem;
  }
  :where(.pbm-sd-hub .pbm-sd-filters label) {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    color: var(--_sd-muted);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 550;
    line-height: 1.4;
  }
  :where(.pbm-sd-hub .pbm-sd-filters input, .pbm-sd-hub .pbm-sd-filters select) {
    min-height: 2.75rem;
    max-width: 100%;
    margin: 0;
    padding: .55rem .8rem;
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: .5rem;
    color: var(--_sd-text);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.5;
  }
  :where(.pbm-sd-hub .pbm-sd-filters select) { min-width: 9rem; }
  :where(.pbm-sd-hub .pbm-sd-filters button) {
    min-height: 2.75rem;
    margin: 0;
    padding: .55rem 1.25rem;
    background: var(--_sd-accent);
    border: 1px solid var(--_sd-accent);
    border-radius: .5rem;
    box-shadow: 0 2px 4px #1e34400a;
    color: var(--_sd-on-accent);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 650;
    line-height: 1.5;
    cursor: pointer;
  }
  :where(.pbm-sd-hub .pbm-sd-filters button:hover) { filter: brightness(.96); }
  :where(.pbm-sd-hub a, .pbm-sd-hub button, .pbm-sd-hub input, .pbm-sd-hub select):focus-visible {
    outline: 2px solid var(--_sd-accent);
    outline-offset: 3px;
  }

  :where(.pbm-sd .pbm-sd-header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
  }
  :where(.pbm-sd .pbm-sd-header h2, .pbm-sd .pbm-sd-header h3) {
    margin: 0;
    color: var(--_sd-text);
    font-family: var(--_sd-font-heading);
    font-size: 1.25rem;
    font-style: normal;
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.3;
  }
  :where(.pbm-sd .pbm-sd-header > span) {
    display: inline-flex;
    align-items: center;
    padding: .3rem .6rem;
    background: var(--_sd-surface);
    border: 1px solid var(--_sd-line);
    border-radius: .4rem;
    color: var(--_sd-muted);
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .04em;
    line-height: 1.3;
  }
  :where(.pbm-sd .pbm-sd-notice) {
    margin: 0 0 1.15rem;
    padding: .7rem .9rem;
    background: var(--_sd-surface);
    border: 1px solid var(--_sd-line);
    border-radius: .6rem;
    color: var(--_sd-muted);
    font-size: .75rem;
    line-height: 1.5;
  }
  :where(.pbm-sd .pbm-sd-games) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
  }
  :where(.pbm-sd .pbm-sd-game) {
    position: relative;
    min-width: 0;
    padding: 1.15rem;
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: .85rem;
    box-shadow: var(--_sd-shadow);
  }
  :where(.pbm-sd .pbm-sd-game[data-status="live"]) {
    border-color: color-mix(in srgb, var(--_sd-live) 34%, var(--_sd-line));
    box-shadow: 0 3px 16px #1d5f440a;
  }
  :where(.pbm-sd .pbm-sd-meta) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: 1.3rem;
    color: var(--_sd-muted);
    font-size: .75rem;
    line-height: 1.4;
  }
  :where(.pbm-sd .pbm-sd-meta > span:first-child) {
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .075em;
    text-transform: uppercase;
  }
  :where(.pbm-sd-status) {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .25rem .5rem;
    background: var(--_sd-surface);
    border: 1px solid var(--_sd-line);
    border-radius: 2rem;
    color: var(--_sd-muted);
    font-size: .6875rem;
    font-weight: 650;
    line-height: 1.3;
  }
  :where([data-status="live"] .pbm-sd-status, .pbm-sd-feature .pbm-sd-status[data-status="live"]) {
    background: color-mix(in srgb, var(--_sd-live) 8%, var(--_sd-bg));
    border-color: color-mix(in srgb, var(--_sd-live) 14%, var(--_sd-line));
    color: var(--_sd-live);
  }
  :where([data-status="live"] .pbm-sd-status, .pbm-sd-feature .pbm-sd-status[data-status="live"])::before {
    content: '';
    width: .35rem;
    height: .35rem;
    flex-shrink: 0;
    background: currentColor;
    border-radius: 50%;
  }
  :where([data-status="scheduled"] .pbm-sd-status) {
    background: color-mix(in srgb, var(--_sd-waiting) 6%, var(--_sd-bg));
    color: var(--_sd-waiting);
  }
  :where([data-stale="true"] .pbm-sd-status) {
    background: var(--_sd-surface);
    color: var(--_sd-muted);
  }
  :where(.pbm-sd .pbm-sd-team) {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 1.05rem 0;
    color: var(--_sd-text);
    font-size: .875rem;
    line-height: 1.35;
  }
  :where(.pbm-sd .pbm-sd-team > span:nth-child(2), .pbm-sd-team-name) {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
  }
  :where(.pbm-sd .pbm-sd-team strong, .pbm-sd-score) {
    color: var(--_sd-text);
    font-family: var(--_sd-font-heading);
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    letter-spacing: -.045em;
    line-height: 1;
  }
  :where(.pbm-sd-mark) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    background: var(--_sd-surface);
    border: 1px solid var(--_sd-line);
    border-radius: .7rem;
    color: var(--_sd-text);
    font-size: .625rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -.015em;
  }
  :where(.pbm-sd .pbm-sd-team:nth-child(3) .pbm-sd-mark) {
    background: color-mix(in srgb, var(--_sd-accent) 5%, var(--_sd-bg));
    color: var(--_sd-accent);
  }
  :where(.pbm-sd .pbm-sd-time) {
    margin: 1.2rem 0 0;
    padding: .8rem 0 0;
    border-top: 1px solid var(--_sd-line);
    color: var(--_sd-muted);
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
  }

  :where(.pbm-sd .pbm-sd-table) {
    overflow-x: auto;
    max-width: 100%;
    background: var(--_sd-bg);
    border: 1px solid var(--_sd-line);
    border-radius: .85rem;
    box-shadow: var(--_sd-shadow);
  }
  :where(.pbm-sd table) {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    color: var(--_sd-text);
    font-family: inherit;
    font-size: .875rem;
    line-height: 1.5;
    text-align: start;
    white-space: nowrap;
  }
  :where(.pbm-sd caption) {
    padding: .9rem 1.15rem;
    background: var(--_sd-bg);
    border-bottom: 1px solid var(--_sd-line);
    color: var(--_sd-muted);
    font-size: .75rem;
    line-height: 1.5;
    text-align: start;
    white-space: normal;
  }
  :where(.pbm-sd th, .pbm-sd td) {
    padding: .95rem 1.15rem;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--_sd-line);
    color: var(--_sd-text);
    font-family: inherit;
    text-align: start;
  }
  :where(.pbm-sd th) {
    background: var(--_sd-surface);
    color: var(--_sd-muted);
    font-size: .75rem;
    font-weight: 600;
  }
  :where(.pbm-sd tbody tr:last-child td) { border-bottom: 0; }
  :where(.pbm-sd tbody tr:nth-child(even)) { background: color-mix(in srgb, var(--_sd-surface) 50%, var(--_sd-bg)); }
  :where(.pbm-sd tbody tr:hover) { background: var(--_sd-surface); }
  :where(.pbm-sd td:not(:first-child)) { font-variant-numeric: tabular-nums; }
  :where(.pbm-sd td.pbm-sd-number, .pbm-sd .pbm-sd-odds-value) { font-weight: 700; }
  :where(.pbm-sd .pbm-sd-book) { font-weight: 600; }
  :where(.pbm-sd .pbm-sd-footer) {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-top: 1.1rem;
    padding: .8rem 0 0;
    border-top: 1px solid var(--_sd-line);
    color: var(--_sd-muted);
    font-size: .6875rem;
    line-height: 1.5;
  }
  :where(.pbm-sd .pbm-sd-note) {
    margin: .65rem 0 0;
    color: var(--_sd-muted);
    font-size: .6875rem;
    line-height: 1.5;
  }
  @container (max-width: 600px) {
    :where(.pbm-sd-feature) { gap: 1rem; padding: 1.2rem; }
    :where(.pbm-sd-feature-art) { width: 23%; }
    :where(.pbm-sd-matchup-team .pbm-sd-mark) { width: 1.85rem; height: 1.85rem; font-size: .5rem; border-radius: .5rem; }
    :where(.pbm-sd-hub .pbm-sd-nav a) { flex: 1; padding-inline: .8rem; }
    :where(.pbm-sd-hub .pbm-sd-counts) { gap: .6rem; }
    :where(.pbm-sd-hub .pbm-sd-counts > div) { padding: 1rem .85rem; }
  }
  @container (max-width: 480px) {
    :where(.pbm-sd-hub .pbm-sd-counts) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    :where(.pbm-sd-hub .pbm-sd-intro) { gap: .85rem; padding-bottom: 1.15rem; }
    :where(.pbm-sd-hub .pbm-sd-intro > img) { width: 6rem; max-width: 26%; }
    :where(.pbm-sd-feature-art) { display: none; }
    :where(.pbm-sd-feature .pbm-sd-kicker) { font-size: .625rem; }
    :where(.pbm-sd-matchup) { gap: .65rem; }
    :where(.pbm-sd-matchup-team) { gap: .4rem; }
    :where(.pbm-sd-matchup-team small) { font-size: .6875rem; }
    :where(.pbm-sd-matchup-team > span:not(.pbm-sd-mark)) { font-size: .9rem; }
    :where(.pbm-sd-matchup-score strong) { font-size: 2.1rem; }
    :where(.pbm-sd-hub .pbm-sd-filters) { padding: .85rem; gap: .7rem; }
    :where(.pbm-sd-hub .pbm-sd-filters label) { flex: 1; min-width: 8rem; }
    :where(.pbm-sd-hub .pbm-sd-filters input, .pbm-sd-hub .pbm-sd-filters select) { width: 100%; min-width: 0; }
    :where(.pbm-sd-hub .pbm-sd-filters button) { width: 100%; }
    :where(.pbm-sd-hub .pbm-sd-nav a) { flex: 1 0 auto; padding: .55rem .7rem; font-size: .8125rem; }
  }
  @container (max-width: 300px) {
    :where(.pbm-sd .pbm-sd-game) { padding: .9rem; }
    :where(.pbm-sd .pbm-sd-team) { gap: .5rem; }
    :where(.pbm-sd .pbm-sd-team strong) { font-size: 1.75rem; }
    :where(.pbm-sd-matchup-team .pbm-sd-mark) { display: none; }
    :where(.pbm-sd-matchup-score strong) { font-size: 1.75rem; }
  }
  :where(.pbm-sd-mark img) { display: block; width: 1.7rem; height: 1.7rem; object-fit: contain; }
}
