/* Tokens first: every color is a custom property so the dark theme only has
   to redefine them. The look borrows from Swedish public-information posters:
   heavy condensed capitals, signal red, paper. */
:root {
  --paper: #f4eee3;
  --paper-alt: #ebe3d4;
  --ink: #171412;
  --ink-soft: #4a433c;
  --red: #b5121b;
  --red-ink: #ffffff;
  --rule: #d4c9b6;
  --card: #fffaf1;
  --right: #1f6b3a;
  --wrong: #b5121b;
  --focus: #1d4ed8;
  /* The opinion section is set apart as a dark block in both themes. */
  --opinion-bg: #171412;
  --opinion-ink: #f4eee3;
  --opinion-accent: #ff6b63;
  /* Chart pair checked for color-blind separation against each theme's paper. */
  --chart-banned: #b5121b;
  --chart-legal: #2a7fb0;

  --font-poster: "Helvetica Neue", "Arial Narrow", Arial, "Liberation Sans", sans-serif;
  --font-text: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --gutter: 16px;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151311;
    --paper-alt: #1e1b18;
    --ink: #efe8dc;
    --ink-soft: #b9b0a3;
    --red: #ff5c55;
    --red-ink: #1a0503;
    --rule: #3a342e;
    --card: #221f1b;
    --right: #6fcf8f;
    --wrong: #ff7a73;
    --focus: #8ab4ff;
    --opinion-bg: #3a100d;
    --opinion-ink: #efe8dc;
    --opinion-accent: #ff8a84;
    --chart-banned: #d9423b;
    --chart-legal: #4a90c4;
  }
}

:root[data-theme="dark"] {
  --paper: #151311;
  --paper-alt: #1e1b18;
  --ink: #efe8dc;
  --ink-soft: #b9b0a3;
  --red: #ff5c55;
  --red-ink: #1a0503;
  --rule: #3a342e;
  --card: #221f1b;
  --right: #6fcf8f;
  --wrong: #ff7a73;
  --focus: #8ab4ff;
  --opinion-bg: #3a100d;
  --opinion-ink: #efe8dc;
  --opinion-accent: #ff8a84;
  --chart-banned: #d9423b;
  --chart-legal: #4a90c4;
}

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

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

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

a {
  color: inherit;
  text-decoration-color: var(--red);
  text-underline-offset: 0.15em;
}

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

h1,
h2,
h3 {
  font-family: var(--font-poster);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(2rem, 6vw, 3rem);
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

h3 {
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
}

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

.skip:focus {
  top: var(--gutter);
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.wrap.narrow {
  max-width: calc(var(--measure) + 2 * var(--gutter));
}

/* ---- contents ------------------------------------------------------------ */

/* Open from 62rem, where the page leaves room for it (see the end of this
   file, and src/main.js). Narrower than that it would cover the text, so it
   collapses to a button. */
.toc {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  z-index: 5;
  max-width: min(13rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 2 * var(--gutter));
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--ink);
  font-family: var(--font-poster);
  font-size: 0.875rem;
  line-height: 1.3;
}

.toc summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
}

.toc-part {
  margin: 0;
  padding: 0.25rem 0.75rem;
  font-weight: 700;
  color: var(--red);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0 0.75rem 0.5rem;
}

.toc li {
  padding: 0.25rem 0;
  border-top: 1px solid var(--rule);
}

.toc a {
  color: var(--ink);
  text-decoration: none;
}

.toc a:hover {
  color: var(--red);
  text-decoration: underline;
}

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

.hero {
  padding: 3rem 0 4rem;
  border-bottom: 8px solid var(--red);
}

.eyebrow,
.label {
  font-family: var(--font-poster);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: clamp(2.75rem, 11vw, 7.5rem);
  text-transform: uppercase;
  margin: 0 0 1.5rem;
  hyphens: manual;
  overflow-wrap: break-word;
}

.hero-word {
  color: var(--red);
}

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

.lede-strong {
  font-weight: 700;
}

.register {
  margin-top: 2.5rem;
  max-width: 34rem;
  background: var(--card);
  border: 2px solid var(--ink);
  padding: 1.25rem;
  box-shadow: 8px 8px 0 var(--ink);
}

.register-title {
  font-size: 1rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.75rem;
}

.register-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  font-family: var(--font-poster);
}

.register-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--rule);
}

.status {
  color: var(--ink-soft);
}

.status.is-narkotika {
  color: var(--red);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status.is-struck {
  color: var(--ink);
  animation: stamp 0.35s ease-out;
}

@keyframes stamp {
  from { transform: scale(1.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.big-button {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--red);
  color: var(--red-ink);
  border: 0;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  width: 100%;
}

.big-button:hover {
  filter: brightness(1.08);
}

.result p {
  margin: 1rem 0 0;
}

.result p:first-child {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.5rem;
  text-transform: uppercase;
}

/* ---- short version ------------------------------------------------------- */

.short {
  margin-top: 3rem;
  max-width: var(--measure);
}

.short ul {
  margin: 0;
  padding-left: 1.25rem;
}

.short li {
  margin-bottom: 0.5rem;
}

/* ---- sections ------------------------------------------------------------ */

.section {
  padding: 4rem 0;
}

.section.alt {
  background: var(--paper-alt);
}

.intro {
  max-width: var(--measure);
  margin: 0 0 2rem;
}

.ref {
  font-family: var(--font-poster);
  font-size: 0.7em;
  font-weight: 700;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.15em;
  text-decoration: none;
  color: var(--red);
}

.ref:hover {
  text-decoration: underline;
}

/* Two references in a row would otherwise read as one number ("914"). */
.ref-sep {
  font-family: var(--font-poster);
  font-size: 0.7em;
  font-weight: 700;
  vertical-align: super;
  line-height: 0;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-top: 2px solid var(--ink);
}

.timeline p {
  margin: 0;
}

.year {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--red);
}

.myths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 1.5rem;
}

.after-cards {
  margin-top: 1.5rem;
}

/* .more comes later and resets the margin, so this needs the extra class. */
.more.after-cards {
  margin-top: 2.5rem;
}

.terms {
  max-width: var(--measure);
  margin: 0;
}

.terms dt {
  font-weight: 700;
}

.terms dd {
  margin: 0 0 1rem;
}

.myths.trio {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

.myth {
  background: var(--card);
  border: 2px solid var(--ink);
  padding: 1.25rem;
}

.myth-claim {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.15;
  text-transform: uppercase;
  margin: 0 0 1rem;
}

.stamp {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--red);
  border: 2px solid var(--red);
  padding: 0.1rem 0.4rem;
  margin-right: 0.4rem;
  vertical-align: middle;
  transform: rotate(-4deg);
}

.myth-truth {
  margin: 0;
  color: var(--ink-soft);
}

/* ---- quiz ---------------------------------------------------------------- */

.quiz {
  background: var(--card);
  border: 2px solid var(--ink);
  padding: 1.5rem;
}

.quiz p {
  margin: 0 0 1rem;
}

.quiz-progress {
  font-family: var(--font-poster);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.quiz-statement {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.35;
}

.quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quiz-choice {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.25rem;
  text-transform: uppercase;
  padding: 1rem;
  background: transparent;
  color: var(--ink);
  border: 3px solid var(--ink);
  cursor: pointer;
}

.quiz-choice:hover {
  background: var(--ink);
  color: var(--paper);
}

.quiz-stop {
  display: block;
  margin-top: 1rem;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  color: inherit;
  font-family: var(--font-poster);
  font-size: 1rem;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.quiz-feedback {
  margin-bottom: 1.25rem;
}

.quiz-verdict {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.is-right .quiz-verdict {
  color: var(--right);
}

.is-wrong .quiz-verdict {
  color: var(--wrong);
}

.quiz-feedback .quiz-statement {
  font-size: 1.125rem;
  color: var(--ink-soft);
}

.quiz-source {
  font-family: var(--font-poster);
  font-weight: 700;
}

.quiz-score {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: 2.5rem;
  text-transform: uppercase;
}

.noscript-note {
  color: var(--ink-soft);
}

/* ---- opinion ------------------------------------------------------------- */

.opinion {
  background: var(--opinion-bg);
  color: var(--opinion-ink);
}

.opinion .label {
  color: var(--opinion-accent);
}

.thesis {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.1;
  text-transform: uppercase;
  border-left: 8px solid var(--opinion-accent);
  padding-left: 1rem;
  margin: 2rem 0;
}

/* ---- harm chart ---------------------------------------------------------- */

.harm {
  margin: 1.5rem 0 2rem;
  font-family: var(--font-poster);
}

.harm table {
  width: 100%;
  border-collapse: collapse;
}

.harm caption {
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* The caption says what the columns hold; screen readers still get the headers. */
.harm thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.harm-row th {
  width: 1%;
  padding: 0.2rem 0.75rem 0.2rem 0;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.harm-row small {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.harm-row td {
  padding: 0.2rem 0;
  font-weight: 700;
  white-space: nowrap;
}

.harm-bar {
  display: inline-block;
  height: 0.9rem;
  /* Scaled to the top score, leaving room for the number after the bar. */
  width: calc(var(--score) / 72 * 85%);
  border-radius: 0 4px 4px 0;
  background: var(--chart-legal);
}

.harm-row.is-narkotika .harm-bar {
  background: var(--chart-banned);
}

.harm-key {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.9rem;
}

.harm-key li::before {
  content: "";
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.4rem;
  border-radius: 2px;
  background: var(--chart-legal);
}

.harm-key .is-narkotika::before {
  background: var(--chart-banned);
}

.harm figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

@media (min-width: 34rem) {
  .harm-row small {
    display: inline;
    margin-left: 0.25rem;
  }
}

/* ---- sources and footer -------------------------------------------------- */

.sources {
  font-size: 0.95rem;
}

.source-list {
  padding-left: 1.5rem;
}

.source-list li {
  margin-bottom: 0.6rem;
  overflow-wrap: anywhere;
}

.source-list li:target {
  background: var(--card);
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.footer {
  border-top: 8px solid var(--red);
  padding: 2rem 0 3rem;
  font-size: 0.95rem;
}

.footer p {
  margin: 0 0 0.5rem;
}

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

  html {
    scroll-behavior: auto;
  }
}

@media (min-width: 48rem) {
  .big-button {
    width: auto;
  }

  .timeline li {
    grid-template-columns: 7rem 1fr;
  }

  .year {
    font-size: 2.25rem;
  }
}

/* ---- prohibition and further reading ------------------------------------- */

.harms {
  list-style: none;
  margin: 0 0 3rem;
  padding: 0;
  max-width: 48rem;
  counter-reset: harm;
}

.harms li {
  counter-increment: harm;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-top: 2px solid var(--ink);
  font-family: var(--font-poster);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
}

.harms li::before {
  content: counter(harm);
  color: var(--red);
  font-weight: 900;
  font-size: 1.5rem;
}

.subhead {
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-transform: uppercase;
  margin: 0 0 1rem;
}

.reading {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reading li {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.reading p {
  margin: 0;
}

/* The page has three parts. The contents name them too, so a test keeps the
   two in step. */
.part {
  background: var(--red);
  color: var(--red-ink);
  padding: 1.5rem 0;
}

.part-number {
  font-family: var(--font-poster);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.25rem;
}

.part-question {
  font-family: var(--font-poster);
  font-weight: 900;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.1;
  text-transform: uppercase;
  margin: 0;
}

/* Depth for those who want it. Native <details>, so it opens without JavaScript. */
.more {
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 2px solid var(--ink);
}

.more summary {
  cursor: pointer;
  font-family: var(--font-poster);
  font-weight: 700;
}

.more[open] summary {
  margin-bottom: 0.75rem;
}

.more p:last-child {
  margin-bottom: 0;
}

/* Last in the file so the padding wins over each block's own shorthand. The
   content moves over to leave the right edge free for the open contents. */
@media (min-width: 62rem) {
  .hero,
  .part,
  .section,
  .footer {
    padding-right: 15rem;
  }
}

/* A plain list here: .harms numbers its items, and these read as dates. */
.deep-time {
  margin: 1rem 0;
  padding-left: 1.25rem;
}

.deep-time li {
  margin-bottom: 0.5rem;
}
