/* The public site. The look is "Campaign": black and orange, big
   photographs, heavy uppercase headlines. Colours come from the tokens below
   only.

   Mobile first: the plain rules are the phone layout, and the min-width
   queries add columns as the screen gets wider.

   One page width: the header, every band, article pages and the footer all
   use --gutter, so their left and right edges line up on every page. */

:root {
  --page: #ffffff;
  --text: #111111;
  --muted: #55524e;
  --rule: #111111;
  --ink: #111111;
  --ink-text: #ffffff;
  --footer: #111111;
  --accent: #c64d0f;
  --accent-text: #ffffff;
  --link: #a8400b;
  --thumb: #c64d0f;
  --shade: rgb(0 0 0 / 62%);
  --panel: #ffffff;
  --panel-text: #111111;
  --field: #ffffff;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  --wide: 72rem;
  --measure: 42rem;
  --gap: 1.25rem;
  --pad: 1rem;
  --gutter: max(var(--pad), calc((100% - var(--wide)) / 2));
  color-scheme: light dark;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1,
h2,
.brand span {
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

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

figure {
  margin: 0;
}

[hidden] {
  display: none !important;
}

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

.skip {
  position: absolute;
  left: -100rem;
}

.skip:focus {
  left: var(--pad);
  top: var(--pad);
  z-index: 3;
  padding: 0.5rem 1rem;
  background: var(--page);
}

/* ---------- Header ----------
   Phone: logo and Join on the first row, the menu wrapped underneath.
   Wide: logo, menu, Join on one row. */
.top {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  padding: 0.6rem var(--gutter);
  background: var(--ink);
  color: var(--ink-text);
}

.brand {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: inherit;
  font-family: var(--font-head);
  font-size: 0.95rem;
  line-height: 1.1;
  text-decoration: none;
}

.brand img {
  flex: none;
  width: 3rem;
}

/* On the narrowest phones there is no room for the name beside the two
   buttons, so it is kept for screen readers only. */
.brand span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.top > .button,
.menu-toggle {
  padding: 0.5rem 0.75rem;
}

.primary {
  flex-basis: 100%;
}

.primary ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.1rem;
}

.primary a {
  display: block;
  padding: 0.6rem 0;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

/* The Menu button only appears once the script is running. Until someone
   presses it, a phone shows just the logo, Menu and Join. */
.menu-toggle {
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.menu-toggle[aria-expanded='true'] {
  background: var(--ink-text);
  color: var(--ink);
}

.has-toggle .primary:not(.open) {
  display: none;
}

.has-toggle .primary ul {
  display: block;
  margin-top: 0.4rem;
}

.has-toggle .primary li {
  border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}

.has-toggle .primary a {
  padding: 0.8rem 0;
}

/* Sub-items: an indented list in the phone menu, a drop-down on a wide screen. */
.primary .sub {
  display: block;
  margin: 0 0 0.5rem 1rem;
}

.has-toggle .primary .sub li {
  border-top: 0;
}

.has-toggle .primary .sub a,
.primary .sub a {
  padding: 0.4rem 0;
  font-weight: 400;
}

.primary a:hover,
.primary a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.2em;
  text-underline-offset: 0.4em;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.button.quiet {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

.button:hover {
  filter: brightness(1.1);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
}

/* ---------- Main ---------- */
main > * {
  padding-inline: var(--gutter);
}

.kicker {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lede {
  max-width: var(--measure);
  margin: 1rem 0 0;
  font-size: 1.15rem;
}

/* The photograph fills the hero and the words sit on it. */
.hero {
  position: relative;
  display: grid;
  align-content: end;
  min-height: min(32rem, 75svh);
  padding-block: 2rem;
  background: var(--ink);
  color: var(--ink-text);
}

.hero figure {
  position: absolute;
  inset: 0;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--shade) 45%, transparent);
}

.hero header {
  position: relative;
  z-index: 1;
}

.hero h1 {
  max-width: 11em;
  font-size: clamp(2.4rem, 11vw, 5.5rem);
  line-height: 0.95;
}

.hero .kicker {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--accent);
  color: var(--accent-text);
}

.band {
  padding-block: 2rem;
}

.band > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 6px solid var(--rule);
}

.band h2 {
  font-size: clamp(1.7rem, 7vw, 3rem);
}

.more {
  color: inherit;
  font-weight: 600;
  text-transform: uppercase;
}

/* ---------- Cards: the title sits on the photograph ---------- */
.features,
.tasks ul {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
}

.features article {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.35rem;
  height: 100%;
  min-height: 15rem;
  padding: 1rem;
  background: var(--thumb);
  color: var(--ink-text);
  overflow: hidden;
}

.thumb {
  position: absolute;
  inset: 0;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb[data-align='top'] img {
  object-position: top;
}

.thumb[data-align='bottom'] img {
  object-position: bottom;
}

.thumb .empty {
  object-fit: contain;
  padding: 2.5rem;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--shade) 45%, transparent 85%);
}

.features article > :not(.thumb) {
  position: relative;
}

.features .kicker {
  margin: 0;
  color: inherit;
}

.features :is(h2, h3) {
  position: static;
  font-size: 1.4rem;
  font-weight: 900;
}

.features :is(h2, h3) a {
  color: inherit;
  text-decoration: none;
}

/* The whole card is the link. */
.features :is(h2, h3) a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.features article:hover :is(h2, h3) a,
.features :is(h2, h3) a:focus-visible {
  text-decoration: underline;
}

.features time {
  font-size: 0.9rem;
}

/* ---------- Tasks ---------- */
.tasks {
  background: var(--ink);
  color: var(--ink-text);
}

.tasks > header {
  border-color: var(--accent);
}

.tasks li a,
.tasks li p {
  display: block;
  height: 100%;
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}

.tasks strong {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tasks a:hover strong {
  text-decoration: underline;
}

.tasks .idea p {
  background: transparent;
  border: 2px dashed currentColor;
  color: inherit;
}

.tasks small {
  display: block;
  margin-top: 0.5rem;
  font-weight: 700;
}

/* ---------- Dated lists ---------- */
.dated li {
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0;
  border-top: 2px solid var(--rule);
}

.dated a {
  color: inherit;
  font-weight: 600;
}

.dated time,
.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Join band ---------- */
.join {
  padding-block: 2.5rem;
  background: var(--accent);
  color: var(--accent-text);
}

.join h2 {
  font-size: clamp(1.9rem, 8vw, 3.6rem);
}

.join p {
  max-width: var(--measure);
}

.join .button {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-text);
}

.join .button.quiet {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}

/* ---------- Section and article pages ---------- */
.page-head {
  padding-block: 1.5rem 1.25rem;
}

.page-head h1 {
  font-size: clamp(1.9rem, 8vw, 3.2rem);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.crumbs li::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--muted);
}

.listing .features,
.older {
  padding-bottom: 2rem;
}

/* The article is one column on a phone. On a wide screen the text keeps a
   readable width on the left and "Filed under" and related articles move
   into the space on the right, so the page is as wide as every other. */
.entry article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 3rem;
  padding-bottom: 2.5rem;
}

.cover {
  margin-bottom: 1.5rem;
}

.cover img {
  width: 100%;
  max-height: 32rem;
  object-fit: cover;
}

.prose {
  max-width: var(--measure);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3 {
  margin: 2rem 0 0.5rem;
}

.prose img,
.prose iframe {
  max-width: 100%;
  margin-block: 1rem;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
  list-style: revert;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--accent);
}

.entry article > footer {
  display: grid;
  gap: 2rem;
  align-content: start;
  margin-top: 2.5rem;
}

.entry footer h2 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

/* ---------- Chips: sections, topics, years ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chips a {
  display: block;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--rule);
  color: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

.chips a:hover,
.chips a[aria-current] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-text);
}

.chips small {
  font-weight: 400;
}

/* ---------- Lists of articles ---------- */
.listing > * {
  margin-bottom: 1.5rem;
}

.listing > .page-head {
  margin-bottom: 0;
}

.listing > :last-child {
  margin-bottom: 0;
  padding-bottom: 2.5rem;
}

.topics h2,
.topic-group h2,
.year h2 {
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
}

.year {
  scroll-margin-top: 1rem;
}

.search {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  max-width: var(--measure);
  margin-bottom: 1rem;
}

.search label {
  flex-basis: 100%;
  font-weight: 700;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--rule);
  background: var(--field);
  color: var(--text);
  font: inherit;
}

.search .button {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#results,
#end {
  color: var(--muted);
  font-weight: 700;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
}

/* With the script running, more cards load as the page is scrolled. */
.pager[data-enhanced] a {
  visibility: hidden;
}

.dated ul {
  margin: 0.25rem 0 0 1.25rem;
  list-style: disc;
  color: var(--muted);
}

/* ---------- Article text ---------- */
.prose::after {
  content: "";
  display: block;
  clear: both;
}

.prose h3 {
  clear: both;
}

.float-images img {
  float: right;
  max-width: 45%;
  margin: 0.25rem 0 1rem 1.25rem;
}

.prose figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

.prose th,
.prose td {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--muted);
  text-align: left;
  vertical-align: top;
}

.prose table {
  border-collapse: collapse;
}

.prose .video {
  aspect-ratio: 16 / 9;
  margin-block: 1.5rem;
}

.prose .video iframe {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
}

.notice {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.todo {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule);
}

/* ---------- A page with a sign-up form ----------
   The headline sits on an orange band the full width of the screen. The form
   is drawn by HubSpot in its own light colours, so it always sits on a white
   panel: beside the text on a wide screen, under it on a phone. */
.signup .page-head {
  margin-bottom: 2rem;
  padding-block: 2rem 2.5rem;
  /* Paints the band and carries it out to both edges of the screen. */
  border-image: conic-gradient(var(--accent) 0 0) fill 0 / 0 / 0 100vmax;
  color: var(--accent-text);
}

.signup .page-head h1 {
  font-size: clamp(2.4rem, 11vw, 5rem);
  line-height: 0.95;
}

.signup .page-head a,
.signup .crumbs li::after {
  color: inherit;
}

.signup .prose > p:first-child {
  font-size: 1.35rem;
  line-height: 1.45;
}

.signup-panel {
  margin-top: 2rem;
  padding: 1.25rem;
  border-top: 8px solid var(--ink);
  background: var(--panel);
  color: var(--panel-text);
  color-scheme: light;
}

.signup-panel h2 {
  margin-bottom: 1rem;
  font-size: 1.7rem;
}

.hubspot-form {
  min-height: 20rem;
}

/* ---------- Footer ---------- */
.foot {
  padding: 2.5rem var(--gutter);
  background: var(--footer);
  color: var(--ink-text);
  font-size: 0.95rem;
}

.foot a {
  display: inline-block;
  padding: 0.3rem 0;
  color: inherit;
}

.foot nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: 2rem;
}

.foot h2 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.foot p {
  margin: 0.25rem 0;
}

/* ---------- Wider screens ---------- */
@media (min-width: 22.5rem) {
  .brand span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    font-size: 0.85rem;
  }
}

@media (min-width: 40rem) {
  :root {
    --pad: 1.5rem;
    --gap: 1.5rem;
  }

  .features,
  .tasks ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .features article {
    min-height: 18rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .brand img {
    width: 4.5rem;
  }

  .hero {
    padding-block: 3rem;
  }

  .band {
    padding-block: 2.5rem;
  }

  .dated li {
    flex-direction: row;
    justify-content: space-between;
    gap: 1rem;
  }

  .dated time {
    flex: none;
  }

  .foot nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .top {
    flex-wrap: nowrap;
    gap: 2rem;
  }

  .brand {
    flex: none;
    gap: 0.75rem;
  }

  .brand img {
    width: 3.5rem;
  }

  .brand span {
    font-size: 0.95rem;
  }

  .top > .button {
    padding: 0.6rem 1.1rem;
  }

  .primary {
    flex: 1;
    order: 1;
  }

  .menu-toggle {
    display: none;
  }

  .has-toggle .primary:not(.open) {
    display: block;
  }

  .primary ul,
  .has-toggle .primary ul {
    display: flex;
    justify-content: end;
    gap: 0 1.5rem;
    margin-top: 0;
  }

  .has-toggle .primary li {
    border-top: 0;
  }

  .has-toggle .primary a {
    padding: 0.6rem 0;
  }

  .top > .button {
    order: 2;
  }

  .features,
  .tasks ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .features article {
    min-height: 20rem;
  }

  .entry article {
    grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr);
  }

  .entry .page-head,
  .cover {
    grid-column: 1 / -1;
  }

  .entry article > footer {
    margin-top: 0;
  }

  .entry .dated li {
    flex-direction: column;
    gap: 0;
  }

  /* The drop-down under a menu item that has sub-items. */
  .primary li {
    position: relative;
  }

  .primary .sub,
  .has-toggle .primary .sub {
    position: absolute;
    top: 100%;
    right: 0;
    display: none;
    min-width: 13rem;
    margin: 0;
    padding: 0.5rem 1rem;
    background: var(--ink);
    border-top: 4px solid var(--accent);
  }

  /* "show" is set by the editor's preview on the item being worked on. */
  .primary li:hover > .sub,
  .primary li:focus-within > .sub,
  .primary li.show > .sub {
    display: block;
  }

  .signup-panel {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    margin-top: 0;
    padding: 1.75rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111111;
    --text: #f3f1ed;
    --muted: #b3aea7;
    --rule: #f3f1ed;
    --ink: #000000;
    --footer: #000000;
    --accent: #e2672a;
    --accent-text: #170800;
    --link: #f39a6b;
    --field: #1c1c1c;
  }
}
