/* The landing page. Uses the baskingspot palette and typography shared with
   the docs theme (baskingspot/.github, brand/README.md). Heat is an accent,
   not a text color: links take the text color and carry heat in the underline
   and on hover. */
:root {
  color-scheme: light dark;
  --ink: #16191d;
  --paper: #f4f1ec;
  --heat: #d4412b;
  --slate: #58616c;
  --bg: light-dark(var(--paper), var(--ink));
  --fg: light-dark(var(--ink), var(--paper));
  --muted: light-dark(var(--slate), #a3abb5);
  --link-hover: light-dark(#b8321d, #e8604a);
  --rule: color-mix(in srgb, var(--fg) 16%, transparent);
  --surface: color-mix(in srgb, var(--fg) 5.5%, var(--bg));
  --panel: color-mix(in srgb, var(--fg) 3.5%, var(--bg));
  --sans: system-ui, sans-serif;
  --mono: ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--sans);
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
}

h1,
h2,
p {
  margin: 0;
}

p {
  text-wrap: pretty;
}

::selection {
  background: color-mix(in srgb, var(--heat) 30%, transparent);
}

a {
  color: inherit;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--link-hover);
}

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

code {
  font: 0.88em var(--mono);
}

:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--surface);
}

.skip {
  position: absolute;
  top: 0.75rem;
  left: 1.5rem;
  z-index: 10;
  padding: 0.5rem 0.85rem;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.9rem;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus {
  transform: translateY(0);
}

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header: matches the docs sites (lockup left, plain links right). */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.topbar .site {
  display: block;
  line-height: 0;
}

.wordmark {
  display: block;
  height: 36px;
  width: auto;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.topbar-links a {
  color: var(--muted);
  text-decoration: none;
}

.topbar-links a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* Two-column layout: sticky contents rail on the left, hero + catalog on the right. */
.layout {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  grid-template-areas:
    "rail hero"
    "rail main";
  column-gap: 3.5rem;
  align-items: start;
}

/* Hero */
.hero {
  grid-area: hero;
  padding: 2.75rem 0 0.75rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 2.8vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.what {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.summary {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Sticky contents rail (descended from the docs theme's nav.toc). */
.rail {
  grid-area: rail;
  position: sticky;
  top: 1.5rem;
  padding: 2.75rem 0 3rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

nav.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.toc > ul > li + li {
  margin-top: 0.55rem;
}

nav.toc ul ul {
  margin-top: 0.25rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--rule);
}

nav.toc ul ul li {
  margin: 0.15rem 0;
}

nav.toc a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  color: var(--muted);
  text-decoration: none;
}

nav.toc a.toc-top {
  color: var(--fg);
  font-weight: 600;
}

nav.toc a:hover {
  color: var(--link-hover);
}

nav.toc a:hover span:first-child {
  text-decoration: underline;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.toc-count {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
  font-size: 0.82rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.rail-section {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.rail-heading {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.author-list li {
  margin: 0.15rem 0;
}

.author-list a {
  display: inline-block;
  padding: 0.15rem 0;
  color: var(--fg);
  text-decoration: none;
}

.author-list a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.rail-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.rail-note a {
  text-decoration: none;
}

.rail-note a:hover code {
  color: var(--link-hover);
}

/* Main catalog */
main {
  grid-area: main;
  min-width: 0;
  padding-bottom: 3.5rem;
}

.group {
  margin-top: 2.5rem;
  scroll-margin-top: 1.5rem;
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.group-head h2 {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group-meta {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-grid li {
  border-bottom: 1px solid var(--rule);
}

.entry {
  display: block;
  height: 100%;
  margin: 0 -0.65rem;
  padding: 1rem 0.65rem 1.05rem;
  border-radius: 6px;
  text-decoration: none;
}

.entry:hover {
  background: var(--surface);
  color: inherit;
}

.entry-name {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-decoration-color: var(--heat);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.entry:hover .entry-name {
  color: var(--link-hover);
}

.entry p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 44ch;
}

/* For agents */
.agents {
  margin-top: 3rem;
  padding: 1.25rem 1.25rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.95rem;
  scroll-margin-top: 1.5rem;
}

.agents h2 {
  font-size: 1rem;
  font-weight: 600;
}

.prompt {
  position: relative;
  margin-top: 0.9rem;
}

.prompt pre {
  margin: 0;
  padding: 1rem 4.75rem 1rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  /* The prompt is a sentence with a URL in it. Wrap it rather than make a
     reader scroll sideways in a box whose end they cannot see. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.prompt button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.prompt button:hover {
  border-color: currentColor;
  color: var(--link-hover);
}

/* Footer */
footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
}

/* Responsive */
@media (width <= 62rem) {
  .layout {
    grid-template-columns: 12.5rem minmax(0, 1fr);
    column-gap: 2.25rem;
  }
  .entry-grid {
    column-gap: 1.75rem;
  }
}

@media (width <= 52rem) {
  .page {
    padding: 0 1.25rem;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "hero"
      "rail"
      "main";
  }
  .hero {
    padding: 2rem 0 0;
  }
  .rail {
    position: static;
    padding: 1.25rem 0 0;
  }
  nav.toc > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
  }
  nav.toc > ul > li + li {
    margin-top: 0;
  }
  nav.toc li.toc-branch {
    display: contents;
  }
  nav.toc li.toc-branch > a.toc-top {
    display: none;
  }
  nav.toc ul ul {
    display: contents;
  }
  nav.toc ul ul li {
    margin: 0;
  }
  nav.toc a {
    gap: 0.4rem;
    font-weight: 500;
  }
  nav.toc a.toc-top {
    font-weight: 500;
    color: var(--muted);
  }
  .rail-authors {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.9rem;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
  }
  .rail-authors .rail-heading {
    margin: 0;
  }
  .author-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
  }
  .author-list li {
    margin: 0;
  }
  .rail-note {
    display: none;
  }
  .group {
    margin-top: 2rem;
  }
}

@media (width <= 36rem) {
  .wordmark {
    height: 30px;
  }
  .topbar-links {
    gap: 1rem;
    font-size: 0.9rem;
  }
  .entry-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .prompt pre {
    padding: 2.5rem 0.9rem 0.9rem;
  }
}
