/* --- Jack Temple styles --- */
:root {
  --primary: #3E5641;
  --primary-rgb: 62, 86, 65;
  --secondary: #2A3B2C;
  --accent: #E8A93B;
  --accent-rgb: 232, 169, 59;
  --surface: #FFFFFF;
  --bg: #FAF9F5;
  --text: #1F2721;
  --muted: #5A6058;
  --border: rgba(62,86,65,.10);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(20,24,40,.05), 0 2px 8px rgba(20,24,40,.04);
  --shadow-md: 0 4px 16px rgba(20,24,40,.07), 0 8px 32px rgba(20,24,40,.05);
  --shadow-hover: 0 8px 24px rgba(var(--primary-rgb), .18), 0 0 0 1px rgba(var(--primary-rgb), .08);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Menlo", monospace;
  --sans: "Inter", "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif Pro", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.68;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link a11y */
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--primary); color: #fff;
  padding: 10px 16px; border-radius: var(--radius);
  z-index: 999; text-decoration: none;
}
.skip-link:focus { left: 8px; }

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

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  gap: 24px;
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { height: 42px; width: auto; display: block; }

.nav-toggle-checkbox { display: none; }
.nav-toggle-label { display: none; }

.main-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; align-items: center;
}
.main-nav a {
  display: inline-flex; align-items: center;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  border-radius: var(--radius);
  transition: color .18s ease, background .18s ease;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--primary); background: rgba(var(--primary-rgb), .06); }
.main-nav a[aria-current="page"] {
  color: var(--primary);
  background: rgba(var(--primary-rgb), .08);
  position: relative;
}
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px;
  height: 2px; background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* --- Hero --- */
.hero {
  padding: 72px 0 56px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(var(--primary-rgb), .07);
  padding: 6px 12px;
  border-radius: 999px;
  margin: 0 0 20px;
}
.hero-eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.14;
  letter-spacing: -.015em;
  margin: 0 0 20px;
  color: var(--text);
  font-weight: 700;
}
.hero-lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 24px;
}
.hero-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 32px;
}
.chip {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(var(--primary-rgb), .07);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--primary-rgb), .12);
}
.hero-figure {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 3;
  background: rgba(var(--primary-rgb), .04);
}
.hero-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- CTA --- */
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .01em;
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), .22);
}
.cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.cta.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), .32);
  box-shadow: none;
}
.cta.secondary:hover {
  background: rgba(var(--primary-rgb), .05);
  border-color: var(--primary);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 20px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}
.breadcrumbs ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.breadcrumbs li:not(:last-child)::after {
  content: "/"; margin-left: 6px; opacity: .5;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; transition: color .18s; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs li:last-child { color: var(--primary); }

/* --- Article body --- */
main { padding: 56px 0 72px; }
main .container article > * + * { margin-top: 1.1em; }
h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.22;
  letter-spacing: -.01em;
  margin: 56px 0 20px;
  scroll-margin-top: 88px;
  color: var(--text);
  font-weight: 700;
}
h3 {
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1.3;
  margin: 34px 0 12px;
  color: var(--text);
  font-weight: 600;
}
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .18s; }
a:hover { color: var(--secondary); }

ul, ol { padding-left: 22px; margin: 0 0 1em; }
li { margin: 6px 0; }

blockquote {
  border-left: 3px solid var(--accent);
  margin: 24px 0;
  padding: 4px 22px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
  font-size: 18px;
}

table {
  width: 100%; border-collapse: collapse; margin: 24px 0;
  font-size: 15px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: rgba(var(--primary-rgb), .05);
  color: var(--primary);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
tr:nth-child(even) td { background: rgba(var(--primary-rgb), .025); }
tr:last-child td { border-bottom: none; }
td .mono { font-family: var(--mono); font-size: 13.5px; }

figure { margin: 32px 0; }
figure img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
figcaption {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* Numeric emphasis */
.stat-num, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- ToC --- */
.toc {
  margin: 36px 0 48px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.toc-heading {
  margin: 0 0 16px !important;
  font-family: var(--mono);
  font-size: 12.5px !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.toc-list {
  list-style: none;
  counter-reset: toc-counter;
  column-count: 2;
  column-gap: 32px;
  column-rule: 1px solid var(--border);
  padding: 0; margin: 0;
}
.toc-list li {
  counter-increment: toc-counter;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  padding: 6px 0 6px 40px;
  position: relative;
  margin: 0;
}
.toc-list li::before {
  content: counter(toc-counter, decimal-leading-zero);
  position: absolute; left: 0; top: 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
}
.toc-list a { text-decoration: none; color: var(--text); }
.toc-list a:hover { color: var(--primary); }
@media (max-width: 700px) {
  .toc-list { column-count: 1; column-rule: none; }
}

/* --- Steps zigzag --- */
.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: 50%; bottom: -66px;
  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: 50%; transform: translate(-50%, -50%);
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: 4px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), .32);
  z-index: 2;
}
.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 { color: var(--primary); }

@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:not(:last-child)::before { left: 24px; }
  .steps li { padding-left: 60px; }
  .step-num { left: 24px; }
  .step-body { width: 100%; }
}

/* --- FAQ --- */
.faq-section {
  margin: 48px 0;
}
/* Reliable FAQ pattern — works on all evergreen browsers.
   Uses default <details> show/hide with a subtle slide-in on the body. */
.faq-section details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: var(--surface);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.faq-section details:hover {
  border-color: rgba(var(--primary-rgb), .3);
  box-shadow: var(--shadow-sm);
}
.faq-section details[open] {
  border-color: rgba(var(--primary-rgb), .35);
  box-shadow: var(--shadow-sm);
}
.faq-section summary {
  padding: 18px 56px 18px 22px;
  position: relative;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 16px;
  user-select: none;
}
.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);
  border-radius: 2px;
}
.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-body {
  padding: 4px 22px 20px;
  color: var(--muted);
}
.faq-body p { margin: 0 0 .8em; }
.faq-body p:last-child { margin-bottom: 0; }

@keyframes faqSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.faq-section details[open] .faq-body {
  animation: faqSlideDown .28s cubic-bezier(.4,0,.2,1);
}

/* --- Author box --- */
.author-box {
  margin: 52px 0 0;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; gap: 24px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.author-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-meta h3 { margin: 0 0 4px !important; font-size: 18px !important; }
.author-meta .author-role {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.author-meta p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* --- Byline --- */
.byline {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  font-family: var(--mono);
  letter-spacing: .02em;
}
.byline-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.byline-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.byline-sep { opacity: .5; }

/* --- Info callout --- */
.callout {
  padding: 20px 24px;
  background: rgba(var(--primary-rgb), .04);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}
.callout strong { color: var(--primary); }
.callout p:last-child { margin-bottom: 0; }

/* --- Footer --- */
.site-footer {
  background: var(--secondary);
  color: rgba(255,255,255,.82);
  padding: 56px 0 24px;
  margin-top: 72px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-col h3 {
  color: #fff;
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 0 16px;
  font-family: var(--mono);
  font-weight: 600;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 8px 0; }
.footer-col a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 14.5px;
  transition: color .18s;
}
.footer-col a:hover { color: #fff; }
.footer-brand img { height: 42px; margin-bottom: 16px; }
.footer-brand p { font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.7); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  color: rgba(255,255,255,.6);
  font-size: 13px;
}
.footer-age {
  display: flex; align-items: center; gap: 12px;
}
.age-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 30px;
  padding: 0 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  letter-spacing: .04em;
}
.copyright { margin: 0; }

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

/* --- Responsive --- */
@media (max-width: 991px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .header-inner { padding: 12px 20px; }

  .nav-toggle-label {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 26px; height: 20px;
    cursor: pointer;
    z-index: 50;
  }
  .nav-toggle-label span {
    display: block; height: 2px; background: var(--text);
    border-radius: 2px;
    transition: transform .28s ease, opacity .28s ease;
  }
  .nav-toggle-checkbox:checked + .nav-toggle-label span:nth-child(1) {
    transform: translateY(9px) 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(-9px) rotate(-45deg);
  }

  .main-nav {
    position: fixed; top: 66px; right: 0;
    width: 280px; max-width: 90vw;
    background: var(--surface);
    box-shadow: -8px 0 32px rgba(20,24,40,.14);
    padding: 20px;
    transform: translateX(105%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    z-index: 45;
    height: calc(100vh - 66px);
    overflow-y: auto;
  }
  .nav-toggle-checkbox:checked ~ .main-nav {
    transform: translateX(0);
  }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 4px; }
  .main-nav a { padding: 12px 14px; font-size: 15px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container, .container-fluid { padding: 0 16px; }
  .hero { padding: 48px 0 32px; }
  .hero-inner { gap: 24px; }
  main { padding: 40px 0 56px; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; margin: 40px 0 16px; }
  h3 { font-size: 18px; }
  .toc { padding: 20px; }
  .author-box { flex-direction: column; align-items: center; text-align: center; padding: 22px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* 404 */
.page-404 {
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 72px 24px;
}
.page-404 h1 {
  font-size: 72px;
  font-family: var(--mono);
  color: var(--primary);
  margin: 0;
}
