/* Sierra Shph adaptive foreground and control contrast system — v1.8.6 */
:root{
  --shph-auto-light-text:#ffffff;
  --shph-auto-light-heading:#ffffff;
  --shph-auto-light-muted:#ffffff;
  --shph-auto-light-subtle:#ffffff;
  --shph-auto-light-link:#ffffff;
  --shph-auto-light-border:rgba(255,255,255,.24);
  --shph-auto-light-control:rgba(7,12,20,.68);
  --shph-auto-light-control-border:rgba(255,255,255,.30);
  --shph-auto-dark-text:#000000;
  --shph-auto-dark-heading:#000000;
  --shph-auto-dark-muted:#000000;
  --shph-auto-dark-subtle:#000000;
  --shph-auto-dark-link:#000000;
  --shph-auto-dark-border:rgba(15,23,42,.22);
  --shph-auto-dark-control:rgba(255,255,255,.92);
  --shph-auto-dark-control-border:rgba(15,23,42,.25);
}

html[data-theme="dark"],html[data-admin-theme="dark"],body.dark-only{color-scheme:dark}
html[data-theme="light"],html[data-admin-theme="light"]{color-scheme:light}

/* Safe no-script/first-paint inheritance. The runtime engine refines each individual surface. */
html[data-theme="dark"] body,html[data-admin-theme="dark"] body,body.dark-only{color:#fff}
html[data-theme="light"] body,html[data-admin-theme="light"] body{color:#000}
:where(button,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],.btn,.nav-link,.dropdown-item,.list-group-item){color:inherit}

[data-shph-tone="dark"]{
  --shph-auto-text:var(--shph-auto-light-text);
  --shph-auto-heading:var(--shph-auto-light-heading);
  --shph-auto-muted:var(--shph-auto-light-muted);
  --shph-auto-subtle:var(--shph-auto-light-subtle);
  --shph-auto-link:var(--shph-auto-light-link);
  --shph-auto-border:var(--shph-auto-light-border);
  --shph-auto-control:var(--shph-auto-light-control);
  --shph-auto-control-border:var(--shph-auto-light-control-border);
  color:var(--shph-auto-text);
  color-scheme:dark;
}
[data-shph-tone="light"]{
  --shph-auto-text:var(--shph-auto-dark-text);
  --shph-auto-heading:var(--shph-auto-dark-heading);
  --shph-auto-muted:var(--shph-auto-dark-muted);
  --shph-auto-subtle:var(--shph-auto-dark-subtle);
  --shph-auto-link:var(--shph-auto-dark-link);
  --shph-auto-border:var(--shph-auto-dark-border);
  --shph-auto-control:var(--shph-auto-dark-control);
  --shph-auto-control-border:var(--shph-auto-dark-control-border);
  color:var(--shph-auto-text);
  color-scheme:light;
}

/* Every text category resolves against the variables of its nearest detected surface. */
[data-shph-tone] :where(h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6,.display-1,.display-2,.display-3,.display-4,.display-5,.display-6,.card-title,.modal-title,.offcanvas-title,.dropdown-header,.accordion-button,.form-label,legend,dt,strong,b){
  color:var(--shph-auto-heading)!important;
  -webkit-text-fill-color:currentColor;
}
[data-shph-tone] :where(p,li,dd,td,th,label,span,div,figcaption,caption,output,summary,code,pre,time,address,blockquote,cite,samp,var):not(.btn):not(.badge):not(.alert):not([data-shph-preserve-text-color="true"]):not(.gradient-text):not([class*="gradient-text"]):not([data-shph-clipped-text="true"]){
  color:var(--shph-auto-text)!important;
  -webkit-text-fill-color:currentColor;
  border-color:inherit;
}
[data-shph-tone] :where(.text-muted,.form-text,small,.small,.help-text,.hint,.eyebrow,.meta,.metadata,[class*="-meta"],[class*="-hint"],[class*="-help"],[class*="-subtitle"],[class*="-description"]):not(.badge):not(.btn){
  color:var(--shph-auto-muted)!important;
  -webkit-text-fill-color:currentColor;
  opacity:1;
}
[data-shph-tone] :where(a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item)){
  color:var(--shph-auto-link)!important;
  -webkit-text-fill-color:currentColor;
  text-decoration-color:color-mix(in srgb,currentColor 45%,transparent);
  text-underline-offset:.16em;
}
[data-shph-tone] :where(a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item)):hover{color:var(--shph-auto-heading)!important}
[data-shph-tone] :where(hr,.border,.border-top,.border-end,.border-bottom,.border-start){border-color:var(--shph-auto-border)!important}
[data-shph-tone] :where(svg:not([data-preserve-color]),i:not([data-preserve-color])){color:currentColor}
[data-shph-tone] :where(svg:not([data-preserve-color]) [fill="currentColor"]){fill:currentColor}
[data-shph-tone] :where(svg:not([data-preserve-color]) [stroke="currentColor"]){stroke:currentColor}

/* Normalize fixed framework/helper foreground utilities whenever they conflict with the detected surface. */
[data-shph-tone="dark"] :where(.text-dark,.text-black,.text-body,.text-body-emphasis):not(.badge):not(.btn){color:var(--shph-auto-text)!important;-webkit-text-fill-color:currentColor}
[data-shph-tone="light"] :where(.text-white,.text-light):not(.badge):not(.btn):not([data-preserve-color]){color:var(--shph-auto-text)!important;-webkit-text-fill-color:currentColor}
[data-shph-tone] :where(.text-success,.text-danger,.text-warning,.text-info,.text-primary,.text-secondary):not(.gradient-text):not([data-shph-clipped-text="true"]){color:var(--shph-auto-text)!important;-webkit-text-fill-color:currentColor;text-shadow:none}

/* Text-entry controls inherit the actual tone of their containing panel. */
[data-shph-tone] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]),select,textarea,.form-control,.form-select,.input-group-text){
  color:var(--shph-auto-text)!important;
  -webkit-text-fill-color:currentColor;
  background-color:var(--shph-auto-control)!important;
  border-color:var(--shph-auto-control-border)!important;
}
[data-shph-tone] :where(input,textarea,.form-control)::placeholder{color:var(--shph-auto-subtle)!important;-webkit-text-fill-color:currentColor;opacity:1}
[data-shph-tone="dark"] :where(select option,select optgroup){color:#fff!important;background:#151d29!important}
[data-shph-tone="light"] :where(select option,select optgroup){color:#000!important;background:#fff!important}
[data-shph-tone] :where(input,select,textarea,.form-control,.form-select):disabled{color:var(--shph-auto-muted)!important;-webkit-text-fill-color:currentColor;opacity:.78}
[data-shph-tone] :where(input[type="file"]::file-selector-button){color:inherit;background:color-mix(in srgb,currentColor 9%,transparent);border-color:var(--shph-auto-control-border)}
[data-shph-tone] :where(input[type="search"]::-webkit-search-cancel-button){filter:grayscale(1);opacity:.85}

/* All button-like text is forced to the foreground selected for that exact button surface. */
:where(button,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],a.btn,.btn,.badge,.alert,.dropdown-item,.list-group-item,.nav-link,.icon-button,.photo-tool-button,.photo-icon-button,.accordion-button,.page-link)[data-shph-tone]{
  color:var(--shph-auto-text)!important;
  -webkit-text-fill-color:currentColor;
  border-color:var(--shph-auto-border);
}
:where(button,[role="button"],a.btn,.btn,.badge,.alert,.dropdown-item,.list-group-item,.nav-link,.icon-button,.photo-tool-button,.photo-icon-button,.accordion-button,.page-link)[data-shph-tone] :where(*){
  color:inherit!important;
  -webkit-text-fill-color:currentColor;
}
:where(input[type="button"],input[type="submit"],input[type="reset"])[data-shph-tone]{color:var(--shph-auto-text)!important;-webkit-text-fill-color:currentColor}
:where(button,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],.btn)[data-shph-tone]:disabled,
:where(button,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],.btn)[data-shph-tone].disabled{color:var(--shph-auto-muted)!important;-webkit-text-fill-color:currentColor;opacity:.72}
[data-shph-tone="dark"].btn-close{filter:invert(1) grayscale(1) brightness(2);opacity:.9}
[data-shph-tone="light"].btn-close{filter:none;opacity:.78}

/* Native and generated text-bearing surfaces. */
:where(mark,kbd)[data-shph-tone],:where(mark,kbd)[data-shph-tone] *{color:var(--shph-auto-text)!important;-webkit-text-fill-color:currentColor}
[data-shph-tone]::placeholder{color:var(--shph-auto-subtle)!important}
[data-shph-tone]::before,[data-shph-tone]::after{color:currentColor}
[data-shph-tone] ::selection{color:var(--shph-auto-control);background:var(--shph-auto-text)}

/* Image surfaces: use sampled tone when available; otherwise use a safe foreground and readability scrim. */
[data-shph-has-image="true"][data-shph-tone="dark"]{--shph-image-text-shadow:0 1px 2px rgba(0,0,0,.72),0 8px 24px rgba(0,0,0,.32)}
[data-shph-has-image="true"][data-shph-tone="light"]{--shph-image-text-shadow:0 1px 2px rgba(255,255,255,.84),0 8px 24px rgba(255,255,255,.32)}
[data-shph-has-image="true"] :where(h1,h2,h3,h4,h5,h6,p,span,small,strong,a:not(.btn),label){text-shadow:var(--shph-image-text-shadow)}
[data-shph-has-image="true"][data-shph-auto-scrim="true"][data-shph-tone="dark"]{
  background-color:rgba(3,7,14,.72)!important;
  background-blend-mode:multiply;
}
[data-shph-has-image="true"][data-shph-auto-scrim="true"][data-shph-tone="light"]{
  background-color:rgba(255,255,255,.76)!important;
  background-blend-mode:screen;
}

/* Explicit author controls for artwork and intentional colored type. */
[data-shph-contrast="dark"],[data-shph-image-tone="dark"]{--shph-forced-tone:dark}
[data-shph-contrast="light"],[data-shph-image-tone="light"]{--shph-forced-tone:light}
[data-shph-preserve-text-color="true"],[data-shph-preserve-text-color="true"] *{color:revert!important;-webkit-text-fill-color:revert!important}
[data-shph-clipped-text="true"],.gradient-text,[class*="gradient-text"]{-webkit-text-fill-color:transparent!important}

/* Legacy informational copy must remain readable rather than decoratively dimmed. */
[data-shph-tone] :where(.collection-card p,.collection-editor-preview p,.shph-loader-credit,.video-duration.is-pending){opacity:1!important}

@media (forced-colors:active){
  [data-shph-tone]{forced-color-adjust:auto;color:CanvasText!important;background:Canvas!important;border-color:CanvasText!important}
  [data-shph-has-image="true"] :where(h1,h2,h3,h4,h5,h6,p,span,small,strong,a,label){text-shadow:none}
}
