/* v.640 — always-live river background with frame-level dark-mode dimming. */
html[data-site-river-background="640"] {
  background: #8fc5ca url("../img/parallax0.webp?v=130") center / cover fixed no-repeat !important;
}
html[data-site-river-background="640"] body {
  position: relative !important;
  min-height: 100vh;
  isolation: isolate;
  background-color: transparent !important;
  background-image: none !important;
}
.site-river-background-v640 {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  pointer-events: none !important;
  user-select: none !important;
  touch-action: none !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: -1 !important;
  opacity: 0;
  transition: opacity .16s linear !important;
}
.site-river-background-v640.is-ready { opacity: 1; }
.river-dimming-button-v640 {
  position: fixed !important;
  z-index: 2147483646 !important;
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.62) !important;
  border-radius: 50% !important;
  background: #0d5c63 !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.30) !important;
  font: 700 15px/46px Arial, sans-serif !important;
  text-align: center !important;
  cursor: pointer !important;
  appearance: none !important;
}
.river-dimming-button-v640:hover,
.river-dimming-button-v640:focus-visible {
  background: #85401f !important;
  outline: 2px solid rgba(255,255,255,.9) !important;
  outline-offset: 2px !important;
}
.river-dimming-button-v640[hidden] { display: none !important; }
@media (max-width: 700px) {
  .river-dimming-button-v640 {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    font-size: 14px !important;
    line-height: 42px !important;
  }
}
@media print {
  .site-river-background-v640,
  .river-dimming-button-v640 { display: none !important; }
}

/* v.619 — hide all local stone/ruler strips in the selected dark mode.
   The independent full-page background canvas remains untouched. */
:is(
  html[data-theme="dark"],
  html[data-river-theme="dark"],
  html[data-rules-theme-choice="dark"]
) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
),
body:is(.dark-mode, .dark-theme) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

:is(
  html[data-theme="dark"],
  html[data-river-theme="dark"],
  html[data-rules-theme-choice="dark"]
) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::before,
:is(
  html[data-theme="dark"],
  html[data-river-theme="dark"],
  html[data-rules-theme-choice="dark"]
) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::after,
body:is(.dark-mode, .dark-theme) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::before,
body:is(.dark-mode, .dark-theme) :is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::after {
  display: none !important;
  content: none !important;
}

/* v.622 — light mode: keep every former stone strip's dimensions,
   remove its legacy decoration, and reveal the independent site background through it. */

html:not([data-theme="dark"]):not([data-river-theme="dark"]):not([data-rules-theme-choice="dark"])
body:not(.dark-mode):not(.dark-theme)
:is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: hidden !important;
}

html:not([data-theme="dark"]):not([data-river-theme="dark"]):not([data-rules-theme-choice="dark"])
body:not(.dark-mode):not(.dark-theme)
:is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::before,
html:not([data-theme="dark"]):not([data-river-theme="dark"]):not([data-rules-theme-choice="dark"])
body:not(.dark-mode):not(.dark-theme)
:is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)::after {
  display: none !important;
  content: none !important;
  background: none !important;
  box-shadow: none !important;
}

/* Remove only obsolete nested renderers; the outer strip keeps its original height. */
html:not([data-theme="dark"]):not([data-river-theme="dark"]):not([data-rules-theme-choice="dark"])
body:not(.dark-mode):not(.dark-theme)
:is(
  .bgimg-2,
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="river-strip"],
  [class*="stone-strip"]
)
:is(
  canvas:not(.site-river-background-v618),
  .animated-river-stone-strip,
  .animated-river-strip,
  .animated-river-strip-v130,
  [class*="legacy-river"],
  [class*="stone-layer"]
) {
  display: none !important;
  visibility: hidden !important;
}

/* The single fixed v.618 canvas remains the only animation source. */
html[data-site-river-background="618"] body {
  background-color: transparent !important;
}
