/* AI FORGE - shared dual theme V2.1 / 2026-09-15.
   Text gold is intentionally darker than button gold in the light theme.
   Only presentation and theme navigation are changed. */
html[data-theme="dark"] {
  color-scheme:dark;
  --aif-bg:#080806;--aif-surface:#0f0e0b;--aif-soft:#17140f;
  --aif-ink:#f3f0e8;--aif-text:#c7c1b6;--aif-muted:#aaa295;
  --aif-gold-text:#f0cf87;--aif-accent:#d3ad61;--aif-accent-hover:#f0cf87;
  --aif-on-accent:#17130d;--aif-line:#484238;--aif-control:#8d826f;
  --aif-header:rgba(8,8,6,.97);--aif-footer:#080806;--aif-danger:#f0a5a5;
  --bg:var(--aif-bg);--bg2:var(--aif-surface);--paper:#f3f0e8;
  --ink:var(--aif-ink);--text:var(--aif-text);--muted:var(--aif-muted);
  --gold:#d3ad61;--gold2:#f0cf87;--orange:var(--aif-gold-text);
  --line:var(--aif-line);--line-strong:#6f6556;--danger:var(--aif-danger);
}
html[data-theme="light"] {
  color-scheme:light;
  --aif-bg:#f4f1e9;--aif-surface:#fffdf8;--aif-soft:#eae3d6;
  --aif-ink:#17130d;--aif-text:#494236;--aif-muted:#625a4e;
  --aif-gold-text:#76521d;--aif-accent:#d3ad61;--aif-accent-hover:#e0bd78;
  --aif-on-accent:#17130d;--aif-line:#cec4b5;--aif-control:#887a64;
  --aif-header:rgba(244,241,233,.98);--aif-footer:#eae3d6;--aif-danger:#962f30;
  --bg:var(--aif-bg);--bg2:var(--aif-surface);--paper:var(--aif-surface);
  --ink:var(--aif-ink);--text:var(--aif-text);--muted:var(--aif-muted);
  --gold:var(--aif-gold-text);--gold2:var(--aif-gold-text);--orange:var(--aif-gold-text);
  --line:var(--aif-line);--line-strong:var(--aif-control);--danger:var(--aif-danger);
}
html[data-theme] body{background:var(--aif-bg);color:var(--aif-ink)}
html[data-theme] :is(h1,h2,h3,h4,h5,h6){color:var(--aif-ink)}
html[data-theme] p{color:var(--aif-text)}
html[data-theme] :is(h1,h2) em{color:var(--aif-gold-text)}
html[data-theme] ::selection{background:var(--aif-accent);color:#17130d}
html[data-theme] :is(a,button,input,textarea,select,summary):focus-visible{
  outline:3px solid var(--aif-gold-text);outline-offset:4px;
}
/* Keep the theme selector OUTSIDE the mobile navigation menu. */
.aif-theme-switch{display:inline-flex;flex:0 0 auto;align-items:center;gap:2px;
  padding:3px;border:1px solid var(--aif-control,#887a64);border-radius:4px;
  background:var(--aif-surface,#0f0e0b);color:var(--aif-ink,#f3f0e8);
  isolation:isolate;white-space:nowrap;box-sizing:border-box;}
.aif-theme-switch button{all:unset;box-sizing:border-box;display:inline-flex;
  align-items:center;justify-content:center;min-width:47px;min-height:32px;
  padding:0 7px;border-radius:2px;cursor:pointer;font-family:Arial,sans-serif;
  font-size:10px;line-height:1.2;font-weight:700;letter-spacing:.05em;
  background:transparent;color:var(--aif-muted,#c7c1b6);}
.aif-theme-switch button[aria-pressed="true"]{background:var(--aif-accent,#d3ad61);color:#17130d}
.aif-theme-switch button:hover{background:var(--aif-soft,#17140f);color:var(--aif-ink,#f3f0e8)}
.aif-theme-switch button[aria-pressed="true"]:hover{background:var(--aif-accent-hover,#f0cf87);color:#17130d}
html[data-theme] .aif-theme-switch button:focus-visible{outline:2px solid var(--aif-gold-text);outline-offset:5px}
.aif-theme-switch.aif-theme-fallback{position:fixed;right:16px;top:12px;z-index:9999}
.aif-theme-header .nav{gap:clamp(10px,1.6vw,24px)}
.aif-theme-header .brand{min-width:0;flex-shrink:0}
.aif-theme-header .aif-theme-switch{margin-left:auto}
.aif-theme-header .menu+.aif-theme-switch{margin-left:0}
.aif-theme-header .aif-theme-switch+.nav-cta{margin-left:0}
html[data-theme] :is(.site-header,.aif-theme-audit .header){background:var(--aif-header);color:var(--aif-ink);border-color:var(--aif-line)}
html[data-theme] :is(.menu,.brand-copy small,.breadcrumb,.breadcrumb strong){color:var(--aif-muted)}
html[data-theme] .menu a:is(:hover,.active){color:var(--aif-ink)}
html[data-theme] .nav-cta{color:var(--aif-gold-text);border-color:var(--aif-control)}
html[data-theme] .mobile-toggle{color:var(--aif-ink);background:var(--aif-surface);border-color:var(--aif-control);cursor:pointer}
html[data-theme] .menu.open{background:var(--aif-bg);color:var(--aif-ink);border-color:var(--aif-control)}
html[data-theme] :is(.text-link,.article-lead){color:var(--aif-ink)}
html[data-theme] :is(.system-label,.eyebrow-text,.context-no,.offer-index,.fact-strip span,.day-flow span,.enterprise-flow span,.price-band span,.path-grid>a>span,.people-grid article span,.resource-list>a>span){color:var(--aif-gold-text)}
html[data-theme] :is(.protocol-note,.protocol-steps p,.fact-strip small,.context-title small,.context-meta span,.offer-price small,.blueprint figcaption,.form-note){color:var(--aif-muted)}
html[data-theme] .compare-row.muted{opacity:1}
html[data-theme] .compare-row.muted span{color:var(--aif-gold-text)}
html[data-theme] .compare-row.muted p{color:var(--aif-muted)}
html[data-theme] .button{color:var(--aif-ink);border-color:var(--aif-gold-text)}
html[data-theme] .button.primary{background:var(--aif-accent);border-color:var(--aif-gold-text);color:#17130d}
html[data-theme] .button.deck-button{background:transparent;color:var(--aif-gold-text);border-color:var(--aif-control)}
html[data-theme] .button:is(:hover,:focus-visible){background:var(--aif-accent-hover);border-color:var(--aif-gold-text);color:#17130d}
html[data-theme] .button span{color:inherit}
html[data-theme] .button:disabled{opacity:1;background:var(--aif-soft);color:var(--aif-muted);border-color:var(--aif-line);cursor:not-allowed}
/* Photo captions are deliberately dark in BOTH modes. Solid panels ensure contrast
   independently of the luminance of the photo under them. */
html[data-theme] .hero-visual figcaption{background:#11100d;color:#ded7ca;border-color:#d3ad61}
html[data-theme] .hero-visual figcaption :is(span,strong,b){color:#f3f0e8}
html[data-theme] .hero-visual figcaption p{color:#ded7ca}
html[data-theme] .visual-index{background:#11100d;color:#f0cf87}
/* Closing and footer must define foreground as well as background. */
html[data-theme] .closing{background:var(--aif-soft);color:var(--aif-ink)}
html[data-theme] .closing h2{color:var(--aif-ink)}
html[data-theme] .closing :is(.system-label,em){color:var(--aif-gold-text)}
html[data-theme] .closing-action{border-color:var(--aif-control)}
html[data-theme] .closing-action p{color:var(--aif-text)}
html[data-theme] .closing .button.primary{background:var(--aif-accent);color:#17130d;border-color:var(--aif-gold-text)}
html[data-theme] .footer{background:var(--aif-footer);color:var(--aif-ink)}
html[data-theme] .footer :is(p,.footer-nav,.footer-legal,.footer-grid>small){color:var(--aif-muted)}
html[data-theme] .footer a:hover{color:var(--aif-gold-text)}
html[data-theme] .error{color:var(--aif-danger);border-color:var(--aif-danger)}
/* Forms, helper copy, placeholders and control boundaries. */
html[data-theme] :is(.form-panel,.sprint-form,.diag-grid,#booking-form) label{color:var(--aif-ink)}
html[data-theme] :is(.form-panel,.sprint-form,.diag-grid,#booking-form) :is(input,textarea,select){
  background:var(--aif-surface)!important;color:var(--aif-ink)!important;
  border-color:var(--aif-control)!important;accent-color:var(--aif-gold-text);
}
html[data-theme] :is(.form-panel,.sprint-form,.diag-grid,#booking-form) :is(input,textarea)::placeholder{
  color:var(--aif-muted)!important;opacity:1;
}
html[data-theme] :is(.form-panel,.sprint-form,.diag-grid,#booking-form) :is(input,textarea,select):focus-visible{
  outline:2px solid var(--aif-gold-text)!important;outline-offset:3px;
}
html[data-theme] :is(.form-panel,.sprint-form,.diag-grid,#booking-form) :is(input,textarea,select):user-invalid{border-color:var(--aif-danger)!important}
html[data-theme] :is(.sprint-grid>div,.sprint-block){background:var(--aif-surface)!important;border-color:var(--aif-line)!important}
html[data-theme] :is(.sprint-form legend,.use-cases>span,.sprint-price,.sprint-price small){color:var(--aif-gold-text)}
html[data-theme] :is(.sprint-note,.sprint-includes){color:var(--aif-muted)}
html[data-theme] .use-case-grid label{background:var(--aif-soft);color:var(--aif-ink);border-color:var(--aif-control)}
html[data-theme] :is(.sprint-form-v12 label span,.use-cases small,.form-panel label span,.diag-grid label span){opacity:1!important;color:var(--aif-muted)}
html[data-theme] .sprint-terms :is(span,a){color:var(--aif-text)}
html[data-theme] .sprint-terms a{text-decoration:underline;text-underline-offset:3px}
/* Read-only display of diagnostics and calendar slots; no behavior changes. */
html[data-theme] .diagnostic-points{color:var(--aif-gold-text)}
html[data-theme] .diagnostic-card{background:var(--aif-surface);border-color:var(--aif-line);color:var(--aif-ink)}
html[data-theme] .diagnostic-card>p{color:var(--aif-text)}
html[data-theme] :is(.diag-slot,.slot){background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-control)}
html[data-theme] :is(.diag-slot,.slot):hover{background:var(--aif-soft);border-color:var(--aif-gold-text)}
html[data-theme] :is(.diag-slot,.slot) b{color:var(--aif-gold-text)}
html[data-theme] :is(.diag-slot small,.diag-loading,.diag-message){color:var(--aif-muted)}
html[data-theme] .confirm-card{background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-line)}
html[data-theme] .confirm-meta{background:var(--aif-soft);border-color:var(--aif-gold-text)}
html[data-theme] .done{background:var(--aif-soft);border-color:var(--aif-control);color:var(--aif-ink)}
html[data-theme] .meet{color:var(--aif-gold-text);text-decoration:underline}
/* Floating diagnostic component (actual V1.2 IDs/classes). */
html[data-theme] :is(.diagnostic-widget,.diagnostic-widget-panel,.aif-diagnostic-panel){background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-control)}
/* Audit: separate CSS vocabulary, same colors and unchanged layout/content. */
html.aif-theme-audit[data-theme]{--paper:var(--aif-bg);--soft:var(--aif-soft);
  --aiforge-gold2:var(--aif-gold-text);--aiforge-deep:var(--aif-ink);
  --aiforge-surface:var(--aif-surface);--aiforge-line-strong:var(--aif-control);}
html.aif-theme-audit[data-theme] :is(.nav nav,.footer p){color:var(--aif-muted)}
html.aif-theme-audit[data-theme] :is(em,.number,.tag,.audit-card li>span,.format h4 span,.person span,.faq summary span){color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .button{background:var(--aif-accent);color:#17130d;border-color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .button:hover{background:var(--aif-accent-hover);color:#17130d}
html.aif-theme-audit[data-theme] .audience-strip{background:var(--aif-soft);border-color:var(--aif-line)}
html.aif-theme-audit[data-theme] .audience-strip p strong{color:var(--aif-ink)}
html.aif-theme-audit[data-theme] .outcomes article{border-top-color:var(--aif-control)}
html.aif-theme-audit[data-theme] .audit-card{background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-line)}
html.aif-theme-audit[data-theme] .audit-card p{color:var(--aif-text)}
html.aif-theme-audit[data-theme] .method-section,
html.aif-theme-audit[data-theme] .offer.featured{background:var(--aif-soft);border-color:var(--aif-line)}
html.aif-theme-audit[data-theme] .steps span{color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .person img{background:var(--aif-soft)}
html.aif-theme-audit[data-theme] .photo-top{background:#11100d;border-color:#9b8a6c;color:#f3f0e8}
html.aif-theme-audit[data-theme] .hero-visual>img.audit-time-image{object-position:50% 48%;filter:saturate(.72) contrast(1.03)}
html.aif-theme-audit[data-theme] .dark-section{background:#11100d;color:#f3f0e8}
html.aif-theme-audit[data-theme] .dark-section h2{color:#f3f0e8}
html.aif-theme-audit[data-theme] .dark-section :is(.eyebrow,h2 em){color:#f0cf87}
html.aif-theme-audit[data-theme] .dark-section .light-copy{color:#ded7ca}
html.aif-theme-audit[data-theme] .dark-section .audit-promise{color:#f3f0e8;border-color:#d3ad61}
html.aif-theme-audit[data-theme] .closing{background:#d3ad61;color:#17130d}
html.aif-theme-audit[data-theme] .closing :is(h2,em,.eyebrow){color:#17130d}
html.aif-theme-audit[data-theme] .closing p:not(.eyebrow):not(.micro),
html.aif-theme-audit[data-theme] .closing .micro{color:#302719}
html.aif-theme-audit[data-theme] .button.black{background:#17130d;border-color:#17130d;color:#f4f1e9}
html.aif-theme-audit[data-theme] .button.black:hover{background:#302719;color:#fffdf8}
html.aif-theme-audit[data-theme] .skip{background:var(--aif-surface);color:var(--aif-ink)}
/* Audit modal: enabled and selected states, not just its outer background. */
html.aif-theme-audit[data-theme] .booking-dialog{background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-control);box-shadow:0 25px 100px rgba(0,0,0,.4)}
html.aif-theme-audit[data-theme] .booking-dialog::backdrop{background:rgba(0,0,0,.68)}
html.aif-theme-audit[data-theme] .booking-close{background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-control)}
html.aif-theme-audit[data-theme] .booking-info{background:var(--aif-soft);border-color:var(--aif-line)}
html.aif-theme-audit[data-theme] .booking-info p{color:var(--aif-muted)}
html.aif-theme-audit[data-theme] #booking-recap{background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .booking-content{background:var(--aif-surface);color:var(--aif-ink)}
html.aif-theme-audit[data-theme] :is(.calendar-head button,.booking-slots button){background:var(--aif-surface);color:var(--aif-ink);border-color:var(--aif-control)}
html.aif-theme-audit[data-theme] .calendar-days button{background:var(--aif-soft);color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] :is(.calendar-days button,.booking-slots button):hover:not(:disabled){background:var(--aif-accent-hover);color:#17130d;border-color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] :is(.calendar-days button,.booking-slots button)[aria-pressed="true"]{background:var(--aif-accent);color:#17130d;border-color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .calendar-days button:disabled{background:transparent;color:var(--aif-muted);opacity:.55}
html.aif-theme-audit[data-theme] .booking-content .button:disabled{background:var(--aif-soft);color:var(--aif-muted);opacity:1}
html.aif-theme-audit[data-theme] .booking-tick{background:var(--aif-soft);color:var(--aif-gold-text)}
html.aif-theme-audit[data-theme] .confirmation-card{background:var(--aif-soft);border-color:var(--aif-line)}
html.aif-theme-audit[data-theme] .confirmation-card p{color:var(--aif-ink)}
@media(max-width:1180px){
  .site-header.aif-has-menu .menu{display:none}
  .site-header.aif-has-menu .mobile-toggle{display:block}
  .site-header.aif-has-menu .menu.open{display:flex;position:absolute;top:78px;left:0;right:0;padding:22px 32px;flex-direction:column;gap:16px;border-bottom:1px solid var(--aif-control)}
  .site-header.aif-has-menu .aif-theme-switch{margin-left:auto}
}
@media(max-width:650px){
  .aif-theme-header .nav{gap:10px}
  .aif-theme-switch{padding:2px;gap:1px}
  .aif-theme-switch button{min-width:43px;min-height:34px;padding:0 5px;font-size:9.5px}
  .site-header.aif-has-menu .menu.open{top:68px;padding:20px 14px}
  .site-header.aif-has-menu .mobile-toggle{padding:9px 10px;font-size:13px}
  .site-header.aif-has-menu .brand-copy b{font-size:14px}
  .site-header.aif-has-menu .nav-cta{padding-left:10px}
}
@media(max-width:420px){
  .site-header.aif-has-menu .nav-cta{display:none}
  .aif-theme-header .brand{gap:8px}
}
@media(max-width:600px){
  .aif-theme-audit .header .nav{gap:10px}
  .aif-theme-audit .header .button.small{font-size:0;min-width:40px;width:40px;padding:10px;gap:0}
  .aif-theme-audit .header .button.small span{font-size:18px;margin:auto}
  .aif-theme-audit .hero-visual>img.audit-time-image{object-position:50% 45%}
}
@media(prefers-reduced-motion:reduce){.aif-theme-switch,.aif-theme-switch button{transition:none}}
/* Component descendants must not inherit a label gold on a gold button. */
html[data-theme] .button.primary span,
html[data-theme] .button:hover span{color:inherit}
html[data-theme] .aif-diagnostic-button{background:var(--aif-accent);color:#17130d;border-color:var(--aif-gold-text)}
html[data-theme] .aif-diagnostic-panel b{color:var(--aif-ink)}
html[data-theme] .aif-diagnostic-panel p{color:var(--aif-text)}
html[data-theme] .aif-diagnostic-panel small{color:var(--aif-muted)}
html[data-theme] .aif-diagnostic-panel a{background:var(--aif-accent);color:#17130d}
html[data-theme] .aif-diagnostic-panel a:hover{background:var(--aif-accent-hover);color:#17130d}
html[data-theme] .offer-row.featured{background:var(--aif-soft)}
/* Avoid animating inherited text through low-contrast intermediate colors on theme changes. */
html[data-theme] :is(.context-row,.path-grid>a){transition-property:transform,padding-left,padding-right}
html[data-theme="light"] .aif-theme-switch [data-aif-set-theme="light"],
html[data-theme="dark"] .aif-theme-switch [data-aif-set-theme="dark"]{background:var(--aif-accent);color:#17130d}
html[data-theme="light"] .aif-theme-switch [data-aif-set-theme="dark"],
html[data-theme="dark"] .aif-theme-switch [data-aif-set-theme="light"]{background:transparent;color:var(--aif-muted)}
