/* v34 final readability layer.
   Loaded after all feature styles so light, dark and system mode keep readable text
   without changing application behavior or brand CTA colors. */

:root,
html[data-color-mode="light"]{
  --read-page:#fbfaff;
  --read-surface:#ffffff;
  --read-surface-2:#f6f7fb;
  --read-ink:#171a28;
  --read-body:#4d586d;
  --read-muted:#697386;
  --read-line:#e3e6ee;
  --read-input:#ffffff;
  --read-input-text:#17213a;
  --read-placeholder:#778196;
  --read-link:#4f3bc7;
  --read-danger:#b42335;
}

html[data-color-mode="dark"]{
  color-scheme:dark;
  --read-page:#080a11;
  --read-surface:#111520;
  --read-surface-2:#171c29;
  --read-ink:#f4f6fb;
  --read-body:#d5dbe7;
  --read-muted:#aeb7c8;
  --read-line:#30384a;
  --read-input:#171c29;
  --read-input-text:#f5f7fb;
  --read-placeholder:#929caf;
  --read-link:#a99cff;
  --read-danger:#ff9da8;
}

@media(prefers-color-scheme:dark){
  html[data-color-mode="system"]{
    color-scheme:dark;
    --read-page:#080a11;
    --read-surface:#111520;
    --read-surface-2:#171c29;
    --read-ink:#f4f6fb;
    --read-body:#d5dbe7;
    --read-muted:#aeb7c8;
    --read-line:#30384a;
    --read-input:#171c29;
    --read-input-text:#f5f7fb;
    --read-placeholder:#929caf;
    --read-link:#a99cff;
    --read-danger:#ff9da8;
  }
}

/* Core readable defaults. Admin is intentionally forced to light mode in layout.php. */
html body:not(.admin-workspace){color:var(--read-body)!important}
html body:not(.admin-workspace) :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend,summary,dt){color:var(--read-ink)!important}
html body:not(.admin-workspace) :where(p,li,dd){color:var(--read-body)!important}
html body:not(.admin-workspace) :where(small,.card-meta,.article-byline,.social-username,.copyright,.panel-foot){color:var(--read-muted)!important}
html body:not(.admin-workspace) a:not(.button):not(.gam-primary-link):not(.gam-banner-cta):not(.gam-submit):not(.gam-success-whatsapp){text-decoration-color:currentColor}

/* Surfaces that commonly carried hard-coded white/light colors. */
html body:not(.admin-workspace) :where(
  .article-card,.article-detail,.author-box,.simple-page,.not-found,.hero-panel,
  .search-box,.site-footer,.contact-form,.dashboard-content,.account-main,
  .course-detail,.notification-card,.lesson-card,.comment-card,.social-profile-card,
  .social-panel,.settings-card,.settings-hub-card,.public-profile-card,
  .public-profile-activity,.public-activity-card,.history-card,.article-reference-detail,
  .article-sidebar-card,.article-faq,.live-search-result,.member-directory-card
){
  background-color:var(--read-surface)!important;
  border-color:var(--read-line)!important;
  color:var(--read-ink)!important;
}

html body:not(.admin-workspace) :where(
  input,textarea,select,option,.live-search-box,.header-discovery-search
){
  background-color:var(--read-input)!important;
  border-color:var(--read-line)!important;
  color:var(--read-input-text)!important;
  caret-color:var(--read-input-text)!important;
}
html body:not(.admin-workspace) :where(input,textarea)::placeholder{color:var(--read-placeholder)!important;opacity:1!important}
html body:not(.admin-workspace) select option{background:var(--read-input)!important;color:var(--read-input-text)!important}

/* Header/footer/navigation readability in every mode. */
html body:not(.admin-workspace) .site-header{border-color:var(--read-line)!important}
html body:not(.admin-workspace) .site-header :where(.nav-wordmark,.site-nav a,.mobile-search-trigger,.nav-icon,.notification-link){color:var(--read-ink)!important;opacity:1!important}
html body:not(.admin-workspace) .site-nav a:hover,
html body:not(.admin-workspace) .site-nav a[aria-current="page"]{color:var(--read-link)!important}
html body:not(.admin-workspace) .footer-grid :where(p,a),
html body:not(.admin-workspace) .copyright{color:var(--read-muted)!important;opacity:1!important}

/* Keep primary branded controls readable. */
html body :where(.button,.gam-primary-link,.gam-submit,.gam-success-whatsapp){color:#fff!important}
html body .button *{color:inherit!important}
html body .form-error,
html body .gam-form-error{color:var(--read-danger)!important}

/* Article/content typography. */
html body:not(.admin-workspace) .article-content{color:var(--read-body)!important}
html body:not(.admin-workspace) .article-content :where(h1,h2,h3,h4,h5,h6,strong,b){color:var(--read-ink)!important}
html body:not(.admin-workspace) .article-content :where(p,li,td){color:var(--read-body)!important}
html body:not(.admin-workspace) .article-content a{color:var(--read-link)!important}
html body:not(.admin-workspace) .article-content :where(code:not(pre code),blockquote,table th){background:var(--read-surface-2)!important;border-color:var(--read-line)!important;color:var(--read-ink)!important}
html body:not(.admin-workspace) .article-content :where(table td,table th){border-color:var(--read-line)!important}

/* GAM page: explicit light-mode contrast. */
html[data-color-mode="light"] body .gam-page,
:root body .gam-page{
  --gam-readable-ink:#0f1d34;
  --gam-readable-body:#526078;
  --gam-readable-muted:#69778d;
}
html[data-color-mode="light"] body .gam-page :is(.gam-hero h1,.gam-section-heading h2,.gam-form-intro h2,.gam-plan-card h3,.gam-price,.gam-path-card h3,.gam-stage-choice legend,.gam-stage-choice strong,.gam-form label,.gam-plan-choice legend,.gam-faq-list summary,.gam-contact-card strong,.gam-success h2,.gam-paused h2){color:var(--gam-readable-ink)!important}
html[data-color-mode="light"] body .gam-page :is(.gam-hero-copy>p,.gam-section-heading p,.gam-form-intro>p,.gam-plan-card>p,.gam-plan-card li,.gam-path-card p,.gam-path-card li,.gam-stage-choice small,.gam-form-benefits span,.gam-faq-list p,.gam-official-note,.gam-form-note,.gam-consent span,.gam-success p,.gam-paused p,.gam-success>small){color:var(--gam-readable-body)!important}
html[data-color-mode="light"] body .gam-page :is(.gam-plan-card,.gam-path-card,.gam-form-card,.gam-contact-card,.gam-faq-list details,.gam-stage-choice label>span){background:#fff!important;border-color:#d8e0ec!important}
html[data-color-mode="light"] body .gam-page :is(.gam-form input,.gam-form select,.gam-form textarea){background:#fff!important;border-color:#c8d2e2!important;color:#14233c!important}
html[data-color-mode="light"] body .gam-page :is(.gam-form input,.gam-form textarea)::placeholder{color:#748096!important}
html[data-color-mode="light"] body .gam-page .gam-trust-row span{background:#fff!important;border-color:#d8e0ec!important;color:#33435e!important}
html[data-color-mode="light"] body .gam-page .gam-secondary-link{background:#fff!important;border-color:#cdd7e6!important;color:#183e91!important}
html[data-color-mode="light"] body .gam-page .gam-path-card>a{background:#edf3ff!important;color:#174bbb!important}
html[data-color-mode="light"] body .gam-page .gam-success-email{background:#fff!important;border-color:#cdd7e6!important;color:#174bbb!important}

/* GAM dark-mode contrast. This is deliberately stronger than the older component rules. */
html[data-color-mode="dark"] body .gam-page{background:#07101f!important;color:#eaf0fa!important}
html[data-color-mode="dark"] body .gam-page :is(.gam-hero h1,.gam-section-heading h2,.gam-form-intro h2,.gam-plan-card h3,.gam-price,.gam-path-card h3,.gam-stage-choice legend,.gam-stage-choice strong,.gam-form label,.gam-plan-choice legend,.gam-faq-list summary,.gam-contact-card strong,.gam-success h2,.gam-paused h2){color:#f7f9ff!important}
html[data-color-mode="dark"] body .gam-page :is(.gam-hero-copy>p,.gam-section-heading p,.gam-form-intro>p,.gam-plan-card>p,.gam-plan-card li,.gam-path-card p,.gam-path-card li,.gam-stage-choice small,.gam-form-benefits span,.gam-faq-list p,.gam-official-note,.gam-form-note,.gam-consent span,.gam-success p,.gam-paused p,.gam-success>small){color:#c4cede!important}
html[data-color-mode="dark"] body .gam-page :is(.gam-plan-card,.gam-path-card,.gam-form-card,.gam-contact-card,.gam-faq-list details,.gam-stage-choice label>span){background:#111d31!important;border-color:#34445f!important;color:#f3f6fc!important}
html[data-color-mode="dark"] body .gam-page :is(.gam-form input,.gam-form select,.gam-form textarea){background:#091426!important;border-color:#465874!important;color:#f4f7fd!important}
html[data-color-mode="dark"] body .gam-page :is(.gam-form input,.gam-form textarea)::placeholder{color:#9ba8ba!important}
html[data-color-mode="dark"] body .gam-page .gam-trust-row span{background:#111d31!important;border-color:#34445f!important;color:#e1e8f3!important}
html[data-color-mode="dark"] body .gam-page .gam-secondary-link{background:#111d31!important;border-color:#465874!important;color:#dbe7ff!important}
html[data-color-mode="dark"] body .gam-page .gam-path-card>a{background:#172b50!important;color:#dce7ff!important;border:1px solid #426399!important}
html[data-color-mode="dark"] body .gam-page .gam-stage-choice input:checked+span,
html[data-color-mode="dark"] body .gam-page .gam-plan-choice input:checked+span{background:#183364!important;border-color:#6c93ff!important;color:#fff!important}
html[data-color-mode="dark"] body .gam-page .gam-success-email{background:#111d31!important;border-color:#465874!important;color:#b9ceff!important}

/* Preserve the intentionally dark GAM promotional panels in every color mode. */
html body .gam-page :is(.gam-hero-panel,.gam-standards){background:#08172f!important;color:#fff!important}
html body .gam-page .gam-hero-panel :is(.gam-panel-label,.gam-banner-path strong){color:#f5fbff!important}
html body .gam-page .gam-hero-panel .gam-banner-path span{color:#d8e4f7!important}
html body .gam-page .gam-hero-panel .gam-banner-path>b{color:#fff!important}
html body .gam-page .gam-standards :is(h2,h3){color:#fff!important}
html body .gam-page .gam-standards .gam-standard-grid p{color:#c1cddd!important}
html body .gam-page .gam-standards .gam-standard-grid strong{color:#70e2d3!important}
html body .gam-page .gam-banner-cta{background:#fff!important;color:#143a91!important}

@media(prefers-color-scheme:dark){
  html[data-color-mode="system"] body .gam-page{background:#07101f!important;color:#eaf0fa!important}
  html[data-color-mode="system"] body .gam-page :is(.gam-hero h1,.gam-section-heading h2,.gam-form-intro h2,.gam-plan-card h3,.gam-price,.gam-path-card h3,.gam-stage-choice legend,.gam-stage-choice strong,.gam-form label,.gam-plan-choice legend,.gam-faq-list summary,.gam-contact-card strong,.gam-success h2,.gam-paused h2){color:#f7f9ff!important}
  html[data-color-mode="system"] body .gam-page :is(.gam-hero-copy>p,.gam-section-heading p,.gam-form-intro>p,.gam-plan-card>p,.gam-plan-card li,.gam-path-card p,.gam-path-card li,.gam-stage-choice small,.gam-form-benefits span,.gam-faq-list p,.gam-official-note,.gam-form-note,.gam-consent span,.gam-success p,.gam-paused p,.gam-success>small){color:#c4cede!important}
  html[data-color-mode="system"] body .gam-page :is(.gam-plan-card,.gam-path-card,.gam-form-card,.gam-contact-card,.gam-faq-list details,.gam-stage-choice label>span){background:#111d31!important;border-color:#34445f!important;color:#f3f6fc!important}
  html[data-color-mode="system"] body .gam-page :is(.gam-form input,.gam-form select,.gam-form textarea){background:#091426!important;border-color:#465874!important;color:#f4f7fd!important}
  html[data-color-mode="system"] body .gam-page :is(.gam-form input,.gam-form textarea)::placeholder{color:#9ba8ba!important}
  html[data-color-mode="system"] body .gam-page .gam-trust-row span{background:#111d31!important;border-color:#34445f!important;color:#e1e8f3!important}
  html[data-color-mode="system"] body .gam-page .gam-secondary-link{background:#111d31!important;border-color:#465874!important;color:#dbe7ff!important}
  html[data-color-mode="system"] body .gam-page .gam-path-card>a{background:#172b50!important;color:#dce7ff!important;border:1px solid #426399!important}
  html[data-color-mode="system"] body .gam-page .gam-stage-choice input:checked+span,
  html[data-color-mode="system"] body .gam-page .gam-plan-choice input:checked+span{background:#183364!important;border-color:#6c93ff!important;color:#fff!important}
  html[data-color-mode="system"] body .gam-page .gam-success-email{background:#111d31!important;border-color:#465874!important;color:#b9ceff!important}
}

/* Small-screen text must never fade because of opacity or inherited hover states. */
@media(max-width:760px){
  html body:not(.admin-workspace) :where(.nav-wordmark,.nav-wordmark span,.mobile-bottom-nav a,.mobile-bottom-nav span,.gam-page h1,.gam-page h2,.gam-page h3,.gam-page p,.gam-page li,.gam-page label,.gam-page small,.gam-page strong){opacity:1!important}
  html body:not(.admin-workspace) .mobile-bottom-nav>a{color:var(--read-body)!important}
  html body:not(.admin-workspace) .mobile-bottom-nav>a[aria-current="page"]{background:#6755e7!important;border-color:#6755e7!important;color:#fff!important}
  html body:not(.admin-workspace) .mobile-bottom-nav>a[aria-current="page"] *{color:#fff!important}
}

html[data-color-mode="dark"] body:not(.admin-workspace) .mobile-bottom-nav>a{color:#dfe5f2!important}
@media(prefers-color-scheme:dark){html[data-color-mode="system"] body:not(.admin-workspace) .mobile-bottom-nav>a{color:#dfe5f2!important}}
