/*
Theme Name: Thichthucung WikiAnswerly
Theme URI: https://thichthucung.com/
Author: Thichthucung
Description: Editorial knowledge-base theme. Built as an independent, SEO-friendly theme.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: thichthucung-wikianswerly
*/

:root {
  --ink: #0f1f19;
  --muted: #5d6b64;
  --line: #e3ebe6;
  --paper: #ffffff;
  --wash: #f2f8f4;
  --accent: #0a7d54;
  --accent-dark: #064e3b;
  --accent-soft: #d9efe3;
  --gold: #f59e0b;
  --gold-dark: #d97706;
  --max: 1180px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(6, 78, 59, .10);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.65; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-family: var(--sans); font-variant-ligatures: none; }
img { max-width: 100%; height: auto; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; }
.skip-link:focus { top: 12px; }
.eyebrow { color: var(--accent); font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; padding: 11px 18px; font: inherit; font-size: 14px; font-weight: 750; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; white-space: nowrap; }
.button:hover { color: #fff; transform: translateY(-1px); }
.button-cta { background: linear-gradient(135deg, #ffb52e, #f59e0b); color: #3b2300; box-shadow: 0 8px 20px rgba(245, 158, 11, .35); }
.button-cta:hover { color: #3b2300; background: linear-gradient(135deg, #ffc247, #f59e0b); box-shadow: 0 12px 26px rgba(245, 158, 11, .45); }
.button-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.button-ghost:hover { background: rgba(255,255,255,.22); }
.button-lg { padding: 15px 26px; font-size: 16px; border-radius: 12px; }

/* Header */
.site-header { border-bottom: 1px solid transparent; background: rgba(255,255,255,.97); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); transition: box-shadow .2s ease, border-color .2s ease; }
.site-header.is-scrolled { border-color: var(--line); box-shadow: 0 6px 24px rgba(6, 78, 59, .08); }
.header-inner { min-height: 76px; display: flex; align-items: center; gap: 22px; }
.site-brand { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; letter-spacing: -.03em; font-size: 20px; white-space: nowrap; }
.site-brand .custom-logo-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.site-brand .custom-logo { display: block; width: auto; max-width: 260px; max-height: 50px; object-fit: contain; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 17px; }
.primary-nav { margin-left: auto; }
.primary-nav > ul, .primary-nav > .menu-main-menu-container > ul { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.primary-nav li { position: relative; list-style: none; }
.primary-nav a { display: block; white-space: nowrap; padding: 9px 12px; border-radius: 9px; color: var(--ink); font-size: 15px; font-weight: 650; }
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current-menu-ancestor > a { color: var(--accent-dark); background: var(--wash); }
.primary-nav ul ul { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; margin: 0; padding: 8px; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.primary-nav li:hover > ul, .primary-nav li:focus-within > ul { display: block; }
.primary-nav ul ul a { padding: 9px 11px; font-size: 14px; font-weight: 600; }
.menu-toggle { display: none; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.header-search { display: flex; flex: 0 1 200px; width: 200px; min-width: 150px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--wash); }
.header-search input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 9px 12px; background: transparent; font: inherit; font-size: 14px; }
.header-search button { border: 0; padding: 0 13px; color: var(--accent-dark); background: transparent; cursor: pointer; font-size: 16px; }
.header-cta { padding: 11px 18px; }
.primary-nav .nav-cta { display: none; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 84px 0 80px; color: #fff; background: radial-gradient(circle at 85% 10%, rgba(245,158,11,.30) 0, transparent 34%), radial-gradient(circle at 0% 100%, rgba(20,196,122,.25) 0, transparent 40%), linear-gradient(135deg, #04372a 0%, #0a6b49 100%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 56px; align-items: center; }
.hero .eyebrow { color: #ffd37a; }
.hero h1 { max-width: 720px; margin: 14px 0 18px; font-size: clamp(38px, 5.2vw, 66px); letter-spacing: -.045em; line-height: 1.05; font-weight: 800; }
.hero p { max-width: 600px; margin: 0; color: #d3efe2; font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero .header-search { width: 100%; max-width: 520px; margin-top: 28px; background: rgba(255,255,255,.96); border: 0; border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.18); }
.hero .header-search input { padding: 14px 16px; font-size: 15px; color: var(--ink); }
.hero .header-search button { color: #fff; background: var(--accent); padding: 0 20px; }
.hero-panel { display: grid; gap: 12px; }
.hero-tile { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius); background: rgba(255,255,255,.10); backdrop-filter: blur(6px); color: #fff; transition: transform .18s ease, background .18s ease; }
.hero-tile:hover { color: #fff; transform: translateX(4px); background: rgba(255,255,255,.18); }
.hero-tile-num { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #ffb52e, #f59e0b); color: #3b2300; font-weight: 800; }
.hero-tile-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hero-tile-body strong { font-size: 17px; line-height: 1.3; }
.hero-tile-body small { margin-top: 3px; color: #c3e6d6; font-size: 13px; line-height: 1.45; }
.hero-tile-arrow { color: #ffd37a; font-size: 20px; }

/* Sections */
.section { padding: 64px 0; }
.section-wash { background: var(--wash); border-block: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.section h2, .related h2 { margin: 6px 0 0; font-size: 34px; line-height: 1.15; letter-spacing: -.035em; font-weight: 800; }
.section-head p { margin: 0; max-width: 380px; color: var(--muted); }
.group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.group-card { display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); background: #fff; transition: transform .18s ease, box-shadow .18s ease; }
.group-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.group-card:nth-child(2) { border-top-color: var(--gold); }
.group-card:nth-child(3) { border-top-color: #0e9aa7; }
.group-card h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.25; letter-spacing: -.02em; }
.group-card h3 a { color: var(--ink); }
.group-card p { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; }
.group-more { margin-top: auto; padding-top: 14px; font-weight: 750; font-size: 14px; color: var(--accent); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 4px 0 0; padding: 0; }
.chip-list a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--wash); color: var(--accent-dark); font-size: 13px; font-weight: 650; }
.chip-list a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Posts */
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 52px; align-items: start; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 24px; }
.post-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.post-card { display: flex; flex-direction: column; min-width: 0; padding: 12px 12px 18px; border: 1px solid transparent; border-radius: var(--radius); background: #fff; transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--line); }
.post-card-image { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--accent-soft); margin-bottom: 14px; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-card:hover .post-card-image img { transform: scale(1.04); }
.post-card h3 { margin: 8px 0; font-size: 20px; line-height: 1.3; font-weight: 750; letter-spacing: -.015em; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.post-meta, .entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 13px; }
.post-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 750; }
.post-badge:hover { background: var(--accent); color: #fff; }
.sidebar-cta { display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; padding: 22px; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, #04372a, #0a7d54); }
.sidebar-cta strong { font-size: 18px; line-height: 1.3; }
.sidebar-box { border-top: 3px solid var(--accent); padding-top: 15px; margin-bottom: 34px; }
.sidebar-box h2 { font-size: 20px; line-height: 1.2; margin: 0 0 10px; font-weight: 750; }
.sidebar-box ul { list-style: none; padding: 0; margin: 0; }
.sidebar-box li { border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 14.5px; line-height: 1.45; }
.sidebar-box a { color: var(--ink); }
.sidebar-box a:hover { color: var(--accent); }

/* Archive */
.archive-header { padding: 54px 0 40px; background: linear-gradient(135deg, #f2f8f4, #e4f3ea); border-bottom: 1px solid var(--line); }
.archive-header h1 { max-width: 820px; margin: 8px 0; font-size: clamp(34px, 4.6vw, 54px); line-height: 1.08; letter-spacing: -.045em; font-weight: 800; }
.archive-header p { margin: 0 0 6px; max-width: 700px; color: var(--muted); font-size: 17px; }
.archive-header .chip-list { margin-top: 16px; }
.breadcrumbs { margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { color: var(--accent); font-weight: 650; }
.no-results { grid-column: 1 / -1; padding: 36px; border: 1px dashed #b9d4c4; border-radius: var(--radius); background: var(--wash); }
.no-results h2 { margin: 0 0 8px; font-size: 26px; }
.no-results p { color: var(--muted); }
.no-results > .header-search { display: flex; width: min(620px, 100%); margin: 20px 0; border-radius: 10px; background: #fff; }
.no-results > .header-search input { padding: 13px 15px; }
.no-results > .header-search button { color: #fff; background: var(--accent); }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.pagination .page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; font-weight: 650; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Single post */
.read-progress { position: fixed; left: 0; top: 0; z-index: 60; height: 4px; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.entry-wrap { padding: 44px 0 64px; }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 56px; align-items: start; }
.entry-header h1 { margin: 14px 0 14px; font-size: clamp(32px, 4.2vw, 48px); line-height: 1.12; letter-spacing: -.04em; font-weight: 800; }
.entry-summary { margin: 0; color: var(--muted); font-size: 19px; line-height: 1.6; }
.entry-featured { margin: 28px 0; border-radius: var(--radius); overflow: hidden; }
.entry-featured img { display: block; width: 100%; }
.entry-content { font-size: 18px; line-height: 1.85; color: #1b2b24; overflow-wrap: break-word; }
.entry-content > * { max-width: 100%; }
.entry-content p { margin: 0 0 1.3em; }
.entry-content h2, .entry-content h3, .entry-content h4 { line-height: 1.25; margin: 2em 0 .6em; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.entry-content h2 { font-size: 30px; padding-top: .4em; border-top: 1px solid var(--line); }
.entry-content h3 { font-size: 23px; }
.entry-content h4 { font-size: 19px; }
.entry-content a { color: var(--accent); text-decoration: underline; text-decoration-color: #a9d8bd; text-underline-offset: 3px; }
.entry-content a:hover { text-decoration-color: var(--accent); }
.entry-content ul, .entry-content ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.entry-content li { margin: .4em 0; }
.entry-content img { border-radius: 10px; }
.entry-content figure { margin: 1.6em 0; }
.entry-content figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; text-align: center; }
.entry-content blockquote { margin: 1.6em 0; padding: 16px 22px; border-left: 4px solid var(--gold); border-radius: 0 10px 10px 0; background: #fffaf0; color: #4a3a1a; }
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.6em 0; font-size: 15.5px; }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
.entry-content th { background: var(--wash); font-weight: 750; }
.entry-content code { padding: 2px 6px; border-radius: 6px; background: var(--wash); font-size: .9em; }
.entry-content pre { overflow-x: auto; padding: 16px; border-radius: 10px; background: #0f1f19; color: #e6f4ec; font-size: 14.5px; line-height: 1.6; }
.entry-content pre code { padding: 0; background: transparent; color: inherit; }
.entry-toc { position: sticky; top: 100px; padding: 18px 20px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); background: #fff; max-height: calc(100vh - 130px); overflow-y: auto; }
.entry-toc summary { font-size: 17px; font-weight: 750; cursor: pointer; list-style: none; }
.entry-toc summary::-webkit-details-marker { display: none; }
.entry-toc ol { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.entry-toc li { margin: 7px 0; }
.entry-toc a { color: var(--muted); }
.entry-toc a:hover { color: var(--accent); }
.entry-toc .toc-level-3 { margin-left: 12px; font-size: 13px; }
.entry-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 44px; padding: 26px 28px; border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, #04372a, #0a7d54); }
.entry-cta strong { display: block; font-size: 20px; line-height: 1.3; }
.entry-cta span { display: block; margin-top: 4px; color: #c3e6d6; font-size: 14.5px; }
.related { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 24px; font-size: 28px; }

/* CTA band + footer */
.cta-band { margin-top: 20px; padding: 52px 0; color: #fff; background: radial-gradient(circle at 90% 0%, rgba(245,158,11,.30) 0, transparent 40%), linear-gradient(135deg, #04372a, #0a7d54); }
.cta-band-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.cta-band h2 { margin: 0 0 8px; font-size: clamp(26px, 3.2vw, 38px); line-height: 1.15; letter-spacing: -.03em; font-weight: 800; }
.cta-band p { margin: 0; max-width: 640px; color: #c3e6d6; }
.site-footer { margin-top: auto; padding: 46px 0 25px; background: #0b1a14; color: #d9e6dc; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; padding-bottom: 30px; }
.site-footer h2 { color: #fff; font-size: 19px; font-weight: 750; margin: 0 0 12px; }
.site-footer p, .site-footer li { color: #9fb5a8; font-size: 14.5px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 8px 0; }
.site-footer a { color: #d9e6dc; }
.site-footer a:hover { color: var(--gold); }
.footer-bottom { padding-top: 19px; border-top: 1px solid rgba(255,255,255,.12); color: #7f968a; font-size: 13px; }
.to-top { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 46px; height: 46px; border: 0; border-radius: 50%; color: #fff; background: var(--accent); font-size: 20px; cursor: pointer; box-shadow: 0 8px 22px rgba(6,78,59,.35); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }

@media (max-width: 1200px) {
  .header-search { display: none; }
}
@media (max-width: 1000px) {
  .post-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .hero-grid, .entry-layout { grid-template-columns: 1fr; gap: 32px; }
  .entry-toc { position: static; max-height: none; }
  .menu-toggle { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; }
  .primary-nav { display: none; position: absolute; left: 14px; right: 14px; top: calc(100% + 1px); padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
  .primary-nav.is-open { display: block; }
  .primary-nav > ul, .primary-nav > .menu-main-menu-container > ul { display: block; }
  .primary-nav > ul > li > a, .primary-nav > .menu-main-menu-container > ul > li > a { padding: 13px 10px; border-radius: 8px; font-size: 16px; }
  .primary-nav ul ul { position: static; display: block; min-width: 0; padding: 0 0 6px 14px; border: 0; box-shadow: none; }
  .header-search { display: none; }
  .content-layout { grid-template-columns: 1fr; }
  .cta-band-inner, .entry-cta { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
  .container { width: min(var(--max), calc(100% - 28px)); }
  .header-inner { min-height: 64px; gap: 10px; }
  .site-brand .custom-logo { max-width: 170px; max-height: 36px; }
  .header-cta { display: none; }
  .primary-nav .nav-cta { display: flex; margin-top: 8px; width: 100%; padding: 13px 18px; color: #3b2300; background: linear-gradient(135deg, #ffb52e, #f59e0b); }
  .hero { padding: 48px 0 52px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 16px; }
  .hero-actions .button { flex: 1; }
  .section { padding: 44px 0; }
  .section h2, .related h2 { font-size: 27px; }
  .section-head { display: block; }
  .section-head p { margin-top: 8px; }
  .post-grid, .post-grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .entry-content { font-size: 17px; line-height: 1.8; }
  .entry-content h2 { font-size: 25px; }
  .entry-summary { font-size: 17px; }
  .entry-cta { padding: 22px; }
}

/*
 * Cross-browser consistency.
 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Safari needs the prefixed property for the blur effects. */
.site-header { -webkit-backdrop-filter: blur(12px); }
.hero-tile { -webkit-backdrop-filter: blur(6px); }

/* Form controls: stop Safari/iOS from restyling the search field and buttons. */
.header-search input,
.header-search button,
.menu-toggle,
.button {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    border-radius: 0;
}
.header-search input[type="search"]::-webkit-search-decoration,
.header-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.button { border-radius: 10px; }
.button-lg { border-radius: 12px; }
.menu-toggle { border-radius: 9px; }

/* The hero and empty-results search must stay visible and full size at every
 * width; the compact header rules above only apply to the header search. */
.hero .header-search,
.no-results > .header-search {
    display: flex;
    flex: none;
    width: 100%;
    margin-left: 0;
}
.hero .header-search { max-width: 520px; background: rgba(255, 255, 255, .96); }
.no-results > .header-search { max-width: 620px; background: #fff; border: 1px solid var(--line); }
.hero .header-search input,
.no-results > .header-search input { display: block; }
.hero .header-search button,
.no-results > .header-search button { width: auto; height: auto; padding: 0 20px; color: #fff; background: var(--accent); }

/* Compact Unsplash attribution below card images. */
.post-card > .acr-photo-credit {
    display: block;
    min-width: 0;
    max-width: 100%;
    margin: -8px 0 12px;
    font-size: 11px;
    line-height: 1.5;
    font-weight: 400;
    color: #52616b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.post-card > .acr-photo-credit a {
    display: inline;
    font: inherit;
    color: inherit;
    text-decoration: underline;
}
