/* ==========================================================================
   Spicy docs layer
   Sits on top of landing.css: left navigation + article typography.
   Loaded by every page under docs/ and the top-level docs folders.
   ========================================================================== */

/* Layout
   -------------------------------------------------------------------------- */
.docs-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding: clamp(1.75rem, 3.5vw, 3rem) 0 clamp(4rem, 8vw, 6rem);
  align-items: start;
}

/* Sidebar
   -------------------------------------------------------------------------- */
.docs-side {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
}
.docs-nav-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.docs-nav-title a { text-decoration: none; }
.docs-nav-title a:hover { color: var(--chili); }
.docs-nav-group {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 1.5rem 0 0.55rem;
}
.docs-nav ul { display: flex; flex-direction: column; }
.docs-nav li a {
  position: relative;
  display: block;
  padding: 0.3rem 0 0.3rem 0.95rem;
  text-decoration: none;
  font-size: 0.94rem;
  color: var(--muted);
}
.docs-nav li a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 0.4rem;
  height: 0.4rem;
  background: transparent;
}
.docs-nav li a:hover { color: var(--chili); }
.docs-nav li a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}
.docs-nav li a[aria-current="page"]::before { background: var(--chili); }

/* The collapsed-nav button only exists on narrow screens, where the sidebar
   sits above the article instead of beside it. */
.docs-nav-toggle { display: none; }

/* Article
   -------------------------------------------------------------------------- */
.docs-article { min-width: 0; max-width: 74ch; }
.docs-crumb {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.1rem;
}
.docs-crumb a { text-decoration: none; }
.docs-crumb a:hover { color: var(--chili); }
.docs-article h1 {
  font-size: clamp(2.1rem, 3.6vw, 3rem);
  letter-spacing: -0.04em;
  margin-bottom: 0.9rem;
}
.docs-article .lede { margin-bottom: 2rem; }
.docs-article h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  max-width: none;
  margin: 2.6rem 0 0.8rem;
}
.docs-article h3 {
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  margin: 1.9rem 0 0.5rem;
}
.docs-article p { max-width: 68ch; color: var(--muted); }
.docs-article p + p { margin-top: 0.9rem; }
.docs-article ul,
.docs-article ol {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.9rem 0;
  color: var(--muted);
}
.docs-article ul li { position: relative; padding-left: 1.15rem; max-width: 66ch; }
.docs-article ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 0.42rem;
  height: 0.42rem;
  background: var(--chili);
}
.docs-article ol { counter-reset: docs-item; }
.docs-article ol li { position: relative; padding-left: 1.7rem; max-width: 66ch; counter-increment: docs-item; }
.docs-article ol li::before {
  content: counter(docs-item);
  position: absolute;
  left: 0;
  top: 0.12em;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
}
.docs-article a { color: var(--chili); text-underline-offset: 2px; }
.docs-article a:hover { color: var(--chili-hot); }
.docs-article code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 0.08em 0.32em;
}
.docs-article pre {
  background: var(--night);
  color: var(--on-night);
  border: 1px solid var(--ink);
  padding: 1rem 1.1rem;
  margin: 1.1rem 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}
.docs-article pre code { background: none; border: 0; padding: 0; color: inherit; }
.docs-article blockquote {
  border-left: 3px solid var(--chili);
  padding-left: 1rem;
  margin: 1.2rem 0;
  color: var(--muted);
}
.docs-article hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.docs-article img { border: 1px solid var(--line); margin: 1.4rem 0; }
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
}
.docs-article th,
.docs-article td {
  text-align: left;
  padding: 0.55rem 0.7rem 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.docs-article th {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom-color: var(--ink);
}

/* Callout boxes
   -------------------------------------------------------------------------- */
.docs-note {
  border: 1px solid var(--ink);
  border-left: 4px solid var(--chili);
  background: var(--sheet);
  padding: 1rem 1.15rem;
  margin: 1.6rem 0;
  font-size: 0.96rem;
}
.docs-note p { max-width: 62ch; }
.docs-note strong { color: var(--ink); }

/* Hub cards
   -------------------------------------------------------------------------- */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}
.docs-card {
  display: block;
  border: 1px solid var(--ink);
  background: var(--sheet);
  padding: 1.1rem 1.15rem 1.25rem;
  text-decoration: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.docs-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--chili);
}
.docs-card h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.docs-card p { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

/* Docs homepage bar and slim footer
   -------------------------------------------------------------------------- */
.docs-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.docs-bar .nav-inner { gap: 0.85rem; }
.docs-bar .theme-toggle { margin-left: 0; }
.docs-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 28rem;
  margin-left: auto;
}
.docs-search svg {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.docs-search input {
  width: 100%;
  height: 42px;
  padding: 0 0.9rem 0 2.4rem;
  border: 1px solid var(--ink);
  background: var(--sheet);
  color: var(--ink);
}
.docs-search input::placeholder { color: var(--faint); }
.docs-search input::-webkit-search-decoration,
.docs-search input::-webkit-search-results-button { display: none; }
.docs-empty { margin-top: 0.4rem; color: var(--muted); }
.footer--slim { padding: 1.15rem 0; }
.footer--slim .footer-base { border-top: 0; padding-top: 0; }

/* Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .docs-bar .nav-inner { gap: 0.55rem; min-height: 64px; }
  .docs-bar .logo img { height: 26px; }
  .docs-bar .theme-toggle { width: 40px; height: 40px; }
  .docs-search { max-width: none; }
  .docs-search input { height: 40px; padding-left: 2.15rem; }
  .docs-nav-toggle { top: 64px; }
}
@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .docs-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--line);
  }
  .docs-nav { display: grid; gap: 0 1.5rem; padding-top: 1.15rem; }
  .docs-nav-title { grid-column: 1 / -1; }

  /* Collapsed navigation. The sidebar sits above the article on narrow
     screens, so it folds behind a button rather than pushing the page
     down by several hundred pixels before any content appears. */
  .docs-nav-toggle {
    /* Sits in its own full-width row of .docs-layout rather than inside the
       sidebar, so the sticky element has a parent tall enough to stick
       within — a sticky child cannot escape its parent's box. */
    grid-column: 1 / -1;
    position: sticky;
    /* The site header is sticky at top: 0, so sit directly beneath it.
       64px is the header height on phones, 72px above that. */
    top: 72px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--ink);
    background: var(--sheet);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .docs-nav-toggle > span { flex: 1; text-align: left; }
  .docs-nav-toggle svg { flex: none; }
  .docs-nav-toggle:hover { border-color: var(--chili); color: var(--chili); }
  .docs-nav-toggle[aria-expanded="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
  }
  .docs-nav-toggle[aria-expanded="true"]:hover { color: var(--paper); }
  .docs-nav-toggle .docs-nav-chevron { transition: transform 0.22s var(--ease); }
  .docs-nav-toggle[aria-expanded="true"] .docs-nav-chevron { transform: rotate(180deg); }

  .docs-side[data-open="false"] .docs-nav { display: none; }
  .docs-side[data-open="false"] { padding-bottom: 1.15rem; }
}
@media (min-width: 640px) and (max-width: 960px) {
  .docs-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .docs-nav-group { margin-top: 1rem; }
}
