/* ============================================================================
   THE GUIDE - "About this page", "Where the data comes from" and the glossary,
   one dialog (js/guide.js) plus the (i) beside every page title. Prefix gd-.

   TOKENS ONLY. Every colour is a theme-aware token (--ok-ink on --ok-weak and the
   rest are declared for both themes in base.css), so there is nothing to declare
   twice for dark mode here. Nothing in this file animates: the dialog's own entrance
   is motion.css's `.modal.fade .modal-dialog`, which already honours
   prefers-reduced-motion, and a status mark that pulsed would be a second claim
   about freshness that nothing measured.

   A STATUS IS A SHAPE AND A WORD. The mark carries an icon and its word; the
   colour is a third signal, never the only one. `live` is the only one that uses
   the "ok" family and `behind` the only one that uses "warn", so neither is
   borrowed for decoration.
   ============================================================================ */

/* ==================== THE (i) BESIDE THE TITLE ==================== */
/* Sits inside the h1's flex row (layout.css), so it is 1.25rem (20px; 25px when the root
   scales to 20px from 1920 tall) in a 21px (25.5px) row and adds no height to the bar
   every sticky offset in this app is measured against. The hit area is larger than the
   glyph: an invisible ::before grows it by .3rem a side without taking any layout. */
.gd-about {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.25rem; height: 1.25rem;
    margin: 0 0 0 .4rem; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    font-size: var(--fs-md); line-height: 1;
    cursor: pointer;
}
.gd-about[hidden] { display: none; }
.gd-about::before { content: ''; position: absolute; inset: -.3rem; }
.gd-about:hover { color: var(--accent-ink); background: var(--accent-weak); }
.gd-about:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ==================== THE DIALOG ==================== */
.gd-head { flex-wrap: wrap; row-gap: var(--sp-4); align-items: center; }
.gd-head .modal-title { flex: 1 1 auto; font-size: var(--fs-xl); font-weight: var(--fw-bold); }

.gd-tabs { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.gd-tab {
    display: inline-flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text-soft);
    font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: var(--lh-snug);
    cursor: pointer;
}
.gd-tab:hover { color: var(--text); border-color: var(--accent-line); }
.gd-tab.is-on { background: var(--accent-weak); border-color: var(--accent-line); color: var(--accent-ink); }
.gd-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gd-body { padding: var(--sp-7) var(--sp-8); }

/* ---- running text ---- */
.gd-lede, .gd-purpose {
    margin: 0 0 var(--sp-6);
    color: var(--text); font-size: var(--fs-md); line-height: var(--lh-prose);
}
.gd-purpose { font-size: var(--fs-lg); font-weight: var(--fw-medium); line-height: var(--lh-normal); }
.gd-h {
    margin: var(--sp-7) 0 var(--sp-4);
    font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: var(--lh-snug);
    color: var(--text);
}
.gd-purpose + .gd-h { margin-top: var(--sp-6); }
.gd-sub { margin: var(--sp-3) 0 0; color: var(--text-soft); font-size: var(--fs-sm); line-height: var(--lh-normal); }
.gd-end { margin-top: var(--sp-7); }
.gd-plain { margin: var(--sp-3) 0 0; color: var(--text); font-size: var(--fs-md); line-height: var(--lh-normal); }

/* A link-looking button: it moves within the dialog, it does not navigate. */
.gd-link {
    padding: 0; border: 0; background: none;
    color: var(--accent-ink); font: inherit; text-decoration: underline; text-underline-offset: 2px;
    cursor: pointer;
}
.gd-link:hover { color: var(--text); }
.gd-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ==================== ABOUT THIS PAGE ==================== */
.gd-read { margin: 0; }
.gd-read-i { padding: var(--sp-4) 0; border-top: 1px solid var(--border-soft); }
.gd-read-i:first-child { border-top: 0; padding-top: 0; }
.gd-read-i dt { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); }
.gd-read-i dd { margin: 0; font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--text); }
.gd-basis { display: block; margin-top: var(--sp-2); color: var(--text-soft); font-size: var(--fs-sm); line-height: var(--lh-normal); }

.gd-not, .gd-tips { margin: 0; padding-left: 1.15rem; }
.gd-not li, .gd-tips li { margin: 0 0 var(--sp-3); font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--text); }
.gd-not li::marker { color: var(--warn); }
.gd-tips li::marker { color: var(--accent); }

/* The page's own sources: one button row each, opening that row in the Sources view. */
.gd-from { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-3); }
.gd-from-b {
    width: 100%;
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5);
    padding: var(--sp-4) var(--sp-5);
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
    font-size: var(--fs-md); text-align: left; cursor: pointer;
}
.gd-from-b:hover { border-color: var(--accent-line); background: var(--surface-2); }
.gd-from-b:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gd-from-n { flex: 1 1 14rem; font-weight: var(--fw-medium); }
.gd-from-d, .gd-from-wait { color: var(--text-soft); font-size: var(--fs-sm); }
.gd-from-b > .bi { color: var(--text-soft); }

.gd-terms { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.gd-term {
    padding: var(--sp-2) var(--sp-5);
    border: 1px solid var(--accent-line); border-radius: 999px;
    background: var(--accent-weak); color: var(--accent-ink);
    font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer;
}
.gd-term:hover { color: var(--text); }
.gd-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The keyboard section: read from the shortcuts registry, drawn with its key caps
   (.sc-key, shortcuts.css). */
.gd-kb { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--sp-6) var(--sp-8); margin-top: var(--sp-4); }
.gd-kb-g h4 { margin: 0 0 var(--sp-3); font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); }
.gd-kb-g dl { margin: 0; }
.gd-kb-g dl > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: var(--sp-5); padding: var(--sp-3) 0; border-top: 1px solid var(--border-soft); }
.gd-kb-g dl > div:first-child { border-top: 0; }
.gd-kb-g dt { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.gd-kb-g dd { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--text); }
.gd-or, .gd-plus { color: var(--text-soft); font-size: var(--fs-xs); }

/* ==================== WHERE THE DATA COMES FROM ==================== */
.gd-fresh {
    margin: 0 0 var(--sp-6); padding: var(--sp-5) var(--sp-6);
    border: 1px solid var(--accent-line); border-left-width: 3px; border-radius: var(--r-sm);
    background: var(--accent-weak); color: var(--text);
    font-size: var(--fs-md); line-height: var(--lh-normal);
}
.gd-fresh b { color: var(--accent-ink); }

.gd-legend { margin: 0 0 var(--sp-4); padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: var(--sp-3) var(--sp-7); }
.gd-legend li { display: flex; align-items: flex-start; gap: var(--sp-4); color: var(--text-soft); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.gd-legend .gd-st { flex: 0 0 auto; }

.gd-rows { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-5); }
.gd-src {
    padding: var(--sp-5) var(--sp-6);
    border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--r-sm);
    background: var(--surface);
}
/* The left rule repeats the status, and the mark in the header says it in words. */
.gd-src.is-live { border-left-color: var(--ok); }
.gd-src.is-behind { border-left-color: var(--warn); }
.gd-src.is-extract { border-left-color: var(--text-dim); }
.gd-src.is-none, .gd-src.is-restricted, .gd-src.is-unreadable { border-left-style: dashed; border-left-color: var(--text-dim); }
/* The row a link pointed at. A static ring, no animation. */
.gd-src.is-mark { box-shadow: 0 0 0 2px var(--accent-line); }
.gd-gloss-i.is-mark { background: var(--accent-weak); box-shadow: 0 0 0 6px var(--accent-weak); border-radius: var(--r-sm); }

.gd-src-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-5); }
.gd-src-h b { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }

.gd-meta { margin: var(--sp-3) 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-8); }
.gd-meta > div { display: flex; flex-direction: column; gap: 0; }
.gd-meta dt { color: var(--text-soft); font-size: var(--fs-xs); font-weight: var(--fw-normal); }
.gd-meta dd { margin: 0; color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-medium); }

.gd-feeds { margin: var(--sp-4) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-soft); }
.gd-feeds > span { margin-right: var(--sp-2); font-weight: var(--fw-medium); }
.gd-feeds > em {
    font-style: normal;
    padding: var(--sp-1) var(--sp-4);
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2); color: var(--text-soft);
}

/* ---- the status mark: an icon and a word, tinted ---- */
.gd-st {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-4);
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2); color: var(--text-soft);
    font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: var(--lh-snug);
    white-space: nowrap;
}
.gd-st > .bi { font-size: var(--fs-2xs); }
.gd-st.is-live     { background: var(--ok-weak);   border-color: var(--ok-line);   color: var(--ok-ink); }
.gd-st.is-behind   { background: var(--warn-weak); border-color: var(--warn-line); color: var(--warn-ink); }
.gd-st.is-extract  { background: var(--surface-2); border-color: var(--border);    color: var(--text); }
.gd-st.is-none, .gd-st.is-restricted, .gd-st.is-unreadable { background: transparent; border-style: dashed; color: var(--text-soft); }

/* ==================== GLOSSARY ==================== */
.gd-gloss { margin: 0; }
.gd-gloss-i { padding: var(--sp-5) 0; border-top: 1px solid var(--border-soft); }
.gd-gloss-i:first-child { border-top: 0; padding-top: 0; }
.gd-gloss dt { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }
.gd-gloss dd { margin: 0; font-size: var(--fs-md); line-height: var(--lh-prose); color: var(--text); }

/* ==================== EXPRESS: THE THREE NUMBERS ====================
   The glossary entry about fee, gross advanced and funded carries, when the reader came from a page that registered them,
   that page's own figures (js/guide.js setExpress). Tokens only; both themes come with the tokens. */
.gd-ex {
    margin: var(--sp-5) 0 0; padding: var(--sp-5) var(--sp-6);
    border: 1px solid var(--accent-line); border-left-width: 3px; border-radius: var(--r-sm);
    background: var(--accent-weak);
}
.gd-ex-h { margin: 0 0 var(--sp-4); font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); }
.gd-ex-l { margin: 0; display: grid; gap: var(--sp-4); }
.gd-ex-l > div { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: var(--sp-5); align-items: baseline; }
.gd-ex-l dt { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text); }
.gd-ex-l dd { margin: 0; display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--text-soft); line-height: var(--lh-snug); }
.gd-ex-l dd b { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text); line-height: var(--lh-tight); }

/* The small link every page that prints an Express money figure carries (a [data-gd-express] button;
   one delegated listener in guide.js opens the entry). `.on-dark` is for a dark band, where the ink is
   the shell ink and underlined - gold is spent on the band's one figure. */
.gd-xlink {
    display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none;
    color: var(--accent-ink); font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: var(--lh-snug);
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left;
}
.gd-xlink:hover { color: var(--text); }
.gd-xlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.gd-xlink.on-dark { color: var(--shell-ink); }
.gd-xlink.on-dark:hover { color: var(--shell-ink); text-decoration-thickness: 2px; }
.gd-xlink.on-dark:focus-visible { outline-color: var(--gold-300); }
