/* Palette and contrast contracts shared by modern and legacy public components.
   Theme sheets own typography and decoration; these roles own readable colors. */
body.sm-inner-site { background-color: var(--color-background); }
body.sm-inner-site .main-content :is([class$="-page"], .sm-team-fixtures-page) {
    background: var(--color-background) !important;
    color: var(--theme-on-background);
}

body.sm-inner-site .main-content :is([class$="-page"], .sm-team-fixtures-page) :is([class$="-hero"], .sm-team-hero) {
    --theme-surface-text: var(--theme-on-hero);
    --theme-muted: var(--theme-on-hero);
    background: radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--color-accent) 14%, transparent), transparent 36%), var(--theme-hero) !important;
    color: var(--theme-on-hero);
}

body.sm-inner-site .main-content :is([class$="-hero"], .sm-team-hero) :is(h1, p, [class$="-eyebrow"], [class$="-breadcrumb"], [class$="-breadcrumb"] a, [class$="-summary"] strong, [class$="-summary"] span) {
    color: var(--theme-on-hero) !important;
}

body.sm-inner-site .main-content :is([class$="-nav-section"], .sm-news-tabs-section, .sm-about-join-section, .sm-contact-lower, .sm-groups-cta-inner, .sm-staff-philosophy-inner, .sm-registration-help-card) {
    --theme-surface-text: var(--theme-on-secondary);
    --theme-on-hero: var(--theme-on-secondary);
    --theme-muted: var(--theme-on-secondary);
    background: var(--color-secondary);
    color: var(--theme-on-secondary);
}

body.sm-inner-site .main-content :is(.sm-fixtures-hero-stats, .sm-team-match-card, .sm-player-card, .sm-staff-principles article) {
    --theme-on-hero: var(--theme-panel-text);
    --theme-surface-text: var(--theme-panel-text);
    --theme-muted: var(--theme-panel-muted);
    background: var(--theme-surface) !important;
    color: var(--theme-panel-text);
}
body.sm-inner-site .main-content .sm-staff-principles article :is(strong, span) {
    color: var(--theme-panel-text) !important;
}
body.sm-inner-site .main-content :is(.sm-fixtures-hero-stats, .sm-team-match-card, .sm-player-card) :is(h2, p, strong, span) {
    color: var(--theme-panel-text) !important;
}
body.sm-inner-site .main-content :is(.sm-news-tabs, .sm-registration-page-nav) a:not(.is-active) {
    color: var(--theme-on-secondary) !important;
}
body.sm-inner-site .main-content .sm-news-tabs a.is-active {
    background: var(--theme-surface) !important;
    color: var(--theme-link) !important;
}
body.sm-inner-site .main-content .sm-registration-page-nav a span {
    color: var(--theme-on-secondary) !important;
}
body.sm-inner-site .main-content .sm-groups-page-nav > span {
    color: var(--theme-on-secondary) !important;
}
body.sm-inner-site .main-content :is(.sm-team-btn-outline, .sm-player-btn.secondary, [class$="-back"], .sm-player-kicker) {
    color: var(--theme-on-hero) !important;
}
body.sm-inner-site .main-content :is(.sm-about-hero-actions a:last-child, .sm-team-btn-outline, .sm-player-btn.secondary) {
    background: transparent !important;
    color: var(--theme-on-hero) !important;
}
body.sm-inner-site .main-content :is(.sm-group-card-footer, .sm-news-card-meta span, .sm-team-match-footer, .sm-player-section-head > span, .timeline-content h3, .stat-number) {
    color: var(--theme-link) !important;
}
body.sm-inner-site .main-content .sm-groups-intro-visual > span {
    color: var(--theme-on-secondary) !important;
}
body.sm-inner-site .main-content .sm-contact-map-actions > a {
    background: var(--theme-action) !important;
    color: var(--theme-on-action) !important;
}
body.sm-inner-site .main-content .is-upcoming .sm-fixture-status {
    color: var(--theme-link) !important;
}
body.sm-inner-site .main-content .sm-squad-tabs button:not(.active) > span {
    color: var(--theme-on-secondary) !important;
}
body.sm-inner-site .main-content :is(.section-title, .stats-section h2) {
    color: var(--theme-panel-text) !important;
}
body.sm-inner-site .main-content :is(.bg-light, .modal-content, .form-control, .form-select) {
    background: var(--theme-surface) !important;
    color: var(--theme-panel-text);
}

/* Home layouts retain their geometry; dark copy panels use inverse text roles. */
body :is(.sm-h-story-copy, .sm-h-tv > a, .sm-i-story-copy, .sm-i-tv > a, .sm-i-academy-copy) {
    --theme-surface-text: var(--theme-on-secondary);
    --theme-muted: var(--theme-on-secondary);
    color: var(--theme-on-secondary);
}
body .sm-h-topline { color: var(--theme-on-primary); }
body .sm-i-topline { color: var(--theme-on-secondary); }
body .sm-g-academy a,
body .sm-g-collection a { color: var(--theme-on-hero) !important; }
body.sm-inner-site .main-content .sm-player-photo > strong {
    color: var(--theme-on-action) !important;
}

body.sm-inner-site .main-content :is(.sm-about-story-card, .sm-about-side-panel, .sm-about-mission-grid article, .sm-about-values-grid article, .sm-about-achievements-inner, .sm-group-card, .sm-group-detail-panel, .sm-group-side-card, .sm-group-program-card, .sm-group-player-row, .sm-team-player-card, .sm-team-staff-card, .sm-team-list-row, .sm-fixture-card, .sm-fixtures-panel, .sm-fixtures-filter, .sm-news-card, .sm-news-side-card, .sm-news-detail-article, .sm-news-detail-meta-card, .sm-news-detail-side-card, .sm-staff-head-card, .sm-staff-card, .sm-contact-info-panel, .sm-contact-map-panel, .sm-contact-faq-list article, .sm-player-info-grid article, .sm-player-stats-grid article, .sm-player-analysis-card, .sm-youth-registration-guide, .sm-registration-checklist, .sm-registration-help, .registration-form-container, .form-section, .card) {
    --theme-on-hero: var(--theme-panel-text);
    --theme-surface-text: var(--theme-panel-text);
    --theme-muted: var(--theme-panel-muted);
    background: var(--theme-surface) !important;
    color: var(--theme-panel-text);
}

body.sm-inner-site .main-content :is(.sm-about-story-card, .sm-about-side-panel, .sm-about-richtext, .sm-news-detail-article) a {
    color: var(--theme-link);
}
body.sm-inner-site .main-content .sm-about-richtext strong {
    color: var(--theme-link) !important;
}
body.sm-theme-design-d .sm-d-login {
    color: var(--theme-on-action) !important;
}

body[class*="sm-theme-"] :is(.sm-a-ticket, .sm-a-btn-gold, .sm-b-btn-primary, .sm-c-join, .sm-c-btn-red, .sm-c-match-action, .sm-d-login, .sm-e-btn-primary, .sm-e-ticket, .sm-f-join, .sm-h-button, .sm-i-button),
body :is(.btn-warning, .btn-primary),
body.sm-inner-site :is(.sm-a-inner-ticket),
body.sm-inner-site .main-content :is(.sm-about-hero-actions a:first-child, .sm-groups-hero-actions a:first-child, .sm-group-detail-actions a:first-child, .sm-staff-hero-actions a:first-child, .sm-contact-direct-actions a:first-child, .sm-team-btn-gold, .sm-player-btn.primary, .sm-youth-registration-page .form-actions .btn) {
    background: var(--theme-action) !important;
    border-color: var(--theme-action) !important;
    color: var(--theme-on-action) !important;
}
body[class*="sm-theme-"] :is(.sm-a-ticket, .sm-a-btn-gold, .sm-b-btn-primary, .sm-c-join, .sm-c-btn-red, .sm-c-match-action, .sm-d-login, .sm-e-btn-primary, .sm-e-ticket, .sm-f-join, .sm-h-button, .sm-i-button):hover,
body :is(.btn-warning, .btn-primary):hover,
body.sm-inner-site .sm-a-inner-ticket:hover,
body.sm-inner-site .main-content :is(.sm-about-hero-actions a:first-child, .sm-groups-hero-actions a:first-child, .sm-group-detail-actions a:first-child, .sm-staff-hero-actions a:first-child, .sm-contact-direct-actions a:first-child, .sm-team-btn-gold, .sm-player-btn.primary, .sm-youth-registration-page .form-actions .btn):hover {
    background: var(--theme-action-hover) !important;
    color: var(--theme-on-action-hover) !important;
}

body.sm-inner-site .bg-primary {
    background: var(--theme-hero) !important;
    color: var(--theme-on-hero);
}
body.sm-inner-site .bg-primary :is(h1, p, .breadcrumb-item) {
    color: var(--theme-on-hero) !important;
}
body.sm-inner-site .text-warning {
    color: var(--theme-link) !important;
}
body.sm-inner-site .bg-primary .text-warning {
    color: var(--theme-on-hero) !important;
}

body.sm-inner-site .main-content .container {
    width: min(1180px, calc(100% - 48px));
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 0;
}
@media (max-width: 640px) {
    body.sm-inner-site .main-content .container { width: calc(100% - 32px); }
    body.sm-inner-site .main-content :is(.sm-about-hero-grid, .sm-contact-hero-grid, .sm-staff-hero-grid, .sm-groups-hero-grid, .sm-team-hero-grid, .sm-fixtures-hero-grid, .sm-group-detail-hero-grid, .sm-player-hero-grid, .sm-news-hero-grid, .sm-youth-registration-hero-grid) { grid-template-columns: minmax(0, 1fr) !important; }
    body.sm-inner-site .main-content :is(h1, h2, h3, a, strong) { overflow-wrap: anywhere; }
}

/* Whole-page background is the saved setting; hero and card roles remain local. */
body[class*="sm-theme-"] { background: var(--color-background); color: var(--theme-on-background); }
body[class*="sm-theme-"] :is(.sm-a-home,.sm-b-home,.sm-c-home,.sm-d-home,.sm-e-home,.sm-f-home,.sm-g-home,.sm-h-home,.sm-i-home) {
    background: var(--color-background) !important;
    color: var(--theme-on-background);
}
body[class*="sm-theme-"] :is(.sm-a-home,.sm-b-home,.sm-c-home,.sm-d-home,.sm-e-home,.sm-f-home,.sm-g-home,.sm-h-home,.sm-i-home) [class$="-section-head"] h2 {
    color: var(--theme-on-background);
}
body[class*="sm-theme-"] :is(.sm-c-hero,.sm-d-hero,.sm-e-hero,.sm-f-hero) {
    --theme-hero: var(--theme-media-overlay);
    --theme-on-hero: var(--theme-on-media);
    --theme-surface-text: var(--theme-on-media);
    --theme-muted: var(--theme-on-media);
    color: var(--theme-on-media);
}
body[class*="sm-theme-"] :is(.sm-c-hero,.sm-d-hero,.sm-e-hero,.sm-f-hero) :is(h1,h2,p) { color: var(--theme-on-media); }
body[class*="sm-theme-"] :is(.sm-c-team-card,.sm-c-news-card,.sm-d-news-card,.sm-e-news-card,.sm-f-news-card,.sm-g-news-card) {
    --theme-surface-text: var(--theme-panel-text);
    --theme-muted: var(--theme-panel-muted);
    background: var(--theme-surface);
    color: var(--theme-panel-text);
}
/* Secondary sections retain their theme identity and use inverse copy colors. */
body[class*="sm-theme-"] :is(.sm-a-hero-dark,.sm-a-academy,.sm-b-academy,.sm-c-academy,.sm-d-academy,.sm-e-academy,.sm-f-academy,.sm-g-academy,.sm-g-collection,.sm-h-match,.sm-i-match) {
    --theme-surface-text: var(--theme-on-secondary);
    --theme-muted: var(--theme-on-secondary);
    color: var(--theme-on-secondary);
}

/* Inverse sections and paper cards keep readable roles when palettes switch. */
body[class*="sm-theme-"] :is(.sm-a-hero-dark,.sm-a-match-rail) {
    --theme-surface-text: var(--theme-on-primary); --theme-muted: var(--theme-on-primary);
    color: var(--theme-on-primary);
}
body[class*="sm-theme-"] :is(.sm-a-hero-dark,.sm-a-match-rail) :is(h1,h2,p,strong,small,.sm-a-kicker,.sm-a-versus) { color: var(--theme-on-primary); }
body[class*="sm-theme-"] :is(.sm-d-quick,.sm-e-quick,.sm-f-quick,.sm-h-quick,.sm-i-quick,.sm-b-next-match,.sm-g-match-card) {
    --theme-surface-text: var(--theme-on-secondary); --theme-muted: var(--theme-on-secondary);
    background: var(--color-secondary); color: var(--theme-on-secondary);
}
body[class*="sm-theme-"] :is(.sm-d-quick,.sm-e-quick,.sm-f-quick,.sm-h-quick,.sm-i-quick,.sm-b-next-match,.sm-g-match-card) :is(a,h2,p,strong,small) { color: var(--theme-on-secondary); }
body[class*="sm-theme-"] :is(.sm-a-team-tab,.sm-b-team-card,.sm-b-video-link,.sm-d-tv,.sm-d-fixture,.sm-d-fixture-list article,.sm-e-news-card,.sm-f-news-card,.sm-h-news-card,.sm-h-academy) {
    --theme-surface-text: var(--theme-panel-text); --theme-muted: var(--theme-panel-muted);
    background: var(--theme-surface); color: var(--theme-panel-text);
}
body[class*="sm-theme-"] :is(.sm-a-team-tab,.sm-b-team-card,.sm-b-video-link,.sm-d-tv,.sm-d-fixture,.sm-e-news-card,.sm-f-news-card,.sm-h-news-card,.sm-h-academy) :is(h2,h3,p,strong,small) { color: var(--theme-panel-text); }
body[class*="sm-theme-"] :is(.sm-a-line-title,.sm-b-section-head,.sm-d-section-head) :is(h2,a) { color: var(--theme-on-background); }
body[class*="sm-theme-"] :is(.sm-d-tv,.sm-d-fixture) .sm-d-section-head :is(h2,a) { color: var(--theme-panel-text); }
body[class*="sm-theme-"] :is(.sm-a-footer,.sm-b-footer,.sm-c-footer,.sm-d-footer,.sm-e-footer,.sm-f-footer,.sm-g-footer,.sm-h-footer,.sm-b-inner-footer) {
    --theme-surface-text: var(--theme-on-secondary); --theme-muted: var(--theme-on-secondary);
    background: var(--color-secondary); color: var(--theme-on-secondary);
}
body[class*="sm-theme-"] :is(.sm-a-footer,.sm-b-footer,.sm-c-footer,.sm-d-footer,.sm-e-footer,.sm-f-footer,.sm-g-footer,.sm-h-footer,.sm-b-inner-footer) :is(h2,h3,h6,p,a,strong,small) { color: var(--theme-on-secondary); }
body[class*="sm-theme-"] .sm-i-footer { background: var(--theme-surface); color: var(--theme-panel-text); }
body[class*="sm-theme-"] .sm-i-footer :is(h2,h3,p,a,strong,small,em) { color: var(--theme-panel-text); }
body[class*="sm-theme-"] :is(.sm-b-btn-white,.sm-c-btn-light) { background: var(--theme-surface); color: var(--theme-panel-text); }
body[class*="sm-theme-"] footer a[href$="/altyapi-kayit"] { background: var(--theme-action) !important; color: var(--theme-on-action) !important; }
body[class*="sm-theme-"] :is(.sm-d-outline-btn,.sm-e-btn-outline,.sm-f-btn-outline) { color: var(--theme-on-media); }
body[class*="sm-theme-"] .sm-d-hero { background-color: var(--theme-media-overlay); }

body[class*="sm-theme-"] .footer { background: var(--color-secondary) !important; color: var(--theme-on-secondary); --theme-surface-text: var(--theme-on-secondary); --theme-muted: var(--theme-on-secondary); }
body[class*="sm-theme-"] .footer :is(h2,h3,h6,p,a,strong,small) { color: var(--theme-on-secondary) !important; }
body[class*="sm-theme-"] :is(.sm-b-btn-white,.sm-c-btn-light,.sm-g-match-card > a) { background: var(--theme-surface); color: var(--theme-panel-text) !important; }
body[class*="sm-theme-"] :is(.sm-d-outline-btn,.sm-e-btn-outline,.sm-f-btn-outline) { color: var(--theme-on-media) !important; }
body[class*="sm-theme-"] .sm-d-fixture-list time strong { color: var(--theme-on-secondary); }
body[class*="sm-theme-"] .sm-d-sponsors > p { color: var(--theme-on-background); }
body[class*="sm-theme-"] .sm-g-home { --sm-g-ink: var(--theme-on-background); --sm-g-muted: var(--theme-on-background); }
body[class*="sm-theme-"] :is(.sm-g-hero-copy,.sm-g-quick,.sm-g-section-head,.sm-g-section-row,.sm-g-sponsor-list) :is(h1,p,a,strong,small) { color: var(--theme-on-background); }
body[class*="sm-theme-"] .sm-h-player-grid strong { color: var(--theme-panel-text); }
body[class*="sm-theme-"] .footer a[href$="/altyapi-kayit"] { background: var(--theme-action) !important; color: var(--theme-on-action) !important; }

body[class*="sm-theme-"] .footer .sm-b-inner-footer-cta { background: transparent !important; }
body[class*="sm-theme-"] .sm-g-feature-news { --theme-hero: var(--theme-media-overlay); --theme-surface-text: var(--theme-on-media); color: var(--theme-on-media); }
body[class*="sm-theme-"] .sm-g-feature-news > a { color: var(--theme-panel-text); }

body[class*="sm-theme-"] .sm-b-match-center > span { color: var(--theme-on-secondary); }
body[class*="sm-theme-"] .sm-f-hero-slide > span { color: var(--theme-on-media); }
