/*
Theme Name: Từ Đường – Gia Phả
Description: Giao diện truyền thống cho website gia phả dòng họ: sắc đỏ son – vàng – giấy dó, câu đối, hoa văn hồi văn. Dùng kèm plugin "Gia Phả Dòng Họ".
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Author: T
License: GPL-2.0-or-later
Text Domain: giapha-theme
Tags: custom-menu, custom-logo, featured-images, translation-ready
*/

:root {
	--t-accent: #7a1414;
	--t-accent-dark: #4f0c0c;
	--t-gold: #c49a3c;
	--t-gold-soft: #e7cf94;
	--t-paper: #faf4e6;
	--t-card: #fffdf7;
	--t-ink: #2a1f16;
	--t-muted: #7b6a57;
	--t-line: #e2d3b3;
	--t-serif: "Noto Serif", Georgia, "Times New Roman", serif;
	--t-display: "Playfair Display", "Noto Serif", Georgia, serif;
	--t-max: 1200px;
	--t-narrow: 780px;
	--gp-paper: var(--t-paper);
	--gp-line: var(--t-line);
	--gp-ink: var(--t-ink);
	--gp-muted: var(--t-muted);
	--t-meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='12'%3E%3Cpath d='M0 10.5H20M4 10.5V1.5H16V7.5H8.5V4.5H12' fill='none' stroke='%23c49a3c' stroke-width='1.4'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--t-paper); color: var(--t-ink); font-family: var(--t-serif); font-size: 17px; line-height: 1.7; }
img { max-width: 100%; height: auto; }
a { color: var(--t-accent); text-underline-offset: 3px; }
a:hover { color: var(--t-accent-dark); }
h1, h2, h3, h4 { font-family: var(--t-display); line-height: 1.25; color: var(--t-accent); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.gpt-skip { position: absolute; left: -9999px; top: 0; background: #fff; padding: 8px 12px; z-index: 1000; }
.gpt-skip:focus { left: 10px; }
.gpt-container { max-width: var(--t-max); margin: 0 auto; padding: 0 20px; }
.gpt-narrow { max-width: var(--t-narrow); }
.gpt-muted { color: var(--t-muted); }
.gpt-section { padding: 48px 0; }
.gpt-section .gpt-container.gpt-section, .gpt-container.gpt-section { padding-top: 36px; padding-bottom: 56px; }
.gpt-section-paper { background: linear-gradient(#f3e9d2, #f7efdd); border-top: 1px solid var(--t-line); border-bottom: 1px solid var(--t-line); }
.gpt-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.gpt-section-head .gpt-h2 { margin: 0; }
.gpt-h2 { font-size: 1.9rem; margin: 0 0 16px; position: relative; padding-bottom: 10px; }
.gpt-h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 3px; background: var(--t-gold); border-radius: 2px; }
.gpt-h3 { font-size: 1.35rem; margin: 0 0 12px; }
.gpt-link-more { font-weight: 600; text-decoration: none; }
.gpt-link-more:hover { text-decoration: underline; }

.gpt-btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 24px; border-radius: 999px; background: var(--t-accent); color: #fff !important; text-decoration: none; font-weight: 600; border: 1px solid var(--t-accent); transition: transform .15s, filter .15s; }
.gpt-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.gpt-btn-gold { background: linear-gradient(180deg, #e3c374, var(--t-gold)); border-color: #a8812d; color: #3a1a05 !important; }
.gpt-btn-line { background: transparent; border-color: var(--t-gold-soft); color: #fff !important; }

/* ---------- Thanh trên & đầu trang ---------- */
.gpt-topbar { background: var(--t-accent-dark); color: var(--t-gold-soft); font-size: 13.5px; }
.gpt-topbar-in { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; flex-wrap: wrap; }
.gpt-topbar a { color: #fff; text-decoration: none; }
.gpt-topbar a:hover { text-decoration: underline; }
.gpt-topbar strong { color: #fff; font-weight: 600; }

.gpt-header { background: var(--t-accent); color: #fff; position: relative; z-index: 50; }
.gpt-header-in { display: flex; align-items: center; gap: 20px; min-height: 84px; }
.gpt-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #fff; margin-right: auto; }
.gpt-brand:hover { color: #fff; }
.gpt-logo { width: 56px; height: 56px; object-fit: contain; }
.gpt-seal { width: 52px; height: 52px; border: 2px solid var(--t-gold); outline: 1px solid var(--t-gold); outline-offset: 3px; display: flex; align-items: center; justify-content: center; font-family: var(--t-display); font-size: 28px; font-weight: 800; color: var(--t-gold-soft); background: var(--t-accent-dark); border-radius: 6px; }
.gpt-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.gpt-brand-kicker { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--t-gold-soft); }
.gpt-brand-name { font-family: var(--t-display); font-size: 26px; font-weight: 700; }
.gpt-meander { height: 12px; background: var(--t-accent-dark) var(--t-meander) repeat-x center; border-top: 1px solid rgba(196, 154, 60, .5); }
.gpt-meander-light { background-color: transparent; border: 0; opacity: .9; }

.gpt-menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.gpt-menu li { position: relative; }
.gpt-menu a { display: block; padding: 10px 14px; color: #fff; text-decoration: none; font-weight: 600; font-size: 15.5px; border-radius: 6px; }
.gpt-menu a:hover, .gpt-menu .current-menu-item > a, .gpt-menu .current_page_item > a { background: rgba(0, 0, 0, .22); color: var(--t-gold-soft); }
.gpt-menu .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 200px; background: var(--t-accent-dark); list-style: none; margin: 0; padding: 6px; border-radius: 0 0 8px 8px; box-shadow: 0 10px 20px rgba(0, 0, 0, .2); }
.gpt-menu li:hover > .sub-menu, .gpt-menu li:focus-within > .sub-menu { display: block; }
.gpt-nav-toggle { display: none; background: none; border: 1px solid rgba(255, 255, 255, .4); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: #fff; }
.gpt-nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; margin: 4px 0; }
.gpt-nav-toggle em { position: absolute; left: -9999px; }

@media (max-width: 900px) {
	.gpt-nav-toggle { display: block; }
	.gpt-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--t-accent); border-top: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 12px 24px rgba(0, 0, 0, .25); }
	.gpt-nav.open { display: block; }
	.gpt-menu { flex-direction: column; padding: 8px 12px 14px; }
	.gpt-menu .sub-menu { display: block; position: static; box-shadow: none; background: transparent; padding-left: 14px; }
	.gpt-brand-name { font-size: 21px; }
	.gpt-header-in { min-height: 70px; }
}

/* ---------- Hero trang chủ ---------- */
.gpt-hero { position: relative; display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: 24px; padding: 56px max(20px, calc((100% - var(--t-max)) / 2 + 20px)); min-height: 440px; color: #fff; background: radial-gradient(ellipse at center, #8e1c1c 0%, #5c0e0e 70%, #3f0909 100%); overflow: hidden; }
.gpt-hero.has-img { background: linear-gradient(rgba(70, 8, 8, .78), rgba(40, 5, 5, .86)), var(--hero) center / cover no-repeat; }
.gpt-hero::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(196, 154, 60, .55); outline: 1px solid rgba(196, 154, 60, .3); outline-offset: 5px; pointer-events: none; }
.gpt-hero-in { text-align: center; position: relative; }
.gpt-hero-kicker { letter-spacing: .45em; text-transform: uppercase; color: var(--t-gold-soft); font-size: 14px; margin-bottom: 6px; }
.gpt-hero-title { font-size: clamp(2.4rem, 6vw, 4.4rem); margin: 0; color: #fff; text-shadow: 0 2px 20px rgba(0, 0, 0, .35); letter-spacing: .01em; }
.gpt-ornament { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--t-gold); margin: 14px 0; font-size: 14px; }
.gpt-ornament span { width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--t-gold), transparent); }
.gpt-hero-sub { font-style: italic; font-size: 1.2rem; margin: 0 0 6px; color: #f6ead0; }
.gpt-hero-origin { color: var(--t-gold-soft); margin: 0; }
.gpt-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.gpt-couplet { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: linear-gradient(180deg, #a3231f, #7d1414); border: 2px solid var(--t-gold); outline: 1px solid rgba(196, 154, 60, .5); outline-offset: 4px; border-radius: 4px; padding: 18px 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); position: relative; z-index: 1; }
.gpt-couplet span { font-family: var(--t-display); font-weight: 700; color: #f4d58a; font-size: 19px; line-height: 1.3; text-align: center; text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
@media (max-width: 760px) {
	.gpt-hero { grid-template-columns: 1fr; padding: 40px 20px 34px; min-height: 0; }
	.gpt-couplet { flex-direction: row; flex-wrap: wrap; gap: 0 6px; padding: 8px 12px; order: 2; }
	.gpt-couplet-left { order: 2; }
	.gpt-couplet-right { order: 3; }
	.gpt-hero-in { order: 1; }
	.gpt-couplet span { font-size: 15px; }
}

/* ---------- Trang chủ ---------- */
.gpt-stats-wrap { padding: 0; margin-top: -34px; position: relative; z-index: 2; }
.gpt-stats-wrap .gp-stats { margin: 0; }
.gpt-stats-wrap .gp-stat { background: #fff; box-shadow: 0 8px 24px rgba(80, 40, 10, .1); border-top: 3px solid var(--t-gold); }
.gpt-stats-wrap .gp-stat-num { font-family: var(--t-display); }
.gpt-home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 900px) { .gpt-home-grid { grid-template-columns: 1fr; } }
.gpt-card { background: var(--t-card); border: 1px solid var(--t-line); border-radius: 12px; padding: 22px 24px; box-shadow: 0 4px 16px rgba(80, 40, 10, .06); }
.gpt-anniv { list-style: none; margin: 0 0 12px; padding: 0; }
.gpt-anniv li { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--t-line); }
.gpt-anniv li:last-child { border-bottom: 0; }
.gpt-anniv-date { flex: 0 0 58px; text-align: center; background: var(--t-accent); color: var(--t-gold-soft); border-radius: 8px; padding: 4px 0; font-size: 12px; line-height: 1.2; }
.gpt-anniv-date b { display: block; font-size: 22px; color: #fff; font-family: var(--t-display); }
.gpt-anniv-body { display: flex; flex-direction: column; line-height: 1.35; }
.gpt-anniv-body a { font-weight: 700; text-decoration: none; color: var(--t-ink); }
.gpt-anniv-body a:hover { color: var(--t-accent); }
.gpt-anniv-body small { color: var(--t-muted); font-size: 13.5px; }

.gpt-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.gpt-post-card { background: var(--t-card); border: 1px solid var(--t-line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.gpt-post-card:hover { box-shadow: 0 10px 28px rgba(80, 40, 10, .12); transform: translateY(-2px); }
.gpt-post-thumb { display: block; text-decoration: none; aspect-ratio: 16/10; background: #efe2c4; overflow: hidden; }
.gpt-post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gpt-post-noimg { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-family: var(--t-display); font-size: 64px; color: rgba(122, 20, 20, .25); }
.gpt-post-body { padding: 16px 20px 20px; }
.gpt-post-meta { font-size: 13.5px; color: var(--t-muted); }
.gpt-post-meta a { color: inherit; }
.gpt-post-title { font-size: 1.25rem; margin: 6px 0 8px; }
.gpt-post-title a { color: var(--t-ink); text-decoration: none; }
.gpt-post-title a:hover { color: var(--t-accent); }
.gpt-post-excerpt { margin: 0; font-size: 15.5px; color: #4d3f31; }

/* ---------- Trang trong ---------- */
.gpt-page-head { background: linear-gradient(180deg, #f1e4c6, var(--t-paper)); border-bottom: 1px solid var(--t-line); padding: 34px 0 26px; }
.gpt-page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
.gpt-crumbs { font-size: 14px; color: var(--t-muted); margin-bottom: 6px; }
.gpt-crumbs a { color: var(--t-muted); }
.gpt-member-alias { color: var(--t-muted); font-style: italic; margin-top: 4px; }
.gpt-prose > :first-child { margin-top: 0; }
.gpt-prose h2 { font-size: 1.6rem; margin-top: 1.8em; }
.gpt-prose h3 { font-size: 1.3rem; margin-top: 1.5em; }
.gpt-prose blockquote { margin: 1.5em 0; padding: 12px 22px; border-left: 4px solid var(--t-gold); background: var(--t-card); font-style: italic; }
.gpt-prose table { border-collapse: collapse; width: 100%; }
.gpt-prose table:not(.gp-info):not(.gp-table) td, .gpt-prose table:not(.gp-info):not(.gp-table) th { border: 1px solid var(--t-line); padding: 6px 10px; }
.gpt-featured { margin: 0 0 24px; }
.gpt-featured img { border-radius: 12px; }
.gpt-bio { margin-top: 36px; background: var(--t-card); border: 1px solid var(--t-line); border-radius: 12px; padding: 24px 28px; }
.post-navigation { margin-top: 40px; border-top: 1px solid var(--t-line); padding-top: 16px; }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 16px; }
.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 6px 12px; border: 1px solid var(--t-line); border-radius: 6px; text-decoration: none; background: #fff; }
.pagination .page-numbers.current { background: var(--t-accent); color: #fff; border-color: var(--t-accent); }
.gpt-404 { text-align: center; }
.gpt-404-num { font-family: var(--t-display); font-size: 110px; font-weight: 800; color: rgba(122, 20, 20, .15); line-height: 1; }
.search-form { display: flex; gap: 8px; justify-content: center; margin: 20px 0; }
.search-form input[type=search] { padding: 10px 14px; border: 1px solid var(--t-line); border-radius: 999px; min-width: 240px; }
.search-form input[type=submit] { padding: 10px 18px; border: 0; background: var(--t-accent); color: #fff; border-radius: 999px; cursor: pointer; }

/* Gia phả trong theme */
.gp-profile-head .gp-info th { width: 30%; }
.gpt-member .gp-profile { background: var(--t-card); border: 1px solid var(--t-line); border-radius: 14px; padding: 24px; }

/* Bình luận */
.gpt-comments { margin-top: 48px; }
.gpt-comment-list { list-style: none; padding: 0; }
.gpt-comment-list .comment-body { background: var(--t-card); border: 1px solid var(--t-line); border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; }
.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea { width: 100%; padding: 10px; border: 1px solid var(--t-line); border-radius: 8px; }
.comment-form .submit { padding: 10px 22px; border: 0; background: var(--t-accent); color: #fff; border-radius: 999px; cursor: pointer; }

/* ---------- Chân trang ---------- */
.gpt-footer { background: #2b0707; color: #e9d9b6; margin-top: 0; font-size: 15.5px; }
.gpt-footer .gpt-meander { background-color: #2b0707; }
.gpt-footer a { color: var(--t-gold-soft); }
.gpt-footer-in { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding-top: 40px; padding-bottom: 32px; }
@media (max-width: 800px) { .gpt-footer-in { grid-template-columns: 1fr; } }
.gpt-footer-name { font-family: var(--t-display); font-size: 1.6rem; color: #fff; }
.gpt-footer-origin { color: var(--t-gold); margin-top: 4px; }
.gpt-footer-text p { margin: .6em 0; }
.gpt-footer-nav ul { list-style: none; margin: 0; padding: 0; }
.gpt-footer-nav li { margin: 4px 0; }
.gpt-footer .widget-title, .gpt-footer h2, .gpt-footer h3 { color: #fff; font-size: 1.1rem; margin: 0 0 10px; }
.gpt-footer ul { padding-left: 18px; }
.gpt-footer-widgets .widget { margin-bottom: 20px; }
.gpt-footer-bottom { border-top: 1px solid rgba(196, 154, 60, .25); padding: 14px 0; font-size: 13.5px; color: #bda678; text-align: center; }

/* Bố cục rộng cho trang cây gia phả */
.gpt-wide .gpt-page-head { padding: 22px 0 16px; }

/* WordPress mặc định */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { font-size: 14px; color: var(--t-muted); text-align: center; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
.sticky .gpt-post-title::before { content: "★ "; color: var(--t-gold); }
.bypostauthor { display: block; }
