:root {
  /* Stable theme tokens; site settings override these values at runtime. */
  --theme-color-brand: #265d97;
  --theme-color-brand-rgb: 38, 93, 151;
  --theme-color-surface: #fff;
  --theme-color-surface-rgb: 255, 255, 255;
  --theme-color-text: #172126;
  --theme-color-text-rgb: 23, 33, 38;
  --theme-color-header: #080e2b;
  --theme-color-footer: #2b2d42;
  --theme-color-footer-text: #fff;
  --theme-font-body: system-ui, sans-serif;
  --theme-font-heading: system-ui, sans-serif;
  --primary-colour: var(--theme-color-brand);
  --page-background: var(--theme-color-surface);
  --text-colour: var(--theme-color-text);
  --header-background: var(--theme-color-header);
  --footer-background: var(--theme-color-footer);
  --footer-foreground: var(--theme-color-footer-text);
  --body-font: var(--theme-font-body);
  --heading-font: var(--theme-font-heading);
  --theme-color-border: color-mix(
    in srgb,
    var(--text-colour) 25%,
    var(--page-background)
  );
  --theme-color-muted: color-mix(
    in srgb,
    var(--text-colour) 68%,
    var(--page-background)
  );
  --theme-color-subtle: color-mix(
    in srgb,
    var(--text-colour) 8%,
    var(--page-background)
  );
  --theme-color-hover: color-mix(
    in srgb,
    var(--primary-colour) 12%,
    var(--page-background)
  );
  --footer-muted: color-mix(
    in srgb,
    var(--footer-foreground) 82%,
    var(--footer-background)
  );
}

.site-header {
  box-sizing: border-box;
  width: 100%;
  padding-top: 1rem;
  background: var(--header-background);
}

.site-header__container {
  display: flex;
  width: min(100%, 75rem);
  align-items: center;
  gap: 2rem;
  justify-content: space-between;
  margin: 0 auto;
  padding-bottom: 1rem;
}

.site-header__logo-link {
  display: inline-flex;
}

.site-header__logo {
  display: block;
  width: auto;
  height: 10rem;
}

.site-search {
  position: relative;
  width: min(25rem, 50vw);
  margin-left: auto;
}

.account-menu {
  position: relative;
  flex: 0 0 auto;
}

.account-menu__trigger {
  display: flex;
  height: 2.875rem;
  align-items: center;
  padding: 0.1875rem 0.375rem 0.1875rem 0.1875rem;
  border: 0;
  border-radius: 999px;
  gap: 0.1875rem;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 140ms ease;
}

.account-menu__trigger::-webkit-details-marker {
  display: none;
}

.account-menu__trigger::marker {
  content: "";
}

.account-menu__trigger:hover,
.account-menu__disclosure[open] .account-menu__trigger {
  background: rgb(255 255 255 / 12%);
}

.account-menu__trigger:focus-visible {
  outline: 0.1875rem solid #75b9ff;
  outline-offset: 0.125rem;
}

.account-menu__avatar {
  display: grid;
  flex: 0 0 auto;
  border-radius: 50%;
  place-items: center;
  background: var(--theme-color-hover);
  color: var(--primary-colour);
}

.icon-mask {
  display: block;
  background-color: currentcolor;
  mask: var(--icon-mask) center / contain no-repeat;
  -webkit-mask: var(--icon-mask) center / contain no-repeat;
}

.icon-mask--arrow {
  --icon-mask: url("../images/icons/arrow-right.svg");
}

.icon-mask--chevron {
  --icon-mask: url("../images/icons/chevron-down.svg");
}

.icon-mask--feather {
  --icon-mask: url("../images/icons/feather.svg");
}

.icon-mask--lock {
  --icon-mask: url("../images/icons/lock.svg");
}

.icon-mask--logout {
  --icon-mask: url("../images/icons/logout.svg");
}

.icon-mask--recovery {
  --icon-mask: url("../images/icons/recovery.svg");
}

.icon-mask--search {
  --icon-mask: url("../images/icons/search.svg");
}

.icon-mask--security {
  --icon-mask: url("../images/icons/security.svg");
}

.icon-mask--user {
  --icon-mask: url("../images/icons/user.svg");
}

.icon-mask--wrench {
  --icon-mask: url("../images/icons/wrench.svg");
}

.account-menu__avatar--header {
  width: 2.375rem;
  height: 2.375rem;
  box-shadow: inset 0 0 0 0.0625rem var(--theme-color-border);
}

.account-menu__avatar--header .icon-mask {
  width: 1.375rem;
  height: 1.375rem;
}

.account-menu__chevron {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  transition: transform 140ms ease;
}

.account-menu__disclosure[open] .account-menu__chevron {
  transform: rotate(180deg);
}

.popover {
  position: absolute;
  z-index: var(--popover-z-index, 20);
  top: calc(100% + 0.5rem);
  right: 0;
  border: 0.0625rem solid var(--popover-border-color, var(--theme-color-border));
  border-radius: var(--popover-border-radius, 0.5rem);
  box-shadow: var(--popover-shadow, 0 1rem 2.5rem rgb(0 0 0 / 25%));
  background: var(--page-background);
  color: var(--text-colour);
}

.account-menu__panel {
  --popover-z-index: 30;
  --popover-border-color: var(--theme-color-border);
  --popover-border-radius: 0.375rem;
  --popover-shadow: 0 0.5rem 1.5rem rgb(8 14 43 / 16%);

  width: min(18.25rem, calc(100vw - 2.5rem));
  overflow: hidden;
}

.account-menu__identity {
  display: grid;
  min-width: 0;
  padding: 0.875rem 1rem;
  border-bottom: 0.0625rem solid var(--theme-color-border);
  gap: 0.125rem;
}

.account-menu__identity strong {
  overflow: hidden;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__identity span {
  overflow: hidden;
  color: var(--theme-color-muted);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__actions {
  padding: 0.25rem;
}

.account-menu__action {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  padding: 0.625rem 0.75rem;
  border-radius: 0.1875rem;
  grid-template-columns: 1.25rem minmax(0, 1fr) 0.875rem;
  gap: 0.625rem;
  color: var(--text-colour);
  text-decoration: none;
}

.account-menu__action:hover {
  background: var(--theme-color-hover);
}

.account-menu__action:focus-visible,
.account-menu__logout:focus-visible,
.account-menu__login:focus-visible {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: 0.125rem;
}

.account-menu__action-icon,
.account-menu__action-arrow,
.account-menu__logout .icon-mask,
.account-menu__login .icon-mask {
  flex: 0 0 auto;
}

.account-menu__action-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--theme-color-muted);
}

.account-menu__action span {
  font-size: 0.875rem;
}

.account-menu__action-arrow {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--theme-color-muted);
  fill: currentcolor;
}

.account-menu__footer {
  padding: 0.25rem;
  border-top: 0.0625rem solid var(--theme-color-border);
}

.account-menu__logout {
  display: flex;
  width: 100%;
  align-items: center;
  padding: 0.5625rem 0.75rem;
  border: 0;
  border-radius: 0.1875rem;
  gap: 0.625rem;
  background: transparent;
  color: #9b2c2c;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
}

.account-menu__logout:hover {
  background: #fff0f0;
}

.account-menu__logout .icon-mask {
  width: 1.25rem;
  height: 1.25rem;
}

.account-menu__login {
  display: inline-flex;
  min-height: 2.75rem;
  box-sizing: border-box;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border: 0.0625rem solid rgb(255 255 255 / 60%);
  border-radius: 0.25rem;
  gap: 0.5rem;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.account-menu__login:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 12%);
}

.account-menu__login .icon-mask {
  width: 1.125rem;
  height: 1.125rem;
}

@media (prefers-reduced-motion: reduce) {
  .account-menu__chevron,
  .account-menu__trigger,
  .account-menu__login {
    transition: none;
  }
}

.site-search__controls {
  position: relative;
}

.site-search input {
  width: 100%;
  min-height: 2.75rem;
  box-sizing: border-box;
  padding: 0.5rem 2.75rem 0.5rem 0.75rem;
  border: 0.0625rem solid var(--theme-color-border);
  border-radius: 0.375rem;
  background: var(--page-background);
  color: var(--text-colour);
  font: inherit;
}

.site-search button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 2.75rem;
  height: 100%;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--theme-color-muted);
  cursor: pointer;
}

.site-search input:focus {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: 0.125rem;
}

.site-search button:hover {
  color: var(--text-colour);
}

.site-search button:focus-visible {
  border-radius: 0.25rem;
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: -0.25rem;
}

.site-search button .icon-mask,
.search-page__submit .icon-mask {
  width: 1.125rem;
  height: 1.125rem;
}

.site-search__results {
  width: min(38rem, calc(100vw - 2.5rem));
  max-width: min(38rem, calc(100vw - 2.5rem));
  max-height: min(32rem, 70vh);
  overflow-y: auto;
  border: 0.0625rem solid var(--theme-color-border);
  border-radius: 0.5rem;
  box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 25%);
  background: var(--page-background);
}

.site-search-results {
  padding: 0.375rem;
  margin: 0;
  list-style: none;
}

.site-search-result {
  display: grid;
  min-width: 0;
  padding: 0.625rem;
  border-radius: 0.375rem;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.875rem;
  color: var(--text-colour);
  text-decoration: none;
}

.site-search-result:hover,
.site-search-result:focus-visible {
  background: var(--theme-color-hover);
}

.site-search-result:focus-visible {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: -0.1875rem;
}

.site-search-result__image {
  display: block;
  width: 5rem;
  height: 3.75rem;
  border-radius: 0.25rem;
  object-fit: cover;
}

.site-search-result__image--placeholder {
  background: var(--theme-color-subtle);
}

.site-search-result__content {
  display: block;
  min-width: 0;
}

.site-search-result__content strong,
.site-search-result__content span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.site-search-result__content strong {
  margin-bottom: 0.2rem;
  line-clamp: 1;
  -webkit-line-clamp: 1;
}

.site-search-result__content span {
  color: var(--theme-color-muted);
  font-size: 0.875rem;
  line-height: 1.35;
  line-clamp: 2;
  -webkit-line-clamp: 2;
}

.site-search__message {
  padding: 1rem;
  margin: 0;
  color: var(--theme-color-muted);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--page-background);
  color: var(--text-colour);
  font-family: var(--body-font);
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-font);
  font-weight: bold;
}

a {
  color: var(--primary-colour);
}

.site-body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-main {
  box-sizing: border-box;
  width: min(100%, 75rem);
  flex: 1 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 4rem);
  margin: 0 auto;
}

.site-main img {
  height: auto;
  object-fit: cover;
}

.error-page {
  width: min(100%, 40rem);
  padding: clamp(2rem, 8vw, 5rem) 0;
  margin: 0 auto;
  text-align: center;
}

.error-page__status {
  margin: 0 0 0.5rem;
  color: var(--primary-colour);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.error-page__heading {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1.1;
}

.error-page__message {
  max-width: 34rem;
  margin: 1.25rem auto 2rem;
  color: var(--theme-color-muted);
  font-size: 1.125rem;
}

.error-page__home-link {
  display: inline-flex;
  min-height: 2.75rem;
  box-sizing: border-box;
  align-items: center;
  padding: 0.625rem 1.25rem;
  border-radius: 0.375rem;
  background: var(--primary-colour);
  color: var(--page-background);
  font-weight: 700;
  text-decoration: none;
}

.error-page__home-link:hover {
  filter: brightness(0.9);
}

.error-page__home-link:focus-visible {
  outline: 0.1875rem solid var(--text-colour);
  outline-offset: 0.1875rem;
}

@media (max-width: 42rem) {
  .site-header__container {
    flex-wrap: wrap;
  }

  .site-search {
    width: 100%;
    order: 3;
  }
}

.page-listing {
  margin-top: 3rem;
}

.page-listing__heading {
  margin-bottom: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-card-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(min(100%, 16rem), 18rem));
  gap: 1.5rem;
  align-items: stretch;
  justify-content: center;
}

.page-card {
  display: grid;
  height: 23rem;
  overflow: hidden;
  border: 0.0625rem solid var(--theme-color-border);
  border-radius: 0.5rem;
  grid-template-rows: 10.125rem minmax(0, 1fr);
  background: var(--page-background);
  color: inherit;
  text-decoration: none;
  transition:
    box-shadow 150ms ease,
    transform 150ms ease;
}

.page-card:hover,
.page-card:focus-visible {
  box-shadow: 0 0.5rem 1.5rem rgb(23 33 38 / 15%);
  transform: translateY(-0.15rem);
}

.page-card:focus-visible {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: 0.1875rem;
}

.page-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-card__figure {
  position: relative;
  min-height: 0;
  margin: 0;
}

.page-card__attribution {
  position: absolute;
  right: 0;
  bottom: 0;
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  overflow: hidden;
  background: rgb(0 0 0 / 72%);
  color: #fff;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-card__content {
  display: block;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  padding: 1.25rem 1.25rem 1.5rem;
}

.page-card__title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 0.5rem;
  font-size: 1.17rem;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-card__description {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.search-page__form {
  max-width: 38rem;
  margin: 1.5rem 0 2rem;
}

.search-page__form label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 600;
}

.search-page__controls {
  position: relative;
}

.search-page__controls input {
  width: 100%;
  min-height: 3rem;
  box-sizing: border-box;
  padding: 0.625rem 3rem 0.625rem 0.875rem;
  border: 0.0625rem solid var(--theme-color-border);
  border-radius: 0.375rem;
  background: var(--page-background);
  color: var(--text-colour);
  font: inherit;
}

.search-page__controls input:focus {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: 0.125rem;
}

.search-page__submit {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 3rem;
  height: 100%;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--theme-color-muted);
  cursor: pointer;
}

.search-page__submit:hover {
  color: var(--text-colour);
}

.search-page__submit:focus-visible {
  border-radius: 0.25rem;
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: -0.25rem;
}

.search-page__summary {
  margin-bottom: 1.5rem;
  color: var(--theme-color-muted);
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.pagination__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pagination__link,
.pagination__ellipsis {
  display: inline-flex;
  box-sizing: border-box;
  min-width: 2.625rem;
  min-height: 2.625rem;
  align-items: center;
  justify-content: center;
  border: 0.0625rem solid var(--theme-color-border);
  border-radius: 0.375rem;
}

.pagination__link {
  background: var(--page-background);
  color: var(--text-colour);
  font-weight: 600;
  text-decoration: none;
}

.pagination__link:hover,
.pagination__link:focus-visible {
  border-color: var(--primary-colour);
  background: var(--theme-color-hover);
  color: var(--text-colour);
}

.pagination__link:focus-visible {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: 0.125rem;
}

.pagination__link--current {
  border-color: var(--text-colour);
  background: var(--text-colour);
  color: var(--page-background);
}

.pagination__link--direction {
  padding: 0.5rem 0.875rem;
}

.pagination__link--disabled,
.pagination__link--disabled:hover {
  border-color: var(--theme-color-border);
  background: var(--theme-color-subtle);
  color: var(--theme-color-muted);
  cursor: not-allowed;
}

.pagination__ellipsis {
  border-color: transparent;
}

.content-page__brief {
  max-width: 50rem;
  font-size: 1.25rem;
}

.content-page__image {
  max-height: 60vh;
  max-width: 90vw;
  width: auto;
  height: auto;
}

.content-page__figure {
  margin: 2rem 0;
  text-align: center;
}

.content-page__caption,
.home-banner__caption {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--theme-color-subtle);
  color: var(--theme-color-muted);
  font-size: 0.9rem;
}

.content-page__attribution {
  font-weight: 600;
}

.site-footer {
  box-sizing: border-box;
  width: 100%;
  padding: 2.5rem clamp(1.25rem, 5vw, 5rem);
  margin-top: auto;
  background: var(--footer-background);
  color: var(--footer-foreground);
}

.site-footer__container {
  width: min(100%, 75rem);
  margin: 0 auto;
}

.site-footer__introduction {
  max-width: 34rem;
}

.site-footer__logo-link {
  display: inline-flex;
  text-decoration: none;
}

.site-footer__column-heading,
.site-footer p {
  margin-top: 0;
}

.site-footer__introduction p {
  margin-bottom: 0;
  color: var(--footer-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.site-footer__columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 8vw, 7rem);
}

.site-footer__column-heading {
  margin-bottom: 1rem;
  color: var(--footer-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer__entry p,
.site-footer__entry address {
  margin-bottom: 0.25rem;
  color: var(--footer-muted);
  font-size: 0.875rem;
  font-style: normal;
  line-height: 1.5;
}

.site-footer a {
  color: var(--footer-foreground);
  text-underline-offset: 0.2em;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration-thickness: 0.15em;
}

.site-body--footer-preview {
  justify-content: flex-end;
  background: var(--theme-color-subtle);
}

.site-body--header-preview {
  background: var(--theme-color-subtle);
}

.theme-preview__brand,
.theme-preview__header-label {
  color: #fff;
}

.theme-preview__brand {
  font-family: var(--heading-font);
  font-size: 1.5rem;
}

.theme-preview__eyebrow {
  margin-bottom: 0.25rem;
  color: var(--primary-colour);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 2rem 0;
}

.theme-preview__button {
  display: inline-flex;
  min-height: 2.75rem;
  box-sizing: border-box;
  align-items: center;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  background: var(--primary-colour);
  color: var(--page-background);
  font-weight: 700;
  text-decoration: none;
}

.theme-preview input {
  min-height: 2.75rem;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  border: 0.0625rem solid var(--text-colour);
  border-radius: 0.375rem;
  background: var(--page-background);
  color: var(--text-colour);
  font: inherit;
}

.theme-preview__card {
  padding: 1.5rem;
  border: 0.0625rem solid color-mix(
    in srgb,
    var(--text-colour) 25%,
    var(--page-background)
  );
  border-top: 0.375rem solid var(--primary-colour);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  background: var(--page-background);
}

.theme-preview__card h2,
.theme-preview__card p,
.site-footer h2 {
  margin-top: 0;
}

.profile-block {
  display: grid;
  grid-template-columns: 3fr 1fr;
  align-items: center;
  margin-bottom: 1em;
}

.profile-block__image {
  display: block;
  width: 100%;
  height: auto;
}

.profile-block__text {
  margin-right: 2em;
}

@media (max-width: 40rem) {
  .site-header__container {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .site-search {
    width: 100%;
    margin-left: 0;
  }

  .site-search__results {
    right: auto;
    left: 0;
    width: 100%;
  }

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

  .site-footer__columns {
    grid-template-columns: 1fr;
  }

  .profile-block {
    /* Just have the image below the description if on mobile */
    grid-template-columns: 1fr;
  }

  .profile-block__text {
    /* Disable margin on mobile, since we don't need a seperator from the image */
    margin-right: 0em;
  }
}
