:root {
  --copy: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --heading: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --margin-x: calc(13% - 28px);
}

@media (max-width: 759px) {
  :root {
    --margin-x: 36px;
  }
}

body {
  background: var(--matte);
}

/* ---------- the exercise book ---------- */

.paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(237, 234, 226, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 234, 226, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(237, 234, 226, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 234, 226, 0.035) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}

.paper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--margin-x);
  width: 1px;
  background: rgba(229, 57, 43, 0.6);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.site-header,
.site-footer {
  position: relative;
  z-index: 3;
  background: var(--matte);
}

main {
  position: relative;
}

section {
  position: relative;
  overflow: clip;
  padding-block: clamp(110px, 18vw, 220px);
}

.eq {
  position: absolute;
  z-index: 0;
  font-family: var(--hand);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.4vw, 2.2rem);
  color: rgba(237, 234, 226, 0.12);
  white-space: nowrap;
  pointer-events: none;
}

.eq:nth-of-type(even) {
  color: rgba(237, 234, 226, 0.07);
}

@media (max-width: 759px) {
  .eq {
    font-size: 1.15rem;
    color: rgba(237, 234, 226, 0.07);
  }
}

/* ---------- text column ---------- */

.text-col {
  position: relative;
  z-index: 1;
  padding-left: 13%;
  padding-right: var(--gutter);
}

.text-col.centred {
  padding-left: var(--gutter);
  text-align: center;
}

@media (max-width: 759px) {
  .text-col,
  .text-col.centred {
    padding-left: 48px;
    padding-right: 20px;
  }
}

/* ---------- copy ---------- */

.line {
  position: relative;
  display: block;
  max-width: 34em;
  clip-path: inset(0 0 0 -90px);
  font-family: var(--copy);
  font-weight: 500;
  font-size: clamp(1.25rem, 2vw, 1.95rem);
  letter-spacing: -0.01em;
  line-height: 1.7;
  color: rgba(237, 234, 226, 0.88);
}

.line > span {
  display: block;
}

.line strong {
  font-weight: 800;
  color: var(--silk);
}

.text-col.centred .line {
  margin-inline: auto;
}

.text-col p.line:first-of-type {
  color: var(--silk);
}

.line + .line {
  margin-top: 1.6em;
}

@media (max-width: 759px) {
  .line {
    line-height: 1.6;
  }
}

html.js .line > span {
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.8s ease;
}

html.js .line:not(.in) > span {
  transform: translateY(100%);
  opacity: 0;
}

.lead {
  color: var(--dim);
}

/* small caps-style labels, all Montserrat on this page */
.graph-y,
.graph-x,
.graph-key,
.break-rule b {
  font-family: var(--copy);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- headings ---------- */

.hero h1,
.discord h2 {
  font-family: var(--heading);
  font-weight: 700;
  font-stretch: 100%;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

/* ---------- 1. hero ---------- */

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  white-space: nowrap;
  margin-bottom: 0.6em;
}

.atar {
  position: relative;
  display: inline-block;
  min-width: 2ch;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.atar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.14em;
  height: 2px;
  background: var(--mask);
  transform-origin: left;
}

html.js .atar.counting {
  color: var(--dim);
}

html.js .atar::after {
  transition: transform 0.5s ease;
}

html.js .atar.pending::after {
  transform: scaleX(0);
}

/* ---------- 2. friends: the graph ---------- */

.graph {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: clamp(56px, 8vw, 96px) auto;
}

.graph-y {
  display: block;
  margin-bottom: 0.8em;
  text-align: left;
}

.graph svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.graph .axis,
.graph .tick-mark {
  fill: none;
  stroke: rgba(237, 234, 226, 0.35);
  stroke-width: 1.5;
}

.graph .curve {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.graph .curve-early {
  stroke: var(--silk);
}

.graph .curve-late {
  stroke: var(--dim);
  stroke-dasharray: 9 9;
}

.graph-x {
  display: flex;
  justify-content: space-between;
  margin-top: 0.7em;
  padding-left: 6.67%;
  padding-right: 1.67%;
}

.graph-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8em 1.8em;
  margin-top: 1.6em;
}

.graph-key i {
  display: inline-block;
  width: 22px;
  margin-right: 0.7em;
  vertical-align: middle;
  border-top: 3px solid var(--silk);
}

.graph-key .key-late {
  border-top-style: dashed;
  border-top-color: var(--dim);
}

/* ---------- 3. how I did it ---------- */

.how {
  background: rgba(19, 19, 20, 0.72);
}

/* ---------- 4. after ---------- */

.break-rule {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1em;
  padding-left: 13%;
  padding-right: var(--gutter);
  margin-bottom: clamp(48px, 8vw, 88px);
}

@media (max-width: 759px) {
  .break-rule {
    padding-left: 48px;
    padding-right: 20px;
  }
}

.break-rule b {
  white-space: nowrap;
}

.break-rule .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pen-tick {
  position: absolute;
  left: -66px;
  top: calc(0.85em - 13px);
  width: 26px;
  height: 26px;
  overflow: visible;
}

.pen-tick path {
  fill: none;
  stroke: var(--wheel);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

html.js .line.ticked .pen-tick path {
  transition: stroke-dashoffset 0.4s ease 0.55s;
}

html.js .line.ticked:not(.in) .pen-tick path {
  stroke-dashoffset: 1;
}

@media (max-width: 759px) {
  .pen-tick {
    left: -45px;
    top: calc(0.8em - 11px);
    width: 22px;
    height: 22px;
  }
}

/* ---------- buttons ---------- */

.cta-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(64px, 9vw, 112px);
  padding-inline: 20px;
}

@media (max-width: 759px) {
  .cta-row {
    padding-left: 48px;
  }
}

main .btn-oval--lg {
  font-family: var(--copy);
  font-weight: 500;
  letter-spacing: 0.16em;
  white-space: nowrap;
  background: var(--matte);
}

@media (max-width: 480px) {
  main .btn-oval--lg {
    padding-inline: 1em;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 360px) {
  main .btn-oval--lg {
    white-space: normal;
    text-wrap: balance;
  }
}

.cta-row .cta-note {
  margin-top: 1em;
  font-family: var(--copy);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dim);
  text-align: center;
}

/* ---------- 5. discord ---------- */

.discord h2 {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  margin-bottom: 0.6em;
}

.after-cta {
  margin-top: clamp(64px, 9vw, 112px);
}
