/* Light theme comfort tweaks */

html:not(.dark) body {
  background-color: #faf7f2; /* warm off-white to ease eye strain */
  color: #0f172a; /* dark slate text */
}
/* Improve touch scrolling reliability */
html:not(.dark) html, html:not(.dark) body, html:not(.dark) .post-container, html:not(.dark) .container{
  touch-action: pan-y;
}

/* Glassy fixed navbar (desktop) */
@media (min-width: 1170px) {
  html:not(.dark) .navbar-custom.is-fixed {
    background-color: rgba(255,255,255,0.65);
    border-bottom-color: rgba(226,232,240,0.6);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    backdrop-filter: saturate(150%) blur(10px);
  }
}

html:not(.dark) .navbar-default {
  background-color: #ffffff;
  border-color: #e5e7eb;
}
html:not(.dark) .navbar-custom .navbar-brand,
html:not(.dark) .navbar-custom .nav li a,
html:not(.dark) .navbar-default .navbar-brand,
html:not(.dark) .navbar-default .navbar-nav>li>a {
  color: #0f172a;
}
html:not(.dark) .navbar-custom .navbar-brand:hover,
html:not(.dark) .navbar-custom .navbar-brand:focus,
html:not(.dark) .navbar-custom .nav li a:hover,
html:not(.dark) .navbar-custom .nav li a:focus,
html:not(.dark) .navbar-default .navbar-brand:hover,
html:not(.dark) .navbar-default .navbar-nav>li>a:hover {
  color: #0085a1; /* brand primary */
}
html:not(.dark) .navbar-default .navbar-toggle {
  border-color: #cbd5e1;
}
html:not(.dark) .navbar-default .navbar-toggle .icon-bar {
  background-color: #0f172a;
}

html:not(.dark) .highlight pre,
html:not(.dark) pre,
html:not(.dark) .highlight .hll {
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

html:not(.dark) blockquote {
  color: #334155;
  border-left-color: #e5e7eb;
}

html:not(.dark) .table th,
html:not(.dark) .table td {
  border-color: #e5e7eb !important;
}

html:not(.dark) hr { border-color: #e5e7eb; }
html:not(.dark) hr.small { border-color: #d1d5db; }

/* Reading-lists TOC on light */
html:not(.dark) .toc-container {
  background: #f8f9fa;
  border-color: #e0e0e0;
}

/* Ensure code/ASCII art does not wrap; allow horizontal scroll */
html:not(.dark) .highlight pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
html:not(.dark) .highlight pre code { white-space: pre !important; }
html:not(.dark) pre code { white-space: pre !important; }
html:not(.dark) .post-container pre { white-space: pre !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Reduce scroll trapping on code and tables */
html:not(.dark) .highlight pre,
html:not(.dark) pre {
  -webkit-overflow-scrolling: auto; /* avoid iOS capturing vertical scroll */
  touch-action: auto;
  overscroll-behavior: contain;
}
html:not(.dark) .table-responsive {
  overflow-y: visible;              /* don't capture vertical scroll */
  touch-action: auto;
  overscroll-behavior: contain;
}

/* Ensure page-level scroll只由浏览器控制，不让article自己滚动 */
html:not(.dark) body > article {
  overflow-y: visible !important;
  overflow-x: visible;
}

/* Pinned badge */
html:not(.dark) .pinned-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #00a7c2, #0085a1);
  border-radius: 4px;
}

/* Post preview cards */
html:not(.dark) .post-preview {
  margin-bottom: 22px;
  background: rgba(255,255,255,0.72);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
html:not(.dark) .post-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(8px); }
.reveal.in { opacity: 1; transform: translateY(0); transition: opacity .4s ease, transform .4s ease; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; transition: none; }
}

/* Mobile menu floats as card */
@media (max-width: 767px){
  #huxblog_navbar{
    position: fixed;
    top: 68px;
    right: 16px;
    width: 230px;
    max-width: calc(100% - 32px);
    display: none;
    z-index: 1000;
  }
  #huxblog_navbar .navbar-collapse {
    display: block !important;
    overflow: hidden;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(226,232,240,0.85);
    border-radius: 16px;
    box-shadow: 0 20px 35px rgba(15,23,42,0.18);
    padding: 8px 12px;
  }
  #huxblog_navbar .nav>li>a {
    color: #0f172a;
    display: block;
    padding: 8px 6px;
  }
  #huxblog_navbar.in {
    display: block;
    animation: navFloatIn .18s ease-out;
  }
}

@keyframes navFloatIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px){
  body{ -webkit-overflow-scrolling: touch; }
}

/* Archive summary card */
html:not(.dark) .archive-summary {
  background: rgba(255,255,255,0.72);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Header readability overlay */
.intro-header{ position: relative; }
@media (min-width: 768px){
  .intro-header::after{
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0.00) 0%, rgba(255,255,255,0.08) 60%, rgba(255,255,255,0.18) 100%);
  }
}

/* Ensure header titles don't stick to top, esp. mobile */
@media (max-width: 767px){
  .intro-header .site-heading,
  .intro-header .page-heading,
  .intro-header .post-heading{ padding-top: 130px; padding-bottom: 50px; }
}
