/* Gallery */
.gallery-wrap {
  position: relative;
  max-width: 700px;
  margin: 1.5em auto;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.gallery-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}

.gallery-img {
  width: 100%;
  height: auto;
  display: none;
  border-radius: 8px;
}

.gallery-img.active {
  display: block;
  animation: galleryFadeIn 0.5s ease;
}

@keyframes galleryFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  font-size: 1.5em;
  padding: 12px 14px;
  cursor: pointer;
  z-index: 10;
  border-radius: 4px;
  transition: background 0.2s;
}

.gallery-btn:hover {
  background: rgba(0,0,0,0.7);
}

.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-dots {
  text-align: center;
  padding: 10px 0;
  position: absolute;
  bottom: 8px;
  width: 100%;
}

.gallery-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: background 0.3s;
}

.gallery-dot.active {
  background: #fff;
}

/* Blog scroll */
.blog-scroll-wrap {
  max-height: 360px;
  overflow-y: auto;
  padding: 1em;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-top: 0.5em;
}

.blog-scroll-wrap::-webkit-scrollbar {
  width: 6px;
}

.blog-scroll-wrap::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 3px;
}

.blog-scroll-wrap::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 3px;
}

[data-theme="dark"] .blog-scroll-wrap {
  border-color: #444;
}

[data-theme="dark"] .blog-scroll-wrap::-webkit-scrollbar-track {
  background: #2a2a3e;
}

[data-theme="dark"] .blog-scroll-wrap::-webkit-scrollbar-thumb {
  background: #666;
}

[data-theme="dark"] .gallery-wrap {
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Middle-earth Weather */
.me-weather {
  display: inline-block;
  font-size: 0.75em;
  vertical-align: middle;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.05);
  white-space: nowrap;
  font-family: 'PT Sans Narrow', sans-serif;
  font-weight: 400;
  text-transform: none;
}

[data-theme="dark"] .me-weather {
  background: rgba(255,255,255,0.1);
}

/* Weather particles canvas */
#weather-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Calendar */
.cal-frame {
  max-width: 220px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  font-family: 'PT Sans Narrow', sans-serif;
  font-size: 13px;
  margin: 1em 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #2c3e50;
  color: #fff;
  font-weight: 700;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.cal-nav-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

.cal-season { font-size: 13px; }
.cal-year { font-size: 12px; opacity: 0.8; }

.cal-year-bar {
  text-align: center;
  font-size: 11px;
  padding: 3px 0;
  background: #34495e;
  color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .cal-year-bar {
  background: #151f2b;
}

.cal-grid {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.cal-grid th {
  padding: 4px 2px;
  font-size: 11px;
  color: #888;
  font-weight: 400;
  border-bottom: 1px solid #eee;
}

.cal-grid td {
  padding: 5px 2px;
  text-align: center;
  cursor: default;
  transition: background 0.15s;
}

.cal-grid td:hover {
  background: #f0f4f8;
}

.cal-day-num {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  font-size: 12px;
}

.cal-today .cal-day-num {
  background: #3498db;
  color: #fff;
  font-weight: 700;
}

.cal-special {
  padding: 12px;
  text-align: center;
  background: #fff;
}

.cal-special-day {
  display: inline-block;
  padding: 4px 10px;
  margin: 3px;
  border-radius: 12px;
  background: #f0f0f0;
  font-size: 12px;
}

.cal-special-day.cal-today {
  background: #3498db;
  color: #fff;
  font-weight: 700;
}

.cal-detail {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fafafa;
  font-size: 18px;
  color: #333;
}

.cal-detail p {
  margin: 4px 0;
  text-indent: 0;
  line-height: 1.5;
}

/* Calendar dark mode */
[data-theme="dark"] .cal-frame {
  border-color: #444;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .cal-header {
  background: #1a2533;
}

[data-theme="dark"] .cal-grid {
  background: #1e1e30;
}

[data-theme="dark"] .cal-grid th {
  color: #888;
  border-bottom-color: #333;
}

[data-theme="dark"] .cal-grid td:hover {
  background: #2a2a3e;
}

[data-theme="dark"] .cal-special {
  background: #1e1e30;
}

[data-theme="dark"] .cal-special-day {
  background: #2a2a3e;
  color: #ccc;
}

[data-theme="dark"] .cal-special-day.cal-today {
  background: #2980b9;
  color: #fff;
}

[data-theme="dark"] .cal-detail {
  background: #1a1a2e;
  border-top-color: #333;
  color: #aaa;
}

/* === Mobile Responsive === */
@media only screen and (max-width: 37.5em) {
  .gallery-wrap {
    margin: 1em 0;
    border-radius: 4px;
  }

  .gallery-btn {
    padding: 8px 10px;
    font-size: 1.2em;
  }

  .gallery-prev { left: 4px; }
  .gallery-next { right: 4px; }

  .me-weather {
    display: block;
    margin-left: 0;
    margin-top: 6px;
    font-size: 0.7em;
  }

  .blog-scroll-wrap {
    max-height: 280px;
    padding: 0.75em;
  }

  .cal-frame {
    max-width: 100%;
  }

  .cal-grid th {
    font-size: 10px;
    padding: 3px 1px;
  }

  .cal-grid td {
    padding: 3px 1px;
  }

  .cal-day-num {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 11px;
  }

  .cal-detail {
    font-size: 16px;
  }
}

@media only screen and (max-width: 30em) {
  .gallery-wrap {
    margin: 0.5em -4%;
    border-radius: 0;
    width: 108%;
  }

  .gallery-dots {
    bottom: 4px;
  }

  .gallery-dot {
    width: 8px;
    height: 8px;
  }

  .top-navigation li {
    margin-right: 10px;
  }

  .me-weather {
    font-size: 0.65em;
    padding: 2px 6px;
  }

  .cal-header {
    padding: 6px 8px;
  }

  .cal-season {
    font-size: 11px;
  }

  .cal-nav-btn {
    font-size: 12px;
    padding: 2px 4px;
  }
}
