/* 粉色主題，簡潔風格 */
:root {
  --bs-primary: #e91e8c;
  --bs-primary-rgb: 233, 30, 140;
  --bs-light: #fce4ec;
  --bs-light-rgb: 252, 228, 236;
  --blog-bg: #fdf2f7;
  --blog-card-bg: #fff;
}

body {
  background-color: var(--blog-bg);
  color: #333;
}

.navbar {
  background-color: var(--blog-card-bg) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.navbar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand {
  color: var(--bs-primary) !important;
  font-weight: 600;
}

/* 部落格 + 文章/相簿 tabs 同一行 */
.blog-header-with-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.blog-header-with-tabs .container {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
}
.blog-tabs {
  border-bottom: 0;
  gap: 0;
  margin-left: auto;
  margin-bottom: -1px;
}
.blog-tabs .nav-link {
  border: 0;
  border-radius: 0;
  color: #6c757d;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.blog-tabs .nav-link:hover {
  color: var(--bs-primary);
  background-color: rgba(var(--bs-primary-rgb), 0.08);
}
.blog-tabs .nav-link.active {
  color: var(--bs-primary);
  background-color: transparent;
  border-bottom: 2px solid var(--bs-primary);
}

/* 文章頁工具列：搜尋 + 篇數（在 main 內，不在頂端） */
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.blog-toolbar #list-count {
  margin-left: auto;
}

/* 日曆共用：FullCalendar 灰色系、按鈕與格線 */
.blog-calendar .fc,
#calendar-page .blog-calendar .fc {
  font-size: 0.8125rem;
  --fc-border-color: rgba(0, 0, 0, 0.08);
  --fc-button-bg-color: #6c757d;
  --fc-button-border-color: #6c757d;
  --fc-button-hover-bg-color: #5a6268;
  --fc-button-hover-border-color: #545b62;
}

.blog-calendar .fc-scrollgrid,
#calendar-page .blog-calendar .fc-scrollgrid {
  border-radius: 0.375rem;
}

.blog-calendar .fc-day-today,
#calendar-page .blog-calendar .fc-day-today {
  background-color: rgba(13, 110, 253, 0.06);
}

.blog-calendar .fc-daygrid-day-events,
#calendar-page .blog-calendar .fc-daygrid-day-events {
  min-height: 1.25em;
}

.blog-calendar .fc-daygrid-event-harness,
#calendar-page .blog-calendar .fc-daygrid-event-harness {
  margin-top: 0.2rem;
}

/* 日曆頁專用：整頁日曆，高度較大以顯示多篇標題 */
#calendar-page .blog-calendar {
  max-width: 900px;
  margin: 0 auto;
}

#calendar-page .fc-view-harness {
  min-height: 480px;
}

#calendar-page .fc-scrollgrid-sync-inner {
  min-height: 0;
}

/* 日曆事件（文章標題）：灰色、可點擊 */
.blog-calendar .fc-event-post,
#calendar-page .blog-calendar .fc-event-post {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  border: none;
  background-color: #6c757d;
  color: #fff;
  cursor: pointer;
}

.blog-calendar .fc-event-post:hover,
#calendar-page .blog-calendar .fc-event-post:hover {
  background-color: #5a6268;
  color: #fff;
}

/* 搜尋框：在內容區使用 */
#search-bar {
  min-width: 0;
}
.blog-search-form {
  min-width: 0;
  border-radius: 2rem;
}
.blog-search-form:focus-within {
  outline: none;
}
.blog-search-form .blog-search-input {
  width: 100%;
  min-width: 0;
  max-width: 280px;
  border: 1px solid #dee2e6;
  border-radius: 2rem 0 0 2rem;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
  background-color: #fff;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.blog-search-form .blog-search-input::placeholder {
  color: #6c757d;
}
.blog-search-form .blog-search-input:focus {
  outline: none;
  box-shadow: none;
  border-color: #dee2e6;
  background-color: #fff;
}
.blog-search-form .blog-search-input:focus-visible {
  outline: none;
  box-shadow: none;
}
.blog-search-form .blog-search-btn {
  border: 1px solid #dee2e6;
  border-left: 0;
  border-radius: 0 2rem 2rem 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  background-color: #f8f9fa;
  color: #495057;
  margin-left: -1px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.blog-search-form .blog-search-btn:focus,
.blog-search-form .blog-search-btn:focus-visible {
  outline: none;
  box-shadow: none;
}
.blog-search-form .blog-search-btn:hover {
  background-color: #e9ecef;
  color: #212529;
  border-color: #dee2e6;
}
.blog-search-form .blog-search-icon {
  display: none;
}
@media (min-width: 992px) {
  .blog-search-form .blog-search-input {
    max-width: 240px;
  }
  .blog-search-form .blog-search-icon {
    display: inline;
  }
  .blog-search-form .blog-search-text {
    display: none;
  }
}
@media (max-width: 991.98px) {
  #search-bar {
    width: 100%;
    order: 3;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  .blog-search-form {
    max-width: 100%;
  }
  .blog-search-form .blog-search-input {
    max-width: none;
    flex: 1;
    border-radius: 2rem 0 0 2rem;
  }
}

.btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-primary:hover {
  background-color: #c2185b;
  border-color: #c2185b;
}

.page-link {
  color: var(--bs-primary);
}

.page-item.active .page-link {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.page-link:hover {
  color: #c2185b;
}

a {
  color: var(--bs-primary);
}

a:hover {
  color: #c2185b;
}

.card {
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  background-color: var(--blog-card-bg);
}

.card-link-wrap {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.card-link-wrap:hover {
  color: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card .card-title {
  font-size: 1.25rem;
}
.card .card-text {
  font-size: 1.05rem;
}
.card .card-text.small {
  font-size: 1rem;
}

.card-img-top {
  object-fit: cover;
  height: 160px;
  background-color: var(--bs-light);
}

/* 列表卡片圖片：固定 16:9，無圖時顯示預設圖 */
.card-img-wrap-16-9 {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #e9ecef;
}
.card-img-wrap-16-9 .card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge.bg-primary {
  background-color: var(--bs-primary) !important;
}

#post-title {
  font-size: 1.9rem;
}
#post-meta {
  font-size: 1rem;
}
#post-body {
  max-width: 100%;
  line-height: 1.75;
  font-size: 1.1rem;
}

#post-body img {
  display: block;
  max-width: 60%;
  height: auto;
  margin-bottom: 0.5rem;
}

#post-body video,
#post-body iframe {
  max-width: 60%;
  height: auto;
}

#post-body p {
  margin-bottom: 1rem;
}

/* 分類模組：粉色風格 */
#category-bar {
  background-color: var(--bs-light);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
}
#category-bar .nav-pills {
  gap: 0.5rem;
}
#category-bar .nav-pills .nav-link {
  color: var(--bs-primary);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
}
#category-bar .nav-pills .nav-link:hover {
  color: #c2185b;
  background-color: rgba(var(--bs-primary-rgb), 0.15);
}
#category-bar .nav-pills .nav-link.active {
  background-color: var(--bs-primary);
  color: #fff;
}
#category-bar .dropdown-menu .dropdown-item {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}
#category-bar .dropdown-menu .dropdown-item.active {
  background-color: var(--bs-primary);
  color: #fff;
}
#category-bar .badge.bg-primary {
  background-color: var(--bs-primary) !important;
}

/* 手機端：常見作法－兩列對齊、下拉全寬、觸控友善 */
@media (max-width: 576px) {
  #category-bar {
    padding: 0.5rem;
  }
  #category-bar .nav-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    flex-wrap: unset;
  }
  #category-bar .nav-pills .nav-item {
    width: 100%;
    margin: 0;
  }
  #category-bar .nav-pills .nav-link {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
    border-radius: 0.375rem;
  }
  #category-bar .nav-pills .dropdown .nav-link {
    justify-content: space-between;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  #category-bar .dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    width: 100% !important;
    max-height: 70vh;
    overflow-y: auto;
    margin-top: 0.25rem;
    border-radius: 0.375rem;
  }
  #category-bar .dropdown-menu .dropdown-item {
    min-height: 2.75rem;
  }
}

/* 相簿列表：封面為前三張圖（左一大、右二小） */
.album-card {
  overflow: hidden;
}
.album-card .card-title {
  font-size: 1.1rem;
}
.album-card-cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #e9ecef;
}
.album-cover-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100%;
  height: 100%;
  gap: 2px;
}
.album-cover-main {
  grid-column: 1;
  grid-row: 1 / -1;
  overflow: hidden;
  background-color: var(--bs-light);
}
.album-cover-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.album-cover-side {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-height: 0;
}
.album-cover-small {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bs-light);
  position: relative;
}
.album-cover-small img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 相簿內頁：標題列 + 分頁置頂右側 */
.album-detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.album-detail-header-left {
  min-width: 0;
}
.album-detail-pagination-nav {
  flex-shrink: 0;
}
.album-detail-pagination-nav .pagination {
  margin-bottom: 0;
  justify-content: flex-end;
}

/* 相簿內頁：照片網格，一排六張（響應式） */
.album-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
@media (min-width: 576px) {
  .album-photo-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}
@media (min-width: 768px) {
  .album-photo-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
}
@media (min-width: 992px) {
  .album-photo-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
  }
}
@media (min-width: 1200px) {
  .album-photo-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
  }
}
.album-photo-item {
  aspect-ratio: 1;
  overflow: hidden;
  background-color: #e9ecef;
  border-radius: 0.25rem;
  cursor: pointer;
}
.album-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-photo-item .album-photo-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-photo-video-placeholder {
  width: 100%;
  height: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #c0c4cc;
  color: #909399;
  font-size: 1.5rem;
}

/* 相簿內頁：點擊照片放大 lightbox（原圖） */
.album-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.album-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}
.album-lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.album-lightbox-content img,
.album-lightbox-content video {
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  width: auto;
  height: auto;
  object-fit: contain;
}
.album-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}
.album-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.35);
}
.album-lightbox-prev,
.album-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}
.album-lightbox-prev:hover,
.album-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.35);
}
.album-lightbox-prev.d-none,
.album-lightbox-next.d-none {
  display: none !important;
}
.album-lightbox-prev {
  left: 1rem;
}
.album-lightbox-next {
  right: 1rem;
}
body.album-lightbox-open {
  overflow: hidden;
}

/* 文章內頁：內文圖片保持原尺寸與換行，點擊開原圖 */
.post-content .post-content-thumb {
  max-width: 100%;
  height: auto;
  cursor: pointer;
  vertical-align: middle;
}

/* 文章內頁：同分類上/下篇、歷史上的今天 */
.post-adjacent a {
  color: var(--bs-primary);
  text-decoration: none;
}
.post-adjacent a:hover {
  text-decoration: underline;
}
.on-this-day #on-this-day-list li {
  margin-bottom: 0.35rem;
}
.on-this-day #on-this-day-list a {
  color: var(--bs-primary);
  text-decoration: none;
}
.on-this-day #on-this-day-list a:hover {
  text-decoration: underline;
}
