/* Giao diện tuỳ biến: "Apple-style" - nền sáng tối giản, chữ hệ thống to
   đậm, nhiều khoảng trắng, ảnh nền lớn full-bleed, rất ít chi tiết trang
   trí (không kính mờ/blob màu như bản cũ). */

:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --bg-light: #f5f5f7;
  --bg-white: #ffffff;
  --hairline: rgba(0, 0, 0, 0.08);

  /* ========================================================================
     TYPOGRAPHY DÙNG CHUNG — font hệ thống (giống cách Apple dùng SF Pro
     trên máy Apple, fallback sang font hệ thống trên các máy khác) thay vì
     tải font ngoài - vừa đúng tinh thần "Apple-style", vừa nhanh hơn vì
     không cần tải font từ Google Fonts.
     ======================================================================== */
  --font-title: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-subtitle: var(--font-title);
}

/* Theme Beautiful Jekyll gán cứng font 'Lora' (tiêu đề) / 'Open Sans' (nội
   dung) riêng lẻ cho rất nhiều selector cụ thể (.post-meta, .blog-tags,
   .navbar-custom, footer, pagination, subheading...) - override riêng
   từng chỗ sẽ rất dài dòng và dễ sót. Ép 1 rule universal `!important` là
   cách chắc chắn nhất để TOÀN BỘ nội dung (chữ thường lẫn tiêu đề) luôn
   dùng đúng font hệ thống của site này. */
/* Loại trừ icon font (Font Awesome) khỏi rule universal bên dưới - nếu
   không, icon sẽ hiện thành ô vuông/ký tự lạ vì bị ép sang font chữ (FA
   vẽ icon qua `content` + font riêng trên chính thẻ hoặc trên ::before). */
*:not(.fa):not([class*="fa-"]) {
  font-family: var(--font-title) !important;
}

*:not(.fa):not([class*="fa-"])::before,
*:not(.fa):not([class*="fa-"])::after {
  font-family: var(--font-title) !important;
}

h1, h2, h3, h4, h5, h6,
.font-title {
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.font-subtitle {
  font-weight: 500;
}

body {
  background-color: var(--bg-white);
  color: var(--ink);
}

/* Fade-in-up khi cuộn tới (hoặc khi tải trang), chỉ chạy 1 lần */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Hero / header lớn (ảnh nền giữ nguyên) ---------- */
.header-section.has-img .big-img {
  position: relative;
  overflow: hidden;
}

/* Lớp phủ tối dần phía dưới để chữ trắng luôn đọc rõ trên mọi ảnh nền,
   giống cách Apple luôn đảm bảo độ tương phản chữ/ảnh. */
.header-section.has-img .big-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

.header-section.has-img .big-img.intro-header {
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.6s ease-out, transform 6s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-section.has-img .big-img.intro-header.kenburns-settle {
  opacity: 1;
  transform: scale(1);
}

.header-section.has-img .page-heading h1,
.header-section.has-img .post-heading h1 {
  color: #ffffff !important;
  font-weight: 700;
  font-size: 3.25rem;
  letter-spacing: -0.02em;
}

.header-section.has-img .page-subheading,
.header-section.has-img .post-subheading {
  display: inline-block;
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.92) !important;
  font-family: var(--font-subtitle);
  font-weight: 400;
  font-size: 1.4rem;
}

@media (max-width: 640px) {
  .header-section.has-img .page-heading h1,
  .header-section.has-img .post-heading h1 {
    font-size: 2.1rem;
  }
  .header-section.has-img .page-subheading,
  .header-section.has-img .post-subheading {
    font-size: 1.1rem;
  }
}

/* ---------- Landing: khối giới thiệu + nút CTA ---------- */
.home-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.5rem;
}

.home-search {
  flex: 1;
  margin: 0;
}

.home-search input,
.home-filter select {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--bg-white);
  color: var(--ink);
  outline: none;
}

.home-search input:focus,
.home-filter select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.home-filter {
  width: 170px;
  margin: 0;
}

.home-display-mode {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--bg-light);
}

.home-mode-btn {
  width: 2.15rem;
  height: 2.15rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.home-mode-btn.is-active,
.home-mode-btn:hover {
  background: var(--bg-white);
  color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.posts-list li[hidden] {
  display: none !important;
}

.posts-list.posts-list-mode-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.posts-list.posts-list-mode-list .post-preview {
  display: block;
}

.posts-list.posts-list-mode-list .post-preview article {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 1rem;
  min-height: 120px;
}

.posts-list.posts-list-mode-list .post-preview .post-image-normal {
  grid-column: 1;
  grid-row: 1 / span 4;
  align-self: stretch;
}

.posts-list.posts-list-mode-list .post-preview .post-image-normal img {
  height: 100%;
}

.posts-list.posts-list-mode-list .post-preview .post-image img {
  height: 120px;
}

.posts-list.posts-list-mode-list .post-preview .post-title {
  margin-top: 0.75rem;
}

.posts-list.posts-list-mode-list .post-preview .post-title,
.posts-list.posts-list-mode-list .post-preview .post-subtitle,
.posts-list.posts-list-mode-list .post-preview .post-meta {
  grid-column: 2;
  padding-left: 0;
  padding-right: 0;
}

.posts-list.posts-list-mode-list .post-preview .blog-tags {
  grid-column: 2;
  padding-left: 0;
  padding-bottom: 0.75rem;
}

@media (max-width: 640px) {
  .home-controls {
    flex-wrap: wrap;
  }

  .home-search {
    flex-basis: 100%;
  }

  .home-filter {
    flex: 1;
    width: auto;
  }

  .posts-list.posts-list-mode-list .post-preview {
    min-height: 100px;
  }

  .posts-list.posts-list-mode-list .post-preview article {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .posts-list.posts-list-mode-list .post-preview .post-image-normal img {
    height: 100%;
    min-height: 100px;
  }
}

.landing-intro {
  padding: 3.5rem 1.5rem 1.5rem;
  margin: 0 auto 1rem;
  max-width: 720px;
  text-align: center;
}

.landing-intro h2 {
  margin-top: 0;
  font-size: 2.25rem;
}

.landing-intro p {
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
  margin: 1rem 0 1.75rem;
}

.landing-cta {
  display: inline-block;
  font-family: var(--font-subtitle);
  font-size: 1.05rem;
  font-weight: 500;
  color: #ffffff !important;
  background: var(--accent-blue);
  border-radius: 999px;
  padding: 0.65rem 1.75rem;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.landing-cta:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.latest-heading {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.75rem;
  color: var(--ink);
}

/* ---------- Trang chân dung ---------- */
.portrait-intro {
  max-width: 680px;
  margin: 2.25rem auto 2rem;
  text-align: center;
}

.portrait-kicker {
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.portrait-intro h2 {
  margin: 0.5rem 0 0.8rem;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.08;
}

.portrait-intro p:last-child,
.portrait-tip-grid p,
.portrait-closing {
  color: var(--muted);
  line-height: 1.65;
}

.portrait-tip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.portrait-tip-grid article {
  padding: 1.1rem;
  border: 1px solid var(--hairline);
  border-radius: 15px;
  background: var(--bg-light);
}

.portrait-tip-number {
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
}

.portrait-tip-grid h3 {
  margin: 0.45rem 0 0.3rem;
  font-size: 1rem;
}

.portrait-tip-grid p {
  margin: 0;
  font-size: 0.9rem;
}

.portrait-checklist {
  display: grid;
  gap: 0.7rem;
  margin: 1.25rem 0 1.75rem;
  padding: 1.1rem 1.25rem;
  border-radius: 15px;
  background: var(--bg-light);
}

.portrait-checklist label {
  color: var(--ink);
  font-size: 0.95rem;
}

.portrait-checklist input {
  margin-right: 0.55rem;
  accent-color: var(--accent-blue);
}

.portrait-closing {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent-blue);
}

@media (max-width: 640px) {
  .portrait-tip-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Trang Giới thiệu ---------- */
.about-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 2rem;
  align-items: center;
  margin: 2.5rem 0 3rem;
}

.about-intro-copy {
  max-width: 560px;
}

.about-kicker {
  margin: 0 0 0.75rem;
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.about-intro h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.08;
}

.about-intro p:not(.about-kicker),
.about-principle p,
.about-note p {
  color: var(--muted);
  line-height: 1.65;
}

.about-intro > img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 20px;
}

.about-principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.about-principle {
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--bg-light);
}

.about-principle img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.about-principle div {
  padding: 1rem 1.1rem;
}

.about-principle h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.about-principle p {
  margin: 0;
  font-size: 0.95rem;
}

.about-note {
  margin: 3rem 0 1rem;
  padding: 1.5rem;
  border-radius: 18px;
  background: var(--bg-light);
}

.about-note h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.about-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.about-note-grid span {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--ink);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .about-intro,
  .about-principles {
    grid-template-columns: 1fr;
  }

  .about-intro {
    margin-top: 1.5rem;
  }

  .about-intro > img {
    height: 240px;
  }
}

/* ---------- Trang Liên hệ + Chính sách ---------- */
.contact-intro,
.policy-intro {
  max-width: 680px;
  margin: 2.5rem auto 2rem;
  text-align: center;
}

.contact-kicker {
  margin-bottom: 0.75rem;
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.contact-intro h2,
.policy-intro h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.contact-intro p:last-child,
.policy-intro p:last-child {
  color: var(--muted);
  line-height: 1.65;
}

.contact-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto 1.5rem;
}

.contact-option {
  padding: 1.4rem;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--bg-light);
}

.contact-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.8rem;
  border-radius: 50%;
  color: #fff;
  background: var(--accent-blue);
}

.contact-option h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.contact-option p,
.contact-note p,
.policy-section {
  color: var(--muted);
  line-height: 1.65;
}

.contact-note {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--accent-blue);
  background: var(--bg-light);
}

.contact-note p {
  margin: 0.35rem 0 0;
}

.policy-intro {
  margin-bottom: 2.5rem;
}

.policy-section {
  max-width: 760px;
  margin: 0 auto 1.5rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--bg-white);
}

.policy-section h2 {
  margin-top: 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.policy-section p:last-child {
  margin-bottom: 0;
}

.policy-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.policy-points span {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--accent-blue);
  background: #e8f0fe;
  font-size: 0.8rem;
  font-weight: 600;
}

.policy-section li {
  margin-bottom: 0.55rem;
}

@media (max-width: 640px) {
  .contact-options {
    grid-template-columns: 1fr;
  }

  .policy-section {
    padding: 1.1rem;
  }
}

/* ---------- Navbar: thanh mỏng, nền trắng mờ nhẹ, không nổi/bo pill ---------- */
.navbar-custom {
  background: rgba(255, 255, 255, 0.82) !important;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: none !important;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0 !important;
  left: 0 !important;
  right: 0 !important;
  transform: none;
  top: 0 !important;
  width: 100%;
  max-width: none;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
  box-shadow: none;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.navbar-custom .navbar-brand {
  color: var(--ink) !important;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Logo + Home icon ---------- */
.navbar-brand-with-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-logo-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
}

.navbar-brand-text {
  font-size: 1rem;
}

/* Các mục menu: căn GIỮA, khoảng cách đều nhau, cỡ chữ nhỏ gọn + hơi
   nhạt màu hơn link thường - đúng kiểu nav của apple.com (không icon,
   không bám sát lề phải như mặc định Bootstrap `ml-auto`). */
.navbar-custom .navbar-nav {
  margin-left: auto !important;
  margin-right: 0 !important;
  align-items: center;
}

.navbar-custom .nav-item {
  margin: 0 0.55rem;
}

.navbar-custom .nav-link {
  color: var(--muted) !important;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  transition: color 0.15s ease;
}

.navbar-custom .nav-link:hover {
  color: var(--ink) !important;
}

/* Bỏ icon trang trí trước mỗi link nav - giữ chữ gọn, đúng tinh thần
   tối giản (Apple chỉ dùng chữ thường, không icon trong nav chính). */
.nav-link-home .fa,
.nav-link-icon .fa,
#nav-search-icon {
  display: none;
}

.nav-link-home,
.nav-link-icon {
  display: flex !important;
  align-items: center;
}

/* ---------- Footer: nền xám nhạt, chữ xám đậm - giống footer apple.com ---------- */
.footer-slogan {
  font-family: var(--font-subtitle);
  font-weight: 500;
  font-size: 1rem;
  color: var(--muted);
  margin: 0.5rem 0 1rem;
}

.footer-extra-links {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.footer-extra-links a {
  color: var(--muted);
}

.footer-extra-links a:hover {
  color: var(--accent-blue);
}

.footer-extra-dot {
  margin: 0 0.5rem;
  opacity: 0.6;
}

/* Menu mobile khi mở: liền mạch với thanh nav, thêm padding trái cho các
   mục cho thẳng với logo. Theme mặc định gán `border-top` cho
   `.navbar-collapse` ở mọi màn hình <1200px (xem beautifuljekyll.css) -
   bỏ hẳn viền này vì tạo thành 1 đường kẻ ngang xấu ngay dưới logo. */
.navbar-custom .navbar-collapse {
  margin: 0 !important;
  border-top: none !important;
}

.navbar-custom .navbar-nav .nav-link {
  padding-left: 1.5rem !important;
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
}

@media (min-width: 1200px) {
  .navbar-custom {
    padding-left: max(1.5rem, calc((100vw - 1200px) / 2)) !important;
    padding-right: max(1.5rem, calc((100vw - 1200px) / 2)) !important;
  }

  .navbar-custom .navbar-collapse {
    display: flex !important;
    align-items: center;
  }

  .navbar-custom .navbar-nav .nav-link {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
    white-space: nowrap;
  }
}

.navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item {
  padding-left: 2.5rem !important;
}

/* ---------- Danh sách bài viết: lưới đều, thẻ phẳng tối giản (không
   masonry lệch cột, không hiệu ứng kính) ---------- */
.posts-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

@media (max-width: 640px) {
  .posts-list {
    grid-template-columns: 1fr;
  }
}

.post-preview {
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-white);
  border: 1px solid var(--hairline);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.post-preview:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
}

.post-preview .post-image {
  margin: 0;
  float: none !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  padding: 0;
}

.post-preview .post-image img {
  width: 100%;
  height: 220px;
  max-width: 100% !important;
  max-height: none !important;
  object-fit: cover;
  display: block;
}

/* Theme ẩn ảnh lớn và hiện ảnh nhỏ 100x100 khi màn hình <500px — luôn giữ
   ảnh lớn, bỏ ảnh nhỏ trùng lặp để tránh vỡ layout trên mobile */
.post-preview .post-image-small {
  display: none !important;
}

@media (max-width: 500px) {
  .post-preview .post-image.post-image-normal {
    display: block !important;
  }
}

.post-preview .post-title,
.post-preview .post-subtitle,
.post-preview .post-meta,
.post-preview .post-entry {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.post-preview .post-title {
  margin-top: 1rem;
  font-size: 1.3rem;
  color: var(--ink);
}

.post-preview .post-subtitle {
  font-family: var(--font-subtitle);
  font-weight: 400;
  font-size: 1rem;
  color: var(--muted);
}

.post-preview .post-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.post-preview .blog-tags {
  padding-left: 1.25rem;
  padding-bottom: 1.25rem;
}

/* Tag dạng pill nhỏ gọn, màu pastel xen kẽ */
.blog-tags ul {
  padding-left: 0;
  margin-bottom: 0;
}

.blog-tags li {
  display: inline-block;
  padding: 0;
}

.blog-tags a {
  display: inline-block;
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  margin: 0.15rem 0.1rem;
  transition: filter 0.15s ease;
}

.blog-tags a:hover,
.blog-tags a:focus {
  border: none;
  outline: none;
  filter: brightness(0.92);
}

/* Nhiều sắc độ màu pastel cho các tag */
.blog-tags li:nth-of-type(7n+1) a { background: #e8f0fe; color: #174ea6; }
.blog-tags li:nth-of-type(7n+2) a { background: #e6f4ea; color: #1e8e3e; }
.blog-tags li:nth-of-type(7n+3) a { background: #fef3e2; color: #b06000; }
.blog-tags li:nth-of-type(7n+4) a { background: #fce8e8; color: #c5221f; }
.blog-tags li:nth-of-type(7n+5) a { background: #f3e8fd; color: #7c4cbf; }
.blog-tags li:nth-of-type(7n+6) a { background: #e7f3ff; color: #0077b6; }
.blog-tags li:nth-of-type(7n+7) a { background: #fff0f5; color: #9c27b0; }

/* ---------- Nội dung trang chi tiết bài viết ---------- */
.post-view-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--bg-light);
}

.post-view-toggle-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.post-view-toggle-btn {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  background: var(--bg-white);
  color: var(--accent-blue);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.post-view-toggle-btn[aria-pressed="true"] {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.18);
}

.post-view-toggle-btn:hover {
  border-color: var(--accent-blue);
}

.post-view-toggle-hide {
  display: none;
}

.post-view-toggle-btn[aria-pressed="true"] .post-view-toggle-show {
  display: none;
}

.post-view-toggle-btn[aria-pressed="true"] .post-view-toggle-hide {
  display: inline;
}

.post-compact-view .post-meta,
.post-compact-view .post-tags,
.post-compact-view .post-extra-content,
.post-compact-view .post-body > * {
  display: none;
}

/* Chế độ rút gọn vẫn giữ toàn bộ ảnh trong bài; chỉ ẩn chữ hướng dẫn. */
.post-compact-view .post-body > p:has(> img),
.post-compact-view .post-body > img,
.post-compact-view .post-body > h3 {
  display: block;
}

.post-compact-view .post-body > .post-gallery {
  display: grid;
}

.post-compact-view .post-body > .post-gallery.gallery-mode-stack {
  display: block;
}

.post-compact-view .post-body > .post-gallery.gallery-mode-masonry {
  display: block;
}

.post-compact-view .post-body > .post-gallery.gallery-mode-film {
  display: flex;
}

.post-compact-view .post-body > .gallery-controls {
  display: flex;
}

.post-compact-view .post-gallery figcaption {
  display: none;
}

.post-compact-view .post-body > p:has(> img) img,
.post-compact-view .post-body > img {
  display: block;
  width: 100%;
  height: auto;
}

.post-photo-block {
  position: relative;
  overflow: hidden;
}

.post-photo-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 2.5rem 1rem 0.9rem;
  color: #ffffff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.post-photo-overlay strong {
  font-size: 1rem;
}

.post-photo-overlay span {
  font-size: 0.85rem;
  line-height: 1.4;
}

.post-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 1.25rem 0 -0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.gallery-mode-btn {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: var(--bg-white);
  color: var(--muted);
  cursor: pointer;
}

.gallery-mode-btn.is-active,
.gallery-mode-btn:hover {
  border-color: var(--accent-blue);
  background: #e8f0fe;
  color: var(--accent-blue);
}

.post-gallery.gallery-mode-single {
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
}

.post-gallery.gallery-mode-single img {
  aspect-ratio: auto;
  max-height: 720px;
}

.post-gallery.gallery-mode-stack {
  position: relative;
  display: block;
  min-height: 520px;
  padding: 0.5rem 0;
}

.post-gallery.gallery-mode-stack figure {
  position: relative;
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(58%, 400px);
  margin: 0;
  border: 6px solid #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.post-gallery.gallery-mode-stack figure:first-child {
  transform: translate(-50%, -50%) translateX(-42%) rotate(-10deg);
  z-index: 1;
}

.post-gallery.gallery-mode-stack figure:nth-child(2) {
  transform: translate(-50%, -50%) translateX(-20%) rotate(6deg);
  z-index: 2;
}

.post-gallery.gallery-mode-stack figure:nth-child(3) {
  transform: translate(-50%, -50%) rotate(-2deg);
  z-index: 3;
}

.post-gallery.gallery-mode-stack figure:nth-child(4) {
  transform: translate(-50%, -50%) translateX(20%) rotate(8deg);
  z-index: 2;
}

.post-gallery.gallery-mode-stack figure:nth-child(n+5) {
  transform: translate(-50%, -50%) translateX(40%) rotate(-7deg);
  z-index: 1;
}

.post-gallery.gallery-mode-stack figcaption {
  background: #fff;
}

.post-gallery.gallery-mode-masonry {
  display: block;
  column-count: 3;
  column-gap: 0.75rem;
}

.post-gallery.gallery-mode-masonry figure {
  display: inline-block;
  width: 100%;
  margin: 0 0 0.75rem;
  break-inside: avoid;
}

.post-gallery.gallery-mode-masonry img {
  aspect-ratio: auto;
}

.post-gallery.gallery-mode-film {
  display: flex;
  overflow-x: auto;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 1rem;
  scroll-snap-type: x mandatory;
}

.post-gallery.gallery-mode-film figure {
  flex: 0 0 min(72vw, 360px);
  scroll-snap-align: center;
}

.post-gallery.gallery-mode-film img {
  aspect-ratio: auto;
}

.post-gallery.gallery-mode-compare {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-gallery.gallery-mode-compare figure:first-child::before,
.post-gallery.gallery-mode-compare figure:nth-child(2)::before {
  display: block;
  position: absolute;
  z-index: 1;
  top: 0.65rem;
  left: 0.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  font-size: 0.7rem;
  font-weight: 600;
}

.post-gallery.gallery-mode-compare figure:first-child::before {
  content: "Trước";
}

.post-gallery.gallery-mode-compare figure:nth-child(2)::before {
  content: "Sau";
}

.post-gallery.gallery-mode-compare figure {
  position: relative;
}

@media (max-width: 700px) {
  .post-gallery.gallery-mode-masonry {
    column-count: 2;
  }
}

@media (max-width: 700px) {
  .post-gallery.gallery-mode-stack {
    min-height: 400px;
  }

  .post-gallery.gallery-mode-stack figure {
    width: min(64%, 300px);
  }
}

.post-gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-light);
}

.post-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

.post-gallery:has(> figure:nth-child(4)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.post-gallery:has(> figure:nth-child(4)) img {
  aspect-ratio: 3 / 4;
}

.post-gallery figure:hover img {
  transform: scale(1.04);
}

.post-gallery figcaption {
  padding: 0.6rem 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.86);
  cursor: zoom-out;
}

.gallery-lightbox img {
  max-width: min(92vw, 900px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 10px;
}

.gallery-lightbox button {
  position: absolute;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-lightbox-close {
  top: 1rem;
  right: 1.5rem;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  top: 50%;
  padding: 1rem;
  transform: translateY(-50%);
}

.gallery-lightbox-prev {
  left: 1rem;
}

.gallery-lightbox-next {
  right: 1rem;
}

.gallery-lightbox button:hover,
.gallery-lightbox button:focus-visible {
  color: #b9d7ff;
}

@media (max-width: 700px) {
  .post-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-lightbox {
    padding: 1rem 3.5rem;
  }

  .gallery-lightbox-prev {
    left: 0.25rem;
  }

  .gallery-lightbox-next {
    right: 0.25rem;
  }
}

@media (hover: hover) and (pointer: fine) {
  .post-photo-block:hover .post-photo-overlay {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .post-view-toggle {
    align-items: stretch;
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-view-toggle-btn {
    width: 100%;
  }
}

.post-container,
#main-content {
  color: var(--ink);
}

.post-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 0;
  font-size: 1.1rem;
  line-height: 1.7;
}

.post-container img {
  border-radius: 14px;
}

/* ---------- Footer gọn gàng ---------- */
footer {
  padding: 2rem 0 1.25rem !important;
  background: var(--bg-light) !important;
  border-top: 1px solid var(--hairline);
}

footer .beautiful-jekyll-footer {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

footer .footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 2rem;
}

footer .footer-row-top {
  color: var(--muted);
  font-size: 0.85rem;
}

footer .footer-row-bottom {
  color: var(--muted);
  font-size: 0.75rem;
}

footer .footer-compact-links {
  display: flex;
  gap: 0.8rem;
}

.footer-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.06);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.footer-icon-link:hover {
  color: var(--accent-blue);
  background: rgba(0, 113, 227, 0.12);
  text-decoration: none;
}

footer .copyright {
  margin: 0;
}

/* ---------- Before/After toggle (trong bài viết) ---------- */
.ba-toggle {
  margin: 1.5rem 0 2rem;
  text-align: center;
}

.ba-buttons {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  padding: 0.3rem;
  background: var(--bg-light);
  border-radius: 999px;
}

.ba-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ba-btn.is-active,
.ba-btn:hover {
  background: var(--bg-white);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ba-frame img {
  width: 100%;
  max-width: 640px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  margin: 0 auto;
  background: var(--bg-light);
}

.ba-caption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ---------- Trang /tags/ ---------- */
.tags-search {
  margin: 1.5rem 0 1.25rem;
}

.tags-search input {
  width: 100%;
  max-width: 420px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--bg-white);
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.tags-search input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.tags-cloud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-light);
  color: var(--ink);
  border: 1px solid var(--hairline);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.tag-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  color: var(--accent-blue);
  text-decoration: none;
}

.tag-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-blue);
  color: #ffffff;
}

.tag-pill:nth-of-type(7n+1) { background: #e8f0fe; color: #174ea6; border-color: #d2e3fc; }
.tag-pill:nth-of-type(7n+2) { background: #e6f4ea; color: #1e8e3e; border-color: #ceead6; }
.tag-pill:nth-of-type(7n+3) { background: #fef3e2; color: #b06000; border-color: #fce8cd; }
.tag-pill:nth-of-type(7n+4) { background: #fce8e8; color: #c5221f; border-color: #fad2cf; }
.tag-pill:nth-of-type(7n+5) { background: #f3e8fd; color: #7c4cbf; border-color: #e9d2fc; }
.tag-pill:nth-of-type(7n+6) { background: #e7f3ff; color: #0077b6; border-color: #cce5ff; }
.tag-pill:nth-of-type(7n+7) { background: #fff0f5; color: #9c27b0; border-color: #ffd6e8; }

.tag-pill:nth-of-type(7n+1) .tag-pill-count { background: #174ea6; color: #ffffff; }
.tag-pill:nth-of-type(7n+2) .tag-pill-count { background: #1e8e3e; color: #ffffff; }
.tag-pill:nth-of-type(7n+3) .tag-pill-count { background: #b06000; color: #ffffff; }
.tag-pill:nth-of-type(7n+4) .tag-pill-count { background: #c5221f; color: #ffffff; }
.tag-pill:nth-of-type(7n+5) .tag-pill-count { background: #7c4cbf; color: #ffffff; }
.tag-pill:nth-of-type(7n+6) .tag-pill-count { background: #0077b6; color: #ffffff; }
.tag-pill:nth-of-type(7n+7) .tag-pill-count { background: #9c27b0; color: #ffffff; }

@media (max-width: 700px) {
  .tags-cloud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .tags-cloud {
    grid-template-columns: 1fr;
  }
}

.tag-section {
  margin-bottom: 2.5rem;
}

.tag-section-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--hairline);
}

.tag-posts {
  display: grid;
  gap: 0.75rem;
}

.tag-post-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 76px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-white);
  border: 1px solid var(--hairline);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.tag-post-thumb {
  flex: 0 0 88px;
  width: 88px;
  height: 64px;
  margin: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-light);
}

.tag-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tag-post-info {
  padding: 0.65rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tag-post-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.tag-post-info time {
  font-size: 0.75rem;
  color: var(--muted);
}
