/* ============================================================
   DARK MODE — blog-repo-cleanwhite
   Activated by:  <html data-theme="dark">
   ============================================================ */

/* ── Smooth transition on theme switch ── */
body,
.navbar-custom.is-fixed,
.navbar-custom.invert,
.navbar-default .navbar-collapse,
.pager li > a,
.pager li > span,
pre, code,
blockquote,
.floating-label-form-group,
.table th, .table td {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ── Body & base text ── */
[data-theme="dark"] body {
  background-color: #1b1b2f;
  color: #e0e0e0;
}

[data-theme="dark"] a {
  color: #c8c8c8;
}
[data-theme="dark"] a:hover,
[data-theme="dark"] a:focus {
  color: #f05c34;
}

/* ── Post content links ── */
[data-theme="dark"] .post-container a {
  color: #7ab3d9;
}
[data-theme="dark"] .post-container a:hover,
[data-theme="dark"] .post-container a:focus {
  color: #f05c34;
}

/* ── Headings ── */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: #f0f0f0;
}
[data-theme="dark"] .post-container h5,
[data-theme="dark"] .post-container h6 {
  color: #aaaaaa;
}

/* ── Navbar — scrolled (is-fixed) ── */
[data-theme="dark"] .navbar-custom.is-fixed {
  background-color: rgba(27, 27, 47, 0.97) !important;
  border-bottom: 1px solid #2e2e50;
}
[data-theme="dark"] .navbar-custom.is-fixed .navbar-brand,
[data-theme="dark"] .navbar-custom.is-fixed .nav li a {
  color: #e0e0e0;
}
[data-theme="dark"] .navbar-custom.is-fixed .navbar-brand:hover,
[data-theme="dark"] .navbar-custom.is-fixed .navbar-brand:focus,
[data-theme="dark"] .navbar-custom.is-fixed .nav li a:hover,
[data-theme="dark"] .navbar-custom.is-fixed .nav li a:focus {
  color: #f05c34;
}

/* ── Navbar — invert style (no hero image pages) ── */
[data-theme="dark"] .navbar-custom.invert {
  background-color: #1b1b2f;
  border-bottom: 1px solid #2e2e50;
}
[data-theme="dark"] .navbar-custom.invert .navbar-brand,
[data-theme="dark"] .navbar-custom.invert .nav li a {
  color: #e0e0e0;
}
[data-theme="dark"] .navbar-custom.invert .navbar-brand:hover,
[data-theme="dark"] .navbar-custom.invert .navbar-brand:focus,
[data-theme="dark"] .navbar-custom.invert .nav li a:hover,
[data-theme="dark"] .navbar-custom.invert .nav li a:focus {
  color: #f05c34;
}
[data-theme="dark"] .navbar-custom.invert .navbar-toggle .icon-bar {
  background-color: #e0e0e0;
}

/* ── Mobile nav dropdown ── */
[data-theme="dark"] .navbar-default .navbar-collapse {
  background-color: #252547;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}

/* The theme fixes the mobile dropdown to 170px wide, float:right.
   In dark mode the dark panel makes this gap very visible — override
   to fill the full navbar width instead. */
@media only screen and (max-width: 767px) {
  [data-theme="dark"] .navbar-default .navbar-collapse {
    width: 100%;
    float: none;
    border-radius: 0;
  }
  /* Animate from the top-left instead of top-right for full-width feel */
  [data-theme="dark"] #huxblog_navbar {
    transform-origin: top left;
    -webkit-transform-origin: top left;
  }
}

/* ── Dark mode toggle button ── */
/* Use inline-flex (not flex) so the <button> stays inline like a navbar
   <a> element — this prevents the <li> from being taller than siblings
   and keeps the entire nav row at the correct height. */
#dark-mode-toggle {
  background: none;
  border: none;
  outline: none;           /* Remove browser default blue focus ring */
  cursor: pointer;
  /* Match .navbar-custom .nav li a { padding: 20px } exactly */
  padding: 20px 12px;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  display: inline-flex;    /* inline so it sits flush with <a> siblings */
  align-items: center;
  vertical-align: middle;
}
/* Accessible focus indicator — orange outline, keyboard-only */
#dark-mode-toggle:focus-visible {
  outline: 2px solid #f05c34;
  outline-offset: 2px;
  border-radius: 2px;
}
.navbar-custom.invert #dark-mode-toggle,
.navbar-custom.is-fixed #dark-mode-toggle {
  color: #404040;
}
[data-theme="dark"] .navbar-custom.invert #dark-mode-toggle,
[data-theme="dark"] .navbar-custom.is-fixed #dark-mode-toggle {
  color: #e0e0e0;
}
#dark-mode-toggle:hover {
  color: #f05c34 !important;
}

/* ── Post preview cards ── */
[data-theme="dark"] .post-preview > a {
  color: #e0e0e0;
}
[data-theme="dark"] .post-preview > a:hover,
[data-theme="dark"] .post-preview > a:focus {
  color: #f05c34;
}
[data-theme="dark"] .post-preview > .post-meta > a,
[data-theme="dark"] .post-preview > .post-meta {
  color: #aaaaaa;
}

/* ── Intro header — text style (no image) ── */
[data-theme="dark"] .intro-header.style-text .site-heading,
[data-theme="dark"] .intro-header.style-text .post-heading,
[data-theme="dark"] .intro-header.style-text .page-heading {
  color: #e0e0e0;
}
[data-theme="dark"] .intro-header.style-text .post-heading .meta a,
[data-theme="dark"] .intro-header.style-text .tags a,
[data-theme="dark"] .intro-header.style-text .tags .tag {
  border-color: #aaaaaa;
  color: #aaaaaa;
}

/* ── Blockquote ── */
[data-theme="dark"] blockquote {
  color: #aaaaaa;
  border-left-color: #444466;
}

/* ── Code & pre ── */
[data-theme="dark"] pre {
  background-color: #252540;
  border-color: #3a3a5c;
  color: #e0e0e0;
}
[data-theme="dark"] code {
  background-color: #2d2d4e;
  color: #f8c8a0;
}
[data-theme="dark"] pre code {
  background-color: transparent;
  color: inherit;
}

/* ── Tables ── */
[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  border-color: #3a3a5c !important;
  color: #e0e0e0;
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
  background-color: #252547;
}

/* ── Pager (prev/next) ── */
[data-theme="dark"] .pager li > a,
[data-theme="dark"] .pager li > span {
  background-color: #252547;
  border-color: #3a3a5c;
  color: #e0e0e0;
}
[data-theme="dark"] .pager li > a:hover,
[data-theme="dark"] .pager li > a:focus {
  background-color: #f05c34;
  border-color: #f05c34;
  color: #fff;
}

/* ── Footer ── */
[data-theme="dark"] footer {
  background-color: #111122;
  color: #aaaaaa;
}
[data-theme="dark"] footer .copyright a {
  color: #7ab3d9;
}
[data-theme="dark"] footer .copyright a:hover {
  color: #f05c34;
}

/* ── HR ── */
[data-theme="dark"] hr.small {
  border-color: #3a3a5c;
}

/* ── Forms ── */
[data-theme="dark"] .floating-label-form-group {
  border-bottom-color: #3a3a5c;
}
[data-theme="dark"] .floating-label-form-group input,
[data-theme="dark"] .floating-label-form-group textarea {
  color: #e0e0e0;
  background-color: transparent;
}

/* ── Selection highlight ── */
[data-theme="dark"] ::selection {
  background: #f05c34;
  color: #fff;
}

/* ── Banner image — dark mode ── */
/* CSS !important acts as a FOUC guard: data-theme is stamped on <html>
   in <head> before the body paints, so on first render the correct image
   loads immediately. The JS updateBanner() handles subsequent toggles. */
[data-theme="dark"] header.intro-header {
  background-image: url('https://images.unsplash.com/photo-1581610186406-5f6e9f9edbc1?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D') !important;
}

/* ── Banner text — light mode ── */
/* The theme defaults banner headings to white (#fff).
   On a light/daytime banner image that makes text invisible.
   Override to dark charcoal when in light mode. */
[data-theme="light"] .intro-header .site-heading,
[data-theme="light"] .intro-header .post-heading,
[data-theme="light"] .intro-header .page-heading {
  color: #1a1a2e;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
}
[data-theme="light"] .intro-header .site-heading h1,
[data-theme="light"] .intro-header .site-heading .subheading,
[data-theme="light"] .intro-header .post-heading h1,
[data-theme="light"] .intro-header .post-heading .subheading,
[data-theme="light"] .intro-header .post-heading .meta,
[data-theme="light"] .intro-header .page-heading h1,
[data-theme="light"] .intro-header .page-heading .subheading {
  color: #1a1a2e;
}
[data-theme="light"] .intro-header .post-heading .meta a {
  color: #2c2c3e;
}
/* Keep tags readable — darken border and text */
[data-theme="light"] .intro-header .tags a,
[data-theme="light"] .intro-header .tags .tag {
  color: #1a1a2e;
  border-color: rgba(26, 26, 46, 0.6);
}

/* ── Box shortcode dark mode ── */
/* The shortcode injects an inline <style> with color:#444 which is
   unreadable on a dark background. Override all box body text to light. */
[data-theme="dark"] .box-shortcode {
  color: #d8d8e8;
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .box-shortcode.info {
  background: rgba(0, 137, 228, 0.12);
}
[data-theme="dark"] .box-shortcode.warning {
  background: rgba(255, 107, 107, 0.15);
}
[data-theme="dark"] .box-shortcode.important {
  background: rgba(247, 236, 44, 0.12);
}
[data-theme="dark"] .box-shortcode.tip {
  background: rgba(163, 255, 163, 0.1);
}
/* important box title uses yellow bg — switch to dark text so it's readable */
[data-theme="dark"] .box-shortcode.important .box-title {
  color: #1a1a1a;
}
