:root {
  --paper: #f7f4ea;
  --paper-2: #e8efe7;
  --paper-3: #dce5dd;
  --ink: #171b19;
  --ink-2: #37413d;
  --ink-muted: #68736e;
  --terra: #c7472c;
  --terra-2: #91311f;
  --terra-soft: rgba(199, 71, 44, 0.09);
  --ledger: #155c57;
  --ledger-2: #0d3e3a;
  --ledger-soft: rgba(21, 92, 87, 0.1);
  --rule: rgba(23, 27, 25, 0.18);
  --rule-2: rgba(23, 27, 25, 0.34);
  --display: 'Fraunces', Georgia, serif;
  --body: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 260px),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.17  0 0 0 0 0.12  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

p, h1, h2, h3, h4 {
  margin-top: 0;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--paper);
  transition: transform 0.15s;
}

.skip-link:focus { transform: translateY(0); }

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

.masthead {
  border-bottom: 1px solid var(--ink);
  background: rgba(247, 244, 234, 0.94);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.masthead-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
}

.masthead-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  fill: var(--terra);
}

.brand-wordmark {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
}

.brand-wordmark em {
  color: var(--terra);
  font-style: italic;
}

.masthead-nav {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead-cta,
.primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 11px 16px;
  border: 1px solid var(--ink);
  background: var(--terra);
  color: #fffaf1;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead-cta:hover,
.primary-cta:hover {
  background: var(--terra-2);
}

.guide-hero {
  border-bottom: 1px solid var(--ink);
  padding: clamp(58px, 8vw, 112px) 0 56px;
}

.guide-kicker,
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--terra-2);
}

.guide-hero h1 {
  max-width: 900px;
  margin: 16px 0 22px;
  font-family: var(--display);
  font-size: clamp(46px, 8vw, 88px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0;
}

.guide-hero h1 em {
  color: var(--ledger);
  font-style: italic;
}

.lede {
  max-width: 760px;
  color: var(--ink-2);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.25;
}

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.guide-meta span + span::before {
  content: '/';
  margin-right: 10px;
  color: var(--rule-2);
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(34px, 6vw, 76px);
  padding: 58px 0 72px;
}

.guide-main {
  min-width: 0;
}

.guide-main h2 {
  margin: 42px 0 14px;
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 400;
  line-height: 1.05;
}

.guide-main h3 {
  margin: 26px 0 8px;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
}

.guide-main p,
.guide-main li {
  color: var(--ink-2);
  font-size: 20px;
}

.guide-main ul,
.guide-main ol {
  padding-left: 22px;
}

.guide-main li + li {
  margin-top: 10px;
}

.pull-note {
  margin: 34px 0;
  padding: 22px;
  border-left: 5px solid var(--terra);
  background: var(--terra-soft);
  color: var(--ink);
  font-family: var(--display);
  font-size: 26px;
  line-height: 1.2;
}

.side-note {
  position: sticky;
  top: 92px;
  align-self: start;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  padding: 22px;
}

.side-note h2 {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.05;
  font-weight: 500;
}

.side-note p {
  color: var(--ink-2);
}

.side-note ul {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  border-top: 1px solid var(--rule);
}

.side-note li {
  border-bottom: 1px solid var(--rule);
}

.side-note a {
  display: block;
  padding: 12px 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.faq-block {
  margin-top: 48px;
  border-top: 2px solid var(--ink);
}

.faq-block details {
  border-bottom: 1px solid var(--rule-2);
  padding: 18px 0;
}

.faq-block summary {
  cursor: pointer;
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.15;
}

.faq-block p {
  max-width: 760px;
  margin: 14px 0 0;
}

.related-guides {
  background: var(--ledger-2);
  color: var(--paper);
  padding: 56px 0;
}

.related-guides h2 {
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 400;
  line-height: 1;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(247, 244, 234, 0.3);
  border: 1px solid rgba(247, 244, 234, 0.3);
}

.related-grid a {
  min-height: 132px;
  padding: 20px;
  background: var(--ledger-2);
}

.related-grid strong {
  display: block;
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.05;
}

.related-grid span {
  display: block;
  margin-top: 12px;
  color: rgba(247, 244, 234, 0.72);
  font-size: 17px;
}

.closing-cta {
  padding: 58px 0 72px;
  background: var(--paper-2);
  border-top: 1px solid var(--ink);
}

.closing-cta h2 {
  max-width: 760px;
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 400;
  line-height: 1;
}

.closing-cta p {
  max-width: 680px;
  color: var(--ink-2);
  font-size: 22px;
}

.colophon {
  border-top: 1px solid var(--ink);
  padding: 28px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.colophon .container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

@media (max-width: 840px) {
  .masthead-inner {
    grid-template-columns: 1fr auto;
    padding: 12px 20px;
  }

  .masthead-nav {
    display: none;
  }

  .guide-layout,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .side-note {
    position: static;
  }

  .colophon .container {
    display: block;
  }
}
