/* ============================================================
   avoid-ai.com — "The Almanac" design system
   A field guide for people learning to use AI wisely.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,500&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root{
  /* --- color tokens --- */
  --ink:        #202D1F;   /* deep pine ink — headings, body text */
  --ink-soft:   #4B5647;   /* muted secondary text */
  --paper:      #F3EEDD;   /* warm parchment background */
  --paper-2:    #EAE2C8;   /* deeper parchment — cards, stripes */
  --paper-3:    #FBF8EE;   /* lightest parchment — raised panels */
  --brass:      #A6752B;   /* muted brass — links, accents */
  --brass-dark: #7E5A20;   /* brass hover/active */
  --teal:       #2B5A57;   /* deep teal — tags, secondary accent */
  --teal-soft:  #E4EEEC;   /* teal tint background */
  --line:       #CBC0A0;   /* hairline rule color */
  --line-soft:  #DED5B8;
  --white:      #ffffff;
  --rust:       #9B3D2E;   /* oxide red — hazard only, never decoration */
  --rust-dark:  #7C3025;
  --rust-soft:  #F7E7E2;   /* hazard tint background */

  /* --- type --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, 'Segoe UI', sans-serif;

  --fs-body: 1.19rem;      /* deliberately larger for easy reading */
  --lh-body: 1.68;

  --radius: 5px;
  --radius-sm: 3px;
  --max-w: 1120px;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body{
  margin:0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

img{ max-width:100%; display:block; }

h1,h2,h3,h4{
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em 0;
  font-weight: 600;
}
h1{ font-size: clamp(2.3rem, 4.4vw, 3.4rem); font-weight: 500; }
h2{ font-size: clamp(1.7rem, 2.8vw, 2.3rem); }
h3{ font-size: 1.4rem; }
h4{ font-size: 1.15rem; }

p{ margin: 0 0 1.2em 0; max-width: 68ch; }
p.lede{ font-size: 1.28em; color: var(--ink-soft); }

/* brass (#A6752B) measures 3.48:1 on parchment — below the 4.5:1 floor
   for body text. brass-dark is 5.37:1 and reads almost identically at
   text size, so links use it and brass stays for rules and hover. */
a{ color: var(--brass-dark); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover{ color: var(--ink); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible{
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

ul, ol{ padding-left: 1.3em; }
li{ margin-bottom: 0.5em; }

.container{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.6rem;
}

.eyebrow{
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--teal);
}

hr, .rule{
  border: none;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

/* ---------------- header / nav ---------------- */
.site-header{
  border-bottom: 1px solid var(--line);
  background: var(--paper-3);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 1.1rem 1.6rem;
  max-width: var(--max-w);
  margin: 0 auto;
  gap: 1rem;
}
.wordmark{
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  display:flex;
  align-items:baseline;
  gap: 0.5rem;
}
.wordmark small{
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 0.22em 0.5em;
  border-radius: 3px;
}
.wordmark:hover{ color: var(--ink); }

.main-nav{ display:flex; align-items:center; }
.main-nav ul{
  display:flex;
  list-style:none;
  gap: 1.9rem;
  margin:0; padding:0;
}
.main-nav a{
  color: var(--ink);
  text-decoration:none;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a[aria-current="page"]{
  color: var(--brass-dark);
  border-bottom-color: var(--brass);
}

.nav-toggle{ display:none; }
.nav-toggle-label{
  display:none;
  cursor:pointer;
  font-family: var(--font-body);
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--paper-3);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
}

@media (max-width: 760px){
  .nav-toggle-label{ display:inline-block; }
  .main-nav{
    display:block;
    position:absolute;
    top:100%; left:0; right:0;
    background: var(--paper-3);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow:hidden;
    transition: max-height 0.25s ease;
  }
  .main-nav ul{ flex-direction:column; gap:0; padding: 0.5rem 1.6rem 1.2rem; }
  .main-nav li{ border-top: 1px solid var(--line-soft); }
  .main-nav a{ display:block; padding: 0.9rem 0.2rem; }
  .nav-toggle:checked ~ .main-nav{ max-height: 420px; }
  .header-row{ position:relative; flex-wrap:wrap; }
}

/* ---------------- buttons ---------------- */
.btn{
  display:inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  text-decoration:none;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  color: var(--ink);
  background: transparent;
}
.btn:hover{ background: var(--ink); color: var(--paper); }
.btn-primary{
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}
.btn-primary:hover{ background: #204542; border-color:#204542; color: var(--white); }

/* ---------------- hero ---------------- */
.hero{
  padding: 4.2rem 0 3.5rem;
}
.hero-grid{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items:center;
}
@media (max-width: 880px){
  .hero-grid{ grid-template-columns: 1fr; }
}
.hero h1{ margin-top:0.3rem; }
.hero-tag{
  display:inline-block;
  margin-bottom: 0.9rem;
}

/* ---------------- trail map (signature element) ---------------- */
.trail-wrap{
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.1rem 1rem;
}
.trail-wrap svg{ display:block; width:100%; height:auto; }
.trail-caption{
  text-align:center;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-top: 0.7rem;
}
.trail-caption strong{ color: var(--ink); }

/* clickable waypoints */
.trail-node{ cursor:pointer; }
.trail-node .node-ring,
.trail-node .node-num,
.trail-node .node-label{
  transition: fill 0.15s ease, stroke 0.15s ease;
}
.trail-node:hover .node-ring{ fill: var(--brass); stroke: var(--brass-dark); }
.trail-node:hover .node-num{ fill: var(--white); }
.trail-node:hover .node-label{ fill: var(--brass-dark); }
.trail-node:focus-visible{ outline: 3px solid var(--teal); outline-offset: 2px; }

/* first-aid marker -> Staying Safe */
.aid-node{ cursor:pointer; }
.aid-node .aid-box, .aid-node .aid-cross, .aid-node .aid-label{
  transition: fill 0.15s ease, stroke 0.15s ease;
}
.aid-node:hover .aid-box{ fill: var(--teal); stroke: var(--teal); }
.aid-node:hover .aid-cross{ fill: var(--paper-3); }
.aid-node:hover .aid-label{ fill: var(--teal); }
.aid-node:focus-visible{ outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---------------- sections ---------------- */
section{ padding: 3.2rem 0; }
.section-tight{ padding: 2rem 0; }
.band{ background: var(--paper-2); }
.band-teal{ background: var(--teal-soft); }

.pillars{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
}
@media (max-width: 820px){ .pillars{ grid-template-columns: 1fr; } }
.pillar{
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.pillar .num{
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--teal);
  font-weight:600;
  display:block;
  margin-bottom: 0.6rem;
}

/* ---------------- guide cards ---------------- */
.card-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}
@media (max-width: 720px){ .card-grid{ grid-template-columns: 1fr; } }

.guide-card{
  display:block;
  text-decoration:none;
  color: var(--ink);
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  position:relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.guide-card:hover{ border-color: var(--brass); transform: translateY(-2px); }
.guide-card .chapter{
  font-family: var(--font-body);
  font-weight:700;
  letter-spacing: 0.1em;
  text-transform:uppercase;
  font-size: 0.72rem;
  color: var(--teal);
  display:block;
  margin-bottom: 0.7rem;
}
.guide-card h3{ margin-bottom: 0.5rem; color: var(--ink); }
.guide-card p{ color: var(--ink-soft); margin-bottom:0.5rem; font-size: 0.98rem; }
.guide-card .read-more{
  color: var(--brass-dark);
  font-weight:700;
  font-size: 0.92rem;
}

/* ---------------- callout boxes ---------------- */
.box{
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  padding: 1.3rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.8rem 0;
}
.box.brass{ border-left-color: var(--brass); background: #F6ECD9; }
.box h4{ margin-bottom:0.4rem; }
.box p:last-child{ margin-bottom:0; }

/* ---------------- FAQ ---------------- */
details{
  border-bottom: 1px solid var(--line);
  padding: 1.2rem 0;
}
details summary{
  font-family: var(--font-display);
  font-size: 1.2rem;
  cursor:pointer;
  font-weight:600;
  list-style: none;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
}
details summary::-webkit-details-marker{ display:none; }
details summary::after{
  content: "+";
  font-family: var(--font-body);
  font-size: 1.6rem;
  color: var(--brass);
  flex-shrink:0;
}
details[open] summary::after{ content: "–"; }
details .answer{ margin-top: 0.8rem; color: var(--ink-soft); }
details .answer p:last-child{ margin-bottom:0; }

/* ---------------- footer ---------------- */
.site-footer{
  border-top: 1px solid var(--line);
  background: var(--paper-3);
  padding: 3rem 0 2.2rem;
  margin-top: 2rem;
}
.footer-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 700px){ .footer-grid{ grid-template-columns: 1fr; } }
.footer-grid h4{ font-size: 0.85rem; letter-spacing:0.08em; text-transform:uppercase; font-family: var(--font-body); color: var(--teal); margin-bottom: 0.9rem; }
.footer-grid ul{ list-style:none; padding:0; margin:0; }
.footer-grid a{ color: var(--ink-soft); text-decoration:none; }
.footer-grid a:hover{ color: var(--brass-dark); }
.footer-bottom{
  border-top: 1px solid var(--line-soft);
  padding-top: 1.4rem;
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------------- misc utility ---------------- */
.center{ text-align:center; }
.tag{
  display:inline-block;
  background: var(--paper-2);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.25em 0.85em;
  font-size: 0.82rem;
  font-weight:600;
  margin: 0 0.4em 0.4em 0;
}
.breadcrumb{
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}
.breadcrumb a{ color: var(--ink-soft); text-decoration: underline; }
.page-head{ padding: 2.6rem 0 1rem; }
.page-head .eyebrow{ margin-bottom: 0.7rem; display:block; }
.two-col{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
}
@media (max-width: 780px){ .two-col{ grid-template-columns: 1fr; } }
.steps{ counter-reset: step; list-style:none; padding-left:0; }
.steps li{
  counter-increment: step;
  position:relative;
  padding-left: 2.7rem;
  margin-bottom: 1.3rem;
}
.steps li::before{
  content: counter(step);
  position:absolute;
  left:0; top:0.05em;
  width: 1.9rem; height:1.9rem;
  border-radius:50%;
  background: var(--teal);
  color: var(--white);
  font-family: var(--font-display);
  font-weight:600;
  font-size: 1rem;
  display:flex; align-items:center; justify-content:center;
}

/* ---------------- review stamp ---------------- */
.updated{
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  display: inline-block;
  margin: 0 0 1.2rem 0;
}


/* ============================================================
   ILLUSTRATION LAYER
   Figures carry the teaching load on interior pages, reusing the
   drawing vocabulary of the trail map on the home page:
     hairline contours ... var(--line)   background texture
     dashed brass path ... var(--brass)  the route you control
     solid teal .......... var(--teal)   local to your machine
     oxide red ........... var(--rust)   hazard, and nothing else
   ============================================================ */

/* ---------------- route strip (page banner) ---------------- */
.route-strip{
  background: var(--paper-3);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.route-strip svg{ display:block; width:100%; height:auto; max-height:152px; }
.route-strip a.rs-stop{ cursor: pointer; }
.route-strip a.rs-stop:hover .rs-ring{ fill: var(--brass); stroke: var(--brass-dark); }
.route-strip a.rs-stop:hover .rs-num{ fill: var(--white); }
.route-strip a.rs-stop:hover .rs-label{ fill: var(--brass-dark); }
.route-strip a.rs-stop:focus-visible{ outline: 3px solid var(--teal); outline-offset: -3px; }
.rs-ring, .rs-num, .rs-label{ transition: fill 0.15s ease, stroke 0.15s ease; }

@media (max-width: 620px){
  /* labels are hidden at this width, so an unlabelled tap target would be a
     guess. The chapter navigation at the foot of the page does this job. */
  .route-strip .rs-optional{ display:none; }
  .route-strip a.rs-stop{ pointer-events: none; }
}

/* ---------------- figures ---------------- */
.figure{ margin: 2.4rem 0; }
.figure .frame{
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem 1.1rem;
}
.figure svg{ display:block; width:100%; height:auto; }
.figcaption{
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.8rem 0 0;
  max-width: 68ch;
}
.figcaption b{ color: var(--ink); font-weight: 600; }

/* ---------------- side-by-side comparison ---------------- */
.compare{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 1.9rem 0;
}
@media (max-width: 720px){ .compare{ grid-template-columns: 1fr; } }
.compare > div{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  background: var(--paper-3);
}
.compare .worse{ border-color: var(--rust); background: var(--rust-soft); }
.compare .better{ border-color: var(--teal); background: var(--teal-soft); }
.compare h4{
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.7rem;
}
.compare .worse h4{ color: var(--rust-dark); }
.compare .better h4{ color: var(--teal); }
.compare p{ margin-bottom: 0.7rem; font-size: 1rem; max-width: none; }
.compare p:first-of-type{
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1.3;
  color: var(--ink);
}
.compare p:last-child{ margin-bottom: 0; }

/* ---------------- hazard checklist ---------------- */
.flags{
  list-style: none;
  padding-left: 0;
  margin: 1.8rem 0;
  border-top: 1px solid var(--line);
}
.flags li{
  position: relative;
  margin: 0;
  padding: 1rem 0 1rem 2.7rem;
  border-bottom: 1px solid var(--line);
}
.flags li::before{
  content: "";
  position: absolute;
  left: 0;
  top: 1.25rem;
  width: 1.55rem;
  height: 1.36rem;
  background: var(--rust);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}
.flags li::after{
  content: "!";
  position: absolute;
  left: 0;
  top: 1.25rem;
  width: 1.55rem;
  height: 1.36rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.12em;
  color: var(--paper-3);
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1;
}

/* ---------------- field card (made to be printed) ---------------- */
.field-card{
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-3);
  padding: 1.6rem 1.8rem 1.5rem;
  margin: 2.2rem 0;
  max-width: 46rem;
}
.field-card .fc-kicker{
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 0.5rem;
}
.field-card h3{ margin-bottom: 0.8rem; }
.field-card .fc-line{
  border: none;
  border-top: 1px dashed var(--line);
  margin: 1.1rem 0;
}
.field-card .fc-note{
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 0;
}
.field-card p:last-child{ margin-bottom: 0; }

/* ---------------- glossary ---------------- */
.glossary{ margin: 2rem 0; border-top: 1px solid var(--line); }
.glossary dt{
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 600;
  color: var(--ink);
  padding-top: 1.15rem;
}
.glossary dd{
  margin: 0.35rem 0 0;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  max-width: 68ch;
}

/* ---------------- nav fits seven items ---------------- */
.main-nav ul{ gap: 1.15rem; }
.main-nav a{ font-size: 0.93rem; }

/* ---------------- footer gains a fourth column ---------------- */
.footer-grid{ grid-template-columns: 1.25fr 1fr 1fr 0.85fr; }
@media (max-width: 900px){ .footer-grid{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px){ .footer-grid{ grid-template-columns: 1fr; } }

/* ---------------- hazard callout variant ---------------- */
.box.rust{ border-left-color: var(--rust); background: var(--rust-soft); }
.box.rust h4{ color: var(--rust-dark); }

/* ---------------- print ---------------- */
@media print{
  :root{ --fs-body: 11.5pt; --lh-body: 1.45; }
  body{ background: #fff; color: #000; }
  .site-header, .site-footer, .btn, .nav-toggle-label,
  nav[aria-label="Chapter navigation"], .breadcrumb{ display: none !important; }
  main{ max-width: 100%; }
  section, .section-tight{ padding: 0.6rem 0; }
  .container{ padding: 0; max-width: 100%; }
  h1, h2, h3, h4{ page-break-after: avoid; break-after: avoid; }
  p, li, .box{ page-break-inside: avoid; break-inside: avoid; }
  .box{ border: 1pt solid #999; background: #fff; }
  .box.brass{ background: #fff; }
  .pillar, .guide-card{ border: 1pt solid #999; background: #fff; }
  .steps li::before{ background: #000; color: #fff; }
  a{ color: #000; text-decoration: underline; }
  /* show link targets on paper */
  main a[href^="http"]::after{ content: " (" attr(href) ")"; font-size: 0.85em; }
  .updated{ background: #fff; border: 1pt solid #999; }

  /* illustration layer on paper */
  .route-strip{ display: none !important; }
  .figure{ page-break-inside: avoid; break-inside: avoid; margin: 0.9rem 0; }
  .figure .frame{ border: 1pt solid #999; background: #fff; padding: 0.5rem; }
  .figcaption{ color: #000; }
  .compare{ gap: 0.6rem; page-break-inside: avoid; break-inside: avoid; }
  .compare > div, .compare .worse, .compare .better{
    border: 1pt solid #999; background: #fff;
  }
  .flags li{ page-break-inside: avoid; break-inside: avoid; }
  .flags li::before{ background: #000; }
  .field-card{
    border: 2pt solid #000; background: #fff;
    page-break-inside: avoid; break-inside: avoid;
  }
  .box.rust{ background: #fff; }
  .glossary dt, .glossary dd{ page-break-inside: avoid; break-inside: avoid; }
}
