/* Latin Modern Mono: the typewriter face of LaTeX, and so of most
   cryptography papers. */
@font-face {
  font-family: "Latin Modern Mono";
  src: url("fonts/lmmono10-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Mono";
  src: url("fonts/lmmonolt10-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* The CIRG was black. The CIRGRG was white. The review group reviewing
   the review group reviewing the review group could not agree. */
:root {
  --ground: #f00;
  --ink: #ff0;
  --rule: currentColor;
  --muted: currentColor;
  --speed: 1.2s;
}

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

html {
  background: var(--ground);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Latin Modern Mono", "CMU Typewriter Text", "Courier New", Courier, monospace;
  font-size: 1rem;
  line-height: 1.5;
  font-synthesis: none;
  /* Match the original font rendering. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: #000;
  color: #fff;
}

/* A narrow centred column, 72 characters wide. */
main {
  max-width: calc(72ch + 3rem);
  margin-inline: auto;
  padding: clamp(3rem, 14vh, 7.5rem) 1.5rem 4rem;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
  font-size: inherit;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  text-wrap: balance;
}

.mission {
  margin-top: 1rem;
  text-wrap: pretty;
}

.mission p + p {
  margin-top: 0.75rem;
}

/* Links follow the original quiet underline treatment, loudly. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

section {
  margin-top: 3rem;
}

h2 + * {
  margin-top: 0.5rem;
}

.roll {
  list-style: none;
}

.note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-wrap: balance;
}

/* Narrow screens: affiliation sits under the name, indented. */
.roll li + li {
  margin-top: 0.5rem;
}

.roll .affiliation {
  display: block;
  padding-left: 2ch;
}

@media (min-width: 40rem) {
  .roll {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 6ch;
  }

  .roll li {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 24ch 1fr;
    column-gap: 6ch;
  }

  @supports (grid-template-columns: subgrid) {
    .roll li {
      grid-template-columns: subgrid;
    }
  }

  .roll li + li {
    margin-top: 0;
  }

  .roll .affiliation {
    padding-left: 0;
  }
}

.byline { margin-top: 1rem; }
header + p { margin-top: 3rem; }

/* ------------------------------------------------------------------
   The rainbow. Every colour jumps (no fading) to the next card, like
   the title cards of a low-budget 1970s film. Each pair keeps the text
   readable against its own background.
   ------------------------------------------------------------------ */
@keyframes rainbow {
  0%     { background-color: #ff0000; color: #ffff00; }
  12.5%  { background-color: #ff8000; color: #0000ff; }
  25%    { background-color: #ffff00; color: #8000ff; }
  37.5%  { background-color: #00ff00; color: #0000ff; }
  50%    { background-color: #00ffff; color: #8000ff; }
  62.5%  { background-color: #0000ff; color: #ffff00; }
  75%    { background-color: #8000ff; color: #00ff00; }
  87.5%  { background-color: #ff00ff; color: #ffff00; }
}

html,
h1,
h2,
.mission p,
section > p,
.roll li,
.byline,
.note,
.halt {
  animation: rainbow var(--speed) step-end infinite;
}

/* Every line is on a different card, so the page is a full rainbow at
   any instant. Negative delays start each line partway through. */
h1, h2, .mission p, section > p, .roll li, .byline, .note, .halt {
  padding-inline: 0.5ch;
  margin-inline: -0.5ch;
}

h1                     { animation-delay: -0.15s; }
h2                     { animation-delay: -0.45s; }
.mission p:nth-child(1),
section > p:nth-of-type(1),
.roll li:nth-child(1)  { animation-delay: -0.3s; }
.mission p:nth-child(2),
section > p:nth-of-type(2),
.roll li:nth-child(2)  { animation-delay: -0.6s; }
.mission p:nth-child(3),
section > p:nth-of-type(3),
.roll li:nth-child(3)  { animation-delay: -0.75s; }
section > p:nth-of-type(4),
.roll li:nth-child(4)  { animation-delay: -0.9s; }
.byline,
.note                  { animation-delay: -1.05s; }
.halt                  { animation-delay: -0.15s; }

.halt {
  margin-top: 3rem;
  display: inline-block;
  font: inherit;
  font-size: 0.875rem;
  border: 1px solid currentColor;
  cursor: pointer;
}

/* "Stop the review": freezes every card where it is. */
.stopped,
.stopped * {
  animation-play-state: paused !important;
}

/* People who have asked their computer to calm down get a slow drift
   through the same colours instead of flashing. */
@media (prefers-reduced-motion: reduce) {
  :root { --speed: 16s; }
}

@media print {
  html, html * {
    animation: none !important;
    background: #fff !important;
    color: #000 !important;
  }

  main {
    padding-top: 0;
  }

  .halt { display: none; }
}
