/**
 * clinicalcontact.co.uk
 * Copyright (c) Virtual Pharmacist Ltd. All rights reserved.
 *
 * ---------------------------------------------------------------------------
 * WHY THIS LOOKS THE WAY IT DOES
 * ---------------------------------------------------------------------------
 * Someone reaches this page seconds after a call they did not expect, on a
 * phone, already suspecting a scam. Every rule below serves one of three ends:
 * they can read it, they can believe it, and they can leave to check it.
 *
 * It borrows the NHS.UK DESIGN LANGUAGE - the calm blue bar, the reading
 * measure, the care-card components - because that grammar is what people
 * recognise as an official health page. It deliberately does NOT borrow the
 * NHS IDENTITY: no NHS logo, no NHS wordmark, no NHS lozenge, and a blue one
 * shade off theirs. Those marks are protected, and a page that pretends to be
 * NHS is exactly the thing patients are told to distrust.
 *
 * To adopt the exact NHS blue instead, change --cc-brand and --cc-link in the
 * one block below. Nothing else in this file hard-codes a brand colour. Read
 * DESIGN_NOTES.md before you do - it is a legal decision, not a visual one.
 *
 * ---------------------------------------------------------------------------
 * COLOUR
 * ---------------------------------------------------------------------------
 * Every pairing used here is verified by scripts/check-contrast.mjs against
 * WCAG 2.2 AA. If you change a value, run `node scripts/check-contrast.mjs`
 * and add the new pairing to that file. Two values already moved once because
 * the check failed them: the border was #A2B0B9 (2.22:1, invisible in
 * sunlight) and is now #6F8089.
 *
 * SINGLE THEME, ON PURPOSE. This site commits to a light appearance, as
 * NHS.UK does. `color-scheme: light` stops browsers auto-darkening form
 * controls into something that no longer matches the page, and every surface
 * paints its own background so nothing is ever inherited from the host. What
 * IS supported properly is Windows High Contrast (forced-colors) at the foot
 * of this file, which is what the users who need it actually use.
 */

:root {
  color-scheme: light;

  /* ------------------------------------------------------------- brand */
  --cc-brand: #00456b;
  --cc-brand-dark: #00344f;
  --cc-link: #00639c;
  --cc-link-hover: #004e7c;

  /* ---------------------------------------------------------- surfaces */
  --cc-ground: #ffffff;
  --cc-tint: #eff4f6;
  --cc-tint-deep: #e2eaee;

  /* ---------------------------------------------------------------- ink */
  --cc-ink: #1c272e;
  --cc-ink-2: #485b66;

  /* ------------------------------------------------------------ edges */
  /* Borders that carry meaning. Verified at 3:1 on every ground. */
  --cc-border: #6f8089;
  /* Hairlines INSIDE an already-bordered container. Decorative only. */
  --cc-rule: #d3dce0;

  /* ----------------------------------------------------------- status */
  --cc-red: #a0160b;
  --cc-red-tint: #fbedeb;
  --cc-green: #005e45;
  --cc-green-tint: #e5f1ed;

  /* ------------------------------------------------------------ focus */
  --cc-focus: #ffdd00;
  --cc-focus-ink: #0b0c0c;

  /* ------------------------------------------------------------- type
   * NO WEBFONT, ON PURPOSE - two reasons, both of which beat a nicer face.
   *
   * 1. PRIVACY. Fonts served from Google send every visitor's IP address to
   *    Google. A Munich court held that unlawful under GDPR in January 2022,
   *    and on a health-adjacent page it would have to be declared in the
   *    privacy notice. Removing it deletes a whole third-party disclosure.
   *
   * 2. AUTHENTICITY. NHS.UK sets "Frutiger W01", Arial. Frutiger is licensed
   *    to the NHS alone, so virtually every real NHS.UK visitor is already
   *    reading Arial. Arial IS the NHS look on the devices that matter.
   *
   * It is also the fastest possible option on a poor mobile connection,
   * which is where this page gets read.
   *
   * The two roles below are separated by weight, size, tracking and numeral
   * style rather than by family. To self-host Source Sans 3 and Public Sans
   * instead - both SIL OFL, so redistributable - see README.md.
   */
  --cc-font: Arial, "Helvetica Neue", Helvetica, "Nimbus Sans", sans-serif;
  --cc-font-civic: Arial, "Helvetica Neue", Helvetica, "Nimbus Sans", sans-serif;

  /* ----------------------------------------------------------- layout */
  --cc-container: 1100px;
  --cc-measure: 40rem;
  --cc-gutter: 1.25rem;
}

/* --------------------------------------------------------------- reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Never below 16px: this audience zooms, and a 14px base defeats them. */
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cc-ground);
  color: var(--cc-ink);
  font-family: var(--cc-font);
  font-size: 1.1875rem; /* 19px - NHS.UK body size. Deliberately large. */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------- focus */

/*
 * The GDS / NHS focus state: a yellow fill with a solid ink underline. It is
 * the most-tested focus indicator in UK public services and it survives being
 * placed on any of our backgrounds. The YELLOW is not the boundary - the
 * underline is, which is what check-contrast.mjs verifies.
 */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid transparent;
  background-color: var(--cc-focus);
  color: var(--cc-focus-ink);
  box-shadow:
    0 -2px var(--cc-focus),
    0 4px var(--cc-focus-ink);
  text-decoration: none;
}

select:focus-visible {
  box-shadow: 0 0 0 4px var(--cc-focus-ink);
  background-color: var(--cc-ground);
  color: var(--cc-ink);
}

.cc-skiplink {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--cc-focus);
  color: var(--cc-focus-ink);
  font-weight: 700;
  text-decoration: none;
}

.cc-skiplink:focus {
  left: 0;
}

/* ------------------------------------------------------------- layout */

.cc-container {
  max-width: var(--cc-container);
  margin: 0 auto;
  padding-inline: var(--cc-gutter);
}

.cc-measure {
  max-width: var(--cc-measure);
}

/* --------------------------------------------------------------- header */

.cc-header {
  background: var(--cc-brand);
  color: var(--cc-ground);
  border-bottom: 4px solid var(--cc-brand-dark);
}

/*
 * Just the name now. The two links that used to sit on the right moved to the
 * footer, where they already were, because at 375px they could not fit beside
 * the wordmark and wrapped the bar onto a second line. That cost about 45px
 * of height directly above the telephone number, which is the one thing on
 * this page anybody came to read.
 */
.cc-header__inner {
  display: flex;
  align-items: center;
  padding-block: 0.875rem;
}

.cc-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--cc-ground);
  text-decoration: none;
  font-family: var(--cc-font-civic);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.cc-logo:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-logo__mark {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
}

/* ----------------------------------------------------------------- hero */

.cc-hero {
  background: var(--cc-tint);
  border-bottom: 1px solid var(--cc-border);
  padding-block: 2.25rem 2rem;
}

/*
 * The H1 now carries the telephone number, so it is a two-part heading: the
 * question in reading size, the number at display size. Both are inside the
 * one <h1>, which is what makes the number count as heading text.
 */
.cc-hero h1 {
  margin: 0 0 1.25rem;
  font-weight: 400;
}

.cc-hero__eyebrow {
  font-family: var(--cc-font-civic);
  font-size: clamp(1.125rem, 2.6vw, 1.375rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--cc-ink);
  margin: 0 0 1.125rem;
  text-wrap: balance;
  max-width: var(--cc-measure);
}

.cc-hero__q {
  display: block;
  font-family: var(--cc-font);
  font-size: 1.1875rem;
  font-weight: 400;
  color: var(--cc-ink-2);
  margin: 0;
}

/*
 * The number is the only string the visitor searched for, so it is the
 * loudest thing on the page. Tabular figures and open tracking so it can be
 * read back aloud, digit by digit, against a phone's call log.
 */
.cc-number {
  display: block;
  font-family: var(--cc-font-civic);
  font-size: clamp(2.125rem, 8vw, 3.25rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.005em;
  font-variant-numeric: tabular-nums;
  color: var(--cc-brand);
  margin: 0.375rem 0 1.125rem;
}

.cc-verdict {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--cc-green-tint);
  border-left: 5px solid var(--cc-green);
  padding: 1rem 1.125rem;
  margin: 0;
  max-width: var(--cc-measure);
}

.cc-verdict__icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  fill: var(--cc-green);
}

.cc-verdict p {
  margin: 0;
  font-size: 1.125rem;
}

.cc-verdict strong {
  display: block;
  font-family: var(--cc-font-civic);
  font-size: 1.1875rem;
  color: var(--cc-green);
  margin-bottom: 0.125rem;
}

/* ----------------------------------------------------------------- main */

.cc-main {
  padding-block: 2.25rem 3rem;
}

.cc-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 62.5em) {
  .cc-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 2.5rem 3rem;
  }
}

.cc-col {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

/* ---------------------------------------------------------------- prose */

/* A section heading that is itself the .cc-prose element, not inside one. */
.cc-section-heading,
.cc-prose h2 {
  font-family: var(--cc-font-civic);
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.cc-prose h3 {
  font-family: var(--cc-font-civic);
  font-size: 1.1875rem;
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 0.375rem;
}

.cc-prose p {
  margin: 0 0 1rem;
  max-width: var(--cc-measure);
}

.cc-prose > *:last-child {
  margin-bottom: 0;
}

.cc-prose a {
  color: var(--cc-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.cc-prose a:hover {
  color: var(--cc-link-hover);
  text-decoration-thickness: 3px;
}

.cc-list {
  margin: 0 0 1rem;
  padding-left: 1.375rem;
  max-width: var(--cc-measure);
}

.cc-list li {
  margin-bottom: 0.5rem;
}

.cc-list li:last-child {
  margin-bottom: 0;
}

.cc-lede {
  font-size: 1.25rem;
  color: var(--cc-ink-2);
}

.cc-emphasis {
  font-weight: 700;
  color: var(--cc-ink);
}

/* ----------------------------------------------------------- care cards */

/*
 * The NHS.UK care card, rebuilt. A coloured heading strip over a bordered
 * body. It is the component people read as "this is the official bit", and it
 * does more trust work than any amount of copy.
 */
.cc-card {
  background: var(--cc-ground);
  border: 2px solid var(--cc-border);
  max-width: 45rem;
}

.cc-card__head {
  font-family: var(--cc-font-civic);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  padding: 0.75rem 1.25rem;
  color: var(--cc-ground);
  background: var(--cc-border);
}

.cc-card__body {
  padding: 1.25rem;
}

.cc-card__body > *:last-child {
  margin-bottom: 0;
}

.cc-card--advice {
  border-color: var(--cc-brand);
}

.cc-card--advice .cc-card__head {
  background: var(--cc-brand);
}

.cc-card--warning {
  border-color: var(--cc-red);
}

.cc-card--warning .cc-card__head {
  background: var(--cc-red);
}

.cc-card--warning .cc-card__body {
  background: var(--cc-red-tint);
}

/* --------------------------------------------------------- action link */

.cc-action {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--cc-link);
  color: var(--cc-ground);
  font-family: var(--cc-font-civic);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.2;
  /* 48px minimum target - WCAG 2.2 AA 2.5.8 wants 24px, we take no chances. */
  padding: 0.875rem 1.25rem;
  min-height: 3rem;
  border: 2px solid transparent;
  border-radius: 4px;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--cc-brand-dark);
  margin-bottom: 3px;
}

.cc-action:hover {
  background: var(--cc-link-hover);
}

.cc-action:active {
  box-shadow: none;
  transform: translateY(3px);
  margin-bottom: 0;
}

.cc-action__icon {
  flex: 0 0 auto;
  width: 1.375rem;
  height: 1.375rem;
  fill: currentColor;
}

.cc-action--quiet {
  background: transparent;
  color: var(--cc-link);
  border-color: var(--cc-link);
  box-shadow: none;
  margin-bottom: 0;
}

.cc-action--quiet:hover {
  background: var(--cc-tint);
  color: var(--cc-link-hover);
  border-color: var(--cc-link-hover);
}

.cc-action--quiet:active {
  transform: none;
}

/* ------------------------------------------------------------ your area */

/*
 * Reserves its own height before the answer arrives, so the page never jumps
 * under a thumb that is already moving. min-height matches the tallest state.
 */
.cc-area {
  background: var(--cc-tint);
  border: 1px solid var(--cc-border);
  border-top: 5px solid var(--cc-brand);
  padding: 1.25rem;
  min-height: 13.5rem;
}

.cc-area__label {
  font-family: var(--cc-font-civic);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--cc-ink-2);
  margin: 0 0 0.5rem;
}

.cc-area__name {
  font-family: var(--cc-font-civic);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.625rem;
  text-wrap: balance;
}

.cc-area__note {
  font-size: 1rem;
  color: var(--cc-ink-2);
  margin: 0 0 1rem;
}

.cc-area__change {
  font-size: 1rem;
}

.cc-area__change button {
  font: inherit;
  font-family: var(--cc-font);
  background: none;
  border: 0;
  padding: 0;
  color: var(--cc-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cc-area__change button:hover {
  color: var(--cc-link-hover);
  text-decoration-thickness: 3px;
}

.cc-area[data-state="loading"] .cc-area__name {
  color: var(--cc-ink-2);
}

.cc-field {
  display: block;
  margin-bottom: 0.75rem;
}

.cc-field label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.375rem;
}

.cc-select {
  font: inherit;
  font-size: 1.0625rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.625rem;
  color: var(--cc-ink);
  background: var(--cc-ground);
  border: 2px solid var(--cc-border);
  border-radius: 0;
}

/* --------------------------------------------------------------- details */

/*
 * Native <details>. It works with no JavaScript, it is announced correctly by
 * screen readers, and the browser handles the keyboard for us.
 */
.cc-details {
  border-top: 1px solid var(--cc-rule);
  max-width: 45rem;
}

.cc-details:last-of-type {
  border-bottom: 1px solid var(--cc-rule);
}

.cc-details > summary {
  font-family: var(--cc-font-civic);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--cc-link);
  padding: 1rem 0 1rem 1.875rem;
  cursor: pointer;
  list-style: none;
  position: relative;
  min-height: 3rem;
}

.cc-details > summary::-webkit-details-marker {
  display: none;
}

.cc-details > summary::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 1.5rem;
  width: 0;
  height: 0;
  border-left: 0.4375rem solid currentColor;
  border-top: 0.375rem solid transparent;
  border-bottom: 0.375rem solid transparent;
  transition: transform 150ms ease;
  transform-origin: 25% 50%;
}

.cc-details[open] > summary::before {
  transform: rotate(90deg);
}

.cc-details > summary:hover {
  color: var(--cc-link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-details__body {
  padding: 0 0 1.25rem 1.875rem;
}

.cc-details__body > *:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------ independent checks */

.cc-checks {
  background: var(--cc-ground);
  border: 1px solid var(--cc-border);
  padding: 1.25rem;
}

.cc-checks h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.cc-checks dl {
  margin: 0;
  display: grid;
  gap: 0.875rem;
}

.cc-checks dt {
  font-family: var(--cc-font-civic);
  font-weight: 700;
  font-size: 1rem;
}

.cc-checks dd {
  margin: 0.125rem 0 0;
  font-size: 1rem;
  color: var(--cc-ink-2);
}

/* --------------------------------------------------------------- inset */

.cc-inset {
  border-left: 5px solid var(--cc-border);
  padding: 0.25rem 0 0.25rem 1.125rem;
  margin: 0 0 1rem;
  max-width: var(--cc-measure);
}

.cc-inset > *:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- footer */

.cc-footer {
  background: var(--cc-tint);
  border-top: 5px solid var(--cc-brand);
  padding-block: 2rem 2.5rem;
  margin-top: 1rem;
  font-size: 1.0625rem;
}

.cc-footer__links {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.75rem;
}

/*
 * These are a list of links, not links inside a sentence, so the "inline"
 * exception to WCAG 2.2 SC 2.5.8 does not cover them. They measured 19px
 * tall in an audit; the padding below takes them past the 24px minimum.
 */
.cc-footer__links a {
  display: inline-block;
  padding-block: 0.3125rem;
  min-height: 1.5rem;
}

.cc-footer a {
  color: var(--cc-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cc-footer a:hover {
  color: var(--cc-link-hover);
  text-decoration-thickness: 3px;
}

.cc-footer__legal {
  color: var(--cc-ink-2);
  font-size: 1rem;
  max-width: 50rem;
  margin: 0;
}

.cc-footer__legal + .cc-footer__legal {
  margin-top: 0.5rem;
}

/* ------------------------------------------------------------- utilities */

.cc-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .cc-action:active {
    transform: none;
  }
}

/* ------------------------------------------------------ forced colours */

/*
 * Windows High Contrast. Our care cards carry meaning in their border colour,
 * and forced-colors throws every custom colour away - so the borders are
 * restated in system colours here, or the urgent card would become
 * indistinguishable from the advice card for the people most likely to be
 * using it.
 */
@media (forced-colors: active) {
  .cc-card,
  .cc-checks,
  .cc-area,
  .cc-select {
    border: 2px solid CanvasText;
  }

  .cc-card__head {
    border-bottom: 2px solid CanvasText;
    forced-color-adjust: none;
  }

  .cc-action {
    border: 2px solid ButtonText;
    box-shadow: none;
  }

  .cc-verdict,
  .cc-inset {
    border-left: 5px solid CanvasText;
  }

  .cc-details > summary::before {
    border-left-color: CanvasText;
  }
}

/* --------------------------------------------------------------- print */

@media print {
  .cc-header,
  .cc-skiplink {
    background: #fff !important;
    color: #000 !important;
  }

  .cc-action,
  .cc-area__change {
    display: none;
  }

  .cc-details[open] > summary,
  .cc-details > summary {
    color: #000;
  }
}
