/* Light theme for the public pages and the app (html[data-theme="light"], set by theme.js; dark stays the default).
   Colours come from variables; the few fixed colours of the dark design are overridden here.
   --wt is the tint colour (white on dark, navy on light), --bgt the see-through page colour, --tht table headers. */
:root { --wt: 255, 255, 255; --bgt: 7, 13, 24; --tht: 23, 35, 58; --text2: #c9d2e0; }

html[data-theme="light"] {
  --bg: #f4f6fa; --bg2: #ffffff; --bg3: #e9edf4; --fg: #2a3547; --fg-strong: #0f1a2c; --muted: #5d6a80; --soft: #3d495c;
  --text2: #3d495c; --accent: #0a7f63; --accent-2: #4a63d8; --accent-ink: #ffffff; --line: #dbe1ea; --warn: #b7791f; --bad: #c23d3d;
  --wt: 20, 35, 65; --bgt: 255, 255, 255; --tht: 230, 235, 243; color-scheme: light;
}
/* The logo is swapped for the dark-ink one by theme.js; hide the light one until then so it never flashes. */
html[data-theme="light"] img[src$="/assets/logo-640.png"] { visibility: hidden; }

/* Theme switch button (public pages). */
.theme-btn { display: inline-grid; place-items: center; width: 32px; height: 30px; border-radius: 8px; cursor: pointer;
             background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 0; }
.theme-btn:hover { color: var(--fg); border-color: var(--muted); }
.theme-btn .moon, html[data-theme="light"] .theme-btn .sun { display: none; }
html[data-theme="light"] .theme-btn .moon { display: block; }

/* ---- public pages ---- */
html[data-theme="light"] .site-header { background: rgba(255, 255, 255, .92); }
html[data-theme="light"] .btn { color: #fff; }
html[data-theme="light"] .btn.ghost { color: var(--fg); }
html[data-theme="light"] .site-header nav a.btn { color: #fff; }
/* Home: the world-map banner (data-dark) and the code sample stay dark in both themes. */
html[data-theme="light"] [data-dark], html[data-theme="light"] .sample {
  --bg: #0b1220; --bg2: #111b2e; --fg: #d2dae6; --muted: #93a1b8; --soft: #b9c3d2; --line: #1e2a40; --accent: #3ccfa8;
  --accent-ink: #062018; color: var(--fg);
}
html[data-theme="light"] [data-dark] .btn { color: #062018; }
html[data-theme="light"] [data-dark] .btn.ghost { color: var(--fg); }
html[data-theme="light"] section.band.alt { background: #eaeef5; }
html[data-theme="light"] .card, html[data-theme="light"] .pane { box-shadow: 0 1px 2px rgba(15, 26, 44, .05); }
html[data-theme="light"] .bars i { background: rgba(20, 35, 65, .14); }
html[data-theme="light"] code { color: var(--fg-strong, #0f1a2c); }

/* ---- app ---- */
html[data-theme="light"] header nav button.on { background: rgba(12, 143, 111, .1); box-shadow: inset 0 0 0 1px rgba(12, 143, 111, .35); }
html[data-theme="light"] button.btn { color: #062018; }
html[data-theme="light"] .pane { background: #fff; border-color: var(--line); box-shadow: 0 1px 2px rgba(15, 26, 44, .05), 0 12px 32px -24px rgba(15, 26, 44, .25); }
html[data-theme="light"] .hit { background: #fff; border-color: var(--line); }
html[data-theme="light"] .hit:hover { background: #fff; box-shadow: 0 8px 24px -16px rgba(15, 26, 44, .35); }
html[data-theme="light"] .hit .fam { color: #4f6480; }
html[data-theme="light"] #detail { background: #fff; border-left-color: var(--line); box-shadow: -24px 0 60px rgba(15, 26, 44, .12); }
html[data-theme="light"] .dsec h3 { color: #6a7a93; }
html[data-theme="light"] #usage .plan { color: #0b7d61; }
html[data-theme="light"] .sk { background: linear-gradient(90deg, var(--bg3), #dfe5ee, var(--bg3)); background-size: 200% 100%; }
html[data-theme="light"] .searchrow input::placeholder { color: #8a96a8; }
html[data-theme="light"] button.danger { color: #b33434; }
html[data-theme="light"] dialog.dlg { background: #fff; box-shadow: 0 30px 80px -20px rgba(15, 26, 44, .35); }
html[data-theme="light"] dialog.dlg::backdrop { background: rgba(15, 26, 44, .35); }
html[data-theme="light"] .acct-menu .panel { background: #fff; box-shadow: 0 24px 60px -20px rgba(15, 26, 44, .3); }
html[data-theme="light"] .dbar { background: rgba(255, 255, 255, .9); border-bottom-color: var(--line); }

/* ---- quick search (Ctrl+K), assets/palette.js ---- */
.qs { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 12px 12px; }
.qs.hidden { display: none; }
.qs-back { position: absolute; inset: 0; background: rgba(3, 7, 14, .6); backdrop-filter: blur(3px); }
.qs-box { position: relative; width: 640px; max-width: 100%; max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
          border-radius: 16px; background: linear-gradient(180deg, #111c31, #0c1526); border: 1px solid rgba(255, 255, 255, .1);
          box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .8); color: var(--fg); font-family: "Manrope", system-ui, sans-serif; }
.qs-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(var(--wt), .08); color: var(--muted); }
.qs .qs-in input { flex: 1; min-width: 0; width: auto; background: none; border: 0; border-radius: 0; outline: none; box-shadow: none; color: var(--fg-strong, var(--fg)); font: inherit; font-size: 16px; padding: 2px 0; }
.qs .qs-in input:focus { outline: none; }
.qs .qs-in input::placeholder { color: var(--muted); }
.qs kbd { font: 600 11px/1.5 inherit; font-family: inherit; color: var(--muted); border: 1px solid rgba(var(--wt), .14); border-bottom-width: 2px;
          border-radius: 5px; padding: 0 5px; background: rgba(var(--wt), .04); }
.qs-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.qs-gt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.qs-o { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 600; }
.qs-o svg { color: var(--muted); flex: none; }
.qs-o[aria-selected="true"] { background: rgba(60, 207, 168, .12); box-shadow: inset 0 0 0 1px rgba(60, 207, 168, .3); color: var(--fg-strong, var(--fg)); }
.qs-o[aria-selected="true"] svg { color: var(--accent); }
.qs-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-s { color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 12.5px; }
.qs-h { color: var(--muted); font-size: 12px; font-weight: 500; flex: none; }
.qs-none { color: var(--muted); text-align: center; padding: 28px 10px; margin: 0; }
.qs-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid rgba(var(--wt), .08); color: var(--muted); font-size: 12px; }
.qs-foot > span { display: inline-flex; align-items: center; gap: 4px; }
html.qs-open { overflow: hidden; }
@media (max-width: 600px) { .qs { padding-top: 10px; } .qs-box { max-height: 82vh; } .qs-foot { display: none; } }
html[data-theme="light"] .qs-back { background: rgba(15, 26, 44, .3); }
html[data-theme="light"] .qs-box { background: #fff; border-color: var(--line); box-shadow: 0 30px 90px -20px rgba(15, 26, 44, .35); }
html[data-theme="light"] .qs-o[aria-selected="true"] { background: rgba(12, 143, 111, .08); box-shadow: inset 0 0 0 1px rgba(12, 143, 111, .3); }

/* Quick search trigger: a search field look-alike in headers. */
.qs-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border-radius: 9px; cursor: pointer;
          background: rgba(var(--wt), .03); border: 1px solid rgba(var(--wt), .1); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; }
.qs-btn:hover { color: var(--fg); border-color: rgba(var(--wt), .2); }
.qs-btn kbd { font: 600 11px/1.5 inherit; font-family: inherit; border: 1px solid rgba(var(--wt), .14); border-radius: 5px; padding: 0 5px; }
@media (max-width: 1200px) { .qs-btn .qs-t { display: none; } }
@media (max-width: 900px) { .qs-btn kbd { display: none; } .qs-btn { padding: 0 8px; } }
@media (max-width: 1200px) { .site-header .qs-btn kbd { display: none; } .site-header .qs-btn { padding: 0 8px; } }
