/* Colors and type follow interledger.org */
:root {
  --sans: "Poppins", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius: 12px;

  /* Interledger palette */
  --il-black: #000;
  --il-neutral-150: #0d0d0d;
  --il-neutral-100: #292929;
  --il-neutral-75: #595959;
  --il-neutral-50: #c9c9c9;
  --il-neutral-25: #e4e4e4;
  --il-aqua-mint: #7edfc8;
  --il-deep-teal: #057972;
  --il-ice-mint: #f3fffc;
  --il-ice-mint-100: #e5f9f4;
  --il-orchid: #80409d;
  --il-orchid-hover: #662b81;
  --il-orchid-light: #dcb4ee;
  --il-lavender: #dbaaec;
  --il-soft-indigo: #959ff9;
  --il-periwinkle: #5d5cd4;
  --il-tangerine: #ff8617;
  --il-tangerine-dark: #dd6a02;
  --il-tangerine-light: #ffd3ab;

  /* Light theme */
  --bg: #fff;
  --surface: #fff;
  --surface-2: var(--il-ice-mint);
  --border: var(--il-neutral-25);
  --text: var(--il-black);
  --muted: var(--il-neutral-75);
  --accent: var(--il-deep-teal);
  --art: var(--il-neutral-100);
  --link: var(--il-orchid);
  --primary: var(--il-orchid);
  --primary-hover: var(--il-orchid-hover);
  --primary-ink: #fff;
  --spooky: var(--il-tangerine-dark);
  --spooky-art: #9a4a00;

  --tag-payments: var(--il-deep-teal);
  --tag-finance: var(--il-orchid);
  --tag-tech: var(--il-periwinkle);
  --tag-halloween: var(--il-tangerine-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--il-black);
    --surface: var(--il-neutral-150);
    --surface-2: #141414;
    --border: var(--il-neutral-100);
    --text: #fff;
    --muted: var(--il-neutral-50);
    --accent: var(--il-aqua-mint);
    --art: var(--il-neutral-25);
    --link: var(--il-orchid-light);
    --spooky: var(--il-tangerine);
    --spooky-art: var(--il-tangerine-light);

    --tag-payments: var(--il-aqua-mint);
    --tag-finance: var(--il-lavender);
    --tag-tech: var(--il-soft-indigo);
    --tag-halloween: var(--il-tangerine);
  }
}

:root[data-theme="dark"] {
  --bg: var(--il-black);
  --surface: var(--il-neutral-150);
  --surface-2: #141414;
  --border: var(--il-neutral-100);
  --text: #fff;
  --muted: var(--il-neutral-50);
  --accent: var(--il-aqua-mint);
  --art: var(--il-neutral-25);
  --link: var(--il-orchid-light);
  --spooky: var(--il-tangerine);
  --spooky-art: var(--il-tangerine-light);

  --tag-payments: var(--il-aqua-mint);
  --tag-finance: var(--il-lavender);
  --tag-tech: var(--il-soft-indigo);
  --tag-halloween: var(--il-tangerine);
}

/* Halloween filter turns the whole page orange */
body[data-mood="spooky"] {
  --accent: var(--spooky);
  --art: var(--spooky-art);
  --primary: var(--il-tangerine-dark);
  --primary-hover: #b95800;
  --primary-ink: #fff;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s;
}

a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

pre {
  margin: 0;
  font-family: var(--mono);
  line-height: 1.2;
  white-space: pre;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .wrap { padding: 0 32px; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Hero */
.hero { padding: 48px 0 32px; }
.hero-inner {
  display: flex;
  align-items: center;
  gap: 40px;
}
.hero-art {
  flex: none;
  color: var(--accent);
  font-size: 15px;
  transition: color 0.3s;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font: 14px var(--mono);
}
h1 {
  margin: 0;
  font-size: clamp(32px, 5.5vw, 56px);
  font-weight: 600;
  line-height: 1.2;
}
h1 .highlight { color: var(--accent); transition: color 0.3s; }
.cursor {
  color: var(--accent);
  font-family: var(--mono);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.lede {
  max-width: 56ch;
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}
.lede #stats { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 640px) {
  .hero { padding-top: 28px; }
  .hero-art { display: none; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border: 1px solid var(--il-neutral-75);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 400 14px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.icon-btn {
  width: 36px; height: 36px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 400 14px/1.2 var(--sans);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--il-neutral-75); }
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.chip .count { opacity: 0.65; margin-left: 4px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  max-width: 320px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.search:focus-within { border-color: var(--accent); }
.search-prompt { color: var(--accent); font: 700 14px var(--mono); }
.search input {
  width: 100%;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 14px var(--sans);
}
.search input:focus { outline: none; }
@media (max-width: 640px) {
  .search { max-width: none; }
}

/* Grid */
main { padding-top: 28px; padding-bottom: 48px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  animation: rise 0.35s ease both;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px -18px color-mix(in srgb, var(--accent) 70%, transparent);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; transition: none; }
  .card:hover { transform: none; }
}

.art-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--surface-2);
  color: var(--art);
  overflow: hidden;
  transition: color 0.2s;
}
.card .art-box { height: 220px; }
.card:hover .art-box { color: var(--accent); }

.card-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
}
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
}
.card-artist {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  flex: none;
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--tag) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag) 12%, transparent);
  color: var(--tag);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
[data-category="payments"] { --tag: var(--tag-payments); }
[data-category="finance"] { --tag: var(--tag-finance); }
[data-category="tech"] { --tag: var(--tag-tech); }
[data-category="halloween"] { --tag: var(--tag-halloween); }

.empty {
  padding: 60px 0;
  color: var(--muted);
  text-align: center;
  white-space: pre-line;
}

/* Modal */
.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(3px);
}
.modal[open] { animation: pop 0.2s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.modal h2 { margin: 10px 0 0; font-size: 24px; font-weight: 600; line-height: 1.3; }
.modal-by { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.modal-desc { margin: 12px 0 18px; color: var(--muted); }
.modal-desc:empty { display: none; }
.modal-art {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 28px 20px;
  max-height: 60vh;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 20px;
  padding-bottom: 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* Used to measure the monospace character width */
.probe {
  position: absolute;
  visibility: hidden;
  font: 100px/1 var(--mono);
  white-space: pre;
}
