/*
 * SDS Client Hub styles. Plain CSS, no build step.
 * Every colour pairing used here is listed in test/contrast.test.ts, which
 * checks it passes WCAG 2.2 AA. Add new pairings there.
 * No text is smaller than 18px (1.125rem).
 */

/* Fonts: self-hosted, SIL Open Font Licence (see the .txt files beside them). */
@font-face {
  font-family: 'Inclusive Sans';
  src: url('../fonts/inclusive-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  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: 'Inclusive Sans';
  src: url('../fonts/inclusive-sans-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Inclusive Sans';
  src: url('../fonts/inclusive-sans-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  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: 'Inclusive Sans';
  src: url('../fonts/inclusive-sans-latin-ext-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  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: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  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: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-ext-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  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: 'Schibsted Grotesk';
  src: url('../fonts/schibsted-grotesk-latin-ext-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  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;
}

:root {
  /* Brand */
  --navy: #022539;
  --teal: #1C7690;
  --orange: #FB991C;
  --light-blue: #A0E0F1;
  --off-white: #FAF9F6;
  --white: #FFFFFF;
  /* Supporting colours, chosen to pass AA with the brand colours */
  --grey: #4A5560;
  --red: #A4262C;
  --red-tint: #FBEAEA;
  --teal-tint: #E3F4F8;
  --orange-tint: #FFF1DC;

  --font-heading: 'Inclusive Sans', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Schibsted Grotesk', 'Segoe UI', Arial, sans-serif;
  --text: 1.125rem; /* 18px, the smallest text anywhere */
  --radius: 6px;
  --space: 1.5rem;
  --measure: 70ch;
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--off-white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  margin: 2rem 0 1rem;
  max-width: var(--measure);
}
h1 { font-size: 2.25rem; margin-top: 0.5rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.3125rem; }

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

a {
  color: var(--teal);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--navy);
  text-decoration-thickness: 0.15em;
}

code {
  font-size: var(--text);
}

/* Focus: thick navy outline on light backgrounds, orange on navy. */
:focus-visible {
  outline: 4px solid var(--navy);
  outline-offset: 3px;
}
.site-header :focus-visible {
  outline-color: var(--orange);
}
main:focus,
[tabindex='-1']:focus {
  outline: none;
}
.error-summary:focus,
.notice:focus {
  outline: 4px solid var(--navy);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  background: var(--orange);
  color: var(--navy);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}
.skip-link:focus {
  top: 1rem;
}

/* Header: the logo always sits on navy. */
.site-header {
  background: var(--navy);
  color: var(--off-white);
}
.site-header a {
  color: var(--off-white);
}
.site-header__inner,
.site-nav ul,
.site-main,
.site-footer__inner {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-left: var(--space);
  padding-right: var(--space);
}
.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__brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}
.site-header__brand img {
  display: block;
}
.site-header__name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}
.site-header__user {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.site-header__user p {
  margin: 0;
}
.site-header__user form {
  margin: 0;
}

.site-nav {
  border-top: 1px solid var(--teal);
}
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0 auto;
}
.site-nav a {
  display: inline-block;
  padding: 0.75rem 0;
  min-height: 44px;
  font-weight: 600;
  color: var(--off-white);
}
.site-nav a[aria-current='page'] {
  color: var(--light-blue);
  text-decoration-thickness: 0.2em;
}

.site-main {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.narrow {
  max-width: 40rem;
}

.site-footer {
  background: var(--navy);
  color: var(--off-white);
  padding: 2rem 0;
}
.site-footer a {
  color: var(--light-blue);
}
.site-footer h2 {
  margin-top: 0;
  font-size: 1.3125rem;
}
.site-footer__links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* Buttons: at least 44px tall. */
.button {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button--primary {
  background: var(--navy);
  color: var(--off-white);
}
.button--primary:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--off-white);
}
.button--secondary {
  background: var(--white);
  color: var(--navy);
}
.button--secondary:hover {
  background: var(--teal-tint);
  color: var(--navy);
}
.button--danger {
  background: var(--red);
  border-color: var(--red);
  color: var(--off-white);
}
.button--danger:hover {
  background: var(--navy);
  border-color: var(--navy);
}
.button--on-dark {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--navy);
}
.button--on-dark:hover {
  background: var(--light-blue);
  border-color: var(--light-blue);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}

/* Forms */
form {
  margin: 0 0 1.5rem;
}
.field {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}
.field--error {
  border-left: 5px solid var(--red);
  padding-left: 1rem;
}
.field__label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.field__hint {
  color: var(--grey);
  margin: 0 0 0.5rem;
}
.field__error {
  color: var(--red);
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--text);
}
.input--short {
  max-width: 12rem;
}
.input--file {
  padding: 0.5rem;
}
.input[aria-invalid='true'] {
  border-color: var(--red);
  border-width: 3px;
}
textarea.input {
  min-height: 8rem;
}
.fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
.fieldset legend {
  padding: 0;
  margin-bottom: 0.5rem;
}
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.choice input {
  width: 28px;
  height: 28px;
  margin: 0;
  accent-color: var(--navy);
}
.choice label {
  padding: 0.35rem 0;
}
.choice .field__hint {
  grid-column: 2;
}

/* Error summary and notices */
.error-summary {
  border: 5px solid var(--red);
  background: var(--white);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  max-width: 40rem;
}
.error-summary h2 {
  margin-top: 0;
}
.error-summary ul {
  margin-bottom: 0;
}
.error-summary a {
  color: var(--red);
  font-weight: 700;
}
.notice {
  border-left: 8px solid var(--teal);
  background: var(--teal-tint);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  max-width: 50rem;
}
.notice--warning {
  border-left-color: var(--orange);
  background: var(--orange-tint);
}
.notice__heading {
  margin-top: 0;
  font-size: 1.3125rem;
}
.notice p:last-child {
  margin-bottom: 0;
}

/* Reports */
.website {
  margin-bottom: 2.5rem;
}
.report-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
  max-width: 50rem;
}
.report-card {
  background: var(--white);
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
}
.report-card h3 {
  margin-top: 0;
}
.facts {
  display: grid;
  gap: 0.25rem;
}
.facts div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
}
.facts dt {
  font-weight: 700;
}
.facts dt::after {
  content: ':';
}
.facts dd {
  margin: 0;
}
.summary {
  background: var(--white);
  border-left: 6px solid var(--light-blue);
  padding: 1rem 1.5rem;
  max-width: var(--measure);
  margin-bottom: 1.5rem;
}
.summary p:last-child {
  margin-bottom: 0;
}
.status {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius);
  font-weight: 700;
  border: 2px solid var(--navy);
}
.status--published {
  background: var(--teal-tint);
}
.status--draft {
  background: var(--orange-tint);
}

/* Tables (admin) */
.table {
  border-collapse: collapse;
  width: 100%;
  max-width: 72rem;
  margin-bottom: 2rem;
  background: var(--white);
}
.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem;
  border-bottom: 1px solid var(--grey);
}
.table thead th {
  border-bottom: 3px solid var(--navy);
}
.plain-list {
  padding-left: 1.25rem;
}
.plain-list li {
  margin-bottom: 0.5rem;
}

/* Website health */
.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--navy);
}
.badge--ok {
  background: var(--teal-tint);
}
.badge--attention {
  background: var(--orange-tint);
}
.health-summary .health-summary__text {
  font-size: 1.3125rem;
  font-weight: 600;
}
.health-checked {
  color: var(--grey);
}
.check-list {
  list-style: none;
  padding: 0;
  max-width: 50rem;
}
.check-list li {
  border-left: 4px solid var(--light-blue);
  padding: 0.25rem 0 0.25rem 1rem;
  margin-bottom: 1rem;
}
.check-list p {
  margin-bottom: 0.25rem;
}
.more {
  margin: 0 0 1.5rem;
  max-width: var(--measure);
}
.more summary {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 0;
  color: var(--teal);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.health-site-section {
  margin-bottom: 2rem;
}

/* Interactive reports, in a sealed frame */
.report-frame {
  margin: 0 0 1rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
}
.report-frame__frame {
  display: block;
  width: 100%;
  /* Without JavaScript the frame stays this tall and scrolls inside. */
  height: 80vh;
  min-height: 400px;
  border: 0;
}
.report-frame__frame--sized {
  min-height: 0;
}
.skip-frame {
  display: inline-block;
  padding: 0.25rem 0;
}

/* Second factor */
.qr {
  display: block;
  background: var(--white);
  border: 2px solid var(--navy);
  margin: 0 0 1rem;
}
.secret {
  font-weight: 700;
  letter-spacing: 0.1em;
  word-break: break-all;
}
.passkey {
  margin-bottom: 1.5rem;
}
.passkey__status:empty {
  display: none;
}

@media (max-width: 40rem) {
  :root {
    --space: 1rem;
  }
  h1 {
    font-size: 1.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .button,
  .status,
  .report-card {
    border: 2px solid ButtonText;
  }
}
