/* /guides/ layout: section jump bar, search field and the collapsed card body.
 *
 * This lives in its own stylesheet rather than site.css. site.css is a single
 * byte-budgeted file (64 KB, checked by scripts/check.mjs) that every one of the
 * 670 pages downloads, and it is currently within ~2.7 KB of that ceiling.
 * Only /guides/ grows these rules, so only /guides/ pays for them — the same
 * arrangement cards-filters.css uses for /cards/ and radar-page.css uses for
 * the status radar.
 *
 * Loaded with a plain <link> rather than through fingerprintAsset(), matching
 * radar-page.css: this file is small, changes rarely, and the conditional
 * request is cheaper than the round trip a hashed name would add on the pages
 * that never load it.
 */

/* --------------------------------------------------------------- jump bar */

.guide-jump {
  position: sticky;
  top: 0;
  /* The push-notification prompt is position:fixed at z-index 60
     (public/site.js). Staying below it means the prompt is never covered by
     this bar, which is the same budget .radar-jump uses. */
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 7px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.guide-jump.is-stuck {
  box-shadow: 0 8px 14px -10px rgba(20, 44, 41, 0.45);
}

.guide-jump ul {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.guide-jump ul::-webkit-scrollbar {
  display: none;
}

.guide-jump a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid #cbd8c4;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.guide-jump a:hover {
  border-color: #38704c;
  background: #edf4eb;
  color: var(--ink);
}

.guide-jump a.is-current {
  background: var(--deep);
  border-color: var(--deep);
  color: #fff;
}

.guide-jump a strong {
  font-weight: 800;
}

.guide-jump a.is-current strong {
  color: var(--green);
}

/* Kept out of the scrolling list so it stays reachable at any scroll position. */
.guide-jump .guide-jump-top {
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ search field */

.guide-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
}

.guide-search label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex: 0 0 auto;
}

.guide-search input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.guide-search input:focus-visible {
  outline: 3px solid #348262;
  outline-offset: 2px;
}

.guide-search-count {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.guide-search-count strong {
  font-weight: 800;
  color: var(--ink);
}

.guide-empty {
  margin: 0 0 24px;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- sections */

.guide-section {
  margin: 0 0 40px;
  /* The jump bar is sticky, so an anchored section would otherwise land with
     its heading underneath the bar. This is scoped to /guides/ rather than
     raised globally in site.css, because every other page sets its own
     scroll-padding through the shared html rule. */
  scroll-margin-top: 56px;
}

.guide-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 0 0 11px;
  border-bottom: 2px solid var(--ink);
}

.guide-section-head h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.guide-section-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.guide-section[hidden] {
  display: none;
}

/* --------------------------------------------------------- card body trim */

/* The excerpt is the bulk of each card's height (cards averaged 316px before
   this). Clamping it to two lines is a visual trim only: the full text stays in
   the HTML, and the complete sentence is available on hover through the title
   attribute. Nothing is removed from the document. */
.guide-card p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guide-card {
  /* Clamping shrinks the box, so the grid no longer needs to stretch rows to
     the tallest card in the line. */
  align-self: start;
  /* site.css gives these cards 30px of padding and wide heading margins, which
     was 60px of a 290px card. At two columns across a 1240px shell that is the
     single largest block of slack on the page, and trimming it costs no
     information. The vertical rhythm below stays proportionate. */
  padding: 22px;
}

.guide-card h2 {
  margin: 13px 0 8px;
}

.guide-card p {
  margin: 0 0 14px;
}

.guide-grid {
  gap: 18px;
}

/* Three columns only where the shell is wide enough for them to stay readable.
   Below this the two-column layout is kept: at narrower widths a third column
   pushes ordinary headlines onto a third and fourth line, which costs more
   scanning time than the extra column saves. */
@media (min-width: 1100px) {
  .guide-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 740px) {
  .guide-jump {
    gap: 8px;
    margin-bottom: 14px;
  }

  .guide-jump a {
    padding: 5px 10px;
  }

  .guide-section {
    margin-bottom: 30px;
    scroll-margin-top: 52px;
  }

  .guide-section-head h2 {
    font-size: 21px;
  }

  .guide-search input {
    flex: 1 1 100%;
  }
}

.guide-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}
