/* Navigation: header menu, search palette, breadcrumbs, section tabs, footer sitemap. */
[id] { scroll-margin-top: 76px; }
kbd { font: 400 11px/1 var(--font-mono); padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); }

/* keyboard focus + skip link */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.search input:focus-visible, .pal-input input:focus-visible, main:focus-visible { outline: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 60; padding: 10px 14px; background: var(--ink); color: var(--bg); font-weight: 500; text-decoration: none; transition: top .15s; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
noscript p { max-width: 640px; margin: 80px auto; padding: 0 16px; font-size: 17px; }

.nav-wrap { display: flex; align-items: center; gap: 6px; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font: 400 14px/1 var(--font-body); margin-left: 8px;
}
.search-btn:hover { color: var(--ink); border-color: var(--line-2); }
.menu-toggle { display: none; width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; place-items: center; }
.menu-toggle .m-close { display: none; }
body.menu-open .menu-toggle .m-open { display: none; }
body.menu-open .menu-toggle .m-close { display: block; }

/* search box above the index */
.search { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 42px; min-width: min(360px, 100%); flex: 0 1 360px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.search:focus-within { border-color: var(--ink); }
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 15px var(--font-body); }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; text-decoration: underline; }

/* breadcrumbs + sticky section tabs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 400 13px/1.4 var(--font-mono); color: var(--muted); }
.crumbs a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.crumbs a:hover { color: var(--accent-text); }
.crumbs b { color: var(--ink); font-weight: 500; }
.subnav {
  position: sticky; top: 61px; z-index: 10; display: flex; align-items: center; gap: 2px; margin-top: 18px; padding: 6px 0;
  background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto;
}
.subnav a { flex: none; text-decoration: none; padding: 7px 10px; font-size: 14px; color: var(--ink-2); }
.subnav a b { font: 400 12px/1 var(--font-mono); color: var(--muted); margin-left: 4px; }
.subnav a:hover { color: var(--ink); background: var(--surface-2); }
.subnav-pager { margin-left: auto; display: flex; gap: 2px; }
.subnav-pager a { font-family: var(--font-mono); }

/* client page */
.client-hero { display: flex; gap: 28px; align-items: flex-start; margin-top: 28px; }
.client-mini { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.client-mini b { display: block; font: 600 15.5px/1.3 var(--font-head); }
.client-mini small { font-size: 13px; color: var(--muted); }
.client-mini:hover b { color: var(--accent-text); }
.client-mini .logo { width: 36px; height: 36px; font-size: 13px; }

/* back to top */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 25; width: 42px; height: 42px; border-radius: var(--radius); cursor: pointer;
  display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.to-top svg { width: 17px; height: 17px; transform: rotate(-90deg); }
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { border-color: var(--ink); }

/* search palette */
.palette { position: fixed; inset: 0; z-index: 50; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.pal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 12, .5); }
.pal-box { position: relative; width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); flex: none; }
.pal-input svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pal-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 17px var(--font-body); }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.pal-item.sel, .pal-item:hover { background: var(--surface-2); }
.pal-ic { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--cc); font-size: 0; overflow: hidden; }
.pal-ic svg { display: none; }
.pal-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pal-txt b { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-txt small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-kind { font: 400 11.5px/1 var(--font-mono); color: var(--muted); }
.pal-empty { padding: 28px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 18px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); flex: none; }
.pal-foot kbd { margin-right: 3px; }

/* footer sitemap */
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 36px; padding-bottom: 8px; }
.footer-links h5 { font: 400 12px/1 var(--font-mono); color: var(--muted); margin: 0 0 12px; }
.footer-links a { display: block; text-decoration: none; color: var(--ink-2); padding: 3px 0; font-size: 14px; }
.footer-links a:hover { color: var(--accent-text); }
.footer-note { font-size: 13px; color: var(--muted); }

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { padding: 0; width: 36px; justify-content: center; }
  .nav {
    position: fixed; left: 0; right: 0; top: 61px; z-index: 40; flex-direction: column; align-items: stretch; gap: 0; padding: 6px clamp(16px, 4vw, 40px) 14px;
    background: var(--bg); border-bottom: 1px solid var(--line-2);
    display: none;
  }
  body.menu-open .nav { display: flex; }
  .nav a { padding: 13px 0; font-size: 17px; border-bottom: 1px solid var(--line); }
  .nav a.active { text-underline-offset: 5px; }
  .client-hero { flex-direction: column; gap: 16px; }
  .logo.xl { width: 64px; height: 64px; font-size: 22px; }
}
@media (max-width: 620px) {
  .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-inner .muted { display: none; }
  .intro-links .btn.ghost { display: none; }
  .to-top { right: 12px; bottom: 12px; }
}
