/* qbook — custom classes that mirror book.ac.cn's index.html inline <style>
   (these are NOT Tailwind utilities; they are the site-specific bits) */

/* ===== Element reset (from Tailwind preflight) ===== */
*, *::before, *::after { box-sizing: border-box; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; }
body { margin: 0; line-height: inherit; }
button, input, optgroup, select, textarea {
  font-family: inherit; font-feature-settings: inherit; font-size: 100%;
  font-weight: inherit; line-height: inherit; color: inherit; margin: 0; padding: 0;
  border: none; outline: none;
}
button, select { text-transform: none; }
button, input:where([type="button"]), input:where([type="reset"]), input:where([type="submit"]) {
  -webkit-appearance: button; background-color: transparent; background-image: none;
}
:-moz-focusring { outline: none; }
[role="button"], button { cursor: pointer; }

/* 全局链接去下划线 + 平滑过渡 */
a { text-decoration: none; color: inherit; transition: color 0.2s ease; }
a:hover { color: inherit; }

/* 微信弹窗 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal.on { display: flex; }
.modal-content { background: #fff; padding: 20px; border-radius: 8px; text-align: center; max-width: 300px; }
.modal-content img { max-width: 200px; height: auto; }

.main-container { max-width: 1200px; margin: 0 auto; }
.banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}
.navbar { backdrop-filter: blur(10px); background-color: rgba(255, 255, 255, 0.8); }
.book-item { transition: all 0.3s ease; }
.book-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== Tailwind substitutes — responsive + interactive utilities ===== */

/* flex / grid responsive */
@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row !important; }
  .md\:justify-start { justify-content: flex-start !important; }
  .md\:justify-end { justify-content: flex-end !important; }
  .md\:items-center { align-items: center !important; }
  .md\:items-start { align-items: flex-start !important; }
  .md\:block { display: block !important; }
  .md\:hidden { display: none !important; }
  .md\:w-32 { width: 8rem !important; }
  .md\:h-48 { height: 12rem !important; }
  .md\:mx-6 { margin-left: 1.5rem !important; margin-right: 1.5rem !important; }
  .md\:my-6 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* Gap utilities (Tailwind 3 gap-3) */
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }

/* Focus ring */
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--tw-ring-color, #2563eb); }
.focus\:ring-blue-600:focus { box-shadow: 0 0 0 2px #2563eb; }

/* Hover utilities */
.hover\:bg-blue-700:hover { background-color: #1d4ed8 !important; }
.hover\:text-blue-600:hover { color: #2563eb !important; }
.hover\:text-white:hover { color: #fff !important; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

/* Object-fit */
.object-cover { object-fit: cover; }
/* Max-width */
.max-w-lg { max-width: 32rem; }

/* Transition */
.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.duration-300 { transition-duration: 300ms; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Position */
.fixed { position: fixed; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }

/* Z-index */
.z-50 { z-index: 50; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.inline-flex { display: inline-flex; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.block { display: block; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Dimensions */
.w-full { width: 100%; }
.w-10 { width: 2.5rem; }
.w-32 { width: 8rem; }
.w-50 { width: 12.5rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-40 { height: 10rem; }
.h-48 { height: 12rem; }

.h-80 { height: 20rem; }

/* Spacing */
.mx-auto { margin-left: auto; margin-right: auto; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-16 { margin-top: 4rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }

.ml-6 { margin-left: 1.5rem; }
.ml-10 { margin-left: 2.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }

.p-2 { padding: 0.5rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.pt-4 { padding-top: 1rem; }
.pb-4 { padding-bottom: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.px-10 { padding-left: 2.5rem; padding-right: 2.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }

/* Typography */
.text-center { text-align: center; }
.text-white { color: #fff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-yellow-500 { color: #eab308; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Backgrounds */
.bg-white { background-color: #fff; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-800 { background-color: #1f2937; }
.bg-blue-600 { background-color: #2563eb; }
.bg-gray-50 { background-color: #f9fafb; }

/* Borders */
.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: #e5e7eb; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #e5e7eb; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }

/* Border radius */
.rounded { border-radius: 0.25rem; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-l-lg { border-radius: 0.5rem 0 0 0.5rem; }
.rounded-r-lg { border-radius: 0 0.5rem 0.5rem 0; }

/* Shadow */
.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }

/* 上一篇/下一篇 */
.prevnext-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
  margin-bottom: 20px;
}
.prevnext-wrap {
  display: flex;
  gap: 16px;
}
.prevnext-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  transition: all 0.3s ease;
  text-decoration: none;
  min-width: 0;
}
.prevnext-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(59,130,246,0.12);
  transform: translateY(-2px);
}
.prevnext-empty {
  background: transparent;
  border: 1px dashed #e2e8f0;
  box-shadow: none;
  pointer-events: none;
}
.prevnext-empty:hover {
  transform: none;
  border-color: #e2e8f0;
  box-shadow: none;
}
.prevnext-prev { justify-content: flex-start; }
.prevnext-next { justify-content: flex-end; text-align: right; }
.prevnext-arrow {
  font-size: 20px;
  color: #94a3b8;
  transition: all 0.3s;
  flex-shrink: 0;
}
.prevnext-card:hover .prevnext-arrow {
  color: #3b82f6;
}
.prevnext-prev:hover .prevnext-arrow { transform: translateX(-4px); }
.prevnext-next:hover .prevnext-arrow { transform: translateX(4px); }
.prevnext-info {
  min-width: 0;
}
.prevnext-label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.prevnext-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prevnext-card:hover .prevnext-title {
  color: #2563eb;
}

/* 标签 */
.tag-item {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  border-radius: 20px;
  border: 1px solid #bfdbfe;
  transition: all 0.2s;
  margin-right: 6px;
  margin-bottom: 4px;
}
.tag-item:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.dark .tag-item {
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-color: rgba(59,130,246,0.3);
}
.dark .tag-item:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.tag-item i { font-size: 10px; }

/* article body typography */
.article-content { color: #374151; line-height: 1.8; font-size: 16px; }
.article-content p { margin: 1em 0; }
.article-content img { max-width: 100%; height: auto; border-radius: 8px; }
.article-content h2, .article-content h3 { color: #1f2937; margin: 1.2em 0 .6em; }
.article-content a { color: #2563eb; text-decoration: underline; }

/* single page info card — tighten spacing */
.single-info h1 { margin: 0 0 2px 0; }
.single-info p { margin: 2px 0; }
.single-info h1 + p { margin-top: 8px; }

/* ===== Mobile menu ===== */
.mobile-menu { display: none; }
.mobile-menu.open { display: block; }

/* ===== Pagination ===== */
.pagebar { margin-top: 1.5rem; text-align: center; }
.page, .now-page {
  display: inline-block; min-width: 2rem; padding: 0.25rem 0.75rem;
  margin: 0 0.15rem; border-radius: 0.375rem; color: #374151; line-height: 1.5;
}
.page:hover { background-color: #e5e7eb; }
.now-page { background-color: #2563eb; color: #fff; }

/* ===== Friend links list ===== */
.friend-links { list-style: none; padding: 0.75rem 1.5rem; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 1rem; margin-bottom: 1rem; }
.friend-links .link-item { display: inline-block; }
.friend-links .link-item a { color: #9ca3af; text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.friend-links .link-item a:hover { color: #60a5fa; }

/* ===== Banner search box ===== */
.search-banner-input {
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.9);
  font-size: 1rem;
  height: 48px;
}
.search-banner-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
  background: #fff;
  outline: none;
}
.search-banner-input:focus ~ .search-banner-btn {
  box-shadow: 0 0 0 1px #3b82f6;
  border: 1px solid #3b82f6;
  margin-left: -1px;
}
.search-banner-btn {
  height: 48px;
  border: 1px solid transparent;
}
.search-form {
  height: 48px;
}

/* ===== Load More button ===== */
.loadmore-btn {
  display: inline-block;
  padding: 0.75rem 2.5rem;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.loadmore-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.dark .loadmore-btn {
  background: #3b82f6;
  color: #fff;
}
.dark .loadmore-btn:hover {
  background: #2563eb;
}

/* ===== TopBtn responsive ===== */
.topbtn { white-space: nowrap; }
@media (max-width: 767px) {
  .topbtn { font-size: 0.75rem; padding: 0.375rem 0.625rem; }
  .search-banner-btn { font-size: 0.75rem; padding-left: 1rem; padding-right: 1rem; }
  .search-banner-input { font-size: 0.875rem; padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* ===== Dark mode ===== */
body.dark { background-color: #0f172a !important; color: #e5e7eb; }
body.dark .navbar { background-color: rgba(47, 51, 63, 0.85); }
body.dark .navbar .text-gray-800,
body.dark .navbar .text-xl { color: #f1f5f9 !important; }
body.dark .navbar a.text-gray-800 { color: #cbd5e1 !important; }
body.dark .bg-white { background-color: #1e293b !important; }
body.dark .text-gray-800 { color: #f1f5f9 !important; }
body.dark .text-gray-600 { color: #cbd5e1 !important; }
body.dark .text-gray-500 { color: #94a3b8 !important; }
body.dark .article-content { color: #cbd5e1; }
body.dark .article-content a { color: #60a5fa; }

/* ===== Dropdown navigation ===== */
.nav-dropdown { position: relative; padding-bottom: 8px; margin-bottom: -8px; }
.nav-dropdown-trigger { display: inline-flex; align-items: center; gap: 6px; }
.nav-dropdown-trigger .fa-chevron-down { font-size: 9px; opacity: 0.4; transition: transform 0.2s; }
.nav-dropdown:hover .nav-dropdown-trigger .fa-chevron-down { opacity: 0.8; transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: max-content;
  min-width: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  padding: 6px 0;
  z-index: 200;
  margin-top: 0;
}
.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 0.875rem;
  color: #4b5563;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.nav-dropdown-item:hover {
  background: #eff6ff;
  color: #2563eb;
}
.nav-dropdown:hover .nav-dropdown-trigger {
  color: #2563eb;
}

/* Dark mode dropdown */
body.dark .nav-dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
body.dark .nav-dropdown-item {
  color: #cbd5e1;
}
body.dark .nav-dropdown-item:hover {
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
}

/* Mobile dropdown */
.mobile-dropdown-toggle {
  transition: transform 0.2s;
}
.mobile-dropdown-toggle.open {
  transform: rotate(180deg);
}
.mobile-dropdown-menu {
  padding-left: 16px;
  border-left: 2px solid #e5e7eb;
  margin-left: 16px;
  margin-top: 2px;
  margin-bottom: 4px;
}
body.dark .mobile-dropdown-menu {
  border-left-color: #334155;
}

/* ===== Cover image shadow ===== */
.cover-shadow {
  box-shadow: 0 4px 15px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.06);
}
body.dark .cover-shadow {
  box-shadow: 0 4px 15px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
}

body.dark .prevnext-divider {
  background: linear-gradient(90deg, transparent, #334155 20%, #334155 80%, transparent);
}
body.dark .prevnext-card {
  background: #1e293b;
  border-color: #334155;
}
body.dark .prevnext-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(59,130,246,0.15);
}
body.dark .prevnext-empty {
  border-color: #334155;
}
body.dark .prevnext-empty:hover {
  border-color: #334155;
}
body.dark .prevnext-arrow { color: #64748b; }
body.dark .prevnext-card:hover .prevnext-arrow { color: #60a5fa; }
body.dark .prevnext-label { color: #64748b; }
body.dark .prevnext-title { color: #e2e8f0; }
body.dark .prevnext-card:hover .prevnext-title { color: #60a5fa; }

/* ===== Banner with custom background ===== */
.banner-has-bg {
  background-blend-mode: overlay;
  background-size: cover;
  background-position: center;
}
