/* BELCANTO THEME READABILITY V34
   Final cascade layer for light and dark themes. */

html[data-theme="light"]{
  --read-bg:#ffffff;
  --read-surface:#f7f8fa;
  --read-surface-strong:#eef3f7;
  --read-text:#1a1a1a;
  --read-muted:#4a4f55;
  --read-border:#b8bec5;
  --read-blue-bg:#eaf4fb;
  --read-blue-border:#4f86ae;
  --read-blue-text:#173b57;
  --read-warn-bg:#fff3cd;
  --read-warn-border:#8a5a00;
  --read-warn-text:#513500;
  --read-danger-bg:#fde7ea;
  --read-danger-border:#a51d36;
  --read-danger-text:#671126;
  --read-focus:#005fcc;
}
html[data-theme="dark"]{
  --read-bg:#0b1724;
  --read-surface:#132536;
  --read-surface-strong:#182e41;
  --read-text:#f4f7fa;
  --read-muted:#c5d1db;
  --read-border:#587086;
  --read-blue-bg:#102b3d;
  --read-blue-border:#58b7dc;
  --read-blue-text:#e9f7ff;
  --read-warn-bg:#3b2c0e;
  --read-warn-border:#d9ae52;
  --read-warn-text:#fff0c2;
  --read-danger-bg:#42151d;
  --read-danger-border:#f07888;
  --read-danger-text:#ffe7ea;
  --read-focus:#8ccfff;
}

/* Modal shells and direct text nodes */
html[data-theme] .modal,
html[data-theme] .readiness-modal,
html[data-theme] .lesson-brief-modal,
html[data-theme] .post-session-modal,
html[data-theme] .voice-command-modal,
html[data-theme] .mic-sync-modal,
html[data-theme] .exercise-purpose-modal,
html[data-theme] .portable-import-modal{
  color:var(--read-text)!important;
  -webkit-text-fill-color:var(--read-text)!important;
  opacity:1!important;
}
html[data-theme="light"] .modal,
html[data-theme="light"] .readiness-modal,
html[data-theme="light"] .lesson-brief-modal,
html[data-theme="light"] .post-session-modal,
html[data-theme="light"] .voice-command-modal,
html[data-theme="light"] .mic-sync-modal,
html[data-theme="light"] .exercise-purpose-modal,
html[data-theme="light"] .portable-import-modal{
  background:var(--read-bg)!important;
  border-color:#c9cdd3!important;
}
html[data-theme="dark"] .modal,
html[data-theme="dark"] .readiness-modal,
html[data-theme="dark"] .lesson-brief-modal,
html[data-theme="dark"] .post-session-modal,
html[data-theme="dark"] .voice-command-modal,
html[data-theme="dark"] .mic-sync-modal,
html[data-theme="dark"] .exercise-purpose-modal,
html[data-theme="dark"] .portable-import-modal{
  background:var(--read-bg)!important;
  border-color:var(--read-border)!important;
}
html[data-theme] :is(.modal,.readiness-modal,.lesson-brief-modal,.post-session-modal,.voice-command-modal,.mic-sync-modal,.exercise-purpose-modal,.portable-import-modal)
:is(h1,h2,h3,h4,h5,h6,strong,b,legend){
  color:var(--read-text)!important;
  -webkit-text-fill-color:var(--read-text)!important;
  opacity:1!important;
}
html[data-theme] :is(.modal,.readiness-modal,.lesson-brief-modal,.post-session-modal,.voice-command-modal,.mic-sync-modal,.exercise-purpose-modal,.portable-import-modal)
:is(p,li,dd,dt,label,small,span,em,.muted,.subtle,.caption,.help-copy,.lesson-brief-meta,.post-note,.post-select){
  color:var(--read-muted)!important;
  -webkit-text-fill-color:var(--read-muted)!important;
  opacity:1!important;
}

/* Advisory modal: these are div elements, so generic paragraph rules do not reach them. */
html[data-theme] .advisory-badge{
  background:var(--read-warn-bg)!important;
  border-color:var(--read-warn-border)!important;
  color:var(--read-warn-text)!important;
  -webkit-text-fill-color:var(--read-warn-text)!important;
  opacity:1!important;
}
html[data-theme] .advisory-modal.high .advisory-badge{
  background:var(--read-danger-bg)!important;
  border-color:var(--read-danger-border)!important;
  color:var(--read-danger-text)!important;
  -webkit-text-fill-color:var(--read-danger-text)!important;
}
html[data-theme] .advisory-reason{
  background:var(--read-surface)!important;
  border-color:var(--read-border)!important;
  color:var(--read-text)!important;
  -webkit-text-fill-color:var(--read-text)!important;
  opacity:1!important;
}
html[data-theme] .advisory-target{
  background:var(--read-blue-bg)!important;
  border-color:var(--read-blue-border)!important;
  color:var(--read-blue-text)!important;
  -webkit-text-fill-color:var(--read-blue-text)!important;
  opacity:1!important;
}
html[data-theme] .advisory-modal .source-box{
  background:var(--read-surface)!important;
  border-color:var(--read-border)!important;
  color:var(--read-muted)!important;
  -webkit-text-fill-color:var(--read-muted)!important;
  opacity:1!important;
}

/* Other direct-label components that formerly retained dark-theme pastels in light mode. */
html[data-theme] .lesson-brief-kicker,
html[data-theme] .exercise-purpose-scroll>.lesson-brief-kicker{
  color:var(--read-blue-text)!important;
  -webkit-text-fill-color:var(--read-blue-text)!important;
  opacity:1!important;
}
html[data-theme] .lesson-brief-body,
html[data-theme] .lesson-brief-summary,
html[data-theme] .lesson-brief-list li,
html[data-theme] .lesson-brief-note,
html[data-theme] .exercise-purpose-evidence-note,
html[data-theme] .portable-import-note,
html[data-theme] .selection-notice,
html[data-theme] .report-disclaimer{
  color:var(--read-muted)!important;
  -webkit-text-fill-color:var(--read-muted)!important;
  opacity:1!important;
}
html[data-theme] .lesson-brief-summary,
html[data-theme] .lesson-brief-note,
html[data-theme] .exercise-purpose-evidence-note,
html[data-theme] .portable-import-note{
  background:var(--read-surface)!important;
  border-color:var(--read-border)!important;
}
html[data-theme] .round-chip,
html[data-theme] .day-card .open-day,
html[data-theme] .audit-pass,
html[data-theme] .audit-fail{
  opacity:1!important;
}
html[data-theme="light"] .day-card .open-day{
  color:#174a70!important;
  -webkit-text-fill-color:#174a70!important;
}
html[data-theme="dark"] .day-card .open-day{
  color:#b8e3ff!important;
  -webkit-text-fill-color:#b8e3ff!important;
}

/* V33 reflection controls and dynamically injected panels. */
html[data-theme] .v33-reflection-note,
html[data-theme] #v33SelectedCount,
html[data-theme] .v33-trait-group>strong,
html[data-theme] .v33-decision-panel small,
html[data-theme] .v33-decision-panel span,
html[data-theme] .reflection-decision-copy small,
html[data-theme] .reflection-decision-status{
  color:var(--read-muted)!important;
  -webkit-text-fill-color:var(--read-muted)!important;
  opacity:1!important;
}
html[data-theme] .v33-more-panel,
html[data-theme] .v33-decision-panel,
html[data-theme] .reflection-decision-panel{
  background:var(--read-surface)!important;
  border-color:var(--read-border)!important;
}
html[data-theme] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]){
  opacity:1!important;
}
html[data-theme="light"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]){
  background:#fff!important;
  border-color:#aeb5bc!important;
  color:#202428!important;
  -webkit-text-fill-color:#202428!important;
}
html[data-theme="light"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]):hover{
  background:#f0f4f7!important;
  border-color:#69747e!important;
}
html[data-theme="light"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]).selected,
html[data-theme="light"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision])[aria-pressed="true"]{
  background:#dceef9!important;
  border-color:#2f76a8!important;
  color:#123b59!important;
  -webkit-text-fill-color:#123b59!important;
}
html[data-theme="dark"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]){
  background:#132536!important;
  border-color:#587086!important;
  color:#e6edf3!important;
  -webkit-text-fill-color:#e6edf3!important;
}
html[data-theme="dark"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision]).selected,
html[data-theme="dark"] :is(.choice,.reflection-decision-choice,[data-v33-trait],[data-v33-decision])[aria-pressed="true"]{
  background:#183b51!important;
  border-color:#65b9dd!important;
  color:#f4fbff!important;
  -webkit-text-fill-color:#f4fbff!important;
}

/* Controls must retain readable text after nested spans or icons are inserted. */
html[data-theme] :is(button,.btn,.pill,.tag,.flag,.round-chip) :is(span,strong,b,small){
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}
html[data-theme] :is(button,.btn,input,select,textarea,[tabindex]):focus-visible{
  outline:3px solid var(--read-focus)!important;
  outline-offset:3px!important;
}
html[data-theme="light"] :is(button,.btn,input,select,textarea):disabled,
html[data-theme="light"] [aria-disabled="true"]{
  color:#5b6269!important;
  -webkit-text-fill-color:#5b6269!important;
  opacity:1!important;
}
html[data-theme="dark"] :is(button,.btn,input,select,textarea):disabled,
html[data-theme="dark"] [aria-disabled="true"]{
  color:#b7c2cc!important;
  -webkit-text-fill-color:#b7c2cc!important;
  opacity:1!important;
}

@media (prefers-contrast:more){
  html[data-theme] .advisory-reason,
  html[data-theme] .advisory-target,
  html[data-theme] .advisory-modal .source-box,
  html[data-theme] .v33-decision-panel,
  html[data-theme] .reflection-decision-panel{border-width:2px!important}
  html[data-theme] :is(button,.btn,input,select,textarea,[tabindex]):focus-visible{outline-width:4px!important}
}
@media (forced-colors:active){
  html[data-theme] .advisory-badge,
  html[data-theme] .advisory-reason,
  html[data-theme] .advisory-target,
  html[data-theme] .advisory-modal .source-box,
  html[data-theme] .v33-decision-panel,
  html[data-theme] .reflection-decision-panel{
    forced-color-adjust:auto!important;
    background:Canvas!important;
    color:CanvasText!important;
    -webkit-text-fill-color:CanvasText!important;
    border-color:CanvasText!important;
  }
}
