/*
 * Components and layout. Uses only the variables from themes.css, so every
 * rule here works in every theme.
 */

/* ---------- Base ---------- */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  background-image: var(--page-pattern);
  background-size: 48px 48px;
}

h1,
h2,
h3 {
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter-spacing);
  line-height: 1.1;
}

a {
  color: var(--color-accent);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Hidden visually but still read by screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 2.5rem;
  }
}

/* Hidden until focused with the keyboard, then shown at the top left. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.skip-link:focus {
  top: 1rem;
}

/* Text in [square brackets] in the copy: a decision still to be made. */
.placeholder {
  padding: 0 0.25rem;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* ---------- Site header and menu ---------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-background);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-header__logo {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.site-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}

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

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--color-text);
}

.site-nav a[aria-current='page'] {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.site-menu-toggle {
  min-height: 44px;
  padding: 0 1rem;
  border: 1px var(--border-style) var(--color-border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

/*
 * Small screens, with JavaScript: the menu folds behind the toggle button.
 * (Without JavaScript the header never gets .has-menu-toggle, so the menu
 * stays visible and simply wraps.)
 */
@media (max-width: 899px) {
  .has-menu-toggle .site-menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 0.5rem;
  }

  .has-menu-toggle.is-menu-open .site-menu {
    display: flex;
  }

  .has-menu-toggle .site-nav {
    flex-direction: column;
  }
}

@media (min-width: 900px) {
  /* The toggle is never needed on wide screens. */
  .site-menu-toggle {
    display: none;
  }
}

/* ---------- Theme switcher ---------- */

.theme-switcher {
  margin: 0;
}

.theme-switcher__options {
  display: flex;
  margin: 0;
  padding: 0;
  border: 1px var(--border-style) var(--color-border-strong);
  border-radius: var(--radius);
}

.theme-switcher__option {
  min-height: 44px;
  padding: 0 0.875rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  cursor: pointer;
}

.theme-switcher__option:hover {
  color: var(--color-text);
}

.theme-switcher__option[aria-pressed='true'] {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

/* Narrow phones: tighter buttons, so all four fit on one line. */
@media (max-width: 420px) {
  .theme-switcher__option {
    padding: 0 0.5rem;
  }
}

/* ---------- Main content ---------- */

.page-main {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.page-title {
  margin: 1rem 0 2rem;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
}

/* ---------- Timing badge ---------- */

.timing-badge {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0.375rem 0.875rem;
  border: 1px var(--border-style) var(--color-accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.timing-badge__icon {
  width: 1em;
  height: 1em;
  color: var(--color-accent);
  flex-shrink: 0;
}

/* ---------- Site footer ---------- */

.site-footer {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

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

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-text-muted);
}

.site-footer p {
  margin: 0;
}

.page-intro {
  max-width: 42rem;
  margin: 0 0 2.5rem;
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

/* ---------- Buttons ---------- */

/* Used on both <button> and <a> elements. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button--secondary {
  border: 1px var(--border-style) var(--color-border-strong);
  background: transparent;
  color: var(--color-text);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 500;
}

.field-hint {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.field input[type='text'],
.field input[type='email'],
.field select,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.field textarea {
  resize: vertical;
}

.field [aria-invalid='true'] {
  border-color: var(--color-accent);
  border-width: 2px;
}

.field--checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
}

.field--checkbox input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

.field-error,
.form-error {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-accent);
}

.field-error:empty,
.form-error:empty {
  display: none;
}

.form-error {
  margin-bottom: 1.25rem;
}

.form-note {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ---------- Lead pipeline demo ---------- */

.demo-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.pipeline-panel {
  border-radius: var(--radius);
  background: var(--color-code-background);
  color: var(--color-code-text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.pipeline-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px var(--border-style) var(--color-code-muted);
}

.pipeline-panel__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: normal;
}

.pipeline-panel__stopwatch {
  font-variant-numeric: tabular-nums;
  color: var(--color-code-muted);
}

.pipeline-log {
  margin: 0;
  padding: 1rem 1.25rem;
  list-style: none;
  min-height: 12rem;
}

.pipeline-log__empty {
  color: var(--color-code-muted);
}

.pipeline-log__item {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  padding: 0.375rem 0;
}

/* Status icons. The text after "/" is what screen readers announce. */
.pipeline-log__item::before {
  content: '•' / '';
}

.pipeline-log__item[data-status='succeeded']::before {
  content: '✓' / 'done: ';
}

.pipeline-log__item[data-status='retrying']::before {
  content: '↻' / 'retrying: ';
}

.pipeline-log__item[data-status='failed']::before {
  content: '✗' / 'failed: ';
}

.pipeline-log__item[data-status='retrying'],
.pipeline-log__item[data-status='failed'] {
  color: var(--color-code-accent);
}

.pipeline-log__item[data-step='complete'] {
  margin-top: 0.5rem;
  padding-top: 0.875rem;
  border-top: 1px var(--border-style) var(--color-code-muted);
  font-weight: 500;
}

.pipeline-log__timing {
  font-variant-numeric: tabular-nums;
  color: var(--color-code-muted);
  white-space: nowrap;
}

.pipeline-summary {
  margin: 0 1.25rem 1.25rem;
  padding: 1rem;
  border: 1px var(--border-style) var(--color-code-muted);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--color-code-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Notices ---------- */

.notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px var(--border-style) var(--color-accent);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---------- Quote calculator ---------- */

.quote-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .quote-grid {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }

  /* Keep the estimate in view while scrolling through the options. */
  .quote-result {
    position: sticky;
    top: 1.5rem;
  }
}

.choice-group {
  margin: 0 0 1.75rem;
  padding: 0;
  border: 0;
}

.choice-group legend {
  margin-bottom: 0.625rem;
  padding: 0;
  font-weight: 600;
}

.choice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  padding: 0.75rem 0.875rem;
  border: 1px var(--border-style) var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--color-accent);
}

.choice input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.2rem 0 0;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

.choice__text {
  display: flex;
  flex-direction: column;
}

.choice__label {
  font-weight: 500;
}

.choice__hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.quote-result {
  padding: 1.5rem;
  border: 1px var(--border-style) var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.quote-total__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.quote-total {
  margin: 0.25rem 0 1.25rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter-spacing);
  font-variant-numeric: tabular-nums;
}

.quote-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.quote-lines caption {
  padding: 1rem 0 0.375rem;
  font-weight: 600;
  text-align: left;
}

.quote-lines th,
.quote-lines td {
  padding: 0.5rem 0;
  border-top: 1px var(--border-style) var(--color-border);
  vertical-align: top;
}

.quote-lines th {
  font-weight: 400;
  text-align: left;
}

.quote-lines td {
  padding-left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-align: right;
  white-space: nowrap;
}

.quote-meta {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.quote-rules {
  margin-top: 3rem;
  max-width: 42rem;
}

.quote-rules summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.quote-rules__steps {
  padding-left: 1.25rem;
}
/* ---------- Home page ---------- */

.hero {
  padding-top: 4.5rem;
  padding-bottom: 3rem;
}

.hero__title {
  max-width: 14em;
  margin: 1rem 0 1.5rem;
  font-size: clamp(2.75rem, 8vw, 5.75rem);
  line-height: 1;
}

.hero__intro {
  max-width: 40rem;
  margin: 0 0 2rem;
  font-size: 1.1875rem;
  color: var(--color-text-muted);
}

/* The five live readings under the hero. */
.proof-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 3rem 0 0.75rem;
  border: 1px var(--border-style) var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: var(--font-mono);
}

@media (min-width: 768px) {
  .proof-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.proof-strip__item {
  padding: 1rem 1.25rem;
  border-bottom: 1px var(--border-style) var(--color-border);
}

@media (min-width: 768px) {
  .proof-strip__item {
    border-bottom: 0;
    border-right: 1px var(--border-style) var(--color-border);
  }

  .proof-strip__item:last-child {
    border-right: 0;
  }
}

.proof-strip dt {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.proof-strip dd {
  margin: 0.25rem 0 0;
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
}

.proof-strip__caption {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.home-section {
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
}

.section-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.card-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 700px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 1px var(--border-style) var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.card__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-accent);
}

.card__title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.25;
}

.card__title a {
  color: var(--color-text);
  text-decoration: none;
}

.card__title a:hover {
  text-decoration: underline;
}

.card__text {
  margin: 0;
  color: var(--color-text-muted);
}

/* Pushed to the bottom so the proof lines of neighbouring cards line up. */
.card__proof {
  margin: auto 0 0;
  padding-top: 0.75rem;
  border-top: 1px var(--border-style) var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.cta-band {
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
  border-top: 1px solid var(--color-border);
}

.cta-band--inline {
  margin-top: 3rem;
  padding-bottom: 0;
}

/* ---------- Content pages (services, agencies) ---------- */

.content-section {
  max-width: 46rem;
  margin-top: 3rem;
}

.content-text {
  margin: 0;
}

.point-list {
  margin: 0;
  padding-left: 1.25rem;
}

.point-list li {
  margin-bottom: 0.75rem;
}

.technical-note {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: var(--color-code-background);
  color: var(--color-code-text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.technical-note__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: normal;
  color: var(--color-code-accent);
}

.technical-note p {
  margin: 0;
}

.page-main > .button-row {
  margin-top: 3rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem 0.75rem 0;
  border-top: 1px var(--border-style) var(--color-border);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  border-top: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ---------- Quote calculator: total pinned to the bottom on phones ---------- */

.quote-sticky-total {
  display: none;
}

@media (max-width: 899px) {
  .quote-sticky-total {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 56px;
    padding: 0.75rem 1rem;
    border-top: 1px var(--border-style) var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
  }

  /* Room at the end of the page so the bar never covers the last content. */
  .quote-grid {
    padding-bottom: 4rem;
  }
}

.quote-sticky-total__label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.quote-sticky-total__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* ---------- Contact form ---------- */

.contact-form {
  max-width: 40rem;
}

.contact-form code,
.content-text code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}
/* ---------- Wide tables ---------- */

/* Tables with several text columns scroll sideways on narrow screens. */
.table-scroll {
  overflow-x: auto;
}

.table-scroll .data-table {
  min-width: 40rem;
}

.content-section--wide {
  max-width: none;
}

.data-table th[scope='row'] {
  font-weight: 500;
}
/* Trading name and address in the footer: plain text, not italic. */
.site-footer__trader {
  font-style: normal;
}
/* ---------- Service tiers and home sections ---------- */

@media (min-width: 900px) {
  .card-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Pushed to the bottom so the prices of neighbouring cards line up. */
.card__price {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
  margin: auto 0 0;
  padding-top: 0.75rem;
  border-top: 1px var(--border-style) var(--color-border);
}

.card__price strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.home-aside {
  margin: 1.5rem 0 0;
  color: var(--color-text-muted);
}

.home-aside strong {
  color: var(--color-text);
}

.feature-list {
  display: grid;
  gap: 1rem 2rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 700px) {
  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .feature-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.feature-list li {
  padding-top: 0.75rem;
  border-top: 1px var(--border-style) var(--color-border);
}

.feature-list strong {
  display: block;
  margin-bottom: 0.25rem;
}

.proof-strip__heading {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* The proof strip sits under a heading here, not under the hero. */
.proof-strip__heading + .proof-strip {
  margin-top: 0.75rem;
}

.feature-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  max-width: 46rem;
  padding: 1.5rem;
  border: 1px var(--border-style) var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.feature-panel__text {
  margin: 0;
}

/* The "From £X" line near the top of a service page. */
.price-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
  margin: -1rem 0 0;
  font-size: 1.125rem;
}

.price-callout strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.quote-note {
  max-width: 42rem;
  margin: -1.5rem 0 2.5rem;
  color: var(--color-text-muted);
}