/* Rusty Stars follows the Best of Go look: 70s/80s Swiss design with warm
   earth tones. Cream paper, white cards, charcoal ink, terracotta numbers,
   2px borders, no rounded corners, monospace for every number. */

/* Berkeley Mono, licensed for rustystars.dev. Every number on the site
   uses it. */
@font-face { font-family: "Berkeley Mono"; src: url("/static/a8f3d2.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/static/b7e4c1.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/static/c6d5a2.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Berkeley Mono"; src: url("/static/d5c6b3.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

/* The palette as RGB triplets, so a rule can add an alpha. */
:root {
  color-scheme: light;
  --paper: 249 246 240;
  --card: 255 255 255;
  --ink: 45 45 45;
  --terracotta: 193 81 13;
  --gray-100: 243 244 246;
  --gray-200: 229 231 235;
  --gray-300: 209 213 219;
  --gray-500: 107 114 128;
  --gray-600: 75 85 99;
  --gray-700: 55 65 81;
  --gray-800: 31 41 55;
  --mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Dark: warm near-black paper, off-white ink, the gray ramp reversed. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: 27 25 23;
  --card: 38 35 32;
  --ink: 237 230 218;
  --terracotta: 224 112 58;
  --gray-100: 48 43 38;
  --gray-200: 58 52 46;
  --gray-300: 74 67 60;
  --gray-500: 142 133 122;
  --gray-600: 173 163 150;
  --gray-700: 200 191 177;
  --gray-800: 221 213 200;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: rgb(var(--paper));
  color: rgb(var(--ink));
  font: 16px/1.5 var(--sans);
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
img { display: block; }

.container {
  max-width: 896px;
  margin: 0 auto;
  padding: 0 12px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 48px;
}

/* Header */

.site-header {
  background: rgb(var(--paper));
  border-bottom: 2px solid rgb(var(--ink));
}

.header-inner { display: flex; align-items: center; justify-content: space-between; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  text-decoration: none;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-size: 26px;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
  box-shadow: 3px 3px 0 0 rgb(var(--ink));
}

.brand-text { display: none; line-height: 1.25; }
.brand-name { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.brand-tagline { display: block; font-size: 14px; color: rgb(var(--gray-700)); }

.site-nav { display: flex; align-items: center; gap: 4px; font-weight: 600; }

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  color: rgb(var(--gray-700));
  text-decoration: none;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-link:hover, .nav-link.is-active { color: rgb(var(--ink)); }
.nav-icon { width: 20px; height: 20px; }
.nav-word, .nav-kbd, .nav-wide { display: none; }
.mono { font-family: var(--mono); }

.nav-kbd {
  font: 11px var(--mono);
  padding: 2px 8px;
  border: 1px solid rgb(var(--ink));
  color: rgb(var(--gray-700));
}

.theme-cycle svg { width: 16px; height: 16px; }
.theme-cycle [data-mode] { display: none; }
:root[data-theme-mode="light"] .theme-cycle [data-mode="light"],
:root[data-theme-mode="auto"] .theme-cycle [data-mode="auto"],
:root[data-theme-mode="dark"] .theme-cycle [data-mode="dark"] { display: inline-flex; }

/* Cards and labels */

.card {
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.label-sm {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mono-strong { font: 700 14px var(--mono); color: rgb(var(--gray-700)); }
.accent { color: rgb(var(--terracotta)); }
.muted { color: rgb(var(--gray-600)); }

.page-title { font-size: clamp(30px, 5vw, 36px); font-weight: 700; margin-bottom: 24px; }
.section { display: flex; flex-direction: column; gap: 16px; }
.section-title { font-size: clamp(24px, 4vw, 30px); font-weight: 700; }
.section-subtitle { font-size: clamp(20px, 3.5vw, 24px); font-weight: 600; }

/* Home */

.stat-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.stat-card { padding: 24px; }
.stat-card .label { margin-bottom: 12px; }

.stat-number {
  font: 900 clamp(36px, 7vw, 48px)/1.1 var(--mono);
  letter-spacing: -0.05em;
  color: rgb(var(--terracotta));
}

.stat-note { margin-top: 8px; font-size: 14px; color: rgb(var(--gray-700)); }

.range-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.range-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.range-button:hover { background: rgb(var(--gray-100)); }
.range-button .dot { width: 8px; height: 8px; background: rgb(var(--gray-300)); }
.range-button.is-active { background: rgb(var(--ink)); color: rgb(var(--paper)); cursor: default; }
.range-button.is-active .dot { background: rgb(var(--terracotta)); }

.card-stack { display: flex; flex-direction: column; gap: 12px; }

/* Repository cards */

.repo-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.repo-card-main { display: flex; flex: 1; gap: 12px; align-items: flex-start; min-width: 0; }

.avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  background: rgb(var(--gray-300));
  border: 2px solid rgb(var(--ink));
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.repo-card-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }

.repo-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
}

.repo-card-title a { text-decoration: none; overflow-wrap: anywhere; }
.repo-card-title a:hover { text-decoration: underline; }
.slash { color: rgb(var(--gray-500)); font-weight: 400; }

.repo-card-description {
  font-size: 14px;
  line-height: 1.6;
  color: rgb(var(--gray-700));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.repo-card-created {
  font: 11px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(var(--gray-600));
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.indented { padding-top: 4px; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  font: 600 11px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgb(var(--paper));
  border: 1px solid rgb(var(--ink));
}

.repo-card-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 16px;
  border-top: 2px solid rgb(var(--ink));
  text-align: right;
}

.repo-card-total { display: flex; align-items: center; gap: 8px; }
.repo-card-total .label-sm { font-weight: 400; color: rgb(var(--gray-700)); }

/* The gained-stars badge: peach number on a faint dotted pattern. */
.star-badge {
  padding: 4px 8px;
  font: 800 20px/1 var(--mono);
  color: #e8a86f;
  border: 1px solid currentColor;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><rect width="16" height="16" fill="rgba(232, 168, 111, 0.05)"/><circle cx="2" cy="3" r="0.6" fill="rgba(232, 168, 111, 0.25)"/><circle cx="6" cy="1" r="0.5" fill="rgba(232, 168, 111, 0.2)"/><circle cx="10" cy="4" r="0.5" fill="rgba(232, 168, 111, 0.22)"/><circle cx="14" cy="2" r="0.6" fill="rgba(232, 168, 111, 0.18)"/><circle cx="4" cy="7" r="0.5" fill="rgba(232, 168, 111, 0.23)"/><circle cx="8" cy="6" r="0.5" fill="rgba(232, 168, 111, 0.19)"/><circle cx="12" cy="8" r="0.6" fill="rgba(232, 168, 111, 0.24)"/><circle cx="3" cy="11" r="0.5" fill="rgba(232, 168, 111, 0.21)"/><circle cx="9" cy="12" r="0.5" fill="rgba(232, 168, 111, 0.2)"/><circle cx="13" cy="13" r="0.5" fill="rgba(232, 168, 111, 0.23)"/><circle cx="5" cy="15" r="0.5" fill="rgba(232, 168, 111, 0.19)"/><circle cx="11" cy="14" r="0.6" fill="rgba(232, 168, 111, 0.22)"/></svg>');
  background-size: 16px 16px;
}

.empty-card { padding: 32px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.empty-big { font: 900 48px/1 var(--mono); color: rgb(var(--terracotta)); margin-bottom: 8px; }
.empty-title { font-weight: 500; color: rgb(var(--gray-700)); }
.empty-note { font-size: 14px; color: rgb(var(--gray-600)); margin-bottom: 8px; }

/* Search */

.search-card { padding: 24px; }

.search-input {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  color: inherit;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
  border-radius: 0;
}

.search-input::placeholder { color: rgb(var(--gray-500)); }
.search-input:focus { outline: none; box-shadow: 0 0 0 2px rgb(var(--terracotta)); }
.search-note { margin-top: 12px; font-size: 14px; color: rgb(var(--gray-600)); }
.search-results { min-height: 400px; margin-top: -8px; }

/* Repo and owner identity card: identity on top, cream stat strips below. */

.identity-top { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.identity-title-row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.identity-top > .identity-title-row, .identity-top.identity-title-row { display: flex; }
.identity-name { display: flex; align-items: center; gap: 16px; min-width: 0; flex-wrap: wrap; }

.identity-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: clamp(24px, 4.5vw, 30px);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.identity-heading a { text-decoration: none; }
.identity-heading a:hover { text-decoration: underline; }
.identity-links { display: flex; gap: 8px; flex-shrink: 0; }
.identity-description { line-height: 1.6; color: rgb(var(--gray-700)); overflow-wrap: anywhere; }

.small-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: rgb(var(--ink));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.small-button:hover { background: rgb(var(--gray-100)); }
.small-button.is-dark, .small-button.is-active { background: rgb(var(--ink)); color: rgb(var(--paper)); }
.small-button.is-active { cursor: default; }
.icon-external { width: 14px; height: 14px; }

.strip { display: grid; background: rgb(var(--paper)); border-top: 2px solid rgb(var(--ink)); }
.strip-2 { grid-template-columns: 1fr 1fr; }
.strip-3 { grid-template-columns: 1fr 1fr 1fr; }
.strip-cell { padding: 16px; min-width: 0; }
.strip-cell + .strip-cell { border-left: 2px solid rgb(var(--ink)); }
.align-right { text-align: right; }
.strip-big { font: 900 clamp(26px, 5vw, 36px)/1.2 var(--mono); white-space: nowrap; }
.strip-medium { font: 900 clamp(18px, 3.5vw, 24px)/1.2 var(--mono); }

/* Star trends */

.trends { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.trends-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.trends-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bucket-links { display: flex; flex-wrap: wrap; gap: 8px; }

.range-chip {
  padding: 4px 10px;
  font: 600 12px var(--mono);
  background: rgb(var(--gray-200));
}

.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: rgb(var(--terracotta)); }
.chart .grid { stroke: rgb(var(--gray-200)); stroke-width: 1; }
.chart .axis { fill: rgb(var(--gray-700)); font: 11px var(--mono); }

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  font-size: 14px;
  color: rgb(var(--gray-700));
  border: 2px solid rgb(var(--ink));
}

/* About */

.prose { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.prose h2:not(:first-child) { margin-top: 12px; }
.prose p, .prose li { color: rgb(var(--gray-700)); line-height: 1.6; }
.prose ul { margin: 0; padding-left: 20px; }
.prose a { color: rgb(var(--terracotta)); }

/* Motion. Anything that navigates lifts toward the reader with a hard
   shadow. Anything that acts in place presses into the page. */

.lift, .lift-sm, .press { transition: transform 90ms ease-out, box-shadow 90ms ease-out; }

@media (hover: hover) {
  .lift:hover { transform: translate(-3px, -3px); box-shadow: 3px 3px 0 rgb(var(--ink)); }
  .lift-sm:hover { transform: translate(-2px, -2px); box-shadow: 2px 2px 0 rgb(var(--ink)); }
  .press:hover { transform: translate(2px, 2px); }
  /* The avatar is a window in the card: the frame moves, the picture stays. */
  .lift:hover .avatar-pinned { transform: translate(3px, 3px); }
}

.avatar-pinned { transition: transform 90ms ease-out; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in 0.3s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .lift, .lift-sm, .press, .avatar-pinned, .fade-in { transition: none; animation: none; }
  .lift:hover, .lift-sm:hover, .press:hover, .lift:hover .avatar-pinned { transform: none; }
}

/* Wider screens */

@media (min-width: 640px) {
  .brand-text { display: block; }
  .nav-icon { display: none; }
  .nav-word, .nav-kbd { display: inline; }
  .nav-wide { display: flex; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  .container { padding: 0 32px; }
  .page { gap: 40px; padding-top: 40px; }
  .brand { gap: 16px; padding: 16px 0; }
  .site-nav { gap: 16px; font-size: 16px; }
  .stat-grid { gap: 24px; }
  .stat-card { padding: 28px; }
  .range-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .range-button { font-size: 16px; }
  .card-stack { gap: 16px; }
  .repo-card { flex-direction: row; align-items: flex-start; gap: 24px; padding: 20px; }
  .repo-card-main { gap: 16px; }
  .repo-card-title { font-size: 18px; }
  .repo-card-description { font-size: 15px; }
  .repo-card-stats { flex-direction: column; align-items: flex-end; gap: 12px; padding-top: 0; border-top: 0; }
  .identity-top { padding: 24px; }
  .identity-description, .chips.indented { padding-left: 64px; }
  .strip-cell { padding: 20px; }
}
/* Styles for the home page, the loading spinner, and the repo cards. */

.home-stats { margin-bottom: 8px; }

.home-trending { margin-bottom: 48px; }

.home-trending-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.home-ranges { margin-bottom: 16px; }

/* The spinner htmx shows while a list loads. htmx adds htmx-request to the
   element named by hx-indicator for as long as the request runs. */
.loading-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgb(var(--gray-700));
}

.loading-indicator.htmx-request { display: flex; }
.spinner { width: 16px; height: 16px; animation: spin 1s linear infinite; }
.spinner-track { opacity: 0.25; }
.spinner-head { opacity: 0.75; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-emoji { font-size: 30px; line-height: 1.2; margin-bottom: 12px; }

/* Repo cards: an avatar frame takes the card color behind the picture, and
   topics with a page link to it. */
.avatar-frame { display: block; background: rgb(var(--card)); }
.chips.indented-top { padding-top: 4px; }

.chip-link {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  color: rgb(var(--ink));
}

.chip-link:hover { background: rgb(var(--ink)); color: rgb(var(--paper)); }

/* The prank card at the end of the trending list. It looks like the next
   card loading, then tilts, blurs, and says there is no more. */
.prank-card {
  position: relative;
  overflow: hidden;
  min-height: 130px;
  padding: 16px;
  transition: all 200ms;
}

.prank-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  opacity: 0.9;
}

.prank-body.is-blurred { filter: blur(2px); }
.prank-main { display: flex; flex: 1; gap: 12px; align-items: flex-start; min-width: 0; }

.prank-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: 2px solid rgb(var(--ink));
}

.prank-lines { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.prank-line-group { display: flex; flex-direction: column; gap: 8px; }
.prank-line-title { height: 12px; width: 128px; }
.prank-line-long { height: 8px; width: 80%; }
.prank-line-short { height: 8px; width: 66%; }

.prank-stats {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 2px solid rgb(var(--ink));
}

.prank-stats-inner {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: right;
}

.prank-stat { display: flex; align-items: center; gap: 8px; }
.prank-stat .label-sm { color: rgb(var(--ink)); }
.prank-stat-total { display: inline-block; height: 12px; width: 40px; }
.prank-stat-gained { display: inline-block; height: 12px; width: 32px; }

.tilt-card {
  transform: rotate(-1.5deg) translateY(2px);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.prank-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgb(var(--card) / 0.94);
  border: 2px solid rgb(var(--ink));
}

.prank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font: 600 11px var(--mono);
  color: rgb(var(--ink));
  background: rgb(var(--paper));
  border: 2px solid rgb(var(--ink));
}

.prank-message { font: 700 16px var(--mono); color: rgb(var(--ink)); }

.prank-rain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 20;
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgb(var(--gray-200)) 25%, rgb(var(--gray-100)) 37%, rgb(var(--gray-200)) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes codeDrop {
  0% {
    transform: translateY(-16px) translateX(0px) rotate(-6deg) scale(0.95);
    opacity: 0;
    letter-spacing: -0.05em;
  }
  12% { opacity: 1; letter-spacing: 0; }
  55% {
    transform: translateY(calc(var(--stopY, 60px) - var(--bounce, 6px)))
      translateX(calc(var(--slide, 0px))) rotate(2deg) scale(1);
    opacity: 1;
  }
  72% {
    transform: translateY(calc(var(--stopY, 60px) + calc(var(--bounce, 6px) * 0.4)))
      translateX(calc(var(--slide, 0px))) rotate(var(--rot, -1deg)) scale(1);
    opacity: 1;
  }
  85% {
    transform: translateY(calc(var(--stopY, 60px) - calc(var(--bounce, 6px) * 0.1)))
      translateX(calc(var(--slide, 0px))) rotate(var(--rot, -2deg)) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(var(--stopY, 60px)) translateX(calc(var(--slide, 0px)))
      rotate(var(--rot, -2deg)) scale(1);
    opacity: 1;
    letter-spacing: 0;
  }
}

.falling-code { position: absolute; inset: 0; z-index: 30; }

.falling-code span {
  position: absolute;
  top: -18px;
  left: var(--left, 10%);
  animation: codeDrop var(--dur, 1.2s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  animation-delay: var(--delay, 0s);
  animation-fill-mode: forwards;
  z-index: var(--z, 1);
  font: 500 11px var(--mono);
  color: rgb(var(--terracotta));
  text-shadow: 0 2px 8px rgb(var(--terracotta) / 0.25);
  letter-spacing: 0.02em;
}

/* The sponsor slots under the trending list. */
.sponsor-section { padding: 40px 0; }
.sponsor-row { display: flex; justify-content: center; gap: 16px; }

.sponsor-card {
  width: 176px;
  padding: 24px;
  text-align: center;
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px dashed rgb(var(--ink));
}

.sponsor-card:hover { background: rgb(var(--gray-100)); }
.sponsor-title { font-size: 12px; font-weight: 600; color: rgb(var(--ink)); }
.sponsor-note { margin-top: 8px; font-size: 12px; color: rgb(var(--gray-700)); }

@media (prefers-reduced-motion: reduce) {
  .spinner, .skeleton, .falling-code span { animation: none; }
  .falling-code span { opacity: 1; transform: translateY(var(--stopY, 60px)); }
}

@media (min-width: 768px) {
  .home-trending-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .prank-card { padding: 20px; }
  .prank-body { flex-direction: row; gap: 24px; }
  .prank-main { gap: 16px; }
  .prank-stats { width: auto; justify-content: flex-end; gap: 24px; padding-top: 0; border-top: 0; }
  .prank-stats-inner { flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; }
  .prank-stat { gap: 10px; }
  .sponsor-row { gap: 20px; }
}
/* Styles for the repo pages. */

/* The line under the description: the archived tag and the last push. */
.repo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font: 12px var(--mono);
  color: rgb(var(--gray-600));
}

.archived-tag {
  display: inline-block;
  padding: 2px 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgb(var(--ink));
  color: rgb(var(--paper));
}

/* Recent gains. On a phone a third of the width is about 100 px, so the
   label drops "Last", the letters sit closer, and the number is smaller. */
.gain-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  padding: 12px;
}

.gain-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  white-space: nowrap;
}

.gain-last { display: none; }
.gain-value { font: 900 16px/1.25 var(--mono); }

/* Star trends chart. */
.bucket-link { text-transform: capitalize; }
.chart-box { position: relative; min-height: 320px; }

.chart-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 320px;
}

.chart-canvas canvas { width: 100%; height: 100%; }
.chart-box .chart-empty { min-height: 320px; background: rgb(var(--card)); }
.chart-box .chart-empty[hidden] { display: none; }

.chart-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font: 12px var(--mono);
}

.chart-nav[hidden] { display: none; }

.chart-nav-button {
  padding: 6px 12px;
  font: inherit;
  color: rgb(var(--ink));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
  cursor: pointer;
}

.chart-nav-button:hover { background: rgb(var(--gray-100)); }
.chart-nav-button:disabled { opacity: 0.5; cursor: default; }

.chart-noscript { font-size: 14px; color: rgb(var(--gray-700)); }

.trend-table {
  width: 100%;
  border-collapse: collapse;
  font: 14px var(--mono);
}

.trend-table caption {
  padding-bottom: 8px;
  text-align: left;
  font: 600 12px var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.trend-table th { text-align: left; text-transform: capitalize; }
.trend-table .num { text-align: right; }

/* README badge. */
.badge-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.badge-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.badge-note { font-size: 14px; color: rgb(var(--gray-700)); }
.badge-row { display: flex; align-items: stretch; gap: 8px; }
.badge-row .small-button { flex-shrink: 0; cursor: pointer; font-family: inherit; }

.badge-code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 12px;
  font: 12px var(--mono);
  background: rgb(var(--paper));
  border: 2px solid rgb(var(--ink));
}

/* The 404 page for a repo the site does not track. */
.untracked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 32px 0;
  text-align: center;
}

.untracked-mascot { position: relative; width: 160px; height: 160px; }

.untracked-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  font-size: 96px;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
  box-shadow: 8px 8px 0 0 rgb(var(--ink));
}

.untracked-mark {
  position: absolute;
  top: -12px;
  right: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  background: rgb(var(--terracotta));
  border: 2px solid rgb(var(--ink));
}

.untracked-text { display: flex; flex-direction: column; gap: 12px; }
.untracked-status { font: 900 48px/1 var(--mono); letter-spacing: -0.05em; color: rgb(var(--terracotta)); }
.untracked-title { font-size: 30px; font-weight: 700; }
.untracked-note { font-size: 16px; line-height: 1.6; color: rgb(var(--gray-700)); }
.untracked-repo, .untracked-reason { color: rgb(var(--ink)); overflow-wrap: anywhere; }
.untracked-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }

.untracked-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  color: rgb(var(--ink));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.untracked-button:hover { background: rgb(var(--gray-100)); }
.untracked-button.is-dark { background: rgb(var(--ink)); color: rgb(var(--paper)); }
.untracked-button.is-dark:hover { background: rgb(var(--ink) / 0.9); }

@media (min-width: 640px) {
  .gain-cell { padding: 16px; }
  .gain-label { font-size: 12px; letter-spacing: 0.1em; }
  .gain-last { display: inline; }
  .gain-value { font-size: 20px; }
}

@media (min-width: 768px) {
  .repo-meta { padding-left: 64px; }
  .gain-cell { padding: 20px; }
  .gain-value { font-size: 24px; }
  .untracked { padding: 48px 0; }
  .untracked-status { font-size: 64px; }
  .untracked-title { font-size: 36px; }
  .untracked-note { font-size: 18px; }
}
/* Styles for the COUNT(*) page. */

.count-header { display: flex; flex-direction: column; gap: 8px; }
.count-title { font-size: clamp(30px, 5vw, 36px); font-weight: 700; }
.muted-700 { color: rgb(var(--gray-700)); }

.count-section { margin-bottom: 48px; }

.count-loading-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

/* Without a loading spinner the row takes no space. */
.count-loading-row:not(:has(.htmx-request)) { margin-bottom: 0; }

.year-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.year-button {
  padding: 6px 12px;
  font: 600 14px var(--mono);
  text-decoration: none;
  color: rgb(var(--ink));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.year-button:hover { background: rgb(var(--gray-100)); }
.year-button.is-active { background: rgb(var(--ink)); color: rgb(var(--paper)); cursor: default; }

.count-list { display: flex; flex-direction: column; gap: 16px; }

.count-summary { font-size: 14px; color: rgb(var(--gray-700)); }
.count-strong { font-weight: 600; color: rgb(var(--ink)); }
.card-stack.count-cards { gap: 12px; }

.count-empty { padding: 24px; text-align: center; color: rgb(var(--gray-700)); }
/* Styles for the topic index and the topic pages. */

.topics-title { font-size: clamp(30px, 5vw, 36px); font-weight: 700; }
.topics-intro { margin-top: 8px; max-width: 672px; color: rgb(var(--gray-700)); }

.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.topic-tile:hover { background: rgb(var(--gray-100)); }

.topic-tile-name {
  font: 600 14px var(--mono);
  color: rgb(var(--ink));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-tile-count { flex-shrink: 0; font: 12px var(--mono); color: rgb(var(--gray-600)); }

/* One topic */

.topic-top { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.topic-crumbs { color: rgb(var(--gray-700)); }
.topic-crumbs a { text-decoration: none; }
.topic-crumbs a:hover { text-decoration: underline; }
.topic-heading { font-size: clamp(24px, 4vw, 30px); font-weight: 700; line-height: 1.25; }
.identity-description.topic-description { padding-left: 0; }

.topic-github {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.topic-github:hover { color: rgb(var(--ink)); }
.topic-number { font: 900 clamp(30px, 5vw, 36px)/1.25 var(--mono); }
.topic-strip .label-sm { color: rgb(var(--ink)); }

.topic-section { display: flex; flex-direction: column; gap: 16px; }
.topic-note { margin-top: 4px; font-size: 14px; color: rgb(var(--gray-600)); }
.card-stack.topic-cards { gap: 12px; }

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

.related-topic {
  padding: 6px 12px;
  font: 600 14px var(--mono);
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.related-topic:hover { background: rgb(var(--gray-100)); }
.related-topic-count { font-weight: 400; color: rgb(var(--gray-600)); }

.all-topics { align-self: flex-start; font-size: 14px; font-weight: 600; text-decoration: none; }
.all-topics:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .topic-grid { grid-template-columns: repeat(3, 1fr); }
  .topic-top { padding: 24px; }
}
/* Styles for the fun page. Each section carries its heading on the page
   ground; the panels below hold nothing but the rows. */

.fun { display: flex; flex-direction: column; gap: 40px; padding-top: 8px; }

.fun-title { font-size: 30px; line-height: 36px; font-weight: 700; }
.fun-intro { margin-top: 8px; color: rgb(var(--gray-700)); }

/* The random repo button sits on a hard shadow and presses into the page. */
.fun-spin {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 16px;
  font: 600 14px/20px var(--mono);
  text-decoration: none;
  color: rgb(var(--ink));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
  box-shadow: 5px 5px 0 rgb(var(--ink));
}

@media (hover: hover) {
  .fun-spin:hover { background: rgb(var(--gray-100)); box-shadow: 3px 3px 0 rgb(var(--ink)); }
}

.fun-head { margin-bottom: 14px; }
.fun-heading { font-size: 20px; line-height: 28px; font-weight: 800; letter-spacing: -0.025em; }
.fun-lede { margin-top: 4px; max-width: 672px; font-size: 14px; line-height: 20px; color: rgb(var(--gray-600)); }
.fun-date { font-weight: 600; color: rgb(var(--terracotta)); }

.fun-panel {
  margin: 0;
  padding: 0;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.fun-panel ol { margin: 0; padding: 0; }

.fun-empty {
  padding: 16px 20px;
  font-size: 14px;
  line-height: 20px;
  color: rgb(var(--gray-600));
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

/* Rows */

.fun-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  list-style: none;
  border-top: 1px solid rgb(var(--gray-200));
}

.fun-row:first-child { border-top: 0; }

.fun-row-label {
  flex: none;
  width: 48px;
  font: 13px var(--mono);
  color: rgb(var(--gray-600));
}

.fun-row-label.is-wide { display: none; width: 112px; }

.fun-avatar {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  overflow: hidden;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.fun-avatar.is-empty { background: rgb(var(--gray-300)); }
.fun-avatar img, .fun-streak-avatar img { width: 100%; height: 100%; object-fit: cover; }

.fun-row-main { flex: 1; min-width: 0; }

.fun-row-name, .fun-row-description {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fun-row-name { font-weight: 700; text-decoration: none; }
.fun-row-name:hover, .fun-strong-link:hover { text-decoration: underline; }
.fun-row-description { font-size: 13px; color: rgb(var(--gray-600)); }

.fun-count {
  flex: none;
  text-align: right;
  font: 800 20px/28px var(--mono);
  color: rgb(var(--terracotta));
}

.fun-unit {
  display: block;
  font: 600 10px/15px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--gray-600));
}

/* The streak headline */

.fun-streak-top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: rgb(var(--paper));
  border-bottom: 1px solid rgb(var(--gray-200));
}

.fun-streak-avatar {
  display: none;
  flex: none;
  width: 40px;
  height: 40px;
  overflow: hidden;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.fun-streak-text { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; color: rgb(var(--gray-700)); }
.fun-strong-link { font-weight: 700; color: rgb(var(--ink)); text-decoration: none; }

.fun-streak-count {
  flex: none;
  text-align: right;
  font: 800 30px/1 var(--mono);
  color: rgb(var(--terracotta));
}

.fun-streak-count .fun-unit { margin-top: 6px; }

/* Time machine */

.fun-years { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.fun-year {
  padding: 4px 10px;
  font: 12px/16px var(--mono);
  text-decoration: none;
  color: rgb(var(--gray-600));
  background: rgb(var(--card));
  border: 1px solid rgb(var(--gray-300));
}

.fun-year:hover { color: rgb(var(--ink)); border-color: rgb(var(--ink)); }
.fun-year.is-active { color: rgb(var(--paper)); background: rgb(var(--ink)); border-color: rgb(var(--ink)); }

/* Stars by year */

.fun-pace { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 2px solid rgb(var(--ink)); }
.fun-pace-cell { padding: 16px; min-width: 0; }
.fun-pace-cell.is-right { text-align: right; border-left: 2px solid rgb(var(--ink)); }

.fun-pace-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fun-pace-number { margin-top: 4px; font: 900 24px/1.25 var(--mono); }
.fun-chart-box { padding: 16px; }
.fun-chart { position: relative; height: 288px; }

.fun-closing {
  padding-top: 20px;
  font-size: 14px;
  line-height: 20px;
  color: rgb(var(--gray-600));
  border-top: 2px solid rgb(var(--ink));
}

.fun-phone-only { display: inline; }

@media (min-width: 640px) {
  .fun-row { gap: 16px; padding: 14px 20px; }
  .fun-row-label.is-wide { display: block; }
  .fun-phone-only { display: none; }
  .fun-streak-avatar { display: block; }
  .fun-pace-cell, .fun-chart-box { padding: 20px; }
}

@media (min-width: 768px) {
  .fun { gap: 48px; }
  .fun-title { font-size: 36px; line-height: 40px; }
  .fun-heading { font-size: 24px; line-height: 32px; }
  .fun-streak-count { font-size: 36px; }
  .fun-pace-number { font-size: 30px; }
  .fun-chart { height: 320px; }
}
/* Styles for the about pages. */

.about-title { margin-bottom: 0; }
.about-lede { margin-top: 8px; font-size: 18px; color: rgb(var(--gray-700)); }

.about-thanks {
  max-width: 672px;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.625;
  color: rgb(var(--gray-800));
}

.about-thanks a { font-weight: 600; color: rgb(var(--ink)); }
.about-thanks a:hover { color: rgb(var(--terracotta)); }

.about-heading {
  margin-bottom: 14px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* Built with */

.about-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 14px 16px;
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.about-logo { width: 28px; height: 28px; flex: none; color: rgb(var(--ink)); }
.about-tile:hover .about-logo { color: rgb(var(--terracotta)); }

/* A logo-sized mark for tools without a generic logo. */
.about-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 13px/1 var(--mono);
  letter-spacing: -0.05em;
  border: 2px solid currentColor;
}

.about-tile-text { min-width: 0; }
.about-tile-name { display: block; font-weight: 700; line-height: 1.25; }

.about-tile-role {
  display: block;
  margin-top: 2px;
  font: 11px/1.375 var(--mono);
  color: rgb(var(--gray-600));
}

/* Spec sheet and maker */

.about-panels { display: grid; gap: 16px; align-items: start; }

/* The spec sheet is charcoal and cream in both themes, like a printed
   label. */
.about-specs {
  padding: 20px;
  font: 14px/1.5 var(--mono);
  color: rgb(249 246 240);
  background: rgb(45 45 45);
  border: 2px solid rgb(var(--ink));
}

.about-specs-title {
  margin-bottom: 12px;
  padding-bottom: 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid rgb(249 246 240 / 0.3);
}

.about-spec-list { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.about-spec { display: flex; align-items: baseline; gap: 8px; }

.about-spec dt {
  flex: none;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(249 246 240 / 0.7);
}

.about-spec-leader {
  flex: 1;
  border-bottom: 1px dotted rgb(249 246 240 / 0.4);
  transform: translateY(-3px);
}

.about-spec dd { margin: 0; text-align: right; }

.about-maker { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; }
.about-maker-text { line-height: 1.625; color: rgb(var(--gray-800)); }

.about-maker-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font: 600 14px var(--mono);
  text-decoration: none;
  background: rgb(var(--card));
  border: 2px solid rgb(var(--ink));
}

.about-maker-logo { width: 16px; height: 16px; }

/* FAQ */

.about-question { font-weight: 700; }
.about-question + .about-answer { margin-top: 8px; }
.about-answer + .about-question { margin-top: 20px; }

.about-answer {
  max-width: 672px;
  margin-bottom: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.625;
  color: rgb(var(--gray-800));
}

.about-answer li + li { margin-top: 4px; }

@media (min-width: 768px) {
  .about-heading { font-size: 24px; }
  .about-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .about-panels { grid-template-columns: 3fr 2fr; gap: 24px; }
  .about-specs, .about-maker { padding: 24px; }
}
/* Styles for the search pages. */

.search-field { position: relative; }
.search-field .search-input { padding-right: 48px; }
.search-input:focus-visible { box-shadow: 0 0 0 2px rgb(var(--terracotta)); }

/* htmx shows the spinner while a search runs. */
.search-loading {
  position: absolute;
  top: 50%;
  right: 16px;
  display: flex;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-spinner {
  width: 20px;
  height: 20px;
  color: rgb(var(--gray-700));
  animation: search-spin 1s linear infinite;
}

.search-spinner-track { opacity: 0.25; }
.search-spinner-head { opacity: 0.75; }

@keyframes search-spin { to { transform: rotate(1turn); } }

/* The highlighted result of the keyboard navigation. */
#search-listbox [role="option"][aria-selected="true"] {
  background-color: rgb(var(--paper));
  box-shadow: inset 0 0 0 2px rgb(var(--terracotta));
}

.search-empty { padding: 32px; }
.search-empty-icon { font-size: 30px; line-height: 1.2; margin-bottom: 8px; }
.search-empty .empty-note { margin-bottom: 0; }

@media (min-width: 768px) {
  .search-empty { padding: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .search-spinner { animation-duration: 2s; }
}
/* Styles for the status pages. */

.debug-title { margin-bottom: 8px; }
.debug-lede { color: rgb(var(--gray-700)); }
.debug-runs { display: flex; flex-direction: column; gap: 16px; }
.debug-card { padding: 24px; }
.debug-empty { text-align: center; }

.debug-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.debug-card-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.debug-started { font-size: 12px; color: rgb(var(--gray-600)); }

.debug-badge {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  border: 2px solid;
}

.debug-badge.is-completed { background: rgb(107 142 35); border-color: rgb(107 142 35); }
.debug-badge.is-failed { background: rgb(var(--terracotta)); border-color: rgb(var(--terracotta)); }

.debug-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.debug-stat-label { margin-bottom: 4px; font-size: 12px; color: rgb(var(--gray-600)); }
.debug-stat-value { font: 700 18px/1.4 var(--mono); }

.debug-error {
  margin-top: 16px;
  padding: 12px;
  background: rgb(var(--terracotta) / 0.1);
  border: 1px solid rgb(var(--terracotta));
}

.debug-error-label { margin-bottom: 4px; font-size: 12px; font-weight: 600; color: rgb(var(--terracotta)); }
.debug-error-text { font: 14px var(--mono); overflow-wrap: anywhere; }

@media (min-width: 768px) {
  .debug-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
