/* ------------------------------------------------------------------ *
 * The newspaper list pages (LAYOUT_LISTS=on), stage 5 of the layout
 *
 * The blocks of the approved mock-ups (docs/BRAND.md "Layout amendment"):
 * the page head (6 | 6), the facets as ruled tabs (4 | 4 | 4), the ledger of
 * records, the ruled calendar, the day's modules, the watch ledger by date,
 * the search field, the reports' ruled list. Every class has the prefix `lp-`;
 * the grid, the rules and the section head are the `np-` primitives of
 * globals.css, the ledger row and its column heads are the front page's (`hm-`
 * in home.css, components/home/ledger.tsx), and the type atoms (figure, year,
 * status mark) are in globals.css too.
 *
 * Under 900px everything stacks; from 900 the head is 6 | 6 and the facets are
 * 4 | 4 | 4. Colour is type, rules, numerals and rings; there is no fill and no
 * soft corner anywhere.
 *
 * WHY THIS IS A FILE IN public/ AND NOT IMPORTED BY globals.css, as home.css and
 * record.css are: the production build keeps the global stylesheet in one chunk
 * only up to 128 KiB (131,072 bytes) of CSS, and it stood at 130,450 bytes
 * before this stage. Past the limit the font's few bytes move to a second
 * stylesheet and every page of the site, flag off included, links one more
 * file, so the flag-off HTML would no longer be the page it was. This file is
 * linked (components/lists/styles.tsx, from the page head) only by a page that
 * draws the new layout, with its content hash in the address, so it costs
 * nothing while LAYOUT_LISTS is off. When the old components and their rules
 * are retired, this file can be imported by globals.css and the link dropped.
 *
 * The first line declares the layer order the global stylesheet declares, so
 * the order is the same whichever stylesheet the browser reads first.
 * ------------------------------------------------------------------ */
@layer theme, base, components, utilities;

@layer components {
  /* ---- Shared: the 44 px target, the 3 px rose underline of hover, the muted small line ---- */
  .lp-back a,
  .lp-more a,
  .lp-status-link,
  .lp-fc-l a,
  .lp-tabs a,
  .lp-jump a,
  .lp-fold summary,
  .lp-search button {
    min-height: 44px;
    min-width: 44px;
  }
  .lp-back a:hover,
  .lp-more a:hover,
  .lp-reports a:hover,
  .lp-status-link:hover .np-mark-w,
  .lp-fc-l a:hover .lp-fl,
  .lp-fc-l a:hover .np-mark-w,
  .lp-tabs a:hover .lp-tl,
  .lp-tabs a:hover .np-mark-w,
  .lp-jump a:hover,
  .lp-fold summary:hover,
  .lp-search button:hover,
  .lp-wt a:hover,
  .lp-rep-t a:hover {
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 0.2em;
  }
  .lp-sub,
  .lp-hint,
  .lp-wn,
  .lp-note,
  .lp-sec-note,
  .lp-sec-foot {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-muted);
  }

  /* ---- The page head: the title at the left; the standfirst, the count and what the page adds at the right ---- */
  .lp-page {
    padding-bottom: 8px;
  }
  .lp-head {
    align-items: end;
    row-gap: 14px;
    padding-block: 22px 24px;
  }
  .lp-head-t,
  .lp-head-d {
    grid-column: 1 / -1;
  }
  .lp-h1 {
    font-size: clamp(2.25rem, 4.2vw, 3.25rem);
    line-height: 1.4;
    font-weight: 700;
    text-wrap: balance;
  }
  html[lang="en"] .lp-h1 {
    line-height: 1.22;
  }
  .lp-back a,
  .lp-more a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-accent-ink);
  }
  .lp-back svg,
  .lp-more svg {
    width: 1.1em;
    height: 1.1em;
  }
  .lp-stand {
    max-width: 40em;
    font-size: 1.1875rem;
    line-height: 1.7;
    color: var(--color-ink-2);
    text-wrap: pretty;
  }
  .lp-sub {
    max-width: 40em;
    margin-top: 8px;
  }
  .lp-stand + .lp-sub {
    margin-top: 6px;
  }
  .lp-sub--fig {
    margin-top: 12px;
    font-size: 1rem;
    color: var(--color-ink-2);
  }
  .lp-count {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 10px;
    margin-top: 10px;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--color-ink-2);
  }
  .lp-count b {
    font-size: 2.75rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--color-accent);
  }
  .lp-count span {
    font-weight: 700;
    color: var(--color-ink);
  }
  .lp-count .lp-span {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--color-muted);
  }
  .lp-aside {
    margin-top: 14px;
    max-width: 28rem;
  }
  .lp-status-link {
    display: inline-flex;
    align-items: center;
  }
  .lp-kicker {
    margin-bottom: 6px;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--color-accent-ink);
  }
  .lp-reports {
    margin-top: 8px;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--color-ink-2);
  }
  .lp-reports a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 700;
    color: var(--color-accent-ink);
    text-underline-offset: 0.2em;
  }
  .lp-head--stacked .lp-head-t,
  .lp-head--stacked .lp-head-d {
    grid-column: 1 / -1;
  }
  @media (min-width: 900px) {
    .lp-head-t {
      grid-column: 1 / span 6;
    }
    .lp-head-d {
      grid-column: 7 / span 6;
    }
  }

  /* ---- Zones, the ledger, the pager, the foot links ---- */
  .lp-z,
  .lp-sec {
    padding-block: 26px 34px;
  }
  .lp-z--tight {
    padding-block: 22px 26px;
  }
  .lp-led {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  /* the year is one column of twelve: its size follows the column, so four digits never run into the headline */
  @media (min-width: 900px) {
    .lp-led .hm-r-y {
      font-size: clamp(1rem, 1.8vw, 1.75rem);
    }
  }
  .lp-more {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
    margin-top: 8px;
  }
  .lp-none {
    padding-block: 14px 18px;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--color-ink-2);
  }
  .lp-none.lp-hint {
    padding-top: 0;
    font-size: 0.9375rem;
    color: var(--color-muted);
  }
  .lp-pager > nav {
    margin-top: 1.25rem;
  }
  .lp-two,
  .lp-cols,
  .lp-mods {
    row-gap: 32px;
  }
  .lp-two > *,
  .lp-cols > *,
  .lp-mods > * {
    grid-column: 1 / -1;
  }
  @media (min-width: 640px) {
    .lp-mods > * {
      grid-column: span 6;
    }
  }
  @media (min-width: 900px) {
    .lp-two > *,
    .lp-cols > * {
      grid-column: span 6;
    }
    .lp-mods--4 > * {
      grid-column: span 4;
    }
  }

  /* ---- Facets: ruled text tabs, each a link with its count; the current one bold with a 3px rose underline ---- */
  .lp-facets {
    padding-block: 22px 30px;
    row-gap: 28px;
  }
  .lp-fc {
    grid-column: 1 / -1;
  }
  .lp-fc .np-head {
    margin-bottom: 4px;
  }
  .lp-fc .np-head > h2 {
    font-size: 1.1875rem;
  }
  .lp-fc-l,
  .lp-tabs,
  .lp-jump,
  .lp-days,
  .lp-w,
  .lp-rep {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .lp-fc-l li {
    border-block-start: 1px solid var(--np-hair);
  }
  .lp-fc-l li:first-child {
    border-block-start: 0;
  }
  .lp-fc-l a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-block: 4px;
    font-size: 1.0625rem;
    line-height: 1.4;
    color: var(--color-ink-2);
  }
  .lp-fc-l a:focus-visible,
  .lp-days a:focus-visible {
    outline-offset: -2px;
  }
  .lp-fl {
    min-width: 0;
  }
  .lp-fc-l a > svg {
    flex: none;
    width: 1.1em;
    height: 1.1em;
    color: var(--color-accent-ink);
  }
  .lp-fc-l a b {
    margin-inline-start: auto;
    padding-inline-start: 8px;
    font-size: 1.0625rem;
    color: var(--color-ink);
  }
  .lp-fc-l a[aria-current],
  .lp-tabs a[aria-current],
  .lp-tabs .lp-tab-all a {
    font-weight: 700;
    color: var(--color-ink);
    border-block-end: 3px solid var(--color-accent);
    padding-block-end: 1px;
  }
  .lp-fc-years {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--np-gut);
  }
  .lp-fc-years li:nth-child(2) {
    border-block-start: 0;
  }
  .lp-fc-years .lp-fl {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-accent);
  }
  @media (min-width: 900px) {
    .lp-fc {
      grid-column: span 4;
    }
  }

  /* ---- The outcome tabs of a day page: text tabs in one ruled strip ---- */
  .lp-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 28px;
  }
  .lp-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-block: 4px;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--color-ink-2);
  }
  .lp-tabs a b {
    color: var(--color-ink);
  }
  .lp-tabs-z {
    padding-block: 6px;
  }

  /* ---- The modules of a day page ---- */
  .lp-run {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    column-gap: var(--np-gut);
  }
  /* two across when the half-page it sits in is wide enough: stacked halves (640 to 899) and from 1,180; one across between */
  @media (min-width: 640px) and (max-width: 899px), (min-width: 1180px) {
    .lp-run {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  .lp-fold {
    margin-top: 14px;
  }
  .lp-fold summary {
    display: inline-flex;
    align-items: center;
    padding-inline: 14px;
    border: 1px solid var(--color-ink);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-ink);
    cursor: pointer;
    list-style: none;
  }
  .lp-fold summary::-webkit-details-marker {
    display: none;
  }
  .lp-fold[open] summary {
    margin-bottom: 8px;
  }
  .lp-stats {
    max-width: 44rem;
  }
  .lp-dh span {
    display: block;
  }
  .lp-dh em {
    font-style: normal;
    color: var(--color-accent);
  }
  .lp-dh a:hover {
    text-decoration: underline;
    text-decoration-thickness: 4px;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 0.15em;
  }

  /* ---- The calendar: twelve ruled months, a ruled grid of days ---- */
  .lp-cal {
    padding-block: 22px 34px;
  }
  .lp-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
  }
  .lp-jump a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 10px;
    font-size: 1rem;
    color: var(--color-ink-2);
  }
  .lp-months {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(19.5rem, 100%), 1fr));
    column-gap: var(--np-gut);
    row-gap: 34px;
  }
  .lp-month {
    min-width: 0;
    scroll-margin-top: 5rem;
    border-block-start: 1px solid var(--color-ink);
  }
  .lp-month[aria-current="date"] {
    border-block-start: 4px solid var(--color-accent);
  }
  .lp-month header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-block: 8px 6px;
  }
  .lp-month h2 {
    font-size: 1.3125rem;
    line-height: 1.45;
    font-weight: 700;
  }
  .lp-month header span {
    font-size: 0.84375rem;
    line-height: 1.5;
    color: var(--color-muted);
  }
  .lp-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-block-start: 1px solid var(--np-line);
    border-inline-start: 1px solid var(--np-hair);
  }
  .lp-days > li {
    display: flex;
    min-width: 0;
  }
  .lp-days a {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 44px;
    padding: 4px 5px;
    border-block-end: 1px solid var(--np-hair);
    border-inline-end: 1px solid var(--np-hair);
    font-size: 0.84375rem;
    line-height: 1.2;
    color: var(--color-muted);
  }
  .lp-days a:focus-visible {
    z-index: 1;
  }
  .lp-days a:hover {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
  }
  .lp-days a[data-has] {
    font-weight: 700;
    color: var(--color-ink);
  }
  .lp-days a[data-has] b {
    align-self: flex-end;
    color: var(--color-accent-ink);
  }
  /* seven columns of a 288px month are 41px wide: on the narrowest phones a week of the grid is six days, so a day is 48px */
  @media (max-width: 359px) {
    .lp-days {
      grid-template-columns: repeat(6, minmax(0, 1fr));
    }
  }

  /* ---- Watch: a ledger by date, three kinds of row ---- */
  .lp-wm {
    margin: 22px 0 0;
    padding-block: 6px;
    border-block-end: 1px solid var(--np-line);
    font-size: 0.9375rem;
    line-height: 1.5;
    font-weight: 700;
    color: var(--color-muted);
  }
  .lp-wm:first-child {
    margin-top: 0;
  }
  .lp-wr {
    position: relative;
    display: grid;
    grid-template-columns: 3.6rem minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    padding-block: 14px;
    border-block-end: 1px solid var(--color-rule);
  }
  .lp-wd {
    grid-row: 1 / span 3;
    font-size: 1.625rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--color-accent);
    white-space: nowrap;
  }
  .lp-wr > :not(.lp-wd) {
    grid-column: 2;
    min-width: 0;
  }
  .lp-wk {
    font-size: 0.84375rem;
    line-height: 1.5;
    font-weight: 700;
    color: var(--color-accent-ink);
  }
  .lp-wt {
    font-size: 1.0625rem;
    line-height: 1.55;
    font-weight: 700;
    text-wrap: pretty;
  }
  .lp-wt a::after,
  .lp-rep-t a::after {
    content: "";
    position: absolute;
    inset: 0;
  }
  .lp-wn {
    font-size: 0.84375rem;
    line-height: 1.6;
  }
  .lp-ws {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
  }
  .lp-wx {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-ink-2);
  }
  .lp-wflow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
  }
  .lp-wflow > svg {
    width: 1em;
    height: 1em;
    color: var(--color-muted);
  }
  .lp-wflow .np-mark {
    font-size: 0.9375rem;
  }
  .lp-wr:has(a:focus-visible),
  .lp-rep > li:has(a:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
  }
  .lp-wr a:focus-visible,
  .lp-rep a:focus-visible {
    outline: 0;
  }
  .lp-note,
  .lp-sec-foot {
    margin-top: 16px;
    padding-top: 12px;
    border-block-start: 1px solid var(--np-hair);
    max-width: 52em;
  }
  .lp-sec-note {
    max-width: 48em;
    margin-bottom: 16px;
  }
  /* a zone is a container (the half-page columns of the watch page never reach 56rem): a row is stacked (date, then the rest) in a narrow one and, in a wide one, the date hung at the
     left, the sentence over seven columns and the record's own line (status, place) in the four at the right */
  .lp-wz {
    container-type: inline-size;
    min-width: 0;
  }
  @container (min-width: 56rem) {
    .lp-wr {
      grid-template-columns: repeat(12, minmax(0, 1fr));
      column-gap: var(--np-gut);
      align-items: start;
      padding-block: 18px;
    }
    .lp-wd {
      grid-column: 1 / span 1;
      font-size: 1.75rem;
    }
    .lp-wr > :not(.lp-wd) {
      grid-column: 2 / span 7;
    }
    .lp-wr > .lp-wside {
      grid-column: 9 / span 4;
      grid-row: 1 / span 3;
    }
  }

  /* ---- Search: a ruled field ---- */
  .lp-search {
    max-width: 40rem;
  }
  .lp-search label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.0625rem;
    font-weight: 700;
  }
  .lp-search-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .lp-search input[type="search"],
  .lp-search button {
    min-height: 48px;
    border: 1px solid var(--color-ink);
    border-radius: 0;
    background: transparent;
    color: var(--color-ink);
  }
  .lp-search input[type="search"] {
    appearance: none;
    width: 100%;
    padding: 8px 14px;
    font-size: 1.0625rem;
  }
  .lp-search input[type="search"]::placeholder {
    color: var(--color-muted);
  }
  .lp-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-inline: 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
  }
  .lp-search button svg {
    width: 1.1em;
    height: 1.1em;
    color: var(--color-accent-ink);
  }
  .lp-search .lp-hint {
    margin-top: 8px;
  }
  @media (min-width: 640px) {
    .lp-search-row {
      flex-direction: row;
    }
    .lp-search input[type="search"] {
      flex: 1;
    }
    .lp-search button {
      flex: none;
    }
  }
  .lp-q {
    font-weight: 700;
    color: var(--color-ink);
  }

  /* ---- The reports' ruled list ---- */
  .lp-rep > li {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 4px;
    padding-block: 18px;
    border-block-end: 1px solid var(--color-rule);
  }
  .lp-rep-t {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 1.375rem;
    line-height: 1.45;
    font-weight: 700;
    text-wrap: balance;
  }
  .lp-rep-t svg {
    flex: none;
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.15em;
    color: var(--color-accent-ink);
  }
  .lp-rep-c,
  .lp-rep-n {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-ink-2);
  }
  .lp-rep-n {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  @media (min-width: 900px) {
    .lp-rep > li {
      grid-template-columns: repeat(12, minmax(0, 1fr));
      column-gap: var(--np-gut);
      align-items: start;
    }
    .lp-rep-t {
      grid-column: 1 / span 6;
      grid-row: 1;
    }
    .lp-rep-c {
      grid-column: 7 / span 4;
      grid-row: 1;
      padding-top: 6px;
    }
    .lp-rep-n {
      grid-column: 11 / span 2;
      grid-row: 1;
      padding-top: 6px;
    }
  }
}

/* The old components these pages carry (the accountability figures, the About essay, the submission form) set their small
   text at 13px; the list pages' floor is 13.5px. Outside the layer, so it wins over their utilities. */
.lp-cols .text-xs,
.lp-cols .meta,
.lp-legacy .text-xs,
.lp-legacy .meta,
html[lang="en"] .lp-legacy .section-title {
  font-size: 0.84375rem;
}

/* the accountability figures' disclosure ("See the full breakdown") is 36px tall as the old page draws it; a target is 44 */
.lp-cols summary {
  padding-block: 0.75rem;
}
