/* THEME-V2 v3 — polish + drawer + dark theme + blog fix + back button. Overrides style.css.
   v3 changes: (1) hamburger button pinned to the LEFT on mobile; (2) drawer narrower (slim side
   panel, not a full page); (3) menu items carry real picture-style SVG images (not font glyphs),
   hidden on desktop; (4) drawer close button hidden on desktop. */
a, button { transition: color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.nav-menu a:hover { color: #2563eb; }
/* --- Theme toggle button --- */
.theme-toggle-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: 10px; border-radius: 50%; border: 1px solid #e2e8f0;
  background: #fff; color: #1e293b; cursor: pointer; font-size: 17px; flex: 0 0 auto; }
.theme-toggle-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.25); }
/* Floating toggle for standalone pages without a header (e.g. subject pages) */
.theme-toggle-btn.floating { position: fixed; left: 16px; bottom: 16px; z-index: 9998;
  margin-left: 0; width: 48px; height: 48px; font-size: 19px;
  box-shadow: 0 8px 22px rgba(2,6,23,.35); }
/* Drawer item pictures + close button are drawer-only: hidden on desktop.
   ID-qualified + !important so no nav rule in style.css can override them. */
#main-navigation .theme-nav-icon { display: none !important; }
#main-navigation .theme-drawer-close { display: none !important; }
/* --- Left drawer (mobile, <=1200px) --- */
@media (max-width: 1200px) {
  /* Hamburger button: pinned to the LEFT side of the navbar, never the middle */
  .main-navbar .navbar-container { padding-left: 56px !important; }
  .mobile-menu-btn { position: absolute !important; left: 12px !important; top: 50% !important;
    transform: translateY(-50%) !important; z-index: 5; }
  /* Slim side panel — clearly a side panel, not a whole extra page */
  #main-navigation { position: fixed !important; top: 0 !important; left: 0 !important;
    height: 100dvh !important; width: min(260px, 72vw) !important; display: flex !important;
    flex-direction: column !important; gap: 2px !important; padding: 18px 16px !important;
    background: #ffffff !important; box-shadow: 4px 0 30px rgba(0,0,0,.25) !important;
    transform: translateX(-105%) !important; transition: transform .3s ease !important;
    z-index: 10001 !important; overflow-y: auto !important; }
  #main-navigation.active { transform: translateX(0) !important; }
  #main-navigation a { display: flex !important; align-items: center; gap: 12px;
    padding: 10px 12px !important; border-radius: 10px; color: #1e293b !important; }
  #main-navigation a:hover { background: #eef2ff !important; color: #2563eb !important; }
  #main-navigation .theme-nav-icon { display: inline-flex !important; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex: 0 0 auto; }
  #main-navigation .theme-nav-icon svg { width: 42px; height: 42px; display: block; }
  #main-navigation .theme-drawer-close { display: inline-flex !important; align-items: center; justify-content: center;
    align-self: flex-end; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid #e2e8f0; background: #fff; font-size: 18px; cursor: pointer; margin-bottom: 8px; }
}
#theme-drawer-overlay { position: fixed; inset: 0; background: rgba(2,6,23,.5);
  z-index: 10000; display: none; }
#theme-drawer-overlay.show { display: block; }
/* --- Back button (injected on inner pages by theme-v2.js) --- */
.theme-back-btn { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 4px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff;
  color: #1e293b; font-weight: 600; font-size: 14px; cursor: pointer; }
.theme-back-btn:hover { border-color: #2563eb; color: #2563eb; transform: translateX(-2px); }
/* --- Blog overlap fix: text sits BELOW the cover image, never on top of it --- */
main.main-content .article-cover-container { margin: 0 auto !important; }
main.main-content .article-content-box { margin: 0 auto 60px !important; }
@media (max-width: 768px) {
  main.main-content .article-cover-container { margin: 0 auto !important; }
  main.main-content .article-content-box { margin: 0 15px 40px !important; }
}
/* --- Dark (black) theme — visitor choice, default is light --- */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { background: #0b1220 !important; color: #e5e7eb !important; }
html[data-theme="dark"] .main-navbar { background: #0f172a !important; }
html[data-theme="dark"] .nav-brand, html[data-theme="dark"] .nav-menu a { color: #e5e7eb !important; }
html[data-theme="dark"] .theme-toggle-btn { background: #1e293b !important; color: #facc15 !important; border-color: #334155 !important; }
html[data-theme="dark"] #main-navigation { background: #111827 !important; }
html[data-theme="dark"] #main-navigation a { color: #e5e7eb !important; }
html[data-theme="dark"] #main-navigation a:hover { background: #1e293b !important; color: #93c5fd !important; }
html[data-theme="dark"] .theme-drawer-close { background: #1e293b !important; color: #e5e7eb !important; border-color: #334155 !important; }
html[data-theme="dark"] .theme-back-btn { background: #1e293b !important; color: #e5e7eb !important; border-color: #334155 !important; }
html[data-theme="dark"] .main-footer { background: #0f172a !important; color: #cbd5e1 !important; }
html[data-theme="dark"] .article-header-wrapper, html[data-theme="dark"] .article-content-box { background: #111827 !important; color: #e5e7eb !important; }
html[data-theme="dark"] main [class*="card"] { background: #1e293b !important; color: #e5e7eb !important; border-color: #334155 !important; }
html[data-theme="dark"] main section { background-color: #0b1220 !important; }
html[data-theme="dark"] main section h1, html[data-theme="dark"] main section h2, html[data-theme="dark"] main section h3 { color: #f1f5f9 !important; }
html[data-theme="dark"] main section p { color: #cbd5e1 !important; }
html[data-theme="dark"] a { color: #93c5fd; }

/* DARK-BLOG-FIX v1 — blog post body text was invisible in dark mode: the body lives
   in DIV .article-content (not a SECTION), so the old "main section p" dark rule
   never reached it and body text kept light-mode dark colours on the dark box. */
html[data-theme="dark"] main.main-content .article-content-box .article-content,
html[data-theme="dark"] main.main-content .article-content-box .article-content p,
html[data-theme="dark"] main.main-content .article-content-box .article-content li,
html[data-theme="dark"] main.main-content .article-content-box .article-content span,
html[data-theme="dark"] main.main-content .article-content-box .article-content td,
html[data-theme="dark"] main.main-content .article-content-box .article-content th { color: #e5e7eb !important; }
html[data-theme="dark"] main.main-content .article-content-box .article-content h1,
html[data-theme="dark"] main.main-content .article-content-box .article-content h2,
html[data-theme="dark"] main.main-content .article-content-box .article-content h3,
html[data-theme="dark"] main.main-content .article-content-box .article-content h4,
html[data-theme="dark"] main.main-content .article-content-box .article-content h5,
html[data-theme="dark"] main.main-content .article-content-box .article-content h6 { color: #f1f5f9 !important; }
html[data-theme="dark"] main.main-content .article-content-box .article-content a { color: #93c5fd !important; }
/* Keep light-background callouts (e.g. the white Note box) readable: dark text stays. */
html[data-theme="dark"] main.main-content .article-content-box .article-content blockquote,
html[data-theme="dark"] main.main-content .article-content-box .article-content blockquote * { color: #1e293b !important; }
