/*
  James Percy Foundation: site styles.
  One stylesheet, system fonts, no external requests.
  Colours and fonts are defined once below. Change them here.
*/

:root {
  --brand: #248d6c;        /* green from the original site */
  --brand-strong: #1b6e54; /* darker green for text, links and the map (WCAG AA) */
  --brand-deep: #0f3b2f;   /* footer background */
  --brand-light: #3aac88;  /* selected priority countries (map and buttons) */
  --brand-tint: #e6f1eb;   /* soft green tiles */
  --sand: #f4f1ea;         /* header and page title background */
  --land: #e6e1d6;         /* map: countries that aren't highlighted */
  --ink: #14231d;          /* headings */
  --text: #36423d;         /* body text */
  --muted: #5c6863;        /* secondary text */
  --line: #e1dcd1;         /* hairlines and borders */
  --white: #fff;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 70rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --radius: 14px;
}

/* Base */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.625rem, 1.4rem + 1vw, 2.125rem);
  line-height: 1.2;
}

p {
  margin: 0;
}

p + p {
  margin-top: 1em;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--brand-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: #cfe6da;
  color: var(--ink);
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.skip-link,
.skip-link:hover {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header */

.site-header {
  background: var(--sand);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--brand-strong);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.3rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.975rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

/* Page title band: the title only */

.page-intro {
  padding-block: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--sand);
}

/* Content */

.section {
  padding-block: clamp(2.25rem, 5vw, 3.5rem);
}

.page-intro + .section {
  padding-top: clamp(1.75rem, 4vw, 2.5rem);
}

.section--flush {
  padding-top: 0;
}

.prose {
  font-size: clamp(1.125rem, 1.07rem + 0.3vw, 1.25rem);
}

.more {
  margin-top: 1.5rem;
  font-weight: 600;
}

.more a {
  text-decoration: none;
}

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

.arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.more a:hover .arrow {
  transform: translateX(3px);
}

/* Home page photo */

.photo {
  margin: 2rem 0 0;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.photo figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Focus area tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.tiles li {
  padding: 1.1rem 1rem;
  border-radius: var(--radius);
  background: var(--brand-tint);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.3;
  text-align: center;
}

@media (min-width: 48rem) {
  .tiles--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Priority countries: list and map */

.countries-layout {
  display: grid;
  gap: 2rem;
}

.countries-layout .more {
  margin-top: 0;
}

.countries {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

/* Country buttons: clicking one highlights it here and on the map. */
.countries button {
  padding: 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.countries button:hover {
  border-color: var(--brand-light);
}

.countries button[aria-pressed="true"] {
  border-color: var(--brand-light);
  background: var(--brand-light);
}

.map {
  display: block;
  width: 100%;
  height: auto;
}

.map path {
  fill: var(--land);
  fill-rule: evenodd;
  stroke: var(--white);
  stroke-width: 0.75;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.map .p {
  fill: var(--brand-strong);
}

.map .p.on {
  fill: var(--brand-light);
}

/* Grantees */

.grantees {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.25rem;
}

.grantee {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: clamp(1.25rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.grantee:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 20px rgb(20 35 29 / 0.08);
}

.grantee:focus-within {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.grantee-logo {
  display: block;
  width: 180px;
  max-width: 100%;
  height: 56px;
  margin-bottom: 0.5rem;
  object-fit: contain;
  object-position: left center;
}

/* The heading holds the linked logo; the logo's alt text is the grantee's name. */
.grantee h3 {
  margin: 0;
}

.grantee h3 a {
  display: block;
}

/* The name's link covers the whole card. */
.grantee h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.grantee h3 a:focus-visible {
  outline: none;
}

.grantee p + p {
  margin-top: 0;
}

.grantee-site {
  margin-top: auto;
  color: var(--brand-strong);
  font-size: 0.9375rem;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Contact */

.notice {
  margin-bottom: 1.5rem;
  color: var(--ink);
  font-size: clamp(1.125rem, 1.07rem + 0.3vw, 1.25rem);
  font-weight: 600;
}

.cards {
  display: grid;
  gap: 1.25rem;
}

.card {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.email {
  font-size: 1.125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (min-width: 48rem) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

/* Footer */

.site-footer {
  padding-block: 1.75rem;
  background: var(--brand-deep);
  color: rgb(255 255 255 / 0.78);
  font-size: 0.9375rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.site-footer p + p {
  margin-top: 0;
}

.footer-name {
  color: var(--white);
  font-family: var(--serif);
  font-size: 1.125rem;
}

@media (prefers-reduced-motion: reduce) {
  .arrow {
    transition: none;
  }
}
