/* =====================================================
   Tranh Tô Màu Cho Bé – main.css
   Port từ /UI/tranh-to-mau-cho-be/css/style.css. Các class trùng với
   GeneratePress (.container, .site-header, .search, .menu-toggle…) đã đổi
   sang tiền tố htm- để không dính CSS của parent theme.
   ===================================================== */

:root {
  --blue: #1f63d6;
  --blue-dark: #174fb3;
  --blue-text: #1e4fb0;
  --pink: #e8338a;
  --pink-dark: #d11f73;
  --sky: #d7ecff;
  --sky-light: #eef7ff;
  --cream: #fffbea;
  --text: #2d3748;
  --muted: #5b6b86;
  --white: #ffffff;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --featured-bg: #e8f3ff;
  --tips-bg: #ffeaf3;
  --ring: #d8e3f3;
  --shadow: 0 6px 18px rgba(40, 80, 160, .10);
  --radius-lg: 22px;
  --radius-md: 16px;

  --font-display: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;

  /* Biến màu toàn cục của GeneratePress → dùng token của theme */
  --contrast: var(--text);
  --contrast-2: var(--muted);
  --base: var(--ring);
  --base-2: var(--bg);
  --base-3: var(--card-bg);
  --accent: var(--blue);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11182a;
    --card-bg: #1b2440;
    --featured-bg: #182238;
    --tips-bg: #2a1a2a;
    --text: #e8eefb;
    --muted: #a9b6cf;
    --blue-text: #8fb6ff;
    --ring: #2b3756;
    --sky: #1b2a44;
    --sky-light: #141d33;
    --cream: #3a3420;
    --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11182a;
  --card-bg: #1b2440;
  --featured-bg: #182238;
  --tips-bg: #2a1a2a;
  --text: #e8eefb;
  --muted: #a9b6cf;
  --blue-text: #8fb6ff;
  --ring: #2b3756;
  --sky: #1b2a44;
  --sky-light: #141d33;
  --cream: #3a3420;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--bg);
}
img, svg { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); }
:focus-visible { outline: 3px solid #ffb83d; outline-offset: 2px; border-radius: 8px; }

.htm-container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.htm-header a, .htm-footer a, #htm-main a { text-decoration: none; }
.htm-header ul, .htm-footer ul { margin: 0; padding: 0; list-style: none; }
.htm-header h1, .htm-header h2, .htm-header h3,
#htm-main h1, #htm-main h2, #htm-main h3 { margin: 0; line-height: 1.15; }
#htm-main img, .htm-header img, .htm-footer img, .htm-related img { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 800;
  border-radius: 999px; white-space: nowrap; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn svg { width: 18px; height: 18px; display: block; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-hero, .btn-hero:hover, .btn-hero:focus {
  background: linear-gradient(180deg, #f14fa0, #d8206f);
  color: #fff; font-size: 20px; padding: 14px 32px;
  box-shadow: 0 8px 20px rgba(216, 32, 111, .35);
}
.btn-hero svg { width: 22px; height: 22px; }
.btn-hero .arrow { margin-left: 2px; }

.btn-small, .btn-small:focus {
  background: var(--blue); color: #fff;
  font-size: 14px; padding: 9px 22px;
  box-shadow: 0 4px 12px rgba(31, 99, 214, .3);
}
.btn-small:hover { background: var(--blue-dark); color: #fff; }

.btn-outline, .btn-outline:focus {
  background: var(--card-bg); color: var(--pink);
  border: 2px solid var(--pink); font-size: 16px; padding: 11px 26px;
}
.btn-outline:hover { background: var(--pink); color: #fff; }

/* =====================================================
   HEADER
   ===================================================== */
.htm-header {
  background: var(--bg);
  border-bottom: 1px solid var(--ring);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
}
.admin-bar .htm-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .htm-header { top: 0; position: relative; } }

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-icon { width: 58px; height: auto; }
.brand-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: 22px; line-height: 1.05; color: var(--blue-text); white-space: nowrap;
}
/* Logo từ Tùy biến › Nhận dạng trang: giới hạn chiều cao, chiều rộng tự co theo tỉ lệ */
.htm-header .brand-logo { display: block; width: auto; height: auto; max-height: 64px; max-width: 260px; }

/* Ô tìm kiếm thu gọn thành nút tròn, bấm để mở rộng */
.htm-search {
  position: relative; display: flex; align-items: center; flex-shrink: 0;
  height: 44px; width: 44px; border-radius: 999px; margin: 0;
  border: 1.5px solid var(--ring); background: var(--card-bg);
  overflow: hidden; transition: width .25s ease;
}
.htm-search.is-open {
  width: 320px; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 5; box-shadow: var(--shadow);
}
.htm-search input,
.htm-search input:focus {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent;
  font: inherit; font-weight: 600; color: var(--text); outline: none;
  padding: 0 0 0 16px; opacity: 0; transition: opacity .2s;
}
.htm-search.is-open input { opacity: 1; }
.htm-search:not(.is-open) input { flex: 0 0 0; width: 0; padding: 0; }
.htm-search input::placeholder { color: #8a97ad; }
.htm-header .search-btn,
.htm-header .search-btn:focus {
  flex-shrink: 0; width: 41px; height: 41px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--blue); display: grid; place-items: center;
  margin-left: auto; line-height: 1;
}
.htm-header .search-btn:hover { background: var(--sky-light); color: var(--blue); }
.search-btn svg { width: 20px; height: 20px; }

/* Menu chính (wp_nav_menu hoặc fallback trong functions.php) */
.main-nav { margin-left: auto; }
.htm-nav-list { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.htm-nav-list > li { position: relative; }
.htm-nav-list a {
  display: block; font-weight: 800; font-size: 14px; padding: 8px 10px; white-space: nowrap;
  border-radius: 999px; color: var(--text); transition: background .15s, color .15s;
}
.htm-nav-list a:hover, .htm-nav-list a:focus { background: var(--sky-light); color: var(--blue-text); }
.htm-nav-list > .current-menu-item > a,
.htm-nav-list > .current-menu-ancestor > a,
.htm-nav-list > .current-menu-item > a:hover { background: var(--blue); color: #fff; }
.htm-nav-list .menu-item-has-children > a::after {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg); margin-left: 8px;
}
.htm-nav-list .sub-menu {
  position: absolute; top: 100%; right: 0; z-index: 10; min-width: 210px;
  padding: 8px; margin-top: 6px; background: var(--card-bg);
  border: 1px solid var(--ring); border-radius: var(--radius-md); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.htm-nav-list .sub-menu::before { content: ""; position: absolute; inset: -8px 0 auto; height: 8px; }
.htm-nav-list li:hover > .sub-menu,
.htm-nav-list li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.htm-nav-list .sub-menu a { border-radius: 10px; }
.htm-nav-list .sub-menu .current-menu-item > a { color: var(--blue-text); background: var(--sky-light); }

.htm-header .htm-menu-toggle,
.htm-header .htm-menu-toggle:hover,
.htm-header .htm-menu-toggle:focus {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  border: 1.5px solid var(--ring); border-radius: 12px; background: var(--card-bg);
}
.htm-menu-toggle span { display: block; height: 3px; border-radius: 3px; background: var(--blue); }

/* =====================================================
   HERO – toàn bộ cảnh là 1 ảnh nền; chỉ tiêu đề, mô tả, nút là HTML
   ===================================================== */
.htm-hero {
  position: relative;
  background: #d8ecff url("../images/hero/hero-bg.webp") center top / cover no-repeat;
  width: 100%;
  /* Cao đúng tỉ lệ ảnh nền (1193:311) để thấy trọn hình. Chữ co theo vw cho vừa khung;
     nếu Tên/Khẩu hiệu quá dài thì banner vẫn giãn ra chứ không cắt chữ. */
  min-height: 26.07vw; display: flex;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 1; display: flex; align-items: center; }
.hero-copy { width: 45%; max-width: 560px; padding: 12px 0 12px 5.5%; }
#htm-main .hero-title { font-size: clamp(20px, 2.7vw, 46px); font-weight: 800; letter-spacing: -.01em; }
.hero-title span { display: block; text-wrap: balance; } /* tên site dài thì tự xuống dòng cân đối */
.line-blue { color: #1f63d6; text-shadow: 0 2px 0 #fff; }
.line-pink { color: #e8338a; text-shadow: 0 2px 0 #fff; }
.hero-sub { font-size: clamp(12.5px, 1.05vw, 18px); color: #4d5e7d; margin: 8px 0 14px; line-height: 1.45; }
.hero-copy .btn-hero, .hero-copy .btn-hero:hover, .hero-copy .btn-hero:focus {
  font-size: clamp(14px, 1.25vw, 20px); padding: clamp(9px, .8vw, 14px) clamp(18px, 2vw, 32px);
}
.hero-copy .btn-hero svg { width: clamp(16px, 1.4vw, 22px); height: clamp(16px, 1.4vw, 22px); }

@media (max-width: 860px) {
  .htm-hero { aspect-ratio: auto; min-height: 420px; background-position: 72% bottom; background-size: auto 100%; }
  .htm-hero::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(216,236,255,.92) 0%, rgba(216,236,255,.85) 45%, rgba(216,236,255,0) 100%);
  }
  .hero-inner { align-items: flex-start; }
  .hero-sub br { display: none; }
  .hero-copy { width: 100%; max-width: none; padding-left: 0; text-align: center; display: flex; flex-direction: column; align-items: center; padding-top: 32px; }
  /* Mobile: ảnh nền cắt theo chiều cao, cỡ chữ cố định cho dễ đọc */
  #htm-main .hero-title { font-size: 32px; }
  .hero-sub { font-size: 15px; margin: 12px 0 20px; }
  .hero-copy .btn-hero, .hero-copy .btn-hero:hover, .hero-copy .btn-hero:focus { font-size: 18px; padding: 13px 28px; }
  .hero-copy .btn-hero svg { width: 20px; height: 20px; }
}
@media (max-width: 520px) {
  .htm-hero { min-height: 380px; }
  #htm-main .hero-title { font-size: 28px; }
  .hero-copy .btn-hero, .hero-copy .btn-hero:hover, .hero-copy .btn-hero:focus { font-size: 17px; padding: 12px 24px; }
}

/* =====================================================
   SECTIONS (shared)
   ===================================================== */
.htm-section { padding: 28px 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.section-title,
#htm-main .section-title,
.htm-related .section-title {
  display: flex; align-items: center; gap: 12px; margin: 0;
  font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.15; color: var(--blue-text);
}
.section-title img { width: 32px; height: auto; }
#htm-main .title-pink { color: var(--pink); }

/* =====================================================
   CATEGORIES
   ===================================================== */
.cat-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px;
}
.cat-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 18px 10px 34px; border-radius: var(--radius-md);
  box-shadow: var(--shadow); text-align: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(40, 80, 160, .16); }
.cat-card picture { height: 96px; display: grid; place-items: center; }
#htm-main .cat-card img { height: 96px; width: auto; max-width: 100%; object-fit: contain; }
.cat-name { margin-top: 12px; font-weight: 800; font-size: 15px; color: var(--text); }
.cat-count { font-size: 13px; font-weight: 700; margin-top: 2px; }
.cat-arrow {
  position: absolute; right: 10px; bottom: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800;
}
.bg-orange { background: #f5a623; }
.bg-sky    { background: #3b8be6; }
.bg-purple { background: #9b6ae8; }
.bg-pink   { background: #ee6aa8; }

.tint-yellow { background: #fff6cf; } .tint-yellow .cat-count { color: #c8821c; }
.tint-blue   { background: #e0efff; } .tint-blue .cat-count   { color: #2d6fd4; }
.tint-lilac  { background: #ece6ff; } .tint-lilac .cat-count  { color: #7b55d9; }
.tint-cream  { background: #fff3d6; } .tint-cream .cat-count  { color: #d1861b; }
.tint-mint   { background: #ffe9f3; } .tint-mint .cat-count   { color: #2d6fd4; }
.tint-rose   { background: #ffe7ea; } .tint-rose .cat-count   { color: #e26a3a; }
.tint-ice    { background: #e3f0ff; } .tint-ice .cat-count    { color: #2d6fd4; }
.tint-peach  { background: #fdeee4; } .tint-peach .cat-count  { color: #9b6ae8; }
.tint-mint .cat-name, .tint-blue .cat-name, .tint-ice .cat-name { color: #1e4fb0; }
.tint-lilac .cat-name { color: #5a3db0; }
.tint-rose .cat-name, .tint-cream .cat-name { color: #c05b22; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cat-card { background: var(--card-bg); }
  :root:not([data-theme="light"]) .cat-name { color: var(--text); }
}
:root[data-theme="dark"] .cat-card { background: var(--card-bg); }
:root[data-theme="dark"] .cat-name { color: var(--text); }

/* =====================================================
   FEATURED + thẻ bộ tranh dùng chung
   ===================================================== */
.featured-box {
  background: var(--featured-bg); border-radius: var(--radius-lg);
  padding: 26px 24px 28px;
}
.featured-box .section-title { margin-bottom: 20px; }
#htm-main .featured-box .section-title, .htm-related .section-title { margin-bottom: 20px; }
.feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feat-card {
  position: relative; background: var(--card-bg); border-radius: var(--radius-md);
  padding: 18px 16px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.feat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(40, 80, 160, .16); }
.feat-img {
  width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: #fff; border-radius: 12px; overflow: hidden;
}
.feat-card .feat-img img { width: 92%; height: auto; max-height: 92%; object-fit: contain; }
.feat-card .feat-title,
#htm-main .feat-card .feat-title {
  font-family: var(--font-body); font-size: 15px; font-weight: 800; line-height: 1.4;
  color: var(--text); margin: 14px 0; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.feat-card .feat-title a, .feat-card .feat-title a:hover { color: inherit; text-decoration: none; }
.feat-card .feat-title a:hover { color: var(--blue-text); }
.feat-card .btn-small { margin-top: auto; }
.hot {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  background: var(--pink); color: #fff; font-size: 12px; font-weight: 800;
  font-style: italic; padding: 3px 11px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(232, 51, 138, .35);
}

/* =====================================================
   TIPS
   ===================================================== */
.tips-box {
  position: relative; background: var(--tips-bg); border-radius: var(--radius-lg);
  padding: 26px 28px; display: grid;
  grid-template-columns: 1fr auto 300px; align-items: center; gap: 28px;
  min-height: 150px; overflow: visible;
}
.tips-box.no-link { grid-template-columns: 1fr 300px; }
.tips-copy p { margin: 10px 0 0; font-size: 15.5px; line-height: 1.55; max-width: 60ch; }
.tips-art { position: relative; align-self: end; margin-bottom: -26px; }
#htm-main .tips-art img { width: 300px; height: auto; }
.tips-sparkle { position: absolute; top: -18px; left: -22px; width: 30px; }

/* =====================================================
   ARCHIVE / SEARCH
   ===================================================== */
/* Nền dải tiêu đề đi theo token --sky/--sky-light để dark mode không ra chữ sáng trên nền sáng */
.htm-page-head {
  background: linear-gradient(var(--sky), var(--sky-light) 70%, var(--bg));
  padding: 34px 0 10px; text-align: center;
}
#htm-main .page-title { font-size: clamp(28px, 3.4vw, 42px); font-weight: 800; color: var(--blue-text); }
.page-desc { margin: 8px auto 0; max-width: 70ch; font-size: 16px; font-weight: 700; color: #3f5070; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .page-desc { color: #c9d4e8; }
}
:root[data-theme="dark"] .page-desc { color: #c9d4e8; }
.htm-page-head .rank-math-breadcrumb,
.inside-article .rank-math-breadcrumb { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.htm-page-head .rank-math-breadcrumb p,
.inside-article .rank-math-breadcrumb p { margin: 0; }
.htm-page-head .rank-math-breadcrumb a,
.inside-article .rank-math-breadcrumb a { color: var(--blue-text); text-decoration: none; }
.htm-page-head .rank-math-breadcrumb a:hover,
.inside-article .rank-math-breadcrumb a:hover { color: var(--blue-text); text-decoration: underline; }

/* ---------- Phân trang: bong bóng màu pastel + nút viên thuốc ---------- */
.htm-pagination {
  margin: 40px auto 0; width: fit-content; max-width: 100%;
  display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 14px 18px;
  padding: 14px 16px; border-radius: 999px;
  background: var(--featured-bg); box-shadow: inset 0 0 0 1.5px var(--ring);
}
.htm-pagination .pg-bubbles { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.htm-pagination .page-numbers {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 19px; font-weight: 800; line-height: 1;
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(40, 80, 160, .12);
  transition: transform .18s ease, box-shadow .18s ease;
}
.htm-pagination a.page-numbers:hover,
.htm-pagination a.page-numbers:focus-visible { transform: translateY(-3px) rotate(-4deg); box-shadow: 0 10px 18px rgba(40, 80, 160, .2); }

.pg-yellow, .pg-yellow:hover { background: #fff6cf; color: #c8821c; }
.pg-blue,   .pg-blue:hover   { background: #e0efff; color: #2d6fd4; }
.pg-lilac,  .pg-lilac:hover  { background: #ece6ff; color: #7b55d9; }
.pg-mint,   .pg-mint:hover   { background: #ffe9f3; color: #d6337f; }
.pg-peach,  .pg-peach:hover  { background: #fdeee4; color: #e26a3a; }

/* Trang hiện tại: gradient hồng giống nút "Khám phá ngay" */
.htm-pagination .page-numbers.current {
  width: 54px; height: 54px; font-size: 22px; color: #fff;
  background: linear-gradient(180deg, #f14fa0, #d8206f);
  box-shadow: 0 8px 18px rgba(216, 32, 111, .35), 0 0 0 4px rgba(232, 51, 138, .15);
  position: relative;
}
.htm-pagination .page-numbers.current::after {
  content: ""; position: absolute; top: -6px; right: -6px; width: 16px; height: 16px;
  background: #ffd23f;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.pg-dots span { display: block; padding: 0 4px; color: var(--muted); font-size: 12px; letter-spacing: 2px; }

.pg-step, .pg-step:hover, .pg-step:focus {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  height: 46px; padding: 0 20px; border-radius: 999px;
  font-weight: 800; font-size: 15px; color: #fff;
  background: var(--blue); box-shadow: 0 4px 12px rgba(31, 99, 214, .3);
  transition: transform .15s ease, background .15s ease;
}
.pg-step svg { width: 18px; height: 18px; display: block; }
a.pg-step:hover { background: var(--blue-dark); transform: translateY(-2px); }
a.pg-prev:hover svg { transform: translateX(-2px); }
a.pg-next:hover svg { transform: translateX(2px); }
.pg-step svg { transition: transform .15s ease; }
.pg-step.is-disabled, .pg-step.is-disabled:hover {
  background: var(--card-bg); color: var(--muted); box-shadow: none;
  border: 1.5px dashed var(--ring); opacity: .7; cursor: default;
}
.pg-status {
  grid-column: 1 / -1; justify-self: center; margin: -4px 0 0;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.pg-status strong { color: var(--pink); font-weight: 800; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .htm-pagination .page-numbers:not(.current) { background: var(--card-bg); border-color: var(--ring); }
}
:root[data-theme="dark"] .htm-pagination .page-numbers:not(.current) { background: var(--card-bg); border-color: var(--ring); }

/* Mobile: hàng trên là bong bóng số, hàng dưới là ← Trang x/y → */
@media (max-width: 640px) {
  .htm-pagination {
    width: 100%; border-radius: var(--radius-lg); padding: 16px 12px 12px; gap: 12px 8px;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "bubbles bubbles bubbles" "prev status next";
  }
  .htm-pagination .pg-bubbles { grid-area: bubbles; justify-content: center; gap: 4px; }
  .pg-prev { grid-area: prev; }
  .pg-next { grid-area: next; }
  .pg-status { grid-area: status; grid-column: auto; margin: 0; align-self: center; }
  .pg-step, .pg-step:hover, .pg-step:focus { height: 40px; padding: 0 14px; font-size: 14px; }
  .htm-pagination .page-numbers { width: 38px; height: 38px; font-size: 16px; }
  .htm-pagination .page-numbers.current { width: 44px; height: 44px; font-size: 18px; }
  .pg-dots span { padding: 0 2px; letter-spacing: 1px; }
}
@media (max-width: 420px) {
  .pg-status { white-space: nowrap; }
  .pg-step, .pg-step:hover, .pg-step:focus { width: 40px; padding: 0; justify-content: center; }
  .pg-step span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

.htm-empty { text-align: center; }
.htm-empty .section-title { justify-content: center; }
.htm-empty .search-form { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

/* =====================================================
   BÀI VIẾT / TRANG (template GeneratePress)
   ===================================================== */
.site-content { padding-top: 28px; }
.separate-containers .inside-article {
  border-radius: var(--radius-lg); box-shadow: var(--shadow); background: var(--card-bg);
}
.entry-title, h1.entry-title {
  font-family: var(--font-display); font-weight: 800; color: var(--blue-text);
  font-size: clamp(26px, 3vw, 38px); line-height: 1.2;
}
.entry-meta { color: var(--muted); font-size: 14px; }
.entry-meta a { color: var(--blue-text); }
.entry-content { font-size: 17px; line-height: 1.7; }
.entry-content h2, .entry-content h3 {
  font-weight: 800; color: var(--blue-text); line-height: 1.25; margin-top: 1.4em;
}
.entry-content h2 { font-size: 28px; }
.entry-content h3 { font-size: 22px; }
.entry-content a { color: var(--blue-text); }

/* Ảnh tranh trong bài: lưới 2 cột, mỗi tranh là một thẻ có nút tải.
   figure.htm-fig do filter the_content trong functions.php gắn cho mọi kiểu chèn ảnh. */
.single-post .entry-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.single-post .entry-content > * { grid-column: 1 / -1; }
.single-post .entry-content > figure.htm-fig { grid-column: auto; }
.entry-content figure.htm-fig {
  width: auto !important; /* figure.wp-caption có inline style width:800px */
  max-width: 100%; margin: 0 0 20px; padding: 12px; background: #fff;
  border: 1.5px solid var(--ring); border-radius: var(--radius-md); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
}
.entry-content figure.htm-fig > a { display: block; width: 100%; }
.entry-content figure.htm-fig img { display: block; width: 100%; height: auto; margin: 0; border-radius: 10px; }
.entry-content figure.htm-fig figcaption {
  margin: 10px 0 0; padding: 0; opacity: 1; font-size: 14px; font-weight: 700; color: #4d5e7d; text-align: center;
}
/* Ô "Xem thêm" chèn giữa bài (functions.php › htm_see_also_box) */
.entry-content .htm-see-also {
  display: block; margin: 4px 0 24px; padding: 14px 18px;
  background: var(--featured-bg); border: 1.5px solid var(--ring); border-left: 5px solid var(--pink);
  border-radius: var(--radius-md); line-height: 1.55; font-size: 16px;
}
.htm-see-also-label { font-weight: 800; color: var(--pink); margin-right: 4px; }
.entry-content .htm-see-also a { font-weight: 800; color: var(--blue-text); text-decoration: none; }
.entry-content .htm-see-also a:hover { color: var(--blue-text); text-decoration: underline; }

/* 2 nút tải dưới mỗi tranh (thêm bằng main.js). Selector đôi để thắng CSS button của GeneratePress. */
.htm-dl-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.htm-dl-group .htm-dl,
.htm-dl-group .htm-dl:hover,
.htm-dl-group .htm-dl:focus {
  border: 0; color: #fff; font-family: var(--font-body); font-size: 14px; font-weight: 800; line-height: 1;
  padding: 10px 20px; border-radius: 999px; cursor: pointer;
}
.htm-dl-group .htm-dl-png, .htm-dl-group .htm-dl-png:focus { background: var(--blue); box-shadow: 0 4px 12px rgba(31, 99, 214, .3); }
.htm-dl-group .htm-dl-png:hover { background: var(--blue-dark); }
.htm-dl-group .htm-dl-pdf, .htm-dl-group .htm-dl-pdf:focus { background: linear-gradient(180deg, #f14fa0, #d8206f); box-shadow: 0 4px 12px rgba(216, 32, 111, .3); }
.htm-dl-group .htm-dl-pdf:hover { background: linear-gradient(180deg, #e33d92, #c11a63); }
.htm-dl-group .htm-dl:disabled { opacity: .75; cursor: progress; transform: none; }

.htm-related { margin-top: 28px; }

@media (max-width: 768px) {
  .single-post .entry-content { grid-template-columns: 1fr; }
  .separate-containers .inside-article { padding: 24px 18px; }
}

/* =====================================================
   FOOTER
   ===================================================== */
.htm-footer {
  position: relative; margin-top: 44px; padding: 70px 0 22px;
  background: url("../images/backgrounds/footer-hills.webp") bottom center / 100% auto no-repeat;
}
.footer-house { position: absolute; left: 2%; bottom: 10px; width: 120px; }
.footer-house img { width: 100%; height: auto; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: nowrap; position: relative;
}
.footer-links { margin-left: 140px; flex-shrink: 0; }
.htm-footer-list { display: flex; align-items: center; flex-wrap: nowrap; gap: 0 4px; }
.htm-footer-list a { font-size: 13.5px; font-weight: 800; color: #26416b; padding: 4px 8px; white-space: nowrap; }
.htm-footer-list li + li::before { content: "|"; color: #26416b; margin-right: 6px; opacity: .6; }
.htm-footer-list a:hover { color: #26416b; text-decoration: underline; }
.footer-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
/* Menu "MenuLink" ở footer – luôn ẩn (theo yêu cầu) */
.htm-hidden-links { display: none !important; }
.copyright { margin: 0; line-height: 1.3; font-size: 12px; font-weight: 700; color: #26416b; }

/* =====================================================
   NÚT NỔI GÓC PHẢI: đổi sáng/tối + về đầu trang (nút có sẵn của GeneratePress)
   ===================================================== */
.htm-theme-toggle, .htm-theme-toggle:hover, .htm-theme-toggle:focus,
a.generate-back-to-top, a.generate-back-to-top:hover, a.generate-back-to-top:focus {
  position: fixed; right: 20px; z-index: 40;
  width: 48px; height: 48px; padding: 0; border: 2px solid #fff; border-radius: 50%;
  display: grid; place-items: center; line-height: 1; font-size: 20px;
  box-shadow: 0 6px 16px rgba(20, 50, 120, .28);
}
a.generate-back-to-top, a.generate-back-to-top:focus { bottom: 20px; background: var(--blue); color: #fff; }

/* Ẩn cho tới khi cuộn xuống (GP thêm class __show). Tự khai báo ở đây vì CSS động
   của GeneratePress được cache và có thể thiếu quy tắc này. */
a.generate-back-to-top {
  opacity: 0; transform: translateY(16px) scale(.85); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .15s ease;
}
a.generate-back-to-top.generate-back-to-top__show { opacity: 1; transform: none; pointer-events: auto; }
a.generate-back-to-top:hover { background: var(--blue-dark); color: #fff; }
a.generate-back-to-top .gp-icon svg { top: 0; width: 20px; height: 20px; }

/* Nút sáng/tối luôn hiện; khi nút về đầu trang xuất hiện thì nhích lên phía trên nó */
.htm-theme-toggle, .htm-theme-toggle:focus {
  bottom: 20px; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #8b6cf0, #5b3fd1);
  transition: bottom .3s ease, transform .15s ease;
}
.htm-theme-toggle:hover { color: #fff; background: linear-gradient(180deg, #7a5be6, #4c31c0); transform: translateY(-2px); }
body:has(.generate-back-to-top__show) .htm-theme-toggle { bottom: 80px; }
.htm-theme-toggle svg { width: 22px; height: 22px; display: block; }
.htm-theme-toggle .icon-sun { display: none; }
.htm-theme-toggle.is-dark, .htm-theme-toggle.is-dark:hover, .htm-theme-toggle.is-dark:focus { background: linear-gradient(180deg, #ffd23f, #f5a623); color: #5a3a00; }
.htm-theme-toggle.is-dark .icon-sun { display: block; }
.htm-theme-toggle.is-dark .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .htm-theme-toggle,
  :root:not([data-theme="light"]) a.generate-back-to-top { border-color: var(--ring); }
}
:root[data-theme="dark"] .htm-theme-toggle,
:root[data-theme="dark"] a.generate-back-to-top { border-color: var(--ring); }
@media (max-width: 520px) {
  .htm-theme-toggle, .htm-theme-toggle:hover, .htm-theme-toggle:focus,
  a.generate-back-to-top, a.generate-back-to-top:hover, a.generate-back-to-top:focus { right: 14px; width: 44px; height: 44px; }
  a.generate-back-to-top, .htm-theme-toggle { bottom: 14px; }
  body:has(.generate-back-to-top__show) .htm-theme-toggle { bottom: 68px; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1260px) {
  .htm-nav-list a { font-size: 13.5px; padding: 8px 8px; }
  .brand-icon { width: 52px; }
  .htm-header .brand-logo { max-height: 56px; max-width: 220px; }
}

@media (max-width: 1040px) {
  .header-inner { flex-wrap: wrap; }
  .brand-icon { width: 56px; }
  .brand-name { font-size: 20px; }
  .htm-header .brand-logo { max-height: 50px; max-width: 200px; }
  .htm-search { order: 2; margin-left: auto; }
  .htm-search.is-open { width: 100%; left: 0; right: 0; }
  .htm-header .htm-menu-toggle,
  .htm-header .htm-menu-toggle:hover,
  .htm-header .htm-menu-toggle:focus { display: flex; order: 3; }
  .main-nav { order: 4; width: 100%; display: none; margin-left: 0; }
  .htm-header.is-open .main-nav { display: block; }
  .htm-nav-list { flex-wrap: wrap; justify-content: flex-start; }
  .htm-nav-list .menu-item-has-children { width: 100%; }
  .htm-nav-list .menu-item-has-children > a { display: inline-block; }
  .htm-nav-list .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; margin: 4px 0 6px;
    box-shadow: none; padding: 6px;
  }
  .htm-nav-list .sub-menu::before { content: none; }
}

@media (max-width: 1100px) {
  .footer-inner { flex-wrap: wrap; justify-content: center; }
  .footer-links { margin-left: 0; }
  .footer-house { display: none; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .tips-box, .tips-box.no-link { grid-template-columns: 1fr auto; }
  .tips-art { display: none; }
}

@media (max-width: 860px) {
  .feat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .section-title, #htm-main .section-title, .htm-related .section-title { font-size: 24px; }
  .tips-box, .tips-box.no-link { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .tips-box .section-title { justify-content: center; }
  .footer-links { margin-left: 0; flex-shrink: 1; max-width: 100%; }
  .htm-footer-list { flex-wrap: wrap; justify-content: center; }
  .footer-inner { justify-content: center; text-align: center; flex-wrap: wrap; }
  .copyright { max-width: none; }
  .footer-right { flex-direction: column; gap: 10px; }

  /* Footer mobile: đồi cỏ giữ chiều cao gốc ở đáy, chữ nằm trong thẻ nền đặc phía trên
     để không đè lên hình và đọc rõ ở cả chế độ tối. */
  .htm-footer {
    margin-top: 28px; padding: 0 0 92px;
    background-size: auto 104px; background-repeat: repeat-x;
  }
  .footer-inner {
    flex-direction: column; gap: 8px; padding: 14px 16px;
    background: var(--card-bg); border: 1.5px solid var(--ring);
    border-radius: var(--radius-md); box-shadow: var(--shadow);
  }
  .htm-footer-list { gap: 2px 6px; }
  .htm-footer-list li + li::before { content: none; }
  .htm-footer-list a, .htm-footer-list a:hover {
    display: block; padding: 6px 10px; font-size: 14px; color: var(--blue-text);
    background: var(--featured-bg); border-radius: 999px;
  }
  .copyright { font-size: 12.5px; color: var(--muted); }
}

@media (max-width: 520px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .feat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
