/* matter.ad: a risograph print shop. Two fluorescent inks, pink and teal, a hair out of register,
   on warm paper by day and deep ink-violet at night. The inks are for the art and big type only;
   all text that has to be read is ink-coloured. */

@font-face {
  font-family: "Rubik";
  src: url("fonts/rubik-variable-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

@font-face {
  font-family: "Martian Mono";
  src: url("fonts/martian-mono-variable-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope-variable-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --mode: light;
  --bg: #f6f1e7;
  --text: #1d1b2e;
  --muted: #4a4659;
  --sheet: #fffaf0;
  --sheet-line: rgba(29, 27, 46, 0.1);
  --pink: #ff48b0;
  --teal: #00a99d;
  --over: #00306c;
  --dot-ink: #1d1b2e;
  --knock: #f6f1e7;
  --loose: 0.18;
  --grain: 0.55;
  --page-grain: 1;
  --poster-shadow: 0 1px 0 rgba(29, 27, 46, 0.06), 0 22px 40px -26px rgba(29, 27, 46, 0.55), 0 6px 14px -8px rgba(29, 27, 46, 0.2);
  --btn-bg: #1d1b2e;
  --btn-text: #f6f1e7;
  --focus: #1d1b2e;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mode: dark;
    --bg: #15131f;
    --text: #f2eee6;
    --muted: #c8c2d3;
    --sheet: #1f1c2c;
    --sheet-line: rgba(242, 238, 230, 0.09);
    --over: #ffc1e1;
    --dot-ink: #6a5f8e;
    --knock: #15131f;
    --loose: 0.14;
    --grain: 0.4;
  --page-grain: 0.4;
    --poster-shadow: 0 0 0 1px rgba(242, 238, 230, 0.05), 0 0 60px -6px rgba(255, 72, 176, 0.16), 0 24px 50px -28px rgba(0, 0, 0, 0.9);
    --btn-bg: #f2eee6;
    --btn-text: #15131f;
    --focus: #f2eee6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --mode: dark;
  --bg: #15131f;
  --text: #f2eee6;
  --muted: #c8c2d3;
  --sheet: #1f1c2c;
  --sheet-line: rgba(242, 238, 230, 0.09);
  --over: #ffc1e1;
  --dot-ink: #6a5f8e;
  --knock: #15131f;
  --loose: 0.14;
  --grain: 0.4;
  --page-grain: 0.4;
  --poster-shadow: 0 0 0 1px rgba(242, 238, 230, 0.05), 0 0 60px -6px rgba(255, 72, 176, 0.16), 0 24px 50px -28px rgba(0, 0, 0, 0.9);
  --btn-bg: #f2eee6;
  --btn-text: #15131f;
  --focus: #f2eee6;
  color-scheme: dark;
}

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

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* The paper's grain, the whole page over. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("img/grain.svg");
  background-size: 220px 220px;
  opacity: var(--page-grain);
}

main {
  flex: 1;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 10px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 800 19px/1 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mark {
  width: 27px;
  height: 18px;
  overflow: visible;
}

.mark-pink {
  fill: var(--pink);
}

.mark-teal {
  fill: var(--teal);
  mix-blend-mode: multiply;
}

:root[data-theme="dark"] .mark-teal {
  mix-blend-mode: screen;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark-teal {
    mix-blend-mode: screen;
  }
}

/* Theme switch: three round ink dots, pink, teal and dark ink, each with its icon knocked out of
   the ink. The chosen one is printed a little off, over a pink misregistered shadow. Driven by the
   root's theme, so the right dot shows chosen before app.js runs. */
.theme {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
}

.inkdot {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--knock);
  background: var(--dot);
  opacity: 0.6;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.inkdot-pink {
  --dot: var(--pink);
}

.inkdot-teal {
  --dot: var(--teal);
}

.inkdot-ink {
  --dot: var(--dot-ink);
}

.inkdot svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inkdot:hover {
  opacity: 0.8;
}

:root:not([data-theme]) .inkdot[data-theme-value="system"],
:root[data-theme="light"] .inkdot[data-theme-value="light"],
:root[data-theme="dark"] .inkdot[data-theme-value="dark"] {
  opacity: 1;
  transform: translate(1.5px, -1.5px);
  box-shadow: -3px 3px 0 0 var(--pink);
}

:root[data-theme="light"] .inkdot[data-theme-value="light"] {
  box-shadow: -3px 3px 0 0 rgba(255, 72, 176, 0.45);
}

.theme .inkdot:focus-visible {
  outline-offset: 3px;
  border-radius: 50%;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "copy" "poster" "play";
  row-gap: 18px;
  padding-top: 10px;
  padding-bottom: 48px;
}

.hero-copy {
  grid-area: copy;
}

h1 {
  font: 800 clamp(50px, 13.8vw, 124px) / 0.9 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.035em;
  margin-left: -0.03em;
  text-shadow: 0.035em -0.025em 0 var(--teal);
}

h1 span {
  display: inline-block;
}

h1 .hl-2 {
  text-shadow: -0.04em 0.03em 0 var(--pink), 0.035em -0.025em 0 var(--teal);
}

.lede {
  margin-top: 14px;
  max-width: 31em;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

/* The poster: a sheet of riso paper. The canvas draws the ink; the words underneath are real text,
   transparent once the ink is down so the dots are what you see. */
.poster {
  grid-area: poster;
  position: relative;
  width: 100%;
  aspect-ratio: 343 / 318;
  max-height: calc(100svh - 90px);
  border-radius: 3px;
  background: var(--sheet);
  box-shadow: var(--poster-shadow);
  overflow: hidden;
  touch-action: pan-y;
  isolation: isolate;
}

/* Loose ink left on the drum: a faint, uneven two-colour halftone across the whole sheet. */
.poster::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: var(--loose);
  background-image:
    radial-gradient(circle, var(--pink) 0.9px, transparent 1.3px),
    radial-gradient(circle, var(--teal) 0.9px, transparent 1.3px);
  background-size: 13px 13px, 17px 17px;
  background-position: 0 0, 6px 4px;
  -webkit-mask-image: radial-gradient(120% 90% at 85% 100%, #000 0, transparent 70%);
  mask-image: radial-gradient(120% 90% at 85% 100%, #000 0, transparent 70%);
}

/* Paper grain over everything, ink included. */
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: url("img/grain.svg");
  background-size: 180px 180px;
  opacity: var(--grain);
  mix-blend-mode: multiply;
}

:root[data-theme="dark"] .poster::after {
  mix-blend-mode: screen;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .poster::after {
    mix-blend-mode: screen;
  }
}

.ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

html:not(.js) .ink {
  display: none;
}

.reg {
  position: absolute;
  top: 10px;
  width: 15px;
  height: 15px;
  z-index: 2;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.1;
  opacity: 0.55;
}

.reg-l {
  left: 10px;
}

.reg-r {
  right: 10px;
}

.swatch {
  position: absolute;
  right: 14px;
  bottom: 16px;
  z-index: 2;
  display: flex;
}

.swatch i {
  width: 10px;
  height: 10px;
}

.swatch i:nth-child(1) {
  background: var(--pink);
}

.swatch i:nth-child(2) {
  background: var(--teal);
}

.swatch i:nth-child(3) {
  background: var(--over);
}

.sheet {
  position: absolute;
  inset: 34px 18px 14px;
  z-index: 2;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.sheet.is-current {
  display: flex;
}

.sheet-words {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  font: 800 52px/0.94 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.025em;
  overflow-wrap: normal;
  color: var(--text);
  text-shadow: -0.03em 0.02em 0 var(--pink), 0.03em -0.02em 0 var(--teal);
}

html.js .sheet-words {
  color: transparent;
  text-shadow: none;
}

html.js .sheet-words::selection {
  color: var(--text);
  background: rgba(255, 72, 176, 0.3);
}

.sheet-small {
  flex: none;
  max-width: calc(100% - 48px);
  font: 600 10.5px/1.45 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

/* Without JS, the chips switch the printed sample directly; the hero sheet is the headline's job. */
html:not(.js) .sheet[data-poster="hero"] {
  display: none;
}

html:not(.js) .hero:has(#cause-bank:checked) .sheet[data-poster="bank"],
html:not(.js) .hero:has(#cause-park:checked) .sheet[data-poster="park"],
html:not(.js) .hero:has(#cause-library:checked) .sheet[data-poster="library"] {
  display: flex;
}

html:not(.js) .print {
  display: none;
}

html:not(.js) .sheet[data-poster="bank"] .sheet-words {
  font-size: 33px;
}

html:not(.js) .sheet[data-poster="park"] .sheet-words {
  font-size: 44px;
}

/* ---------- the play ---------- */

.play {
  grid-area: play;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.play-title {
  font: 800 34px/1 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.03em;
  text-shadow: -0.045em 0.035em 0 var(--pink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.chip {
  position: relative;
  display: inline-flex;
}

.chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip span {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--text);
  font: 700 14px/1.2 "Manrope", system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.chip input:hover + span {
  background: rgba(255, 72, 176, 0.12);
}

.chip input:checked + span {
  background: var(--pink);
  color: #1d1b2e;
  box-shadow: -2.5px 2.5px 0 0 var(--teal);
  transform: translate(1px, -1px);
}

.chip input:focus-visible + span {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
}

.print {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  padding: 14px 24px 14px 20px;
  border: 0;
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font: 800 19px/1 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: -5px 5px 0 0 var(--pink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.roller {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.print:hover {
  box-shadow: -6px 6px 0 0 var(--pink);
  transform: translate(1px, -1px);
}

.print:active,
.print.is-pressed {
  transform: translate(-4px, 4px);
  box-shadow: -1px 1px 0 0 var(--pink);
}

.play-note {
  max-width: 30em;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- three steps ---------- */

.steps {
  padding-top: 8px;
  padding-bottom: 56px;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1.5px solid var(--text);
}

.step {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-areas: "art title" "art line";
  column-gap: 16px;
  align-content: center;
  padding: 18px 0;
  border-bottom: 1px dashed var(--sheet-line);
  border-bottom-color: color-mix(in srgb, var(--text) 28%, transparent);
}

.step:last-child {
  border-bottom: 0;
}

.step-art {
  grid-area: art;
  position: relative;
  width: 76px;
  height: 76px;
}

.step-no {
  display: none;
  font: 800 64px/76px "Rubik", system-ui, sans-serif;
  text-align: center;
  color: var(--text);
  text-shadow: -0.04em 0.03em 0 var(--pink), 0.03em -0.02em 0 var(--teal);
}

html:not(.js) .step-no {
  display: block;
}

.step h3 {
  grid-area: title;
  align-self: end;
  font: 800 21px/1.15 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.step p {
  grid-area: line;
  align-self: start;
  margin-top: 3px;
  color: var(--muted);
}

/* ---------- footer ---------- */

.foot {
  padding-top: 18px;
  padding-bottom: 28px;
}

.foot-line {
  padding-top: 14px;
  border-top: 1.5px solid var(--text);
  font: 500 12px/1.6 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.foot-line a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.foot-line a:hover {
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
}

/* ---------- 404 ---------- */

.nf {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  row-gap: 30px;
  padding-top: 18px;
  padding-bottom: 56px;
}

/* The misprint came out of the press crooked. */
.nf .poster {
  grid-area: auto;
  aspect-ratio: 343 / 190;
  transform: rotate(-1.6deg);
}

.nf .sheet {
  inset: 40px 18px 34px;
}

.nf .sheet-words {
  display: flex;
  align-items: center;
}

.nf-line {
  font: 800 clamp(26px, 7vw, 44px) / 1.05 "Rubik", system-ui, sans-serif;
  letter-spacing: -0.025em;
}

.nf-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 18px;
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font: 800 17px/1 "Rubik", system-ui, sans-serif;
  text-decoration: none;
  box-shadow: -5px 5px 0 0 var(--pink);
}

.nf-home:hover {
  transform: translate(1px, -1px);
  box-shadow: -6px 6px 0 0 var(--pink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ---------- wider screens ---------- */

@media (min-width: 560px) {
  .wrap {
    padding-left: 28px;
    padding-right: 28px;
  }

  .poster {
    aspect-ratio: 4 / 3.3;
  }

  .sheet {
    inset: 44px 28px 22px;
  }

  .sheet-small {
    font-size: 12px;
  }
}

@media (min-width: 900px) {
  .bar {
    padding-top: 24px;
    padding-bottom: 14px;
  }

  .wordmark {
    font-size: 22px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "copy poster" "play poster";
    column-gap: clamp(36px, 5vw, 80px);
    row-gap: 40px;
    align-items: start;
    padding-top: 28px;
    padding-bottom: 88px;
  }

  h1 {
    font-size: clamp(76px, 8.4vw, 124px);
  }

  .lede {
    margin-top: 26px;
    font-size: 19px;
  }

  .poster {
    aspect-ratio: 5 / 5.6;
    max-height: none;
  }

  .sheet {
    inset: 58px 40px 30px;
  }

  .reg {
    top: 16px;
    width: 19px;
    height: 19px;
  }

  .reg-l {
    left: 16px;
  }

  .reg-r {
    right: 16px;
  }

  .swatch {
    right: 24px;
    bottom: 30px;
  }

  .swatch i {
    width: 12px;
    height: 12px;
  }

  .sheet-small {
    font-size: 13px;
  }

  .play {
    align-self: end;
    gap: 16px;
  }

  .play-title {
    font-size: 44px;
  }

  .chip span {
    padding: 10px 16px;
    font-size: 15px;
  }

  .print {
    padding: 17px 30px 17px 24px;
    font-size: 21px;
  }

  .step-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 40px;
  }

  .step {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "art" "title" "line";
    align-content: start;
    padding: 28px 0 8px;
    border-bottom: 0;
  }

  .step-art {
    width: 104px;
    height: 104px;
    margin-bottom: 14px;
  }

  .step-no {
    font-size: 88px;
    line-height: 104px;
  }

  .step h3 {
    font-size: 25px;
  }

  .step p {
    font-size: 17px;
  }

  .nf {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-content: center;
    align-items: center;
    column-gap: 72px;
    padding-top: 40px;
    padding-bottom: 96px;
  }

  .nf .poster {
    aspect-ratio: 5 / 3;
  }

  .nf .sheet {
    inset: 70px 44px 60px;
  }
}
