@font-face {
  font-family: "Bricolage Grotesque";
  src: url(assets/fonts/bricolage.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url(assets/fonts/bricolage-ext.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  src: url(assets/fonts/body.woff2?v=2) format("woff2");
  font-weight: 100 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  src: url(assets/fonts/body-ext.woff2) format("woff2");
  font-weight: 100 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url(assets/fonts/mono.woff2) format("woff2");
  font-display: swap;
}
:root {
  --ink: #422c41;
  --muted: #665364;
  --berry: #7d3251;
  --paper: #fffbf6;
  --hair: #bdabba;
  --mono: "IBM Plex Mono", monospace;
  --headline: "Bricolage Grotesque", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button,
input,
summary {
  font: inherit;
  color: inherit;
}
button,
summary {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid #6b3986;
  outline-offset: 3px;
}
h1,
h2,
h3,
p,
figure,
ul {
  margin: 0;
}
h1,
h2,
strong {
  font-family: var(--headline);
}
.page-width {
  width: min(1120px, 90%);
  margin-inline: auto;
}
.skip {
  position: fixed;
  top: 0;
  left: 1rem;
  z-index: 20;
  transform: translateY(-130%);
  padding: 9px;
  background: var(--paper);
}
.skip:focus {
  transform: none;
}
.mast {
  background: #fffbf8;
  border-bottom: 1px solid #cbb9c5;
}
.mast-inner,
.mast nav,
.footer-inner,
.footer-inner nav,
.shelf-heading,
.shelf-controls,
.modal-top,
.input-row {
  display: flex;
  align-items: center;
}
.mast-inner,
.footer-inner,
.shelf-heading {
  justify-content: space-between;
  gap: 20px;
}
.mast-inner {
  min-height: 63px;
}
.mast nav,
.footer-inner nav {
  gap: clamp(18px, 3vw, 44px);
}
.mast a,
.footer-inner a {
  text-decoration: none;
}
.mast nav a,
.footer-inner nav a {
  font-size: 14px;
  padding: 12px 0;
}
.mast a:hover,
.footer-inner a:hover {
  text-decoration: underline;
}
.byline {
  font: 650 22px/1 var(--headline);
  letter-spacing: -0.045em;
}
.shop {
  position: relative;
  isolation: isolate;
  background-color: #eee4eb;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 22px, #b88caa0b 22px 24px),
    repeating-linear-gradient(0deg, transparent 0 22px, #b88caa0b 22px 24px);
  border-bottom: 1px solid #d3c0c9;
  padding: clamp(25px, 3vw, 46px) 0 25px;
  box-shadow: inset 0 1px #fff9;
}
.shelf-heading {
  align-items: center;
  position: relative;
  z-index: 3;
}
h1 {
  font: 680 clamp(32px, 3.3vw, 49px)/1.04 var(--headline);
  letter-spacing: -0.055em;
}
.shelf-heading p,
.favorites p {
  color: var(--muted);
  margin-top: 5px;
}
.index {
  position: relative;
}
.index summary {
  list-style: none;
  border: 1px solid #a48b9c;
  border-radius: 24px;
  background: #fffaf4a8;
  font-size: 13px;
  padding: 8px 15px;
  white-space: nowrap;
}
.index summary::-webkit-details-marker {
  display: none;
}
.index summary::after {
  content: "⌄";
  margin-left: 8px;
}
.index[open] summary::after {
  content: "⌃";
}
.index ul {
  position: absolute;
  right: 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--hair);
  min-width: 190px;
  padding: 7px;
  box-shadow: 3px 4px 0 #795e7424;
  z-index: 10;
}
.index li a {
  display: block;
  text-decoration: none;
  padding: 7px 10px;
}
.index li a:hover {
  background: #f2e1e7;
}
.display-case {
  position: relative;
  width: min(1550px, 100%);
  margin: 0 auto;
  padding: 0 0 12px;
  overflow: hidden;
}
.swiper-initialized {
  overscroll-behavior-x: contain;
}
@media (prefers-reduced-motion: no-preference) {
  .swiper-initialized .print img {
    transition: filter 95ms ease-out;
  }
  .swiper.moving .print img {
    filter: blur(1px);
  }
}
.swiper {
  padding: 24px 0 12px;
  overflow: visible;
  width: 100%;
}
/* Hit-test the tilted paper itself, including in accelerated 3D layouts. */
.swiper-initialized .swiper-wrapper {
  pointer-events: none;
}
.swiper-initialized .swiper-slide {
  pointer-events: auto;
}
.swiper-wrapper {
  align-items: end;
}
.swiper-slide {
  width: clamp(238px, 20.6vw, 316px);
  height: auto;
  display: flex;
  justify-content: center;
  align-items: end;
}
.swiper:not(.swiper-initialized) {
  overflow-x: auto;
}
.swiper:not(.swiper-initialized) .swiper-wrapper {
  gap: 18px;
  padding-inline: 5%;
}
.print {
  --stock: #fff3df;
  --title: #63324a;
  display: block;
  position: relative;
  width: 100%;
  text-decoration: none;
  --fold: 11px;
  filter: drop-shadow(2px 4px 4px #432b343b);
  user-select: none;
}
.print-sheet {
  position: relative;
  display: block;
  background: var(--stock);
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
}
.print-sheet::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: var(--fold);
  height: var(--fold);
  background: linear-gradient(135deg, var(--stock) 35%, color-mix(in srgb, var(--stock) 72%, #83605b));
  box-shadow: -1px 1px 2px #442e3466;
  pointer-events: none;
}
.print img {
  width: 100%;
  aspect-ratio: 4 / 4.55;
  object-fit: cover;
  object-position: center 48%;
  height: auto;
  display: block;
  pointer-events: none;
}
.print-flyover {
  --stock: #fff0c8;
  --title: #74324b;
}
.print-factoring {
  --stock: #e9e7ff;
  --title: #4b4069;
}
.print-conway {
  --stock: #e8efd6;
  --title: #454e3b;
}
.print-cpu {
  --stock: #ffeac1;
  --title: #633d39;
}
.print-schedule {
  --stock: #dbede5;
  --title: #345758;
}
.print-foot {
  text-align: center;
  display: block;
  padding: 10px 14px 12px;
  color: var(--title);
  border-top: 1px solid #7f594727;
}
.print-type {
  display: block;
  font: 11px var(--mono);
}
.print-foot strong {
  display: block;
  font-size: clamp(20px, 2.2vw, 32px);
  font-weight: 690;
  letter-spacing: -0.055em;
  line-height: 1.12;
  margin-top: 4px;
}
.ledge {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 16px;
  pointer-events: none;
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      1deg,
      #0000 0 5px,
      #754e2e0b 6px 7px,
      #0000 8px 16px
    ),
    linear-gradient(
      #cfb194 0 3px,
      #e7cbb0 3px 7px,
      #caa182 7px 14px,
      #b58973 14px
    );
  box-shadow: 0 5px 8px #563a3d26;
}
.shelf-controls {
  justify-content: center;
  gap: 11px;
  margin-top: 18px;
}
.shelf-controls a,
.shelf-controls button,
.outbound,
.input-row button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 620 14px/1.15 var(--headline);
  text-decoration: none;
}
.shelf-controls a,
.outbound,
.input-row button {
  background: var(--ink);
  color: #fffaf7;
  padding: 10px 19px;
  border: 1px solid var(--ink);
  border-radius: 24px;
}
.shelf-controls a {
  min-width: 175px;
}
.shelf-controls button {
  min-width: 42px;
  border: 1px solid #a894a4;
  border-radius: 50%;
  background: #fff9f2;
  color: var(--ink);
  font-size: 19px;
}
.shelf-controls button:hover,
.index summary:hover {
  background: #f9dfe6;
}
.shelf-controls a:hover,
.outbound:hover,
.input-row button:hover {
  background: #68425d;
}
.personal {
  padding-block: clamp(45px, 6vw, 80px);
  display: grid;
  grid-template-columns: 1.1fr 0.85fr;
  gap: clamp(45px, 10vw, 140px);
  align-items: start;
}
.personal h2,
.footer-inner h2 {
  font: 650 clamp(24px, 2.25vw, 34px)/1.1 var(--headline);
  letter-spacing: -0.048em;
}
.intro p,
.favorites p {
  margin-top: 14px;
  line-height: 1.6;
}
.inline-link {
  display: inline-block;
  color: var(--berry);
  font-weight: bold;
  margin-top: 11px;
}
.favorites {
  position: relative;
  padding: 24px clamp(18px, 2.2vw, 32px) 25px;
  background: #f4e7d4;
  box-shadow: 1px 3px 4px #5a39441a;
  transform: rotate(1deg);
  border-radius: 2px;
}
.favorites:before {
  content: "";
  position: absolute;
  width: 66px;
  height: 20px;
  top: -8px;
  left: calc(50% - 33px);
  transform: rotate(-6deg);
  background: repeating-linear-gradient(
    135deg,
    #cbb5cbbe 0 4px,
    #e2cdddcc 4px 8px
  );
  clip-path: polygon(
    0 4%,
    98% 0,
    100% 17%,
    97% 34%,
    100% 51%,
    97% 72%,
    100% 98%,
    1% 100%,
    3% 82%,
    0 62%,
    3% 35%
  );
}
.favorites p {
  font-size: 14px;
  margin-top: 8px;
}
.favorites ul {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}
.favorites li {
  border-bottom: 1px solid #c4af9e;
}
.favorites a {
  display: block;
  padding: 5px 0;
  text-decoration: none;
  font-weight: 600;
}
.favorites a:hover {
  text-decoration: underline;
}
.footer-inner {
  min-height: 83px;
  border-top: 1px solid var(--hair);
}
.footer-inner h2 {
  font-size: 19px;
}
.project-details .detail {
  margin-block: 30px;
}
.enhanced .project-details {
  display: none;
}
.detail > p,
.detail-heading,
.detail .toy,
.detail .player {
  margin-bottom: 17px;
}
.detail-heading > p,
.print-type {
  font: 11px/1.5 var(--mono);
  color: #5b4b55;
}
.detail h2 {
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: -0.045em;
  line-height: 1.1;
}
.open-project {
  padding: 0;
  width: min(790px, 92vw);
  max-height: 90dvh;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #7a6376;
  border-radius: 6px;
  box-shadow: 0 15px 80px #35203144;
}
.open-project::backdrop {
  background: #37263d74;
}
.modal-top {
  justify-content: flex-end;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hair);
  background: #f4e9f0;
}
.modal-top button {
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 14px;
  padding: 5px;
}
#detail-slot {
  display: grid;
  grid-template-columns: 28% 1fr;
  align-items: start;
}
#detail-slot > .detail-art {
  width: 100%;
  height: 100%;
  max-height: 510px;
  object-fit: cover;
  min-height: 100%;
  border-right: 1px solid #b79ea14d;
}
#detail-slot > .detail {
  padding: clamp(20px, 3vw, 33px);
}
.toy {
  padding: 14px;
  background: #f4ebe6;
  border: 1px solid #d8c8cc;
  border-radius: 3px;
}
.toy label,
.toy small {
  display: block;
}
.toy small,
.player figcaption {
  font-size: 12px;
}
.input-row {
  margin-top: 8px;
  gap: 7px;
}
.input-row input {
  width: 120px;
  background: white;
  border: 1px solid #a991a0;
  border-radius: 4px;
  padding: 8px;
}
.toy output,
.toy #forecast {
  display: block;
  font: 15px/1.45 var(--mono);
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.spectrum {
  position: relative;
  color: var(--paper);
  background: var(--ink);
}
.spectrum img {
  width: 100%;
  height: auto;
  display: block;
}
.playhead {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: white;
}
.player audio {
  width: 100%;
  display: block;
  margin: 8px 0;
}
.rook-board {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 2px;
  margin-top: 10px;
}
.rook-board button {
  height: 42px;
  border: 1px solid #b2a1af;
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  font: 13px var(--mono);
}
.rook-board .neighbor {
  background: #dbcadf;
}
.rook-board [aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
@media (min-width: 1550px) {
  .ledge {
    width: 98%;
    left: 1%;
  }
  .display-case {
    mask-image: linear-gradient(90deg, transparent, #000 3% 97%, transparent);
  }
}
@media (max-width: 680px) {
  .mast-inner {
    min-height: 57px;
  }
  .mast nav,
  .footer-inner nav {
    gap: 16px;
  }
  .mast nav a {
    font-size: 13px;
  }
  .byline {
    font-size: 18px;
  }
  .shop {
    padding-top: 24px;
    padding-bottom: 18px;
  }
  .shelf-heading {
    align-items: start;
  }
  .shelf-heading p {
    font-size: 14px;
    max-width: 24ch;
  }
  .index summary {
    font-size: 12px;
    padding: 7px 10px;
  }
  .swiper {
    padding-top: 20px;
  }
  .swiper-slide {
    width: clamp(200px, 62vw, 290px);
  }
  .print img {
    aspect-ratio: 4/4.55;
  }
  .print-foot {
    padding: 7px 12px 9px;
  }
  .print-foot strong {
    font-size: 24px;
  }
  .shelf-controls {
    margin-top: 14px;
  }
  .personal {
    grid-template-columns: 1fr;
    gap: 38px;
  }
  .favorites {
    max-width: 460px;
  }
  .footer-inner {
    min-height: 70px;
  }
  #detail-slot {
    display: block;
  }
  #detail-slot > .detail-art {
    display: none;
  }
}
@media (max-width: 380px) {
  .mast nav {
    gap: 10px;
  }
  .page-width {
    width: 92%;
  }
  .shelf-heading {
    gap: 5px;
  }
  .shelf-heading h1 {
    font-size: 30px;
  }
  .index summary {
    padding: 6px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::after,
  *::before {
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}
body.modal-open {
  overflow: hidden;
}
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* The light on the shelf takes its color from the paper in the middle. */
.shop {
  transition: background-color 0.36s ease;
}
.shop[data-selection="factoring"] {
  background-color: #e9e5f0;
}
.shop[data-selection="cpu"] {
  background-color: #f3e6db;
}
.shop[data-selection="schedule"] {
  background-color: #e4ede7;
}
.shop[data-selection="conway"] {
  background-color: #ebeddf;
}
.shop[data-selection="conjectures"] {
  background-color: #eee2e8;
}
.print-conjectures {
  --stock: #f2dce0;
  --title: #562d49;
}
/* Swiper moves the slide. Hover only changes its ink and shadow, keeping the hit area still. */
@media (hover: hover) and (pointer: fine) {
  .swiper:not(.handling) .print:is(:hover,:focus-visible) {
    filter: drop-shadow(2px 5px 5px #422a3459);
  }
  .favorites {
    transition: transform 0.25s;
    transform-origin: 50% 4px;
  }
  .favorites:hover,
  .favorites:focus-within {
    transform: rotate(0.1deg);
  }
}
.shelf-controls button,
.outcomes button,
.outbound,
.shelf-controls a,
.input-row button {
  transition:
    transform 0.12s,
    background-color 0.16s;
}
.shelf-controls button:active,
.shelf-controls a:active,
.outbound:active,
.input-row button:active,
.outcomes button:active {
  transform: translateY(2px);
}
.index ul {
  width: min(300px, 92vw);
  min-width: 0;
  max-height: min(470px, calc(100dvh - 145px));
  overflow: auto;
  border-radius: 3px;
}
.index li a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 2px;
  font-size: 14px;
}
.index a img {
  width: 38px;
  height: 48px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 1px 2px #462b352a;
}
.index a span { min-width: 0; }
.index a strong { display: block; font-size: 15px; font-weight: 650; }
.index a small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.index li + li { border-top: 1px solid #bdabba55; }
.index a[aria-current="true"] {
  background: #f2e6ea;
}
.open-project[open] {
  animation: open-print 0.21s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes open-print {
  from {
    opacity: 0;
    transform: translateY(12px) rotate(-0.6deg) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-top {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.turn-prints {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  gap: 8px;
}
.turn-prints span {
  font: 12px var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.turn-prints button {
  flex-shrink: 0;
  width: 40px;
  min-height: 37px;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 18px;
  text-decoration: none;
}
.turn-prints button:hover {
  background: var(--paper);
  border-color: var(--hair);
}
.spectrum-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: crosshair;
  touch-action: pan-y;
}
.spectrum:focus-within {
  outline: 3px solid #9468a4;
  outline-offset: 2px;
}
.seek-hint {
  position: absolute;
  top: 5px;
  left: 24px;
  transform: translateX(-50%);
  background: #fff8e9;
  color: var(--ink);
  font: 11px var(--mono);
  padding: 3px 5px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
}
.spectrum:has(input:not([hidden]):focus-visible) .seek-hint,
.spectrum:hover .seek-hint:not(:empty) {
  opacity: 1;
}
.spectrum:has(input:not([hidden]))::after {
  content: "Drag to seek";
  position: absolute;
  bottom: 4px;
  right: 6px;
  padding: 1px 5px;
  background: #352a35ca;
  color: white;
  font: 11px/1.5 var(--mono);
  pointer-events: none;
}
.predictor h3,
.war h3 {
  font: 650 18px/1.2 var(--headline);
  margin: 0 0 6px;
}
.predictor p,
.war p {
  font-size: 14px;
}
.counter-track {
  --state: 1;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 12px 0 10px;
  border: 1px solid #9c819962;
  background: #fffaf2;
  border-radius: 4px;
  overflow: hidden;
}
.counter-track::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 25%;
  background: #dfc6b0;
  z-index: -1;
  transform: translateX(calc(var(--state) * 100%));
  transition: transform 0.2s;
}
.counter-track span {
  text-align: center;
  padding: 5px;
  font: 14px var(--mono);
}
.outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.outcomes button,
.war button {
  padding: 7px 14px;
  border: 1px solid #ac929e;
  background: #fffbf6;
  border-radius: 4px;
  font-weight: 600;
}
.outcomes button:hover,
.war button:hover {
  background: #f0dfe7;
}
@media (prefers-reduced-motion: reduce) {
  .favorites:hover,
  .favorites:focus-within {
    transform: none;
  }
  .open-project[open] {
    animation: none;
  }
}

.war-hands {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.war-hands span {
  display: grid;
  gap: 3px;
  align-items: center;
  min-width: 55px;
  border: 1px solid #baa3af;
  border-radius: 5px;
  padding: 3px 8px 6px;
  background: var(--paper);
  color: #79475a;
  font: 11px var(--mono);
  box-shadow: 1px 2px 0 #cdb9bb;
}
.war-hands span:nth-child(2) {
  color: #496749;
}
.war-hands span:nth-child(3) {
  color: #4d5985;
}
.war-hands b {
  font: 650 24px var(--headline);
  text-align: center;
}
.war-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.proof-links {
  margin-top: 12px;
  font-size: 13px;
  color: var(--berry);
}
.catalogue {
  padding-top: clamp(32px, 4.7vw, 67px);
}
.catalogue-head,
.catalogue-tail {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.catalogue h2 {
  font: 650 clamp(26px, 2.55vw, 38px)/1.1 var(--headline);
  letter-spacing: -0.047em;
}
.catalogue-search input {
  max-width: 100%;
  width: 210px;
  padding: 8px 14px;
  border: 1px solid var(--hair);
  border-radius: 4px;
  color: var(--ink);
  background: #fffcf8;
  font-size: 14px;
}
.catalogue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 20px;
}
.catalogue-filters button {
  padding: 8px 13px 7px;
  border: 1px solid #cbbac2;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: #f4ede8;
  font: 580 14px var(--headline);
  transition: background-color 0.16s;
}
.catalogue-filters button:hover {
  background: #f3dfe5;
}
.catalogue-filters button[aria-pressed="true"] {
  background: #6e4563;
  color: #fffaf6;
  border-color: #6e4563;
}
.catalogue-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  list-style: none;
  padding: 0;
  column-gap: 4%;
  border-top: 2px solid #8c6c83;
}
/* Keep the paired engineering stories in reading order without an empty half-row. */
.catalogue-list:has(.firmware-note[open], .incident-note[open]) > li:has(.firmware-note, .incident-note) {
  grid-column: 1 / -1;
}
.catalogue-list li {
  border-bottom: 1px solid #dacbd2;
}
.catalogue-list a {
  display: block;
  padding: 12px 4px;
  text-decoration: none;
}
.catalogue-list strong {
  display: block;
  font: 650 18px/1.2 var(--headline);
  letter-spacing: -0.025em;
}
.catalogue-list a:hover strong,
.catalogue-list a:focus-visible strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.catalogue-list a span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}
.catalogue-tail {
  justify-content: start;
  flex-wrap: wrap;
  margin-top: 12px;
  gap: 10px 16px;
  font-size: 13px;
}
.catalogue-tail span {
  font: 11px var(--mono);
  color: var(--muted);
}
.catalogue-tail button {
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 16px;
  padding: 5px 13px;
}
.catalogue-tail a {
  margin-left: auto;
  color: var(--berry);
}
#no-projects {
  padding: 17px 0;
}
@media (max-width: 680px) {
  .catalogue-head {
    align-items: start;
    flex-direction: column;
    gap: 11px;
  }
  .catalogue-search,
  .catalogue-search input {
    width: 100%;
  }
  .catalogue-filters {
    gap: 5px;
    margin-top: 12px;
    margin-bottom: 9px;
  }
  .catalogue-filters button {
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid var(--hair);
    border-radius: 14px;
  }
  .catalogue-list {
    grid-template-columns: 1fr;
  }
  .catalogue-tail a {
    margin-left: 0;
  }
  .catalogue-list a {
    padding: 10px 1px;
  }
}

/* Small reading details belong to the same paper-and-plum world as the shelf. */
::selection {
  background: #dfc8dd;
  color: #422c41;
}
input {
  caret-color: var(--berry);
}
html {
  scrollbar-color: #a68b9f var(--paper);
}
.hand-inspector {
  margin-top: 16px;
  border-top: 1px solid #d8c8cc;
  padding-top: 10px;
}
.hand-inspector summary {
  font-weight: 600;
  font-size: 14px;
}
.hand-inspector p,
.experiment-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.hand-inspector dl {
  margin: 12px 0 0;
}
.hand-inspector dt {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}
.hand-inspector dd {
  margin: 3px 0 0;
  font: 12px/1.7 var(--mono);
  overflow-wrap: anywhere;
}
#factor-form small {
  margin-top: 12px;
  color: var(--muted);
}
#clear-projects {
  display: block;
  margin-top: 10px;
  padding: 7px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 4px;
}
#clear-projects:hover {
  background: #f0dfe7;
}
.modal-top {
  position: sticky;
  top: 0;
  z-index: 4;
}
.catalogue-search input {
  font-size: 16px;
}
@media (prefers-reduced-motion: reduce) {
  .counter-track::before {
    transition: none;
  }
}
@media (max-width: 380px) {
  .mast-inner {
    flex-wrap: wrap;
    gap: 0;
    padding-block: 10px;
  }
  .mast .byline {
    white-space: nowrap;
  }
  .mast nav {
    width: 100%;
    justify-content: space-between;
    gap: 16px;
  }
  .mast nav a {
    padding: 8px 0 2px;
    white-space: nowrap;
  }
}

/* A small notebook chart: actual hand sizes, not an illustrative curve. */
.war-cycle { margin-top: 22px; border-top: 1px solid var(--hair); padding-top: 16px; }
.war-cycle figcaption { font: 650 18px var(--headline); }
.war-cycle p { font-size: 13px; }
.war-cycle svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart-grid path { fill: none; stroke: #bdabba80; stroke-width: 1; }
.chart-grid text { fill: var(--muted); font: 11px var(--mono); }
#war-lines polyline:nth-child(1) { stroke: #7d3251; }
#war-lines polyline:nth-child(2) { stroke: #416858; stroke-dasharray: 6 3; }
#war-lines polyline:nth-child(3) { stroke: #60538d; stroke-dasharray: 2 3; }
#war-cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.war-legend { display: flex; justify-content: space-between; font: 11px var(--mono); margin: 0 4% 12px 6%; }
.war-legend span:nth-child(1) { color: #7d3251; }
.war-legend span:nth-child(2) { color: #416858; }
.war-legend span:nth-child(3) { color: #60538d; }
.war-cycle label { display: block; font-size: 13px; }
.war-cycle label output { display: inline; font: inherit; }
#war-turn { display: block; width: 100%; margin: 8px 0 0; accent-color: var(--berry); min-height: 28px; cursor: pointer; }

.rook-presets { margin-top: 12px; }
.rook-board { grid-template-columns: repeat(3, 48px); gap: 3px; }
.rook-board button { height: 48px; }
#rook-caption + small { margin-top: 10px; color: var(--muted); }

.war-legend span { display: inline-flex; align-items: center; gap: 5px; }
.war-legend span::before { content: ""; width: 20px; border-top: 2px solid currentColor; }
.war-legend span:nth-child(2)::before { border-top-style: dashed; }
.war-legend span:nth-child(3)::before { border-top-style: dotted; }
@media (max-width: 680px) {
  .chart-grid text { font-size: 24px; }
}

.spectrum-label, .spectrum-time { display: flex; justify-content: space-between; color: var(--muted); font: 11px var(--mono); }
.spectrum-label { margin-bottom: 7px; }
.spectrum-time { margin-top: 5px; }
.listening-note { margin-top: 12px; font-size: 14px; }
.audio-cues { margin: 10px 0 7px; }
.audio-cues[hidden] { display: none; }

.factor-working { margin-top: 14px; border-top: 1px solid var(--hair); padding-top: 10px; }
.factor-working summary { font-size: 13px; }
#factor-steps { list-style: none; padding: 0; margin: 9px 0 0; }
#factor-steps li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid #bdabba55; font: 13px var(--mono); }
#factor-steps span:nth-child(2) { color: var(--muted); }
#factor-steps strong { text-align: right; font: inherit; color: var(--berry); }
#factor-ending { font-size: 13px; margin-top: 9px; }
#factor-form .input-row input { flex: 1; min-width: 0; max-width: 120px; }
#factor-form .input-row button { flex-shrink: 0; white-space: nowrap; }

/* A register drawn like a small worksheet, with the live bits picked out. */
.binary-working { margin-top: 16px; border-top: 1px solid var(--hair); padding-top: 10px; }
.binary-working summary { cursor: pointer; font-size: 13px; }
.binary-working p { font-size: 12px; margin: 10px 0; }
#binary-register { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.binary-cell { border: 1px solid #d8c8cc; text-align: center; padding: 4px 0; background: var(--paper); }
.binary-cell small { font: 10px var(--mono); color: var(--muted); }
.binary-cell strong { display: block; font: 17px var(--mono); }
.binary-cell.is-one { background: #e2ecdf; border-color: #8aa48a; }
.binary-cell.instruction-type { border-style: dashed; }
#binary-sum { font-family: var(--mono); overflow-wrap: anywhere; }

/* A failed enhancement download must leave useful native reading, not dead controls. */
.script-unavailable .shelf-controls,
.script-unavailable #factor-form,
.script-unavailable .war,
.script-unavailable #cpu .predictor,
.script-unavailable #conway .toy { display: none; }

/* On phones the print becomes a reading sheet, not a narrow inset window. */
@media screen and (max-width: 680px) {
  .open-project {
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overscroll-behavior: contain;
  }
  .open-project[open] { animation: none; }
  .open-project .modal-top {
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }
  .open-project .modal-top button { min-height: 44px; }
  .open-project .turn-prints button { width: 44px; }
  .open-project #detail-slot > .detail {
    padding: 24px max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
}

/* Save the open project as a readable note, not a clipped overlay on the shelf. */
@media print {
  body.modal-open { overflow: visible; background: white; }
  body.modal-open > :not(.open-project) { display: none !important; }
  .open-project[open] {
    position: static;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: white;
  }
  .open-project::backdrop { background: none; }
  .open-project .modal-top,
  .open-project .detail-art,
  .open-project audio,
  .open-project .audio-cues,
  .open-project input[type="range"] { display: none !important; }
  .open-project #detail-slot {
    display: block;
    opacity: 1 !important;
    transform: none !important;
  }
  .open-project #detail-slot > .detail { padding: 16px; }
  .open-project .detail-heading { break-after: avoid; }
  .open-project .toy,
  .open-project .player {
    break-inside: avoid;
    print-color-adjust: exact;
  }
  .open-project .outbound {
    color: var(--ink);
    background: none;
    border: 0;
    padding: 0;
    text-decoration: underline;
  }
  .open-project .detail::after {
    content: "Cinna Davis · 1337isnot1337.github.io";
    display: block;
    margin-top: 24px;
    border-top: 1px solid var(--hair);
    padding-top: 8px;
    font: 11px var(--mono);
  }
}

/* State the actual research endpoint separately from the small trial-division toy. */
.research-bound{margin:24px 0 28px;padding:18px 20px;border:1px solid var(--hair);background:#f2eaf0;min-width:0}
.research-bound math{font-size:clamp(20px,3vw,28px);margin:0 0 16px}
.research-bound figcaption{font-size:12px;line-height:1.6;color:var(--muted)}
.research-bound figcaption a{display:inline-block;margin-left:8px}
@media(max-width:380px){.research-bound{padding-inline:12px}.research-bound figcaption a{display:block;margin-left:0;margin-top:4px}}
@media print{.research-bound{background:transparent;break-inside:avoid}}

.detail-heading .project-repo,.modal-top .project-repo {
  display:inline-flex; align-items:center; justify-content:center; gap:.85em; min-height:48px;
  padding:10px 20px; border-radius:5px; background:#56364e; color:#fff8ed;
  font:650 17px/1.25 var(--headline); text-decoration:none;
}
.detail-heading .project-repo { margin-top:14px; }
.project-repo:is(:hover,:focus-visible) { background:#723e5e; text-decoration:underline; text-underline-offset:3px; }
#reader-repo { display:none; }
@media screen and (max-width:680px) {
  .open-project .detail-heading .project-repo { display:none; }
  .open-project #reader-repo { display:inline-flex; flex:1 0 auto; min-height:44px; padding:8px 12px; font-size:16px; }
  .open-project .modal-top { flex-wrap:wrap; gap:5px 8px; justify-content:space-between; }
}
@media screen and (max-width:475px) {
  .open-project #reader-repo { order:3; flex-basis:100%; }
}
