/* Citizen Green
   Colours from the logo: Pantone Process Black U and Pantone 361 U.
   The 26.9 degree slant is the angle of the logo's own diagonal. */

@font-face {
  font-family: "Courier Prime";
  src: url("fonts/courier-prime-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #231f20;
  --green: #4fbe37;
  --green-deep: #2b7d1d;
  --paper: #ffffff;
  --muted: #5f5b5c;
  --error: #b3261e;

  --skew: -26.9deg;
  --slant: 0.507;
  --rule: 1rem;
  --gutter: max(1.5rem, calc((100vw - 74rem) / 2));
  --hero-h: clamp(24rem, 31vw, 29rem);

  --display: "Courier Prime", "Courier New", Courier, monospace;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-x: clip;
}

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

h1, h2, h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.045em;
  word-spacing: -0.24em;
  line-height: 1.05;
}
p { margin: 0; text-wrap: pretty; }

a { color: var(--green-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
}
.skip:focus { top: 1rem; color: var(--paper); }

/* ---------- Slanted button: the logo's parallelogram ---------- */

.btn {
  position: relative;
  z-index: 0;
  display: inline-block;
  padding: 0.85rem 1.9rem;
  border: 0;
  background: none;
  color: var(--paper);
  font-family: var(--body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: skewX(var(--skew));
  transition: background-color 0.15s;
}
.btn:hover { color: var(--ink); }
.btn:hover::before { background: var(--green); }

.btn--green { color: var(--ink); }
.btn--green::before { background: var(--green); }
.btn--green:hover::before { background: var(--paper); }
.btn[disabled] { cursor: progress; opacity: 0.7; }

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem var(--gutter);
}
.top__logo img { width: clamp(11rem, 22vw, 16rem); }
.top__nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.top__link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.top__link:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.top .btn { padding: 0.6rem 1.4rem; font-size: 1rem; }

/* ---------- Hero: the logo, opened up ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  height: var(--hero-h);
  overflow-x: clip;
}
/* the two green rules that run out of the logo to the right */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--rule);
  background: var(--green);
  transform-origin: left;
}
.hero::before { top: 0; }
.hero::after { bottom: 0; }

.hero__block {
  position: relative;
  z-index: 1;
  padding-left: var(--gutter);
  color: var(--paper);
}
.hero__block::before {
  content: "";
  position: absolute;
  inset: 0 0 0 -100vw;
  z-index: -1;
  background: var(--ink);
  transform: skewX(var(--skew));
  transform-origin: top right;
}
/* text follows the diagonal on both sides */
.hero__edge {
  width: calc(var(--hero-h) * var(--slant));
  height: 100%;
  shape-margin: 1.75rem;
}
.hero__block .hero__edge {
  float: right;
  shape-outside: polygon(100% 0, 100% 100%, 0 100%);
}
.hero__open .hero__edge {
  float: left;
  shape-outside: polygon(0 0, 100% 0, 0 100%);
}

.hero h1 {
  padding-top: calc(var(--rule) + var(--hero-h) * 0.14);
  font-size: clamp(2.5rem, 5.6vw, 5.4rem);
  line-height: 0.98;
}

.hero__open {
  position: relative;
  z-index: 1;
  margin-left: calc(var(--hero-h) * var(--slant) * -1);
  padding-right: var(--gutter);
}
.hero__lede {
  padding-top: calc(var(--hero-h) * 0.27);
  font-size: clamp(1.125rem, 1.45vw, 1.3125rem);
  line-height: 1.5;
}
.hero__cta { margin-top: 1.75rem; }

/* a shorter hero for inner pages */
.hero--page { --hero-h: clamp(12rem, 17vw, 15rem); }
.hero--page h1 {
  padding-top: calc((var(--hero-h) - 0.98em) / 2);
}
.hero--page .hero__lede {
  padding-top: calc(var(--hero-h) * 0.36);
}

/* ---------- What we do ---------- */

.work {
  padding: clamp(4rem, 8vw, 7rem) var(--gutter);
}
.work__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.25rem clamp(1.5rem, 3vw, 3rem);
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.work h2,
.close h2 { font-size: clamp(2.2rem, 3.8vw, 3.4rem); }
.work__intro { max-width: 36rem; font-size: 1.25rem; line-height: 1.5; }

.areas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3rem clamp(1.5rem, 3vw, 3rem);
}
.area {
  position: relative;
  padding-top: calc(var(--rule) + 1.75rem);
}
/* each area sits under one of the logo's green rules */
.area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--rule);
  background: var(--green);
  clip-path: polygon(
    calc(var(--rule) * var(--slant)) 0, 100% 0,
    calc(100% - var(--rule) * var(--slant)) 100%, 0 100%
  );
}
.area h3 { font-size: clamp(1.6rem, 2.3vw, 2.05rem); }
.area p { margin-top: 1rem; }
.area p + p { margin-top: 0.75rem; color: var(--muted); }

/* ---------- Closing band ---------- */

.close {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem 4rem;
  padding: clamp(3.5rem, 7vw, 5.5rem) var(--gutter);
  background: var(--ink);
  color: var(--paper);
}
.close__text { flex: 1 1 24rem; }
.close__text p {
  max-width: 36rem;
  margin-top: 1.25rem;
  font-size: 1.25rem;
  line-height: 1.5;
}
.close__cta { padding: 0 0.6rem; }

/* ---------- Contact page ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 3rem clamp(2rem, 6vw, 6rem);
  padding: clamp(3.5rem, 7vw, 6rem) var(--gutter);
}
.contact h2 { font-size: 1.6rem; }
.contact address {
  margin-top: 1.25rem;
  font-style: normal;
}
.contact__legal {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}
.form { display: grid; gap: 1.25rem; max-width: 40rem; }
.form__pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.field { display: grid; gap: 0.4rem; align-content: start; }
.field label { font-weight: 600; font-size: 1rem; }
.field label span { font-weight: 400; color: var(--muted); }
.field input,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.field textarea { min-height: 11rem; resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.field [aria-invalid="true"] { border-color: var(--error); }
.field__error { color: var(--error); font-size: 0.95rem; }
.form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 0.5rem;
  padding-left: 0.6rem;
}
.form__note { flex: 1 1 14rem; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.form__status { font-size: 1.125rem; }
.form__status:empty { display: none; }
.form__status--error { color: var(--error); }
.form__done h2 { font-size: 2rem; }
.form__done p { margin-top: 1rem; font-size: 1.25rem; line-height: 1.5; }

/* honeypot: off-screen, not for people */
.hp {
  position: absolute;
  left: -200vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 3rem;
  padding: 2.5rem var(--gutter);
  color: var(--muted);
}
.foot img { width: 11rem; }
.foot__legal {
  flex: 0 1 auto;
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ---------- Confirmation and error pages ---------- */

.note {
  padding: clamp(4rem, 12vw, 9rem) var(--gutter);
}
.note h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.note p { max-width: 34rem; margin: 1.5rem 0 2.25rem; font-size: 1.25rem; }
.note ul { max-width: 34rem; margin: 1.5rem 0 2.25rem; padding-left: 1.2rem; }

/* ---------- One entrance: the logo draws itself across the hero ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero__block::before { animation: block-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero::before,
  .hero::after { animation: rule-out 0.8s 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero h1,
  .hero__lede,
  .hero__cta { animation: text-in 0.5s 0.55s both; }
}
@keyframes block-in {
  from { transform: translateX(-100%) skewX(var(--skew)); }
  to { transform: translateX(0) skewX(var(--skew)); }
}
@keyframes rule-out {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes text-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 56rem) {
  :root { --rule: 0.75rem; --cut: 4.5rem; }

  .hero {
    display: block;
    height: auto;
    padding-bottom: var(--rule);
  }
  .hero::before { display: none; }
  .hero__edge { display: none; }

  .hero__block {
    padding: 3rem var(--gutter) calc(var(--cut) + 0.5rem);
  }
  /* square block with the logo's corner cut out of it */
  .hero__block::before {
    inset: 0;
    transform: none;
    clip-path: polygon(
      0 0, 100% 0,
      100% calc(100% - var(--cut)),
      calc(100% - var(--cut) * var(--slant)) 100%,
      0 100%
    );
  }
  .hero h1,
  .hero--page h1 {
    padding-top: 0;
    font-size: clamp(2.3rem, 10.5vw, 3.6rem);
  }
  .hero__open {
    margin-left: 0;
    padding: 2rem var(--gutter) 2.5rem;
  }
  .hero__lede,
  .hero--page .hero__lede { padding-top: 0; max-width: 34rem; }

  .hero--page { --cut: 3rem; }
  .hero--page .hero__block { padding-top: 2.25rem; padding-bottom: calc(var(--cut) + 0.25rem); }

  .work__head,
  .areas,
  .contact { grid-template-columns: minmax(0, 1fr); }
  .areas { gap: 2.75rem; }

  @keyframes block-in {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
  }
}

@media (max-width: 34rem) {
  .top { gap: 0.75rem; padding-top: 1.1rem; padding-bottom: 1.1rem; }
  .top__nav { gap: 1.1rem; }
  .top__logo { flex: 0 1 9.5rem; min-width: 0; }
  .top__logo img { width: 100%; }
  .top__link { font-size: 0.9375rem; white-space: nowrap; }
  .top .btn { padding: 0.55rem 1rem; font-size: 0.9375rem; }
  .form__pair { grid-template-columns: minmax(0, 1fr); }
}
