/* =====================================================================
   ISHAURA SITE SKIN — WHOLE SITE v2.0.0
   NARRATIVE-SAFE / NEURO-FRIENDLY / PLACE-AWARE

   Design law:
   - The narrative owns the experience.
   - The place owns the atmosphere.
   - The Skin owns readability and accessibility.

   This file intentionally does NOT repaint every card/panel/page.
   It supplies common accessibility tokens and only repairs surfaces that
   the JS contrast guardian identifies as ordinary UI/readability failures.
   ===================================================================== */

:root{
  --ishaura-air:#87CEEB;
  --ishaura-water:#F59E0B;
  --ishaura-earth:#50C878;
  --ishaura-fire:#F4C542;
  --ishaura-aether:#A78BFA;
  --ishaura-skin-radius:16px;
  --ishaura-skin-radius-sm:11px;
  --ishaura-skin-reading-width:76ch;
}

html.ishaura-site-light,
body.ishaura-site-light{
  color-scheme:light;
  --ishaura-skin-page:#fbfdff;
  --ishaura-skin-surface:#ffffff;
  --ishaura-skin-surface-2:#f7fafc;
  --ishaura-skin-text:#0f172a;
  --ishaura-skin-soft:#334155;
  --ishaura-skin-muted:#64748b;
  --ishaura-skin-border:rgba(71,85,105,.16);
  --ishaura-skin-border-strong:rgba(71,85,105,.27);
  --ishaura-skin-shadow:0 12px 34px rgba(15,23,42,.08);
  --ishaura-skin-focus:#075985;
  --ishaura-skin-link:#075985;
  --ishaura-skin-button:#0f172a;
  --ishaura-skin-button-text:#ffffff;
  --ishaura-place-accent:#475569;
}

html.ishaura-site-dark,
body.ishaura-site-dark{
  color-scheme:dark;
  --ishaura-skin-page:#03060c;
  --ishaura-skin-surface:#0b1220;
  --ishaura-skin-surface-2:#111827;
  --ishaura-skin-text:#f8fafc;
  --ishaura-skin-soft:#d8e1ec;
  --ishaura-skin-muted:#a5b4c7;
  --ishaura-skin-border:rgba(148,163,184,.22);
  --ishaura-skin-border-strong:rgba(148,163,184,.36);
  --ishaura-skin-shadow:0 14px 38px rgba(0,0,0,.34);
  --ishaura-skin-focus:#7dd3fc;
  --ishaura-skin-link:#bae6fd;
  --ishaura-skin-button:#f8fafc;
  --ishaura-skin-button-text:#0f172a;
  --ishaura-place-accent:#cbd5e1;
}

/* Place identity. These are accents only; local pages keep their atmosphere. */
body.ishaura-realm-air{--ishaura-place-accent:#0284c7;}
body.ishaura-realm-water{--ishaura-place-accent:#b45309;}
body.ishaura-realm-earth{--ishaura-place-accent:#047857;}
body.ishaura-realm-fire{--ishaura-place-accent:#a16207;}
body.ishaura-realm-aether{--ishaura-place-accent:#7e22ce;}
body.ishaura-site-dark.ishaura-realm-air{--ishaura-place-accent:#7dd3fc;}
body.ishaura-site-dark.ishaura-realm-water{--ishaura-place-accent:#fbbf24;}
body.ishaura-site-dark.ishaura-realm-earth{--ishaura-place-accent:#6ee7b7;}
body.ishaura-site-dark.ishaura-realm-fire{--ishaura-place-accent:#fde68a;}
body.ishaura-site-dark.ishaura-realm-aether{--ishaura-place-accent:#c4b5fd;}
body.ishaura-place-dosn{--ishaura-place-accent:#3f6212;}
body.ishaura-place-provisions{--ishaura-place-accent:#9a6700;}
body.ishaura-place-ishori{--ishaura-place-accent:#6d5bd0;}
body.ishaura-site-dark.ishaura-place-dosn{--ishaura-place-accent:#bef264;}
body.ishaura-site-dark.ishaura-place-provisions{--ishaura-place-accent:#f4d792;}
body.ishaura-site-dark.ishaura-place-ishori{--ishaura-place-accent:#bceeff;}

/* Fallback canvas only. Custom world/page roots are NOT repainted. */
html.ishaura-site-light{background:#fbfdff;color:var(--ishaura-skin-text);}
html.ishaura-site-dark{background:#03060c;color:var(--ishaura-skin-text);}
body.ishaura-site-light{background-color:#fbfdff;color:var(--ishaura-skin-text);}
body.ishaura-site-dark{background-color:#03060c;color:var(--ishaura-skin-text);}

/* Neuro-friendly reading defaults. Deliberately modest so narrative layouts remain theirs. */
body.ishaura-site-skin-enabled :where(p,li,dd,blockquote){
  line-height:max(1.55,1.55em);
}
body.ishaura-site-skin-enabled :where(h1,h2,h3,h4,h5,h6){
  text-wrap:balance;
  overflow-wrap:anywhere;
}
body.ishaura-site-skin-enabled :where(p,li,dd,blockquote,figcaption,label,legend,summary){
  overflow-wrap:break-word;
}

/* Keyboard and low-vision navigation. */
body.ishaura-site-skin-enabled :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--ishaura-skin-focus)!important;
  outline-offset:3px!important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--ishaura-skin-page) 82%,transparent)!important;
}
body.ishaura-site-skin-enabled :where(button,input,select,textarea){font:inherit;}
body.ishaura-site-skin-enabled :where(input,select,textarea){min-height:42px;}
body.ishaura-site-skin-enabled textarea{min-height:7rem;}

/* Generic WordPress/Forminator fallbacks. Custom Ishaura world components keep local styling. */
html.ishaura-site-light body.ishaura-site-skin-enabled :where(.forminator-ui,.edd_form,.edd-checkout,.woocommerce-form) :where(input,textarea,select){
  background:#fff!important;color:#0f172a!important;border-color:#cbd5e1!important;caret-color:#0f172a!important;
}
html.ishaura-site-dark body.ishaura-site-skin-enabled :where(.forminator-ui,.edd_form,.edd-checkout,.woocommerce-form) :where(input,textarea,select){
  background:#0b1220!important;color:#f8fafc!important;border-color:rgba(148,163,184,.32)!important;caret-color:#f8fafc!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled :where(.forminator-ui,.edd_form,.edd-checkout,.woocommerce-form) :where(input,textarea)::placeholder{color:#64748b!important;opacity:1!important;}
html.ishaura-site-dark body.ishaura-site-skin-enabled :where(.forminator-ui,.edd_form,.edd-checkout,.woocommerce-form) :where(input,textarea)::placeholder{color:#94a3b8!important;opacity:1!important;}

/* ---------------------------------------------------------------------
   JS rescue classes. These are only applied after computed-style checks.
   --------------------------------------------------------------------- */
html.ishaura-site-light .ishaura-skin-text-on-light{
  color:#0f172a!important;
  text-shadow:none!important;
}
html.ishaura-site-light .ishaura-skin-text-on-dark{
  color:#f8fafc!important;
}
html.ishaura-site-dark .ishaura-skin-text-on-light{
  color:#0f172a!important;
  text-shadow:none!important;
}
html.ishaura-site-dark .ishaura-skin-text-on-dark{
  color:#f8fafc!important;
}

html.ishaura-site-light .ishaura-skin-generic-surface{
  background:#fff!important;
  background-image:none!important;
  color:#0f172a!important;
  border-color:var(--ishaura-skin-border)!important;
  box-shadow:var(--ishaura-skin-shadow)!important;
}
html.ishaura-site-light .ishaura-skin-generic-surface :where(h1,h2,h3,h4,h5,h6,p,li,small,label,strong,em,span):not([style*="color"]){
  color:inherit;
}
html.ishaura-site-dark .ishaura-skin-generic-surface{
  background:#0b1220!important;
  background-image:none!important;
  color:#f8fafc!important;
  border-color:var(--ishaura-skin-border)!important;
  box-shadow:var(--ishaura-skin-shadow)!important;
}

/* A rescued button gets contrast, not a new identity. */
html.ishaura-site-light .ishaura-skin-button-rescue{
  background:#0f172a!important;color:#fff!important;border-color:#0f172a!important;text-shadow:none!important;
}
html.ishaura-site-dark .ishaura-skin-button-rescue{
  background:#f8fafc!important;color:#0f172a!important;border-color:#f8fafc!important;text-shadow:none!important;
}

/* Optional explicit hooks for future page work. */
.ishaura-skin-reading-surface{
  max-width:var(--ishaura-skin-reading-width);
  margin-inline:auto;
}
html.ishaura-site-light .ishaura-skin-reading-surface{
  background:var(--ishaura-skin-surface);color:var(--ishaura-skin-text);border-color:var(--ishaura-skin-border);
}
html.ishaura-site-dark .ishaura-skin-reading-surface{
  background:var(--ishaura-skin-surface);color:var(--ishaura-skin-text);border-color:var(--ishaura-skin-border);
}

/* Explicit opt-out: the skin will not auto-rescue inside these. */
.ishaura-skin-preserve,
[data-ishaura-skin="preserve"],
[data-ishaura-preserve-surface]{
  --ishaura-skin-preserved:1;
}

/* Motion accessibility: preserve atmosphere, remove forced motion for people who ask. */
@media (prefers-reduced-motion:reduce){
  html:focus-within{scroll-behavior:auto!important;}
  body.ishaura-site-skin-enabled *,
  body.ishaura-site-skin-enabled *::before,
  body.ishaura-site-skin-enabled *::after{
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
    scroll-behavior:auto!important;
  }
}

/* Increased contrast preference without flattening the visual world. */
@media (prefers-contrast:more){
  body.ishaura-site-skin-enabled :where(a,button,input,select,textarea,summary){
    border-color:currentColor!important;
  }
  body.ishaura-site-skin-enabled :where(p,li,dd,label,legend,summary){
    font-weight:max(400,1em);
  }
}

/* Print keeps long-form narrative readable. */
@media print{
  body.ishaura-site-skin-enabled{background:#fff!important;color:#000!important;}
  body.ishaura-site-skin-enabled :where(h1,h2,h3,h4,h5,h6,p,li,blockquote,figcaption){color:#000!important;text-shadow:none!important;}
}


/* =====================================================================
   INITIATION BRIDGE — v2.0.1
   The Initiation experience is intentionally cinematic, but its own v22
   controller stores a separate theme key and several scene backgrounds are
   hard-coded dark. The site theme is authoritative here. This changes only
   presentation; narrative, choices, storage, progression and routing remain
   untouched.
   ===================================================================== */
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app{
  --ink:#111827!important;
  --muted:#475569!important;
  --gold:#865800!important;
  --aqua:#0369a1!important;
  --violet:#6d28d9!important;
  --green:#047857!important;
  --deep:#e8edf5!important;
  --panel:rgba(255,255,255,.92)!important;
  --panel-strong:rgba(255,255,255,.98)!important;
  --line:rgba(51,65,85,.20)!important;
  --danger:#b4233d!important;
  --app-bg:#eef3f8!important;
  --surface:rgba(255,255,255,.80)!important;
  --surface-strong:rgba(255,255,255,.97)!important;
  --text-strong:#0f172a!important;
  --shadow:0 28px 74px rgba(15,23,42,.16)!important;
  color:#111827!important;
  background:#eef3f8!important;
  color-scheme:light!important;
}

/* Any current or future Initiation scene gets a readable light fallback.
   Scene-specific gradients below preserve the different narrative spaces. */
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > .init-scene{
  color:#111827!important;
  background:radial-gradient(circle at 50% 44%,#eef7fb 0,#edf2f8 58%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #initThreshold{
  background:radial-gradient(circle at 50% 70%,#d9f2ff 0,#e8eaff 48%,#f8fafc 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #mappedRecord{
  background:radial-gradient(circle at 50% 42%,#e6e9ff 0,#eef3fb 56%,#f8fafc 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #ritePresence{
  background:radial-gradient(circle at 50% 58%,#dcf7fb 0,#edf5f8 56%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #riteSignals{
  background:radial-gradient(circle at 50% 46%,#f5f1ff 0,#edf5f8 58%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #riteBeacon{
  background:radial-gradient(circle at 50% 54%,#fff7df 0,#f1f4f8 57%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #riteMapping{
  background:radial-gradient(circle at 50% 48%,#eee8ff 0,#edf3fa 58%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #riteNavigation{
  background:radial-gradient(circle at 50% 60%,#e0f5ff 0,#edf2f8 58%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #riteCivilization{
  background:radial-gradient(circle at 50% 55%,#e8f7ee 0,#eef3f7 58%,#fbfdff 100%)!important;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app > #initiationGate{
  background:radial-gradient(circle at 50% 38%,#e8ecff 0,#edf3f9 58%,#fbfdff 100%)!important;
}

/* The app already has a complete light component system. These guards cover
   hard-coded dark text/surfaces that otherwise escape its data-theme rules. */
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app :where(h1,h2,h3,h4,p,li,.story-lead,.smallnote,.story-response,.quest-ledger-help){
  text-shadow:none;
}
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-initiation-app :where(.keeper-voice,.story-response,.record-item,.choice-card,.story-choice,.nav-door,.arc-card,.sigil,.acceptance,.scroll-reveal,.return-crossing-card,.init-identity-recognition){
  border-color:rgba(71,85,105,.18)!important;
}

/* One site = one theme control. The page's private switch is hidden so it
   cannot put only this experience back into dark mode. */
body.ishaura-site-skin-enabled #ishaura-initiation-app #initTheme{
  display:none!important;
}


/* =====================================================================
   INCARNATION BRIDGE — v2.0.2
   Incarnation V6.7 already contains its own narrative-aware TRUE SITE LIGHT
   MODE and deliberately keeps a few cinematic transition/water scenes dark.
   The whole-site Skin therefore does NOT repaint Incarnation. It only makes
   the site theme authoritative and prevents the generic rescue layer from
   flattening the experience.
   ===================================================================== */
html.ishaura-site-light body.ishaura-site-skin-enabled #ishaura-incarnation-app{
  color-scheme:light!important;
}
html.ishaura-site-dark body.ishaura-site-skin-enabled #ishaura-incarnation-app{
  color-scheme:dark!important;
}

/* These two app roots are governed by their dedicated bridges, not by the
   automatic card/surface rescue system. This is an explicit CSS-side marker
   for future maintenance and debugging. */
body.ishaura-site-skin-enabled :where(#ishaura-initiation-app,#ishaura-incarnation-app){
  --ishaura-dedicated-theme-bridge:1;
}

/* =====================================================================
   SPIRAL JUNCTION / JOURNEY TRAVEL DASHBOARD BRIDGE — v2.0.3
   This persistent dashboard owns its own UI. The global rescue scanner is
   excluded from it in JS so controls do not flash while rescue classes are
   recalculated. These selectors only pass through the site light/dark state.
   ===================================================================== */
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="light"]{
  --sj-bg:#edf3f8!important;
  --sj-panel:#ffffff!important;
  --sj-panel2:#f5f8fb!important;
  --sj-ink:#0b1725!important;
  --sj-muted:#516579!important;
  --sj-line:rgba(23,54,86,.16)!important;
  --sj-blue:#1d70a7!important;
  --sj-violet:#694fa7!important;
  --sj-gold:#977116!important;
  --sj-green:#187458!important;
  --sj-shadow:0 22px 65px rgba(17,38,62,.20)!important;
  color-scheme:light;
}
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="dark"]{
  --sj-bg:#040914!important;
  --sj-panel:#09121f!important;
  --sj-panel2:#0d1827!important;
  --sj-ink:#eef8ff!important;
  --sj-muted:#a9bbcd!important;
  --sj-line:rgba(147,197,253,.17)!important;
  --sj-blue:#78d9ff!important;
  --sj-violet:#b8a5ff!important;
  --sj-gold:#efd98c!important;
  --sj-green:#6dd7aa!important;
  --sj-shadow:0 22px 65px rgba(0,0,0,.42)!important;
  color-scheme:dark;
}
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="light"] .sj-strip,
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="light"] .sj-console-top{
  background:rgba(255,255,255,.96)!important;
}
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="dark"] .sj-strip,
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="dark"] .sj-console-top{
  background:rgba(7,16,27,.95)!important;
}
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="dark"] .sj-hero{
  background:
    radial-gradient(circle at 10% 0%,rgba(120,217,255,.10),transparent 24rem),
    radial-gradient(circle at 92% 0%,rgba(184,165,255,.08),transparent 24rem),
    linear-gradient(180deg,#06101c,#040914)!important;
}
#ishaura-spiral-junction-dashboard[data-ishaura-site-theme="dark"] .sj-coordinate{
  background:rgba(9,18,31,.86)!important;
}
/* Never animate or transition a control merely because the Skin is rescanning. */
#ishaura-spiral-junction-dashboard .sj-small,
#ishaura-spiral-junction-dashboard .sj-open-btn,
#ishaura-spiral-junction-dashboard .sj-icon-btn{
  animation:none!important;
}
