/* Lib Dem Lords Business Hub
   Palette taken from the Whips' Office house documents:
   grid navy, title red, heading orange, and the yellow highlighter used for Lib Dem peers. */

:root {
  --navy: #1F3864;
  --navy-deep: #16294A;
  --red: #C00000;
  --orange: #C9561D;        /* house orange #E97132, darkened for text contrast */
  --orange-rule: #E97132;
  --mark: #FFF34D;
  --paper: #F2F4F7;
  --card: #FFFFFF;
  --ink: #172033;
  --muted: #586174;
  --rule: #D3D8E1;
  --rule-strong: #B8C0CE;
  --focus: #0B63CE;
  --head: 'Libre Franklin', 'Franklin Gothic Medium', Arial, sans-serif;
  --body: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  --measure: 72ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--body);
}
a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--mark); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }
mark { background: var(--mark); color: inherit; padding: 0 .1em; }
mark.ld { background: var(--mark); font-weight: 700; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ------------------------------------------------------------ masthead */
.masthead { background: var(--navy); color: #fff; border-bottom: 4px solid var(--red); }
.masthead-inner { max-width: 1120px; margin: 0 auto; padding: .9rem 1.25rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; }
.brand { color: #fff; text-decoration: none; display: grid; line-height: 1.1; }
.brand:hover { color: #fff; }
.brand-name { font: 800 1.45rem/1.1 var(--head); letter-spacing: -.01em; }
.brand-sub { font-size: .8rem; opacity: .85; }
.topnav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.topnav a { color: #fff; text-decoration: none; font: 700 .98rem var(--head); padding: .2rem 0; }
.topnav a:hover { text-decoration: underline; color: #fff; }
.topnav a[aria-current] { color: var(--ink); background: var(--mark); padding: .2rem .35rem; margin: 0 -.35rem; }

/* ------------------------------------------------------------ page */
main { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; outline: none; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font: 800 clamp(1.9rem, 4vw, 2.6rem)/1.1 var(--head); margin: .15rem 0 .5rem; color: var(--red); letter-spacing: -.015em; max-width: 30ch; }
.lede { font-size: 1.08rem; color: var(--muted); max-width: var(--measure); margin: 0; }
.dateline { font: 700 .95rem var(--head); color: var(--muted); margin: 0; }
.crumbs { font-size: .88rem; display: flex; gap: .5rem; color: var(--muted); }
h2, h3, h4 { font-family: var(--head); }
.h2-rule { font: 800 1.3rem/1.2 var(--head); color: var(--ink); margin: 2.25rem 0 .9rem; padding-bottom: .35rem; border-bottom: 2px solid var(--ink); display: flex; align-items: baseline; gap: .6rem; }
.h3-section { font: 700 1.08rem var(--head); margin: 1.75rem 0 .6rem; }
.h3-peer { font: 700 1.05rem var(--head); color: var(--orange); margin: 1.1rem 0 .4rem; }
.count { font: 500 .85rem var(--body); color: var(--muted); }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
p { max-width: var(--measure); }

/* ------------------------------------------------------------ home index */
.index { border-top: 2px solid var(--ink); margin-top: 1.5rem; }
.index-row {
  display: grid; grid-template-columns: minmax(14rem, 1.1fr) 2fr; gap: .25rem 2rem; align-items: baseline;
  padding: 1.15rem 0; border-bottom: 1px solid var(--rule-strong); text-decoration: none; color: var(--ink);
}
.index-title { font: 800 clamp(1.5rem, 3.2vw, 2.15rem)/1.1 var(--head); letter-spacing: -.015em; color: var(--navy); }
.swipe {
  background-image: linear-gradient(var(--mark), var(--mark)); background-repeat: no-repeat;
  background-size: 0% 38%; background-position: 0 88%; transition: background-size .25s ease-out;
}
.index-row:hover .swipe, .index-row:focus-visible .swipe { background-size: 100% 38%; }
.index-row:hover { color: var(--ink); }
.index-text { color: var(--muted); max-width: 55ch; }
.index-hint { grid-column: 2; font: 700 .9rem var(--head); color: var(--red); min-height: 1em; }
.index-small .index-title { font-size: 1.5rem; }
@media (max-width: 700px) {
  .index-row { grid-template-columns: 1fr; }
  .index-hint { grid-column: 1; }
}

/* ------------------------------------------------------------ live panel */
.live { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin: 1rem 0 1.5rem; }
.live-panel { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--navy); padding: .8rem 1rem 1rem; }
.live-panel h2 { font: 700 .95rem var(--head); margin: 0 0 .5rem; display: flex; align-items: center; gap: .5rem; color: var(--navy); }
.pulse { width: .6rem; height: .6rem; border-radius: 50%; background: var(--red); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.live-line { margin: .15rem 0; font-size: .98rem; }
.live-line.is-member { font-weight: 700; }
.live-label { font: 700 .8rem var(--head); color: var(--red); margin-right: .5rem; }
.live-quiet { color: var(--muted); margin: 0; font-size: .95rem; }
.live-compact .live-line:nth-child(n+4) { display: none; }
@media (max-width: 760px) { .live { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ day */
.day-nav { display: flex; gap: 1.25rem; font: 700 .92rem var(--head); margin: -.5rem 0 .75rem; }
.chamber { margin-top: 1.75rem; }
.chamber-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .3rem; }
.chamber-head h2 { font: 800 1.4rem var(--head); margin: 0; }
.chamber-head p { margin: 0; }
.items { list-style: none; margin: 0; padding: 0; }
.item { border-bottom: 1px solid var(--rule); padding: .8rem 0; }
.item-row, .oq summary { display: grid; grid-template-columns: 10.5rem 1fr minmax(8rem, 15rem); gap: .2rem 1rem; align-items: baseline; }
.kind { font: 700 .78rem/1.3 var(--head); color: var(--muted); }
.item-oq .kind, .item-pnq .kind { color: var(--red); }
.item-legislation .kind { color: var(--navy); }
.item-title { font-weight: 700; }
.item-detail { font-weight: 400; color: var(--muted); }
.item-who { font-size: .92rem; text-align: right; }
.item-links { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; margin: .35rem 0 0 11.5rem; font-size: .9rem; }
.item-notes, .item > .small, .groupings { margin: .3rem 0 0 11.5rem; font-size: .9rem; }
.item-notes { padding-left: 1rem; }
.tags { margin: .3rem 0 0 11.5rem; display: flex; gap: .35rem; }
.tag { font: 700 .72rem var(--head); text-decoration: none; border: 1px solid var(--rule-strong); padding: 0 .35rem; color: var(--muted); }
.groupings ol { columns: 2; font-size: .88rem; }
.oq summary { cursor: pointer; list-style: none; }
.oq summary::-webkit-details-marker { display: none; }
.oq summary .item-title::after { content: ' ▸'; color: var(--red); font-weight: 400; }
.oq[open] summary .item-title::after { content: ' ▾'; }
.oq-body { margin: .6rem 0 .2rem 11.5rem; background: var(--card); border-left: 4px solid var(--mark); padding: .8rem 1rem; }
.oq-meta { margin-top: 0; }
.suggest-head { font: 700 .95rem var(--head); margin: .6rem 0 .3rem; }
.suggest-list { padding-left: 1.2rem; margin: 0; }
.suggest-list li { margin-bottom: .8rem; }
.suggest-q { font-size: 1.02rem; margin: 0 0 .2rem; }
@media (max-width: 760px) {
  .item-row, .oq summary { grid-template-columns: 1fr; }
  .item-who { text-align: left; }
  .item-links, .item-notes, .item > .small, .groupings, .tags, .oq-body { margin-left: 0; }
}

/* ------------------------------------------------------------ tables (navy header, like the grids) */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); }
table.grid { border-collapse: collapse; width: 100%; font-size: .93rem; }
.grid th, .grid td { border: 1px solid var(--rule); padding: .5rem .65rem; text-align: left; vertical-align: top; }
.grid thead th { background: var(--navy); color: #fff; font: 700 .85rem var(--head); border-color: var(--navy); }
.grid tbody th { font-weight: 700; }
.grid tbody tr:nth-child(even) { background: #F7F8FA; }

/* ------------------------------------------------------------ bill page */
.bill-meta { margin-top: -.5rem; }
.summary-box { background: var(--card); border: 1px solid var(--rule); padding: .6rem 1rem; }
.summary-box summary, details > summary { cursor: pointer; font-weight: 700; }
.stages { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--rule-strong); }
.stage { position: relative; padding: .2rem 0 1.25rem 1.25rem; }
.stage::before { content: ''; position: absolute; left: -.55rem; top: .55rem; width: .8rem; height: .8rem; background: var(--paper); border: 3px solid var(--rule-strong); border-radius: 50%; }
.stage-done::before { background: var(--navy); border-color: var(--navy); }
.stage-scheduled::before, .stage-in-progress::before { background: var(--mark); border-color: var(--red); }
.stage-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.stage-head h3 { font: 800 1.12rem var(--head); margin: 0; }
.stage-status { font: 700 .78rem var(--head); color: var(--muted); }
.stage-scheduled .stage-status, .stage-in-progress .stage-status { color: var(--red); }
.feeds { margin: .5rem 0 .4rem; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.slot { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--rule-strong); padding: .5rem .7rem; }
.slot.is-found { border-top-color: var(--navy); }
.slot h4 { font: 700 .85rem var(--head); margin: 0 0 .3rem; }
.slot p { margin: 0; }
.docs { margin: 0; padding-left: 1rem; font-size: .88rem; }
.fb-list { margin: .2rem 0 .4rem; }
.commons-stages { margin-bottom: 1rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tabs button { font: 700 .9rem var(--head); background: var(--card); color: var(--navy); border: 1px solid var(--rule-strong); padding: .4rem .8rem; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.am-list { list-style: none; padding: 0; margin: 0; }
.am { border-bottom: 1px solid var(--rule); }
.am summary { display: grid; grid-template-columns: 4.5rem 1fr 11rem; gap: 1rem; padding: .45rem 0; font-weight: 400; }
.am-no { font: 800 1rem var(--head); color: var(--navy); }
.am-decision { font-size: .85rem; color: var(--muted); text-align: right; }
.am-body { padding: .2rem 0 .8rem 5.5rem; }
.am-text { background: var(--card); border: 1px solid var(--rule); padding: .5rem .9rem; font-size: .93rem; }
.am-location { font-weight: 700; }
.mes { font-style: italic; }
.all-ams { margin-top: 1.5rem; }
.peer-group + .peer-group { margin-top: .5rem; }
@media (max-width: 700px) { .am summary { grid-template-columns: 3.5rem 1fr; } .am-decision { grid-column: 2; text-align: left; } .am-body { padding-left: 0; } }

/* ------------------------------------------------------------ calendar & portfolios */
.toggle { display: inline-flex; border: 2px solid var(--navy); margin-bottom: 1.25rem; }
.toggle a { font: 700 .95rem var(--head); padding: .45rem 1rem; text-decoration: none; color: var(--navy); }
.toggle a[aria-current] { background: var(--navy); color: #fff; }
.cal { display: grid; gap: .5rem; }
.cal-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.cal-headrow div { font: 700 .85rem var(--head); color: var(--muted); }
.cal-cell { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--navy); padding: .5rem .6rem; min-height: 8.5rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: .3rem; font-size: .84rem; }
a.cal-cell:hover { border-color: var(--navy); color: var(--ink); }
.cal-cell.is-empty { border-top-color: var(--rule-strong); background: transparent; }
.cal-cell.is-out { visibility: hidden; }
.cal-cell.is-today { outline: 3px solid var(--mark); outline-offset: -3px; }
.cal-date { font: 800 .95rem var(--head); color: var(--navy); }
.cal-cell ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; flex: 1; }
.kind-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .35rem; background: var(--rule-strong); vertical-align: middle; }
.kind-legislation { background: var(--navy); } .kind-si { background: var(--orange-rule); } .kind-statement, .kind-uq { background: var(--red); }
@media (max-width: 820px) { .cal-headrow { display: none; } .cal-row { grid-template-columns: 1fr; } .cal-cell { min-height: 0; } .cal-cell.is-out, .cal-cell.is-empty { display: none; } }
.portfolio-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .5rem; }
.portfolio-list a { display: flex; gap: .8rem; align-items: baseline; background: var(--card); border: 1px solid var(--rule); padding: .8rem 1rem; text-decoration: none; font-weight: 700; color: var(--ink); }
.portfolio-list a:hover { border-color: var(--navy); }
.p-code { font: 800 .8rem var(--head); color: #fff; background: var(--navy); padding: .1rem .4rem; min-width: 3.6rem; text-align: center; }
.plain { padding-left: 1.1rem; }
.plain li { margin-bottom: .35rem; }

/* ------------------------------------------------------------ search, records, policy */
.search { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: 0 0 1.25rem; }
.field { display: grid; gap: .25rem; font: 700 .85rem var(--head); flex: 1 1 18rem; }
.field-narrow { flex: 0 1 16rem; }
.field input, .field select { font: 1rem var(--body); padding: .55rem .65rem; border: 2px solid var(--rule-strong); background: #fff; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { border-color: var(--navy); }
.search-big .field input { font-size: 1.15rem; padding: .7rem .8rem; border-color: var(--navy); }
.check { font-size: .92rem; display: flex; gap: .4rem; align-items: center; padding-bottom: .6rem; }
.button { font: 700 .95rem var(--head); background: var(--navy); color: #fff; border: 2px solid var(--navy); padding: .55rem 1.1rem; cursor: pointer; text-decoration: none; display: inline-block; }
.button:hover { background: var(--navy-deep); color: #fff; }
.button-quiet { background: transparent; color: var(--navy); }
.button-quiet:hover { background: var(--card); color: var(--navy); }
.linkish { background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; }
.records { list-style: none; padding: 0; margin: 0; }
.record { border-bottom: 1px solid var(--rule); padding: .8rem 0; }
.record p { margin: .2rem 0; }
.record-title { font-weight: 700; }
.results { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.result { display: grid; gap: .3rem; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--navy); padding: .8rem 1rem; text-decoration: none; color: var(--ink); }
.result:hover { border-left-color: var(--red); color: var(--ink); }
.extract { margin: 0; font-size: 1.05rem; line-height: 1.6; }
.result-title { font: 700 .95rem var(--head); color: var(--navy); }
.result-meta { font-size: .85rem; color: var(--muted); }
.browse { border-bottom: 1px solid var(--rule); padding: .55rem 0; }
.browse summary { display: flex; align-items: baseline; gap: .7rem; }
.browse ul { margin-top: .6rem; }

/* ------------------------------------------------------------ states & footer */
.state { color: var(--muted); padding: .8rem 0; }
.state-error { color: var(--ink); background: #FDECEC; border-left: 4px solid var(--red); padding: .7rem 1rem; }
.spinner { display: inline-block; width: .9rem; height: .9rem; border: 2px solid var(--rule-strong); border-top-color: var(--navy); border-radius: 50%; margin-right: .5rem; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { max-width: 1120px; margin: 0 auto; padding: 1.25rem; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--rule); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
