/* GiaPhaToCo main styles */

/* Page Loading Screen */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f7f2e9 0%, #f1e7d7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loading.loaded {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: #7b3f00;
}

.loading-image {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  display: block;
  border-radius: 24px;
}

.loading-text {
  font-size: 16px;
  font-weight: 600;
  color: #7b3f00;
  letter-spacing: 0.5px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .loading-image {
    width: 100px;
    height: 100px;
  }

  .loading-text {
    font-size: 14px;
  }
}

@font-face {
  font-family: "FontChuThuong";
  src: url("../fonts/fontchuthuong.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "FontSite";
  src: url("../fonts/fontsite.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "FontTucNgu";
  src: url("../fonts/fonttucngu.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "FontThongTin";
  src: url("../fonts/Thu-Phap-DaiTu-TieuTu-FontZin/fontthongtin/Fz Wagon-ExtraLight.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "FzThuPhapDaiTu";
  src: url("../fonts/Thu-Phap-DaiTu-TieuTu-FontZin/FzThuphapDTFontzin/Fz Thư pháp Đại tự Fontzin.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "FzThuPhapTieuTu";
  src: url("../fonts/Thu-Phap-DaiTu-TieuTu-FontZin/FzThuPhapTTFontzin/Fz Thư pháp Tiểu tự Fontzin.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #2b1d16;
  --bg-alt: #3a2920;
  --primary: #8b1e1e;
  --gold: #c9a648;
  --text: #f2e3c6;
  --muted: #c7b59d;
  --card: rgba(255, 255, 255, 0.04);
  --max-width: 1200px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --font-body: "FontSite", "FontChuThuong", "Noto Serif Display", serif;
  --font-calligraphy: "FzThuPhapDaiTu", "FzThuPhapTieuTu", "Noto Serif Display", serif;
  --font-proverb: "FontTucNgu", "FontSite", "Noto Serif Display", serif;
  --font-info: "FontThongTin", "FontSite", "Noto Serif Display", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 27px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  color: #ffd86b;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ẩn hộp tìm kiếm để tránh đè lên câu đối */
.search-form,
form[role="search"],
.wp-block-search,
.widget_search {
  display: none !important;
}

/* Ẩn widget Recent Comments để không che câu đối */
.widget_recent_comments,
.recentcomments,
.wp-block-latest-comments,
[class*="recent-comments"],
[class*="recentcomments"],
/* Ẩn các block/widget bài viết/bình luận mặc định */
.widget_recent_entries,
.wp-block-latest-posts,
.wp-block-latest-posts__list,
.wp-block-latest-comments__comment,
.comment-list {
  display: none !important;
}

header.site-header,
footer.site-footer {
  background: linear-gradient(135deg, rgba(139, 30, 30, 0.9), rgba(201, 166, 72, 0.4));
  border-bottom: 2px solid var(--gold);
  border-top: 2px solid var(--gold);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Ẩn toàn bộ header nếu không cần hiển thị */
header.site-header {
  display: none;
}

header.site-header::before,
footer.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(201, 166, 72, 0.1), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.1), transparent 35%);
  pointer-events: none;
}

.header-inner,
.footer-inner,
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand .title {
  font-family: var(--font-calligraphy);
  letter-spacing: 1px;
  font-size: 45px;
  color: #ffe6a7;
}

.brand .subtitle {
  color: var(--muted);
  font-size: 14px;
}

nav.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 18px;
  padding: 0;
  margin: 12px 0 0;
}

nav.primary-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

nav.primary-nav a:hover,
nav.primary-nav .current-menu-item a {
  background: rgba(201, 166, 72, 0.15);
  border-color: rgba(201, 166, 72, 0.6);
}

.hero {
  position: relative;
  padding: 30px 5px 50px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 60%), url("../images/bg-pattern.jpg"),
    radial-gradient(circle, rgba(139, 30, 30, 0.3) 0%, rgba(0, 0, 0, 0) 45%);
  background-blend-mode: overlay;
  text-align: center;
  overflow: hidden;
}

.hero h1 {
  font-size: 69px;
  margin: 0 0 10px;
  font-family: var(--font-calligraphy);
  color: #ffe6a7;
}

.hero p {
  max-width: 700px;
  margin: 220px auto 24px;
  color: var(--muted);
}
.hero .des_text {
  font-family: var(--font-proverb);
}
.info p {
  max-width: 700px;
  margin: 10px auto 24px;
  color: var(--muted);
  font-family: var(--font-info);
  font-size: 16px;
}

.hero .cta {
  display: inline-block;
  padding: 12px 22px;
  background: var(--primary);
  color: #fff;
  border-radius: 30px;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
}

.featured-ancestors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 30px auto 10px;
  max-width: 960px;
}

.hero .ancestor-highlights {
  text-align: left;
}

.ancestor-article {
  max-width: 1000px;
  margin: 24px auto 0;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  line-height: 1.65;
}

.ancestor-article h3 {
  margin: 0 0 8px;
  color: #ffe6a7;
}

.ancestor-article p {
  margin: 0 0 16px;
  color: var(--muted);
  font-family: var(--font-info);
  font-size: 22px;
}

.family-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.family-photo {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.family-photo img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.family-photo figcaption {
  padding: 8px 10px;
  font-size: 14px;
  color: var(--muted);
}

.ancestor-highlight h4 {
  margin: 0 0 8px;
  color: #ffe6a7;
  font-size: 18px;
}

.ancestor-highlight p {
  margin: 0;
  color: var(--muted);
}

.ancestor-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.ancestor-card img {
  width: 100%;
  height: 340px;
  object-fit: cover;
}

.ancestor-card .info {
  padding: 14px;
}

.section {
  padding: 10px 5px;
}

.section h2 {
  margin: 0 0 14px;
  color: #ffe6a7;
}

.section .lead {
  color: var(--muted);
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.card {
  padding: 16px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.news-meta {
  color: var(--muted);
  font-size: 14px;
}

.sidebar-couplet {
  position: fixed;
  top: 80px;
  width: 80px;
  min-height: 40vh;
  background: linear-gradient(180deg, rgba(139, 30, 30, 0.9), rgba(0, 0, 0, 0.9));
  border: 2px solid var(--gold);
  color: #ffe6a7;
  padding: 18px 12px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  letter-spacing: 2px;
  font-family: var(--font-calligraphy);
  text-orientation: mixed; /* Latin giữ nguyên, không tách từng chữ */
  white-space: pre-wrap; /* cho phép xuống dòng theo khoảng trắng (từng từ) */
  word-break: keep-all; /* không bẻ giữa chữ */
  line-height: 1.5;
  box-shadow: var(--shadow);
  z-index: 999;
}

.sidebar-couplet.is-hidden {
  display: none !important;
}

.sidebar-couplet.left {
  left: 10px;
}

.sidebar-couplet.right {
  right: 10px;
}

.tree-wrapper {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tree-canvas {
  min-height: 400px;
}

.tree-node {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 166, 72, 0.4);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tree-node .avatar {
  /* Default PC size */
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  margin: 0 auto 8px;
}

/* Tablet: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .tree-node .avatar {
    width: 70px;
    height: 70px;
  }
}

/* Mobile: max-width 768px */
@media (max-width: 768px) {
  .tree-node .avatar {
    width: 62px;
    height: 62px;
  }
}

.tree-node .name {
  font-weight: 700;
  margin-bottom: 4px;
}

.tree-node .year {
  color: var(--muted);
  font-size: 13px;
}

.tree-branch {
  position: relative;
  padding-left: 26px;
  margin-left: 12px;
  border-left: 1px dashed rgba(201, 166, 72, 0.4);
}

.tree-branch::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -1px;
  width: 18px;
  border-top: 1px dashed rgba(201, 166, 72, 0.4);
}

.tree-branch-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.tree-branch .toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(201, 166, 72, 0.7);
  background: rgba(0, 0, 0, 0.35);
  color: #ffe6a7;
  cursor: pointer;
}

.tree-children {
  margin-left: 16px;
  padding-left: 12px;
  border-left: 1px dashed rgba(201, 166, 72, 0.25);
}

.tree-children.collapsed {
  display: none;
}

.popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.popup {
  background: #1e130d;
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 20px;
  max-width: 520px;
  width: 90%;
  color: #f2e3c6;
  box-shadow: var(--shadow);
  position: relative;
}

.popup h3 {
  margin-top: 0;
  color: #ffe6a7;
}

.popup .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.footer-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  color: var(--muted);
}

.footer-inner .copyright {
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
  font-family: var(--font-proverb);
}

.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.news-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.news-archive .archive-header,
.single-news-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(201, 166, 72, 0.15), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
}

.news-archive {
  background: rgba(0, 0, 0, 0.03);
}

.news-archive .archive-header h1 {
  margin: 0 0 6px;
}

.news-archive .lead {
  max-width: 720px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-btn:hover {
  background: rgba(201, 166, 72, 0.16);
  border-color: rgba(201, 166, 72, 0.6);
  color: #ffe6a7;
}

.back-btn.primary {
  background: var(--primary);
  border-color: var(--gold);
  color: #fff;
}

.back-btn.primary:hover {
  background: #b8860b;
  color: #fff;
}

.archive-actions,
.single-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-item {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.news-thumb img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

.news-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.news-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-info);
}

.news-meta-line::before {
  content: "";
  width: 10px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.news-item h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}

.news-item .excerpt {
  color: var(--muted);
  line-height: 1.6;
  font-size: 18px;
  font-family: var(--font-info);
}

.news-item .read-more {
  display: inline-block;
  margin-top: auto;
  font-weight: 600;
  color: var(--primary);
  font-family: var(--font-info);
}

.navigation.pagination {
  margin-top: 14px;
}

.navigation.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  margin: 0 4px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.navigation.pagination .page-numbers.current {
  border-color: rgba(201, 166, 72, 0.6);
  background: rgba(201, 166, 72, 0.2);
  color: #ffe6a7;
}

.navigation.pagination .page-numbers:hover {
  border-color: rgba(201, 166, 72, 0.6);
}

.single-content {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.single-content .news-meta,
.single-content .entry,
.single-content .entry p,
.single-content .entry li {
  font-family: var(--font-info);
}

@media (max-width: 1024px) {
  .sidebar-couplet {
    display: block;
    width: 80px;
    min-height: 35vh;
    top: 70px;
    padding: 14px 10px;
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 50px;
  }

  nav.primary-nav ul {
    flex-wrap: wrap;
  }

  .featured-ancestors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ancestor-card img {
    height: 180px;
  }

  .sidebar-couplet {
    width: 90px;
    min-height: 35vh;
    top: 60px;
    padding: 12px 10px;
    font-size: 28px;
  }

  .news-list {
    grid-template-columns: 1fr;
  }

  .news-thumb img {
    height: 160px;
  }

  .news-archive .archive-header,
  .single-news-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .archive-actions,
  .single-actions {
    width: 100%;
  }

  .archive-actions .back-btn,
  .single-actions .back-btn {
    width: 100%;
    justify-content: center;
  }
  .des_text {
    max-width: 230px !important;
    margin: 20px 89px 110px !important;
    color: var(--muted) !important;
    font-size: 26px !important;
  }
}
.des_text {
  max-width: 700px;
  margin: 30px auto 200px;
  color: var(--muted) !important;
  font-size: 28px;
}
