/* --------------------------------------------------------------------------
   ai-slop's stylesheet.

   The palette, the fonts, the mono-caps micro-labels, the 6px radius and the
   120ms transitions are calebstew.art's, so the two sites read as siblings.
   The layout is not: that site is two pages of prose, this one is a catalog of
   skills and the long documents they ship.

   House rules, if you edit this:
     - colours only ever come from the tokens below;
     - one content width, `--content-max`, on every page — a width that changes
       between page types reads as breakage, not as design;
     - no shadows and no sticky positioning: depth comes from a border and a
       background, movement is a 120ms colour transition, and that is all;
     - dark mode is `prefers-color-scheme` only. There is no toggle.
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Palette. Light values live on :root so a colour always has a definition
   outside of any media query; the dark block only swaps the tokens.
   -------------------------------------------------------------------------- */
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --border: #e3e1dc;
  --text: #201f1c;
  --muted: #6b6862;
  --accent: #9a5b2e;

  /* One step under --surface, for things that should read as inset rather than
     raised: the search field, filter chips, count badges. */
  --sunken: #f2f0eb;

  /* A wash of the accent for hover and selected states. Derived rather than
     given its own hex so it tracks --accent through both schemes. */
  --accent-wash: color-mix(in srgb, var(--accent) 12%, transparent);

  --font-sans:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", sans-serif;
  --font-mono:
    ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* One width for everything on the page: prose, tables, code blocks, cards.
     Nothing is capped narrower than this.
     
     An earlier version held prose at 42rem inside a 56rem container, which made
     paragraphs visibly slimmer than the tables and code blocks beside them and
     read as a formatting accident rather than as a decision. 46rem is the
     compromise: about 90 characters per line, which is at the wide end of
     comfortable but not beyond it, while still fitting a three-column table
     without scrolling. */
  --content-max: 46rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --surface: #1d1c22;
    --border: #302e37;
    --text: #e8e6e1;
    --muted: #9b968e;
    --accent: #d9a066;
    --sunken: #24232a;
  }
}

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

body {
  margin: 0;
  padding: clamp(2.5rem, 7vh, 4.5rem) 1.5rem clamp(3rem, 8vh, 5rem);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ==========================================================================
   Shared idioms
   ========================================================================== */

/* The mono-caps micro-label. Used for every structural label on the site —
   facts keys, section headings above lists, breadcrumbs. Borrowed wholesale
   from calebstew.art, where it is the whole visual signature. */
.label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

h2.section-label {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

code {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Masthead (catalog only) and breadcrumb (everywhere else)
   ========================================================================== */

.masthead h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.masthead .tagline {
  margin: 0.6rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.005em;
  text-wrap: balance;
}

/* There is no persistent navigation anywhere on this site, by design — a skill
   page is a document, not an application. This is the only way back up, so it
   is on every page that is not the catalog. */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 120ms ease,
    border-color 120ms ease;
}

.crumbs a:hover,
.crumbs a:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.crumbs .sep {
  color: var(--border);
}

/* ==========================================================================
   Catalog
   ========================================================================== */

.intro {
  margin-top: 2.5rem;
}

.intro p {
  margin: 0 0 1.1rem;
}

.intro p:last-child {
  margin-bottom: 0;
}

.intro a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.catalog {
  margin-top: 3.25rem;
}

/* ----------------------------------------------------------------- Filters */
/* Hidden until site.js reveals it. A search box that cannot search is worse
   than no search box, so the control does not exist until it works. */
.filters {
  margin-bottom: 1.25rem;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  width: 100%;
  padding: 0.6rem 4.5rem 0.6rem 0.85rem;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* The keyboard hint sits inside the field rather than in the placeholder, so it
   survives typing. */
.search-field kbd {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  padding: 0.05rem 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  pointer-events: none;
}

/* One flat row. Every chip is the same shape — `facet: value` plus a count — so
   there is nothing to divide or head, and a third facet would just join the
   row. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.85rem 0 0;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  /* Mono for the whole chip: `trigger: auto` is a query fragment, not prose,
     and the fixed pitch is what makes a row of eleven of them read as a set
     rather than as clutter. */
  font-family: var(--font-mono);
  font-size: 0.72rem;
  user-select: none;
  white-space: nowrap;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

/* The facet name is the quiet half — it repeats down the row, so it recedes and
   lets the values be what you scan. */
.chip-key {
  color: var(--muted);
}

.chip-key::after {
  content: ":";
}

.chip-value {
  font-weight: 500;
}

.chip input {
  /* The chip itself is the affordance; the native box would fight it. State is
     carried by colour and by :checked below, and the input stays focusable. */
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip:has(input:checked) {
  background: var(--accent-wash);
  border-color: var(--accent);
}

.chip:has(input:checked) .chip-value {
  color: var(--accent);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip .count {
  color: var(--muted);
  font-size: 0.66rem;
}

.result-count {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------- Cards */
.card-grid {
  display: grid;
  /* 13rem so three cards still fit across a 46rem container
     (3 × 13 + 2 × 1rem of gap = 41rem); they stretch to fill via 1fr. */
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  /* Column so the facts block can be pushed to the bottom with margin-top:
     auto — that is what keeps the bottom edges aligned across a row when the
     taglines are different lengths. */
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.05rem 1.1rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.card:hover,
.card:focus-visible {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.card-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.card-tagline {
  flex: 1 1 auto;
  margin: 0.6rem 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.card-facts {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.card-facts .row {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.card-facts .row + .row {
  margin-top: 0.2rem;
}

.card-facts .requires {
  text-align: right;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 1.5rem 0 0;
  color: var(--muted);
}

.empty-state button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Document pages — a skill, a bundled file, the install guide
   ========================================================================== */

.doc-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

/* A skill's title is the slash command you type, so it is set in mono. A
   bundled document's title is prose, so it is not. */
.doc-title.is-command {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3.5vw, 1.7rem);
}

.lede {
  margin: 0.7rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
  text-wrap: balance;
}

.source-note {
  margin: 0.7rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.source-note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.source-note a:hover,
.source-note a:focus-visible {
  color: var(--accent);
}

/* ------------------------------------------------------------------- Facts */
.facts {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.3rem 1.25rem;
  margin: 2.25rem 0 0;
  padding: 1.15rem 0 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding-top: 0.3rem;
}

.facts dd {
  margin: 0;
}

.facts dd code {
  font-size: 0.85em;
}

.facts .tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

/* ------------------------------------------------------------ Install block */
.install {
  margin-top: 2.5rem;
}

.snippet {
  position: relative;
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
}

.snippet code {
  font-family: var(--font-mono);
}

/* Injected by site.js, never authored, so there is never a copy button that
   cannot copy. */
.copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.15rem 0.5rem;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.copy:hover,
.copy:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.copy.is-done {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent);
}

/* Room for the button so a long command cannot run underneath it. */
.snippet:has(.copy) code {
  padding-right: 3.5rem;
}

.aside {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.aside a {
  color: var(--accent);
}

/* ------------------------------------------------------- Inline contents */
.contents {
  margin: 2.5rem 0 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.contents ul {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  columns: 2 15rem;
}

.contents li {
  break-inside: avoid;
}

.contents ul ul {
  columns: 1;
  margin-left: 0.9rem;
}

.contents a {
  display: block;
  padding: 0.08rem 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contents a:hover,
.contents a:focus-visible {
  color: var(--accent);
}

/* ==========================================================================
   Prose — a rendered README, SKILL.md, or reference file
   ========================================================================== */

.prose {
  margin-top: 2.75rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
  scroll-margin-top: 1rem;
}

.prose h2 {
  margin: 2.75rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.25rem;
}

.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.02rem;
}

.prose h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.92rem;
  color: var(--muted);
}

/* Zola wraps heading text in an anchor (insert_anchor_links = "heading"), so
   the heading has to be told not to look like a link. */
.prose .zola-anchor {
  color: inherit;
  text-decoration: none;
}

.prose .zola-anchor:hover,
.prose .zola-anchor:focus-visible {
  color: var(--accent);
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 120ms ease;
}

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

.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.prose img {
  max-width: 100%;
  height: auto;
}

/* The `:not(pre) >` guard keeps this off highlighted code blocks, whose tokens
   are also <code> descendants. */
.prose :not(pre) > code {
  font-size: 0.85em;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.32em;
}

/* Colours come from the two Giallo stylesheets Zola generates; everything
   structural is here. The background is overridden because the themes ship
   their own, and this site has a --surface token that raised elements sit on.
   `pre.giallo` outranks the theme's `.z-code` on specificity, so no
   !important is needed. */
.prose pre,
pre.giallo {
  margin: 1.4rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  tab-size: 4;
}

pre.giallo {
  background-color: var(--surface);
}

/* -------------------------------------------------------------- Tables */
/* Load-bearing, not decorative: frontmatter.md alone is 38 rows, and the
   env-var and flag tables are how two of the three skills document their
   surface.

   Deliberately NOT wrapped in a scrolling container. Zola renders tables from
   markdown, so there is nowhere to put a wrapper without post-processing the
   HTML, and the alternative — `display: block` on the table itself — drops the
   implicit table role in WebKit and Blink, which costs a screen-reader user the
   row/column relationships. At 56rem every table in this repo is two or three
   columns and wraps fine, so the wrapper buys nothing. See the narrow-viewport
   block near the bottom for the one place that trade flips. */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.prose td {
  overflow-wrap: anywhere;
}

.prose th {
  padding: 0.35rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
}

.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose th:first-child,
.prose td:first-child {
  padding-left: 0;
}

.prose th:last-child,
.prose td:last-child {
  padding-right: 0;
}

/* Keeps an identifier in a leading column from breaking mid-token while the
   prose column beside it still wraps. */
.prose td:first-child code {
  white-space: nowrap;
}

/* ==========================================================================
   What it ships / siblings / prev-next
   ========================================================================== */

.ships {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li + li {
  border-top: 1px solid var(--border);
}

.file-list a,
.file-list .static-row {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) 1fr;
  gap: 0.15rem 1.25rem;
  padding: 0.7rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.file-list a:hover,
.file-list a:focus-visible {
  background: var(--accent-wash);
  color: var(--accent);
}

.file-list .fname {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.file-list .fdesc {
  color: var(--muted);
  font-size: 0.875rem;
}

.file-list a:hover .fdesc,
.file-list a:focus-visible .fdesc {
  color: var(--text);
}

/* The eight prompt templates collapse into one row rather than eight: the
   skill that owns them would otherwise have a bundled-file list longer than
   its README. */
.file-list .fnames {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.pager a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 120ms ease,
    border-color 120ms ease;
}

.pager a:hover,
.pager a:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.pager .next {
  margin-left: auto;
  text-align: right;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 120ms ease,
    border-color 120ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 34rem) {
  .facts {
    display: block;
  }

  .facts dt {
    padding-top: 0.8rem;
  }

  .file-list a,
  .file-list .static-row {
    display: block;
  }

  .file-list .fnames {
    margin-top: 0.2rem;
  }

  .card-facts .row {
    display: block;
  }

  .card-facts .requires {
    text-align: left;
  }

  .search-field kbd {
    display: none;
  }

  /* The one place the table trade-off flips. A three-column table at 320px is
     unreadable, and an unreadable table serves nobody — so below this width it
     becomes a scroll container, accepting the loss of table semantics that
     `display: block` causes in WebKit and Blink. Above this width the table
     stays a table. */
  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .prose td {
    white-space: normal;
    min-width: 8rem;
  }
}

/* ==========================================================================
   A11y
   ========================================================================== */

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

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
