/* The lineage explorer's own styles, shared by its standalone page
   (/lineage, lineage.html) and the Lineage tab of the legislation page
   (legislative.html #panel-lineage). Every rule is scoped under .lineage-app
   so none of them can restyle the rest of the legislation page, whose own
   .pill/.hint/.row/button rules differ. Page chrome (body, header, footer,
   the theme toggle, the skip link) stays in each page's own <style>. */

.lineage-app section { background:var(--panel); border:1px solid var(--border);
          border-radius:8px; padding:16px 18px; margin-bottom:18px; }
/* Inside the legislation page's tab panel, which is already the card: the
   explorer's own views sit flat in it instead of nesting a second card. */
.tab-panel .lineage-app section { background:none; border:0; border-radius:0;
          padding:0; margin:0 0 6px; }
.lineage-app h2 { font-size:13px; text-transform:uppercase; letter-spacing:1.2px;
     color:var(--gold); margin:0 0 12px; }
.lineage-app h3 { font-size:12.5px; color:var(--text); margin:16px 0 8px; }
.lineage-app .hint { color:var(--faint); font-size:11.5px; margin-top:8px; }
.lineage-app .hint:first-child { margin-top:0; }
.lineage-app .hint code { color:var(--muted); }
.lineage-app .hint a { color:var(--gold); }
/* WCAG 2.5.8: an inline back link ("← All templates") measured well under
   24px tall at the .hint font's own line-height, so it is padded to a real
   24px hit box. */
.lineage-app .hint a[data-nav] { display:inline-flex; align-items:center; min-height:24px; }
/* An assertion worth reading as distinct from plain .hint text ("credited
   to", "no catalogued template"), never coloured to imply certainty. */
.lineage-app .claim { font-size:12.5px; color:var(--text); margin:8px 0;
         padding-left:10px; border-left:2px solid var(--gold); }
.lineage-app a { color:inherit; }
.lineage-app .row { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
.lineage-app label { display:flex; flex-direction:column; gap:3px; font-size:11.5px;
        color:var(--muted); }
.lineage-app input, .lineage-app select, .lineage-app button {
  background:var(--panel2); color:var(--text); font:inherit;
  border:1px solid var(--control-border); border-radius:5px;
  padding:7px 10px; max-width:100%; }
.lineage-app input:focus, .lineage-app select:focus, .lineage-app button:focus-visible {
  outline:1px solid var(--pro); }
.lineage-app button { cursor:pointer; min-height:24px; }
.lineage-app button.primary { background:var(--pro); color:var(--on-pro); font-weight:600;
                 border-color:var(--pro); }

/* ---- pills / tags (legislative.html's palette, verbatim) ---- */
.lineage-app .pill { display:inline-block; font-size:10.5px; padding:1px 8px;
        border-radius:9px; white-space:nowrap; font-weight:600;
        border:1px solid var(--border-strong); color:var(--muted);
        margin-left:6px; }
.lineage-app .pill.enacted { background:var(--gold-fill); color:var(--on-gold);
                border-color:var(--gold-fill); }
.lineage-app .pill.failed { color:var(--faint); }
.lineage-app .pill.vetoed { color:var(--blue); border-color:var(--blue); }
.lineage-app .pill.pending { color:var(--gold); border-color:var(--gold); }
.lineage-app .pill.kind-document { color:var(--pro); border-color:var(--pro); }
.lineage-app .pill.kind-exemplar { color:var(--gold); border-color:var(--gold); }

/* ---- index: template/family cards ---- */
.lineage-app .fam-group { margin-bottom:14px; }
.lineage-app .fam-group h3 { text-transform:uppercase; letter-spacing:.6px;
                font-size:11px; color:var(--faint); margin:14px 0 6px; }
.lineage-app .tcard { display:block; border:1px solid var(--border); border-left:3px solid var(--gold);
         border-radius:6px; padding:9px 12px; margin-bottom:8px;
         background:var(--panel2); text-decoration:none; color:var(--text); }
.lineage-app .tcard:hover { border-color:var(--gold); }
.lineage-app .tcard-name { font-weight:700; font-size:13px; }
.lineage-app .tcard-name .fam-id { font-weight:400; font-size:11.5px; color:var(--faint); margin-left:4px;
                                   font-variant-numeric:tabular-nums; }
.lineage-app .tcard-authors { color:var(--muted); font-size:11.5px; margin-top:2px; }
.lineage-app .tcard-meta { color:var(--faint); font-size:11px; margin-top:3px; }

/* ---- a bill line, reused in tiers / timelines / compare header ---- */
.lineage-app .member-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px,1fr));
               gap:8px; margin-top:8px; }
.lineage-app .lbill { border:1px solid var(--border); border-radius:6px; padding:8px 10px;
         background:var(--panel2); min-width:0; }
.lineage-app .lbk { font-weight:700; display:flex; align-items:baseline; gap:4px; flex-wrap:wrap; }
.lineage-app .lbk a { color:var(--text); text-decoration:none; border-bottom:1px dotted var(--muted);
         display:inline-flex; align-items:center; min-height:24px; }
.lineage-app .lbk a:hover { color:var(--gold); }
.lineage-app .lbt { color:var(--muted); font-size:11.5px; margin:2px 0; line-height:1.35;
       display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
       overflow:hidden; }
.lineage-app .lmeta { color:var(--faint); font-size:11px; }

/* ---- source note: document vs exemplar, deliberately different ---- */
.lineage-app .source-note { border:1px solid var(--border); border-radius:6px; padding:10px 14px;
               margin:10px 0; font-size:12.5px; color:var(--muted); overflow-wrap:anywhere; }
.lineage-app .source-note.document { border-left:3px solid var(--pro); }
.lineage-app .source-note.exemplar { border-left:3px solid var(--gold); }
.lineage-app .source-note strong { color:var(--text); }

/* ---- tier groups ---- */
.lineage-app .tier-group { margin-top:14px; }
.lineage-app .tier-note { color:var(--faint); font-weight:400; font-size:11px; text-transform:none;
             letter-spacing:0; }
.lineage-app .predates-group { border:1px solid var(--border); border-left:3px solid var(--gold);
                   border-radius:6px; padding:10px 14px; background:var(--panel2); }

/* ---- timeline (drawTimeline() in app/lineage.js): states as lanes, time
   left to right, drawn to fit the width it has -- no sideways scroll ---- */
.lineage-app .tl { position:relative; margin-top:8px; }
.lineage-app .tl-top { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
          gap:6px 16px; margin-bottom:8px; }
.lineage-app .tlegend { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap;
           gap:4px 16px; font-size:11.5px; color:var(--muted); }
.lineage-app .tlegend li { display:flex; align-items:center; gap:6px; }
.lineage-app .tkey { display:inline-block; flex-shrink:0; box-sizing:border-box; }
.lineage-app .tkey.dot { width:12px; height:12px; border-radius:50%; background:var(--pro); }
.lineage-app .tkey.bar { width:28px; height:8px; border-radius:4px; border:1.5px solid var(--pro);
            background:color-mix(in srgb, var(--pro) 20%, transparent); }
.lineage-app .tkey.dot.src { background:var(--gold); }
.lineage-app .tctl { display:flex; flex-wrap:wrap; gap:6px 14px; }
.lineage-app .tctl label { flex-direction:row; align-items:center; gap:6px; }
.lineage-app .tctl select { padding:3px 8px; min-height:28px; }
.lineage-app .tframe { border:1px solid var(--border); border-radius:8px; background:var(--panel2);
          padding:6px 10px; }
/* zero height, full width: the ResizeObserver watches this, never the plot,
   so a redraw that changes the plot's height cannot trigger another */
.lineage-app .tsizer { height:0; }
.lineage-app .tbody { position:relative; }
.lineage-app .trow { display:flex; gap:8px; }
/* 34px + the 8px gap = TL_LABEL + TL_GAP in app/lineage.js, and .tgrid's left */
.lineage-app .tlabel { width:34px; flex-shrink:0; font-size:11px; font-weight:700; color:var(--muted);
          text-align:right; line-height:24px; padding-top:2px; }
.lineage-app .taxis { position:relative; flex:1; height:18px; }
.lineage-app .taxis.two { height:32px; }
.lineage-app .tyear { position:absolute; top:1px; text-align:center; font-size:11px; font-weight:700;
         line-height:15px; color:var(--muted); white-space:nowrap; overflow:hidden; }
.lineage-app .tmon { position:absolute; top:17px; padding-left:3px; font-size:10px; line-height:13px;
        color:var(--faint); white-space:nowrap; }
.lineage-app .ttick { position:absolute; bottom:0; width:1px; height:4px; background:var(--border-strong); }
.lineage-app .ttick.q { height:7px; }
/* year bands (every other one shaded) and gridlines, behind the axis and
   every lane's track */
.lineage-app .tgrid { position:absolute; top:0; bottom:0; left:42px; right:0; pointer-events:none; }
.lineage-app .tband { position:absolute; top:0; bottom:0; background:var(--panel); opacity:.75; }
.lineage-app .tgl { position:absolute; top:0; bottom:0; border-left:1px solid var(--border-strong); }
.lineage-app .tgl.minor { border-left-style:dotted; opacity:.6; }
.lineage-app .tlane { position:relative; border-top:1px solid var(--border); }
.lineage-app .ttrack { position:relative; flex:1; }
/* A mark is a 24px-tall button, its hit box; what it draws is its ::before.
   The .lineage-app button rule's padding, border and fill are reset here. */
.lineage-app .tmark { position:absolute; height:24px; min-height:0; margin:0; padding:0; border:0;
         border-radius:0; background:none; cursor:pointer; z-index:1; }
.lineage-app .tmark.dot { width:24px; margin-left:-12px; }
.lineage-app .tmark::before { content:""; position:absolute; box-sizing:border-box; }
.lineage-app .tmark.dot::before { left:6px; top:6px; width:12px; height:12px; border-radius:50%;
          background:var(--pro); box-shadow:0 0 0 2px var(--panel2); }
.lineage-app .tmark.bar::before { left:var(--in, 0px); right:var(--in, 0px); top:8px; height:8px; border-radius:4px;
          border:1.5px solid var(--pro); background:color-mix(in srgb, var(--pro) 20%, transparent); }
.lineage-app .tmark.src.dot::before { background:var(--gold); }
.lineage-app .tmark.src.bar::before { border-color:var(--gold);
          background:color-mix(in srgb, var(--gold) 20%, transparent); }
/* "+N": bills folded into this mark when a state's lane is capped */
.lineage-app .tmore { position:absolute; left:15px; top:-3px; min-width:15px; height:15px; padding:0 3px;
         border-radius:8px; background:var(--text); color:var(--panel); font-size:9.5px; font-weight:700;
         line-height:15px; text-align:center; pointer-events:none; z-index:1; }
.lineage-app .tmark.bar .tmore { left:auto; right:-6px; }
.lineage-app .tmark:hover { z-index:2; }
.lineage-app .tmark.dot:hover::before { transform:scale(1.25); }
.lineage-app .tmark:focus-visible { outline:none; }
.lineage-app .tmark:focus-visible::before,
.lineage-app .tmark[aria-expanded="true"]::before { outline:2px solid var(--text); outline-offset:2px; }
/* a hover label, on pointer devices only (a tap opens the card instead) */
@media (hover:hover) and (pointer:fine) {
  .lineage-app .tmark:hover::after { content:attr(data-tip); position:absolute; bottom:100%; left:50%;
        transform:translateX(-50%); margin-bottom:2px; padding:3px 7px; border-radius:4px;
        background:var(--text); color:var(--panel); font-size:11px; line-height:1.3;
        white-space:nowrap; pointer-events:none; z-index:3; }
  .lineage-app .tmark.tip-l:hover::after { left:0; transform:none; }
  .lineage-app .tmark.tip-r:hover::after { left:auto; right:0; transform:none; }
  .lineage-app .tmark[aria-expanded="true"]:hover::after { content:none; }
}
/* the card a mark opens; openCard() in app/lineage.js places it */
.lineage-app .tlc { position:absolute; z-index:10; background:var(--panel); color:var(--text);
         border:1px solid var(--border-strong); border-radius:8px; padding:6px 12px 12px;
         box-shadow:0 8px 24px rgba(0,0,0,.22); font-size:12.5px; line-height:1.4; }
.lineage-app .tlc-head { display:flex; align-items:center; gap:8px; }
.lineage-app .tlc-key { font-weight:700; font-size:13.5px; color:var(--text);
             display:inline-flex; align-items:center; min-height:24px; }
.lineage-app .tlc-x { margin-left:auto; width:28px; height:28px; padding:0; border:0;
           background:none; font-size:18px; line-height:1; color:var(--muted); }
.lineage-app .tlc-x:hover { color:var(--text); }
.lineage-app .tlc-title { color:var(--muted); margin:0 0 6px; }
.lineage-app .tlc-when { font-weight:700; }
.lineage-app .tlc-note { font-weight:400; color:var(--muted); }
.lineage-app .tlc-meta { color:var(--muted); margin-top:3px; }
.lineage-app .tlc-meta a { color:var(--text); }
.lineage-app .tlc-src { margin-top:6px; padding-left:8px; border-left:2px solid var(--gold); }
.lineage-app .tlc-more { margin-top:10px; padding-top:8px; border-top:1px solid var(--border); }
.lineage-app .tlc-more ul { list-style:none; margin:4px 0 0; padding:0; max-height:180px; overflow-y:auto; }
.lineage-app .tlc-more li { display:flex; flex-wrap:wrap; align-items:center; gap:0 8px; }
.lineage-app .tlc-more a { color:var(--text); font-weight:600; display:inline-flex; align-items:center; min-height:24px; }
.lineage-app .tlc-more li span { color:var(--muted); }
.lineage-app .tlc-open { display:inline-flex; align-items:center; gap:6px; min-height:30px; margin-top:10px;
           padding:0 12px; border-radius:5px; background:var(--pro); color:var(--on-pro);
           font-weight:600; text-decoration:none; }

/* ---- compare picker ---- */
.lineage-app .compare-picker { margin-top:16px; padding-top:12px; border-top:1px solid var(--border); }
.lineage-app .cmp-inline select { min-width:200px; }

/* ---- comparison view ---- */
.lineage-app .cmp-head { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:8px; }
.lineage-app .cmp-head-side { border:1px solid var(--border); border-radius:6px; padding:10px 12px;
                 background:var(--panel2); min-width:0; }
.lineage-app .cmp-cols { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:14px; }
.lineage-app .cmp-col-head { font-size:10.5px; text-transform:uppercase; letter-spacing:.7px;
                color:var(--gold); font-family:ui-monospace,Menlo,Consolas,monospace; }
.lineage-app .cmp-body { display:flex; flex-direction:column; gap:2px; margin-top:6px; }
.lineage-app .cblock { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.lineage-app .cside { font-size:12.5px; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere;
         padding:6px 10px; border-radius:4px; }
.lineage-app .cblock.gap .cside { color:var(--muted); }
.lineage-app .cblock.match .cside { background:var(--gold-fill); color:var(--on-gold);
                        font-weight:600; border:1px solid var(--gold); }
/* Phones: the comparison stacks; two columns of running text at 375px would
   be unreadably narrow, and this keeps the page itself from scrolling
   sideways (the timeline scrolls in its own container instead). */
@media (max-width:640px) {
  .lineage-app .cmp-head, .lineage-app .cmp-cols, .lineage-app .cblock { grid-template-columns:1fr; }
  .lineage-app .cmp-cols { display:none; }
  .lineage-app .cside + .lineage-app .cside,
  .lineage-app .cblock .cside + .cside { margin-top:4px; border-top:1px dashed var(--border); padding-top:8px; }
}

/* ---- the shared error pattern (990/policy/status.html) ---- */
.lineage-app .err { color:var(--anti-text); font-size:12.5px; }
.lineage-app .err button { margin-left:8px; background:var(--panel2); color:var(--text);
              font:inherit; font-size:11.5px; border:1px solid var(--control-border);
              border-radius:5px; padding:4px 10px; min-height:24px; cursor:pointer; }
