/* V6.19 — definitive dark-theme readability repair.
   Loaded last so native controls, viewer controls, project controls, and selected
   language text remain readable after every earlier theme stylesheet. */
:root{
  --v619-dark-bg:#101d31;
  --v619-dark-bg-hover:#172a45;
  --v619-dark-border:#4c6585;
  --v619-dark-text:#f8fafc;
  --v619-dark-muted:#d7e1ee;
  --v619-light-bg:#ffffff;
  --v619-light-border:#cbd8e8;
  --v619-light-text:#0e1726;
}

/* Main portfolio header controls. */
html[data-front-theme="dark"] :where(.front-theme-control,.front-language-control){
  background:var(--v619-dark-bg)!important;
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  border-color:var(--v619-dark-border)!important;
  opacity:1!important;
  text-shadow:0 1px 1px rgba(0,0,0,.42)!important;
}
html[data-front-theme="dark"] :where(.front-theme-control span,.front-language-control span,.front-language-control select){
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  opacity:1!important;
  font-weight:800!important;
}
html[data-front-theme="dark"] .front-language-control select{
  background:transparent!important;
  color-scheme:dark!important;
}
html[data-front-theme="dark"] .front-language-control select option{
  background:var(--v619-dark-bg)!important;
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
}

/* Desktop/laptop project-viewer controls — fixes the black “Dark / English” text. */
html[data-front-theme="dark"] .viewer :where(.viewer__theme-control,.viewer__language-control){
  background:var(--v619-dark-bg)!important;
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  border-color:var(--v619-dark-border)!important;
  opacity:1!important;
  box-shadow:0 5px 16px rgba(0,0,0,.34)!important;
  text-shadow:0 1px 1px rgba(0,0,0,.42)!important;
}
html[data-front-theme="dark"] .viewer :where(
  .viewer__theme-control span,
  .viewer__theme-control #viewerThemeLabel,
  .viewer__language-control .viewer__control-icon,
  .viewer__language-control::after,
  #viewerLanguageControl
){
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  opacity:1!important;
  font-weight:800!important;
}
html[data-front-theme="dark"] .viewer #viewerLanguageControl{
  background:transparent!important;
  color-scheme:dark!important;
}
html[data-front-theme="dark"] .viewer #viewerLanguageControl option{
  background:var(--v619-dark-bg)!important;
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
}
html[data-front-theme="dark"] .viewer :where(.viewer__theme-control,.viewer__language-control):hover{
  background:var(--v619-dark-bg-hover)!important;
  border-color:#78b9ff!important;
}

/* Standalone project theme controls use data-apu-theme. */
html[data-apu-theme="dark"] :where(
  .viewer__theme-control,.viewer__language-control,
  .apu-theme-control,.apu-language-control,
  [data-theme-control],[data-language-control]
){
  background:var(--v619-dark-bg)!important;
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  border-color:var(--v619-dark-border)!important;
  opacity:1!important;
}
html[data-apu-theme="dark"] :where(
  #viewerThemeLabel,#viewerLanguageControl,
  select,select option,
  [data-theme-control] span,[data-language-control] span
){
  color:var(--v619-dark-text)!important;
  -webkit-text-fill-color:var(--v619-dark-text)!important;
  opacity:1!important;
}
html[data-apu-theme="dark"] select{color-scheme:dark!important}
html[data-apu-theme="dark"] select option{background:var(--v619-dark-bg)!important}

/* Inputs and muted copy must remain legible without turning bright cards white. */
html[data-front-theme="dark"] :where(.viewer,.site-header,.mobile-menu) input::placeholder,
html[data-apu-theme="dark"] :where(input,textarea)::placeholder{
  color:var(--v619-dark-muted)!important;
  -webkit-text-fill-color:var(--v619-dark-muted)!important;
  opacity:.82!important;
}
html[data-front-theme="dark"] :where(.viewer,.site-header,.mobile-menu) :where(button,label,select,input,a){
  text-decoration-color:currentColor!important;
}

/* Explicit light-theme reset prevents stale inline colors after switching themes. */
html[data-front-theme="light"] .viewer :where(.viewer__theme-control,.viewer__language-control),
html[data-front-theme="light"] :where(.front-theme-control,.front-language-control){
  background:var(--v619-light-bg)!important;
  color:var(--v619-light-text)!important;
  -webkit-text-fill-color:var(--v619-light-text)!important;
  border-color:var(--v619-light-border)!important;
  text-shadow:none!important;
}
html[data-front-theme="light"] .viewer :where(#viewerThemeLabel,#viewerLanguageControl,.viewer__control-icon),
html[data-front-theme="light"] :where(.front-theme-control span,.front-language-control span,.front-language-control select){
  color:var(--v619-light-text)!important;
  -webkit-text-fill-color:var(--v619-light-text)!important;
}
html[data-front-theme="light"] :where(#viewerLanguageControl,.front-language-control select){color-scheme:light!important}
html[data-front-theme="light"] :where(#viewerLanguageControl,.front-language-control select) option{
  background:var(--v619-light-bg)!important;
  color:var(--v619-light-text)!important;
  -webkit-text-fill-color:var(--v619-light-text)!important;
}
