:root {
  --paper: #faf9f6;
  --sheet: #f6f6f3;
  --ink: #141313;
  --blue: #2f55a8;
  --pencil: #6a6a6a;
  --line: #bdbdbd;
  --grid: rgba(47, 85, 168, 0.09);
  --sky: #e6f0ff;
  --screen: #17233f;

  --sans: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  --hand: "Caveat", "Segoe Script", cursive;

  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

.defs { position: absolute; }

a { color: var(--blue); }

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

/* nav */

.nav {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 22px var(--gutter) 18px;
  font-family: var(--type);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.nav-name {
  font-size: 1.25rem;
  text-transform: uppercase;
}

.nav nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 0.95rem;
}

.nav-rule {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 6px;
}

.nav-rule path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.6;
}

/* hero */

.hero {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 560px);
  justify-content: center;
  align-items: center;
  gap: clamp(28px, 6vw, 90px);
  padding: clamp(40px, 8vw, 110px) var(--gutter) clamp(50px, 8vw, 110px);
}

.hi {
  margin: 0 0 18px 34px;
  min-height: 1.2em;
  font-family: var(--hand);
  font-size: clamp(3rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1;
  color: var(--blue);
}

.caret { animation: blink 1s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

.polaroid {
  position: relative;
  display: block;
  width: 100%;
  padding: 16px 16px 14px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transform: rotate(-2.2deg);
  transition: transform 0.25s ease;
}

.polaroid::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e9e9e6;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  filter: url(#rough) drop-shadow(0 6px 10px rgba(20, 19, 19, 0.16));
}

.polaroid:hover,
.polaroid[aria-pressed="true"] { transform: rotate(1.4deg); }

.polaroid-frame {
  position: relative;
  display: block;
  aspect-ratio: 690 / 908;
  overflow: hidden;
  background: #333;
}

.polaroid img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease;
}

.photo-then { opacity: 0; filter: sepia(0.25); }

.polaroid:hover .photo-then,
.polaroid[aria-pressed="true"] .photo-then { opacity: 1; }

.polaroid-caption {
  position: relative;
  display: grid;
  margin-top: 10px;
  font-family: var(--hand);
  font-size: 1.45rem;
  line-height: 1.3;
  color: #3c3c3c;
  text-align: center;
}

.polaroid-caption span {
  grid-area: 1 / 1;
  transition: opacity 0.35s ease;
}

.cap-then { opacity: 0; }

.polaroid:hover .cap-now,
.polaroid[aria-pressed="true"] .cap-now { opacity: 0; }

.polaroid:hover .cap-then,
.polaroid[aria-pressed="true"] .cap-then { opacity: 1; }

.note {
  position: relative;
  padding: clamp(26px, 4vw, 48px) clamp(22px, 4vw, 52px);
  transform: rotate(0.6deg);
}

.note::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(118deg, rgba(0, 0, 0, 0.035) 0 22%, transparent 22.4% 100%),
    linear-gradient(200deg, rgba(0, 0, 0, 0.03) 0 31%, transparent 31.4% 100%),
    linear-gradient(72deg, transparent 0 64%, rgba(0, 0, 0, 0.03) 64.4% 100%),
    #fdfdfc;
  filter: url(#rough) drop-shadow(0 8px 14px rgba(20, 19, 19, 0.1));
}

.note h1 {
  margin: 0 0 14px;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.35;
}

.note p { margin: 0 0 14px; }
.note p:last-child { margin-bottom: 0; }

.note a {
  font-weight: 500;
  text-underline-offset: 3px;
}

/* section scaffolding */

.block { padding: 0 var(--gutter) clamp(56px, 8vw, 100px); }

.label {
  margin: 0 0 40px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--blue);
  font-family: var(--type);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--blue);
}

/* cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: clamp(18px, 2.6vw, 36px);
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--sheet);
  color: inherit;
  text-decoration: none;
}

a.card:hover { border-color: var(--blue); }
a.card:hover .tag { transform: rotate(-2deg); }

.card-top {
  position: relative;
  padding: 46px 34px 34px;
  border-bottom: 1px solid var(--line);
}

.clip {
  position: absolute;
  top: 26px;
  left: 50%;
  z-index: 1;
  width: 16px;
  height: 44px;
  margin-left: -8px;
  fill: none;
  stroke: #9c9c99;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.tag {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
  transition: transform 0.2s ease;
}

.tag::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e7e7e4;
  filter: url(#rough);
}

.tag span {
  position: relative;
  font-family: var(--type);
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: #8a8a87;
}

.tag b { color: #5f5f5c; }

.tag img {
  position: relative;
  width: 72%;
  max-width: 260px;
  height: auto;
}

/* the TCS file is white-on-transparent; darken it for the light tag */
.tag img.tcs { width: 46%; filter: brightness(0); opacity: 0.85; }

.card-body { padding: 26px 34px 34px; }

.card-body p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
}

.card-body strong { color: var(--blue); }

/* demo */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  align-items: start;
  gap: clamp(24px, 5vw, 80px);
}

.runs { display: grid; gap: 14px; }

.run {
  display: grid;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  background: var(--sheet);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.run:hover { border-color: var(--blue); }

.run.is-on {
  border-color: var(--blue);
  background: var(--sky);
  box-shadow: inset 0 0 0 2px var(--blue);
}

.run-name { font-weight: 700; }

.run-sub {
  font-size: 0.92rem;
  color: #444;
}

.runs-note {
  margin: 6px 0 0;
  max-width: 52ch;
  font-size: 0.85rem;
  color: var(--pencil);
}

.device {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 400px;
  padding: 26px 22px 34px;
  border-radius: 14px 14px 74px 14px;
  background: linear-gradient(160deg, #f1f1ee, #dededb);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -3px 0 rgba(0, 0, 0, 0.08),
    0 18px 30px rgba(20, 19, 19, 0.18);
}

.device-top {
  position: absolute;
  top: 9px;
  left: 22px;
  right: 22px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.07);
}

.screen {
  height: 300px;
  overflow: hidden;
  padding: 16px 16px 12px;
  border: 6px solid #c9c9c6;
  border-radius: 8px;
  background: var(--screen);
  color: #dfe9ff;
  font-family: var(--type);
  font-size: 0.84rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.screen p {
  margin: 0 0 7px;
  display: grid;
  grid-template-columns: 8ch 1fr;
  gap: 8px;
}

.screen .k { color: #8fb0f4; }
.screen .ok .k,
.screen .ok .v { color: #ffe27a; }

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 12px 0;
}

.dpad {
  position: relative;
  width: 72px;
  height: 72px;
}

.dpad::before,
.dpad::after {
  content: "";
  position: absolute;
  border-radius: 4px;
  background: #2a2a2c;
}

.dpad::before { inset: 24px 0; }
.dpad::after { inset: 0 24px; }

.ab {
  display: flex;
  gap: 14px;
  transform: rotate(-24deg);
}

.ab button {
  position: relative;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d6d70, #2f2f31 70%);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.ab button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.ab span {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  padding-top: 8px;
  font-family: var(--type);
  font-size: 0.8rem;
  font-weight: 700;
  color: #77777a;
}

.device-hint {
  margin: 56px 0 0 12px;
  max-width: 55%;
  font-family: var(--hand);
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--blue);
}

.speaker {
  position: absolute;
  right: 36px;
  bottom: 26px;
  display: flex;
  gap: 6px;
  transform: rotate(-24deg);
}

.speaker i {
  width: 5px;
  height: 30px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ledger */

.ledger {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ledger li {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 130px;
  border: 1px solid var(--line);
  background: var(--sheet);
}

.ledger li > span { padding: 20px 26px; }

.when,
.where {
  display: grid;
  place-items: center;
  font-family: var(--type);
  font-size: 0.95rem;
  text-align: center;
}

.what {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  line-height: 1.45;
}

.what small {
  font-size: 0.9rem;
  color: #444;
}

.when { white-space: nowrap; }
.where { color: var(--blue); font-weight: 700; }

/* tools strip */

.strip {
  overflow: hidden;
  margin-bottom: clamp(56px, 8vw, 100px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.strip-track {
  display: flex;
  width: max-content;
  animation: slide 46s linear infinite;
}

.strip:hover .strip-track { animation-play-state: paused; }

.strip ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.strip li {
  padding: 26px 34px;
  font-family: var(--type);
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
  color: #8f8f8c;
}

@keyframes slide { to { transform: translateX(-50%); } }

/* footer */

.footer {
  padding: clamp(40px, 6vw, 64px) var(--gutter) 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 32px 24px;
}

.footer-cols > div {
  display: grid;
  align-content: start;
  gap: 8px;
}

.footer h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer a,
.footer span {
  color: var(--pencil);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.footer a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 4px; }

.bigname {
  display: block;
  width: 100%;
  margin-top: clamp(30px, 6vw, 70px);
}

.bigname text {
  font-family: var(--sans);
  font-size: 300px;
  font-weight: 700;
  fill: url(#hatch);
  stroke: #6f6f6c;
  stroke-width: 2;
}

/* highlighter */

mark {
  padding: 0.05em 0.25em;
  margin: 0 -0.1em;
  border-radius: 0.5em 0.2em 0.6em 0.25em;
  background: linear-gradient(100deg, rgba(255, 226, 89, 0) 0.5%, rgba(255, 226, 89, 0.85) 3%, rgba(255, 226, 89, 0.6) 96%, rgba(255, 226, 89, 0) 99.5%);
  color: inherit;
  font-weight: 700;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* gallery */

.gallery {
  columns: 4 240px;
  column-gap: clamp(18px, 2.4vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery li {
  position: relative;
  break-inside: avoid;
  margin: 0 0 clamp(18px, 2.4vw, 32px);
  padding: 10px 10px 12px;
  background: #fdfdfc;
  border: 1px solid #dcdcd9;
  box-shadow: 0 5px 12px rgba(20, 19, 19, 0.1);
  transform: rotate(-0.8deg);
}

.gallery li:nth-child(3n) { transform: rotate(1.1deg); }
.gallery li:nth-child(4n + 1) { transform: rotate(0.4deg); }

/* strip of tape */
.gallery li::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 1;
  width: 84px;
  height: 22px;
  margin-left: -42px;
  background: rgba(47, 85, 168, 0.16);
  border-left: 1px dashed rgba(47, 85, 168, 0.3);
  border-right: 1px dashed rgba(47, 85, 168, 0.3);
  transform: rotate(-2deg);
}

.shot {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #ddd;
  cursor: zoom-in;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot:hover img { filter: brightness(1.05); }

.play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(250, 249, 246, 0.92);
  box-shadow: 0 0 0 2px var(--blue);
}

.play::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 25px;
  border-style: solid;
  border-width: 12px 0 12px 19px;
  border-color: transparent transparent transparent var(--blue);
}

.cap {
  display: block;
  padding-top: 8px;
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.2;
  color: #3c3c3c;
  text-align: center;
}

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 56px 12px 16px;
  border: 0;
  background: rgba(20, 19, 19, 0.92);
  color: #fff;
}

.lightbox[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.lightbox::backdrop { background: rgba(20, 19, 19, 0.6); }

.lb-stage {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 0;
}

.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #000;
}

.lightbox button {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: none;
  color: #fff;
  font-family: var(--type);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.lightbox button:hover { background: rgba(255, 255, 255, 0.14); }
.lightbox :focus-visible { outline-color: #fff; }

.lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px 14px;
}

.lb-prev,
.lb-next {
  width: 46px;
  height: 64px;
  font-size: 1.4rem;
}

.lb-cap {
  grid-column: 1 / -1;
  min-height: 1.4em;
  margin: 0;
  font-family: var(--hand);
  font-size: 1.4rem;
  text-align: center;
}

/* small screens */

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 420px); }
  .hero-left { width: min(100%, 300px); margin: 0 auto; }
  .hi { margin-left: 10px; }
  .demo { grid-template-columns: minmax(0, 1fr); }
  .ledger li { grid-template-columns: 1fr; }
  .ledger li > span { padding: 14px 20px; }
  .when, .where { place-items: start; text-align: left; }
  .what { border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .strip li { padding: 18px 22px; font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .strip-track { animation: none; width: auto; flex-wrap: wrap; }
  .strip ul { flex-wrap: wrap; }
  .strip ul[aria-hidden] { display: none; }
  .polaroid, .polaroid img, .polaroid-caption span, .tag { transition: none; }
  .gallery li { transform: none; }
}
