/* Skill Archive: one flat, alphabetical library set in Recursive. */

@font-face {
  font-family: "Recursive";
  src: url("assets/fonts/recursive-latin.woff2") format("woff2");
  font-weight: 300 850;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: light-dark(oklch(0.974 0.008 250), oklch(0.205 0.026 264));
  --paper-raised: light-dark(oklch(0.99 0.005 250), oklch(0.24 0.028 264));
  --ink: light-dark(oklch(0.25 0.035 264), oklch(0.93 0.012 250));
  --muted: light-dark(oklch(0.47 0.03 262), oklch(0.74 0.022 256));
  --faint: light-dark(oklch(0.87 0.015 255), oklch(0.33 0.03 264));
  --accent: light-dark(oklch(0.5 0.2 268), oklch(0.76 0.13 270));
  --accent-soft: light-dark(oklch(0.93 0.04 268), oklch(0.3 0.06 268));
  --mark: light-dark(oklch(0.92 0.11 98), oklch(0.8 0.13 85));
  --mark-ink: light-dark(oklch(0.25 0.035 264), oklch(0.22 0.035 264));

  --sans: "Recursive", ui-sans-serif, system-ui, sans-serif;
  --mono: 0;
  --casl: 0;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-4: clamp(2.6rem, 2rem + 2.6vw, 3.9rem);
  --letter: clamp(3rem, 2rem + 4.5vw, 6.25rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 21.5rem;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*,
*::before,
*::after {
  box-sizing: border-box;
  font-variation-settings: "MONO" var(--mono), "CASL" var(--casl);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-block: 6rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
}

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

mark {
  background: var(--mark);
  color: var(--mark-ink);
  border-radius: 0.15em;
  padding-inline: 0.05em;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* Page frame: a quiet sidebar beside the library on wide screens, stacked on phones. */
.page {
  max-width: 82rem;
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 3.5rem) clamp(1.1rem, 4vw, 3.5rem) 0;
}

@media (min-width: 60rem) {
  .page {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 5.5rem);
    align-items: start;
  }
  .intro {
    position: sticky;
    top: clamp(1.25rem, 4vw, 3.5rem);
  }
}

/* Intro */
.intro__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  --casl: 1;
  margin: 0;
  font-size: var(--step-4);
  font-weight: 820;
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.wordmark span { display: block; }
.wordmark span + span { color: var(--accent); }

.intro__lede {
  margin: 1.1rem 0 1.75rem;
  max-width: 30ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.45;
}

.theme-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--faint);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.theme-button:hover { color: var(--ink); border-color: var(--muted); }
.theme-button svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
}
.theme-button svg circle { fill: none; }

/* Search */
.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 2.75rem 0.7rem 2.75rem;
  border: 1.5px solid var(--faint);
  border-radius: 0.85rem;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
  font-size: var(--step-0);
  box-shadow: 0 1px 0 var(--faint);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:hover { border-color: var(--muted); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search input::-webkit-search-cancel-button { cursor: pointer; }

.search__icon {
  position: absolute;
  left: 0.95rem;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.75;
  stroke-linecap: round;
  pointer-events: none;
}

.search__kbd {
  --mono: 1;
  position: absolute;
  right: 0.8rem;
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--faint);
  border-radius: 0.35rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  pointer-events: none;
}
.search input:focus ~ .search__kbd,
.search input:not(:placeholder-shown) ~ .search__kbd { display: none; }

.search__result {
  min-height: 1.5em;
  margin: 0.6rem 0.2rem 0;
  color: var(--muted);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.updated {
  margin: 1.5rem 0.2rem 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.letters {
  --casl: 1;
  display: grid;
  grid-template-columns: repeat(7, 2.25rem);
  gap: 0.2rem;
  margin: 1.5rem 0 0 -0.35rem;
  font-size: 1.0625rem;
  font-weight: 750;
  line-height: 1;
}
.letters:empty { display: none; }
.letters__link,
.letters__empty {
  display: grid;
  place-items: center;
  height: 2.25rem;
  border-radius: 0.6rem;
}
.letters__link {
  color: var(--accent);
  text-decoration: none;
  transition: background-color 160ms var(--ease-out);
}
.letters__link:hover { background: var(--accent-soft); }
.letters__empty { color: var(--faint); }

@media (max-width: 59.99rem) {
  .letters { display: none; }
  .intro__lede { margin-bottom: 1.25rem; }
  .search {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-inline: calc(-1 * clamp(1.1rem, 4vw, 3.5rem));
    padding: 0.6rem clamp(1.1rem, 4vw, 3.5rem);
    background: var(--paper);
  }
  .search__icon { left: calc(clamp(1.1rem, 4vw, 3.5rem) + 0.95rem); }
  .search__kbd { display: none; }
  .search__result { margin-top: 0.1rem; }
  .updated { margin: 0 0.2rem 1rem; }
  .search__result:empty { display: none; }
}

/* Library: groups under a large hanging initial. */
.library { outline: none; }

.group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-block: 0.25rem 1.75rem;
}
.group + .group { border-top: 1px solid var(--faint); padding-top: 1.75rem; }

.group__letter {
  --casl: 1;
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: var(--letter);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

@media (min-width: 48rem) {
  .group {
    grid-template-columns: clamp(4.5rem, 8vw, 7.5rem) minmax(0, 1fr);
    column-gap: clamp(1rem, 3vw, 2.5rem);
  }
  .group__letter {
    position: sticky;
    top: clamp(1.25rem, 4vw, 3.5rem);
    align-self: start;
    margin: 0;
    padding-top: 0.15rem;
  }
}

.group__entries {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Entries */
.entry {
  position: relative;
  max-width: 44rem;
  padding: 0.85rem 1rem 0.95rem;
  margin-inline: -1rem;
  border-radius: 0.9rem;
  transition: background-color 600ms var(--ease-out);
}
.entry.is-target { background: var(--accent-soft); }

.entry__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  margin: 0;
  font-size: var(--step-1);
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.entry__anchor {
  text-decoration: none;
  border-radius: 0.2rem;
}
.entry__anchor:hover { text-decoration: underline; }

.entry__kind {
  --casl: 1;
  padding: 0.05rem 0.5rem 0.1rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.entry__name {
  --mono: 1;
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: var(--step--1);
  overflow-wrap: anywhere;
}

.entry__desc {
  margin: 0.4rem 0 0;
  max-width: 64ch;
  text-wrap: pretty;
}

/* Honourable mentions: a pack's installed skills, set as a quiet inline list */
.entry__mentions {
  margin: 0.7rem 0 0;
  max-width: 64ch;
  font-size: 0.9375rem;
}
.entry__mentions-label {
  --casl: 1;
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-weight: 650;
}
.entry__mentions-list {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0 0 0 0.9rem;
  list-style: none;
  border-left: 1px solid var(--faint);
}
.mention { color: var(--muted); text-wrap: pretty; }
.mention__title { color: var(--ink); font-weight: 600; }
a.mention__title { text-decoration-color: var(--faint); }
a.mention__title:hover { text-decoration-color: currentColor; }

.entry__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.entry__links a {
  color: var(--accent);
  font-weight: 600;
  text-decoration-color: color-mix(in oklch, currentColor 35%, transparent);
}
.entry__links a:hover { text-decoration-color: currentColor; }
.entry__host {
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
}

/* Loading, empty and error messages */
.library__status:empty { display: none; }
.library__status {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
  padding-block: 1rem 3rem;
  color: var(--muted);
  font-size: var(--step-1);
}
.library__status p { margin: 0; max-width: 40ch; }
.library[aria-busy="true"] .library__status p { animation: breathe 1.6s ease-in-out infinite alternate; }

.text-button {
  padding: 0.5rem 0.95rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--step-0);
  font-weight: 600;
  cursor: pointer;
}
.text-button:hover { background: var(--accent-soft); }

@keyframes breathe {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

/* Footer */
.colophon {
  max-width: 82rem;
  margin: 3rem auto 0;
  padding: 1.75rem clamp(1.1rem, 4vw, 3.5rem) 2.5rem;
  color: var(--muted);
  font-size: var(--step--1);
}
.colophon p { margin: 0 0 0.35rem; max-width: 70ch; }

@media (min-width: 60rem) {
  .colophon { padding-left: calc(clamp(1.1rem, 4vw, 3.5rem) + var(--sidebar) + clamp(2.5rem, 5vw, 5.5rem)); }
}

.noscript {
  max-width: 40rem;
  margin: 2rem auto;
  padding-inline: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

@media (forced-colors: active) {
  .entry.is-target { outline: 2px solid CanvasText; }
  .entry__kind { border: 1px solid CanvasText; }
}
