:root {
  --primary: #1f2937;
  --primary-rgb: 31, 41, 55;
  --secondary: #374151;
  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  --bg: #ffffff;
  --surface: #f9fafb;
  --surface-alt: #f1f3f5;
  --text: #111827;
  --muted: #6b7280;
  --border: #dfe3e8;
  --success: #059669;
  --danger: #ea580c;
  --radius: 4px;
  --radius-lg: calc(4px * 1.5);
  --font-weight-body: 400;
  --font-weight-bold: 700;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: var(--font-weight-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  margin: 0;
}
.skip-link { position:absolute; left:-9999px; }
.skip-link:focus { position:static; padding:.5rem 1rem; background:var(--primary); color:#fff; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-fluid { max-width: 1400px; margin: 0 auto; padding: 0 32px; width: 100%; }
img { max-width: 100%; height: auto; display:block; border-radius: var(--radius); }
a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--secondary); }

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 30;
  box-shadow: var(--shadow-sm);
}
.header-inner { display:flex; align-items:center; justify-content:space-between; gap:20px; position: relative; }
.brand { display:inline-flex; align-items:center; text-decoration:none; }
.brand-logo { height: 44px; width: auto; display: block; }

.main-nav ul { list-style:none; padding:0; margin:0; display:flex; gap: 28px; align-items:center; flex-wrap: nowrap; white-space: nowrap; }
.main-nav a { text-decoration:none; font-size:.95rem; color: var(--text); padding: 8px 0; position: relative; font-weight: 500; transition: color .15s; white-space: nowrap; }
.main-nav a:hover { color: var(--primary); }
.main-nav a[aria-current] { color: var(--primary); font-weight: var(--font-weight-bold); }
.main-nav a[aria-current]::after { content:""; position:absolute; left:0; right:0; bottom:-2px; height:2px; background: var(--accent); border-radius: 2px; }

/* Mobile hamburger — CSS-only, no JS */
.nav-toggle-checkbox { display: none; }
.nav-toggle-label { display: none; cursor: pointer; padding: 8px; z-index: 40; }
.nav-toggle-label span { display: block; width: 26px; height: 3px; background: var(--primary); margin: 5px 0; border-radius: 2px; transition: transform .2s, opacity .2s; }

@media (max-width: 991px) {
  .brand-logo { height: 38px; }
  .nav-toggle-label { display: inline-block; }
  .main-nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); box-shadow: var(--shadow-md); max-height: 0; overflow: hidden; transition: max-height .25s ease; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 20px 20px; white-space: normal; }
  .main-nav li { border-bottom: 1px solid var(--border); }
  .main-nav li:last-child { border-bottom: none; }
  .main-nav a { padding: 14px 0; display: block; white-space: normal; }
  .nav-toggle-checkbox:checked ~ .main-nav { max-height: 500px; }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(2) { opacity: 0; }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

.breadcrumb { padding: 20px 0 8px 0; font-size:.88rem; color: var(--muted); }
.breadcrumb ol { list-style:none; padding:0; margin:0; display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.breadcrumb li:not(:last-child)::after { content:"›"; color:var(--muted); margin-left:6px; font-weight: 700; }
.breadcrumb a { text-decoration:none; color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

article { padding: 20px 0 40px 0; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height:1.15; margin: 8px 0 14px 0; letter-spacing:-0.02em; font-weight: var(--font-weight-bold); color: var(--secondary); }
.byline { color: var(--muted); font-size:.92rem; margin: 0 0 28px 0; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.byline strong { color: var(--text); }
.hero { margin: 0 0 32px 0; }
.hero img { width:100%; aspect-ratio: 16/9; object-fit: cover; box-shadow: var(--shadow-md); }
.intro { margin: 0 0 32px 0; }
.intro p { font-size:1.08rem; color: var(--text); line-height: 1.7; }
.intro p:first-child { font-size: 1.14rem; font-weight: 500; }

.toc { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%); border: 1px solid var(--border); border-left: 4px solid var(--primary); padding: 20px 24px; margin: 32px 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.toc-heading { font-size: 1rem; font-weight: var(--font-weight-bold); margin: 0 0 14px 0; color: var(--secondary); text-transform: uppercase; letter-spacing: .05em; }
.toc-list { list-style: none; counter-reset: toc-counter; padding: 0; margin: 0; column-count: 2; column-gap: 32px; column-rule: 1px solid var(--border); }
.toc-list li { counter-increment: toc-counter; position: relative; padding: 8px 0 8px 40px; border-bottom: 1px dashed var(--border); break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid; }
.toc-list li:last-child { border-bottom: none; }
.toc-list li::before {
  content: counter(toc-counter, decimal-leading-zero);
  position: absolute; left: 0; top: 8px;
  font-weight: var(--font-weight-bold); color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, "SF Mono", ui-monospace, monospace;
  font-size: .9rem;
}
.toc-list a { text-decoration: none; color: var(--text); font-size: .98rem; line-height: 1.5; display: block; transition: color .15s; }
.toc-list a:hover { color: var(--primary); }
@media (max-width: 700px) {
  .toc-list { column-count: 1; column-rule: none; }
}

.content-section { margin: 40px 0; }
.content-section h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); line-height:1.25; margin: 32px 0 14px 0; font-weight: var(--font-weight-bold); letter-spacing:-0.01em; }
.content-section h3 { font-size: 1.15rem; line-height:1.3; margin: 24px 0 10px 0; font-weight: var(--font-weight-bold); }
.content-section p { margin: 12px 0; }
.content-section ul, .content-section ol { margin: 12px 0; padding-left: 22px; }
.content-section ul li, .content-section ol li { margin: 6px 0; }
.content-section figure { margin: 20px 0; }
.content-section figure img { width:100%; aspect-ratio: 16/9; object-fit: cover; }

.table-wrap { overflow-x: auto; margin: 20px 0; }
table { width:100%; border-collapse: collapse; font-size:.95rem; }
th, td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-alt); font-weight: var(--font-weight-bold); }

.callout { padding: 14px 18px; border-radius: var(--radius); margin: 18px 0; border-left: 4px solid var(--primary); background: var(--surface); }
.callout-info { border-left-color: var(--primary); background: var(--surface); }
.callout-warning { border-left-color: var(--danger); background: var(--surface-alt); }
.callout-important { border-left-color: var(--accent); background: var(--surface-alt); }
.callout-tip { border-left-color: var(--success); background: var(--surface); }

/* Steps — alternating zigzag timeline with number pinned to center */
.steps {
  list-style: none;
  padding: 0;
  margin: 48px 0 52px 0;
  position: relative;
}

/* Vertical dashed connector — drawn per-step so it starts at first number
   and ends at last number (no overflow above/below the sequence). */
.steps li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;             /* start at this step-num center */
  bottom: -66px;        /* extend past this li (-28px margin) + 38px into next li = next step-num center */
  width: 2px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, var(--border) 0 5px, transparent 5px 10px);
  z-index: 0;
  pointer-events: none;
}

.steps li {
  position: relative;
  margin: 0 0 28px 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  z-index: 1;
}
.steps li:last-child { margin-bottom: 0; }

/* Step number — absolutely centered on the vertical line */
.step-num {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-weight: var(--font-weight-bold);
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), .32), inset 0 -1px 2px rgba(0,0,0,.15);
  border: 4px solid var(--bg);
  z-index: 2;
  transition: transform .25s ease, box-shadow .25s ease;
}

/* Step body — the content card */
.step-body {
  display: block;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  line-height: 1.65;
  color: var(--text);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  position: relative;
  z-index: 1;
}
.step-body strong {
  display: inline;
  color: var(--secondary);
  font-weight: var(--font-weight-bold);
  font-size: 1.04rem;
  letter-spacing: -0.005em;
}

.steps li:hover .step-body {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(var(--primary-rgb), .35);
}
.steps li:hover .step-num {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 8px 22px rgba(var(--primary-rgb), .48), inset 0 -1px 2px rgba(0,0,0,.15);
}

/* DESKTOP alternating layout */
@media (min-width: 992px) {
  .steps li { padding: 0 46px; } /* leave center gap of 92px for the number (52px + margins) */

  /* Odd — box left, arrow pointing right toward number */
  .steps li:nth-child(odd) .step-body {
    width: calc(50% - 46px);
    margin-right: auto;
    margin-left: 0;
    text-align: left;
  }
  .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);
    transition: border-color .25s ease;
  }
  .steps li:nth-child(odd):hover .step-body::after {
    border-color: rgba(var(--primary-rgb), .35);
  }

  /* Even — box right, arrow pointing left toward number */
  .steps li:nth-child(even) .step-body {
    width: calc(50% - 46px);
    margin-left: auto;
    margin-right: 0;
    text-align: left;
  }
  .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);
    transition: border-color .25s ease;
  }
  .steps li:nth-child(even):hover .step-body::after {
    border-color: rgba(var(--primary-rgb), .35);
  }
}

/* MOBILE < 992px — stack vertically, connector on left, number left of body */
@media (max-width: 991px) {
  .steps li:not(:last-child)::before {
    left: 24px;
    top: 50%;
    bottom: -20px;
    transform: translateX(-50%);
  }
  .steps li {
    padding: 0 0 0 60px;
    min-height: 0;
    margin-bottom: 20px;
  }
  .step-num {
    left: 24px;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    font-size: 1rem;
    border-width: 3px;
  }
  .step-body {
    width: 100%;
    text-align: left;
    padding: 14px 18px;
  }
  .steps li:hover .step-num {
    transform: translate(-50%, -50%) scale(1.06);
  }
  .steps li .step-body::after,
  .steps li:nth-child(odd) .step-body::after,
  .steps li:nth-child(even) .step-body::after {
    content: none;
  }
}

/* FAQ with smooth toggle animation */
.faq-section details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  interpolate-size: allow-keywords;
}
.faq-section details:hover { box-shadow: var(--shadow-md); border-color: rgba(var(--primary-rgb), .35); }
.faq-section details[open] { border-color: rgba(var(--primary-rgb), .5); box-shadow: var(--shadow-md); }

.faq-section summary {
  padding: 18px 56px 18px 22px;
  cursor: pointer;
  font-weight: var(--font-weight-bold);
  font-size: 1.02rem;
  background: var(--surface);
  list-style: none;
  position: relative;
  transition: background-color .25s ease, color .2s ease;
  user-select: none;
  color: var(--text);
}
.faq-section summary:hover { background: var(--surface-alt); color: var(--primary); }
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::marker { display: none; content: ""; }

/* Animated plus/minus icon using two overlapping bars */
.faq-section summary::before,
.faq-section summary::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 50%;
  width: 14px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1), background-color .2s ease;
}
.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[open] summary {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
  color: var(--primary);
}
.faq-section details[open] summary::before,
.faq-section details[open] summary::after { background: var(--accent); }

/* Content area with smooth expand/collapse (modern browsers) */
.faq-section details::details-content {
  height: 0;
  overflow: clip;
  opacity: 0;
  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;
}

/* Fallback slide-in for browsers without ::details-content support */
.faq-section details > *:not(summary) {
  animation: faqSlideDown .32s cubic-bezier(.4, 0, .2, 1);
  transform-origin: top;
}
@keyframes faqSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.faq-section details p {
  padding: 18px 22px 20px 22px;
  margin: 0;
  color: var(--text);
  line-height: 1.72;
  border-top: 1px solid var(--border);
}

.author-box { display: flex; gap: 20px; padding: 24px; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%); border-radius: var(--radius-lg); border: 1px solid var(--border); margin: 48px 0 32px 0; align-items: flex-start; box-shadow: var(--shadow-sm); }
.author-box > img { flex: 0 0 auto; border-radius: 50%; width: 110px; height: 110px; object-fit: cover; border: 3px solid var(--bg); box-shadow: var(--shadow-md); }
.author-body { flex: 1 1 auto; min-width: 0; }
.author-box h3 { margin: 0 0 4px 0; font-size: 1.15rem; color: var(--secondary); }
.author-role { color: var(--primary); font-size:.9rem; margin: 0 0 10px 0; font-weight: 600; }
.author-body p { margin: 8px 0; font-size:.94rem; line-height: 1.65; }
.author-body p:last-child a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--primary); color: #fff; text-decoration: none; border-radius: var(--radius); font-size: .88rem; font-weight: 600; }
.author-body p:last-child a:hover { background: var(--secondary); }

.site-footer { background: var(--secondary); color: rgba(255, 255, 255, .82); border-top: 4px solid var(--primary); padding: 56px 0 24px 0; margin-top: 80px; font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 40px; align-items: flex-start; }
.footer-col h3.footer-heading { font-size: .85rem; font-weight: var(--font-weight-bold); color: #fff; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 16px 0; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 8px 0; }
.footer-col a { color: rgba(255,255,255,.75); text-decoration: none; font-size: .92rem; transition: color .15s; }
.footer-col a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.footer-brand-link { display: inline-block; text-decoration: none; margin-bottom: 16px; }
.footer-brand-link img { height: 52px; width: auto; display: block; }
.footer-tagline { margin: 0 0 16px 0; color: rgba(255,255,255,.65); line-height: 1.55; font-size: .9rem; max-width: 320px; }
.footer-org { margin: 12px 0 0 0; color: rgba(255,255,255,.55); font-size: .83rem; line-height: 1.7; }

.footer-bottom { margin-top: 40px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 12px; }
.footer-age { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.72); font-size: .88rem; }
.age-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 2px solid var(--accent); color: var(--accent); border-radius: 50%; font-weight: var(--font-weight-bold); font-size: .95rem; flex-shrink: 0; }
.copyright { margin: 0; color: rgba(255,255,255,.5); font-size: .83rem; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

strong { font-weight: var(--font-weight-bold); color: var(--text); }

@media (max-width: 700px) {
  .container, .container-fluid { padding: 0 16px; }
  .author-box { flex-direction: column; text-align: left; padding: 20px; }
  .author-box > img { width: 84px; height: 84px; }
  .toc-list li { padding-left: 36px; }
  h1 { font-size: 1.75rem; }
  .content-section h2 { font-size: 1.3rem; }
}

/* Print-friendly */
@media print {
  .site-header, .site-footer, .toc, .nav-toggle-label { display: none; }
}
