@layer page {
/* ============================================================
   BLOG
   Vibrant, high-contrast cards with whitish decorative overlays.
   ============================================================ */

.blog-header {
  padding: clamp(4rem, 10vh, 8rem) var(--gutter) clamp(2rem, 4vh, 4rem);
  max-width: 72rem;
  margin: 0 auto;
  h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 200;
    color: var(--text-0);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--space-4);
  }
  p { font-size: var(--text-lg); color: var(--text-2); max-width: 36rem; }
}

/* --- Visual Foundations --- */
.blog-featured-visual,
.blog-article-thumb,
.blog-highlight-visual,
.post-hero-band {
  position: relative;
  overflow: hidden;
}

.blog-featured-visual {
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
}

.blog-article-thumb {
  aspect-ratio: 16/10;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  background-blend-mode: soft-light, normal;
}

.blog-highlight-visual {
  aspect-ratio: 16/10;
  border-radius: var(--radius-lg);
}

.blog-illustration {
  width: 100%;
  height: 100%;
  background-image:
    url("/images/blog-pattern.svg"),
    linear-gradient(135deg,
      oklch(0.65 0.30 var(--ah)) 0%,
      oklch(0.50 0.25 calc(var(--ah) + 30)) 100%);
  background-size: cover, auto;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: overlay, normal;
}

.blog-highlight {
  --ah: 260;
  position: relative;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3rem, 6vh, 6rem) var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;

  &.reverse {
    .blog-highlight-visual { order: 2; }
    .blog-highlight-text { order: 1; }
  }
}

.blog-highlight-text {
  min-width: 0;
}

/* --- Grid & Layout --- */
.blog-grid {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2rem, 4vh, 4rem) var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
}

.blog-article {
  --ah: 260;
  position: relative;
  display: block;
  transition: transform var(--duration-normal) var(--ease-out-expo);
  &:hover { transform: translateY(-4px); }
  h3 {
    font-size: var(--text-xl);
    font-weight: 400;
    color: var(--text-0);
    line-height: 1.3;
    margin-bottom: var(--space-2);
  }
  .article-excerpt { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--space-3); }
  .meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-3); }
}

.blog-featured {
  --ah: 260;
  position: relative;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3rem, 6vh, 6rem) var(--gutter);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 300; color: var(--text-0); margin-bottom: var(--space-4); }
}

.read-link {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: oklch(0.80 0.26 var(--ah));
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  &:hover { gap: var(--space-3); color: var(--text-0); }
}

.blog-newsletter {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(4rem, 8vh, 8rem) var(--gutter);
  text-align: center;
  background: radial-gradient(circle at 50% 50%, oklch(0.12 0.05 200 / 0.3), transparent 70%);
}

/* --- Post Show Page Layout --- */
.post-wrapper {
  --ah: 260;
  --post-accent: oklch(0.75 0.20 var(--ah));
  --post-link: var(--rainbow-violet);
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--space-10) var(--gutter) var(--space-20);

  > .breadcrumb { color: var(--post-accent); }
}

.post-hero {
  margin-bottom: var(--space-20);
  position: relative;
  text-align: center;
}

.post-meta {
  justify-content: center;
  margin-top: var(--space-6);
  .sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); vertical-align: middle; margin-inline: var(--space-2); }
  .post-date { font-size: var(--text-xs); color: var(--text-2); }
}

.post-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-0);
  margin-bottom: var(--space-8);
  /* balance, not pretty: these are short display headings, and the two were
     declared back to back so pretty silently won. */
  text-wrap: balance;

  strong {
    color: var(--post-accent);
    font-weight: inherit;
  }
}

.post-subtitle {
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--text-0);
  line-height: 1.4;
  text-wrap: balance;
}

.post-hero-band {
  height: 14rem;
  margin-bottom: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 80px -10px oklch(0 0 0 / 0.5);
}

.post-body {
  font-size: 1.25rem;
  line-height: 1.95;
  color: var(--text-0);
  font-weight: 300;

  p { margin-bottom: var(--space-10); }

  a:not(.heading-permalink) {
    color: var(--post-link);
    text-decoration: underline;
    text-decoration-color: color-mix(in oklab, var(--post-link) 55%, transparent);
    text-underline-offset: var(--space-1);
    transition: color var(--duration-fast), text-decoration-color var(--duration-fast);

    &:hover {
      color: var(--text-0);
      text-decoration-color: var(--post-link);
    }

    &:focus-visible {
      outline: 2px solid var(--post-link);
      outline-offset: var(--space-1);
      border-radius: var(--radius-sm);
    }
  }

  h2 {
    font-size: 2.25rem;
    color: var(--text-0);
    margin-top: var(--space-24);
    margin-bottom: var(--space-8);
    font-weight: 400;
    letter-spacing: -0.02em;
    &:hover .heading-permalink { opacity: 1; }
  }
  h3 {
    font-size: 1.75rem;
    color: var(--text-0);
    margin-top: var(--space-16);
    margin-bottom: var(--space-6);
    font-weight: 400;
    &:hover .heading-permalink { opacity: 1; }
  }

  .heading-permalink {
    margin-left: var(--space-3);
    color: var(--text-3);
    text-decoration: none;
    opacity: 0;
    transition: opacity var(--duration-fast), color var(--duration-fast);
    &:hover { color: var(--text-1); }
  }

  > pre { margin-block: var(--space-12); }

  > .code-block {
    margin-inline: calc(var(--space-6) * -1);
    margin-block: var(--space-12);
  }

  code:not(pre code) {
    background: var(--surface-1);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--post-accent);
  }

  ul, ol {
    margin-bottom: var(--space-10);
    padding-inline-start: var(--space-8);
  }

  ul { list-style: disc; }
  ol { list-style: decimal; }

  li {
    margin-bottom: var(--space-4);

    &::marker { color: var(--post-accent); }
  }

  .table-of-contents {
    list-style: none;
    padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-12);
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 400;

    li { margin-bottom: var(--space-2); }
    ul { list-style: none; padding-left: var(--space-6); margin-top: var(--space-2); margin-bottom: 0; }
    a { color: var(--text-2); text-decoration: none; }
    a:hover { color: var(--text-0); }
  }
}

.post-author {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding-top: var(--space-16);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-20);
}

.post-author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: oklch(0.75 0.20 var(--ah));
  color: oklch(0.10 0 0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.post-author-label { font-size: 11px; text-transform: uppercase; color: var(--text-3); font-weight: 700; letter-spacing: 0.05em; }
.post-author-name { font-size: var(--text-lg); font-weight: 500; color: var(--text-0); }

.post-related {
  background: var(--surface-0);
  padding-block: var(--space-24);
}

.post-related-header {
  max-width: 52rem;
  margin: 0 auto var(--space-8);
  padding-inline: var(--gutter);

  h2 {
    text-wrap: balance;
  }
}

.post-related-list {
  max-width: 52rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.post-related-row {
  display: grid;
  grid-template-columns: var(--space-24) minmax(0, 1fr) auto;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-3);
  color: var(--text-1);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast), color var(--duration-fast);

  &:hover {
    color: var(--text-0);

    .post-related-arrow {
      transform: translateX(var(--space-1));
    }
  }
}

.post-related-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);

  .blog-illustration {
    display: block;
    inline-size: 100%;
    block-size: 100%;
  }
}

.post-related-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-2);

  strong {
    color: inherit;
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
  }
}

.post-related-meta {
  color: var(--text-3);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-related-arrow {
  color: var(--accent-text);
  font-size: var(--text-xl);
  transition: transform var(--duration-fast);
}

@media (width <= 900px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-highlight { grid-template-columns: 1fr; }
}

@media (width <= 600px) {
  .post-related-row {
    grid-template-columns: var(--space-20) minmax(0, 1fr) auto;
    gap: var(--space-4);
    padding-inline: 0;
  }

  .post-related-thumb {
    aspect-ratio: 4 / 3;
  }
}

.post-hero-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background:
    radial-gradient(circle at 60% 40%, oklch(0.65 0.30 var(--ah) / 0.15) 0%, transparent 60%),
    radial-gradient(circle at 30% 60%, oklch(0.55 0.25 calc(var(--ah) + 40) / 0.10) 0%, transparent 55%);
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.8;
  z-index: -1;
}
}
@layer page {
/* ============================================================
   DOCS
   Styles for documentation hub and sidebar docs pages.
   ============================================================ */

/* --- Hub --- */
.docs-hub {
  padding: calc(var(--nav-h) + var(--space-16)) var(--gutter) var(--space-16);
  max-width: 72rem;
  margin-inline: auto;
}
.docs-hub-header {
  text-align: center;
  margin-bottom: var(--space-10);

  h1 {
    font-size: var(--text-4xl);
    font-weight: 200;
    color: var(--text-0);
    margin-bottom: var(--space-3);
  }
  p {
    font-size: var(--text-lg);
    color: var(--text-1);
    max-width: 40rem;
    margin-inline: auto;
  }
}

/* --- Search --- */
.docs-search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 36rem;
  margin: 0 auto var(--space-8);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);

  svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-2);
    stroke-width: 2;
    fill: none;
  }
  input {
    flex: 1;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    background: transparent;
    border: none;
    color: var(--text-0);
    outline: none;
  }
}

/* --- Version banner --- */
.version-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-1);
  padding: var(--space-3) var(--space-6);
  background: var(--surface-1);
  border-radius: var(--radius-full);
  max-width: max-content;
  margin: 0 auto var(--space-12);

  .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: oklch(0.72 0.22 145);
  }
}

.docs-cat-card {
  position: relative;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: background var(--duration-fast);

  &:hover {
    background: var(--surface-2);
  }
}

/* Landing cards (guide parts, getting-started steps): the title
   clearly outsizes the eyebrow, list links answer hover, and a
   final arrowed CTA invites the click the stretched link serves. */
.docs-cat-card {
  .eyebrow {
    font-size: var(--text-xs);
    color: var(--text-3);
  }

  h2 {
    font-size: var(--text-xl);
    font-weight: var(--weight-regular);
    line-height: 1.3;

    a {
      color: var(--text-0);
      text-decoration: none;
      transition: color var(--duration-fast);
    }
  }

  &:hover h2 a { color: var(--accent-text); }
}

.docs-cat-list {
  padding-left: var(--space-5);
  margin: 0;
  list-style: decimal;

  li::marker { color: var(--text-3); }

  a {
    position: relative;
    z-index: 2; /* above the stretched card-link cover */
    color: var(--text-2);
    text-decoration: none;
    transition: color var(--duration-fast);

    &:hover { color: var(--accent-text); }
  }
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--accent-text);

  .card-cta-arrow {
    display: inline-block;
    transition: translate var(--duration-fast) var(--ease-out-expo);
  }
}

.docs-cat-card:hover .card-cta-arrow {
  translate: 3px 0;
}

/* Doors out of the Getting Started tour: a marketing grid, one
   accent per door, the title carrying the color. */
.tour-doors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
  margin-block: var(--space-8);
}

.tour-door {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast), transform var(--duration-fast) var(--ease-out-expo);

  &:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
  }

  h3 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--weight-regular);

    a {
      color: var(--accent-text);
      text-decoration: none;
    }
  }

  p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-2);
  }

  &:hover .card-cta-arrow { translate: 3px 0; }
}

@media (width <= 640px) {
  .tour-doors { grid-template-columns: 1fr; }
}
.docs-cat-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-0);
  margin-bottom: var(--space-2);

  .count {
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--text-2);
    margin-left: var(--space-2);
  }
}
.docs-cat-desc {
  font-size: var(--text-sm);
  color: var(--text-1);
  margin-bottom: var(--space-4);
}
.docs-cat-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);

  a {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-1);
    transition: color var(--duration-fast);

    &:hover {
      background: oklch(0.72 0.22 var(--cat-hue, var(--hue-brand)) / 0.15);
      color: oklch(0.80 0.20 var(--cat-hue, var(--hue-brand)));
    }
  }
}
.docs-cat-cta a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: oklch(0.80 0.18 var(--cat-hue, var(--hue-brand)));
  transition: color var(--duration-fast);

  &:hover { color: oklch(0.88 0.20 var(--cat-hue, var(--hue-brand))); }
}

/* --- Stats band on the docs landing --- */
.docs-stats {
  --grid-gap: var(--space-4);
}
.docs-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: background var(--duration-fast);

  &:hover { background: var(--surface-2); }
}
.docs-stat__value {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.02em;
  color: oklch(0.85 0.20 var(--stat-hue, var(--hue-brand)));
}
.docs-stat__unit {
  font-size: 0.55em;
  color: var(--text-2);
  margin-left: 0.05em;
}
.docs-stat__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-2);
}

/* --- Docs shell (topbar + sidebar + main) ---
   Sidebar + accordion-nav rules were previously inlined in the docs
   layout; consolidated here so they live in the page cascade layer. */
/* The shell grows with its content so the page itself scrolls: one
   scrollbar at the window edge, and the footer stays reachable at the
   end of the document. The sidebar handles its own viewport-height
   scrolling via position: sticky below. */
.docs-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: var(--nav-h, 56px) auto auto;
}
.docs-shell.without-sidebar {
  grid-template-columns: 1fr;
}
.docs-sidebar {
  padding: var(--space-6) var(--space-4);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  position: sticky;
  top: calc(var(--nav-h) + var(--space-10));
  height: calc(100vh - var(--nav-h) - var(--space-10));
  background: var(--surface-0);
}
.sidebar-search {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-0);
  margin-bottom: var(--space-6);
  outline: none;
}

/* Accordion nav groups */
.nav-group { margin-bottom: var(--space-1); }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast);

  &:hover { background: var(--surface-1); }
}
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
  flex: 1;
  transition: color var(--duration-fast);
}
.nav-group:not(.is-collapsed) .nav-group-label,
.nav-group.active .nav-group-label {
  color: oklch(1 0 0);
}
.nav-group-icon {
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;

  svg { width: 12px; height: 12px; }
}
.nav-group.is-collapsed .nav-group-icon { transform: rotate(-90deg); }
.nav-group-content {
  overflow: hidden;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Sidebar accordion links (docs + api share the .nav-group accordion).
   Scoped to .nav-group so this does NOT leak onto the top .site-nav
   .nav-link -- a bare .nav-link here (page layer) was overriding the
   header nav site-wide, pinning it to 13px. */
.nav-group .nav-link {
  display: block;
  font-size: 13px;
  padding: var(--space-1) var(--space-3) var(--space-1) 28px;
  color: var(--text-1);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 1px;

  &:hover { color: var(--text-0); background: var(--surface-1); }
  &.active { color: var(--accent-text); background: var(--accent-soft); font-weight: 500; }
}
.sidebar-link {
  display: block;
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  transition: color var(--duration-fast), background var(--duration-fast);

  &:hover { color: var(--text-0); background: var(--surface-1); }
  &.active { color: var(--accent-text); background: var(--accent-soft); }
}

.docs-main {
  padding: var(--space-8) var(--space-12);
  background: var(--surface-0);
}
/* Center the content column for a calmer reading measure. */
.docs-main > * { max-width: 60rem; margin-inline: auto; }
.doc-body img,
.doc-body svg {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.docs-breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-2);
  margin-bottom: var(--space-8);

  .dim { color: var(--text-2); }
}
.doc-content {
  h1 {
    font-size: var(--text-4xl);
    font-weight: var(--weight-light);
    color: var(--text-0);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-4);
  }
  .lead {
    font-size: var(--text-xl);
    color: var(--text-1);
    margin-bottom: var(--space-10);
  }
  h2 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-regular);
    color: var(--text-0);
    margin-top: var(--space-16);
    margin-bottom: var(--space-4);
  }
  h3 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-regular);
    color: var(--text-0);
    margin-top: var(--space-12);
    margin-bottom: var(--space-3);
  }
  p {
    margin-bottom: var(--space-5);
  }
}

/* Markdown prose: the reset strips list markers and anchors carry no
   color of their own, so the doc body restores both. Scoped to
   .doc-body only -- .doc-content also hosts breadcrumb and pager. */
.doc-body {
  ul, ol {
    margin-bottom: var(--space-5);
    padding-inline-start: var(--space-6);
  }
  ul { list-style: disc; }
  ol { list-style: decimal; }
  li {
    margin-bottom: var(--space-2);

    &::marker { color: var(--text-3); }
  }

  a {
    color: var(--accent-text);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  strong { color: var(--text-0); font-weight: var(--weight-medium); }
}

/* ── Getting Started: standalone centered step pages ─────────
   Outside the docs shell entirely: short hero above, one reading
   column, a large pager as the only navigation. */
.gs-article {
  max-width: 46rem;
  margin-inline: auto;
  padding: var(--space-4) var(--gutter) var(--space-16);

  .pager { margin-top: var(--space-8); }

  /* Closing line of each step: breathing room after the article,
     a quieter voice, then the pager. */
  .gs-outro {
    margin-block: var(--space-16) 0;
    color: var(--text-2);
    text-wrap: pretty;
  }

  /* Editorial bleed: the negative margin mirrors the block's own
     horizontal padding (space-6 on the pre), so the first code
     character sits exactly on the reading column. Color strips stay
     in the column; one glued to its code block keeps a tight gap. */
  .code-block {
    margin-inline: calc(var(--space-6) * -1);
    margin-block: var(--space-12);
  }
  .code-block:has(+ .color-strip) { margin-block-end: var(--space-4); }
}

.getting-started-wrapper {
  --ah: var(--hue-brand);

  .getting-started-hero { margin-block-end: var(--space-16); }

  /* Same treatment as the guide headings: the frontmatter headline wraps
     the stressed part in <strong><em>, colour carries it, and the weight
     stays with the rest of the line. */
  .getting-started-hero .post-title {
    em, strong {
      color: var(--accent-text);
      font-style: normal;
      font-weight: inherit;
    }
  }

  .gs-article {
    padding: 0;
  }
}

/* Guide articles share the section shell and reading column. */
.guide-article-content {
  .pager { margin-top: var(--space-8); }

  .doc-body {
    color: var(--text-0);
    font-size: var(--text-lg);
    line-height: 1.8;
    text-wrap: pretty;

    > p { margin-bottom: var(--space-8); }

    > p:first-child {
      margin-bottom: var(--space-10);
      color: var(--text-0);
      font-size: var(--text-xl);
      line-height: 1.65;
    }
  }

  .doc-table-wrap {
    width: calc(100% + var(--space-24));
    margin: var(--space-12) calc(var(--space-12) * -1);
    overflow-x: auto;
    border-block: 1px solid var(--border-subtle);

    table {
      width: 100%;
      border-collapse: collapse;
      color: var(--text-1);
      font-size: var(--text-base);
      line-height: 1.55;
    }

    :is(th, td) {
      padding: var(--space-4);
      text-align: left;
      vertical-align: top;
    }

    th {
      color: var(--text-0);
      font-size: var(--text-sm);
      font-weight: var(--weight-medium);
      letter-spacing: 0.02em;
    }

    td { border-top: 1px solid var(--border-subtle); }

    :is(th, td):first-child { width: 30%; }
    :is(th, td):nth-child(2) { width: 24%; }
  }

  .gs-outro {
    margin-block: var(--space-16) 0;
    color: var(--text-2);
    text-wrap: pretty;
  }

  .code-block {
    margin-inline: calc(var(--space-6) * -1);
    margin-block: var(--space-12);
  }

  .code-block:has(+ .color-strip) { margin-block-end: var(--space-4); }
}

.guide-summary {
  align-self: start;
  position: sticky;
  top: calc(var(--nav-h) + var(--space-12));
  padding-block-start: var(--space-1);
}

.guide-summary-title {
  display: block;
  margin: 0 var(--space-2) var(--space-6);
  color: var(--text-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.guide-summary-sections,
.guide-summary-pages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-section-content {
  max-width: var(--layout-guide-measure);
  margin-inline: auto;
  min-width: 0;
}

.guide-section-pages {
  padding-block: var(--space-4) 0;
}

.guide-section-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 10rem;
  min-height: calc(100dvh - var(--nav-h) - var(--space-12));

  > .guide-summary {
    grid-column: 1;
    position: sticky;
    top: calc(var(--nav-h) + var(--space-12));
    height: calc(100dvh - var(--nav-h) - var(--space-12));
    padding: var(--space-8) var(--space-4) var(--space-6);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    scrollbar-color: transparent transparent;

    &:hover {
      scrollbar-color: color-mix(in oklch, black 80%, var(--accent, currentColor) 20%) transparent;
    }
  }
}

.guide-section-main {
  grid-column: 2;
  min-width: 0;
  padding: var(--space-8) var(--space-12) var(--space-20);
}

.guide-section-layout.is-section-index .guide-section-content { max-width: 70rem; }

.ctx-guide .subnav { border-bottom: 1px solid var(--border-subtle); }

.guide-section-rail { grid-column: 3; }

.guide-section-header {
  padding-block: var(--space-4) var(--space-16);

  .eyebrow { margin-block-end: var(--space-5); }

  h1 {
    margin: 0;
    max-width: 18ch;
    font-size: clamp(var(--text-4xl), 5.5vw, var(--text-7xl));
    font-weight: var(--weight-light);
    letter-spacing: -0.035em;
    line-height: 1.02;
    font-style: normal;
    text-wrap: balance;

    /* The frontmatter headline wraps the part worth stressing in
       <strong><em>. Colour carries it; the weight stays light so the
       emphasis reads as a highlight rather than a second heading. */
    em, strong {
      color: var(--accent-text);
      font-style: normal;
      font-weight: inherit;
    }
  }

  .body-lg {
    margin-block: var(--space-5) 0;
    max-width: 48ch;
    color: var(--text-1);
    text-wrap: pretty;
  }

  &.is-landing {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.65fr);
    gap: var(--space-20);
    align-items: center;

    h1 {
      max-width: 17ch;
      font-size: clamp(var(--text-6xl), 5vw, var(--text-7xl));
      letter-spacing: -0.04em;
      line-height: 0.98;
    }
  }
}

.guide-section-proof {
  display: grid;
  gap: var(--space-5);
  align-items: center;
  min-height: calc(var(--space-40) * 1.65);
  color: var(--text-1);
}

.guide-section-proof--creating-colors { grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.75fr); }
.guide-proof-inputs { display: grid; gap: var(--space-3); }
.guide-proof-inputs code { padding: var(--space-3); background: var(--surface-0); color: var(--text-0); }

.guide-section-proof--spaces-and-output { grid-template-columns: auto minmax(0, 1fr); }
.guide-proof-color { display: grid; place-items: end start; inline-size: var(--space-40); block-size: var(--space-40); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--sample); }
.guide-proof-color code { padding: var(--space-2); background: var(--surface-0); color: var(--text-0); }
.guide-section-proof dl { display: grid; gap: var(--space-3); margin: 0; }
.guide-section-proof dl div { display: grid; grid-template-columns: minmax(var(--space-20), 0.6fr) minmax(0, 1fr); gap: var(--space-4); }
.guide-section-proof dt { color: var(--accent-text); }
.guide-section-proof dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); }

.guide-section-proof--manipulating-colors,
.guide-section-proof--accessibility,
.guide-section-proof--css-workflows { grid-template-columns: auto 1fr auto; }

.guide-section-proof--palettes-and-gradients { grid-template-columns: auto minmax(0, 1fr); }
.guide-proof-palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); min-height: var(--space-32); }
.guide-proof-palette i { background: var(--sample); }

.guide-proof-ratio { display: grid; place-content: center; gap: var(--space-3); min-height: var(--space-32); padding: var(--space-5); background: #1e293b; }
.guide-proof-ratio.is-fail { color: #3b82f6; }
.guide-proof-ratio.is-pass { color: #458dff; }
.guide-proof-ratio strong { font-family: var(--font-mono); font-size: var(--text-2xl); }

.guide-summary-section {
  > a {
    display: grid;
    grid-template-columns: var(--space-3) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    color: var(--text-2);
    font-size: var(--text-sm);
    line-height: 1.4;
    text-decoration: none;
    transition: color var(--duration-fast);

    &:hover { color: var(--text-0); }
  }

  &.active {
    > a {
      color: var(--accent-text);
      font-weight: var(--weight-medium);
    }

    > a .guide-summary-chevron { transform: rotate(90deg); }
  }
}

.guide-summary-chevron,
.guide-summary-icon {
  width: 100%;
  margin-block-start: var(--space-1);
}

.guide-summary-chevron {
  transition: transform var(--duration-fast);
}

.guide-summary-pages {
  padding: var(--space-1) 0 var(--space-5) var(--space-7);

  a {
    display: block;
    padding: var(--space-2);
    color: var(--text-2);
    font-size: var(--text-sm);
    line-height: 1.4;
    text-decoration: none;
    transition: color var(--duration-fast);

    &:hover { color: var(--text-0); }

    &[aria-current="page"] {
      color: var(--accent-text);
      font-weight: var(--weight-medium);
    }
  }
}

@media (width <= 1440px) {
  .guide-section-layout { grid-template-columns: 16rem minmax(0, 1fr) var(--space-16); }
}

@media (width <= 900px) {
  .guide-section-layout { grid-template-columns: var(--layout-sidebar-width-compact) minmax(0, 1fr); }
  .guide-section-rail { display: none; }
}

.recipes-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (width <= 900px) {
  .gs-article,
  .guide-article-content {
    .code-block { margin-inline: 0; }
  }

  .guide-article-content .doc-table-wrap {
    width: 100%;
    margin-inline: 0;

    table { min-width: var(--layout-guide-measure); }
  }

}

@media (width <= 768px) {
  .guide-section-layout { grid-template-columns: 1fr; }
  .guide-section-layout > .guide-summary { display: none; }
  .guide-section-main {
    grid-column: 1;
    padding-inline: var(--gutter);
  }
  .recipes-cards { grid-template-columns: 1fr; }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
}
body.part-docs .sec-hero.large {
  padding-block-start: var(--space-10);
}

/* --- Documentation identity and route selection --- */
.docs-surface-label {
  margin-block: 0 var(--space-5);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sec-hero > .docs-surface-label {
  margin-block-end: var(--space-6);
}

.docs-directory,
.getting-started-path,
.guide-chapters {
  padding-block: var(--space-24) var(--space-32);
}

.docs-directory__intro,
.getting-started-path > header {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: var(--space-6) var(--space-16);
  align-items: end;
  margin-block-end: var(--space-16);

  .eyebrow { grid-column: 1 / -1; }

  h2 {
    max-width: 15ch;
    color: var(--text-0);
    font-size: var(--text-4xl);
    font-weight: var(--weight-light);
    letter-spacing: -0.03em;
    line-height: 1.06;
    text-wrap: balance;

    em { color: var(--accent-text); font-style: normal; }
  }

  > p:not(.eyebrow) {
    max-width: 56ch;
    color: var(--text-1);
    font-size: var(--text-lg);
    line-height: 1.7;
    text-wrap: pretty;
  }
}

.docs-route {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: var(--space-20);
  padding-block: var(--space-20);
}

.docs-route + .docs-route { border-top: 1px solid var(--border-subtle); }

.docs-route__heading > p:first-child,
.docs-reference > p:first-child {
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 var(--space-6);
}

.docs-route__heading h2,
.docs-reference h2 {
  margin: 0 0 var(--space-6);
  color: var(--text-0);
  font-size: var(--text-5xl);
  font-weight: var(--weight-light);
  letter-spacing: -0.035em;
  line-height: 1;
}

.docs-route__heading h2 a,
.docs-reference h2 a { color: inherit; text-decoration: none; }

.docs-route__heading > p:not(:first-child),
.docs-reference > p:not(:first-child) {
  max-width: 40ch;
  color: var(--text-1);
  line-height: 1.65;
}

.docs-route__link {
  display: inline-flex;
  gap: var(--space-3);
  align-items: center;
  margin-block-start: var(--space-8);
  color: var(--text-0);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;

  span {
    color: var(--accent-text);
    transition: translate var(--duration-fast) var(--ease-out-expo);
  }
}

.docs-route__link:hover span { translate: var(--space-1) 0; }

.docs-start-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: center;
  margin: 0;
  padding: 0;
  list-style: none;

  li {
    position: relative;
    display: grid;
    gap: var(--space-2);
    min-height: var(--space-32);
    padding: var(--space-5) var(--space-5) var(--space-5) 0;
  }

  li::before { content: ""; inline-size: var(--space-3); block-size: var(--space-3); border-radius: 50%; background: var(--accent); }
  strong { color: var(--text-0); font-size: var(--text-lg); font-weight: var(--weight-regular); }
  strong a { color: inherit; text-decoration: none; }
  span { color: var(--text-2); font-size: var(--text-sm); }
}

.docs-guide-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: center;

  a {
    display: flex;
    justify-content: space-between;
    gap: var(--space-5);
    padding: var(--space-6) var(--space-5) var(--space-6) 0;
    color: var(--text-0);
    font-size: var(--text-lg);
    text-decoration: none;
  }

  b { color: var(--accent-text); font-weight: var(--weight-regular); }
}

.docs-reference-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border-subtle);
}

.docs-reference {
  padding-block: var(--space-20);

  &:first-child { padding-inline-end: var(--space-16); border-right: 1px solid var(--border-subtle); }
  &:last-child { padding-inline-start: var(--space-16); }

  ul,
  dl { margin: var(--space-10) 0 0; padding: 0; list-style: none; }

  li,
  dl div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-5);
    padding-block: var(--space-4);
  }

  li span,
  dt { color: var(--text-0); }
  code,
  dd { color: var(--accent-text); font-family: var(--font-mono); font-size: var(--text-xs); }
  dd { margin: 0; }
}

/* --- Getting Started sequence --- */
.getting-started-cards {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-default);
}

.getting-started-step {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: color var(--duration-fast);

  div {
    display: grid;
    grid-template-columns: minmax(14rem, 0.7fr) minmax(0, 1.3fr);
    gap: var(--space-12);
    align-items: baseline;
  }

  h3 { margin: 0; color: var(--text-0); font-size: var(--text-2xl); font-weight: var(--weight-regular); }
  div > span { color: var(--text-1); line-height: 1.55; }
  > b { color: var(--accent-text); font-size: var(--text-xl); font-weight: var(--weight-regular); }
}

.getting-started-step:hover h3 { color: var(--accent-text); }

.getting-started-path > header {
  display: block;
  max-width: 64rem;
  margin-block-end: var(--space-16);
}

.getting-started-path > header h2 {
  max-width: 18ch;
  font-size: clamp(var(--text-5xl), 6vw, 6rem);
}

.getting-started-path > header > p {
  margin-block-start: var(--space-8);
  font-size: var(--text-xl);
}

.sec-hero.large + .getting-started-path { padding-block-start: var(--space-12); }

/* --- Guide chapter directory --- */
/* page-wrap puts a fixed-nav clearance on its top padding, which is right
   for a container that opens a page and wrong for one sitting under a hero
   that already cleared it: it read as 96px of dead space under the
   spectrum. */
.guide-chapters {
  padding-block-start: var(--space-10);
}

/* Six chapters as a grid of units rather than six full-width bands. Each
   card is one chapter whole: its own surface, its own padding, nothing
   shared with its neighbours and no rule drawn between them. Separation
   comes from the gap and the surface change, never from a border. */
.guide-chapters__list {
  display: grid;
  /* min() caps the track at the container: a bare 24rem minimum is wider
     than a 390px viewport once page-wrap takes its inset, so the cards pushed
     18px of horizontal scroll onto the whole document. */
  grid-template-columns: repeat(auto-fit, minmax(min(calc(var(--space-24) * 4), 100%), 1fr));
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-chapter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
  overflow: clip;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
}

/* The visual leads the card: it is what tells the chapters apart at a
   glance, and the heading reads better under it than beside it in a column
   this narrow.

   Height is fixed, not a minimum. A row of cards only reads as a grid if
   every band ends on the same line; with min-height each visual set its own
   height and the headings below them drifted out of line.

   The band carries its own surface and no padding: the visuals that fill
   edge to edge do so without fighting a parent inset, and the ones that need
   breathing room add it themselves. */
.guide-chapter__visual {
  order: -1;
  display: grid;
  align-items: center;
  height: var(--space-40);
  overflow: clip;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  color: var(--text-1);
}

/* Each band gets a ground of its own instead of one faint shared surface.
   surface-0, surface-1 and surface-2 sit at lightness 0.06, 0.09 and 0.12,
   so reusing surface-2 for the illustration left it floating on a card that
   was barely distinguishable from the page. The treatment is chosen per
   illustration rather than applied uniformly: a split where the picture is
   about two sides, a sweep where it is about a transition, nothing at all
   where the content already fills the frame.

   The two that are already their own ground, palettes and accessibility,
   are deliberately absent here. */

/* Many concrete forms in, one type out: a hard split, neutral to accent. */
.guide-chapter__visual--creating-colors {
  background: linear-gradient(90deg,
    var(--surface-3) 0 56%,
    oklch(from var(--accent) l c h / 0.18) 56% 100%);
}

/* One colour read in three spaces: the ground is that colour, held back. */
.guide-chapter__visual--spaces-and-output {
  background:
    radial-gradient(120% 140% at 12% 50%, oklch(from var(--accent) l calc(c * 0.55) h / 0.34), transparent 62%),
    var(--surface-3);
}

/* Source to result: the ground runs the same way the bar between them does. */
.guide-chapter__visual--manipulating-colors {
  background: linear-gradient(90deg in oklch,
    oklch(from var(--accent) l c calc(h - 18) / 0.30),
    oklch(from var(--accent) l c h / 0.30));
}

/* An expression on one side, what it resolves to on the other. */
.guide-chapter__visual--css-workflows {
  background: linear-gradient(90deg,
    var(--surface-3) 0 54%,
    oklch(from var(--accent) l calc(c * 0.40) h / 0.26) 54% 100%);
}

/* Three concrete inputs collapsing into one type. The chips stretch so the
   column fills the band instead of floating in the middle of it. */
.guide-chapter__visual--creating-colors {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.9fr);
  gap: var(--space-4);
  padding: var(--space-5);

  > span { color: var(--accent-text); font-size: var(--text-xl); }
  > strong {
    color: var(--text-0);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
  }
}

.guide-visual-inputs {
  display: grid;
  gap: var(--space-2);
  height: 100%;
  align-content: stretch;
}

.guide-visual-inputs code {
  display: grid;
  align-content: center;
  padding-inline: var(--space-3);
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--text-0);
  font-size: var(--text-xs);
}

/* One color, read out in three spaces. The swatch anchors the left, the
   readings spread over the full height rather than clustering. */
.guide-chapter__visual--spaces-and-output {
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-6);
  padding: var(--space-5);

  dl { display: grid; align-content: space-between; height: 100%; margin: 0; }
  dl div {
    display: grid;
    grid-template-columns: minmax(var(--space-16), 0.45fr) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: baseline;
  }
  dt { color: var(--accent-text); font-size: var(--text-sm); }
  dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); }
}

.guide-visual-swatch {
  display: block;
  inline-size: var(--space-16);
  block-size: var(--space-16);
  border-radius: var(--radius-full);
  background: var(--sample);

  &.is-large { inline-size: var(--space-20); block-size: var(--space-20); }
}

/* Source and result, with the transformation shown between them rather than
   only named: the bar is the actual interpolation from one to the other. */
.guide-chapter__visual--manipulating-colors {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-5);
  padding: var(--space-5);
  text-align: center;

  > span {
    display: grid;
    gap: var(--space-3);
    font-size: var(--text-sm);

    &::after {
      content: "";
      height: var(--space-4);
      border-radius: var(--radius-full);
      background: linear-gradient(90deg in oklch, #3b82f6, #886cee);
    }
  }
}

/* Full bleed: a palette is the one visual that says more the less framing it
   gets. */
.guide-visual-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: 100%;

  i { background: var(--sample); }
}

/* The pair under test, each panel filling its half so the failing and the
   repaired reading sit at the same scale. */
.guide-chapter__visual--accessibility { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.guide-visual-contrast {
  display: grid;
  place-content: center;
  gap: var(--space-3);
  height: 100%;
  padding: var(--space-6);
  background: #1e293b;
  text-align: center;
}

.guide-visual-contrast span { font-size: var(--text-xs); opacity: 0.75; }
.guide-visual-contrast.is-fail { color: #3b82f6; }
.guide-visual-contrast.is-pass { color: #458dff; }
.guide-visual-contrast strong { font-family: var(--font-mono); font-size: var(--text-3xl); }

/* A variable plus a context resolving to one concrete value. */
/* Four elements, so a three-column row dropped the last one onto a line of
   its own. Two columns by two rows instead: the expression and its context
   on the left, the resolved colour and its value on the right, which is the
   order the sentence is read in. */
.guide-chapter__visual--css-workflows {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-content: center;
  justify-items: center;
  gap: var(--space-3) var(--space-6);
  padding: var(--space-5);
  text-align: center;

  code { grid-area: 1 / 1; }
  > span { grid-area: 2 / 1; }
  .guide-visual-swatch { grid-area: 1 / 2; }
  strong { grid-area: 2 / 2; }

  code {
    padding: var(--space-3);
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    color: var(--text-0);
    font-size: var(--text-xs);
  }
  > span { color: var(--accent-text); font-size: var(--text-sm); }
  strong { color: var(--text-0); font-family: var(--font-mono); font-size: var(--text-sm); }
}

/* Fills the card so the action can sit on the card floor. Combined with the
   fixed visual band and the two-line heading reserve, that puts the visual
   bottom, the outcome top and the action baseline on the same line right
   across a row. */
.guide-chapter__copy {
  display: flex;
  flex: 1;
  flex-direction: column;

  h3 {
    /* Reserve two lines. Some chapter names take one and some take two;
       without the reserve the text under them starts at a different height
       in every card. */
    min-height: 2lh;
    max-width: 18ch;
    margin: 0 0 var(--space-4);
    color: var(--text-0);
    font-size: var(--text-3xl);
    font-weight: var(--weight-light);
    letter-spacing: -0.035em;
    line-height: 1.02;
    text-wrap: balance;
  }

  > span:not(.guide-chapter__action) {
    display: block;
    max-width: 44ch;
    color: var(--text-1);
    font-size: var(--text-base);
    line-height: 1.7;
    text-wrap: pretty;
  }
}

.guide-chapter__action {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  /* auto, not a fixed space: it drops the action to the bottom of whichever
     card is tallest in the row, so every action in the row shares a line. */
  margin-block-start: auto;
  padding-block-start: var(--space-6);
  color: var(--text-0);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);

  b { color: var(--accent-text); font-weight: var(--weight-regular); }
}

/* --- Guide section path --- */
.guide-section-path-header {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: var(--space-12);
  align-items: end;
  margin-block: var(--space-8) var(--space-12);

  h2 {
    max-width: 14ch;
    margin: 0;
    color: var(--text-0);
    font-size: var(--text-4xl);
    font-weight: var(--weight-light);
    letter-spacing: -0.025em;
    line-height: 1.08;
    text-wrap: balance;
  }

  > p:not(.eyebrow) { max-width: 52ch; color: var(--text-1); line-height: 1.65; }
}

.guide-section-path {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-subtle);

  > li {
    position: relative;
    padding-block: var(--space-8);
    border-bottom: 1px solid var(--border-subtle);
  }

  > li > div {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: var(--space-12);
    align-items: baseline;
  }

  h3 {
    margin: 0;
    color: var(--text-0);
    font-size: var(--text-2xl);
    font-weight: var(--weight-regular);
    line-height: 1.15;

    a { display: flex; justify-content: space-between; gap: var(--space-5); }
    b { color: var(--accent-text); font-weight: var(--weight-regular); }
  }

  p { max-width: 48ch; margin: 0; color: var(--text-1); font-size: var(--text-base); line-height: 1.65; text-wrap: pretty; }
}

@media (width <= 900px) {
  .docs-directory__intro,
  .getting-started-path > header { grid-template-columns: 1fr; }

  .docs-route { grid-template-columns: 1fr; gap: var(--space-12); }
  .docs-reference:first-child { padding-inline-end: var(--space-10); }
  .docs-reference:last-child { padding-inline-start: var(--space-10); }

  .getting-started-step div { grid-template-columns: minmax(12rem, 0.7fr) minmax(0, 1.3fr); }

  .guide-chapter { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .guide-chapter > * { grid-column: 1 !important; grid-row: auto; }
  .guide-section-header.is-landing { grid-template-columns: 1fr; }
  .guide-section-proof { min-height: 0; }
  .guide-section-path-header { grid-template-columns: 1fr; }
}

@media (width <= 680px) {
  .docs-directory,
  .getting-started-path,
  .guide-chapters { padding-block: var(--space-20) var(--space-24); }

  .docs-start-flow,
  .docs-guide-map,
  .docs-reference-row { grid-template-columns: 1fr; }
  .docs-reference:first-child { padding-inline-end: 0; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .docs-reference:last-child { padding-inline-start: 0; }

  .getting-started-step {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-4);
    padding-inline: 0;

    div { grid-template-columns: 1fr; gap: var(--space-2); }
  }

  .guide-chapter__number { font-size: var(--text-lg); }

  .guide-chapter { gap: var(--space-10); padding-block: var(--space-16); }
  .guide-chapter__copy h3 { font-size: var(--text-4xl); }
  .guide-chapter__visual,
  .guide-section-proof { grid-template-columns: 1fr; }
  .guide-section-path > li > div { grid-template-columns: 1fr; gap: var(--space-4); }
  .guide-section-header.is-landing h1 { font-size: var(--text-5xl); }
  .guide-proof-color { inline-size: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-route__link span,
  .getting-started-step,
  .guide-chapter { transition: none; }
}
}
@layer page {
/* ============================================================
   GALLERIES
   Shared visual language for the four "entity gallery" pages:
   /palettes, /colors, /color/spaces, /gradients mosaic.

   Each gallery card is a surface-1 tile with a big visual block
   on top and a meta block underneath. Per-page styles (palette
   strip, color swatch, space illustration, gradient preview)
   plug into the `.gallery-card` shell via a variant class.
   ============================================================ */

/* ── Section frame ─────────────────────────────────────────── */

.sec-gallery {
  padding: var(--space-12) var(--gutter) var(--space-24);
  max-width: 84rem;
  margin-inline: auto;
}


/* ── Filter bar ────────────────────────────────────────────── */

.gallery-filters {
  justify-content: center;
  margin-bottom: var(--space-10);
}

.gallery-filter {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-2);
  cursor: pointer;
  transition:
    background var(--duration-fast),
    border-color var(--duration-fast),
    color var(--duration-fast);

  &:hover {
    border-color: var(--text-2);
    color: var(--text-0);
  }
  &.active {
    background: var(--text-0);
    border-color: var(--text-0);
    color: oklch(0.08 0 0);
  }
}


/* ── Grid ──────────────────────────────────────────────────── */

/* Uses auto-fill (not the .grid-auto default of auto-fit) so trailing
   incomplete rows preserve column width instead of stretching. */
.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min, 340px), 1fr));
}


/* ── Card shell ────────────────────────────────────────────── */

.gallery-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    background var(--duration-normal) var(--ease-out-expo),
    transform  var(--duration-normal) var(--ease-out-expo);

  &:hover {
    background: var(--surface-2);
    transform: translateY(-3px);
  }
}


/* ── Meta block (shared across all variants) ───────────────── */

.gallery-meta {
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.gallery-card-title {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-0);
  line-height: 1.2;
  margin: 0;
}

.gallery-card-count {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.gallery-card-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0;
  text-wrap: pretty;
}

.gallery-card-tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-2);
  margin-top: var(--space-1);

  /* Mood-driven tag colors. Each reads as a tinted chip, not a
     saturated fill -- the palette strip itself carries the color. */
  &.mood-cool   { color: oklch(0.82 0.14 220); background: oklch(0.82 0.14 220 / 0.12); }
  &.mood-warm   { color: oklch(0.82 0.18  35); background: oklch(0.82 0.18  35 / 0.12); }
  &.mood-vivid  { color: oklch(0.82 0.20 320); background: oklch(0.82 0.20 320 / 0.12); }
  &.mood-earthy { color: oklch(0.82 0.12  90); background: oklch(0.82 0.12  90 / 0.12); }
  &.mood-dark   { color: oklch(0.78 0.06 260); background: oklch(0.78 0.06 260 / 0.12); }
  &.mood-light  { color: oklch(0.85 0.04 180); background: oklch(0.85 0.04 180 / 0.12); }
}


/* ============================================================
   PALETTE CARD
   Big colorful strip that fills the top of the card. On hover
   the card lifts; swatches expand their neighbour on hover and
   reveal their OKLCH values.
   ============================================================ */

.palette-card .palette-strip {
  display: flex;
  height: clamp(140px, 18vw, 200px);
  gap: 0;
}

/* Gradient card thumbnail: full-bleed gradient at the top of the
   card, position-relative so the title's stretched-link cover
   anchors to the card. */
.gradient-card {
  position: relative;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background var(--duration-fast), transform var(--duration-fast);

  &:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
  }
}
.gradient-card-strip {
  height: clamp(140px, 18vw, 200px);
}

.palette-swatch {
  flex: 1;
  position: relative;
  background: var(--c);
  transition: flex var(--duration-normal) var(--ease-out-expo);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

/* When the parent strip is hovered, other swatches shrink a bit;
   the specifically-hovered swatch grows. Gives a subtle sense of
   focus without moving the card outline. */
.palette-card:hover .palette-swatch { flex: 0.85; }
.palette-card .palette-swatch:hover { flex: 2.2; }

.palette-swatch-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: oklch(0.08 0 0);
  padding: var(--space-2) var(--space-3);
  background: color-mix(in oklch, var(--c) 85%, white 15%);
  border-top-right-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast),
    transform var(--duration-fast);
  pointer-events: none;
  white-space: nowrap;
}

/* Revealed only on the swatch that's actually being hovered. */
.palette-swatch:hover .palette-swatch-label {
  opacity: 0.95;
  transform: translateY(0);
}

/* Dark-on-light vs light-on-dark label: pick the text color based
   on the perceived lightness of the swatch. Using `oklch(from var(--c) l)`
   exposes the lightness channel we can branch on — but CSS can't
   if-else at parse time, so we use `color-mix` to derive a legible
   label backing regardless of the swatch's own lightness. The
   mix above with white biases toward a tinted pastel the text sits
   on, which reads well across both dark and light source swatches. */


/* ── Responsive ─────────────────────────────────────────────── */

@media (width <= 600px) {
  .palette-card .palette-strip { height: 140px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-filters { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: var(--space-2); }
  .gallery-filter { flex-shrink: 0; }
}


/* ============================================================
   NEIGHBOR NAV
   Prev / next strip at the bottom of every show page in the
   three catalogs (colors, palettes, gradients). Each card is
   the same surface-1 tile as a gallery card, with a label, the
   neighbor's name, and a preview block whose contents vary by
   catalog (single swatch, palette strip, or gradient band).
   ============================================================ */

.neighbor-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.neighbor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition:
    background var(--duration-normal) var(--ease-out-expo),
    transform var(--duration-normal) var(--ease-out-expo);

  &:hover {
    background: var(--surface-2);
    transform: translateY(-2px);
  }
  &.next {
    text-align: right;
  }
}

.neighbor-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.neighbor-name {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-0);
  line-height: 1.2;
  margin: 0;
}

.neighbor-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
}

.neighbor-preview {
  display: flex;
  height: 48px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-2);

  & > span {
    flex: 1;
    display: block;
  }
}

@media (width <= 600px) {
  .neighbor-nav { grid-template-columns: 1fr; }
}
}
