/* Standalone Kokoho Guide Documentation System */

.guide-body #gate-screen {
  min-height: calc(100vh - 54px);
}

/* Dedicated Guide Header */
.guide-topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  min-height: 54px;
  background: rgba(13, 20, 32, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: grid;
  grid-template-columns: auto minmax(200px, 480px) auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.guide-tb-left,
.guide-tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-tb-right {
  justify-content: flex-end;
}

.guide-mobile-nav-btn {
  display: none;
}

.guide-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.guide-brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.guide-brand-sub {
  color: var(--accent);
  font-weight: 700;
  padding-left: 2px;
}

/* Instant Search Bar & Results Popover */
.guide-tb-search {
  position: relative;
  width: 100%;
}

.guide-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.guide-search-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.guide-search-input {
  width: 100%;
  height: 36px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 58px 0 34px;
  font-size: 0.87rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.guide-search-input:focus {
  border-color: rgba(110, 231, 183, 0.55);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.guide-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.guide-search-kbd {
  position: absolute;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
}

.guide-search-clear {
  position: absolute;
  right: 34px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.guide-search-clear:hover {
  background: rgba(148, 163, 184, 0.32);
}

.guide-search-results {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: min(440px, 72vh);
  overflow-y: auto;
  background: #101826;
  border: 1px solid rgba(110, 231, 183, 0.28);
  border-radius: 12px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.62);
  padding: 6px;
  z-index: 65;
}

.guide-search-hit {
  display: block;
  padding: 9px 11px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  margin-bottom: 3px;
}

.guide-search-hit:last-child {
  margin-bottom: 0;
}

.guide-search-hit:hover,
.guide-search-hit.is-selected {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(110, 231, 183, 0.32);
}

.guide-search-hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.guide-search-hit-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.guide-search-hit-badge {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.guide-search-hit-heading {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}

.guide-search-hit-snippet {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.42;
}

.guide-search-hit mark {
  background: rgba(110, 231, 183, 0.24);
  color: #ecfdf5;
  border-radius: 3px;
  padding: 0 2px;
}

.guide-search-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* 3-Column Documentation Layout */
.guide-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 236px;
  min-height: calc(100vh - 54px);
  max-width: 1560px;
  margin: 0 auto;
}

/* Left Section & Article Index Rail */
.guide-rail {
  border-right: 1px solid var(--border);
  background: #0d1420;
  padding: 18px 14px 36px;
  position: sticky;
  top: 54px;
  max-height: calc(100vh - 54px);
  overflow-y: auto;
}

.guide-rail-title {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
  padding: 0 8px;
}

.guide-section {
  margin-bottom: 12px;
}

.guide-section-heading {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text);
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 5px;
  user-select: none;
}

.guide-section-heading::-webkit-details-marker {
  display: none;
}

.guide-section-heading:hover {
  background: rgba(255, 255, 255, 0.06);
}

.guide-section-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
}

.guide-nav-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
}

.guide-nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.38;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.guide-nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.guide-nav-link.active {
  color: var(--accent);
  background: rgba(16, 185, 129, 0.12);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Center Article Pane */
.guide-main {
  padding: 28px 36px 64px;
  min-width: 0;
}

.guide-article {
  max-width: 820px;
  margin: 0 auto;
}

.guide-eyebrow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.guide-breadcrumb {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.guide-audience-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.32);
}

.guide-article h1 {
  margin: 0 0 10px;
  font-size: 1.82rem;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.guide-lead {
  font-size: 1.03rem;
  color: #cbd5e1;
  margin: 0 0 22px;
  line-height: 1.6;
}

.guide-article h2 {
  margin: 30px 0 12px;
  font-size: 1.24rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
  scroll-margin-top: 76px;
}

.guide-article h3 {
  margin: 18px 0 7px;
  font-size: 1.02rem;
  color: var(--accent);
  scroll-margin-top: 76px;
}

.guide-article p {
  margin: 0 0 13px;
  color: var(--text);
}

.guide-article ul,
.guide-article ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text);
}

.guide-article li {
  margin-bottom: 8px;
}

.guide-article code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.guide-article pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Cards, Steps, Callouts & Swatches */
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 14px 0 18px;
}

.guide-card h3:first-child {
  margin-top: 0;
}

.guide-card p:last-child,
.guide-card ul:last-child,
.guide-card ol:last-child {
  margin-bottom: 0;
}

.guide-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.guide-feature-grid .guide-card {
  margin: 0;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 20px;
}

.guide-step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
}

.guide-step-num {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(110, 231, 183, 0.5);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.guide-step-body h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 1rem;
}

.guide-step-body p {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.93rem;
}

.guide-callout {
  border-radius: 11px;
  padding: 14px 16px;
  margin: 16px 0 18px;
  border: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.55;
}

.guide-callout-tip {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(110, 231, 183, 0.38);
  color: #d1fae5;
}

.guide-callout-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-ink);
}

.guide-callout-info {
  background: rgba(56, 189, 248, 0.11);
  border-color: rgba(125, 211, 252, 0.38);
  color: #e0f2fe;
}

/* Monitor Color Swatches */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}

.swatch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 15px;
}

.swatch-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.swatch-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.94rem;
}

.swatch-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  flex-shrink: 0;
}

.swatch-calm { border-top: 3px solid #22c55e; }
.dot-calm { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.55); }

.swatch-yellow { border-top: 3px solid #eab308; }
.dot-yellow { background: #eab308; box-shadow: 0 0 8px rgba(234, 179, 8, 0.55); }

.swatch-orange { border-top: 3px solid #f97316; }
.dot-orange { background: #f97316; box-shadow: 0 0 8px rgba(249, 115, 22, 0.55); }

.swatch-red { border-top: 3px solid #ef4444; }
.dot-red { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.65); }

/* Map Shape Visual Demos */
.shape-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 20px;
}

.shape-card {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.shape-preview {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  background: #0a0f18;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.demo-wide-ring {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.18);
  border: 2px dashed #ef4444;
}

.demo-solid-puck {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.75);
}

.demo-air-tether {
  width: 40px;
  height: 40px;
  position: relative;
}

.demo-air-tether::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.35);
  border: 2px solid #22d3ee;
}

.demo-air-tether::after {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 7px;
  width: 26px;
  height: 2px;
  background: #22d3ee;
  transform: rotate(-42deg);
  transform-origin: left bottom;
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.75);
}

/* Agency Color Chips & UI Pills */
.agency-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.agency-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.chip-ice { color: #fca5a5; background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.5); }
.chip-dhs-air { color: #f9a8d4; background: rgba(236, 72, 153, 0.18); border-color: rgba(236, 72, 153, 0.5); }
.chip-cbp { color: #fdba74; background: rgba(249, 115, 22, 0.18); border-color: rgba(249, 115, 22, 0.5); }
.chip-hsi { color: #fde047; background: rgba(234, 179, 8, 0.18); border-color: rgba(234, 179, 8, 0.5); }
.chip-fps { color: #d8b4fe; background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.5); }
.chip-leo { color: #7dd3fc; background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.5); }
.chip-drone { color: #67e8f9; background: rgba(6, 182, 212, 0.18); border-color: rgba(6, 182, 212, 0.5); }
.chip-sar { color: #86efac; background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.5); }

.pill-demo {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  margin: 1px 2px;
}

.pill-demo-accent {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(110, 231, 183, 0.45);
  color: var(--accent);
}

/* Spec & Legend Tables */
.guide-article .table-wrap {
  overflow-x: auto;
  margin: 14px 0 20px;
}

.guide-article table.spec {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.87rem;
}

.guide-article table.spec th,
.guide-article table.spec td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.guide-article table.spec tr:last-child td {
  border-bottom: none;
}

.guide-article table.spec th {
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Previous / Next Article Cards */
.guide-prev-next {
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.guide-pn-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 16px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.guide-pn-card:hover {
  border-color: rgba(110, 231, 183, 0.48);
  background: var(--surface-alt);
}

.guide-pn-next {
  text-align: right;
  align-items: flex-end;
}

.guide-pn-dir {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
}

.guide-pn-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
}

/* Right Rail ("On This Page" TOC) */
.guide-toc-rail {
  border-left: 1px solid var(--border);
  padding: 24px 14px 36px;
  position: sticky;
  top: 54px;
  max-height: calc(100vh - 54px);
  overflow-y: auto;
}

.guide-toc-empty {
  visibility: hidden;
}

.guide-toc-heading {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
  padding: 0 8px;
}

.guide-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-toc-link {
  display: block;
  padding: 5px 8px;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid var(--border);
  transition: color 0.12s ease, border-color 0.12s ease;
}

.guide-toc-link:hover {
  color: var(--text);
}

.guide-toc-h3 {
  padding-left: 18px;
  font-size: 0.77rem;
}

.guide-toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Responsive Breakpoints */
@media (max-width: 1160px) {
  .guide-shell {
    grid-template-columns: 256px minmax(0, 1fr);
  }

  .guide-toc-rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .guide-topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "search search";
    gap: 8px;
    padding: 8px 12px;
  }

  .guide-tb-left {
    grid-area: left;
  }

  .guide-tb-right {
    grid-area: right;
  }

  .guide-tb-search {
    grid-area: search;
  }

  .guide-mobile-nav-btn {
    display: inline-flex;
  }

  .guide-shell {
    grid-template-columns: 1fr;
  }

  .guide-rail {
    display: none;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .guide-rail.mobile-open {
    display: block;
  }

  .guide-main {
    padding: 20px 16px 48px;
  }

  .guide-prev-next {
    grid-template-columns: 1fr;
  }

  .guide-pn-next {
    text-align: left;
    align-items: flex-start;
  }

  .shape-card {
    align-items: flex-start;
  }
}
