@font-face {
  font-family: "Geist Mono";
  src: url("GeistMono-Regular.woff2") format("woff2");
  font-display: swap;
}

/* Colours used across the page */
:root {
  color-scheme: dark;
  --background: #050505;
  --text: #fafafa;
  --subtle: #a3a3a3;
  --muted: #787878;
  --accent: #22d3ee;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

/* Reserve the scrollbar's space on every page, so long pages don't shift sideways */
html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--background);
  color: var(--text);
  font: 1rem/1.5 "Geist Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgb(34 211 238 / 22%);
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Hidden until a keyboard user presses Tab */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  transform: translateY(-200%);
  background: var(--text);
  color: var(--background);
}

.skip-link:focus {
  transform: none;
}

/* One shape for every page: the same column, starting at the same height,
   so the name never moves when you click between pages */
main {
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 6rem 1.5rem;
}

.column {
  width: 100%;
  max-width: 36rem;
}

@media (max-width: 600px) {
  main {
    padding-block: 4rem;
  }
}

/* The homepage on a wide screen: the block of links sits in the middle of the window */
@media (min-width: 601px) {
  .home main {
    align-items: center;
    padding-block: 0;
  }

  .home .column {
    width: fit-content;
  }
}

/* Faint cyan circle behind the content */
.glow {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.03;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Name */
header {
  margin-bottom: 4rem;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.75rem;
}

header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Main links */
.links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a,
.empty {
  display: flex;
  min-height: 3rem;
  align-items: center;
  padding: 0.75rem 0;
}

.links a {
  position: relative;
  justify-content: space-between;
  color: var(--subtle);
  transition: color 200ms var(--ease);
}

.empty {
  color: var(--muted);
  user-select: none;
}

.arrow {
  color: var(--muted);
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease), color 200ms var(--ease);
}

/* Cyan underline that grows on hover */
.links a::after {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  width: 0;
  height: 1px;
  background: rgb(34 211 238 / 40%);
  content: "";
  transition: width 300ms cubic-bezier(0, 0, 0.2, 1);
}

.links a:hover,
.links a:focus-visible,
.links a:hover .arrow,
.links a:focus-visible .arrow {
  color: var(--text);
}

.links a:hover .arrow,
.links a:focus-visible .arrow {
  opacity: 1;
  transform: translateX(0.125rem);
}

.links a:hover::after,
.links a:focus-visible::after {
  width: 100%;
}

/* Small label above a group of links, e.g. "watch" */
.group {
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.group:first-of-type {
  margin-top: 0;
}

/* A group of small links on one line, e.g. the channels under "watch" */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.9375rem; /* five links fit on one line on a phone */
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.row.stack {
  flex-direction: column;
}

.row a,
.row .soon {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
}

.row a {
  color: var(--subtle);
  transition: color 200ms var(--ease);
}

.row a:hover,
.row a:focus-visible {
  color: var(--text);
  text-decoration: underline; /* the same underline as the footer sentence links */
  text-decoration-color: rgb(34 211 238 / 40%);
  text-underline-offset: 0.25rem;
}

.row .soon {
  color: var(--muted);
  user-select: none;
}

/* A project that is planned but not built yet: same row as a link, not clickable */
.planned {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  color: var(--subtle);
}

.planned .date {
  flex-shrink: 0;
}

/* Second, quieter line under a project name */
.sub {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Date shown next to a post title */
.date {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Post number, e.g. #001 */
.num {
  margin-right: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* The writing and projects lists: date pinned to the right */

.writing-list .links a {
  gap: 1rem;
}

.writing-list .date {
  flex-shrink: 0;
}

/* A single post */

.post h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 400;
}

.post article {
  margin-top: 2rem;
  color: var(--subtle);
  line-height: 1.75;
}

.post .num {
  display: block;
  margin-bottom: 0.25rem;
}

/* Code blocks scroll sideways on small screens instead of wrapping */
.post pre {
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid rgb(250 250 250 / 5%);
  border-radius: 4px;
  background: rgb(250 250 250 / 3%);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.6;
}

.post code {
  font-family: inherit;
}

/* Section headings and diagrams inside a post */
.post article h3 {
  margin: 2.5rem 0 0.5rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
}

.post figure {
  margin: 1.5rem 0;
}

.post figure img,
.post figure video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgb(250 250 250 / 5%);
  border-radius: 4px;
}

/* Animation clips: capped height so they sit with the text instead of taking over */
.post figure video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 16rem;
  margin: 0 auto;
}

.post figure:has(video) figcaption {
  text-align: center;
}

.post figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.post article a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgb(34 211 238 / 40%);
  text-underline-offset: 0.25rem;
}

/* Published date and reading time under a post's title */
.post .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 3rem;
  margin: 1rem 0 0;
}

.post .meta dt {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.post .meta dd {
  margin: 0.25rem 0 0;
  color: var(--subtle);
  font-size: 0.875rem;
}

.post .meta dd::before {
  margin-right: 0.5rem;
  color: var(--muted);
  content: "└";
}

/* Reading time is filled in by reading.js, so hide its row until it is */
.post .meta div:has(dd:empty) {
  display: none;
}

/* The reading bar: sticks to the top of the screen while you read a post.
   reading.js builds it and puts it under the name. */
.post.has-bar header {
  margin-bottom: 1.5rem;
}

.reading-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  min-height: 3rem;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* Its background reaches both edges of the screen, frosted over the page behind */
.reading-bar::before {
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  border-bottom: 1px solid rgb(250 250 250 / 8%);
  background: rgb(5 5 5 / 85%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  content: "";
}

.reading-bar .back,
.reading-bar summary {
  display: inline-flex;
  min-height: 2.75rem; /* big enough to tap */
  flex-shrink: 0;
  align-items: center;
  color: var(--subtle);
  cursor: pointer;
  transition: color 200ms var(--ease);
}

/* The ◂ and ▾ carry the same soft cyan as the link underlines */
.reading-bar .back span,
.reading-bar summary::after {
  color: rgb(34 211 238 / 40%);
}

.reading-bar .back span {
  margin-right: 0.5rem;
}

.reading-bar .back:hover,
.reading-bar summary:hover,
.reading-bar .parts[open] summary {
  color: var(--text);
}

/* The post's title, cut short with "…", once the real one has scrolled away */
.reading-bar .title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.25rem);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.reading-bar.show-title .title {
  opacity: 1;
  transform: none;
}

/* "part 2/7 ▾", which opens a list of the parts to jump to */
.reading-bar .parts {
  position: relative;
}

.reading-bar summary {
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.reading-bar summary::-webkit-details-marker {
  display: none;
}

.reading-bar summary::after {
  margin-left: 0.5rem;
  content: "▾";
  display: inline-block;
  transition: transform 200ms var(--ease);
}

.reading-bar .parts[open] summary::after {
  transform: rotate(180deg);
}

.reading-bar summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.reading-bar ol {
  position: absolute;
  top: 100%;
  right: 0;
  width: min(20rem, calc(100vw - 3rem));
  max-height: 60vh;
  margin: 0.25rem 0 0;
  padding: 0.5rem 0;
  overflow-y: auto;
  border: 1px solid rgb(250 250 250 / 8%);
  border-radius: 4px;
  background: #0c0c0c;
  box-shadow: 0 20px 60px rgb(0 0 0 / 60%);
  list-style: none;
  counter-reset: part;
  animation: fade-in-up 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.reading-bar ol a {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--subtle);
  font-size: 0.8125rem;
  letter-spacing: 0;
  line-height: 1.4;
  transition: color 200ms var(--ease);
}

.reading-bar ol a::before {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  content: counter(part, decimal-leading-zero);
  counter-increment: part;
}

.reading-bar ol a:hover,
.reading-bar ol a:focus-visible {
  color: var(--text);
}

.reading-bar ol a[aria-current] {
  color: var(--text);
}

.reading-bar ol a[aria-current]::before {
  color: rgb(34 211 238 / 40%);
}

.reading-bar ol a:focus-visible {
  outline-offset: -2px;
}

/* The line along the bottom that fills as you read, edge to edge */
.reading-bar .progress {
  position: absolute;
  bottom: -1px;
  left: calc(50% - 50vw);
  width: 100vw;
  height: 2px;
  pointer-events: none;
}

.reading-bar .progress span {
  display: block;
  height: 100%;
  background: rgb(34 211 238 / 40%); /* the same cyan as the link underlines */
  transform: scaleX(0);
  transform-origin: left;
}

/* A part you jump to lands just under the bar instead of behind it */
.post h2,
.post article h3 {
  scroll-margin-top: 4.5rem;
}

html:has(.reading-bar) {
  scroll-behavior: smooth;
}

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

/* Social links */
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(250 250 250 / 5%);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  line-height: 1.25rem;
}

footer a {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: var(--muted);
  transition: color 200ms var(--ease);
}

footer a:hover {
  color: var(--text);
}

/* A sentence in a footer, e.g. "every post is also on x and substack" */
footer span {
  color: var(--muted);
}

/* Links inside that sentence: underlined like links in a post */
footer span a {
  display: inline;
  text-decoration: underline;
  text-decoration-color: rgb(34 211 238 / 40%);
  text-underline-offset: 0.25rem;
}

/* Fade-in when the page loads, staggered top to bottom */
.enter {
  animation: fade-in-up 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.links li:nth-child(1) { animation-delay: 50ms; }
.links li:nth-child(2) { animation-delay: 100ms; }
.links li:nth-child(3) { animation-delay: 150ms; }
.links li:nth-child(4) { animation-delay: 200ms; }
.links li:nth-child(5) { animation-delay: 250ms; }
.links li:nth-child(6) { animation-delay: 300ms; }
.links li:nth-child(7) { animation-delay: 350ms; }
.links li:nth-child(n+8) { animation-delay: 400ms; }
footer.enter { animation-delay: 400ms; }

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* LeetCode 30 tracker page */
.tracker .numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 2rem 0 0.5rem;
}

.tracker .numbers div {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  border-top: 1px solid rgb(250 250 250 / 10%);
}

.tracker .big {
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1.2;
}

.tracker .label {
  color: var(--muted);
  font-size: 0.75rem;
}

.tracker .aside {
  color: var(--muted);
  font-size: 0.875rem;
}

.tracker .grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.375rem;
  margin-top: 0.75rem;
}

.tracker .sq {
  display: flex;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(250 250 250 / 12%);
  border-radius: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.tracker .sq.on {
  background: rgb(34 211 238 / 25%);
  border-color: rgb(34 211 238 / 50%);
  color: var(--text);
}

.tracker .sq.today {
  border-color: var(--accent);
  color: var(--text);
}

.tracker .sq.future {
  opacity: 0.4;
}

.tracker .day,
.tracker .card {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(250 250 250 / 5%);
}

.tracker .day .num,
.tracker .card .num {
  display: inline;
  margin-right: 0.75rem;
}

.tracker .day dl {
  margin: 0.75rem 0 0;
}

.tracker .day dt {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tracker .day dd {
  margin: 0.125rem 0 0;
}

.tracker .numbers-line {
  margin: 0.5rem 0 0;
  color: var(--text);
  font-size: 0.875rem;
}

.tracker .rules {
  padding-left: 1.25rem;
}

.tracker .rules li {
  margin-bottom: 0.5rem;
}

@media (max-width: 420px) {
  .tracker .numbers { grid-template-columns: repeat(2, 1fr); }
  .tracker .grid { grid-template-columns: repeat(6, 1fr); }
}

/* CV page: definition lists for work and projects */
.cv article ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.cv article li {
  margin-bottom: 0.5rem;
}

.cv dl {
  margin: 0.5rem 0 0;
}

.cv dt {
  margin-top: 1.25rem;
  color: var(--text);
}

.cv dt .date {
  margin-left: 0.5rem;
}

.cv dd {
  margin: 0.25rem 0 0;
}

.cv .aside {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Imogen page: countdown and hearts, with the accent turned rose */
/* Her page is the one light page on the site: pastel pink, her favourite */
.love {
  color-scheme: light;
  --background: #ffdbe4;
  --text: #3a1f2b;
  --subtle: #6b3b4b;
  --muted: #875b69;  /* deep enough to read at 12px on the pink */
  --accent: #f4557e; /* a shade deeper than the hearts need, so the ▶ and ♥ show */
  --line: rgb(58 31 43 / 14%);
}

.love ::selection {
  background: rgb(255 111 145 / 30%);
}

.love .glow {
  opacity: 0.12;
}

.love .countdown div,
.love footer {
  border-top-color: var(--line);
}

.love .gate input {
  border-bottom-color: var(--line);
}

.love .lightbox {
  background: rgb(255 219 228 / 85%);
}

.love .lightbox img,
.love .lightbox video {
  box-shadow: 0 20px 60px rgb(58 31 43 / 25%);
}

/* This page scrolls, so give it room at the top and bottom and tighten the gaps */
.love .column {
  padding-block: 3rem;
}

.love header {
  margin-bottom: 0; /* the sections below bring their own air */
}

.love footer {
  margin-top: 2.5rem;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.countdown div {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  border-top: 1px solid rgb(250 250 250 / 10%);
}

.countdown .big {
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.countdown .label {
  color: var(--muted);
  font-size: 0.75rem;
}

.love .aside {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.arrived .countdown {
  display: none;
}

/* Sections: the same gap above each one, a small label if it needs one, then the content */
.love .section {
  margin-top: 2.5rem;
}

.love .section[hidden] {
  display: none;
}

.love .section > .label {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Moments: pages of three tiles side by side across the whole screen, snapping as she swipes */
.love .strip {
  display: flex;
  gap: 0.75rem;
  margin: 0 calc(50% - 50vw);
  padding: 0 max(1.5rem, calc(50vw - 10rem)); /* the column's left edge */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: max(1.5rem, calc(50vw - 10rem));
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
}

.love .strip::-webkit-scrollbar {
  display: none;
}

/* One page: a tall tile on the left, two stacked on the right; flipped on every other page */
.love .page {
  --page: min(84vw, 19rem);
  --tile: calc((var(--page) - 0.5rem) * 2 / 5 * 4 / 3); /* a small tile's height, 3:4 */
  display: grid;
  flex: 0 0 var(--page);
  grid-template-columns: 3fr 2fr;
  grid-template-rows: var(--tile) var(--tile);
  gap: 0.5rem;
  scroll-snap-align: start;
}

.love .page figure {
  margin: 0;
  min-height: 0;
}

.love .page figure:first-child {
  grid-row: 1 / 3;
}

.love .page.flip figure:first-child {
  grid-column: 2;
}

.love .page.flip figure:not(:first-child) {
  grid-column: 1;
}

.love .page img,
.love .page video {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.love .page figure:first-child img,
.love .page figure:first-child video {
  aspect-ratio: auto;
}

/* Songs that remind me of her: one line that drives Spotify's player */
.love .songs .song {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
  margin: 0;
  border-top: 1px solid var(--line);
}

.love .songs .note {
  width: 1.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.75rem; /* a little triangle, not a big one */
  cursor: pointer;
}

.love .songs .playing .note {
  font-size: 1rem;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.love .songs a {
  color: var(--subtle);
  font-size: 0.875rem; /* the same size as the other lines under the clock */
  transition: color 200ms var(--ease);
}

.love .songs a:hover,
.love .songs .playing a {
  color: var(--text);
}

/* Spotify's own player: out of sight unless the page cannot start it */
.love .songs .player {
  position: absolute;
  left: -200vw;
  width: 20rem;
  height: 152px;
  opacity: 0;
  pointer-events: none;
}

.love .songs .player iframe {
  display: block;
  border-radius: 12px;
}

.show-player .songs .player {
  position: static;
  width: auto;
  margin-top: 0.5rem;
  opacity: 0.85;
  pointer-events: auto;
}

/* Big view of one photo or the clip */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgb(5 5 5 / 80%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  touch-action: pan-y;
  animation: fade-in 200ms var(--ease) both;
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  -webkit-user-drag: none;
  user-select: none;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 60%);
  animation: fade-in-up 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
  cursor: default;
}

.lightbox[hidden],
.hi[hidden] {
  display: none;
}

.looking {
  overflow: hidden;
}

@keyframes fade-in {
  from { opacity: 0; }
}

/* The footer heart she can tap */
.love footer .tap {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}

.love footer .tap:active {
  transform: scale(1.4);
}

.love footer .tap span {
  color: var(--muted);
}

/* "hi imogen", once, after the passcode */
.hi {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  color: var(--accent);
  font-size: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms var(--ease);
}

.hi.show {
  opacity: 1;
}

.love .photos img,
.love .photos video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid rgb(250 250 250 / 6%);
  border-radius: 4px;
  background: rgb(250 250 250 / 3%);
}

.love footer {
  justify-content: space-between;
}

.love footer .muted {
  color: var(--muted);
  opacity: 0.6;
}

/* Passcode gate in front of the Imogen page */
.gate label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gate input {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 0;
  border: 0;
  border-bottom: 1px solid rgb(250 250 250 / 15%);
  border-radius: 0;
  background: none;
  color: var(--text);
  font: inherit;
  letter-spacing: 0.2em;
  outline: none;
}

.gate input:focus {
  border-bottom-color: var(--accent);
}

.gate button {
  margin-top: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--subtle);
  font: inherit;
  cursor: pointer;
  transition: color 200ms var(--ease);
}

.gate button::after {
  content: " →";
  color: var(--muted);
}

.gate button:hover,
.gate button:focus-visible {
  color: var(--text);
}

.gate .note {
  min-height: 1.5rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Hearts float up from below the screen, sway a little, and fade out near the top */
.hearts {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.heart {
  position: absolute;
  bottom: -40px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  fill: var(--accent);
  opacity: 0;
  animation: float var(--duration) linear var(--delay) infinite;
  will-change: transform, opacity;
}

@keyframes float {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.8); }
  10%  { opacity: var(--alpha); }
  50%  { transform: translate(var(--sway), -55vh) scale(1); }
  90%  { opacity: var(--alpha); }
  100% { opacity: 0; transform: translate(calc(var(--sway) * -0.5), -115vh) scale(0.9); }
}

/* Hearts that burst out from a tap */
.heart.pop {
  bottom: auto;
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  opacity: 0.7;
  animation: pop var(--duration) cubic-bezier(0, 0.6, 0.4, 1) forwards;
}

@keyframes pop {
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); }
}

/* No motion: hold a few still hearts instead of hiding them completely */
@media (prefers-reduced-motion: reduce) {
  .heart {
    opacity: var(--alpha);
    bottom: auto;
    top: calc(var(--x) * 0.9);
  }
  .heart.pop {
    display: none;
  }
}


/* Ham's guide to C programming (guide/c/): a post, plus the shape of a book.
   Chapters are numbered, code is numbered, and every page has prev | contents | next. */

/* The title block on the contents page */
.guide .book {
  margin-bottom: 2.5rem;
}

.guide .book h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.guide .book p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.guide .book .version {
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

/* prev | contents | next, above and below a chapter */
.guide .pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 2.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgb(250 250 250 / 5%);
  border-bottom: 1px solid rgb(250 250 250 / 5%);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.guide .pager.bottom {
  margin: 3rem 0 0;
}

.guide .pager a {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  color: var(--subtle);
  transition: color 200ms var(--ease);
}

.guide .pager a:hover,
.guide .pager a:focus-visible {
  color: var(--text);
}

/* The ◂ and ▸ carry the same soft cyan as the link underlines */
.guide .pager a span {
  color: rgb(34 211 238 / 40%);
}

.guide .pager a[rel="prev"] span { margin-right: 0.5rem; }
.guide .pager a[rel="next"] span { margin-left: 0.5rem; }

.guide .pager .none {
  visibility: hidden;
}

/* Section numbers, e.g. 2.3 */
.guide .n {
  margin-right: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.guide article h4 {
  margin: 2rem 0 0.5rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 400;
}

.guide article ul,
.guide article ol {
  padding-left: 1.25rem;
}

.guide article li {
  margin-bottom: 0.5rem;
}

.guide article li::marker {
  color: var(--muted);
}

.guide article strong {
  color: var(--text);
  font-weight: 400;
}

/* Inline code: a word of C in a sentence */
.guide article p code,
.guide article li code,
.guide article td code {
  padding: 0.05em 0.3em;
  border-radius: 3px;
  background: rgb(250 250 250 / 6%);
  color: var(--text);
  font-size: 0.9375em;
}

/* A listing: the file's name on top, numbered lines below. Each line is a span. */
.guide .listing {
  position: relative;
  padding-top: 2.25rem;
  counter-reset: line;
}

.guide .listing::before {
  position: absolute;
  top: 0.6rem;
  left: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  content: attr(data-file);
}

.guide .listing a.src {
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.guide .listing a.src:hover,
.guide .listing a.src:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgb(34 211 238 / 40%);
  text-underline-offset: 0.25rem;
}

.guide .listing .l {
  display: block;
  min-height: 1.6em;
}

.guide .listing .l::before {
  display: inline-block;
  width: 2rem;
  margin-right: 1rem;
  color: var(--muted);
  text-align: right;
  user-select: none;
  content: counter(line);
  counter-increment: line;
}

/* Comments in a listing sit back from the code */
.guide .listing .c {
  color: var(--muted);
}

/* The terminal: what to type (after the $) and what came back */
.guide .shell .l::before {
  color: rgb(34 211 238 / 40%);
  content: "$";
}

.guide .shell .out::before {
  content: "";
}

.guide .shell .out {
  color: var(--subtle);
}

/* Two kinds of box: "try" (something to build) and "trip" (something that goes wrong) */
.guide .box {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border-left: 2px solid rgb(34 211 238 / 40%);
}

.guide .box.trip {
  border-left-color: rgb(250 250 250 / 15%);
}

.guide .box .label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.guide .box p,
.guide .box ul,
.guide .box ol {
  margin: 0.5rem 0 0;
}

.guide .box p:first-of-type {
  margin-top: 0;
}

/* Tables: the C versions, the format letters */
.guide table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.guide th {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid rgb(250 250 250 / 15%);
  color: var(--muted);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-align: left;
}

.guide td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid rgb(250 250 250 / 5%);
  vertical-align: top;
}

/* The contents: chapters as rows, sections underneath */
.guide .toc {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide .toc > li {
  padding: 0.5rem 0;
  border-top: 1px solid rgb(250 250 250 / 5%);
}

.guide .toc > li > a,
.guide .toc > li > .soon {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--subtle);
  transition: color 200ms var(--ease);
}

.guide .toc > li > a:hover,
.guide .toc > li > a:focus-visible {
  color: var(--text);
}

.guide .toc > li > .soon {
  color: var(--muted);
}

.guide .toc .date,
.guide .toc .soon .date {
  flex-shrink: 0;
}

.guide .toc ol {
  margin: 0 0 0.5rem;
  padding-left: 2.75rem;
  list-style: none;
  color: var(--muted);
  font-size: 0.875rem;
}

.guide .toc ol li {
  margin: 0;
  line-height: 1.75;
}

.guide .toc ol a {
  color: var(--muted);
}

.guide .toc ol a:hover,
.guide .toc ol a:focus-visible {
  color: var(--text);
}

/* Footer of every guide page: the version, and where the book comes from */
.guide footer {
  justify-content: space-between;
}

.guide footer .version {
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

/* A chapter heading you jump to lands clear of the top */
.guide article h3,
.guide article h4 {
  scroll-margin-top: 1.5rem;
}
