/* Two-column doc page: sidebar (search + tree) on the left, content on the right.
   Top bar and footer come from page chrome and stay full-width. */

.ckit-doc--main {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Plain-text sidebar — no border, no background. The site's own .html-wrapper
   dashed left rule must not apply here either. */
.ckit-sidebar,
.ckit-doc--main .ckit-sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  font-size: 13px;
  background: transparent;
  border: 0;
  border-left: 0;
  padding: 0;
  margin: 0;
}

.ckit-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  margin-bottom: 8px;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  font: inherit;
  background: #fff;
  /* Stay anchored at the top of the sidebar even while the tree below scrolls. */
  position: sticky;
  top: 0;
  z-index: 1;
}

.ckit-search:focus {
  outline: none;
  border-color: #0587b9;
  box-shadow: 0 0 0 2px rgba(5, 135, 185, 0.2);
}

.ckit-tree {
  display: block;
}

.ckit-tree-section {
  margin: 6px 0;
}

.ckit-tree-section > summary {
  cursor: pointer;
  font-weight: 600;
  color: #444;
  padding: 2px 0;
  list-style: none;
}

.ckit-tree-section > summary::-webkit-details-marker { display: none; }
.ckit-tree-section > summary::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  color: #999;
  transition: transform 0.12s;
}
.ckit-tree-section[open] > summary::before {
  transform: rotate(90deg);
}

.ckit-tree-section ul {
  list-style: none;
  margin: 4px 0 4px 14px;
  padding: 0;
}

.ckit-tree-section li {
  padding: 1px 0;
  line-height: 1.3em !important;
}

.ckit-tree-section li[hidden] {
  display: none;
}

.ckit-tree-section li a {
  color: #0587b9;
  text-decoration: none;
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
}

.ckit-tree-section li a:hover {
  background: rgba(5, 135, 185, 0.1);
}

.ckit-tree-section li.current a {
  background: rgba(5, 135, 185, 0.15);
  color: #024c69;
  font-weight: 600;
}

.ckit-tree-hint {
  display: block;
  margin: 0 0 0 4px;
  font-size: 11px;
  color: #888;
  font-style: italic;
}

.ckit-tree-error {
  color: #b00;
  font-size: 12px;
  margin: 8px 0 0;
}

.ckit-content {
  min-width: 0; /* allow grid item to shrink */
}

.ckit-content h1:first-child {
  margin-top: 0;
}

/* Version + status badges rendered above the article header */
.ckit-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  margin: 0 0 8px;
}

.ckit-badge {
  background: #eef2f7;
  color: #4a5b6b;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #dfe5ec;
}

.ckit-badge--deprecated {
  background: #fff3cd;
  color: #876600;
  border-color: #ffe58a;
}

.ckit-badge--since {
  background: #e7f5ec;
  color: #2c7a3a;
  border-color: #c3e6c8;
}

/* Member list table — used by the auto-rendered Properties / Methods
   sections (Phase 1+: prose may be empty but the structure renders). */
.ckit-members {
  margin: 16px 0;
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.ckit-members th,
.ckit-members td {
  border-bottom: 1px solid #ececec;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.ckit-members th {
    background: #e4eded;
    color: #25528d;
    font-weight: 600;
    font-size: 1.2em;
    padding: 10px 8px 6px;
}

.ckit-members td.ckit-members--name {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 13px;
  white-space: nowrap;
  color: #444;
}

.ckit-members td.ckit-members--sig {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  color: #777;
}

.ckit-members td.ckit-members--doc {
  color: #444;
}

/* Hover-tooltip for /canvaskit/* links inside the article body. Populated via
   ajax fetch with a canonical-reference top line, lead paragraph, and (for
   enum pages) the full members table. */
.ckit-type-tip {
  position: absolute;
  display: none;
  max-width: 480px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  background: #2a2a2a;
  color: #f5f5f5;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  pointer-events: none;
}

.ckit-type-tip.ckit-type-tip--open { display: block; }

.ckit-tip-canon {
  font-size: 11px;
  margin-bottom: 4px;
  color: #cfd8dc;
}
.ckit-tip-canon code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #fff;
}

.ckit-tip-lead {
  margin: 0 0 6px;
}

.ckit-tip-table {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 6px;
}
.ckit-tip-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.ckit-tip-table th,
.ckit-tip-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
  color: #e3e3e3;
}
.ckit-tip-table th {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}
.ckit-tip-table code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0 3px;
  border-radius: 2px;
  font-size: 10px;
}
.ckit-tip-table a {
  color: #6cc7ff;
  text-decoration: none;
}

/* Mobile-only nav toggle: shown in the top-left, labeled with the current
   page title. Tap to slide the sidebar in as an overlay. */
.ckit-nav-toggle {
  display: none;
}

.ckit-nav-toggle--icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 18px;
  line-height: 1;
}

/* Close button next to the search input — hidden on desktop, visible while
   the overlay is open on mobile. */
.ckit-nav-close {
  display: none;
}

.ckit-sidebar--searchrow {
  display: contents;
}

.ckit-nav-backdrop {
  display: none;
}

@media (max-width: 760px) {
  .ckit-doc--main {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 0;
  }

  .ckit-nav-toggle {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin: 0 0 8px;
    padding: 6px 10px;
    border: 1px solid #25528d;
    border-radius: 6px;
    background: #d8f6ff;
    color: #25528d;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ckit-nav-toggle:active {
    background: #a4f0d3;
  }

  .ckit-nav-toggle--label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Full-screen overlay at the page's own background — no dialog look. */
  .ckit-sidebar {
    position: fixed !important;
    top: 56px !important;
    left: 0;
    right: 0;
    bottom: 2px !important;
    max-height: none;
    margin: 4px !important;
    padding: 12px 14px 16px;
    background: #ffffff !important;
    box-shadow: none;
    z-index: 2;
    /* Translate plus visibility/pointer-events so the off-screen panel can't
       capture clicks at the left edge while closed. */
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.18s ease-out, visibility 0s linear 0.18s;
    overflow-y: auto;
  }

  body.ckit-nav-open .ckit-sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.18s ease-out, visibility 0s linear 0s;
  }

  /* Search + close button sit on one flex row, sticky to the top of the
     overlay so the close affordance stays reachable while the tree scrolls. */
  .ckit-sidebar--searchrow {
    display: flex;
    gap: 8px;
    align-items: stretch;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .ckit-sidebar--searchrow .ckit-search {
    flex: 1;
    margin-bottom: 0;
    position: static;
  }

  .ckit-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #25528d;
    border-radius: 6px;
    background: #d8f6ff;
    color: #25528d;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .ckit-nav-close:active {
    background: #a4f0d3;
  }

  /* Backdrop is irrelevant when the overlay is full-width; keep it removed
     from layout so it doesn't add a row to the grid. */
  .ckit-nav-backdrop,
  body.ckit-nav-open .ckit-nav-backdrop {
    display: none;
  }

  /* Lock background scroll while the overlay is open. */
  body.ckit-nav-open {
    overflow: hidden;
  }
}
