/* ============================================================
   Mostly Harmless — Resources hub + guide pages
   Shares the design tokens of the main site (index.html).
   ============================================================ */

:root{
  --ink:#0E1116;
  --paper:#FAF6EE;
  --bg:var(--ink);
  --fg:rgba(250,246,238,.88);
  --fg-strong:rgba(250,246,238,.94);
  --fg-soft:rgba(250,246,238,.66);
  --fg-faint:rgba(250,246,238,.42);
  --gold:#F5C518;
  --teal:#3DD3C2;
  --plum:#B07AC7;
  --coral:#FF7A8A;
  --line:rgba(250,246,238,.10);
  --line-soft:rgba(250,246,238,.06);
}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
html,body{
  background:var(--bg);
  color:var(--fg);
  font-family:"Inter",ui-sans-serif,system-ui,-apple-system,"Helvetica Neue",sans-serif;
  font-feature-settings:"cv11","ss01","ss03";
  -webkit-font-smoothing:antialiased;
  line-height:1.6;
  overflow-x:hidden;
}
a{color:inherit}

/* ------------ Nav ------------ */
nav{
  display:flex;justify-content:space-between;align-items:center;
  padding:24px 40px;
  border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:20;
  background:rgba(14,17,22,.82);
  backdrop-filter:saturate(140%) blur(10px);
}
nav .brand{display:flex;align-items:center;text-decoration:none}
nav .brand img{width:64px;height:64px;display:block}
nav .links{display:flex;gap:26px;font-size:14px;color:var(--fg-soft);align-items:center}
nav .links a{text-decoration:none;transition:color .2s;white-space:nowrap}
nav .links a:hover{color:var(--fg)}
nav .links a.active{color:var(--gold)}
@media (max-width:720px){
  nav{padding:16px 20px}
  nav .brand img{width:48px;height:48px}
  nav .links{gap:18px;font-size:13px}
}

/* ------------ Shared wrappers ------------ */
.wrap{max-width:1120px;margin:0 auto;padding:0 40px}
.eyebrow{
  font-size:12px;letter-spacing:.22em;text-transform:uppercase;
  color:var(--fg-faint);margin-bottom:16px;
}
@media (max-width:720px){.wrap{padding:0 22px}}

/* ============================================================
   LIBRARY / INDEX
   ============================================================ */
.lib-hero{padding:84px 0 56px;border-bottom:1px solid var(--line)}
.lib-hero h1{
  font-size:clamp(36px,6vw,64px);font-weight:800;
  letter-spacing:-.035em;line-height:1.02;
  color:var(--fg-strong);max-width:16ch;margin-bottom:24px;
}
.lib-hero h1 .accent{color:var(--gold)}
.lib-hero p{font-size:clamp(16px,2vw,20px);color:var(--fg-soft);max-width:60ch}
.lib-hero .underline{display:inline-block;width:48px;height:3px;background:var(--gold);margin-top:32px}

.cat{padding:64px 0 8px}
.cat-head{display:flex;align-items:baseline;gap:16px;margin-bottom:32px;flex-wrap:wrap}
.cat-head h2{font-size:clamp(22px,3vw,30px);font-weight:800;letter-spacing:-.02em;color:var(--fg-strong)}
.cat-head .count{font-size:13px;color:var(--fg-faint);letter-spacing:.04em}

.cards{
  display:grid;grid-template-columns:repeat(2,1fr);
  gap:1px;background:var(--line);
  border:1px solid var(--line);border-radius:10px;overflow:hidden;
}
@media (max-width:760px){.cards{grid-template-columns:1fr}}
/* a lone trailing card (odd-count category) spans the full row, so no empty cell */
.cards > .card:last-child:nth-child(odd){grid-column:1 / -1;}
.card{
  background:var(--bg);padding:34px 32px;
  display:flex;flex-direction:column;gap:14px;
  text-decoration:none;transition:background .2s;
  min-height:230px;
}
.card:hover{background:#13171f}
.card .tag{
  font-size:11px;letter-spacing:.18em;text-transform:uppercase;font-weight:700;
}
.card.c-coral .tag{color:var(--coral)}
.card.c-gold  .tag{color:var(--gold)}
.card.c-teal  .tag{color:var(--teal)}
.card.c-plum  .tag{color:var(--plum)}
.card h3{font-size:21px;font-weight:700;letter-spacing:-.01em;color:var(--fg-strong);line-height:1.25}
.card p{font-size:15px;color:var(--fg-soft);line-height:1.55;flex:1}
.card .more{
  display:inline-flex;align-items:center;gap:8px;
  font-size:13px;font-weight:600;color:var(--fg);letter-spacing:.02em;
}
.card .more svg{width:14px;height:14px;transition:transform .2s}
.card:hover .more svg{transform:translateX(4px)}
.card .meta{font-size:12px;color:var(--fg-faint);letter-spacing:.03em}

.lib-more{
  margin:64px 0 0;padding:32px;border:1px dashed var(--line);border-radius:10px;
  display:flex;justify-content:space-between;align-items:center;gap:24px;flex-wrap:wrap;
}
.lib-more p{color:var(--fg-soft);font-size:15px;max-width:54ch}
.lib-more b{color:var(--fg-strong);font-weight:600}

/* downloads */
.downloads{padding:64px 0 8px;border-top:1px solid var(--line);margin-top:64px}
.dl-feature{
  display:flex;justify-content:space-between;align-items:center;gap:32px;flex-wrap:wrap;
  border:1px solid var(--line);border-radius:12px;padding:32px 34px;margin-bottom:24px;
  background:linear-gradient(135deg,rgba(245,197,24,.07),rgba(176,122,199,.05));
}
.dl-feature .t .tag{font-size:11px;letter-spacing:.16em;text-transform:uppercase;font-weight:700;color:var(--gold);display:block;margin-bottom:10px}
.dl-feature .t h3{font-size:22px;font-weight:700;color:var(--fg-strong);letter-spacing:-.01em;margin-bottom:10px}
.dl-feature .t p{font-size:15px;color:var(--fg-soft);max-width:52ch}
.dl-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1px;background:var(--line);border:1px solid var(--line);border-radius:10px;overflow:hidden}
@media (max-width:760px){.dl-grid{grid-template-columns:1fr}}
.dl-item{
  background:var(--bg);padding:20px 24px;text-decoration:none;
  display:flex;align-items:center;justify-content:space-between;gap:16px;transition:background .2s;
}
.dl-item:hover{background:#13171f}
.dl-item .n{font-size:15px;font-weight:600;color:var(--fg-strong)}
.dl-item .s{font-size:12px;color:var(--fg-faint);letter-spacing:.03em;white-space:nowrap}
.dl-item .dlicon{width:16px;height:16px;color:var(--fg-soft);flex:none}

/* ============================================================
   GUIDE / ARTICLE
   ============================================================ */
.breadcrumb{padding:28px 0 0;font-size:13px;color:var(--fg-faint)}
.breadcrumb a{text-decoration:none;color:var(--fg-soft)}
.breadcrumb a:hover{color:var(--fg)}
.breadcrumb span{margin:0 8px;color:var(--fg-faint)}

.article-head{padding:24px 0 48px;border-bottom:1px solid var(--line)}
.article-head .tag{
  font-size:11px;letter-spacing:.18em;text-transform:uppercase;font-weight:700;
  color:var(--gold);margin-bottom:18px;display:block;
}
.article-head h1{
  font-size:clamp(32px,5vw,52px);font-weight:800;
  letter-spacing:-.03em;line-height:1.04;color:var(--fg-strong);
  max-width:20ch;margin-bottom:22px;
}
.article-head .dek{font-size:clamp(17px,2vw,21px);color:var(--fg-soft);max-width:60ch;line-height:1.5}
.article-head .meta{
  margin-top:26px;display:flex;gap:20px;flex-wrap:wrap;
  font-size:12px;color:var(--fg-faint);letter-spacing:.04em;
}
.article-head .meta b{color:var(--fg-soft);font-weight:500}

/* layout: content + optional TOC */
.article-body{
  display:grid;grid-template-columns:1fr;gap:56px;
  padding:56px 0 40px;
}
@media (min-width:1000px){
  .article-body{grid-template-columns:220px 1fr;gap:64px}
}
.toc{align-self:start}
@media (min-width:1000px){.toc{position:sticky;top:104px}}
.toc p{font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--fg-faint);margin-bottom:16px}
.toc ol{list-style:none;display:flex;flex-direction:column;gap:11px}
.toc a{text-decoration:none;font-size:14px;color:var(--fg-soft);line-height:1.4;transition:color .2s;border-left:2px solid var(--line);padding-left:14px;display:block}
.toc a:hover{color:var(--fg);border-color:var(--gold)}

/* prose */
.prose{max-width:72ch;font-size:17px}
.prose > * + *{margin-top:22px}
.prose h2{
  font-size:clamp(24px,3vw,32px);font-weight:800;letter-spacing:-.02em;
  color:var(--fg-strong);line-height:1.15;margin-top:64px;scroll-margin-top:104px;
  padding-top:8px;
}
.prose h2:first-child{margin-top:0}
.prose h3{
  font-size:20px;font-weight:700;color:var(--fg-strong);
  letter-spacing:-.01em;margin-top:40px;line-height:1.3;
}
.prose p{color:var(--fg)}
.prose strong{color:var(--fg-strong);font-weight:700}
.prose a{color:var(--fg-strong);text-decoration:underline;text-decoration-color:rgba(245,197,24,.5);text-underline-offset:3px}
.prose a:hover{text-decoration-color:var(--gold)}
.prose ul,.prose ol{padding-left:24px;color:var(--fg)}
.prose li{margin-top:10px}
.prose li::marker{color:var(--fg-faint)}
.prose code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.88em;background:rgba(250,246,238,.07);
  padding:2px 6px;border-radius:5px;color:var(--teal);
}
.prose pre{
  background:#0a0c10;border:1px solid var(--line);border-radius:10px;
  padding:20px 22px;overflow-x:auto;font-size:14px;line-height:1.6;
}
.prose pre code{background:none;padding:0;color:var(--fg);font-size:14px}
.prose blockquote{
  border-left:3px solid var(--gold);padding:4px 0 4px 22px;
  color:var(--fg-soft);font-style:italic;
}

/* tables */
.prose table{width:100%;border-collapse:collapse;font-size:15px;display:block;overflow-x:auto}
.prose th,.prose td{text-align:left;padding:12px 16px;border-bottom:1px solid var(--line);vertical-align:top}
.prose thead th{font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--fg-faint);font-weight:700}
.prose tbody td{color:var(--fg-soft)}
.prose tbody td:first-child{color:var(--fg-strong);font-weight:600}

/* callouts */
.callout{
  border:1px solid var(--line);border-left-width:3px;border-radius:10px;
  padding:20px 24px;background:rgba(250,246,238,.03);
}
.callout .lead{
  display:block;font-size:11px;letter-spacing:.16em;text-transform:uppercase;
  font-weight:700;margin-bottom:8px;
}
.callout p{margin:0;color:var(--fg-soft);font-size:15.5px}
.callout.note{border-left-color:var(--teal)}
.callout.note .lead{color:var(--teal)}
.callout.warn{border-left-color:var(--coral)}
.callout.warn .lead{color:var(--coral)}
.callout.key{border-left-color:var(--gold);background:rgba(245,197,24,.05)}
.callout.key .lead{color:var(--gold)}

/* checklist recap block */
.checklist{
  border:1px solid var(--line);border-radius:12px;padding:28px 30px;
  background:linear-gradient(180deg,rgba(250,246,238,.04),rgba(250,246,238,.015));
}
.checklist h3{margin-top:0}
.checklist ul{list-style:none;padding:0;margin-top:18px}
.checklist li{
  position:relative;padding-left:32px;margin-top:14px;color:var(--fg);font-size:15.5px;
}
.checklist li::before{
  content:"";position:absolute;left:0;top:2px;width:18px;height:18px;
  border:1.5px solid var(--gold);border-radius:5px;
}
.checklist li::after{
  content:"";position:absolute;left:6px;top:5px;width:5px;height:9px;
  border:solid var(--gold);border-width:0 2px 2px 0;transform:rotate(40deg);
}

/* figure (light panel for dark-on-transparent diagrams) */
figure.diagram{margin:8px 0}
figure.diagram .panel{
  background:var(--paper);border-radius:12px;padding:24px;
  box-shadow:0 18px 50px rgba(0,0,0,.4);
}
figure.diagram img{display:block;width:100%;height:auto}
figure.diagram figcaption{
  margin-top:14px;font-size:13px;color:var(--fg-faint);text-align:center;letter-spacing:.02em;
}

/* end-of-guide CTA */
.guide-cta{
  margin:64px 0 0;border:1px solid var(--line);border-radius:14px;
  padding:40px;background:linear-gradient(135deg,rgba(245,197,24,.07),rgba(176,122,199,.05));
}
.guide-cta h2{font-size:clamp(22px,3vw,30px);font-weight:800;letter-spacing:-.02em;color:var(--fg-strong);margin-bottom:14px;line-height:1.15}
.guide-cta p{color:var(--fg-soft);font-size:16px;max-width:54ch;margin-bottom:24px}
.btn{
  display:inline-flex;align-items:center;gap:9px;
  background:var(--gold);color:var(--ink);
  padding:13px 26px;border-radius:999px;text-decoration:none;
  font-weight:700;font-size:14px;transition:filter .2s,transform .2s;
}
.btn:hover{filter:brightness(1.08);transform:translateY(-1px)}
.btn.ghost{background:transparent;color:var(--fg-strong);border:1px solid var(--line)}
.btn.ghost:hover{border-color:var(--gold);filter:none}
.guide-cta .row{display:flex;gap:14px;flex-wrap:wrap}

.related{padding:48px 0 24px;border-top:1px solid var(--line);margin-top:64px}
.related p.eyebrow{margin-bottom:24px}
.related-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1px;background:var(--line);border:1px solid var(--line);border-radius:10px;overflow:hidden}
@media (max-width:760px){.related-grid{grid-template-columns:1fr}}

/* ------------ Footer ------------ */
footer{
  padding:40px;border-top:1px solid var(--line);margin-top:64px;
  display:flex;justify-content:space-between;align-items:center;gap:24px;flex-wrap:wrap;
  font-size:13px;color:var(--fg-faint);
}
footer .l{display:flex;gap:22px;align-items:center}
footer a{text-decoration:none;color:var(--fg-soft);transition:color .2s}
footer a:hover{color:var(--fg)}
@media (max-width:560px){footer{flex-direction:column;align-items:flex-start;padding:32px 22px}}

@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
