/* =================================================================
   FindOut — "Quiet editorial" restyle (direction 1d)
   White page · serif headings in sentence case · hairline ink rules
   Ink-solid buttons · saltire blue reserved for links
   Body text ≥ 7:1 (WCAG AAA) · amber focus rings unchanged
   ================================================================= */

/* --- Fonts (self-hosted) ----------------------------------------- */

/* Source Sans 3 - normal */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Source Sans 3 - italic */
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-sans-3-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-sans-3-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Source Serif 4 - normal */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Source Serif 4 - italic */
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-serif-4-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-serif-4-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Custom Properties ------------------------------------------- */
:root {
  /* */
  --fo-ink: #1C1C1F;
  --fo-ink-secondary: #44444B;
  --fo-ink-quiet: #6B6B73;
  --fo-ink-faint: #8E8E96;

  --fo-paper: #FFFFFF;
  --fo-parchment: #F4F5F7;
  --fo-stone: #E9ECEF;
  --fo-page: #FFFFFF;

  /* Accent */
  --fo-saltire: #1A5276;
  --fo-saltire-hover: #14425E;
  --fo-saltire-light: rgba(26, 82, 118, 0.07);
  --fo-saltire-glow: rgba(26, 82, 118, 0.15);

  /* Links */
  --fo-link: #1A5276;
  --fo-link-hover: #14425E;
  --fo-link-visited: #5B3A8C;

  /* Focus */
  --fo-focus: #D97706;
  --fo-focus-ring: rgba(217, 119, 6, 0.35);

  /* Borders */
  --fo-rule: rgba(28, 28, 31, 0.08);
  --fo-rule-strong: rgba(28, 28, 31, 0.13);

  /* Outcome badges  */
  --fo-granted-bg: #EEF6EE;
  --fo-granted-border: rgba(34, 120, 55, 0.25);
  --fo-granted-text: #1B5E2B;

  --fo-refused-bg: #F1F1F3;
  --fo-refused-border: rgba(75, 75, 83, 0.2);
  --fo-refused-text: #3B3B42;

  --fo-partial-bg: #FBF5E9;
  --fo-partial-border: rgba(158, 107, 22, 0.25);
  --fo-partial-text: #7A5318;

  /* Shadows — minimal, editorial  */
  --fo-shadow-sm: none;
  --fo-shadow-md: none;
  --fo-shadow-lg: none;

  /* Radii — sharp corners  */
  --fo-radius-sm: 0;
  --fo-radius: 0;
  --fo-radius-lg: 0;

  /* Type */
  --fo-serif: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --fo-sans: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --fo-mono: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;

  /* Motion */
  --fo-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --fo-duration: 0.15s;

  /* Spacing base: 8px */
}

/* --- Reset ------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: auto;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--fo-sans);
  background: var(--fo-page);
  color: var(--fo-ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Skip link --------------------------------------------------- */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
  transform: translateY(-200%);
  background: var(--fo-focus);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: var(--fo-radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 9999;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

/* --- Screen-reader only ------------------------------------------ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

/* --- Focus ------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--fo-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --- Links ------------------------------------------------------- */
a {
  color: var(--fo-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--fo-duration) var(--fo-ease);
}

a:hover, a:focus-visible {
  color: var(--fo-link-hover);
  text-decoration-thickness: 2px;
}

a:visited {
  color: var(--fo-link-visited);
}

/* --- Typography -------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--fo-serif);
  color: var(--fo-ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
  scroll-margin-top: 5rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0.4em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  margin-top: 2.5em;
  margin-bottom: 0.5em;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.4em;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h4 {
  font-family: var(--fo-sans);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
}

p, li {
  max-width: 72ch;
}

blockquote {
  background: transparent;
  border: none;
  border-left: 2px solid var(--fo-ink);
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
}

blockquote p {
  margin: 0 0 0.75rem;
  max-width: none;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote ol,
blockquote ul {
  margin: 0.5rem 0;
}

blockquote strong:first-child {
  color: var(--fo-saltire);
}

/* --- Page layout ------------------------------------------------- */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrapper > main {
  flex: 1;
}

main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  width: 100%;
}

/* --- Header ------------------------------------------------------

   ----------------------------------------------------------------- */
.site-header {
  background: var(--fo-paper);
  border-bottom: 3px solid var(--fo-ink);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header::before {
  content: none;
}

.header-inner {
  max-width: 58rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.site-logo {
  font-family: var(--fo-serif);
  color: var(--fo-ink);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-logo:hover,
.site-logo:focus-visible,
.site-logo:visited {
  color: var(--fo-ink);
}

.site-logo span {
  font-weight: 400;
  font-style: italic;
  color: var(--fo-ink-secondary);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--fo-ink);
  text-decoration: none;
  padding: 0.625rem 0.5rem;
  border-radius: 0;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--fo-duration) var(--fo-ease);
}

.site-nav a:visited {
  color: var(--fo-ink);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: transparent;
  color: var(--fo-ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.site-nav a[aria-current="page"],
.site-nav a[aria-current="true"] {
  background: transparent;
  color: var(--fo-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

/* --- Breadcrumbs ------------------------------------------------- */
.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.breadcrumbs li {
  display: inline;
}

.breadcrumbs li + li::before {
  content: "›";
  margin: 0 0.35em;
}

.breadcrumbs {
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.breadcrumbs a {
  color: var(--fo-ink-quiet);
  text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
  color: var(--fo-saltire);
  text-decoration: underline;
}

/* --- Page description -------------------------------------------- */
.page-description {
  font-size: 1.125rem;
  color: var(--fo-ink-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
  padding-left: 0;
  border-left: none;
  max-width: 55ch;
}

/* --- Heading anchors --------------------------------------------- */
.heading-anchor {
  color: var(--fo-saltire);
  text-decoration: none;
  font-family: var(--fo-sans);
  font-weight: 400;
  font-size: 0.8em;
  margin-left: 0.3em;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--fo-duration) var(--fo-ease), visibility 0s var(--fo-duration);
}

.heading-anchor:visited {
  color: var(--fo-saltire);
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
.heading-anchor:focus-visible {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--fo-duration) var(--fo-ease), visibility 0s;
}

.heading-anchor:hover {
  color: var(--fo-saltire);
}

/* --- Back to top ------------------------------------------------- */
.section-top {
  text-align: right;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--fo-rule);
}

.decision-text > .section-top:first-child,
.decision-full-text > .section-top:first-child {
  display: none;
}

.decision-full-text .section-top {
  border-top: none;
  margin-top: 0.5rem;
  padding-top: 0;
}

.back-to-top {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fo-ink-quiet);
  text-decoration: none;
  transition: color var(--fo-duration) var(--fo-ease);
}

.back-to-top:visited {
  color: var(--fo-ink-quiet);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  color: var(--fo-saltire);
}

/* --- Table of contents ------------------------------------------- */
.toc {
  background: transparent;
  border: none;
  border-top: 1px solid var(--fo-ink);
  padding: 1.25rem 0;
  margin-bottom: 2.5rem;
}

.toc-title {
  font-family: var(--fo-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fo-ink);
  margin: 0 0 0.75rem;
  padding: 0;
  border: none;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  max-width: none;
  margin: 0;
  padding: 0;
}

.toc > ul > li {
  border-bottom: 1px solid var(--fo-rule);
}

.toc > ul > li:last-child {
  border-bottom: none;
}

.toc a {
  display: block;
  padding: 0.45rem 0;
  color: var(--fo-ink-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--fo-duration) var(--fo-ease);
}

.toc a:visited {
  color: var(--fo-ink-secondary);
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--fo-saltire);
}

/* Indent nested items */
.toc ul ul {
  padding-left: 1rem;
}

.toc ul ul a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--fo-ink-quiet);
}

.toc ul ul a:visited {
  color: var(--fo-ink-quiet);
}

.toc ul ul a:hover {
  color: var(--fo-saltire);
}

/* --- Messages ---------------------------------------------------- */
.message {
  border-radius: var(--fo-radius);
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.message-info {
  background: #EBF2F8;
  border-left: 2px solid var(--fo-ink);
  color: #1A3E5A;
}

.message-warning {
  background: var(--fo-partial-bg);
  border-left: 2px solid #B8860B;
  color: var(--fo-partial-text);
}

.message-error {
  background: #FDF0F0;
  border-left: 2px solid #B91C1C;
  color: #7F1D1D;
}

/* --- Buttons -----------------------------------------------------
   ----------------------------------------------------------------- */
.btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  background: var(--fo-ink);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: background var(--fo-duration) var(--fo-ease),
              border-color var(--fo-duration) var(--fo-ease);
}

.btn:hover {
  background: var(--fo-ink-secondary);
  border-color: var(--fo-ink-secondary);
  color: #fff;
}

.btn:active {
  background: #000000;
  border-color: #000000;
}

.btn:visited {
  color: #fff;
}

.btn-secondary {
  background: var(--fo-paper);
  color: var(--fo-ink);
  border: 1px solid var(--fo-ink);
}

.btn-secondary:hover {
  border-color: var(--fo-ink);
  background: var(--fo-parchment);
  color: var(--fo-ink);
}

.btn-secondary:visited {
  color: var(--fo-ink);
}

/* Legacy Datasette form buttons */
input[type="submit"],
button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  background: var(--fo-ink);
  color: #fff;
  cursor: pointer;
  transition: background var(--fo-duration) var(--fo-ease);
}

input[type="submit"]:hover,
button:hover {
  background: var(--fo-ink-secondary);
  border-color: var(--fo-ink-secondary);
}

/* --- Form elements ----------------------------------------------- */
input,
select,
textarea {
  font: inherit;
  font-size: 0.9rem;
  background: var(--fo-paper);
  color: var(--fo-ink);
  border: 2px solid var(--fo-rule-strong);
  border-radius: var(--fo-radius);
  padding: 0.625rem 0.75rem;
  transition: border-color var(--fo-duration) var(--fo-ease),
              box-shadow var(--fo-duration) var(--fo-ease);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--fo-saltire);
  outline: 3px solid var(--fo-focus);
  outline-offset: 1px;
  box-shadow: none;
}

label {
  font-weight: 600;
  display: inline-block;
  margin-bottom: 0.2rem;
  color: var(--fo-ink);
  font-size: 0.875rem;
}

fieldset {
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1rem;
}

/* --- Filters ----------------------------------------------------- */
.filters-panel {
  margin-top: 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}

.filters-panel summary {
  padding: 0.4rem 0;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  transition: color var(--fo-duration) var(--fo-ease);
  list-style: none;
}

.filters-panel summary::-webkit-details-marker {
  display: none;
}

.filters-panel summary::before {
  content: '+ ';
  font-weight: 700;
  color: var(--fo-saltire);
}

.filters-panel[open] summary::before {
  content: '− ';
}

.filters-panel summary:hover {
  color: var(--fo-saltire);
}

.filters-panel[open] summary {
  border-bottom: none;
  margin-bottom: 0.5rem;
}

.filters-inner {
  padding: 1rem;
  background: var(--fo-parchment);
  border-radius: var(--fo-radius);
  border: 1px solid var(--fo-rule);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

.filter-row .select-wrapper {
  flex: 1;
  min-width: 8rem;
}

.filter-row select {
  width: 100%;
}

.filter-row .filter-value {
  flex: 2;
  min-width: 8rem;
}

.sort-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--fo-rule);
}

.sort-row label {
  font-weight: 400;
  font-size: 0.825rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Results count ----------------------------------------------- */
.results-summary {
  font-size: 0.875rem;
  color: var(--fo-ink-secondary);
  margin-bottom: 1rem;
}

.results-summary strong {
  color: var(--fo-ink);
  font-weight: 700;
}

/* --- Decision cards ----------------------------------------------

   ----------------------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
  list-style: none;
  padding: 0;
  margin-top: 0;
}

.decision-card {
  position: relative;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--fo-rule-strong);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s var(--fo-ease);
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-link:focus-visible {
  outline: none;
}

.card-link:focus-visible::after {
  outline: 3px solid var(--fo-focus);
  outline-offset: 2px;
  border-radius: var(--fo-radius);
}

.decision-card:hover {
  background: var(--fo-parchment);
}

.decision-card:hover .card-ref {
  color: var(--fo-saltire);
}

.decision-card:hover .card-cta {
  color: var(--fo-saltire-hover);
}

.card-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-ref {
  font-family: var(--fo-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--fo-ink);
  margin: 0;
  line-height: 1.3;
  transition: color var(--fo-duration) var(--fo-ease);
}

.card-ref a {
  text-decoration: none;
  color: inherit;
}

.card-ref a:hover {
  text-decoration: underline;
}

.card-authority {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fo-ink);
  margin: 0;
}

.card-date {
  font-size: 0.8rem;
  color: var(--fo-ink-quiet);
}

.card-summary {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fo-ink-secondary);
  margin: 0.25rem 0 0;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.card-cta {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fo-saltire);
  transition: color var(--fo-duration) var(--fo-ease);
}

.card-view-link {
  font-size: 0.825rem;
  font-weight: 600;
}

.card-view-link a {
  text-decoration: none;
  color: var(--fo-saltire);
}

.card-view-link a:hover {
  text-decoration: underline;
}

.card-view-link::after {
  content: " →";
}

.card-source-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fo-ink-quiet);
  text-decoration: none;
  transition: color var(--fo-duration) var(--fo-ease);
}

.card-source-link:hover {
  color: var(--fo-saltire);
  text-decoration: underline;
}

.card-source-link:visited {
  color: var(--fo-ink-quiet);
}

/* --- Outcome badges ----------------------------------------------

   ----------------------------------------------------------------- */
.outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.outcome-for-applicant {
  background: var(--fo-granted-bg);
  border: 1px solid var(--fo-granted-border);
  color: var(--fo-granted-text);
}

.outcome-for-applicant::before {
  content: "\2713";  /* ✓ */
}

.outcome-for-authority {
  background: var(--fo-refused-bg);
  border: 1px solid var(--fo-refused-border);
  color: var(--fo-refused-text);
}

.outcome-for-authority::before {
  content: "\2014";  /* — */
}

.outcome-partially-upheld {
  background: var(--fo-partial-bg);
  border: 1px solid var(--fo-partial-border);
  color: var(--fo-partial-text);
}

.outcome-partially-upheld::before {
  content: "\00BD";  /* ½ */
}

.outcome-unknown {
  background: var(--fo-parchment);
  border: 1px solid var(--fo-rule);
  color: var(--fo-ink-quiet);
}

/* --- Pagination -------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1.5rem 0;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--fo-rule-strong);
  border-radius: 2em;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--fo-saltire);
  background: var(--fo-paper);
  transition: all var(--fo-duration) var(--fo-ease);
}

.pagination a:hover,
.pagination a:focus-visible {
  border-color: var(--fo-saltire);
  background: var(--fo-saltire-light);
}

.pagination a:visited {
  color: var(--fo-saltire);
}

/* --- Row page (individual decision) ------------------------------

   ----------------------------------------------------------------- */
.decision-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--fo-rule);
}

.decision-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.decision-header-top h1 {
  margin-bottom: 0;
}

.outcome-badge-lg {
  font-size: 0.875rem;
  padding: 0.3rem 0.85rem;
}

.decision-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  margin-top: 0.5rem;
}

.decision-meta dt {
  font-family: var(--fo-sans);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fo-ink-secondary);
}

.decision-meta dd {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

/* --- Decision topic ---------------------------------------------- */
.decision-topic {
  margin-bottom: 1.25rem;
}

.decision-topic p {
  font-family: var(--fo-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--fo-ink);
  margin: 0;
  max-width: 65ch;
}

/* --- Decision sections ------------------------------------------- */
.decision-section {
  background: transparent;
  border: none;
  border-top: 1px solid var(--fo-ink);
  padding: 2rem 0;
  margin-bottom: 0;
}

.decision-section h2 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: none;
}

/* --- Compliance section ------------------------------------------ */
.decision-compliance {
  border-left: 2px solid var(--fo-ink);
}

.compliance-detail {
  margin-bottom: 0.75rem;
}

.compliance-detail:last-child {
  margin-bottom: 0;
}

.compliance-detail dt {
  font-family: var(--fo-sans);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fo-ink-quiet);
  margin-bottom: 0.2rem;
}

.compliance-detail dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 65ch;
}

/* --- Key points list --------------------------------------------- */
.key-points-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.key-points-list li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-bottom: 1px solid var(--fo-rule);
  line-height: 1.6;
  font-size: 0.95rem;
}

.key-points-list li:last-child {
  border-bottom: none;
}

.key-points-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fo-ink);
}

/* --- Exemption badges -------------------------------------------- */
.badge-procedural,
.badge-upheld,
.badge-not-upheld {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 2em;
  font-family: var(--fo-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.badge-procedural {
  background: var(--fo-parchment);
  border: 1px solid var(--fo-rule-strong);
  color: var(--fo-ink-quiet);
}

.badge-upheld {
  background: var(--fo-refused-bg);
  border: 1px solid var(--fo-refused-border);
  color: var(--fo-refused-text);
}

.badge-not-upheld {
  background: var(--fo-granted-bg);
  border: 1px solid var(--fo-granted-border);
  color: var(--fo-granted-text);
}

.decision-text {
  font-family: var(--fo-sans);
  line-height: 1.75;
  font-size: 1rem;
}

.decision-text h2 {
  padding-top: 1.5em;
  border-top: 1px solid var(--fo-rule);
}

.decision-text p {
  margin-bottom: 0.75rem;
}

.decision-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* --- Decisions list page ----------------------------------------- */
.decisions-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.decisions-stat {
  background: transparent;
  border: none;
  border-top: 1px solid var(--fo-ink);
  padding: 1rem 0;
  text-align: left;
}

.decisions-stat-value {
  display: block;
  font-family: var(--fo-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fo-ink);
  line-height: 1.2;
}

.decisions-stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fo-ink-quiet);
  margin-top: 0.25rem;
}

/* --- Browse panels ----------------------------------------------- */
.browse-panel {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.browse-panel summary {
  cursor: pointer;
  padding: 0;
  list-style: none;
  border: none;
  background: none;
}

.browse-panel summary::-webkit-details-marker {
  display: none;
}

.browse-panel summary::marker {
  content: "";
}

.browse-panel summary {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fo-ink-quiet);
}

.browse-panel summary::after {
  content: " ▾";
  font-size: 0.8em;
}

.browse-panel[open] summary::after {
  content: " ▴";
}

.browse-panel summary:hover {
  color: var(--fo-saltire);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.browse-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--fo-rule);
  text-decoration: none;
  color: var(--fo-ink);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--fo-duration) var(--fo-ease);
}

.browse-item:visited {
  color: var(--fo-ink);
}

.browse-item:hover,
.browse-item:focus-visible {
  color: var(--fo-saltire);
}

.browse-item-label {
  font-weight: 600;
}

.browse-item-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fo-ink-quiet);
  background: transparent;
  padding: 0;
  min-width: 1.5rem;
  text-align: right;
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.browse-item-row {
  border-radius: var(--fo-radius-sm);
}

/* --- Authority groups -------------------------------------------- */
.authority-group {
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius-sm);
  margin-top: 0.5rem;
  background: none;
  padding: 0;
}

.authority-group summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  list-style: none;
  border: none;
  background: none;
  border-radius: var(--fo-radius-sm);
  transition: background var(--fo-duration) var(--fo-ease);
}

.authority-group summary::-webkit-details-marker {
  display: none;
}

.authority-group summary::marker {
  content: "";
}

.authority-group summary:hover {
  background: var(--fo-parchment);
}

.authority-group summary [role="heading"] {
  font-family: var(--fo-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fo-ink);
}

.authority-group-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fo-ink-quiet);
  background: var(--fo-parchment);
  border-radius: 2em;
  padding: 0.1rem 0.5rem;
}

.authority-group summary::after {
  content: "▸";
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--fo-ink-quiet);
  transition: transform var(--fo-duration) var(--fo-ease);
}

.authority-group[open] summary::after {
  content: "▾";
}

.authority-group[open] summary {
  border-bottom: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius-sm) var(--fo-radius-sm) 0 0;
}

.authority-group .browse-list {
  padding: 0.5rem;
  margin-top: 0;
}

/* --- Facets ------------------------------------------------------ */
.facet-results {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--fo-shadow-sm);
}

.facet-info {
  margin-bottom: 0.75rem;
}

.facet-info:last-child {
  margin-bottom: 0;
}

.facet-info-name {
  margin: 0 0 0.25rem;
  font-size: 0.825rem;
}

.facet-info-total {
  color: var(--fo-ink-quiet);
  font-weight: 400;
}

.tight-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tight-bullets li {
  padding: 0.2rem 0.4rem;
  border-radius: var(--fo-radius-sm);
  font-size: 0.825rem;
}

.tight-bullets a {
  text-decoration: none;
}

.tight-bullets a:hover {
  text-decoration: underline;
}

.cross {
  color: var(--fo-ink-quiet);
  text-decoration: none;
  font-size: 0.8rem;
}

.cross:hover {
  color: var(--fo-ink);
}

.suggested-facets {
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  margin-bottom: 1rem;
}

/* --- Export links ------------------------------------------------- */
.export-links {
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  margin-bottom: 1rem;
}

.advanced-export {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  box-shadow: var(--fo-shadow-sm);
}

.advanced-export h3 {
  margin-top: 0;
}

/* --- Tables (fallback) ------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  overflow: hidden;
}

th, td {
  border: 1px solid var(--fo-rule);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--fo-parchment);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fo-ink-secondary);
}

th a {
  color: var(--fo-ink-secondary);
  text-decoration: none;
}

th a:hover {
  color: var(--fo-saltire);
}

tbody tr:nth-child(even) {
  background: var(--fo-parchment);
}

/* --- Code / SQL -------------------------------------------------- */
code, pre {
  font-family: var(--fo-mono);
}

code {
  background: var(--fo-parchment);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}

pre {
  background: var(--fo-parchment);
  padding: 0.75rem 1rem;
  border-radius: var(--fo-radius);
  overflow-x: auto;
  border: 1px solid var(--fo-rule);
}

.wrapped-sql {
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Details / Summary ------------------------------------------- */
details {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  margin-bottom: 0.75rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  transition: color var(--fo-duration) var(--fo-ease);
}

details summary:hover {
  color: var(--fo-saltire);
}

details[open] summary {
  border-bottom: 1px solid var(--fo-rule);
}

details > :not(summary) {
  padding: 0.5rem 0.85rem;
}

/* --- Footer ------------------------------------------------------
   
   ----------------------------------------------------------------- */
.site-footer {
  background: var(--fo-ink);
  color: rgba(255, 255, 255, 0.78);
  margin-top: auto;
  font-size: 0.875rem;
}

.footer-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.footer-inner p {
  margin: 0.25rem 0;
}

.site-footer a {
  color: #ffffff;
}

.site-footer a:visited {
  color: rgba(255, 255, 255, 0.85);
}

.site-footer a:hover {
  color: #fff;
  text-decoration-thickness: 2px;
}

/* --- Zero results ------------------------------------------------ */
.zero-results {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--fo-ink-secondary);
  font-size: 1rem;
}

/* --- Column descriptions ----------------------------------------- */
.column-descriptions {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.column-descriptions dt {
  font-weight: 700;
  margin-top: 0.5rem;
}

.column-descriptions dt:first-child {
  margin-top: 0;
}

.column-descriptions dd {
  margin: 0;
  color: var(--fo-ink-secondary);
}

/* --- Extra wheres ------------------------------------------------ */
.extra-wheres {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* --- Responsive: tablet+ ----------------------------------------- */
@media (min-width: 40rem) {
  main {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.15rem;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .decision-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
  }

  .decision-header h1 {
    font-size: 2.25rem;
  }

  .decisions-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .decision-topic p {
    font-size: 1.25rem;
  }

}

/* --- Responsive: desktop ----------------------------------------- */
@media (min-width: 64rem) {
  body {
    font-size: 1.0625rem;
  }

  main {
    padding: 3rem 2rem;
  }

  h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.75rem;
    margin-top: 2.5em;
  }

  h3 {
    font-size: 1.25rem;
  }

  .site-logo {
    font-size: 1.35rem;
  }

  .site-nav a {
    font-size: 0.9375rem;
    padding: 0.625rem 0.5rem;
  }

  .header-inner {
    padding: 0.875rem 1rem;
  }

  .breadcrumbs {
    font-size: 0.875rem;
    margin-bottom: 1rem;
  }

  .card-grid {
    gap: 1.25rem;
  }

  .decision-card {
    padding: 1.5rem 1.75rem;
    gap: 0.5rem;
  }

  .decision-section {
    padding: 2.5rem 0;
    margin-bottom: 0;
  }

  .decision-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
  }

  .decision-header h1 {
    font-size: 2.75rem;
  }

  .pit-panel {
    padding: 1.5rem 1.75rem;
  }

  .decision-text {
    font-size: 1.0625rem;
  }

  .footer-inner {
    padding: 2.5rem 1rem;
  }
}

/* --- Reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .decision-card:hover,
  .decision-card:focus-visible {
    transform: none;
  }
}

/* --- Challenge tool ---------------------------------------------- */
.challenge-progress {
  font-size: 0.875rem;
  color: var(--fo-ink-quiet);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.challenge-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.challenge-fieldset legend {
  font-family: var(--fo-serif);
  font-size: 1.625rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fo-ink);
  margin-bottom: 0.75rem;
  padding: 0;
  float: none;
  width: 100%;
}

.challenge-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.challenge-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 1.0625rem;
  min-height: 44px;
  transition: border-color var(--fo-duration) var(--fo-ease),
              background var(--fo-duration) var(--fo-ease);
}

.challenge-option:hover {
  border-color: var(--fo-ink);
  background: var(--fo-parchment);
}

.challenge-option input[type="radio"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--fo-ink);
}

.challenge-option:has(input:checked) {
  border-color: var(--fo-ink);
  background: var(--fo-ink);
  color: #fff;
  font-weight: 600;
}

.challenge-option:has(input:checked) input {
  accent-color: #fff;
}

.challenge-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.challenge-review-textarea {
  width: 100%;
  min-height: 12rem;
  font-family: var(--fo-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  margin-top: 0.5rem;
}

.challenge-copy-status {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fo-granted-text);
}

/* --- Challenge tool: multiselect branches ------------------------ */

.challenge-options-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  color: var(--fo-ink-quiet);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.challenge-options-separator::before,
.challenge-options-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--fo-rule-strong);
}

.challenge-branch-label {
  background: var(--fo-parchment);
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fo-ink);
}

/* --- Multi-challenge tool ---------------------------------------- */

.multi-progress {
  font-size: 0.875rem;
  color: var(--fo-ink-quiet);
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--fo-rule);
}

.multi-triage-fieldset {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--fo-rule);
}

.multi-triage-fieldset:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.multi-selector-group {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.multi-selector-group:last-child {
  margin-bottom: 0;
}

.multi-selector-group legend {
  font-family: var(--fo-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--fo-ink);
  margin-bottom: 0.75rem;
  padding: 0;
  float: none;
  width: 100%;
}

.challenge-option input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--fo-ink);
}

.challenge-option:has(input[type="checkbox"]:checked) {
  border-color: var(--fo-ink);
  background: var(--fo-ink);
  color: #fff;
  font-weight: 600;
}

/* --- Public interest evidence ------------------------------------ */
.pi-evidence {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--fo-rule-strong);
}

.pi-evidence > h2 {
  margin-top: 0;
}

.pi-stat-label {
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  font-weight: 500;
  margin-top: 0.15rem;
}

.pi-subsection-table {
  margin-bottom: 1.5rem;
}

.pi-subsection-table td:nth-child(2),
.pi-subsection-table td:nth-child(3),
.pi-subsection-table td:nth-child(4),
.pi-subsection-table th:nth-child(2),
.pi-subsection-table th:nth-child(3),
.pi-subsection-table th:nth-child(4) {
  text-align: right;
}

.pi-theme-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.pi-theme {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--fo-rule);
}

.pi-theme:last-child {
  border-bottom: none;
}

.pi-theme-name {
  font-family: var(--fo-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fo-ink);
}

.pi-theme-desc {
  font-size: 0.9rem;
  color: var(--fo-ink-secondary);
  line-height: 1.55;
  max-width: 60ch;
}

.pi-examples {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pi-example {
  background: transparent;
  border: none;
  border-top: 1px solid var(--fo-rule-strong);
  padding: 1rem 0;
}

.pi-example-meta {
  font-size: 0.825rem;
  color: var(--fo-ink-quiet);
  margin-bottom: 0.25rem;
}

.pi-example-topic {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fo-ink);
  margin: 0;
}

.pi-example-outcome {
  font-size: 0.825rem;
  margin-top: 0.25rem;
}

.pi-suggestions {
  background: var(--fo-parchment);
  border: none;
  border-left: 2px solid var(--fo-ink);
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
}

.pi-suggestions h3 {
  margin-top: 0;
  font-size: 1rem;
}

.pi-suggestions label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-weight: 400;
  font-size: 0.9375rem;
  cursor: pointer;
}

.pi-suggestions input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--fo-saltire);
}

/* --- Authority page ---------------------------------------------- */

.authority-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.authority-stat {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: var(--fo-parchment);
  border: 1px solid var(--fo-rule);
  border-radius: 2em;
  font-size: 0.8125rem;
  color: var(--fo-ink-secondary);
  line-height: 1.3;
}

.authority-stat-number {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--fo-ink);
  font-variant-numeric: tabular-nums;
}

.authority-stat-label {
  font-weight: 400;
}

/* Hide redundant authority name on authority page cards */
.authority-cards .card-authority {
  display: none;
}

/* --- Card sections (exemption tags) ------------------------------ */

.card-sections {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--fo-ink-quiet);
  line-height: 1.5;
}

/* --- Pagination -------------------------------------------------- */

.pagination {
  margin: 1.5rem 0;
}

.pagination ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
}

.pagination li a,
.pagination li span {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius-sm);
  text-decoration: none;
  color: var(--fo-link);
  background: var(--fo-paper);
  min-width: 2.25rem;
  text-align: center;
}

.pagination li a:hover {
  background: var(--fo-saltire-light);
  border-color: var(--fo-saltire);
}

.pagination-current span {
  background: var(--fo-saltire);
  color: var(--fo-paper);
  border-color: var(--fo-saltire);
  font-weight: 600;
}

.pagination-disabled span {
  color: var(--fo-ink-faint);
  cursor: default;
}

.pagination-ellipsis span {
  border-color: transparent;
  background: transparent;
  padding: 0.4rem 0.25rem;
  color: var(--fo-ink-quiet);
}

/* --- Decision single page ---------------------------------------- */

/* Section tags (exemption labels in header) */
.decision-sections-bar {
  margin-top: 0.5rem;
}

.decision-sections-bar dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fo-ink-quiet);
  margin-bottom: 0.25rem;
}

.section-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.section-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--fo-radius);
  background: var(--fo-parchment);
  border: 1px solid var(--fo-rule);
  color: var(--fo-ink);
}

.section-tag--upheld {
  background: #fef3f2;
  border-color: #d4918a;
  color: #7a2e28;
}

.section-tag--not-upheld {
  background: #f0faf4;
  border-color: #82b89a;
  color: #1e5631;
}

.decision-source-note {
  font-size: 0.85rem;
  color: var(--fo-ink-quiet);
  border-top: 1px solid var(--fo-rule);
  padding-top: 1rem;
  margin-top: 2rem;
  max-width: 55ch;
}

/* Full decision text */
.decision-full-text {
  margin-top: 1.5rem;
  padding-top: 0;
  border-top: none;
}

.decision-full-text p {
  font-family: var(--fo-sans);
  line-height: 1.8;
  margin-bottom: 0.75rem;
  max-width: 72ch;
}

.decision-full-text ol {
  max-width: 72ch;
  line-height: 1.75;
  padding-left: 1.5rem;
}

.decision-full-text h2 {
  font-size: 1.2rem;
  text-transform: none;
  letter-spacing: -0.01em;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  border-top: none;
}

.decision-full-text h3 {
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: -0.01em;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.exemption-block {
  padding: 1rem 0;
  border-bottom: 1px solid var(--fo-rule);
}

.exemption-block:last-child {
  border-bottom: none;
}

.exemption-block h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* --- PIT panel (public interest test on decision pages) ---------- */

.pit-panel {
  background: var(--fo-parchment);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
}

.pit-panel h4 {
  font-family: var(--fo-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fo-saltire);
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.pit-outcome {
  font-family: var(--fo-sans);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.pit-outcome--disclosure {
  color: var(--fo-granted-text);
}

.pit-outcome--withholding {
  color: var(--fo-refused-text);
}

.pit-columns {
  display: grid;
  gap: 0;
}

.pit-side {
  padding: 0.75rem 0;
  border-top: 1px solid var(--fo-rule-strong);
}

.pit-side h5 {
  font-family: var(--fo-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
  line-height: 1.2;
}

.pit-side--disclosure h5 {
  color: var(--fo-granted-text);
}

.pit-side--withholding h5 {
  color: var(--fo-refused-text);
}

.pit-side ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pit-side li {
  font-family: var(--fo-sans);
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 0.2rem 0;
  color: var(--fo-ink);
}

.pit-decisive {
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--fo-rule-strong);
}

.pit-decisive h5 {
  font-family: var(--fo-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fo-saltire);
  margin: 0 0 0.4rem;
  line-height: 1.2;
}

.pit-decisive ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pit-decisive li {
  font-family: var(--fo-sans);
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 0.2rem 0;
  color: var(--fo-ink);
}

.decision-timeline {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
}

.decision-timeline dt {
  font-weight: 600;
  color: var(--fo-ink-secondary);
}

.decision-timeline dd {
  margin: 0;
}

.decision-findings summary {
  cursor: pointer;
  padding: 0.5rem 0;
  color: var(--fo-link);
}

.decision-findings-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  border: none;
}

.decision-findings summary:hover {
  text-decoration: underline;
}

.decision-findings[open] summary {
  margin-bottom: 0.5rem;
}

.decision-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.decision-links a {
  color: var(--fo-link);
  text-decoration: underline;
}

.decision-links a:hover,
.decision-links a:focus-visible {
  color: var(--fo-link-hover);
}

/* --- Homepage ---------------------------------------------------- */

main.home-page {
  max-width: none;
  padding: 0;
}

/* Hero */
.home-hero {
  background: var(--fo-paper);
  color: var(--fo-ink);
  position: relative;
  overflow: hidden;
}

.home-hero-saltire {
  display: none;
}

.home-hero-saltire svg {
  width: 100%;
  height: 100%;
}

.home-hero-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 4.5rem 1rem 4rem;
  position: relative;
  z-index: 1;
  animation: homeReveal 0.6s var(--fo-ease) both;
}

.home-hero h1 {
  font-family: var(--fo-serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fo-ink);
  margin: 0 0 1.5rem;
  max-width: 16ch;
}

.home-hero-lead {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  line-height: 1.55;
  color: var(--fo-ink-secondary);
  max-width: 46ch;
  margin: 0 0 2.5rem;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-hero-primary {
  display: inline-block;
  background: var(--fo-ink);
  color: #fff;
  padding: 1rem 2.5rem;
  border-radius: 0;
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  transition: background var(--fo-duration) var(--fo-ease);
}

.btn-hero-primary:hover,
.btn-hero-primary:focus-visible {
  background: var(--fo-ink-secondary);
  color: #fff;
}

.btn-hero-primary:visited {
  color: #fff;
}

.btn-hero-secondary {
  display: inline-block;
  background: transparent;
  color: var(--fo-link);
  border: none;
  padding: 1rem 0.5rem;
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  transition: color var(--fo-duration) var(--fo-ease);
}

.btn-hero-secondary:hover,
.btn-hero-secondary:focus-visible {
  background: transparent;
  color: var(--fo-link-hover);
  text-decoration-thickness: 3px;
}

.btn-hero-secondary:visited {
  color: var(--fo-link);
}

/* Pathway cards */
.home-pathways {
  max-width: 52rem;
  margin: 0 auto;
  padding: 3rem 1rem;
  animation: homeReveal 0.6s var(--fo-ease) 0.15s both;
}

.home-pathways-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.home-pathway {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  border-top: 1px solid var(--fo-ink);
  padding: 1.5rem 0 1rem;
  text-decoration: none;
  color: var(--fo-ink);
  transition: background 0.15s var(--fo-ease);
}

.home-pathway:visited {
  color: var(--fo-ink);
}

.home-pathway:hover,
.home-pathway:focus-visible {
  background: var(--fo-parchment);
}

svg.home-pathway-icon {
  display: none;
}

.home-pathway h3 {
  font-family: var(--fo-serif);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--fo-ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.home-pathway p {
  font-size: 0.9375rem;
  color: var(--fo-ink-secondary);
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

.home-pathway-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fo-link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color var(--fo-duration) var(--fo-ease);
}

.home-pathway:hover .home-pathway-cta {
  color: var(--fo-saltire-hover);
}

/* Homepage entrance animation */
@keyframes homeReveal {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Homepage responsive: tablet+ */
@media (min-width: 40rem) {
  .home-hero-inner {
    padding: 5.5rem 1.5rem 5rem;
  }

  .home-pathways-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .home-pathway {
    display: grid;
    grid-template-columns: 16rem 1fr;
    gap: 0.25rem 2rem;
    align-items: baseline;
    padding: 2rem 0;
  }

  .home-pathway h3 {
    grid-row: span 2;
    margin: 0;
  }

  .home-pathway:last-child {
    border-bottom: 1px solid var(--fo-ink);
  }
}

/* Homepage responsive: desktop */
@media (min-width: 64rem) {
  .home-hero-inner {
    padding: 6.5rem 2rem 6rem;
  }

  .home-pathways {
    padding: 4rem 2rem;
  }
}

/* --- Print ------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .filters-panel,
  .pagination,
  .export-links,
  .advanced-export,
  .suggested-facets,
  .heading-anchor,
  .section-top {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .decision-card,
  .decision-section {
    break-inside: avoid;
    box-shadow: none;
    border-color: #ccc;
  }

  .pit-panel {
    break-inside: avoid;
    background: none;
    border-color: #ccc;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .card-view-link::after {
    content: none;
  }
}

/* --- Templates index page ---------------------------------------- */

/* Category quick-jump navigation — bold blue panel */
.templates-nav {
  margin-bottom: 2rem;
}

.templates-nav #TableOfContents {
  background: transparent;
  border-top: 1px solid var(--fo-ink);
  padding: 1.25rem 0 0;
}

.templates-nav #TableOfContents > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.templates-nav #TableOfContents > ul > li {
  margin: 0;
  max-width: none;
}

.templates-nav #TableOfContents a {
  display: inline-block;
  padding: 0.35rem 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  color: var(--fo-link);
  transition: color 0.2s var(--fo-ease);
}

.templates-nav #TableOfContents a:visited {
  color: var(--fo-link);
}

.templates-nav #TableOfContents a:hover,
.templates-nav #TableOfContents a:focus-visible {
  color: var(--fo-link-hover);
  text-decoration-thickness: 2px;
}

/* Content area */
.templates-index {
  font-family: var(--fo-sans);
  line-height: 1.65;
}

/* Intro & section note paragraphs */
.templates-index > p {
  color: var(--fo-ink-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  max-width: 65ch;
}

/* Back-to-top links between template categories */
.templates-index > .section-top {
  margin-top: 1.5rem;
}

/* Hide the first back-to-top (before the first category) */
.templates-index > .section-top:first-child {
  display: none;
}

/* Category headings — tinted bar with thick left accent */
.templates-index > h2 {
  font-family: var(--fo-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fo-ink);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--fo-ink);
  border-left: none;
  border-bottom: none;
  background: transparent;
  scroll-margin-top: 5rem;
}

.templates-index > h2:first-of-type {
  margin-top: 1.25rem;
}

/* Hide heading anchor hash inside tinted bar */
.templates-index > h2 > .heading-anchor {
  opacity: 0;
}
.templates-index > h2:hover > .heading-anchor {
  opacity: 0.7;
}

/* Template list items — title on one line, description below */
.templates-index > ul > li {
  max-width: none;
  color: var(--fo-ink-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 0.35rem;
}

.templates-index > ul > li > a {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
}

/* Responsive */
@media (min-width: 48rem) {
  .templates-nav #TableOfContents {
    padding: 1.25rem 0 0;
  }

  .templates-nav #TableOfContents a {
    font-size: 0.9375rem;
    padding: 0.4rem 0;
  }

  .templates-index > h2 {
    font-size: 1.4rem;
  }
}

@media (min-width: 64rem) {
  .templates-index > h2 {
    font-size: 1.5rem;
    margin-top: 3rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .templates-nav #TableOfContents a:hover {
    transform: none;
  }
}

/* --- Template request bank (single pages) ----------------------- */

.template-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  border-radius: 2em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.template-badge-foisa {
  background: var(--fo-saltire-light);
  border: 1px solid rgba(26, 82, 118, 0.25);
  color: var(--fo-saltire);
}

.template-badge-eir {
  background: #EEF6EE;
  border: 1px solid rgba(34, 120, 55, 0.25);
  color: #1B5E2B;
}

.template-text {
  background: var(--fo-paper);
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  padding: 2rem 2.25rem;
  margin: 1rem 0 1.5rem;
  white-space: pre-line;
  font-family: var(--fo-serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  position: relative;
}

.template-text::before {
  content: none;
}

.template-text p {
  max-width: none;
}

/* Placeholder highlights — injected by JS */
.template-placeholder {
  background: #FEF3C7;
  color: #92400E;
  padding: 0.05em 0.25em;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
}

.template-copy-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
}

.template-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--fo-ink);
  border-radius: 0;
  background: var(--fo-ink);
  color: #fff;
  font-family: var(--fo-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fo-duration) var(--fo-ease),
              color var(--fo-duration) var(--fo-ease),
              border-color var(--fo-duration) var(--fo-ease);
}

.template-copy-btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.template-copy-btn:hover,
.template-copy-btn:focus-visible {
  background: var(--fo-ink-secondary);
  border-color: var(--fo-ink-secondary);
  color: #fff;
}

.template-copy-btn[data-copied] {
  background: #166534;
  border-color: #166534;
  color: #fff;
}

.template-copy-status {
  font-size: 0.85rem;
  color: var(--fo-ink-quiet);
}

/* Template single pages: compact layout, no back-to-top dividers */
.template-page .section-top {
  display: none;
}

.template-page h2 {
  margin-top: 1.25em;
  margin-bottom: 0.35em;
}

.template-page .page-description {
  margin-bottom: 0.75rem;
}

.template-page .decision-text > p:first-child {
  margin-top: 0;
}


/* ============================================================
   GLOSSARY PAGE
   ============================================================ */

/* A-Z letter-tile navigation */
.glossary-nav {
  margin-bottom: 2rem;
}

.glossary-nav #TableOfContents > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: flex-start;
}

.glossary-nav #TableOfContents > ul > li {
  margin: 0;
  max-width: none;
}

.glossary-nav #TableOfContents a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  font-family: var(--fo-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--fo-ink);
  background: var(--fo-paper);
  border: 1px solid var(--fo-ink);
  border-radius: var(--fo-radius-sm);
  transition: background var(--fo-duration) var(--fo-ease),
              color var(--fo-duration) var(--fo-ease),
              border-color var(--fo-duration) var(--fo-ease),
              transform var(--fo-duration) var(--fo-ease);
}

.glossary-nav #TableOfContents a:visited {
  color: var(--fo-ink);
}

.glossary-nav #TableOfContents a:hover,
.glossary-nav #TableOfContents a:focus-visible {
  background: var(--fo-ink);
  border-color: var(--fo-ink);
  color: #fff;
}

.glossary-nav #TableOfContents a:focus-visible {
  outline: 3px solid var(--fo-focus);
  outline-offset: 2px;
}

/* Glossary body */
.glossary-body {
  font-family: var(--fo-sans);
  line-height: 1.65;
}

/* Letter headings */
.glossary-body > h2 {
  font-family: var(--fo-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fo-saltire);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-top: none;
  border-bottom: 2px solid var(--fo-saltire);
  scroll-margin-top: 5rem;
}

/* Hide heading anchor hash */
.glossary-body > h2 > .heading-anchor {
  opacity: 0;
}
.glossary-body > h2:hover > .heading-anchor {
  opacity: 0.7;
}

/* Definition lists */
.glossary-body dl {
  margin: 0 0 1rem;
}

.glossary-body dt {
  font-weight: 700;
  color: var(--fo-ink);
  margin-top: 1.5rem;
  font-size: 1rem;
  scroll-margin-top: 5rem;
}

.glossary-anchor {
  color: var(--fo-saltire);
  text-decoration: none;
  font-family: var(--fo-sans);
  font-weight: 400;
  font-size: 0.8em;
  margin-left: 0.35em;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--fo-duration) var(--fo-ease), visibility 0s var(--fo-duration);
}

.glossary-anchor:visited {
  color: var(--fo-saltire);
}

dt:hover .glossary-anchor,
.glossary-anchor:focus-visible {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--fo-duration) var(--fo-ease), visibility 0s;
}

.glossary-body dd {
  color: var(--fo-ink-secondary);
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
}

/* Hide the first back-to-top (before letter A) */
.glossary-body > .section-top:first-child {
  display: none;
}

/* Responsive */
@media (min-width: 48rem) {
  .glossary-nav #TableOfContents a {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 0.9rem;
  }

  .glossary-body > h2 {
    font-size: 1.6rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .glossary-nav #TableOfContents a:hover {
    transform: none;
  }
}

/* Print */
@media print {
  .glossary-nav {
    display: none;
  }

  .glossary-body .section-top {
    display: none;
  }

  .glossary-body > h2 {
    break-after: avoid;
    margin-top: 1.5rem;
  }

  .glossary-body dt {
    break-after: avoid;
  }
}


/* ============================================================
   CHALLENGE INDEX PAGE
   ============================================================ */

/* Section headings — tinted bar with left accent */
.challenge-index > h2 {
  font-family: var(--fo-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fo-ink);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0 0.6rem 1rem;
  border-left: 2px solid var(--fo-ink);
  border-top: none;
  border-bottom: none;
  background: var(--fo-parchment);
  scroll-margin-top: 5rem;
}

.challenge-index > h2 > .heading-anchor {
  opacity: 0;
}
.challenge-index > h2:hover > .heading-anchor {
  opacity: 0.7;
}

@media (min-width: 48rem) {
  .challenge-index > h2 {
    font-size: 1.4rem;
  }
}

@media (min-width: 64rem) {
  .challenge-index > h2 {
    font-size: 1.5rem;
    margin-top: 3rem;
  }
}