/* ============================================================================
 * shared.css — common UI primitives across all Budget Papers pages.
 * Single source of truth for: about modal, mobile dropdowns, share button,
 * share toast, footer freshness line. CSS variables (--ink, --paper, etc.)
 * are defined per-page so each page controls its own theme.
 * ========================================================================== */

/* ── STYLISED TOOLTIP ─────────────────────────────────────────────────────── */
/* Site-wide hover tooltip for control buttons (the look used by the spend-filter
   pills). Any element with data-tip gets it, EXCEPT .asl-info / [data-asl-tip],
   which use the JS multi-line tooltip on the app pages. Replaces native title=. */
/* Dark theme lives on <html> (set synchronously in each page's <head> before
   first paint) to avoid a flash of light when navigating in dark mode. Paint the
   root dark immediately so even the pre-<body> frame isn't white. */
html.dark{background:#141210}

[data-tip]:not(.asl-info):not([data-asl-tip]){position:relative}
[data-tip]:not(.asl-info):not([data-asl-tip]):hover::after{
  content:attr(data-tip);position:absolute;top:calc(100% + 6px);left:50%;
  transform:translateX(-50%);background:var(--ink);color:var(--paper);
  font-family:'IBM Plex Mono',monospace;font-size:0.62rem;line-height:1.45;
  letter-spacing:0.02em;padding:0.3rem 0.6rem;border-radius:3px;
  width:max-content;max-width:230px;white-space:normal;text-align:center;
  pointer-events:none;z-index:9999;box-shadow:0 2px 8px #00000033
}

/* ── MASTHEAD NAV: "More" dropdown + mobile grid ──────────────────────────── */
/* The "More" button holds secondary/overflow pages (How Budgets Work, Data).
   On mobile the whole nav becomes an even 2-column grid (rows of 2 / 2 / 1). */
/* Vertically centre every nav item so the "More" button lines up with the links.
   The wrapper is itself a flex box that centres the button, so even a stray
   line-height/padding difference can't push "More" out of line with the links. */
.masthead-nav{align-items:center}
.nav-more{position:relative;display:inline-flex;align-items:center}
/* Match the nav links exactly (same box) so the button sits in line with them. */
.nav-more-btn{font-family:'IBM Plex Mono',monospace;font-size:0.62rem;line-height:1.6;color:var(--ink3);background:none;letter-spacing:0.04em;border:1px solid var(--rule);padding:0.18rem 0.5rem;border-radius:3px;cursor:pointer;transition:all 0.15s;white-space:nowrap;display:inline-block}
.nav-more-btn:hover,.nav-more.open .nav-more-btn{background:var(--ink);color:var(--paper);border-color:var(--ink)}
.nav-more.cur .nav-more-btn{background:var(--ink2);color:var(--paper);border-color:var(--ink2)}
.nav-more-menu{display:none;position:absolute;top:calc(100% + 4px);left:0;background:var(--paper);border:1px solid var(--rule);border-radius:4px;box-shadow:0 6px 24px #00000022;z-index:600;min-width:150px;flex-direction:column;padding:4px}
html.dark .nav-more-menu{box-shadow:0 6px 24px #00000066}
.nav-more.open .nav-more-menu{display:flex}
.nav-more-menu a{font-family:'IBM Plex Mono',monospace;font-size:0.66rem;color:var(--ink2);text-decoration:none;letter-spacing:0.04em;padding:0.42rem 0.6rem;border-radius:3px;white-space:nowrap}
.nav-more-menu a:hover{background:var(--paper2);color:var(--ink)}
.nav-more-menu a.current{color:var(--orange)}
@media(max-width:640px){
  .masthead-nav{display:grid!important;grid-template-columns:1fr 1fr;gap:0.4rem;width:100%}
  .masthead-nav > a{text-align:center}
  /* "More" spans the full width on its own row, with a full-width dropdown.
     Match the bigger mobile tap-target padding/font the page gives its links. */
  .masthead-nav .nav-more{display:block;width:100%;grid-column:1 / -1}
  .nav-more-btn{width:100%;text-align:center;padding:0.4rem 0.7rem;font-size:0.72rem;line-height:1.6}
  .nav-more-menu{left:0;right:0;min-width:0}
}

/* ── SECTION HEADINGS (high-level dividers in Q&A / explainer pages) ───────── */
/* Quiet uppercase mono kicker — same treatment as the "Sources & references"
   label. Groups explainer content into sections (home page + How It Works). */
.explainer-group{font-family:'IBM Plex Mono',monospace;font-size:0.6rem;font-weight:400;letter-spacing:0.12em;text-transform:uppercase;color:var(--ink3);margin:2.4rem 0 0.9rem;line-height:1.4}
.explainer-group:first-child{margin-top:0}
/* Explanatory sentence(s) that sit directly under a section label, before the
   data/list/chips below it. Prefer this over jumping straight from a label to
   bare data — it gives the section flow. (See CLAUDE.md style guide §8.) */
.section-intro{font-family:'Source Serif 4',Georgia,serif;font-size:0.85rem;font-weight:300;color:var(--ink2);line-height:1.6;margin:0 0 1rem}

/* Content heading tiers (written / Q&A pages). Three levels live *below* the
   page's single <h1> hero. Prominence descends H1 › H2 › H3 even though the
   label tiers are smaller than body text — caps + tracking read as headings
   (the eyebrow pattern). See CLAUDE.md style guide §4.
     H1  .explainer-group  mono caps kicker     e.g. "About Budget Papers"
     H2  .explainer-q      Space Grotesk 700    e.g. "What is Budget Papers?"
     H3  .subhead          serif caps label     e.g. "Commonwealth" */
.subhead{font-family:'Source Serif 4',Georgia,serif;font-size:0.82rem;font-weight:700;letter-spacing:-0.01em;color:var(--ink);margin:0 0 0.4rem;line-height:1.35}

/* Inline code / data excerpts — column names, ids, keys, JSON paths. A small
   monospace chip. (See CLAUDE.md style guide §7.) */
code{font-family:'IBM Plex Mono',monospace;font-size:0.88em;background:var(--paper3);color:var(--ink2);padding:0.08em 0.36em;border-radius:3px}

/* ── ABOUT BUTTON ─────────────────────────────────────────────────────────── */
.about-btn{background:none;border:1px solid var(--rule);padding:0.2rem 0.6rem;font-family:'IBM Plex Mono',monospace;font-size:0.62rem;color:var(--ink3);border-radius:3px;cursor:pointer;letter-spacing:0.04em;transition:all 0.15s;display:inline-flex;align-items:center;gap:0.3rem}
.about-btn:hover{background:var(--ink);color:var(--paper);border-color:var(--ink)}

/* ── ABOUT MODAL ──────────────────────────────────────────────────────────── */
.about-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;z-index:9000;padding:1rem}
.about-modal{background:var(--paper);border:1.5px solid var(--rule);border-radius:8px;max-width:500px;width:100%;padding:1.8rem 2rem;position:relative;max-height:90vh;overflow-y:auto;box-shadow:0 8px 40px rgba(0,0,0,0.2)}
html.dark .about-modal{box-shadow:0 8px 40px rgba(0,0,0,0.6)}
.about-close{position:absolute;top:0.9rem;right:1rem;background:none;border:none;font-size:1rem;cursor:pointer;color:var(--ink3);line-height:1;padding:0.2rem 0.3rem;border-radius:3px;transition:color 0.15s}
.about-close:hover{color:var(--ink)}
.about-title{font-family:'Space Grotesk',sans-serif;font-size:1.3rem;font-weight:700;letter-spacing:-0.02em;margin-bottom:1rem;padding-right:2rem}
.about-body{font-size:0.85rem;line-height:1.7;color:var(--ink2)}
.about-body p{margin-bottom:0.8rem}
.about-body p:last-child{margin-bottom:0}
.about-rule{border:none;border-top:1px solid var(--rule);margin:1.2rem 0}
.about-feedback-label{font-family:'IBM Plex Mono',monospace;font-size:0.6rem;letter-spacing:0.12em;text-transform:uppercase;color:var(--ink3);margin-bottom:0.6rem}
.about-form{display:flex;flex-direction:column;gap:0.6rem;margin-top:0.7rem}
.about-form input,.about-form textarea{border:1px solid var(--rule);background:var(--paper2);color:var(--ink);font-family:'Source Serif 4',serif;font-size:0.82rem;padding:0.45rem 0.65rem;border-radius:4px;outline:none;transition:border-color 0.15s;resize:vertical;width:100%}
.about-form input:focus,.about-form textarea:focus{border-color:var(--ink3)}
.about-form textarea{min-height:90px}
.about-form-submit{align-self:flex-start;background:var(--ink);color:var(--paper);border:none;padding:0.4rem 1rem;font-family:'IBM Plex Mono',monospace;font-size:0.7rem;border-radius:3px;cursor:pointer;letter-spacing:0.04em;transition:opacity 0.15s}
.about-form-submit:hover{opacity:0.8}

/* ── MOBILE DROPDOWNS ─────────────────────────────────────────────────────── */
/* Used on narrow viewports where the pill button rows would overflow. */
.jur-mobile-select,.grp-mobile-select{display:none;border:1px solid var(--rule);background:var(--paper2);color:var(--ink);font-family:'IBM Plex Mono',monospace;font-size:0.72rem;padding:0.25rem 1.6rem 0.25rem 0.7rem;border-radius:3px;cursor:pointer;outline:none;-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6b6b'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 0.5rem center}
html.dark .jur-mobile-select,html.dark .grp-mobile-select{background-color:var(--paper2);color:var(--ink);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7870'/%3E%3C/svg%3E")}

/* ── NOTICE BANNER ────────────────────────────────────────────────────────── */
/* Reusable, body-text notification strip. Blue (never the brand orange, which is
   reserved for accents). Used for the Compare intro and the Data caveat. Layout
   is neutral — the host page positions it (margins / max-width container).
   Markup:
     <div class="notice">
       <span class="notice-icon">&#9432;</span>
       <span class="notice-text">… <b>emphasis</b> …</span>
       <button class="notice-close">&times;</button>   (optional, page wires dismiss)
     </div> */
.notice{display:flex;align-items:flex-start;gap:0.55rem;padding:0.7rem 0.9rem;border-radius:6px;font-family:'Source Serif 4',Georgia,serif;font-size:0.8rem;line-height:1.5;background:#e9f0f6;border:1px solid #a8c0d8;color:#274867}
html.dark .notice{background:#152028;border-color:#3a5060;color:#90b0ce}
.notice-icon{font-weight:700;flex-shrink:0;line-height:1.5}
.notice-text{flex:1}
/* Notices are never bolded — bold reads as an error/alert and muddies the calm
   informational tone. Any stray <b>/<strong> is neutralised to body weight. */
.notice-text b,.notice-text strong{font-weight:400}
.notice-text a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.notice-close{background:none;border:none;color:inherit;opacity:0.6;cursor:pointer;font-size:1.1rem;line-height:1;padding:0 0.2rem;flex-shrink:0}
.notice-close:hover{opacity:1}

/* ── SHARE TOAST ──────────────────────────────────────────────────────────── */
/* Floating confirmation after Share is clicked. Auto-hides via JS. */
.share-toast{position:fixed;bottom:1.4rem;left:50%;transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--paper);font-family:'IBM Plex Mono',monospace;font-size:0.72rem;letter-spacing:0.04em;padding:0.55rem 1rem;border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,0.3);opacity:0;pointer-events:none;transition:opacity 0.2s,transform 0.2s;z-index:9500;white-space:nowrap}
.share-toast.visible{opacity:1;transform:translateX(-50%) translateY(0)}

/* ── FOOTER FRESHNESS LINE ────────────────────────────────────────────────── */
.data-fresh{font-family:'IBM Plex Mono',monospace;font-size:0.62rem;color:var(--ink3);letter-spacing:0.04em;margin-top:0.2rem}
.data-fresh strong{font-weight:500;color:var(--ink2)}

/* ── RECENTLY VIEWED STRIP ────────────────────────────────────────────────── */
/* Horizontal pills above the footer. Hidden when empty. */
.recents-strip{display:flex;flex-wrap:wrap;align-items:center;gap:0.4rem;padding:0.7rem 2rem;border-top:1px solid var(--rule);background:var(--paper2);font-family:'IBM Plex Mono',monospace}
.recents-label{font-size:0.6rem;letter-spacing:0.12em;text-transform:uppercase;color:var(--ink3);margin-right:0.4rem;flex-shrink:0}
.recents-chip{display:inline-flex;align-items:center;gap:0.35rem;background:var(--paper);border:1px solid var(--rule);border-radius:3px;padding:0.18rem 0.3rem 0.18rem 0.35rem;text-decoration:none;color:var(--ink2);font-size:0.7rem;cursor:pointer;transition:background 0.15s,border-color 0.15s,color 0.15s;max-width:220px;line-height:1.4}
.recents-chip:hover{background:var(--ink);color:var(--paper);border-color:var(--ink)}
.recents-chip:hover .recents-chip-x{color:var(--paper);opacity:0.7}
.recents-chip-jur{display:inline-flex;align-items:center;justify-content:center;font-size:0.54rem;font-weight:600;color:#fff;padding:0.05rem 0.3rem;border-radius:2px;letter-spacing:0.06em;flex-shrink:0;line-height:1.4}
.recents-chip-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px}
.recents-chip-x{background:none;border:none;color:var(--ink3);font-size:0.85rem;line-height:1;cursor:pointer;padding:0 0.15rem;margin-left:0.15rem;border-radius:2px;transition:opacity 0.15s;opacity:0.6}
.recents-chip-x:hover{opacity:1}
@media(max-width:640px){
  .recents-strip{padding:0.55rem 1rem;gap:0.35rem}
  .recents-chip{max-width:160px}
  .recents-chip-name{max-width:100px}
}
