/* =================================================================
   ================================================================= */

/* --- Fonts ------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

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

  --fo-paper: #FFFFFF;
  --fo-parchment: #F7F6F3;
  --fo-stone: #EDECEA;
  --fo-page: #F3F2EF;

  /* 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.1);
  --fo-rule-strong: rgba(28, 28, 31, 0.18);

  /* 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  */
  --fo-shadow-sm: 0 1px 2px rgba(28, 28, 31, 0.06);
  --fo-shadow-md: 0 2px 8px rgba(28, 28, 31, 0.07), 0 1px 2px rgba(28, 28, 31, 0.04);
  --fo-shadow-lg: 0 4px 16px rgba(28, 28, 31, 0.08), 0 1px 4px rgba(28, 28, 31, 0.04);

  /* Radii  */
  --fo-radius-sm: 4px;
  --fo-radius: 8px;
  --fo-radius-lg: 12px;

  /* 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: smooth;
}

body {
  margin: 0;
  font-family: var(--fo-sans);
  background: var(--fo-page);
  color: var(--fo-ink);
  line-height: 1.6;
  -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.25;
  margin-top: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

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

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

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

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

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

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

.site-header::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--fo-saltire);
}

.header-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.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;
  color: var(--fo-ink-quiet);
}

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

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

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

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

.site-nav a[aria-current="page"] {
  background: var(--fo-saltire-light);
  color: var(--fo-saltire);
  font-weight: 600;
}

/* --- Breadcrumbs ------------------------------------------------- */
.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;
}

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

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

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

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

/* --- Search form -------------------------------------------------

   ----------------------------------------------------------------- */
.search-form {
  margin-bottom: 1.5rem;
}

.search-main {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.search-main label {
  display: block;
  font-weight: 600;
  font-size: 0.825rem;
  margin-bottom: 0.3rem;
  color: var(--fo-ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-field {
  flex: 1;
  min-width: 0;
}

.search-field input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.625rem 0.875rem;
  border: 2px solid var(--fo-rule-strong);
  border-radius: var(--fo-radius);
  background: var(--fo-paper);
  color: var(--fo-ink);
  transition: border-color var(--fo-duration) var(--fo-ease),
              box-shadow var(--fo-duration) var(--fo-ease);
}

.search-field input::placeholder {
  color: var(--fo-ink-faint);
}

.search-field input:focus {
  border-color: var(--fo-saltire);
  outline: none;
  box-shadow: 0 0 0 3px var(--fo-saltire-glow);
}

/* --- Buttons -----------------------------------------------------
   ----------------------------------------------------------------- */
.btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border: 2px solid var(--fo-saltire);
  border-radius: var(--fo-radius);
  background: var(--fo-saltire);
  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-saltire-hover);
  border-color: var(--fo-saltire-hover);
  color: #fff;
}

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

.btn:visited {
  color: #fff;
}

.btn-secondary {
  background: var(--fo-paper);
  color: var(--fo-saltire);
  border: 2px solid var(--fo-rule-strong);
}

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

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

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

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

/* --- 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.45rem 0.625rem;
  transition: border-color var(--fo-duration) var(--fo-ease),
              box-shadow var(--fo-duration) var(--fo-ease);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--fo-saltire);
  outline: none;
  box-shadow: 0 0 0 3px var(--fo-saltire-glow);
}

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: 0.75rem;
  margin-bottom: 1.5rem;
}

.decision-card {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-left: 4px solid var(--fo-rule-strong);
  border-radius: var(--fo-radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--fo-shadow-sm);
  transition: background var(--fo-duration) var(--fo-ease),
              border-color var(--fo-duration) var(--fo-ease);
}

.decision-card:hover {
  background: var(--fo-parchment);
  border-left-color: var(--fo-saltire);
}

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

.card-ref {
  font-family: var(--fo-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fo-ink);
  margin: 0;
}

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

.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);
  margin: 0;
}

.card-summary {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--fo-ink-secondary);
  margin: 0.15rem 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-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.15rem 0.5rem;
  border-radius: var(--fo-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.outcome-badge::before {
  font-weight: 700;
  font-size: 0.85em;
}

.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: "✓ ";
}

.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: "✗ ";
}

.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: "⚖ ";
}

.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: var(--fo-radius);
  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 h1 {
  margin-bottom: 0.25rem;
}

.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.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fo-ink-quiet);
}

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

.decision-section {
  background: var(--fo-paper);
  border: 1px solid var(--fo-rule);
  border-radius: var(--fo-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--fo-shadow-sm);
}

.decision-section h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--fo-rule);
}

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

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

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

/* --- 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);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--fo-radius);
  margin-bottom: 1.5rem;
}

/* --- 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: #1C1C1F;
  color: rgba(255, 255, 255, 0.6);
  margin-top: auto;
  font-size: 0.825rem;
}

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

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

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

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

.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: 1.75rem;
  }

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

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

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

/* --- Responsive: desktop ----------------------------------------- */
@media (min-width: 64rem) {
  main {
    padding: 2rem;
  }
}

/* --- 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;
  }
}

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

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

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

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

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