/* The look of the Squares in Circles playground (/squares-in-circles/): the
   same paper, ink and type, and the colours of the Lean project's figures:
   blue for the shapes, orange for the hyperbolic arcs. */
:root {
  color-scheme: light;
  --paper: #f2eee4;
  --card: #fbf9f3;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #8a8e96;
  --rule: #d9d2c1;
  --grid: rgba(31, 41, 55, 0.05);
  --grid-axis: rgba(31, 41, 55, 0.16);
  --red: #dc2626;
  --red-wash: rgba(220, 38, 38, 0.07);
  --green: #15803d;
  --focus: #2563eb;
  --s0: #2563eb;
  --f0: #dbeafe;
  --f0-deep: #bcd5fb;
  --s1: #ea580c;
  --f1: #ffedd5;
  --s2: #16a34a;
  --f2: #dcfce7;
  --s3: #9333ea;
  --sk: #9ca3af;
  --solid: #dbeafe;
  --solid-deep: #b9d3fb;
  --gap: #fde3c4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #131518;
    --card: #1a1d21;
    --ink: #ebe7dc;
    --ink-2: #b8b4a9;
    --ink-3: #7c7f86;
    --rule: #33363c;
    --grid: rgba(235, 231, 220, 0.04);
    --grid-axis: rgba(235, 231, 220, 0.14);
    --red: #f87171;
    --red-wash: rgba(248, 113, 113, 0.08);
    --green: #4ade80;
    --focus: #60a5fa;
    --s0: #60a5fa;
    --f0: rgba(96, 165, 250, 0.16);
    --f0-deep: rgba(96, 165, 250, 0.34);
    --s1: #fb923c;
    --f1: rgba(251, 146, 60, 0.2);
    --s2: #4ade80;
    --f2: rgba(74, 222, 128, 0.18);
    --s3: #c084fc;
    --sk: #9ca3af;
    --solid: #253344;
    --solid-deep: #33507a;
    --gap: #4a3322;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #131518;
  --card: #1a1d21;
  --ink: #ebe7dc;
  --ink-2: #b8b4a9;
  --ink-3: #7c7f86;
  --rule: #33363c;
  --grid: rgba(235, 231, 220, 0.04);
  --grid-axis: rgba(235, 231, 220, 0.14);
  --red: #f87171;
  --red-wash: rgba(248, 113, 113, 0.08);
  --green: #4ade80;
  --focus: #60a5fa;
  --s0: #60a5fa;
  --f0: rgba(96, 165, 250, 0.16);
  --f0-deep: rgba(96, 165, 250, 0.34);
  --s1: #fb923c;
  --f1: rgba(251, 146, 60, 0.2);
  --s2: #4ade80;
  --f2: rgba(74, 222, 128, 0.18);
  --s3: #c084fc;
  --sk: #9ca3af;
  --solid: #253344;
  --solid-deep: #33507a;
  --gap: #4a3322;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration-color: var(--ink-3);
  text-underline-offset: 0.18em;
}

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

i {
  font-style: italic;
}

sub {
  font-size: 0.7em;
  line-height: 0;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 0;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.top a {
  text-decoration: none;
}

.top a:hover {
  text-decoration: underline;
}

.top-end {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.theme {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.theme:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.theme svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.theme svg .solid {
  fill: currentColor;
  stroke: none;
}

/* ---------------------------------------------------------------- the intro */

.intro {
  max-width: 46rem;
  margin: 40px 0 24px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

h1 {
  margin: 0;
  font-weight: 350;
  font-style: italic;
  font-size: clamp(2.6rem, 6.4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.015em;
}

.lede {
  margin: 18px 0 0;
  font-size: 1.12rem;
  color: var(--ink-2);
}

.lede a {
  color: var(--ink);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0 0 8px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.98rem;
}

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

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

.toc .n {
  display: inline-block;
  min-width: 1.1em;
  font-style: italic;
  color: var(--ink-3);
}

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

.part {
  padding-top: 44px;
  scroll-margin-top: 8px;
}

.part + .part {
  margin-top: 28px;
  border-top: 1px solid var(--rule);
}

.part-head {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 46rem);
  justify-content: start;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.part-head .num {
  margin: -0.12em 0 0;
  font-size: 3.2rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  color: var(--ink-3);
  font-variant-numeric: lining-nums;
}

.part-head p {
  margin: 0;
  color: var(--ink-2);
}

h2,
h3 {
  margin: 0 0 6px;
  font-weight: 500;
  line-height: 1.2;
}

h2 {
  font-size: 1.75rem;
  font-weight: 400;
  font-style: italic;
}

h3 {
  font-size: 1.05rem;
}

/* the choice of shape */

.shapes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  max-width: min(74vh, 640px);
  margin: 0 0 18px;
}

.shape {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.shape svg {
  width: 100%;
  max-width: 54px;
  aspect-ratio: 1;
  display: block;
  margin-bottom: 4px;
}

.shape .thumb {
  fill: var(--f0);
  stroke: var(--s0);
  stroke-width: 0.07;
  stroke-linejoin: round;
}

.shape-density {
  font-size: 0.8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums lining-nums;
}

.shape:hover {
  background: var(--card);
  transform: translateY(-1px);
}

.shape[aria-pressed="true"] {
  background: var(--card);
  border-color: var(--ink);
  color: var(--ink);
}

.shape:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible,
.board:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.board:focus:not(:focus-visible),
.board.pointer:focus-visible {
  outline: none;
}

/* ---------------------------------------------------------------- the boards */

.play {
  display: grid;
  grid-template-columns: minmax(0, min(74vh, 640px)) minmax(280px, 360px);
  justify-content: space-between;
  gap: 32px;
  align-items: start;
}

.board-wrap {
  min-width: 0;
}

.board-box {
  position: relative;
}

.board {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
  user-select: none;
  -webkit-user-select: none;
}

#slide-board {
  touch-action: auto;
}

/* On small screens the panel is below the board, so the density is also shown
   on the board. */
.board-readout {
  display: none;
  position: absolute;
  top: 10px;
  left: 12px;
  margin: 0;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--card);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums lining-nums;
  pointer-events: none;
}

.hint {
  margin: 12px 2px 0;
  font-size: 0.92rem;
  color: var(--ink-3);
}

.grid line {
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.grid .minor {
  stroke: var(--grid);
}

.grid .axis {
  stroke: var(--grid-axis);
}

/* copies of a shape, drawn with <use> */
.copy {
  fill: var(--f0);
  stroke: var(--s0);
  stroke-width: 1;
  stroke-opacity: 0.55;
  pointer-events: none;
}

.copy.home {
  fill: var(--f0-deep);
  stroke-opacity: 1;
  stroke-width: 1.6;
}

.copy.ring {
  stroke-opacity: 0.85;
}

.mover use {
  fill: var(--fill);
  stroke: var(--stroke);
  stroke-width: 1.6;
  cursor: grab;
}

.mover.selected use {
  stroke-width: 3;
}

.c1 {
  --fill: var(--f1);
  --stroke: var(--s1);
}

.c2 {
  --fill: var(--f2);
  --stroke: var(--s2);
}

.board.dragging,
.board.dragging * {
  cursor: grabbing !important;
}

.arrows {
  pointer-events: none;
}

.arrow {
  stroke: var(--stroke);
  stroke-width: 1.8;
}

.head {
  fill: var(--stroke);
}

.tip {
  fill: var(--stroke);
}

.tip.origin {
  fill: var(--ink);
}

/* building the octagon */

.octagon-fill {
  fill: var(--f0);
  stroke: var(--s0);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.octagon-ghost {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.smoothed {
  fill: var(--f0);
  stroke: var(--s0);
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.cut {
  fill: var(--f1);
  stroke: var(--s1);
  stroke-width: 1;
  stroke-opacity: 0.6;
}

.asymptote {
  stroke: var(--ink-2);
  stroke-width: 1.2;
  stroke-dasharray: 7 5;
}

.corner-side {
  fill: none;
  stroke: var(--s0);
  stroke-width: 3;
  stroke-linecap: round;
}

.next-side {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}

.branch {
  fill: none;
  stroke: var(--s1);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  cursor: grab;
}

.arc {
  fill: none;
  stroke: var(--s1);
  stroke-width: 4;
  stroke-linecap: round;
}

.drop {
  stroke: var(--ink);
  stroke-width: 1.3;
}

.foot {
  fill: var(--ink);
}

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

.dot.cross {
  fill: var(--card);
  stroke: var(--s1);
  stroke-width: 2;
}

.label {
  fill: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 17px;
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 4px;
  stroke-linejoin: round;
  dominant-baseline: middle;
  pointer-events: none;
}

.label.end {
  text-anchor: end;
}

.grab {
  fill: transparent;
  cursor: grab;
}

.knob {
  fill: var(--card);
  stroke: var(--ink);
  stroke-width: 2;
  cursor: grab;
}

.point .knob {
  fill: var(--s1);
  stroke: var(--card);
}

/* the polygon to beat: its densest packing, with the gaps in orange */

#beat-board {
  background: var(--gap);
}

#beat-board .copy {
  fill: var(--solid);
  stroke-opacity: 0.7;
}

#beat-board.over-corner {
  cursor: grab;
}

#beat-board.over-edge {
  cursor: copy;
}

.poly {
  fill: var(--solid-deep);
  stroke: var(--s0);
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.handle {
  fill: var(--card);
  stroke: var(--s0);
  stroke-width: 2.2;
}

.handle.selected {
  fill: var(--s0);
  stroke: var(--card);
}

.handle.selected.twin {
  fill: var(--card);
  stroke: var(--s0);
  stroke-dasharray: 3 2.4;
}

.pair-line {
  stroke: var(--s0);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.centre {
  fill: var(--s0);
}

.contact {
  fill: var(--ink);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the panel */

.panel > section {
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}

.panel > section:first-child {
  border-top: 0;
  padding-top: 0;
}

.panel > section[hidden] {
  display: none;
}

.panel p {
  margin: 0;
}

.cap {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.big {
  margin: 2px 0 4px !important;
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  font-weight: 350;
  line-height: 1.15;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.pair {
  margin-top: 4px !important;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}

.least {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}

.status {
  margin-top: 8px !important;
  font-style: italic;
  color: var(--ink-2);
}

.status.good {
  color: var(--green);
}

.note {
  font-size: 0.95rem;
  color: var(--ink-3);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls .note {
  flex-basis: 100%;
}

button {
  font: inherit;
  color: var(--ink);
}

.modes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.modes.wide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  border-radius: 20px;
}

.modes.wide .mode {
  padding: 4px 8px;
}

.mode {
  padding: 4px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.corners .mode {
  min-width: 2.3em;
  padding: 4px 8px;
  font-variant-numeric: tabular-nums lining-nums;
}

.mode[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
}

.mode:not([aria-pressed="true"]):hover {
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle,
.actions button {
  padding: 6px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
}

.toggle.small {
  padding: 2px 12px;
  font-size: 0.92rem;
}

.actions button:disabled,
.toggle:disabled {
  opacity: 0.4;
  cursor: default;
}

.actions button:not(:disabled):hover,
.toggle:not(:disabled):hover {
  background: var(--ink);
  color: var(--card);
}

/* the stepper */

.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dots {
  display: flex;
  gap: 6px;
}

.dots button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.85rem;
  font-variant-numeric: lining-nums;
  cursor: pointer;
}

.dots button:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.dots button[aria-current="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
}

.step-text {
  min-height: 7.8em;
  margin-bottom: 12px !important;
  color: var(--ink-2);
}

/* sliders */

.slider {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  font-size: 0.98rem;
}

.slider output {
  min-width: 4.2em;
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink-2);
}

.ends {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 0 4.4em !important;
  font-size: 0.78rem;
  color: var(--ink-3);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--rule);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--rule);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--ink);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--ink);
}

.oct {
  --c: var(--s1);
}

.dec {
  --c: var(--s3);
}

.reg {
  --c: var(--s0);
}

.disk {
  --c: var(--ink-2);
}

.s14 {
  --c: var(--s3);
}

.key {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.key li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sw {
  flex: none;
  width: 3px;
  height: 14px;
  border-radius: 1px;
  background: var(--c);
}

.key.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 2px 0 10px;
  font-size: 0.85rem;
}

.key.inline .sw {
  width: 14px;
  height: 3px;
}

.key .v {
  margin-left: auto;
  font-variant-numeric: tabular-nums lining-nums;
}

.sw {
  flex: none;
  width: 3px;
  height: 14px;
  border-radius: 1px;
  background: var(--c);
}

.sw.low {
  width: 0;
  height: 0;
  margin: 0 -2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--ink);
  background: none;
}

/* the goal, the gauge and the controls of "Try to beat it" */

.goal-text {
  margin: 2px 0 4px !important;
  font-size: 1.22rem;
  line-height: 1.35;
}

.gauge {
  display: block;
  width: 100%;
  margin: 6px 0 2px;
}

.gauge .zone {
  fill: var(--f1);
}

.gauge .end-cap {
  stroke-width: 1.6;
}

.gauge .arrowhead {
  fill: var(--ink-3);
}

.gauge .axis,
.gauge .tick-mark {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.gauge .tick,
.gauge .hint-label {
  fill: var(--ink-3);
  font-family: "Newsreader", Georgia, serif;
  font-size: 12px;
  text-anchor: middle;
  font-variant-numeric: tabular-nums lining-nums;
}

.gauge .start {
  text-anchor: start;
}

.gauge .end {
  text-anchor: end;
}

.gauge .hint-label {
  font-style: italic;
}

.gauge .mark {
  stroke: var(--c);
  stroke-width: 1.4;
}

.gauge .mark-label {
  fill: var(--c);
  font-family: "Newsreader", Georgia, serif;
  font-size: 12.5px;
  text-anchor: end;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.gauge .you {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 2.5;
  transition: cx 0.12s ease;
}

.modes.presets {
  gap: 6px;
  margin: 6px 0 12px;
  padding: 0;
  border: 0;
}

.presets .mode {
  padding: 3px 12px;
  border: 1px solid var(--rule);
}

.presets .mode[aria-pressed="true"] {
  border-color: var(--ink);
}

.corners-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums lining-nums;
}

.corners-row span {
  min-width: 6.5em;
  text-align: center;
}

.round {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.round:not(:disabled):hover {
  background: var(--ink);
  color: var(--card);
}

.round:disabled {
  opacity: 0.4;
  cursor: default;
}

/* the family of smoothed polygons */

.family {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  max-width: 60rem;
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
}

.family-shapes {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.family-shapes li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 92px;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}

.family-shapes svg {
  width: 64px;
  height: 64px;
}

.family-shapes .thumb {
  fill: var(--f0);
  stroke: var(--s0);
  stroke-width: 0.045;
  stroke-linejoin: round;
}

.family-text p {
  margin: 0;
  color: var(--ink-2);
}

/* the chart of the slide */

.chart {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.chart .gridline {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--ink-3);
  font-family: "Newsreader", Georgia, serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums lining-nums;
}

.tick.end {
  text-anchor: end;
}

.tick.start {
  text-anchor: start;
}

.chart .series {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.3;
  stroke-opacity: 0.45;
}

.chart .series.current {
  stroke-width: 2.6;
  stroke-opacity: 1;
}

.chart .cursor {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.chart .dotmark {
  fill: var(--c);
  stroke: var(--card);
  stroke-width: 2;
}

.panel .slider .toggle {
  min-width: 4.4em;
}

/* ------------------------------------------------------------- the notes */

.aside-notes {
  max-width: 46rem;
  margin-top: 24px;
  color: var(--ink-2);
}

.aside-notes p {
  margin: 0 0 8px;
}

.more {
  font-size: 0.95rem;
  color: var(--ink-2);
}

.more summary {
  cursor: pointer;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-3);
  text-underline-offset: 0.18em;
}

.more summary:hover {
  text-decoration-color: currentColor;
}

.more p {
  margin: 8px 0 0;
}

/* ---------------------------------------------------------------- the history */

.history {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.line-box {
  position: sticky;
  top: 16px;
  padding: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
}

.numberline {
  display: block;
  width: 100%;
}

.numberline .axis {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.numberline .tick-mark {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.numberline .tick {
  fill: var(--ink-3);
  font-family: "Newsreader", Georgia, serif;
  font-size: 14px;
  text-anchor: middle;
  font-variant-numeric: tabular-nums lining-nums;
}

.numberline .proved {
  fill: var(--green);
  fill-opacity: 0.22;
}

.numberline .open {
  fill: var(--f1);
}

.numberline .mark {
  stroke: var(--c);
  stroke-width: 1.2;
}

.numberline .mark-dot {
  fill: var(--c);
}

.numberline .mark-label {
  fill: var(--c);
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
  text-anchor: end;
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.numberline .floor {
  stroke: var(--green);
  stroke-width: 2.4;
}

.numberline .floor-label {
  fill: var(--green);
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
  font-style: italic;
  text-anchor: end;
}

.numberline .floor-label.start {
  text-anchor: start;
}

.caption {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.event {
  display: grid;
  grid-template-columns: 6.2em minmax(0, 1fr);
  column-gap: 14px;
  width: 100%;
  margin: 0;
  padding: 10px 12px 10px 18px;
  border: 0;
  border-radius: 0 12px 12px 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--ink-2);
  cursor: pointer;
  position: relative;
}

.event::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--ink-3);
}

.event:hover {
  background: var(--card);
}

.event[aria-current="true"] {
  background: var(--card);
  color: var(--ink);
}

.event[aria-current="true"]::before {
  background: var(--ink);
  border-color: var(--ink);
}

.event .year {
  grid-row: span 2;
  font-style: italic;
  font-variant-numeric: lining-nums;
  color: var(--ink);
}

.event .who {
  font-weight: 500;
  color: var(--ink);
}

.event .what {
  font-size: 0.95rem;
}

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

footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--ink-3);
  max-width: 46rem;
}

footer p {
  margin: 0;
}

/* --------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .play,
  .history {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .board-wrap {
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
  }

  .shapes {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  .board-readout {
    display: block;
  }

  .line-box {
    position: static;
  }

  .step-text {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .top {
    font-size: 0.88rem;
  }

  .intro {
    margin: 28px 0 20px;
  }

  .part {
    padding-top: 32px;
  }

  .part-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .part-head .num {
    font-size: 2.2rem;
  }

  .shapes {
    gap: 2px;
  }

  .shape {
    padding: 6px 1px 4px;
    font-size: 0.78rem;
  }

  .shape-density {
    font-size: 0.72rem;
  }

  .event {
    grid-template-columns: minmax(0, 1fr);
  }

  .shapes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .family {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .family-shapes {
    justify-content: space-around;
  }

  .event .year {
    grid-row: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .shape,
  .mode,
  .toggle,
  .actions button,
  .scale .pin {
    transition: none;
  }
}
