:root {
  --primary: #1f4d2c;
  --primary-rgb: 31, 77, 44;
  --secondary: #0f2c17;
  --secondary-rgb: 15, 44, 23;
  --accent: #e0a833;
  --accent-rgb: 224, 168, 51;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --text: #0f1a12;
  --muted: #5b6a5f;
  --border: #d8e0d2;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 2px 6px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter','Helvetica Neue','Segoe UI',Arial,sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-fluid { max-width: 1400px; margin: 0 auto; padding: 0 32px; }

/* ============ HEADER ============ */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; gap: 24px;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 44px; width: auto; display: block; }
.main-nav ul {
  display: flex; gap: 6px; list-style: none; margin: 0; padding: 0;
  align-items: center;
}
.main-nav a {
  display: block; padding: 10px 14px; color: var(--text);
  font-size: 15px; font-weight: 500; border-radius: var(--radius);
  transition: background .18s, color .18s;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  background: rgba(var(--primary-rgb), .08); color: var(--primary); text-decoration: none;
}
.nav-toggle-checkbox { display: none; }
.nav-toggle-label { display: none; cursor: pointer; padding: 8px; }
.nav-toggle-label span {
  display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0;
  transition: transform .25s;
}
@media (max-width: 991px) {
  .nav-toggle-label { display: block; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height .3s ease-out;
  }
  .nav-toggle-checkbox:checked ~ .main-nav { max-height: 500px; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 12px 20px; }
  .main-nav a { width: 100%; padding: 12px 16px; }
}

/* ============ HERO ============ */
.hero {
  padding: 56px 0 40px;
}
.hero-inner { text-align: center; }
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  margin: 0 0 20px;
  color: var(--secondary);
  letter-spacing: -0.02em;
}
.hero .lead {
  font-size: 19px; color: var(--muted);
  max-width: 720px; margin: 0 auto 32px;
}
.hero-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: 32px 0;
}
.hero-image img { width: 100%; height: auto; display: block; }

/* ============ BYLINE ============ */
.byline {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 24px 0 32px; font-size: 14px; color: var(--muted);
}
.byline-avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
}
.byline-avatar img { width: 100%; height: 100%; object-fit: cover; }
.byline-meta { display: flex; flex-direction: column; }
.byline-name { color: var(--text); font-weight: 600; }
.byline-date { font-size: 13px; }

/* ============ BREADCRUMBS ============ */
.breadcrumbs {
  font-size: 14px; color: var(--muted); padding: 20px 0 0;
}
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; opacity: .5; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }

/* ============ TOC ============ */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin: 40px 0;
  box-shadow: var(--shadow-sm);
}
.toc-heading {
  font-size: 18px; margin: 0 0 20px; color: var(--secondary);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.toc-list {
  list-style: none; counter-reset: toc-counter;
  column-count: 2; column-gap: 40px; column-rule: 1px solid var(--border);
  margin: 0; padding: 0;
}
.toc-list li {
  counter-increment: toc-counter; break-inside: avoid;
  -webkit-column-break-inside: avoid; page-break-inside: avoid;
  padding: 8px 0 8px 40px; position: relative;
}
.toc-list li::before {
  content: counter(toc-counter, decimal-leading-zero);
  position: absolute; left: 0; top: 8px;
  color: var(--accent); font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 14px; font-weight: 600;
}
.toc-list a { color: var(--text); font-size: 15px; }
.toc-list a:hover { color: var(--primary); }
@media (max-width: 700px) {
  .toc-list { column-count: 1; column-rule: none; }
}

/* ============ ARTICLE BODY ============ */
.article-body { margin: 40px 0 60px; }
.article-body h2 {
  font-size: 28px; line-height: 1.25; margin: 52px 0 20px;
  color: var(--secondary); letter-spacing: -0.01em;
  padding-top: 12px; scroll-margin-top: 90px;
}
.article-body h3 {
  font-size: 21px; margin: 32px 0 14px; color: var(--secondary);
}
.article-body p { margin: 0 0 18px; }
.article-body ul, .article-body ol { margin: 0 0 20px; padding-left: 24px; }
.article-body li { margin: 8px 0; }
.article-body strong { color: var(--secondary); }
.article-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

.article-body figure { margin: 32px 0; }
.article-body figure img {
  width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.article-body figcaption {
  font-size: 14px; color: var(--muted); margin-top: 10px; text-align: center;
}

.article-body blockquote {
  margin: 28px 0; padding: 20px 28px; border-left: 4px solid var(--accent);
  background: rgba(var(--accent-rgb), .06); border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic; color: var(--secondary);
}

.article-body table {
  width: 100%; border-collapse: collapse; margin: 28px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.article-body th, .article-body td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.article-body th {
  background: rgba(var(--primary-rgb), .06); color: var(--secondary); font-weight: 700;
}
.article-body tr:last-child td { border-bottom: 0; }

/* ============ STEPS ============ */
.steps { list-style: none; padding: 0; margin: 48px 0 52px; position: relative; }
.steps li { position: relative; margin: 0 0 28px; min-height: 76px; display: flex; align-items: center; }
.steps li:not(:last-child)::before {
  content: ""; position: absolute; left: 50%; top: 76px; bottom: -28px;
  width: 2px; transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, var(--border) 0 5px, transparent 5px 10px);
}
.step-num {
  position: absolute; left: 50%; top: 38px; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; border: 4px solid var(--bg);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), .32);
  z-index: 2; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; font-family: ui-monospace, monospace;
}
.step-body {
  padding: 18px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); text-align: left;
}
.step-body strong { display: block; margin-bottom: 6px; color: var(--secondary); }
@media (min-width: 992px) {
  .steps li { padding: 0 46px; }
  .steps li:nth-child(odd) .step-body { width: calc(50% - 46px); margin-right: auto; position: relative; }
  .steps li:nth-child(odd) .step-body::after {
    content: ""; position: absolute; right: -8px; top: 50%;
    width: 14px; height: 14px; background: var(--surface);
    border-right: 1px solid var(--border); border-top: 1px solid var(--border);
    transform: translateY(-50%) rotate(45deg);
  }
  .steps li:nth-child(even) .step-body { width: calc(50% - 46px); margin-left: auto; position: relative; }
  .steps li:nth-child(even) .step-body::after {
    content: ""; position: absolute; left: -8px; top: 50%;
    width: 14px; height: 14px; background: var(--surface);
    border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
    transform: translateY(-50%) rotate(45deg);
  }
}
@media (max-width: 991px) {
  .steps li { padding-left: 76px; }
  .steps li:not(:last-child)::before { left: 26px; }
  .step-num { left: 26px; }
  .step-body { width: 100%; }
}

/* ============ FAQ ============ */
.faq-section { margin: 48px 0; }
.faq-section h2 { margin-bottom: 24px; }
.faq-section details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 12px;
  interpolate-size: allow-keywords;
  transition: box-shadow .2s, border-color .2s;
}
.faq-section details[open] {
  box-shadow: var(--shadow-sm); border-color: rgba(var(--primary-rgb), .3);
}
.faq-section summary {
  padding: 18px 56px 18px 22px; position: relative;
  list-style: none; cursor: pointer;
  font-weight: 600; color: var(--secondary); font-size: 17px;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::before,
.faq-section summary::after {
  content: ""; position: absolute; right: 24px; top: 50%;
  width: 14px; height: 2px; background: var(--primary);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.faq-section summary::before { transform: translateY(-50%) rotate(0deg); }
.faq-section summary::after { transform: translateY(-50%) rotate(90deg); }
.faq-section details[open] summary::after { transform: translateY(-50%) rotate(0deg); }

.faq-section details::details-content {
  height: 0; opacity: 0; overflow: clip;
  transition: height .35s cubic-bezier(.4,0,.2,1),
              opacity .3s ease-out,
              content-visibility .35s allow-discrete;
}
.faq-section details[open]::details-content { height: auto; opacity: 1; }

.faq-section details > *:not(summary) {
  padding: 0 22px 20px; animation: faqSlideDown .32s cubic-bezier(.4,0,.2,1);
}
@keyframes faqSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ AUTHOR BOX ============ */
.author-box {
  display: flex; gap: 24px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  margin: 56px 0; box-shadow: var(--shadow-sm);
}
.author-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-name { margin: 0 0 4px; font-size: 20px; color: var(--secondary); }
.author-role { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.author-bio { margin: 0; font-size: 15px; }
@media (max-width: 560px) {
  .author-box { flex-direction: column; text-align: center; }
  .author-avatar { margin: 0 auto; }
}

/* ============ FOOTER ============ */
.site-footer {
  background: var(--secondary); color: rgba(255,255,255,.82);
  padding: 56px 0 24px; margin-top: 80px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 40px; margin-bottom: 40px;
}
.footer-col h3 {
  font-size: 15px; text-transform: uppercase; letter-spacing: .08em;
  color: #fff; margin: 0 0 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 8px 0; }
.footer-col a {
  color: rgba(255,255,255,.7); font-size: 15px;
  transition: color .18s;
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-brand .brand-logo { height: 40px; margin-bottom: 16px; }
.footer-brand p { font-size: 14px; margin: 8px 0; }
.footer-entity { font-size: 13px; opacity: .7; line-height: 1.5; margin-top: 12px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1); padding-top: 24px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px;
}
.footer-age { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.age-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: var(--accent); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: 13px;
}
.copyright { font-size: 13px; margin: 0; opacity: .7; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ============ UTIL ============ */
.callout {
  padding: 20px 24px; background: rgba(var(--accent-rgb), .08);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 28px 0;
}
.callout strong { color: var(--secondary); }
