/* Guide library: index by symptom, search, contents bar and previous/next.
   Builds on guide.css tokens: warm paper, quiet ink, hairlines, no shadows,
   blue only for action and focus. */
.gl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gl [hidden] { display: none !important; }
.gl-searchbar :focus-visible, .gl-chips :focus-visible, .gl-cards :focus-visible, .gl-results :focus-visible, .gl-toc :focus-visible, .gl-pager :focus-visible, .gl-dialog :focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.gl-ico { flex: none; position: relative; width: 20px; height: 20px; color: var(--muted); }
.gl-ico::before { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; box-sizing: border-box; border: 2px solid currentColor; border-radius: 50%; }
.gl-ico::after { content: ""; position: absolute; left: 12px; top: 15px; width: 7px; height: 2px; border-radius: 1px; background: currentColor; transform: rotate(45deg); transform-origin: left center; }
.gl-intro { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

/* search field */
.gl-field { position: relative; display: flex; align-items: center; }
.gl-field .gl-ico { position: absolute; left: 16px; pointer-events: none; }
.gl-field input { width: 100%; min-height: 56px; padding: 0 16px 0 46px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--ink); font: 500 17px/1.3 var(--sans); appearance: none; }
.gl-field input::placeholder { color: var(--faint); }
.gl-field input:focus { border-color: var(--blue); outline: 3px solid var(--blue-soft); outline-offset: 0; }
.gl-tries { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.gl-tries > span { color: var(--faint); font-size: 13px; font-weight: 700; }
.gl-tries button, .gl-chips button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer; white-space: nowrap; }
.gl-tries button:hover, .gl-chips button:hover { border-color: var(--blue); }

/* results */
.gl-status { margin: 22px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.gl-status:empty { display: none; }
.gl-results { margin: 8px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.gl-results:empty { display: none; }
.gl-found { padding-bottom: 8px; }
.gl-found:has(.gl-results:not(:empty)) { min-height: 60vh; padding-bottom: 72px; }
.rs-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.rs-main { display: grid; gap: 5px; color: var(--ink); text-decoration: none; }
.rs-title { font: 600 21px/1.22 var(--serif); }
.rs-main:hover .rs-title { color: var(--blue-dark); }
.rs-sum { color: var(--muted); font-size: 15px; }
.rs-meta { color: var(--faint); font-size: 12px; font-weight: 700; }
.rs-faq { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--line-strong); background: rgba(255, 254, 249, .7); color: var(--muted); font-size: 14px; line-height: 1.5; }
.rs-faq strong { display: block; color: var(--ink); }
.rs-jumps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.rs-jumps > span { color: var(--faint); font-size: 12px; font-weight: 700; }
.rs-jump { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--blue-dark); font-size: 13px; font-weight: 650; text-decoration: none; }
.rs-jump:hover { border-color: var(--blue); }
.rs-none { padding: 18px 0; color: var(--muted); }

/* library index */
.gl-searchbar { position: sticky; top: var(--gl-top, 77px); z-index: 25; padding: 10px 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.gl-searchbar .gl-field input { min-height: 48px; border-radius: 12px; font-size: 16px; }
.gl-index .gl-hero { padding: 30px 0 8px; }
.gl-prompt { margin-top: 22px; }
.gl-prompt h2 { margin: 0; font: 500 clamp(26px, 3.6vw, 36px)/1.14 var(--serif); }
.gl-prompt + .gl-chips { margin-top: 12px; }
.gl-index .gl-hero h1 { font-size: clamp(32px, 5.4vw, 56px); line-height: 1.04; }
.gl-index .gl-hero .dek { margin-top: 16px; font-size: clamp(17px, 1.8vw, 20px); }
.gl-chips { display: flex; gap: 8px; margin: 4px -20px 0; padding: 4px 20px 12px; overflow-x: auto; scrollbar-width: none; }
.gl-chips::-webkit-scrollbar { display: none; }
.gl-chips button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.gl-cards { display: grid; gap: 14px; margin-top: 14px; }
.gl-card { padding: 22px 22px 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.gl-card h2 { margin: 0; font: 500 clamp(24px, 3.4vw, 32px)/1.16 var(--serif); }
.gl-rows { margin-top: 16px; border-top: 1px solid var(--line); }
.gl-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.gl-card .gl-row:last-child { border-bottom: 0; }
.gl-row-text { display: grid; gap: 4px; }
.gl-row-text h3 { margin: 0; font: 600 19px/1.25 var(--serif); }
.gl-row-text span { color: var(--muted); font-size: 15px; line-height: 1.45; }
.gl-row:hover h3 { color: var(--blue-dark); }
.gl-min { padding-top: 4px; color: var(--faint); font-size: 12px; font-weight: 700; white-space: nowrap; }
.gl-empty { color: var(--muted); }
.gl-index .library-start { margin-top: 36px; }

/* buttons */
.gl-search-btn, .gl-close { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font: 650 14px/1 var(--sans); cursor: pointer; }
.gl-search-btn:hover { border-color: var(--blue); color: var(--blue-dark); }
.gl-close { min-height: 44px; }

/* search dialog */
.gl-dialog { width: 100%; max-width: 760px; height: 100%; max-height: none; margin: 0 auto; padding: 0; border: 0; background: var(--paper); color: var(--ink); }
.gl-dialog::backdrop { background: rgba(28, 33, 31, .45); }
.gl-dialog-in { padding: 14px 20px 40px; }
.gl-dialog-top { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.gl-dialog:has(.gl-results:not(:empty)) .gl-tries { display: none; }

/* guide page: contents bar */
.gl-guide .article-toc { display: none; }
.gl-guide h2[id], .gl-guide h3[id] { scroll-margin-top: calc(var(--gl-top, 77px) + 68px); }
.gl-toc { position: sticky; top: var(--gl-top, 77px); z-index: 20; margin-bottom: 34px; border-block: 1px solid var(--line); background: var(--paper); }
.gl-toc summary { list-style: none; cursor: pointer; }
.gl-toc summary::-webkit-details-marker { display: none; }
.gl-toc-in { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; min-height: 52px; padding-right: 60px; }
.gl-toc-plain { grid-template-columns: 1fr; }
.gl-toc-label { color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gl-toc-now { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.gl-toc-chev { width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); }
.gl-toc details[open] .gl-toc-chev { transform: rotate(-135deg) translateY(-3px); }
.gl-toc ol { margin: 0 auto; padding: 4px 0 14px; list-style: none; max-height: calc(100dvh - var(--gl-top, 77px) - 80px); overflow: auto; }
.gl-toc li a { display: block; padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink); font-size: 15px; text-decoration: none; }
.gl-toc li a[aria-current] { color: var(--blue-dark); font-weight: 700; }
.gl-toc-tools { position: absolute; inset: 0 0 auto 0; height: 52px; display: flex; align-items: center; justify-content: flex-end; pointer-events: none; }
.gl-toc-tools .gl-search-btn { pointer-events: auto; width: 44px; min-height: 40px; padding: 0; justify-content: center; }
.gl-toc-tools .gl-search-btn span:not(.gl-ico) { display: none; }
.gl-progress { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; background: var(--blue); transform: scaleX(0); transform-origin: left; }

/* guide page: previous and next */
.gl-pager { padding: 8px 0 56px; }
.gl-pager-where { margin: 0 0 12px; color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gl-pager > div { display: grid; gap: 12px; }
.gl-pn { display: grid; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.gl-pn:hover { border-color: var(--blue); }
.gl-pn span { color: var(--faint); font-size: 12px; font-weight: 700; }
.gl-pn strong { font: 600 19px/1.25 var(--serif); }

@media (max-width: 760px) {
  /* On a phone the site header is already two rows tall, so the search box scrolls away with the page. */
  .gl-searchbar { position: static; }
}
@media (min-width: 761px) {
  .gl-index .gl-hero { padding: 48px 0 12px; }
  .gl-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .gl-chips { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; overflow: visible; }
  .gl-searchbar .gl-field, .gl-found .gl-results { max-width: 760px; }
  .gl-dialog { height: auto; max-height: 82vh; margin-top: 8vh; border: 1px solid var(--line-strong); border-radius: 20px; }
  .gl-pager > div { grid-template-columns: 1fr 1fr; }
  .gl-pn-next { text-align: right; }
  .gl-pager { width: min(820px, calc(100% - 40px)); }
  .gl-toc-tools .gl-search-btn { width: auto; padding: 0 14px; }
  .gl-toc-tools .gl-search-btn span:not(.gl-ico) { display: inline; }
  .gl-toc-in { padding-right: 120px; }
}
