/* Custom styles for the blog */

/* Smooth transitions for theme changes */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Enhanced card hover */
.card-widget:hover {
  transform: translateY(-2px);
}

/* Custom scrollbar for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #49b1f5 transparent;
}

/* Better code block styling */
figure.highlight {
  border-radius: 8px;
  overflow: hidden;
}

/* Article title hover enhancements */
.article-title:hover {
  color: #49b1f5;
}

/* Tag cloud hover effect */
.card-tag-cloud a:hover {
  background: #49b1f5 !important;
  color: #fff !important;
  transform: scale(1.1);
}

/* Footer styling */
#footer {
  position: relative;
}

#footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #49b1f5, transparent);
}

/* Avatar: pause rotation on hover */
.avatar-img:hover {
  animation-play-state: paused;
}
.avatar-img img:hover {
  transform: none !important;
}

/* Music button in rightside panel */
#rightside-music-btn {
  background: #49B1F5 !important;
  color: #fff !important;
}

#rightside-music-btn:hover {
  background: #3a8fd4 !important;
  transform: scale(1.08);
}

/* Go up button animation */
#go-up:hover {
  transform: translateY(-3px);
}

/* Tall image preview — limit inline height, click to view full via fancybox (supports scroll-wheel zoom + drag pan) */
.article-content img,
#article-container img {
  max-height: 500px;
  width: auto;
}

/* ===== 私密图库 Gallery ===== */
/* Password lock overlay */
#gallery-lock {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gallery-lock-card {
  position: relative;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  max-width: 380px;
  width: 90%;
  animation: galleryFadeIn .4s ease;
}

@keyframes galleryFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Close button */
#gallery-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .2s, background .2s;
  line-height: 1;
}

#gallery-close:hover {
  color: #333;
  background: #f0f0f0;
}

.gallery-lock-icon {
  font-size: 48px;
  color: #49B1F5;
  margin-bottom: 12px;
}

/* Loading pulse on submit button */
.gallery-loading {
  animation: galleryPulse .8s ease-in-out infinite;
}

@keyframes galleryPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

.gallery-lock-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--font-color, #333);
}

.gallery-lock-hint {
  color: #999;
  font-size: 14px;
  margin: 0 0 24px;
}

.gallery-lock-input {
  display: flex;
  gap: 8px;
}

.gallery-lock-input input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color .3s;
  background: var(--card-bg, #fff);
  color: var(--font-color, #333);
}

.gallery-lock-input input:focus {
  border-color: #49B1F5;
}

.gallery-lock-input button {
  padding: 12px 18px;
  background: #49B1F5;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background .3s, transform .2s;
}

.gallery-lock-input button:hover {
  background: #3a8fd4;
  transform: scale(1.05);
}

.gallery-lock-input button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

#gallery-error {
  color: #e74c3c;
  font-size: 13px;
  margin: 12px 0 0;
  min-height: 18px;
}

/* Image grid */
#gallery-grid {
  display: none;
  padding: 20px 0;
}

.gallery-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.gallery-grid-item {
  border-radius: 10px;
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
  background: var(--card-bg, #f5f5f5);
  aspect-ratio: 4 / 3;
}

.gallery-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.gallery-grid-item a {
  display: block;
  width: 100%;
  height: 100%;
}

#gallery-grid .gallery-grid-item img {
  max-height: none !important;
  width: 100% !important;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .3s ease;
}

.gallery-grid-item img[src] {
  opacity: 1;
}

@media screen and (max-width: 768px) {
  .gallery-grid-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .gallery-lock-card {
    padding: 28px 20px;
  }
}

/* ===== 归档页面 ===== */
#archive .article-sort-item.year {
  font-size: 1.4rem;
  font-weight: 700;
  color: #49b1f5;
  margin: 24px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #49b1f5;
}

#archive .article-sort-item.month {
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  margin: 16px 0 6px;
  padding-left: 8px;
  border-left: 3px solid #49b1f5;
}

#archive .article-sort-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0 6px 16px;
}

#archive .article-sort-item-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#archive .article-sort-item-time {
  font-size: 0.85rem;
  color: #999;
  white-space: nowrap;
  min-width: 42px;
}

#archive .article-sort-item-title {
  color: var(--font-color, #333);
  text-decoration: none;
  transition: color .2s;
}

#archive .article-sort-item-title:hover {
  color: #49b1f5;
}

/* Mobile improvements */
@media screen and (max-width: 768px) {
  #site-title {
    font-size: 2rem !important;
  }

  .layout {
    padding: 10px !important;
  }
}
