/* =========================================================
   Family Tree Guide — stylesheet
   ========================================================= */
:root {
  --bg: #fbf8f2;
  --surface: #ffffff;
  --soft: #f3eee3;
  --border: #e6dfcf;
  --text: #2a2a24;
  --muted: #6b6a5e;
  --primary: #2f6b4f;
  --primary-dark: #22513b;
  --primary-soft: #e4efe8;
  --accent: #b9773a;
  --radius: 16px;
  --shadow: 0 14px 34px -18px rgba(42, 42, 36, 0.28);
  --header-h: 70px;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: var(--primary); }
ul, ol { padding-left: 1.3rem; }

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(780px, 100% - 40px); margin-inline: auto; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; color: var(--text); font-weight: 700; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }

.skip-link { position: absolute; left: 12px; top: -50px; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 3px solid rgba(47, 107, 79, 0.45); outline-offset: 2px; }

.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px;
  font-weight: 600; font-size: 0.97rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ============ Header ============ */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(251, 248, 242, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.logo svg { width: 34px; height: 34px; }

.nav-menu { display: flex; align-items: center; gap: 24px; }
.nav-menu a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-menu a:hover, .nav-menu a.active { color: var(--primary); }
.nav-menu a.active { font-weight: 600; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; flex-direction: column; gap: 5px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Home hero ============ */
.hero { padding: 80px 0 70px; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
.hero h1 { margin-bottom: 18px; }
.hero h1 em { font-style: italic; color: var(--primary); }
.hero p { color: var(--muted); font-size: 1.12rem; max-width: 540px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-image { border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.hero-image img { width: 100%; height: auto; }

/* ============ Page hero ============ */
.page-hero { padding: 60px 0 46px; background: var(--soft); border-bottom: 1px solid var(--border); }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-bottom: 12px; }
.page-hero p { color: var(--muted); font-size: 1.08rem; max-width: 680px; }
.breadcrumb { font-size: 0.87rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ============ Sections ============ */
.section { padding: 80px 0; }
.section-alt { background: var(--soft); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.section-head h2 { margin-bottom: 10px; }
.section-head p { color: var(--muted); }

/* ============ Cards ============ */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.cards.two { grid-template-columns: repeat(2, 1fr); }

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  text-decoration: none; color: inherit;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #cfdccf; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.96rem; }
.card .more { margin-top: auto; padding-top: 16px; font-weight: 600; color: var(--primary); font-size: 0.93rem; }

.card-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 16px; }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Steps ============ */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; counter-reset: step; list-style: none; padding: 0; }
.steps li { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 22px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700;
  margin-bottom: 14px;
}
.steps h3 { font-size: 1.08rem; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: 0.94rem; }

/* ============ Split + checklist ============ */
.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 50px; align-items: center; }
.split h2 { margin-bottom: 12px; }
.muted { color: var(--muted); margin-bottom: 24px; }

.checklist { list-style: none; padding: 0; display: grid; gap: 12px; }
.checklist li {
  position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px 14px 56px;
}
.checklist li::before {
  content: "\2713";
  position: absolute; left: 16px; top: 15px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 700; font-size: 0.85rem;
}
.checklist strong { display: block; font-weight: 600; }
.checklist span { color: var(--muted); font-size: 0.93rem; }

/* ============ Interview questions ============ */
.question-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; counter-reset: q; max-width: 920px; margin: 0 auto; }
.question-grid li {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px;
}
.question-grid li::before {
  counter-increment: q; content: counter(q);
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem;
}

/* ============ FAQ ============ */
.faq { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.faq details[open] { border-color: #c4d6c9; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 52px 16px 20px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 1.3rem; transition: transform 0.2s; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq p { padding: 0 20px 18px; color: var(--muted); }

/* ============ Quote / callout ============ */
.callout { background: var(--primary); color: #e9f2ec; border-radius: 22px; padding: 46px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.callout h2 { color: #fff; margin-bottom: 6px; }
.callout .btn { background: #fff; color: var(--primary); flex-shrink: 0; }

/* ============ Article (guide pages) ============ */
.article { padding: 60px 0 80px; }
.article h2 { margin: 44px 0 12px; font-size: 1.6rem; }
.article h2:first-child { margin-top: 0; }
.article h3 { margin: 26px 0 8px; }
.article p { margin-bottom: 16px; color: #3d3c34; }
.article ul, .article ol { margin: 0 0 18px; color: #3d3c34; }
.article li { margin-bottom: 8px; }
.article li::marker { color: var(--primary); }

.tip { background: var(--primary-soft); border-left: 4px solid var(--primary); border-radius: 10px; padding: 18px 20px; margin: 24px 0; }
.tip strong { color: var(--primary-dark); }
.tip p:last-child { margin-bottom: 0; }

.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 36px; }
.toc strong { display: block; font-family: var(--serif); margin-bottom: 6px; }
.toc ol { margin: 0; }
.toc li { margin-bottom: 4px; }

.next-guide { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 48px; padding-top: 26px; }
.next-guide a { text-decoration: none; font-weight: 600; }
.next-guide small { display: block; color: var(--muted); font-weight: 400; font-size: 0.82rem; }

/* ============ Glossary ============ */
.glossary dt { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; margin-top: 24px; }
.glossary dd { color: #3d3c34; margin-top: 4px; }
.letter-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.letter-nav a { padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-weight: 600; font-size: 0.9rem; }

/* ============ Live chat ============ */
.nav-menu a.nav-chat {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 600;
}
.nav-menu a.nav-chat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8ee0a8; box-shadow: 0 0 0 3px rgba(142, 224, 168, 0.3); }
.nav-menu a.nav-chat:hover { background: var(--primary-dark); color: #fff; }

.chat-panel {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; margin: 8px 0 24px;
}
.chat-panel > div:nth-child(2) { flex: 1; min-width: 180px; }
.chat-panel strong { display: block; font-family: var(--serif); font-size: 1.08rem; }
.chat-panel span { color: var(--muted); font-size: 0.92rem; }
.chat-panel-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.chat-panel-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Contact ============ */
.contact-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 46px; align-items: start; }
.contact-box { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
  font: inherit; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.15); }
.field textarea { min-height: 130px; resize: vertical; }
.form-note { font-size: 0.85rem; color: var(--muted); margin-top: 12px; }

/* ============ Footer ============ */
.footer { background: #23251f; color: #c9c7b8; padding: 60px 0 26px; margin-top: 0; }
.footer a { color: #c9c7b8; text-decoration: none; }
.footer a:hover { color: #fff; }
.footer .logo { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 34px; margin-bottom: 40px; }
.footer-grid p { font-size: 0.92rem; margin-top: 12px; max-width: 320px; }
.footer h4 { color: #fff; font-family: var(--sans); font-size: 0.95rem; margin-bottom: 12px; }
.footer ul { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 0.92rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 22px; font-size: 0.84rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-bottom p { max-width: 720px; }

/* ============ 404 ============ */
.not-found { text-align: center; padding: 110px 0; }
.not-found .code { font-family: var(--serif); font-size: clamp(4.5rem, 14vw, 8rem); color: var(--primary); line-height: 1; }
.not-found p { color: var(--muted); margin: 12px auto 26px; max-width: 440px; }

/* ============ Responsive ============ */
@media (max-width: 980px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    height: calc(100dvh - var(--header-h));
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); padding: 12px 20px;
    transform: translateX(100%); transition: transform 0.3s ease;
    overflow-y: auto;
  }
  .nav-menu.open { transform: none; }
  .nav-menu a { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
  .nav-menu a.nav-chat { justify-content: center; margin-top: 16px; padding: 14px; border-bottom: 0; }

  .hero-inner, .contact-grid, .split { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .callout { flex-direction: column; text-align: center; padding: 36px 26px; }
}

@media (max-width: 640px) {
  .container, .narrow { width: calc(100% - 32px); }
  .hero { padding: 50px 0; }
  .section { padding: 60px 0; }
  .cards, .cards.two, .steps, .question-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .contact-box { padding: 22px; }
}

/* ============ Print ============ */
@media print {
  .header, .footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* =========================================================
   Blog
   ========================================================= */
.tag {
  align-self: flex-start;
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.03em; text-decoration: none;
}
a.tag:hover { background: var(--primary); color: #fff; }
.post-meta { font-size: 0.84rem; color: var(--muted); }

/* Post cards */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.post-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform 0.25s, box-shadow 0.25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--soft); }
.post-card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card h3 { font-size: 1.15rem; }
.post-card p { color: var(--muted); font-size: 0.94rem; flex: 1; }
.post-card[hidden] { display: none; }

/* Featured post */
.featured {
  display: grid; grid-template-columns: 1.1fr 0.9fr; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  text-decoration: none; color: inherit; transition: box-shadow 0.25s;
}
.featured:hover { box-shadow: var(--shadow); }
.featured img { width: 100%; height: 100%; object-fit: cover; min-height: 280px; }
.featured-body { padding: 36px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.featured-body h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.featured-body p { color: var(--muted); }
.featured-body .more { font-weight: 600; color: var(--primary); }

/* Category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat-tile {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 18px 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); font-weight: 600; transition: border-color 0.2s, color 0.2s;
}
.cat-tile:hover { border-color: var(--primary); color: var(--primary); }
.cat-tile small { color: var(--muted); font-weight: 500; }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 36px; }
.filter-bar button {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.filter-bar button:hover { color: var(--primary); border-color: var(--primary); }
.filter-bar button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Single post */
.post-header { padding: 54px 0 34px; text-align: center; }
.post-header h1 { font-size: clamp(1.9rem, 4.2vw, 2.8rem); max-width: 820px; margin: 14px auto 12px; }
.post-header .post-meta { font-size: 0.92rem; }
.post-cover { max-width: 1000px; margin: 0 auto; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); }
.post-cover img { width: 100%; height: auto; aspect-ratio: 16 / 7; object-fit: cover; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 50px; padding: 50px 0 70px; align-items: start; }
.post-layout .article { padding: 0; }
.post-layout .article .lead-para { font-size: 1.15rem; color: var(--text); }

.sidebar { display: grid; gap: 22px; position: sticky; top: calc(var(--header-h) + 20px); }
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.side-box h3 { font-size: 1.05rem; margin-bottom: 12px; }
.side-box p { color: var(--muted); font-size: 0.92rem; }
.side-box ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.side-box li a { text-decoration: none; color: var(--text); font-size: 0.93rem; font-weight: 500; line-height: 1.45; display: block; }
.side-box li a:hover { color: var(--primary); }
.side-box .cat-list a { display: flex; justify-content: space-between; }
.side-box .cat-list small { color: var(--muted); }
.side-chat { background: var(--primary); border: 0; color: #e9f2ec; }
.side-chat h3 { color: #fff; }
.side-chat p { color: #d3e6da; margin-bottom: 14px; }
.side-chat .btn { background: #fff; color: var(--primary); width: 100%; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--border); margin-top: 44px; padding-top: 24px; }
.post-nav a { text-decoration: none; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-weight: 600; color: var(--text); }
.post-nav a:hover { border-color: var(--primary); color: var(--primary); }
.post-nav small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8rem; margin-bottom: 4px; }
.post-nav .next { text-align: right; grid-column: 2; }

@media (max-width: 980px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured img { min-height: 0; aspect-ratio: 16 / 9; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .post-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 640px) {
  .post-grid, .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: auto; }
  .featured-body { padding: 24px; }
  .cat-grid { grid-template-columns: 1fr; }
}
