/* LegallyAided — plain, calm, legible. One family (Atkinson Hyperlegible). */
:root {
  --ink: #16323a;
  --ink-soft: #4a6169;
  --teal: #0d5e63;
  --teal-dark: #08454a;
  --teal-tint: #e6f1f1;
  --page: #f4f6f7;
  --paper: #ffffff;
  --line: #d4dcde;
  --focus: #ffcc33;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --ok: #1d7343;
  --ok-tint: #e7f4ec;
  --warn-tint: #fff6db;
  --radius: 6px;
  --measure: 68ch;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.65rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.2rem, 5vw, 3.25rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
}
img { max-width: 100%; }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--teal-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: 0 0 0 6px var(--ink); }
a:focus-visible { background: var(--focus); color: var(--ink); box-shadow: 0 3px 0 var(--ink); outline: none; text-decoration: none; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p, ul, ol { margin: 0 0 1em; max-width: var(--measure); }
.lead { font-size: var(--step-1); color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: var(--step--1); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.wrap--narrow { width: min(720px, 100% - 32px); margin-inline: auto; }
main { padding: 40px 0 72px; }

/* Skip link */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; padding: 8px 12px; }

/* Header */
.site-header { background: var(--teal); color: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { color: #fff; }
.brand-mark { width: 26px; height: 26px; }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; align-items: center; }
.nav a, .nav button { color: #fff; text-decoration: none; font: inherit; font-size: var(--step--1); background: none; border: 0; padding: 4px 0; cursor: pointer; }
.nav a:hover, .nav button:hover { text-decoration: underline; color: #fff; }
.nav form { margin: 0; }
.role-band { background: var(--teal-dark); color: #d7ebeb; font-size: var(--step--1); }
.role-band .wrap { display: flex; gap: 20px; min-height: 40px; align-items: center; flex-wrap: wrap; }
.role-band a { color: #fff; }
.role-band a[aria-current="page"] { font-weight: 700; text-decoration-thickness: 2px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--paper); padding: 32px 0; font-size: var(--step--1); color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 24px; max-width: none; }
.message { padding: 14px 16px; border-left: 5px solid var(--teal); background: var(--teal-tint); margin-bottom: 8px; }
.message--success { border-color: var(--ok); background: var(--ok-tint); }
.message--error { border-color: var(--danger); background: var(--danger-tint); }
.message--warning { border-color: #b58100; background: var(--warn-tint); }

/* Buttons */
.button {
  display: inline-block; font: inherit; font-weight: 700; line-height: 1.2;
  padding: 12px 20px; border-radius: var(--radius); border: 2px solid var(--teal);
  background: var(--teal); color: #fff; text-decoration: none; cursor: pointer;
  box-shadow: 0 2px 0 var(--teal-dark);
}
.button:hover { background: var(--teal-dark); color: #fff; }
.button:active { transform: translateY(2px); box-shadow: none; }
.button--secondary { background: var(--paper); color: var(--teal); }
.button--secondary:hover { background: var(--teal-tint); color: var(--teal-dark); }
.button--danger { background: var(--danger); border-color: var(--danger); box-shadow: 0 2px 0 #7a160f; }
.button--danger:hover { background: #8f1c13; }
.button--small { padding: 6px 12px; font-size: var(--step--1); }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Forms */
.field { margin-bottom: 22px; max-width: 560px; }
.field label, .label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .help { color: var(--ink-soft); font-size: var(--step--1); margin: 0 0 6px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel],
.field input[type=url], .field input[type=file], .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 0; padding: 10px 12px; min-height: 48px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.field--error input, .field--error select, .field--error textarea { border-color: var(--danger); }
.field--error { border-left: 4px solid var(--danger); padding-left: 14px; }
.error-text { color: var(--danger); font-weight: 700; margin: 0 0 6px; font-size: var(--step--1); }
.field--check { display: flex; gap: 12px; align-items: flex-start; }
.field--check input { width: 28px; height: 28px; margin: 0; flex: none; accent-color: var(--teal); }
.field--check label { font-weight: 400; margin: 2px 0 0; }
.trap { position: absolute; left: -10000px; }
.error-summary { border: 4px solid var(--danger); padding: 16px 20px; margin-bottom: 28px; background: var(--paper); max-width: 560px; }
.error-summary h2 { font-size: var(--step-1); }
.error-summary ul { margin: 0; padding-left: 20px; }

/* The sentence search — the one bold moment */
.hero { padding: 24px 0 40px; }
.hero h1 { font-size: var(--step-4); max-width: 18ch; letter-spacing: -0.02em; }
.sentence {
  background: var(--paper); border: 3px solid var(--ink); padding: 24px;
  font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.9; font-weight: 700;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; max-width: 980px;
}
.sentence select, .sentence input {
  font: inherit; color: var(--teal); background: var(--teal-tint);
  border: 0; border-bottom: 4px solid var(--teal); border-radius: 0;
  padding: 2px 10px; min-height: 0; max-width: 100%;
}
.sentence select { cursor: pointer; }
.sentence input { width: 9.5ch; text-transform: uppercase; }
.sentence input::placeholder { color: #7f9da1; text-transform: none; }
.sentence select:focus, .sentence input:focus { outline: none; background: var(--focus); color: var(--ink); border-color: var(--ink); }
.sentence .button { font-size: var(--step-1); margin-left: auto; }
.sentence-errors { color: var(--danger); font-weight: 700; margin-top: 12px; }
@media (max-width: 640px) {
  .sentence { padding: 16px; }
  .sentence select, .sentence input { width: 100%; }
  .sentence .button { width: 100%; margin-left: 0; }
}

.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 20px 0 0; color: var(--ink-soft); }
.facts strong { color: var(--ink); }

.section { padding-top: 48px; }
.steps { padding-left: 1.4em; }
.steps li { margin-bottom: 10px; padding-left: 6px; }
.steps li::marker { font-weight: 700; color: var(--teal); }

.category-list { list-style: none; padding: 0; margin: 0; max-width: none; columns: 3 240px; column-gap: 32px; }
.category-list li { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.category-list .count { color: var(--ink-soft); font-size: var(--step--1); white-space: nowrap; }

/* Search results */
.search-bar { background: var(--paper); border: 1px solid var(--line); padding: 20px; margin-bottom: 28px; display: flex; flex-wrap: wrap; gap: 0 20px; align-items: flex-end; }
.search-bar .field { margin-bottom: 12px; flex: 1 1 200px; }
.search-bar .button { margin-bottom: 12px; }
.results { list-style: none; padding: 0; margin: 0; max-width: none; border-top: 2px solid var(--ink); }
.result { display: grid; grid-template-columns: 84px 1fr auto; gap: 4px 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.result .distance { font-weight: 700; font-size: var(--step-2); line-height: 1; color: var(--teal); }
.result .distance span { display: block; font-size: var(--step--1); color: var(--ink-soft); font-weight: 400; margin-top: 4px; }
.result h3 { margin: 0 0 4px; font-size: var(--step-1); }
.result address { font-style: normal; color: var(--ink-soft); margin-bottom: 6px; }
.result .tags { font-size: var(--step--1); color: var(--ink-soft); margin: 0; }
.result .actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.tel { font-weight: 700; font-size: var(--step-1); white-space: nowrap; }
@media (max-width: 720px) {
  .result { grid-template-columns: 64px 1fr; }
  .result .actions { grid-column: 2; align-items: flex-start; }
}
.callout { background: var(--paper); border-left: 6px solid var(--teal); padding: 20px 24px; margin: 24px 0; }
.callout > :last-child { margin-bottom: 0; }
.callout--warn { border-color: #b58100; background: var(--warn-tint); }
.callout--ok { border-color: var(--ok); background: var(--ok-tint); }
.pagination { display: flex; gap: 16px; align-items: center; margin-top: 24px; }

/* Panels & definition lists for account areas */
.panel { background: var(--paper); border: 1px solid var(--line); padding: 24px; margin-bottom: 24px; }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { font-size: var(--step-1); }
.panel--off { border-left: 6px solid var(--danger); }
.panel--on { border-left: 6px solid var(--ok); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.status { display: inline-block; font-size: var(--step--1); font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--teal-tint); color: var(--teal-dark); white-space: nowrap; }
.status--on { background: var(--ok-tint); color: var(--ok); }
.status--off { background: var(--danger-tint); color: var(--danger); }
.status--wait { background: var(--warn-tint); color: #7a5600; }

/* MoJ and SRA side by side (admin) */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .compare { grid-template-columns: 1fr; } }
.compare h3 { font-size: var(--step-0); margin: 20px 0 8px; }
.compare-office, .compare-link { border-top: 1px solid var(--line); padding: 12px 0; }
.compare-office--chosen { background: var(--teal-tint); padding: 12px; border-left: 4px solid var(--teal); }
.compare-office--old { opacity: 0.6; }
.compare-fields { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 0 0 8px; font-size: var(--step--1); }
.compare-fields dt { color: var(--ink-soft); }
.compare-fields dd { margin: 0; overflow-wrap: anywhere; }
.compare-decide { border-top: 2px solid var(--line); margin-top: 12px; padding-top: 12px; }

.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.switch-row form { margin: 0; }

/* Tables (admin & solicitor) */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eaeff0; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td form { margin: 0; display: inline; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--paper); border: 1px solid var(--line); margin-bottom: 32px; }
.stat { background: var(--paper); padding: 16px 18px; box-shadow: 1px 1px 0 var(--line); }
.stat b { display: block; font-size: var(--step-2); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--step--1); color: var(--ink-soft); }
.stat a { color: inherit; text-decoration: none; }
.stat a:hover b { text-decoration: underline; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filters .field { margin: 0; flex: 1 1 220px; }
.tabs { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 8px 0; text-decoration: none; border-bottom: 4px solid transparent; margin-bottom: -2px; }
.tabs a[aria-current="true"] { border-color: var(--teal); color: var(--ink); font-weight: 700; }

/* Firm picker */
.picker { position: relative; max-width: 560px; }
.picker-results { list-style: none; padding: 0; margin: 0; border: 2px solid var(--ink); border-top: 0; background: var(--paper); max-height: 320px; overflow-y: auto; }
.picker-results:empty { display: none; }
.picker-results button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; color: var(--ink); }
.picker-results button:hover, .picker-results button:focus { background: var(--teal-tint); outline: none; }
.picker-results small { display: block; color: var(--ink-soft); }
.picker-chosen { margin-top: 8px; padding: 10px 12px; background: var(--ok-tint); border-left: 4px solid var(--ok); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .site-header, .site-footer, .role-band, .button { display: none; } body { background: #fff; } }

/* Test-site banner (SITE_TEST_MODE) */
.test-banner { background: #ffcc33; color: #16323a; text-align: center; padding: 10px 16px; font-size: 1rem; border-bottom: 2px solid #b38600; }

/* Search: several areas of law combined with AND / OR */
.search-panel { background: var(--paper); border: 1px solid var(--line); padding: 20px; margin-bottom: 28px; }
.search-panel fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.search-panel legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px 16px; }
.area-pick { display: flex; gap: 10px; align-items: center; font-weight: 400; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.area-pick input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--teal); }
.area-pick:has(input:checked) { background: var(--teal-tint); border-color: var(--teal); }
.combine-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.combine-option { display: flex; gap: 12px; align-items: center; font-weight: 400; padding: 12px; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; }
.combine-option input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--teal); }
.combine-option:has(input:checked) { border-color: var(--teal); background: var(--teal-tint); }
.combine-option small { display: block; color: var(--ink-soft); }
.venn { width: 64px; height: 40px; flex: none; }
.venn-ring { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.venn-fill { fill: var(--teal); opacity: .55; }
.venn-union { fill: var(--teal); opacity: .55; } /* one even shade over the whole union */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.op { display: inline-block; background: var(--ink); color: #fff; border-radius: 4px; padding: 0 6px; font-size: .85em; letter-spacing: .05em; }
.search-bar--inline { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: flex-end; }
.search-bar--inline .field { margin-bottom: 12px; flex: 1 1 200px; }
.search-bar--inline .button { margin-bottom: 12px; }
.query-summary { font-size: 1.1rem; line-height: 2; }
.area-chip { display: inline-block; background: var(--teal-tint); border: 1px solid var(--teal); border-radius: 999px; padding: 0 10px; line-height: 1.6; }
.result .tags mark { background: #ffe9a8; color: inherit; padding: 0 2px; }
.search-changed { border-left-width: 6px; }

/* "Postcode or street" suggestions */
.place-box { position: relative; flex: 2 1 260px; }
.search-bar--inline .place-box .field { margin-bottom: 12px; }
.place-suggestions { position: absolute; left: 0; right: 0; top: 100%; margin: -10px 0 0; padding: 0; list-style: none; z-index: 20;
  background: var(--paper); border: 1px solid var(--teal); border-radius: 0 0 6px 6px; box-shadow: 0 6px 16px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto; }
.place-suggestions li { padding: 10px 12px; cursor: pointer; border-top: 1px solid var(--line); }
.place-suggestions li:first-child { border-top: 0; }
.place-suggestions li:hover, .place-suggestions li[aria-selected="true"] { background: var(--teal-tint); }
/* Same box inside the home page sentence: grows to fit a street name, list sits right under the underline */
.sentence .place-box { flex: 1 1 14ch; min-width: 12ch; max-width: 100%; }
.sentence .place-box input { width: 100%; text-transform: none; }
.sentence .place-suggestions { margin-top: 4px; font-size: 1rem; font-weight: 400; line-height: 1.4; color: var(--ink); }
@media (max-width: 640px) {
  .sentence .place-box { flex-basis: 100%; min-width: 0; }
}
.place-suggestions li.place-hint { cursor: default; color: var(--ink-soft); font-size: .9em; background: var(--page); }
