/* =====================================================================
   Field Notes — shared design system
   Link this on every page:  <link rel="stylesheet" href="field-notes.css">
   Then use the tokens (var(--fn-*)) and component classes below.
   Paths assume this file sits at the interactive-map/ root, next to the
   HTML pages, so url()s mirror what the HTML uses (assets/…, fonts/…).
   ===================================================================== */

/* ---------- fonts (always local — never a CDN at view time) ---------- */
@font-face { font-family: 'Libre Caslon Text'; src: url('assets/caslon-400.woff2') format('woff2');  font-weight: 400; font-style: normal; }
@font-face { font-family: 'Libre Caslon Text'; src: url('assets/caslon-400i.woff2') format('woff2'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Outfit';            src: url('assets/outfit-var.woff2') format('woff2');   font-weight: 100 900; font-style: normal; }
@font-face { font-family: 'Caveat';            src: url('fonts/Caveat/Caveat-VariableFont_wght.ttf') format('truetype'); font-weight: 400 700; font-style: normal; }
@font-face { font-family: 'Cutive Mono';       src: url('fonts/Cutive_Mono/CutiveMono-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'IBM Plex Mono';     src: url('assets/ibm-plex-mono.woff2') format('woff2'); font-weight: 400; font-style: normal; }

/* ---------- tokens ---------- */
:root {
  /* color */
  --fn-noir:        #192127;   /* near-black — borders, headings, ink */
  --fn-ink:         #1E1E1E;   /* body-dark alt */
  --fn-mid:         #737373;   /* nav / secondary UI text */
  --fn-davy:        #595957;   /* body copy, mono labels */
  --fn-silver:      #B5B5B5;   /* inactive numerals */
  --fn-quick:       #9E9E9E;   /* inactive list text */
  --fn-muted:       #7B7B7B;   /* sidebar meta */
  --fn-paper:       #ECECEC;   /* page background */
  --fn-paper-line:  #E3E3E3;   /* map grid lines */
  --fn-paper-dot:   #D2D2D2;   /* dotted-grid dots */
  --fn-subscribe:   #DBDBDB;   /* subscribe box fill */
  --fn-hairline:    #C4C4C4;   /* thin dividers */
  --fn-highlight:   #C7E0E3;   /* article text highlight */
  --fn-teal:        #0D5C6E;   /* brand teal (badges) */
  --fn-white:       #FFFFFF;

  /* type families */
  --fn-serif:  'Libre Caslon Text', serif;   /* headlines */
  --fn-sans:   'Outfit', sans-serif;         /* body + UI */
  --fn-script: 'Caveat', cursive;            /* handwriting / signatures / inputs */
  --fn-mono:   'Cutive Mono', monospace;     /* small-caps labels (MAPPED BY, CONTENTS) */
  --fn-mono2:  'IBM Plex Mono', monospace;   /* numerals, chapter tags, arrows */

  /* geometry */
  --fn-gap:        24px;   /* fixed margin for pinned sidebar / nav */
  --fn-r-sidebar:  44px;
  --fn-r-pill:     68px;
  --fn-r-card:     24px;
  --fn-r-box:      18px;
  --fn-stroke:     0.5px;  /* hairline borders (sidebar, pills) */

  /* motion */
  --fn-ease-spring: cubic-bezier(.34, 1.45, .64, 1);
}

/* ---------- text roles ---------- */
.fn-h1        { font-family: var(--fn-serif); font-weight: 400; font-size: 44px; line-height: 58px; color: var(--fn-noir); }
.fn-h2        { font-family: var(--fn-serif); font-weight: 400; font-size: 30px; line-height: 43.5px; color: var(--fn-noir); }
.fn-body      { font-family: var(--fn-sans); font-size: 17px; line-height: 28px; color: var(--fn-davy); letter-spacing: -.2px; }
.fn-label     { font-family: var(--fn-mono); font-size: 13.4px; letter-spacing: 1.07px; color: var(--fn-noir); }   /* MAPPED BY etc. */
.fn-label-lg  { font-family: var(--fn-mono); font-size: 16px;  letter-spacing: 1.28px; color: var(--fn-davy); }    /* CONTENTS */
.fn-tag       { font-family: var(--fn-mono2); font-size: 14px; letter-spacing: 1.4px; color: var(--fn-davy); }     /* CH 01 · NAME */
.fn-script    { font-family: var(--fn-script); color: var(--fn-noir); }
.fn-mark      { background: var(--fn-highlight); padding: 2px 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- sidebar (identical position on every page) ---------- */
.fn-sidebar {
  position: fixed; left: var(--fn-gap); top: var(--fn-gap);
  width: 389px; height: calc(100vh - (2 * var(--fn-gap)));
  background: var(--fn-paper);
  border: var(--fn-stroke) solid var(--fn-noir);
  border-radius: var(--fn-r-sidebar);
  z-index: 10; overflow: hidden auto;   /* short screens scroll internally */
  overscroll-behavior: contain;         /* wheel stays in the sidebar, not the page */
}
/* real children are absolutely positioned, so an in-flow spacer is what
   gives the panel a scrollable content height on short screens */
.fn-sidebar::after { content: ''; display: block; height: 890px; }
.fn-sidebar .fn-logo { position: absolute; left: 89px; top: 35px; width: 178px; display: block; }
.fn-sidebar .fn-logo img { width: 100%; display: block; }
.fn-sidebar .fn-wordmark { position: absolute; left: 32px; top: 140.5px; width: 331.2px; }

/* mapped by / curated by credits */
.fn-credits { position: absolute; left: 34px; top: 202px; width: 320px; height: 76px; border-left: 1.97px solid var(--fn-noir); }
.fn-credits .row { position: absolute; left: 19px; width: 290px; }
.fn-credits .r1 { top: 11px; } .fn-credits .r2 { top: 49px; }
.fn-credits .lbl { font-family: var(--fn-mono); font-size: 13.4px; letter-spacing: 1.07px; color: var(--fn-noir); display: inline-block; }
.fn-credits .line { position: absolute; top: 16.8px; height: 1.26px; background: var(--fn-noir); }
.fn-credits .r1 .line { left: 97px; width: 131px; } .fn-credits .r2 .line { left: 97px; width: 137px; }
.fn-credits .script { position: absolute; top: -11px; font-family: var(--fn-script); font-size: 24px; color: var(--fn-noir); line-height: 1; }
.fn-credits .r1 .script { left: 125px; } .fn-credits .r2 .script { left: 128px; }

/* subscribe box */
.fn-subscribe { position: absolute; left: 26px; top: 320px; width: 340px; height: 157px; background: var(--fn-subscribe); border-radius: var(--fn-r-box); }
.fn-subscribe p { position: absolute; left: 32px; top: 26px; width: 280px; font-family: var(--fn-sans); font-size: 15px; line-height: 22px; color: #4E4E4E; }
.fn-subscribe .lbl { position: absolute; left: 32px; top: 86px; font-family: var(--fn-sans); font-size: 10px; font-weight: 500; letter-spacing: 2.2px; color: #6E6E6E; }
.fn-subscribe .row { position: absolute; left: 32px; top: 102px; width: 276px; height: 31px; display: flex; align-items: flex-end; gap: 14px; }
.fn-subscribe input { flex: 1; min-width: 0; border: none; background: none; outline: none; font-family: var(--fn-script); font-size: 19px; color: var(--fn-ink); padding: 2px 0 4px; border-bottom: 1.4px solid #2F2F2F; }
.fn-subscribe input::placeholder { color: #8A8A8A; }
.fn-subscribe button { width: 30px; height: 30px; border: none; background: none; cursor: pointer; font-family: var(--fn-sans); font-size: 19px; color: var(--fn-ink); display: grid; place-items: center; border-radius: 50%; transition: background .25s; }
.fn-subscribe button:hover { background: rgba(0,0,0,.07); }
.fn-subscribe .thanks { position: absolute; left: 32px; top: 96px; width: 276px; font-family: var(--fn-script); font-size: 18px; color: var(--fn-ink); display: none; }
.fn-subscribe.done .row, .fn-subscribe.done .lbl { display: none; }
.fn-subscribe.done .thanks { display: block; }

/* sidebar story list — full-width hover zone, square corners */
.fn-story-item { position: absolute; left: 1px; width: calc(100% - 2px); display: flex; gap: 20px; cursor: pointer; padding: 7px 20px; transition: background .25s ease; }
.fn-story-item:hover { background: rgba(0,0,0,.045); }
.fn-story-item .num { position: relative; width: 21px; height: 21px; margin: 5px 2px 0 3px; flex-shrink: 0; }
.fn-story-item .num img { position: absolute; inset: 0; width: 100%; transition: opacity .3s ease; }
.fn-story-item .num .red { opacity: 0; }
.fn-story-item.current .num .red { opacity: 1; }   /* red marker only marks the CURRENT story — never on hover */
.fn-story-item .content .title { font-family: var(--fn-sans); font-size: 17px; font-weight: 500; line-height: 25px; color: var(--fn-noir); white-space: nowrap; }
.fn-story-item .content .meta { display: flex; align-items: center; gap: 10px; font-family: var(--fn-sans); font-size: 15px; line-height: 25px; color: var(--fn-muted); white-space: nowrap; }
.fn-story-item .content .meta .div { width: 1px; height: 17px; background: var(--fn-hairline); flex-shrink: 0; }

/* ---------- nav pill (274px, fixed to the same right:24/top:24 on every page) ---------- */
.fn-topnav { position: fixed; right: var(--fn-gap); top: var(--fn-gap); z-index: 20; width: 274px; display: flex; align-items: center; justify-content: center; gap: 27px; padding: 8px 16px; background: var(--fn-paper); border: var(--fn-stroke) solid var(--fn-noir); border-radius: var(--fn-r-pill); }
.fn-topnav a { font-family: var(--fn-sans); font-size: 16px; line-height: 25px; letter-spacing: -.2px; color: var(--fn-mid); text-decoration: none; white-space: nowrap; }
.fn-topnav a.active, .fn-topnav a:hover { color: var(--fn-noir); }
.fn-topnav .div { width: 1px; height: 23px; background: var(--fn-mid); }

/* ---------- pill controls (zoom bar shape) ---------- */
.fn-pill { display: flex; align-items: center; justify-content: center; gap: 27px; padding: 8px 16px; background: var(--fn-paper); border: var(--fn-stroke) solid var(--fn-noir); border-radius: var(--fn-r-pill); }

/* ---------- share pills (icon → expands to reveal label on hover; no color change) ---------- */
.fn-share { display: flex; justify-content: space-between; align-items: flex-start; }
.fn-share .pill { height: 40px; display: flex; align-items: center; flex-shrink: 0; border: var(--fn-stroke) solid var(--fn-noir); border-radius: 1000px; background: none; padding: 10px; cursor: pointer; transition: padding .3s ease; }
.fn-share .pill img { width: 20px; height: 20px; flex-shrink: 0; }
.fn-share .pill .lbl { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; font-family: var(--fn-sans); font-size: 14px; line-height: 19.8px; color: var(--fn-mid); margin-left: 0; transition: max-width .3s ease, opacity .25s ease, margin-left .3s ease; }
.fn-share .pill:hover, .fn-share .pill.copied { padding: 8px 12px; }
.fn-share .pill:hover .lbl, .fn-share .pill.copied .lbl { max-width: 80px; opacity: 1; margin-left: 8px; }

/* ---------- table of contents (article rail) ---------- */
.fn-contents .label { font-family: var(--fn-mono); font-size: 16px; letter-spacing: 1.28px; color: var(--fn-davy); margin-bottom: 20px; }
.fn-contents .sec { display: flex; gap: 10px; align-items: baseline; margin-bottom: 14px; cursor: pointer; }
.fn-contents .sec:last-child { margin-bottom: 0; }
.fn-contents .num { font-family: var(--fn-mono2); font-size: 15px; color: var(--fn-silver); transition: color .25s; }
.fn-contents .sec-title { font-family: var(--fn-sans); font-size: 16px; line-height: 25px; letter-spacing: -.2px; color: var(--fn-quick); transition: color .25s; }
.fn-contents .sec:hover .num, .fn-contents .sec:hover .sec-title,
.fn-contents .sec.active .num, .fn-contents .sec.active .sec-title { color: #212124; }

/* ---------- article footer band ---------- */
.fn-footer .rule { flex: 1; height: 1px; background: #D9D9D9; }
.fn-footer .fmono { font-family: var(--fn-mono2); font-size: 14px; letter-spacing: .7px; color: var(--fn-davy); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .fn-reduce-motion * { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Mobile chrome — header (wordmark + hamburger), full-screen menu,
   map watermark. Desktop (≥768px) never sees any of this.
   Markup contract: .fnm-head (+.fnm-solid on scrolling pages),
   .fnm-watermark, #fnm-menu with .fnm-nav / .fnm-div / .fnm-story.
   ===================================================================== */
.fnm-head, .fnm-watermark, .fnm-menu { display: none; }

@media (max-width: 767px) {
  .fnm-head { display: block; }
  /* scrolling pages get a solid paper bar behind the fixed header */
  .fnm-head.fnm-solid::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0; height: 84px;
    background: var(--fn-paper); z-index: 58;
    border-bottom: var(--fn-stroke) solid rgba(25,33,39,.25);
  }
  .fnm-wordmark { position: fixed; left: 24px; top: 32px; width: clamp(130px, 37vw, 162px); z-index: 60; display: block; }
  .fnm-wordmark img { width: 100%; display: block; }
  .fnm-burger {
    position: fixed; right: 24px; top: 25px; z-index: 110;  /* stays above the menu */
    width: 47px; height: 47px; padding: 0;
    border: 0.8px solid var(--fn-noir); border-radius: 50%;
    background: var(--fn-paper); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5.2px;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  }
  .fnm-burger span {
    display: block; width: 23px; height: 0.8px; border-radius: 1px; background: var(--fn-noir);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1), opacity .2s ease;
  }
  /* open: lines fold into an × while the button quarter-turns */
  .fnm-burger.open { transform: rotate(90deg); }
  .fnm-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .fnm-burger.open span:nth-child(2) { opacity: 0; transform: scaleX(.3); }
  .fnm-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .fnm-close { display: none; }  /* the morphing burger is the close button */

  /* gray levelpath watermark, map page only */
  .fnm-watermark {
    display: block; position: fixed; left: 24px; bottom: 34px; width: 104px;
    opacity: .38; z-index: 5; pointer-events: none;
  }

  /* full-screen menu */
  .fnm-menu {
    display: block; position: fixed; inset: 0; z-index: 100;
    background: var(--fn-paper);
    opacity: 0; pointer-events: none; transition: opacity .22s ease;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .fnm-menu.open { opacity: 1; pointer-events: auto; }
  .fnm-menu .fnm-wordmark { position: absolute; }
  .fnm-inner { padding: 104px 24px 120px; }
  .fnm-nav a {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--fn-sans); font-size: 15px; line-height: 20px;
    letter-spacing: -.2px; color: var(--fn-noir); text-decoration: none;
    margin-bottom: 21px;
  }
  .fnm-nav a img { width: 13px; height: 15px; }
  .fnm-nav a.active { font-weight: 600; }
  .fnm-div { border: none; height: 1px; background: #B5B5B5; margin: 36px 0 39px; }
  .fnm-story { display: block; text-decoration: none; margin-bottom: 30px; }
  .fnm-story .t {
    font-family: var(--fn-sans); font-size: 15px; font-weight: 500;
    line-height: 20px; letter-spacing: -.2px; color: var(--fn-noir); margin-bottom: 4px;
  }
  .fnm-story .m {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--fn-sans); font-size: 15px; line-height: 25px;
    letter-spacing: -.2px; color: var(--fn-muted); white-space: nowrap;
  }
  .fnm-story .m i { width: 1px; height: 17px; background: var(--fn-hairline); }
  .fnm-menu .fnm-logo {
    position: absolute; left: 24px; bottom: 34px; width: 104px; opacity: .5;
  }
  .fnm-menu .fn-legal { position: absolute; left: 24px; bottom: 78px; }
  /* the desktop sidebar/footer copies are hidden on phones — the menu carries it */
  #sidebar .fn-legal, #legal-band { display: none; }
}

/* =====================================================================
   Legal links — Privacy Policy + Cookie Settings.
   "Cookie Settings" opens the Usercentrics preference centre, which is
   the opt-out path when the banner is suppressed for a region.
   Markup: <p class="fn-legal"><a href=...>Privacy Policy</a>
             <span>·</span><button type="button" data-cookie-settings>…
   ===================================================================== */
.fn-legal {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: 'Outfit', sans-serif;
  font-size: 12px; font-weight: 400; letter-spacing: -0.1px;
  color: var(--fn-mid, #737373);
}
.fn-legal a,
.fn-legal button {
  font: inherit; color: inherit; text-decoration: none;
  background: none; border: none; padding: 0; cursor: pointer;
}
.fn-legal a:hover,
.fn-legal button:hover { color: var(--fn-noir, #192127); text-decoration: underline; }
.fn-legal .sep { opacity: .55; }
