/* Shared styles for every page on hardfork.co.
   One typeface, hairlines, one red. Colours are tokens below; everything else follows from them. */

:root {
  --paper: #ffffff;
  --ink: #111111;
  --grey: #7a7a7a;
  --rule: #dcdcdc;
  --red: #e5352b;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: 24px;
  --measure: 38rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0f;
    --ink: #ededed;
    --grey: #8a8a8a;
    --rule: #2a2a2a;
    --red: #ff5a4f;
  }
}

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

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

body {
  margin: 0;
  padding: 0 var(--gutter) 40px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.small {
  font-size: 0.8125rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0 var(--gutter);
}

/* Header: wordmark, a quiet line of categories, nothing else */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 0 10px;
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark .px {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-left: 0.12em;
  background: var(--red);
}

.site-header nav {
  display: flex;
  gap: 20px;
  color: var(--grey);
}

.site-header nav a:hover,
.cats a:hover {
  color: var(--ink);
}

.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--rule);
  color: var(--grey);
}

.cats a[aria-current] {
  color: var(--ink);
}

/* Figures: no boxes, thin ink, one red each */

.fig {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
  overflow: visible;
}

.fig * {
  vector-effect: non-scaling-stroke;
}

.fig > g {
  stroke-width: 1;
}

.fig .acc {
  stroke: var(--red);
  stroke-width: 2;
}

.fig [fill="var(--red)"] {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
}

.fig text {
  font-family: var(--sans);
  font-size: var(--fs, 7px);
  fill: var(--grey);
  letter-spacing: 0.02em;
}

.fig text.big {
  font-size: calc(var(--fs, 7px) * 2.2);
  letter-spacing: -0.02em;
  fill: var(--ink);
}

.fig text.sm {
  font-size: calc(var(--fs, 7px) * 0.85);
}

.fig text.cap {
  display: none;
}

/* Entry anatomy: number and category, title, hook, stamp */

.k {
  color: var(--grey);
  font-size: 0.8125rem;
}

.k b {
  font-weight: 400;
  color: var(--ink);
}

.hook {
  color: var(--grey);
  max-width: 46ch;
}

.stamp {
  display: inline-block;
  padding: 3px 7px 2px;
  border: 1px solid var(--grey);
  color: var(--grey);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.stamp.built {
  border-color: var(--red);
  color: var(--red);
}

.entry:hover h2 {
  color: var(--red);
}

/* Home */

.manifesto {
  padding: 64px 0 72px;
}

.manifesto h1 {
  grid-column: 1 / span 9;
  max-width: 22ch;
  font-size: clamp(1.875rem, 3.4vw, 3.125rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-wrap: balance;
}

.manifesto h1 em {
  font-style: normal;
  color: var(--grey);
}

.lead {
  padding: 0 0 48px;
  border-top: 1px solid var(--rule);
  align-items: end;
}

.lead .art {
  grid-column: 1 / span 7;
  padding: 48px 48px 0 0;
  --fs: 4.4px;
}

.lead .text {
  grid-column: 8 / span 5;
  display: grid;
  gap: 18px;
  padding-top: 48px;
}

.lead h2 {
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.lead .hook {
  font-size: 1.125rem;
  max-width: 36ch;
}

.row {
  padding: 40px 0 48px;
  border-top: 1px solid var(--rule);
  row-gap: 48px;
}

.entry {
  display: grid;
  gap: 14px;
  align-content: end;
  min-width: 0;
}

.two {
  grid-column: span 6;
}

.two .art {
  max-width: 480px;
  padding: 0 64px 18px 0;
  --fs: 5.6px;
}

.two h2 {
  max-width: 22ch;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}

.one {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0 var(--gutter);
  align-items: end;
}

.one .art {
  grid-column: 7 / span 6;
  padding: 0 48px 0 24px;
  --fs: 5px;
}

.one .text {
  grid-column: 1 / span 5;
  display: grid;
  gap: 14px;
}

.one h2 {
  font-size: clamp(1.75rem, 2.6vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.06;
  text-wrap: balance;
}

/* Category pages: the index */

.index-head {
  padding: 56px 0 40px;
}

.index-head h1 {
  grid-column: 1 / span 8;
  font-size: clamp(1.875rem, 3.4vw, 3.125rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.index-head .k {
  grid-column: 9 / span 4;
  align-self: end;
}

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

.index li a {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) 9rem 7rem;
  gap: 0 var(--gutter);
  align-items: baseline;
  padding: 18px 0 20px;
  border-top: 1px solid var(--rule);
}

.index li:last-child a {
  border-bottom: 1px solid var(--rule);
}

.index .t {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.index .t small {
  display: block;
  margin-top: 4px;
  max-width: 60ch;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--grey);
}

.index a:hover .t {
  color: var(--red);
}

.empty {
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--grey);
}

/* Post pages: number and category, title, abstract, byline, body, figures */

.post {
  padding: 56px 0 0;
}

.post-head {
  display: grid;
  gap: 18px;
}

.post-head h1 {
  max-width: 18ch;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.post-head .abstract {
  max-width: 54ch;
  font-size: 1.1875rem;
  line-height: 1.45;
}

.post-head .abstract b {
  font-weight: 500;
}

.post-head .byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.post-body {
  padding: 48px 0 0;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.post-body > :not(figure) {
  max-width: var(--measure);
}

.post-body h2 {
  margin: 2.2em 0 0.6em;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.post-body h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1.0625rem;
  font-weight: 500;
}

.post-body p,
.post-body ul,
.post-body ol {
  margin: 0 0 1.1em;
}

.post-body ul,
.post-body ol {
  padding-left: 1.2em;
}

.post-body li + li {
  margin-top: 0.3em;
}

.post-body a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

.post-body a:hover {
  text-decoration-color: var(--red);
}

.post-body blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 1em;
  border-left: 2px solid var(--rule);
  color: var(--grey);
}

.post-body hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
}

.post-body code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--rule);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.875em;
}

.post-body pre {
  overflow-x: auto;
  margin: 1.5em 0;
  padding: 16px;
  border: 1px solid var(--rule);
  line-height: 1.5;
}

.post-body pre code {
  padding: 0;
  border: 0;
}

.post-body figure {
  margin: 2.5em 0;
  max-width: 44rem;
}

.post-body figure.wide {
  max-width: 56rem;
}

.post-body figcaption {
  margin-top: 12px;
  max-width: 60ch;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--grey);
}

.post-body figcaption b {
  font-weight: 400;
  color: var(--ink);
}

.post-body .fig {
  --fs: 5px;
}

.post-body .references {
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--grey);
}

.post-body .references ol {
  padding-left: 1.4em;
}

.post-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--grey);
}

.post-foot a:hover {
  color: var(--ink);
}

/* Not found */

.lost {
  padding: 64px 0;
}

.lost h1 {
  max-width: 22ch;
  font-size: clamp(1.875rem, 3.4vw, 3.125rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.lost p {
  margin-top: 18px;
  color: var(--grey);
}

/* Footer carries the scoreboard */

.site-footer {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px var(--gutter);
  padding: 18px 0 0;
  border-top: 1px solid var(--rule);
  color: var(--grey);
  font-size: 0.8125rem;
}

.site-footer .l {
  grid-column: 1 / span 3;
}

.site-footer .score {
  grid-column: 4 / span 6;
}

.site-footer .score b {
  font-weight: 400;
  color: var(--ink);
}

.site-footer .r {
  grid-column: 10 / span 3;
  text-align: right;
}

.site-footer a:hover {
  color: var(--ink);
}

@media (max-width: 900px) {
  :root {
    --gutter: 16px;
  }

  .manifesto {
    padding: 40px 0 48px;
  }

  .manifesto h1,
  .index-head h1,
  .index-head .k {
    grid-column: 1 / -1;
  }

  .index-head {
    padding: 40px 0 28px;
    row-gap: 12px;
  }

  .lead .art,
  .lead .text {
    grid-column: 1 / -1;
  }

  .lead .art {
    padding: 40px 0 0;
    --fs: 6px;
  }

  .lead .text {
    padding-top: 28px;
  }

  .row {
    padding: 32px 0 36px;
    row-gap: 36px;
  }

  .two {
    grid-column: 1 / -1;
  }

  .two .art {
    max-width: 360px;
    padding: 0 0 8px;
    --fs: 7px;
  }

  .one .art,
  .one .text {
    grid-column: 1 / -1;
  }

  .one .art {
    order: -1;
    max-width: 360px;
    padding: 0 0 8px;
    --fs: 7px;
  }

  .index li a {
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 4px var(--gutter);
  }

  .index .t,
  .index .m {
    grid-column: 2;
  }

  .index .m + .m {
    display: none;
  }

  .post {
    padding-top: 40px;
  }

  .post-body {
    padding-top: 36px;
  }

  .post-body .fig {
    --fs: 7px;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer .l,
  .site-footer .score,
  .site-footer .r {
    grid-column: 1;
    text-align: left;
  }
}
