.editorial-page {
  --title-gap: 32px;
  background: #181a19;
}

.editorial-page > .masthead {
  --wordmark-height: calc(var(--wordmark-width) * 135 / 510);
  /* The 510px image has 22 transparent pixels below the wordmark and shifts down 8%. */
  --ink-to-edge: calc(
    (var(--masthead-height) - var(--wordmark-height)) / 2
    + var(--wordmark-width) * 22 / 510
    - var(--wordmark-height) * .08
  );
  --masthead-padding: calc(var(--title-gap) - var(--ink-to-edge));
  min-height: calc(var(--masthead-height) + var(--masthead-padding));
  padding-block-end: var(--masthead-padding);
}

.editorial {
  color-scheme: light;
  flex: 1;
  background: #efefec;
  color: #171717;
}

.editorial :focus-visible { outline-color: var(--archive-red); }

.editorial-toolbar {
  display: flex;
  align-items: center;
  /* The visible title starts about 12px into the centered row. */
  padding: calc(var(--title-gap) - 12px) var(--header-gutter) 10px;
  border-bottom: 1px solid #cececa;
}

.editorial-back {
  display: grid;
  place-items: center end;
  flex: none;
  width: 44px;
  height: 44px;
  margin-inline-start: -22px;
  padding-inline-end: 4px;
  color: var(--archive-red);
}

.editorial-back:focus-visible { outline-offset: -2px; }

.editorial-toolbar h1 {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 0;
  color: var(--archive-red);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.editorial-body {
  margin-inline: var(--content-gutter) var(--directory-inset);
  padding-bottom: clamp(36px, 5vw, 64px);
  overflow-wrap: break-word;
}

.editorial-intro { margin-block: clamp(24px, 3vw, 42px) clamp(24px, 3vw, 38px); }
.editorial-intro h2 {
  margin: 0;
  font-size: clamp(23px, 2.2vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.directory-intro {
  max-width: 66ch;
  margin: 10px 0 0;
  color: #55554f;
  line-height: 1.55;
}

.about-copy { max-width: 66ch; line-height: 1.7; }
.about-copy p { margin: 0 0 22px; }
.about-copy p:last-child { margin-bottom: 0; }

.archive-form {
  display: grid;
  gap: 25px;
  max-width: 740px;
}

.archive-form label {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.archive-form :is(input, select, textarea) {
  width: 100%;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid #bdbdb5;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: 400 1rem/1.6 Archivo, Arial, sans-serif;
}

.archive-form :is(input, select, textarea):focus {
  outline: none;
  border-color: var(--archive-red);
}

.archive-form textarea { resize: vertical; }
.archive-form .field-optional { color: #55554f; font-size: 12px; font-weight: 400; }
.form-pair, .contribution-relations { display: grid; gap: 20px; }
.form-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.relation-help { margin: 4px 0 8px; color: #55554f; font-size: 13px; line-height: 1.5; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.form-actions button {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
}

.form-actions .primary {
  padding: 14px 20px;
  background: #171717;
  color: #efefec;
}

.form-actions .primary:hover:enabled { background: #333; color: #fff; }
.form-actions button:not(.primary) { text-decoration: underline; text-underline-offset: 4px; }
.form-status { margin: 0; color: #55554f; font-size: 12px; line-height: 1.6; }

@media (width > 760px) {
  .about-copy { max-width: 63ch; text-wrap: pretty; }
}

@media (max-width: 760px) {
  .editorial-page { --title-gap: 20px; }
  /* The 2035px source has 87 transparent pixels below the wordmark. */
  .editorial-page > .masthead { --ink-to-edge: calc(var(--wordmark-width) * 87 / 2035); }
  .editorial-page > .masthead :is(a, picture) { display: block; max-width: 100%; }
  .editorial-toolbar { padding-inline: var(--content-gutter); padding-bottom: 8px; }
  .editorial-toolbar h1 { min-height: 0; }
  .form-pair { grid-template-columns: 1fr; }
}

@media (forced-colors: active) {
  .archive-form :is(input, select, textarea):focus { outline: 1px solid Highlight; outline-offset: 1px; }
}

.contribution-matchbox { position: relative; }
.contribution-matches { position: absolute; z-index: 2; top: 100%; left: 0; right: 0; margin: 0; padding: 0; list-style: none; background: #181a19; border: 1px solid #656563; }
.contribution-matches li { padding: .65rem .8rem; cursor: pointer; }
.contribution-matches li[aria-selected="true"], .contribution-matches li:hover { background: #353734; }
.contribution-matches small { display: block; }
.contribution-linked { display: flex; flex-wrap: wrap; list-style: none; gap: .5rem; padding: 0; margin: .45rem 0; }
.contribution-linked li { display: flex; align-items: center; gap: .35rem; border: 1px solid #656563; padding: .2rem .35rem .2rem .55rem; }
.contribution-linked button { font: inherit; background: transparent; color: inherit; border: 0; cursor: pointer; min-width: 1.75rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
