/* ===================================================================
   Guides (/guides/:slug, layouts/guide), in the dashboard's toy look
   (2026-10-23): the public header and footer (pages/_public_header,
   _public_footer, public.css), a bar with the guide picker, then the
   guide in one white card. v2.css tokens via body.v2.
   =================================================================== */

/* The guide layout loads every stylesheet, and studio.css pins html and
   body to the viewport with overflow hidden. Let the page scroll again;
   clip (not hidden) keeps body from becoming a scroll container, so the
   sticky header still sticks. */
html.guide-html {
  width: auto !important;
  height: auto !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  scroll-padding-top: 96px;
}
body.guide-body {
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
html.guide-html h2[id],
html.guide-html h3[id] {
  scroll-margin-top: 96px;
}
.guide-wrapper { flex: 1 0 auto; display: flex; flex-direction: column; }
/* studio.css (loaded here too) styles its help panel's .guide-card as a
   flex link card; the guide's wrapper of the same name is just a box.
   As a flex item, the card overflowed narrow phones. */
body.guide-body .guide-card { display: block; padding: 0; background: none; border: 0; border-radius: 0; transition: none; }
body.guide-body .guide-card:hover { transform: none; box-shadow: none; }

/* --- The guide picker bar --- */
.guide-nav { padding: 20px 0 0; }
.guide-nav-container { max-width: 960px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: center; }
.guide-nav-center { width: 100%; display: flex; justify-content: center; }
.guide-selector-wrapper { position: relative; width: 100%; max-width: 340px; }
.guide-selector-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 46px; padding: 0 18px; box-sizing: border-box;
  background: #fff; border: 2px solid var(--v2-line); border-radius: 999px; box-shadow: 0 3px 0 var(--v2-line);
  color: var(--v2-ink); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.guide-selector-btn:hover { transform: translateY(-2px); }
.guide-selector-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--v2-line); }
.guide-selector-btn svg { color: var(--v2-muted); flex-shrink: 0; }
.guide-selector-dropdown {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0; z-index: 1000; padding: 12px;
  background: #fff; border: 2px solid var(--v2-line); border-radius: 20px; box-shadow: 0 4px 0 var(--v2-line);
}
.guide-selector-dropdown.hidden { display: none !important; }
.search-box { position: relative; margin-bottom: 10px; }
.search-box input {
  width: 100%; min-height: 42px; padding: 0 14px; box-sizing: border-box;
  background: var(--v2-cream); border: 2px solid var(--v2-line); border-radius: 14px;
  color: var(--v2-ink); font: inherit; font-size: 15px;
}
.search-box input:focus { outline: none; border-color: var(--v2-blue); background: #fff; }
.guide-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; padding-right: 4px; }
.guide-list::-webkit-scrollbar { width: 4px; }
.guide-list::-webkit-scrollbar-track { background: transparent; }
.guide-list::-webkit-scrollbar-thumb { background: var(--v2-line); border-radius: 10px; }
body.guide-body .guide-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  color: var(--v2-ink); text-decoration: none; font-size: 15px; font-weight: 600;
}
body.guide-body .guide-item:hover { background: var(--v2-cream); }
body.guide-body .guide-item.active { background: var(--v2-blue-bg); color: var(--v2-blue-ink); font-weight: 800; }
.guide-item.hidden { display: none !important; }

/* --- The guide --- */
.guide-main { flex-grow: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 20px 20px 56px; box-sizing: border-box; }
.guide-card-content {
  padding: 40px 48px;
  background: #fff; border: 2px solid var(--v2-line); border-radius: 24px; box-shadow: 0 4px 0 var(--v2-line);
}

/* Table of contents (built by the layout's script from h2/h3 ids). */
.guide-toc { margin-bottom: 32px; padding: 20px 24px; background: var(--v2-cream); border: 2px solid var(--v2-line); border-radius: 20px; }
.guide-toc-title { margin-bottom: 10px; color: var(--v2-muted); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.guide-toc ul, .guide-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc-section; }
.guide-toc li { margin: 0; padding: 0; counter-increment: toc-section; }
body.guide-body .guide-toc li a { display: block; padding: 5px 0; color: var(--v2-ink); text-decoration: none; font-size: 15px; font-weight: 600; }
.guide-toc li a::before { content: counter(toc-section) ". "; color: var(--v2-muted); font-weight: 700; }
body.guide-body .guide-toc li a:hover { color: var(--v2-blue-ink); }
.guide-toc li.toc-sub { counter-increment: none; }
body.guide-body .guide-toc li.toc-sub a { padding-left: 22px; font-size: 14px; font-weight: 500; color: var(--v2-muted); }
.guide-toc li.toc-sub a::before { content: "\2022  "; color: var(--v2-line); }

/* Typography */
.guide-card-content h1,
.guide-card-content h2,
.guide-card-content h3 { scroll-margin-top: 96px; font-family: var(--v2-display); color: var(--v2-ink); }
/* Icons stay on the title's line, centered, however long the title. */
.guide-card-content h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 36px; font-weight: 800; line-height: 1.15; }
.guide-card-content h2 { display: flex; align-items: center; gap: 12px; margin: 32px 0 14px; font-size: 26px; font-weight: 800; line-height: 1.25; }
.guide-card-content h3 { display: flex; align-items: center; gap: 10px; margin: 20px 0 8px; font-size: 19px; font-weight: 800; line-height: 1.3; }
.guide-card-content h2:hover .anchor-link,
.guide-card-content h3:hover .anchor-link { opacity: 1; }
body.guide-body .anchor-link { opacity: 0; margin-left: 8px; color: var(--v2-line); text-decoration: none; font-weight: 400; font-size: .8em; transition: opacity .2s, color .2s; }
body.guide-body .anchor-link:hover { color: var(--v2-blue) !important; }
.guide-card-content p { margin: 0 0 12px; font-size: 17px; line-height: 1.6; color: var(--v2-ink); }
.guide-card-content p.lead { margin-bottom: 24px; font-size: 19px; line-height: 1.55; color: var(--v2-muted); font-weight: 500; }
.guide-card-content hr { margin: 28px 0; border: none; border-top: 2px solid var(--v2-line); }
.guide-card-content ul, .guide-card-content ol { margin: 8px 0 20px 24px; color: var(--v2-ink); font-size: 17px; line-height: 1.6; }
.guide-card-content li { margin-bottom: 8px; }
.guide-card-content li:last-child { margin-bottom: 0; }
.guide-card-content strong { color: var(--v2-ink); font-weight: 700; }
body.guide-body .guide-card-content a { color: var(--v2-blue-ink); font-weight: 600; }
.guide-card-content code {
  padding: 2px 8px; background: var(--v2-cream); border: 2px solid var(--v2-line); border-radius: 8px;
  color: var(--v2-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .88em;
  overflow-wrap: anywhere; /* a long URL wraps instead of widening the page */
}

/* Blocks */
.guide-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 24px; }
@media (min-width: 640px) { .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.guide-box, .guide-box-gray, .guide-box-indigo, .guide-box-blue, .guide-box-red { padding: 22px 24px; border: 2px solid var(--v2-line); border-radius: 20px; }
.guide-box { background: #fff; box-shadow: 0 4px 0 var(--v2-line); }
.guide-box-gray { background: var(--v2-cream); }
/* "indigo" boxes were the guides' highlight color; they are blue now, as
   the brand allows no indigo. */
.guide-box-indigo, .guide-box-blue { background: var(--v2-blue-bg); border-color: var(--v2-blue-line); }
.guide-box-indigo h3, .guide-box-blue h3 { color: var(--v2-blue-ink); }
.guide-box-indigo :is(p, li), .guide-box-blue :is(p, li) { color: var(--v2-blue-ink); }
.guide-box-indigo code, .guide-box-blue code { background: #fff; border-color: var(--v2-blue-line); color: var(--v2-blue-ink); }
.guide-box-red { background: #fdecef; border-color: var(--v2-danger-line); }
.guide-box-red h3, .guide-box-red :is(p, li) { color: var(--v2-danger); }
.guide-box-red code { background: #fff; border-color: var(--v2-danger-line); color: var(--v2-danger); }

/* Step number badges */
.step-badge {
  flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: var(--v2-blue); box-shadow: 0 3px 0 var(--v2-blue-deep); color: #fff; border-radius: 12px;
  font-family: var(--v2-display); font-size: 16px; font-weight: 800;
}

/* Code blocks */
.guide-code-block { margin: 16px 0 24px; padding: 16px 18px; overflow-x: auto; background: var(--v2-ink); border-radius: 16px; }
/* Long commands wrap on phones instead of scrolling sideways (soft wraps
   still copy as one line). */
.guide-code-block pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #f3e6da; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 14px; line-height: 1.55; }
.guide-code-block .token-var { color: #b6e08f; }
.guide-code-block .token-string { color: #f7d3a9; }
.guide-code-block .token-key { color: #c9d3f5; }

/* "Good to know" note under a section; its inline icon flows with the text. */
.guide-tip { margin-top: 32px; padding-top: 22px; border-top: 2px solid var(--v2-line); text-align: center; color: var(--v2-muted); font-size: 15px; font-weight: 600; }
.guide-card-content p.guide-video-caption { margin: 10px 0 30px; text-align: center; color: var(--v2-muted); font-size: 13px; }

/* Screenshots */
.guide-screenshot { margin: 20px 0; overflow: hidden; border: 2px solid var(--v2-line); border-radius: 18px; box-shadow: 0 4px 0 var(--v2-line); }
.guide-screenshot img { display: block; width: 100%; height: auto; }
.guide-screenshot-caption { padding: 12px 16px; background: var(--v2-cream); border-top: 2px solid var(--v2-line); color: var(--v2-muted); font-size: 14px; line-height: 1.45; text-align: center; }
.guide-screenshot-caption strong { color: var(--v2-ink); }

body.guide-body .guide-source-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 12px;
  border: 2px solid var(--v2-line); border-radius: 999px; color: var(--v2-muted); text-decoration: none; font-size: 13px; font-weight: 700;
}
body.guide-body .guide-source-link:hover { color: var(--v2-blue-ink); border-color: var(--v2-blue-line); background: var(--v2-blue-bg); }

.guide-illustration { margin: 16px 0; overflow: hidden; border-radius: 18px; }
.guide-illustration img { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }

/* --- Narrow screens --- */
@media (max-width: 768px) {
  .guide-nav { padding-top: 16px; }
  .guide-main { padding: 16px 12px 40px; }
  .guide-card-content { padding: 24px 20px; border-radius: 20px; }
  .guide-card-content h1 { font-size: 28px; }
  .guide-card-content h2 { font-size: 23px; margin: 24px 0 12px; }
  .guide-card-content h3 { font-size: 18px; }
  .guide-box, .guide-box-gray, .guide-box-indigo, .guide-box-blue, .guide-box-red { padding: 18px; }
  .guide-code-block { padding: 14px; }
}
@media (max-width: 480px) {
  .guide-card-content { padding: 20px 16px; }
  .guide-card-content h1 { font-size: 25px; }
  .guide-card-content h2 { font-size: 21px; gap: 8px; }
  .guide-card-content h3 { font-size: 17px; gap: 8px; }
  .guide-card-content p, .guide-card-content ul, .guide-card-content ol { font-size: 16px; }
  .guide-box, .guide-box-gray, .guide-box-indigo, .guide-box-blue, .guide-box-red { padding: 14px; }
  .guide-code-block pre { font-size: 13px; }
}

/* --- Inline icons in guide content: bi_icon bakes 14px into each SVG;
   here they scale with the text (role colors come from .icon-c-*). Only
   SVGs inside the card, so the header's icons keep their size. --- */
.guide-card-content svg { width: 1em; height: 1em; vertical-align: -.15em; flex-shrink: 0; }
.guide-card-content h1 svg,
.guide-card-content h2 svg,
.guide-card-content h3 svg { width: .85em; height: .85em; }
