@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-700-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/sourcesanspro-400-latin.woff2') format('woff2');
}

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

/* The hidden attribute is how this page shows and hides sections, so it has to
   beat the display values set below. */
[hidden] {
  display: none !important;
}

/* Stops the card scrolling behind the open sheet on iOS. */
body.sheet-open {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--colour-page);
  color: var(--colour-text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  -webkit-text-size-adjust: 100%;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  max-width: var(--content-width);
  margin: 0 auto;
  background: var(--colour-card);
  min-height: 100vh;
}

/* Hero -------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 176px;
  background: var(--colour-hero);
  overflow: hidden;
}

.hero__graphic {
  display: block;
  width: 100%;
  height: 100%;
}

/* Set by the server when the hero is configured as a photo. */
.hero--image {
  background-size: cover;
  background-position: center;
}

.hero--image .hero__graphic,
.hero--flat .hero__graphic {
  display: none;
}

/* Card -------------------------------------------------------------------- */

.card {
  position: relative;
  margin: -56px var(--space-4) 0;
  padding: var(--space-6) var(--space-5) var(--space-5);
  background: var(--colour-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.card__headshot {
  width: 96px;
  height: 96px;
  margin: -72px auto var(--space-4);
  border-radius: var(--radius-round);
  border: 4px solid var(--colour-card);
  object-fit: cover;
  background: var(--colour-page);
}

.card__name {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-name);
  line-height: 1.2;
  color: var(--colour-heading);
}

.card__role {
  margin: var(--space-2) 0 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--colour-accent-text);
}

.card__rule {
  width: 40px;
  height: 3px;
  margin: var(--space-4) auto;
  border: 0;
  background: var(--colour-accent);
  border-radius: 2px;
}

.card__org {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.card__mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.card__org-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-small);
  line-height: 1.25;
  color: var(--colour-heading);
  text-align: left;
}

/* Actions ----------------------------------------------------------------- */

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* After a successful exchange the second button is gone. */
.actions--sent {
  grid-template-columns: 1fr;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--colour-link);
  border-radius: var(--radius-control);
  font-family: var(--font-heading);
  font-weight: 700;
  /* Sized so "Exchange contact" stays on one line at 320px. */
  font-size: var(--size-label);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.button--primary {
  background: var(--colour-link);
  color: var(--tas-white);
}

.button--secondary {
  background: var(--colour-card);
  color: var(--colour-link);
}

.button:focus-visible,
.field input:focus-visible,
.field textarea:focus-visible,
.link-list a:focus-visible,
.footer a:focus-visible {
  outline: 3px solid var(--colour-accent-text);
  outline-offset: 2px;
}

.button:active {
  transform: translateY(1px);
}

/* Exchange sheet ---------------------------------------------------------- */

/* A dialog with no open attribute is hidden in every browser, including ones
   without dialog support, where the script falls back to opening it inline. */
.sheet:not([open]) {
  display: none;
}

.sheet {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: var(--content-width);
  /* Short enough that the card stays visible behind it, tall enough that the
     first two fields sit above the keyboard on a small phone. */
  max-height: 88dvh;
  margin: 0 auto;
  padding: var(--space-2) var(--space-5) var(--space-5);
  border: 0;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--colour-card);
  color: var(--colour-text);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
  animation: sheet-in 220ms ease-out;
}

.sheet::backdrop {
  background: rgba(57, 58, 64, 0.5);
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

/* The grip is decoration that says "this came up from the bottom". */
.sheet__grip {
  width: 36px;
  height: 4px;
  margin: 0 auto var(--space-3);
  border-radius: 2px;
  background: var(--colour-rule);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.sheet__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--colour-heading);
}

.sheet__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  /* Pulled into the padding so the icon lines up with the edge while the
     tappable area stays 48px. */
  margin-right: calc(var(--space-3) * -1);
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: none;
  color: var(--colour-heading);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sheet__close:focus-visible {
  outline: 3px solid var(--colour-accent-text);
  outline-offset: -3px;
}

/* Fallback when the browser has no dialog support: the script opens it in
   place instead, so it must not sit fixed over the page. */
.sheet--inline {
  position: static;
  max-width: none;
  max-height: none;
  margin-top: var(--space-5);
  padding: var(--space-5) 0 0;
  border-top: 1px solid var(--colour-rule);
  border-radius: 0;
  animation: none;
}

.exchange__intro {
  margin: 0 0 var(--space-4);
  font-size: var(--size-small);
}

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-heading);
}

.field .optional {
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--colour-text);
}

.field input,
.field textarea {
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--colour-rule);
  border-radius: var(--radius-control);
  background: var(--colour-card);
  color: var(--colour-heading);
  font-family: var(--font-body);
  /* 16px keeps iOS from zooming the viewport on focus. */
  font-size: var(--size-body);
  line-height: var(--leading-body);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field--invalid input,
.field--invalid textarea {
  border-color: var(--colour-error);
}

.field__error {
  display: none;
  margin-top: var(--space-1);
  font-size: var(--size-small);
  color: var(--colour-error);
}

.field--invalid .field__error {
  display: block;
}

/* The honeypot. Off screen rather than display:none, which some bots skip. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.exchange__submit {
  width: 100%;
}

.exchange__submit[disabled] {
  opacity: 0.6;
  cursor: default;
}

.form-error {
  display: none;
  margin: 0 0 var(--space-3);
  font-size: var(--size-small);
  color: var(--colour-error);
}

.form-error--shown {
  display: block;
}

.privacy {
  margin: var(--space-4) 0 0;
  font-size: var(--size-label);
  line-height: 1.5;
}

.privacy a {
  color: var(--colour-accent-text);
}

.confirmation {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--colour-rule);
}

.confirmation__title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--colour-heading);
}

.confirmation__body {
  margin: 0;
  font-size: var(--size-small);
}

/* About ------------------------------------------------------------------- */

.about {
  margin-top: var(--space-6);
  padding: var(--space-6) var(--space-5) var(--space-5);
  background: var(--colour-page);
}

.section-label {
  margin: 0 0 var(--space-3);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-section);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--colour-accent-text);
}

.bio {
  margin: 0 0 var(--space-5);
}

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--colour-rule);
}

.link-list li {
  border-bottom: 1px solid var(--colour-rule);
}

/* Stacked rather than label-beside-value: a 40 character email has nowhere to go
   on a 320px screen, and breaking it mid-word reads worse than a second line. */
.link-list a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap-target);
  padding: var(--space-2) 0;
  color: var(--colour-link);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.link-list .link-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--size-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-heading);
}

.link-list .link-value {
  font-size: var(--size-small);
}

/* Footer ------------------------------------------------------------------ */

.footer {
  padding: var(--space-5);
  background: var(--colour-page);
  text-align: center;
  font-size: var(--size-label);
}

.footer a {
  color: var(--colour-accent-text);
}

@media (min-width: 480px) {
  .page {
    min-height: auto;
    margin-top: var(--space-6);
    margin-bottom: var(--space-6);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
  }

  body {
    padding: 0 var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .button:active {
    transform: none;
  }

  .sheet {
    animation: none;
  }
}
