/* Kalem — light/dark theme (kalemuni.com) — v1 2026-12-01
   html[data-theme="dark"] is set by the inline head snippet (no flash) and by the toggle in kalem-theme.js.
   1) Kalem manual pages (body > #kalem-safe-zone): real dark palette through the page's CSS variables.
   2) Every other page (WordPress/Elementor incl. the homepage, older pages): "smart invert" of the whole page, with photos,
      videos and maps inverted back so they keep their real colours. */

/* ---------- toggle button ---------- */
.k-theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:36px;height:36px;min-width:36px;padding:0;margin:0;margin-inline-start:8px;border-radius:50%;border:1.5px solid rgba(100,116,139,.4);background:transparent;color:#0F172A;cursor:pointer;line-height:1;vertical-align:middle;-webkit-tap-highlight-color:transparent;transition:background-color .2s,border-color .2s}
.k-theme-toggle:hover{background:rgba(100,116,139,.12)}
.k-theme-toggle:focus-visible{outline:2px solid #F5B43C;outline-offset:2px}
.k-theme-toggle svg{width:18px;height:18px;display:block;pointer-events:none}
.k-theme-toggle .k-ico-sun{display:none}
html[data-theme="dark"] .k-theme-toggle .k-ico-sun{display:block}
html[data-theme="dark"] .k-theme-toggle .k-ico-moon{display:none}
.k-theme-toggle.k-tt-sm{width:30px;height:30px;min-width:30px;margin-inline-start:4px}
.k-theme-toggle.k-tt-sm svg{width:16px;height:16px}
.k-theme-toggle.k-tt-float{position:fixed;top:12px;left:12px;z-index:9999;background:#fff;box-shadow:0 2px 10px rgba(15,23,42,.15)}

html[data-theme="dark"]{color-scheme:dark}
html.k-no-trans *,html.k-no-trans *::before,html.k-no-trans *::after{transition:none!important}

/* ---------- 1) Kalem 2026 pages ---------- */
html[data-theme="dark"] body:has(> #kalem-safe-zone){background:#0B1220}
html[data-theme="dark"] body > #kalem-safe-zone{
  --ink:#E8EEF7; --body:#C9D4E3; --muted:#9AAABF; --line:#26354D;
  --bg:#0B1220; --bg2:#111B2E; --blue:#8DB4FF; --blue2:#A9C6FF; --blue-soft:#14213A;
  --amber-soft:#2A2110; --amber-ink:#F5C26B; --ok:#4ADE80;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);
  color:var(--body); background-color:var(--bg)!important}
html[data-theme="dark"] body > #kalem-safe-zone .k-theme-toggle{color:#E8EEF7;border-color:rgba(201,212,227,.35)}
html[data-theme="dark"] body > #kalem-safe-zone .k-top{background:rgba(11,18,32,.94);border-color:var(--line)}
html[data-theme="dark"] body > #kalem-safe-zone .k-brand img{background:#fff;border-radius:8px;padding:2px}
html[data-theme="dark"] body > #kalem-safe-zone .k-btn-blue{background:#2563EB;color:#fff}
html[data-theme="dark"] body > #kalem-safe-zone .k-btn-ghost{background:var(--bg2);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] body > #kalem-safe-zone :is(.k-card,.k-src,.k-cd div,.k-mbar,details,table){background-color:var(--bg2)}
html[data-theme="dark"] body > #kalem-safe-zone :is(th){background-color:#16233A;color:var(--ink)}
html[data-theme="dark"] body > #kalem-safe-zone .k-alt{background:#0E1728}
html[data-theme="dark"] body > #kalem-safe-zone .k-dk-surface{background-color:var(--bg2)!important}
html[data-theme="dark"] body > #kalem-safe-zone .k-dk-surface2{background-color:#16233A!important}
html[data-theme="dark"] body > #kalem-safe-zone .k-dk-text{color:var(--ink)!important}
html[data-theme="dark"] body > #kalem-safe-zone .k-dk-text2{color:var(--body)!important}
html[data-theme="dark"] body > #kalem-safe-zone .k-dk-line{border-color:var(--line)!important}

/* ---------- 2) all other pages: smart invert ---------- */
html[data-theme="dark"]:not(:has(body > #kalem-safe-zone)){filter:invert(.92) hue-rotate(180deg);background:#fff}
html[data-theme="dark"]:not(:has(body > #kalem-safe-zone)) :is(img,video,iframe,picture,canvas,embed,object,.k-reinvert){filter:invert(1) hue-rotate(180deg)}
html[data-theme="dark"]:not(:has(body > #kalem-safe-zone)) :is(picture img,.k-reinvert img,.k-reinvert video){filter:none}
html[data-theme="dark"]:not(:has(body > #kalem-safe-zone)) .k-theme-toggle{color:#0F172A}

/* ---------- v2 (2026-12-01): Kalem logo keeps a white background in dark mode (Adel's request) ---------- */
html[data-theme="dark"] :is(img.custom-logo,img[src*="kalem-logo"],.k-logo-img,.k-brand img,header img[src$="logo.png"],footer img[src$="logo.png"]),
html[data-theme="dark"] body > #kalem-safe-zone :is(img.custom-logo,img[src*="kalem-logo"],.k-logo-img,.k-brand img,header img[src$="logo.png"],footer img[src$="logo.png"]){background-color:#fff!important;border-radius:8px;box-shadow:0 0 0 4px #fff}
