/*
Theme Name: Tiết Khí
Theme URI: https://tietkhi.com
Description: Giao diện lịch tiết khí — tông vàng cổ sang trọng, dễ nhìn. Card-based layout.
Version: 1.0.0
Author: TietKhi.com
Text Domain: tietkhi
*/

:root {
  --bg:         #faf5eb;
  --bg2:        #f3ead8;
  --bg-card:    rgba(255,255,255,0.85);
  --bg-dark:    #1c1710;
  --gold:       #b8860b;
  --gold-light: #d4a843;
  --gold-bright:#e8c97a;
  --gold-pale:  rgba(184,134,11,0.08);
  --gold-bg:    rgba(184,134,11,0.06);
  --brown:      #3d2b1f;
  --brown-light:#5c4033;
  --text:       #2c1e12;
  --text-dim:   #7a6a58;
  --text-faint: #b0a090;
  --border:     rgba(184,134,11,0.18);
  --border2:    rgba(184,134,11,0.30);
  --red:        #c0392b;
  --green:      #5a8a3c;
  --radius:     20px;
  --radius-sm:  12px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-body:  'Be Vietnam Pro', 'Inter', -apple-system, sans-serif;
  --font-zh:    'Noto Serif SC', serif;
  --font-mono:  'DM Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brown); }

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

.container { max-width: 1300px; margin: 0 auto; padding: 0 24px; }

/* ── CARD ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 4px 20px rgba(60,40,10,0.04);
}

/* ── NAVIGATION ── */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  margin: 20px auto;
  max-width: 1300px;
}

.logo { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.logo-ring {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-zh);
  font-size: 20px; color: var(--gold);
  background: var(--gold-pale);
}
.logo-text h1 { font-size: 18px; font-weight: 700; color: var(--brown); letter-spacing: 0.04em; }
.logo-text p { font-size: 11px; color: var(--text-faint); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 1px; }

.nav-links { display: flex; gap: 4px; list-style: none; align-items: center; }
.nav-links a {
  color: var(--text-dim); padding: 10px 16px;
  font-size: 14px; font-weight: 500; border-radius: var(--radius-sm);
  transition: all .2s;
}
.nav-links a:hover { color: var(--brown); background: var(--gold-pale); }
.nav-cta {
  border: 1.5px solid var(--border2) !important;
  color: var(--gold) !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--gold-pale) !important; }

/* ── HERO ── */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; margin-bottom: 24px; }
.hero-main { display: flex; justify-content: space-between; align-items: center; min-height: 380px; }
.hero-text { max-width: 540px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  background: var(--gold-pale);
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--gold);
  letter-spacing: 0.06em; margin-bottom: 24px;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.6)} }

.hero h2 {
  font-family: var(--font-serif);
  font-size: 52px; line-height: 1.12; font-weight: 700;
  color: var(--brown); margin-bottom: 18px;
}
.hero h2 em { font-style: italic; color: var(--gold); }

.hero-desc { font-size: 17px; color: var(--text-dim); line-height: 1.8; margin-bottom: 28px; }

.hero-buttons { display: flex; gap: 12px; }

.btn {
  padding: 13px 26px; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); display: inline-block;
  transition: all .2s; border: none; cursor: pointer; letter-spacing: 0.03em;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #fff; box-shadow: 0 2px 8px rgba(184,134,11,0.25);
}
.btn-gold:hover { background: linear-gradient(135deg, var(--gold-light), var(--gold-bright)); color: #fff; }
.btn-outline { background: transparent; color: var(--text-dim); border: 1.5px solid var(--border2); }
.btn-outline:hover { color: var(--gold); border-color: var(--gold); }

.hero-circle {
  width: 280px; height: 280px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg2), #ecdcc0);
  position: relative; overflow: hidden;
}
.hero-circle::before {
  content: ''; position: absolute; width: 100px; height: 100px;
  background: rgba(184,134,11,0.12); border-radius: 50%; left: 40px; top: 100px;
}
.hero-circle::after {
  content: ''; position: absolute; width: 60px; height: 60px;
  background: rgba(200,160,60,0.2); border-radius: 50%; right: 35px; top: 35px;
}

/* ── TERM CARD (sidebar hero) ── */
.term-card h3 { font-size: 14px; color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 18px; }
.term-name { font-family: var(--font-serif); font-size: 48px; font-weight: 700; color: var(--brown); margin-bottom: 4px; }
.term-zh { font-family: var(--font-zh); font-size: 20px; color: var(--text-faint); margin-bottom: 6px; }
.term-pinyin { font-family: var(--font-serif); font-style: italic; font-size: 16px; color: var(--text-faint); margin-bottom: 20px; }
.term-time { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.term-time::before { content: ''; width: 20px; height: 1.5px; background: var(--gold); }
.term-desc { font-size: 14px; color: var(--text-dim); line-height: 1.8; margin-bottom: 22px; }

.meta-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px;
}
.meta-cell { background: var(--bg-card); padding: 14px; transition: background .2s; }
.meta-cell:hover { background: var(--gold-pale); }
.meta-cell small { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 5px; }
.meta-cell strong { font-size: 15px; color: var(--brown); font-weight: 600; }

.next-line { font-size: 13px; color: var(--text-faint); padding-top: 14px; border-top: 1px solid var(--border); }
.next-line b { color: var(--gold); }

/* ── MAIN 3-COLUMN LAYOUT (4:3:3) ── */
.grid-main { display: grid; grid-template-columns: 4fr 3fr 3fr; gap: 24px; margin-bottom: 24px; }

/* ── GRID 3 COLUMNS (equal) ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 24px; }

/* ── SIDEBAR POST LIST ── */
.sidebar-posts h3 { font-family: var(--font-serif); font-size: 20px; color: var(--brown); margin-bottom: 16px; }
.sidebar-post-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sidebar-post-item:last-child { border-bottom: none; }
.sidebar-post-num { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--gold); opacity: 0.5; min-width: 24px; line-height: 1.2; }
.sidebar-post-item h4 { font-size: 14px; font-weight: 500; line-height: 1.4; margin-bottom: 2px; }
.sidebar-post-item h4 a { color: var(--brown); }
.sidebar-post-item h4 a:hover { color: var(--gold); }
.sidebar-post-item .post-date { font-size: 11px; color: var(--text-faint); }

/* ── CALENDAR ── */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.cal-header h3 { font-family: var(--font-serif); font-size: 26px; font-weight: 700; color: var(--brown); }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.cal-dn { text-align: center; font-size: 11px; letter-spacing: 0.08em; color: var(--text-faint); padding-bottom: 8px; font-weight: 600; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-dim); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; transition: all .15s;
  font-weight: 500; position: relative;
}
.cal-day:hover:not(.empty) { background: var(--gold-pale); color: var(--brown); }
.cal-day.today { background: var(--gold); color: #fff !important; font-weight: 700; box-shadow: 0 2px 8px rgba(184,134,11,0.3); }
.cal-day.has-term { color: var(--gold); font-weight: 700; }
.cal-day.has-term::after {
  content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--gold);
}
.cal-day.today.has-term::after { background: #fff; }
.cal-legend { margin-top: 16px; font-size: 12px; color: var(--text-faint); display: flex; gap: 16px; }
.cal-legend .dot { color: var(--gold); }

/* ── WHY SECTION ── */
.why-list { display: flex; flex-direction: column; gap: 18px; }
.why-row { display: flex; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.why-row:last-child { border-bottom: none; }
.why-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.why-row h4 { font-size: 15px; font-weight: 600; color: var(--brown); margin-bottom: 4px; }
.why-row p { font-size: 13px; color: var(--text-dim); line-height: 1.7; }

/* ── TERMS LIST ── */
.terms-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.term-chip {
  border: 1px solid var(--border); padding: 12px;
  border-radius: var(--radius-sm); background: var(--bg-card);
  cursor: pointer; transition: all .15s;
}
.term-chip:hover { border-color: var(--gold); background: var(--gold-pale); }
.term-chip.active { border-color: var(--gold); background: var(--gold-pale); }
.term-chip-name { font-size: 13px; font-weight: 600; color: var(--brown); }
.term-chip-date { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); margin-top: 2px; }

/* ── SECTION DIVIDER ── */
.section-divider {
  display: flex; align-items: center; gap: 16px;
  padding: 36px 0 24px; color: var(--text-faint);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-divider .diamond { color: var(--gold); font-size: 8px; }

/* ── API SECTION ── */
.api-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; margin-bottom: 24px; }
.api-info h3 { font-family: var(--font-serif); font-size: 30px; font-weight: 700; color: var(--brown); margin-bottom: 10px; }
.api-info p { font-size: 15px; color: var(--text-dim); line-height: 1.8; margin-bottom: 20px; }
.api-features { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.api-features li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); }
.api-features li::before { content: '\u25C6'; font-size: 7px; color: var(--gold); }

.code-panel { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.code-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--gold-pale); border-bottom: 1px solid var(--border);
}
.code-dots { display: flex; gap: 6px; }
.code-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border2); }
.code-endpoint { font-family: var(--font-mono); font-size: 11px; color: var(--gold); }
.code-block {
  padding: 24px; font-family: var(--font-mono); font-size: 13px;
  line-height: 1.9; background: var(--bg-dark); color: #d4c8b0; overflow-x: auto;
}
.c-method { color: #e8c97a; } .c-url { color: #a8d8a8; }
.c-key { color: #c4b5fd; } .c-str { color: #fca5a5; } .c-brace { color: rgba(184,134,11,0.5); }

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; margin-top: 40px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-faint);
}
.footer-center { display: flex; gap: 8px; color: var(--gold); opacity: .5; font-size: 16px; }

/* ── SINGLE POST LAYOUT (sidebar + main) ── */
.single-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  margin-top: 32px;
  align-items: start;
}
.single-sidebar {
  position: sticky;
  top: 24px;
}
.single-main {
  max-width: 780px;
  min-width: 0;
}
@media (max-width: 900px) {
  .single-layout { grid-template-columns: 1fr; }
  .single-sidebar { position: static; }
}

/* ── SINGLE POST / PAGE ── */
.content-area { max-width: 780px; margin: 40px auto; }
.content-area h1 { font-family: var(--font-serif); font-size: 36px; color: var(--brown); margin-bottom: 8px; }
.post-meta { font-size: 13px; color: var(--text-faint); margin-bottom: 28px; }
.entry-content { font-size: 16px; line-height: 1.85; color: var(--text); }
.entry-content h2 { font-family: var(--font-serif); font-size: 26px; color: var(--brown); margin: 32px 0 12px; }
.entry-content h3 { font-size: 20px; color: var(--brown); margin: 24px 0 10px; }
.entry-content p { margin-bottom: 16px; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin-bottom: 16px; }
.entry-content li { margin-bottom: 6px; }
.entry-content blockquote { border-left: 3px solid var(--gold); padding: 12px 20px; margin: 20px 0; background: var(--gold-pale); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim); font-style: italic; }
.entry-content code { background: var(--bg2); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 14px; }
.entry-content pre { background: var(--bg-dark); color: #d4c8b0; padding: 20px; border-radius: var(--radius-sm); overflow-x: auto; margin: 16px 0; font-size: 13px; line-height: 1.7; }
.entry-content pre code { background: none; padding: 0; }
.entry-content img { border-radius: var(--radius-sm); margin: 16px 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.entry-content th { background: var(--bg2); font-weight: 600; text-align: left; }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--border); font-size: 14px; }

/* ── ARCHIVE / BLOG ── */
.archive-header { margin-bottom: 32px; }
.archive-header h1 { font-family: var(--font-serif); font-size: 34px; color: var(--brown); }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.post-card { transition: transform .2s, box-shadow .2s; }
.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(60,40,10,0.08); }
.post-card h2 { font-family: var(--font-serif); font-size: 20px; color: var(--brown); margin-bottom: 8px; line-height: 1.3; }
.post-card h2 a { color: var(--brown); }
.post-card h2 a:hover { color: var(--gold); }
.post-card .excerpt { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 12px; }
.post-card .post-date { font-size: 12px; color: var(--text-faint); }
.post-thumb { width: 100%; height: 180px; object-fit: cover; border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin: -28px -28px 18px; width: calc(100% + 56px); }

/* ── AUTHOR BOX ── */
.author-box {
  display: flex;
  gap: 20px;
  padding: 28px;
  margin-top: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.author-avatar {
  flex-shrink: 0;
}
.author-avatar img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border2);
}
.author-info {
  flex: 1;
  min-width: 0;
}
.author-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 2px;
}
.author-title {
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 12px;
}
.author-bio p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 8px;
}
.author-bio p:last-child {
  margin-bottom: 0;
}
.author-bio strong {
  color: var(--brown);
}
.author-bio a {
  color: var(--gold);
  font-weight: 600;
}
.author-bio-extended {
  padding: 0 28px 24px;
  margin-top: -8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.author-bio-extended p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 8px;
}
.author-bio-extended p:last-child { margin-bottom: 0; }
.author-bio-extended strong { color: var(--brown); }
.author-bio-extended a { color: var(--gold); font-weight: 600; }

@media (max-width: 600px) {
  .author-box { flex-direction: column; align-items: center; text-align: center; }
}

/* ── PAGINATION ── */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--border); color: var(--text-dim); }
.pagination .current { background: var(--gold); color: #fff; border-color: var(--gold); }
.pagination a:hover { background: var(--gold-pale); }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .api-row { grid-template-columns: 1fr; }
  .hero-circle { display: none; }
}
@media (max-width: 700px) {
  .site-nav { flex-direction: column; gap: 14px; padding: 14px 16px; }
  .hero h2 { font-size: 36px; }
  .terms-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer { flex-direction: column; gap: 8px; text-align: center; }
  .posts-grid { grid-template-columns: 1fr; }
}
