/* ============================================================================
 * THE PUBLIC SAMPLE PUBLICATIONS LIBRARY
 * ----------------------------------------------------------------------------
 * Namespaced `sl-`. Two class names on this site are already overloaded —
 * `.shell` is a flex sidebar in style.css and a centred container in seven page
 * sheets, and `.stages` renders 6mm circles — so this takes a prefix rather
 * than a plausible generic name.
 *
 * Designed at 390px first. A procurement lead reads this on a phone between
 * meetings at least as often as at a desk.
 * ========================================================================== */

:root {
  --sl-ink: #0f172a;
  --sl-muted: #64748b;
  --sl-line: #e2e8f0;
  --sl-surface: #ffffff;
  --sl-subtle: #f8fafc;
  --sl-navy: #0b2e59;
  --sl-gold: #a16207;
}

#main-content { max-width: 74rem; margin: 0 auto; padding: 0 1rem 4rem; }

/* ---- the disclosure, before anything else ------------------------------ */
.sl-disclosure-banner {
  margin: 1rem 0 0;
  padding: .75rem 1rem;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  background: #fffbeb;
  color: #78350f;
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.55;
}

/* ---- hero -------------------------------------------------------------- */
.sl-hero { padding: 2rem 0 1rem; }
.sl-hero h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem); margin: 0 0 .6rem; text-wrap: balance; line-height: 1.2; }
.sl-hero-sub { color: var(--sl-muted); max-width: 62ch; margin: 0; line-height: 1.6; font-size: 1.02rem; }

/* ---- sections ---------------------------------------------------------- */
.sl-section { margin-top: 2.5rem; }
.sl-section-head { margin-bottom: 1.1rem; }
.sl-section-head h2 { font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem); margin: 0 0 .35rem; }
.sl-section-head p { color: var(--sl-muted); margin: 0; max-width: 72ch; line-height: 1.55; font-size: .92rem; }

/* ---- flagship cards ---------------------------------------------------- */
.sl-flagships { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.sl-flagship {
  border: 1px solid var(--sl-line); border-radius: 12px; background: var(--sl-surface);
  padding: 1.1rem; display: flex; flex-direction: column; gap: .5rem;
}
.sl-flagship:hover { border-color: #0b2e5955; }
.sl-flagship-area { font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--sl-gold); font-weight: 700; }
.sl-flagship h3 { margin: 0; font-size: 1.08rem; line-height: 1.3; text-wrap: balance; }
/* The card TITLE is the primary link and was measuring 20px tall. It is not an
 * inline link in a sentence — it is the card's main target — so the WCAG 2.2
 * exception does not apply and it gets the 24px floor. inline-flex so a title
 * that wraps still grows its hit area rather than clipping it. */
.sl-flagship h3 a {
  display: inline-flex; align-items: center; min-height: 24px;
  padding: .15rem 0; text-decoration: none;
}
.sl-flagship h3 a:hover { text-decoration: underline; }
.sl-flagship-demo { font-size: .875rem; color: var(--sl-ink); line-height: 1.5; margin: 0; }
.sl-flagship-meta { display: grid; gap: .3rem .9rem; margin: .4rem 0 0; font-size: .8rem; }
@media (min-width: 26rem) { .sl-flagship-meta { grid-template-columns: auto 1fr; } }
.sl-flagship-meta dt { color: var(--sl-muted); }
.sl-flagship-meta dd { margin: 0; }
.sl-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.sl-chip {
  font-size: .68rem; padding: .18rem .48rem; border-radius: 4px;
  background: var(--sl-subtle); color: var(--sl-muted); border: 1px solid var(--sl-line);
  overflow-wrap: anywhere; max-width: 100%;
}
.sl-chip[data-tone="gate"] { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.sl-chip[data-tone="synthetic"] { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.sl-flagship-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .7rem; }

/* ---- toolbar and filters ----------------------------------------------- */
.sl-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; margin-bottom: .6rem; }
.sl-search { flex: 1 1 16rem; min-width: 0; }
.sl-search input {
  width: 100%; padding: .55rem .7rem; min-height: 2.75rem; font: inherit;
  border: 1px solid #cbd5e1; border-radius: 8px; background: var(--sl-surface); color: inherit;
}
.sl-search input:focus-visible, .sl-filter select:focus-visible { outline: 3px solid var(--sl-navy); outline-offset: 1px; }
.sl-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.sl-filter { display: flex; flex-direction: column; gap: .2rem; }
.sl-filter label { font-size: .72rem; color: var(--sl-muted); font-weight: 600; }
.sl-filter select {
  min-height: 2.75rem; padding: .4rem .55rem; font: inherit; color: inherit;
  border: 1px solid #cbd5e1; border-radius: 8px; background: var(--sl-surface); max-width: 14rem;
}
.sl-count { font-size: .82rem; color: var(--sl-muted); margin: 0 0 1rem; }

/* ---- report-type catalogue --------------------------------------------- */
.sl-family { margin-bottom: 1.6rem; }
.sl-family-head { border-bottom: 1px solid var(--sl-line); padding-bottom: .4rem; margin-bottom: .75rem; }
.sl-family-head h3 { margin: 0; font-size: 1rem; }
.sl-family-head p { margin: .2rem 0 0; font-size: .82rem; color: var(--sl-muted); line-height: 1.5; }
.sl-types { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.sl-type {
  border: 1px solid var(--sl-line); border-radius: 10px; padding: .8rem;
  background: var(--sl-surface); display: flex; flex-direction: column; gap: .3rem;
}
.sl-type[data-flagship="yes"] { border-left: 4px solid var(--sl-navy); }
.sl-type h4 { margin: 0; font-size: .93rem; line-height: 1.35; }
.sl-type-purpose { font-size: .82rem; color: var(--sl-muted); line-height: 1.5; margin: 0; }
/* STANDALONE LINKS GET A REAL TARGET.
 * These measured 20px tall. WCAG 2.2 exempts a link INSIDE a sentence, whose
 * size is constrained by the surrounding line-height — these are not: each sits
 * alone in its own block, so the exception does not apply and the 24px floor
 * does. Given as min-height plus vertical padding so the clickable area grows
 * without the text moving. */
.sl-type a,
.sl-panel p > a:only-child,
.sl-count a {
  font-size: .82rem;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .25rem 0;
}
.sl-type a { margin-top: .2rem; }

/* ---- CTA band ----------------------------------------------------------- */
.sl-cta-band {
  border: 1px solid var(--sl-line); border-radius: 12px; padding: 1.4rem;
  background: var(--sl-subtle); text-align: center;
}
.sl-cta-band h2 { margin: 0 0 .35rem; }
.sl-cta-band p { color: var(--sl-muted); margin: 0 0 1rem; }
.sl-cta-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

/* ---- detail page -------------------------------------------------------- */
.sl-detail-head { padding: 1.5rem 0 1rem; border-bottom: 1px solid var(--sl-line); margin-bottom: 1.5rem; }
.sl-detail-head h1 { font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2.1rem); margin: .3rem 0 .5rem; text-wrap: balance; line-height: 1.25; }
.sl-detail-grid { display: grid; gap: 1.5rem; }
@media (min-width: 60rem) { .sl-detail-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.sl-panel { border: 1px solid var(--sl-line); border-radius: 12px; padding: 1rem; background: var(--sl-surface); margin-bottom: 1rem; }
.sl-panel h2 { font-size: 1.02rem; margin: 0 0 .6rem; }
.sl-panel p { line-height: 1.6; margin: 0 0 .6rem; }
.sl-facts { display: grid; gap: .45rem .9rem; margin: 0; font-size: .875rem; }
@media (min-width: 30rem) { .sl-facts { grid-template-columns: 11rem 1fr; } }
.sl-facts dt { color: var(--sl-muted); }
.sl-facts dd { margin: 0; overflow-wrap: anywhere; }

/* the reasoning chain — the thing the benchmark did best */
.sl-chain { display: grid; gap: .5rem; }
.sl-step {
  border: 1px solid var(--sl-line); border-left: 4px solid var(--sl-line);
  border-radius: 8px; padding: .65rem .8rem;
}
.sl-step[data-p="MEASURED"] { border-left-color: #16a34a; }
.sl-step[data-p="DERIVED"] { border-left-color: #2563eb; }
.sl-step[data-p="INFERRED"] { border-left-color: #ca8a04; }
.sl-step[data-p="AUTHORED"] { border-left-color: #7c3aed; }
.sl-step[data-p="DECIDED"] { border-left-color: #ea580c; }
.sl-step-label { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; margin-bottom: .25rem; }
.sl-step-name { font-size: .68rem; font-weight: 700; letter-spacing: .05em; }
.sl-step-title { font-size: .8rem; color: var(--sl-muted); }
.sl-step-text { font-size: .875rem; line-height: 1.55; margin: 0; }
.sl-step-caveat { font-size: .78rem; color: var(--sl-gold); margin: .35rem 0 0; line-height: 1.45; }
.sl-step-ev { font-size: .7rem; color: var(--sl-muted); margin: .3rem 0 0; overflow-wrap: anywhere; }

/* downloads */
.sl-downloads { display: grid; gap: .4rem; }
.sl-download {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between;
  border: 1px solid var(--sl-line); border-radius: 8px; padding: .55rem .7rem; text-decoration: none; color: inherit;
  min-height: 2.75rem;
}
.sl-download:hover { border-color: var(--sl-navy); }
.sl-download:focus-visible { outline: 3px solid var(--sl-navy); outline-offset: 2px; }
.sl-download-name { font-weight: 600; font-size: .875rem; }
.sl-download-meta { font-size: .75rem; color: var(--sl-muted); }

.sl-loading, .sl-empty { color: var(--sl-muted); font-size: .9rem; }
.sl-error { border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 8px; padding: .75rem .9rem; font-size: .9rem; line-height: 1.55; }
.sl-noscript { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 1rem; margin-top: 2rem; }

a:focus-visible, button:focus-visible { outline: 3px solid var(--sl-navy); outline-offset: 2px; }

/* ---- dark mode ---------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sl-ink: #e2e8f0; --sl-muted: #94a3b8; --sl-line: #1e293b;
    --sl-surface: #0f172a; --sl-subtle: #111c2e;
  }
  :root:not([data-theme="light"]) .sl-disclosure-banner { background: #422006; border-color: #854d0e; color: #fde68a; }
  :root:not([data-theme="light"]) .sl-chip[data-tone="gate"] { background: #052e16; color: #86efac; border-color: #166534; }
  :root:not([data-theme="light"]) .sl-chip[data-tone="synthetic"] { background: #422006; color: #fde68a; border-color: #854d0e; }
}

@media (prefers-reduced-motion: reduce) {
  .sl-flagship, .sl-type, .sl-download { transition: none; }
}

/* ---------------------------------------------------------------------------
 * THE RETIRED SURFACES, AND THE BANNER ON THE ONE THAT WAS KEPT
 *
 * These four pages carried their layout in a style="…" attribute. Under
 * style-src 'self' — which this site now serves — a browser drops every one of
 * them, so the redirect pages would have rendered as unstyled text against the
 * page edge and the banner would have lost the colour that makes it read as a
 * notice. Nothing would have thrown; it would simply have looked broken.
 *
 * They belong here rather than in the generated utility layer: that file is
 * written by migrate-inline-styles.mjs and says so, and these are four rules
 * describing two components on pages that already load this stylesheet.
 * ------------------------------------------------------------------------- */
.sl-redirect {
  max-width: 40rem;
  margin: 4rem auto;
  padding: 0 1rem;
}

.sl-superseded-banner {
  max-width: 74rem;
  margin: 1rem auto;
  padding: .75rem 1rem;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  background: #fffbeb;
  color: #78350f;
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.55;
}

/* ---------------------------------------------------------------------------
 * THE COMMISSIONING LINES
 *
 * A publication's cover is read in a fixed order — who commissioned it, the
 * programme, what kind of document, for when. The card and the detail page
 * carry the same four lines so a reader meets the assignment before the
 * product name, which is the difference between a sample and a template.
 * ------------------------------------------------------------------------- */
.sl-commissioner {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sl-accent, #1f4f7a);
  margin-bottom: .25rem;
}
.sl-programme { font-size: .92rem; color: var(--sl-muted, #5c6773); margin: .15rem 0; }
.sl-period { font-size: .8rem; color: var(--sl-muted, #5c6773); font-variant-numeric: tabular-nums; }
.sl-partner {
  font-size: .8rem;
  color: var(--sl-muted, #5c6773);
  margin: .4rem 0 .2rem;
  padding-top: .4rem;
  border-top: 1px solid var(--sl-line, #e3e8ee);
  max-width: 34rem;
}
