/* ==========================================================================
   Kriyasya — Site-wide polish layer (Tier 1.2, enhance-in-place)
   Injected into every HTML page via the boot output-buffer. INTENTIONALLY
   CONSERVATIVE: only universal, additive, NON-LAYOUT improvements that are safe
   across all coexisting design systems (fn-*, lv-*, account/dashboard, legacy
   world inline). It never changes box sizes, positions, fonts or spacing — so it
   cannot break any existing layout. Deeper per-system typography/spacing polish
   is done in Tier 2/3 against each system's own stylesheet.
   Reversible: set config ui.polish=false or define LV_NO_POLISH.
   ========================================================================== */

/* Crisper text rendering (paint-only, no layout impact) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

/* Accessible, consistent keyboard focus everywhere (many legacy pages lack it).
   Uses :focus-visible so it only shows for keyboard users — no change for mouse. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #8b6dff;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Premium text selection (paint-only) */
::selection { background: rgba(139, 109, 255, .28); color: inherit; }

/* Refined scrollbars (paint-only; Firefox + WebKit) */
* { scrollbar-width: thin; scrollbar-color: rgba(139,109,255,.5) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,109,255,.42); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,109,255,.65); border: 3px solid transparent; background-clip: content-box; }

/* Respect reduced-motion globally (accessibility; safe) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   Ecosystem-wide Container Width Harmonization (Phase 5)
   Harmonizes page containers across all worlds to --lv-container-max (1200px)
   so that sticky header, body content, and canonical footer share identical alignment.
   ========================================================================== */
:root {
  --lv-container-max: 1200px;
  --lv-container-pad: clamp(16px, 4vw, 32px);
  --lv-maxw: var(--lv-container-max, 1200px);
}

#lvh .lvh-in,
.lv-legal-bar .lv-wrap,
.lv-wrap,
.ax-in,
.ax-header-in,
.nh-wrap,
.nh-header-in,
.gm-wrap,
.spx-wrap,
.sc-wrap,
.bg-wrap,
.yn-wrap,
.fn-wrap,
.hl-wrap {
  max-width: var(--lv-container-max, 1200px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Guided Meditation: inner pages center at 1200px; home v3 has full-bleed background with centered inner sections */
.gm-main:not(.gm-home-v3) {
  max-width: var(--lv-container-max, 1200px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.gm-main.gm-home-v3 {
  max-width: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (min-width: 900px) {
  .wrap {
    max-width: var(--lv-container-max, 1200px) !important;
  }
}

/* =============================================================================
   PLATFORM-WIDE WCAG 2.2 AA CONTRAST & READABILITY SAFEGUARDS
   Injected site-wide across all 28 worlds, hubs, tools, forms, and alerts.
   Eliminates all dark-on-dark, light-on-light, and low-contrast states centrally.
   ============================================================================= */

/* 1. Global Alert & Feedback Components */
.errbox, .lv-err, .pr-err, .warn {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.lv-ok, .success-box {
  background: rgba(34, 197, 94, 0.08) !important;
  color: #15803d !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
}
.note, .info-box {
  background: rgba(59, 130, 246, 0.08) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(59, 130, 246, 0.25) !important;
}

/* Dark theme overrides for alert components */
:root[data-theme="dark"] .errbox, :root[data-theme="dark"] .lv-err,
:root[data-theme="dark"] .pr-err, :root[data-theme="dark"] .warn,
[data-theme="night"] .errbox, [data-theme="night"] .lv-err {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
:root[data-theme="dark"] .lv-ok, [data-theme="night"] .lv-ok {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}
:root[data-theme="dark"] .note, :root[data-theme="dark"] .info-box,
[data-theme="night"] .note, [data-theme="night"] .info-box {
  background: rgba(59, 130, 246, 0.16) !important;
  color: #bfdbfe !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
}

/* 2. Related Tools & Action Pills (Astrology, Ayurveda, Numerology, etc.) */
.related-tools a {
  background: rgba(124, 92, 255, 0.10) !important;
  color: #6d28d9 !important;
  border: 1px solid rgba(124, 92, 255, 0.28) !important;
  font-weight: 600 !important;
}
.related-tools a:hover {
  background: rgba(124, 92, 255, 0.20) !important;
  color: #4c1d95 !important;
}
:root[data-theme="dark"] .related-tools a, [data-theme="night"] .related-tools a {
  background: rgba(169, 139, 255, 0.16) !important;
  color: #d8b4fe !important;
  border-color: rgba(169, 139, 255, 0.35) !important;
}
:root[data-theme="dark"] .related-tools a:hover, [data-theme="night"] .related-tools a:hover {
  background: rgba(169, 139, 255, 0.28) !important;
  color: #f3e8ff !important;
}

/* 3. Emergency / Crisis Actions */
.crisis-fab, .crisis-num {
  background: #dc2626 !important;
  color: #ffffff !important;
}

/* 4. Global Cross-Browser Inputs & Dropdowns */
select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
:root[data-theme="dark"] select option, [data-theme="night"] select option {
  background-color: #1e1b4b !important;
  color: #f8fafc !important;
}
::placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
}

/* 5. Yoga Calm Theme & Header Synchronization */
[data-theme="night"] #lvh,
html[data-theme="night"] #lvh {
  --lvh-bg: rgba(28, 25, 23, 0.96) !important;
  --lvh-fg: #f5f0eb !important;
  --lvh-mut: #a39990 !important;
  --lvh-line: rgba(255, 240, 225, 0.12) !important;
  --lvh-hover: rgba(255, 240, 225, 0.08) !important;
  --lvh-menu: #24201d !important;
  --lvh-drawer: #1c1917 !important;
  background: var(--lvh-bg) !important;
  border-bottom: 1px solid var(--lvh-line) !important;
}
[data-theme="night"] #lvh .lvh-a,
html[data-theme="night"] #lvh .lvh-a {
  color: var(--lvh-mut) !important;
}
[data-theme="night"] #lvh .lvh-a:hover,
html[data-theme="night"] #lvh .lvh-a:hover {
  color: var(--lvh-fg) !important;
  background: var(--lvh-hover) !important;
}
[data-theme="night"] #lvh .lvh-brand,
html[data-theme="night"] #lvh .lvh-brand {
  color: var(--lvh-fg) !important;
}


