/* WT Docs - Binance style */
:root{ --wt-primary:#f0b90b; --wt-bg:#0b0e11; --wt-panel:#0e1116; --wt-text:#eaecef; --wt-muted:#a7b1c2; }
.wt-docs{ color:var(--wt-text); background:var(--wt-bg); min-height:60vh; }
.wt-docs [data-theme='light']{ --wt-bg:#fff; --wt-panel:#f8fafc; --wt-text:#222; --wt-muted:#667085; }
.wt-docs .wt-hero{ background:var(--wt-panel); padding:40px 20px; border-bottom:1px solid #1f2a37; }
.wt-docs .brand{ max-width:920px; margin:0 auto; text-align:center; }
.wt-docs .brand .logo{ height:40px; margin-bottom:12px; }
.wt-docs .wt-hero h1{ font-size:32px; margin:8px 0 6px; }
.wt-docs .wt-hero p{ color:var(--wt-muted); margin:0 0 16px; }
.wt-docs .wt-hero .search{ display:flex; gap:8px; justify-content:center; }
.wt-docs input[type=search]{ background:#0b0f16; border:1px solid #1f2a37; color:var(--wt-text); padding:10px 12px; border-radius:8px; min-width:280px; }
.wt-docs .wt-hero button{ background:var(--wt-primary); border:none; border-radius:8px; padding:10px 14px; cursor:pointer; }

.wt-books-grid{ max-width:1100px; margin:24px auto; padding:0 16px; display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.book-card{ display:block; background:var(--wt-panel); border:1px solid #1f2a37; border-radius:14px; padding:16px; color:var(--wt-text); text-decoration:none; transition:transform .15s ease, border-color .15s ease; }
.book-card:hover{ transform:translateY(-2px); border-color:var(--wt-primary); }

/* Reader */
.wt-topbar{ position:sticky; top:0; z-index:40; background:var(--wt-panel); border-bottom:1px solid #1f2a37; padding:10px 14px; display:flex; justify-content:space-between; align-items:center; }
.wt-topbar .left{ display:flex; gap:12px; align-items:center; }
.wt-topbar .brand img{ height:22px; }
.wt-topbar a{ color:var(--wt-text); text-decoration:none; }
.wt-container{ display:grid; grid-template-columns:280px 1fr; gap:0; max-width:1200px; margin:0 auto; }
.wt-sidebar{ padding:18px 12px 24px; border-right:1px solid #1f2a37; min-height:calc(100vh - 52px); background:var(--wt-panel); }
.wt-sidebar .sticky{ position:sticky; top:52px; }
.wt-sidebar .sb-title{ font-weight:600; margin-bottom:6px; color:var(--wt-muted); text-transform:uppercase; letter-spacing:.04em; }
.wt-sidebar .wt-chapters-nav{ list-style:none; margin:0; padding:0; }
.wt-sidebar .wt-chapters-nav li{ margin:2px 0; }
.wt-sidebar .wt-chapters-nav a{ color:var(--wt-text); display:block; padding:8px 10px; border-radius:8px; text-decoration:none; }
.wt-sidebar li.active>a, .wt-sidebar a:hover{ background:#121823; border-left:2px solid var(--wt-primary); padding-left:8px; }
.wt-sidebar .child{ margin-left:12px; }

.content{ padding:24px; }
.breadcrumbs{ color:var(--wt-muted); font-size:14px; margin-bottom:12px; }
.breadcrumbs .sep{ margin:0 6px; color:#667085; }
.chapter h1{ font-size:28px; margin:8px 0 18px; }
.chapter h2{ font-size:22px; margin-top:24px; }
.chapter h3{ font-size:18px; margin-top:18px; }
.chapter pre, .chapter code{ background:#0b0f16; color:#d1d5db; padding:2px 6px; border-radius:6px; }
.chapter pre{ display:block; padding:12px; overflow:auto; border:1px solid #1f2a37; }
.chapter a{ color:var(--wt-primary); }
@media (max-width: 980px){
  .wt-container{ grid-template-columns:1fr; }
  .wt-sidebar{ display:none; }
  .content{ padding:16px; }
}


/* TOC right side */
.wt-toc{ position:sticky; top:64px; float:right; width:240px; margin:0 0 0 16px; display:none; }
.toc-box{ background:var(--wt-panel); border:1px solid #1f2a37; border-radius:12px; padding:12px; }
.toc-title{ font-weight:600; margin-bottom:8px; color:var(--wt-muted); text-transform:uppercase; font-size:12px; letter-spacing:.04em }
.toc-box ul{ list-style:none; margin:0; padding:0 }
.toc-box li{ margin:4px 0 }
.toc-box a{ color:var(--wt-text); text-decoration:none; font-size:14px }
.toc-box .lv3 a{ opacity:.85; padding-left:8px; display:block }

/* Search dropdown */
.wt-search-box{ background:var(--wt-panel); border:1px solid #1f2a37; border-radius:12px; max-height:380px; overflow:auto; }
.wt-s-item{ display:block; padding:10px 12px; text-decoration:none; color:var(--wt-text); border-bottom:1px solid #111827 }
.wt-s-item:hover{ background:#121823 }
.wt-s-item .t{ font-weight:600; margin-bottom:4px }
.wt-s-item .x{ color:var(--wt-muted); font-size:13px }
.wt-s-item.empty{ color:var(--wt-muted); }

/* Prev/Next */
.wt-prev-next{ display:flex; justify-content:space-between; align-items:center; border-top:1px solid #1f2a37; margin-top:24px; padding-top:14px }
.wt-prev-next a{ color:var(--wt-text); text-decoration:none; background:var(--wt-panel); border:1px solid #1f2a37; padding:10px 12px; border-radius:10px }
.wt-prev-next a:hover{ border-color:var(--wt-primary) }

@media (max-width: 1200px){
  .wt-toc{ display:none !important; }
}


/* --- v1.2.1: Hard reset against theme wrappers that constrain width --- */
.wt-docs .wt-container{ max-width:1280px; margin:0 auto; }
.wt-docs .content{ width:100%; max-width:none !important; }
.wt-docs .content > *{ max-width:none !important; }
.wt-docs .content .wp-block, 
.wt-docs .content .wp-block-group, 
.wt-docs .content .wp-block-columns, 
.wt-docs .content .wp-block-column{ max-width:none !important; margin-left:0; margin-right:0; }
.wt-docs .chapter, .wt-docs .book-intro{ max-width:none !important; }
.wt-docs .chapter p, .wt-docs .chapter ul, .wt-docs .chapter ol{ max-width:none !important; }
.wt-docs .chapter table{ width:100%; max-width:100%; table-layout:auto; }
.wt-docs .chapter img{ max-width:100%; height:auto; }

/* Ensure grid really has 2 columns only; remove unexpected theme floats */
.wt-docs .wt-container{ display:grid !important; grid-template-columns:280px 1fr !important; }
.wt-docs .wt-sidebar{ width:280px; }
.wt-docs .content{ grid-column:2 / 3; }

/* Remove theme padding that collapses our layout */
.wt-docs .content, .wt-docs .wt-sidebar{ padding:24px; }
.wt-docs .wt-sidebar{ padding-right:16px; }

/* Breadcrumb spacing fix */
.wt-docs .breadcrumbs{ margin:8px 0 18px; }

/* Header overlay safeguards */
.wt-docs .wt-topbar{ position:sticky; top:0; z-index:99; }


/* --- v1.2.2: Strong isolation vs theme flex/float/max-width rules --- */
.wt-docs{ position:relative; isolation:isolate; }
.wt-docs, .wt-docs *{ box-sizing:border-box; }

/* Kill floats/flex from parent themes inside our container */
.wt-docs .wt-container, 
.wt-docs .wt-container *{
  float:none !important;
  max-width:none !important;
}
.wt-docs .wt-container{ 
  display:grid !important; 
  grid-template-columns:300px minmax(0,1fr) !important; 
  gap:0 !important; 
  width:100% !important;
}
.wt-docs .wt-container > *{ width:auto !important; }

/* Sidebar pin + width */
.wt-docs .wt-sidebar{ width:300px !important; }
.wt-docs .wt-sidebar .sticky{ position:sticky; top:60px; }

/* Content column should stretch fully */
.wt-docs .content{ grid-column:2 / 3 !important; align-self:stretch; }

/* Prevent unexpected theme backgrounds/overlays */
.wt-docs .wt-sidebar, .wt-docs .content{ background:transparent !important; }

/* Tables & images still responsive */
.wt-docs .chapter table{ width:100%; max-width:100%; table-layout:auto; }
.wt-docs .chapter img{ max-width:100%; height:auto; display:block; }

@media (max-width: 980px){
  .wt-docs .wt-container{ grid-template-columns: 1fr !important; }
  .wt-docs .wt-sidebar{ display:none !important; }
}


/* --- v1.2.3: Mobile layout fixes --- */
@media (max-width: 980px){
  .wt-docs .wt-container{ grid-template-columns: 1fr !important; }
  .wt-docs .wt-sidebar{ display:none !important; }
  .wt-docs .content{ grid-column:1 / -1 !important; padding:16px !important; }
  .wt-docs .breadcrumbs{ font-size:13px; line-height:1.4; word-break:break-word; }
}
/* Prevent horizontal scroll on mobile */
.wt-docs{ overflow-x:hidden; }
/* Tables responsive scroll */
.wt-docs .chapter table{ display:block; overflow-x:auto; white-space:nowrap; }


/* TOC toggle button (mobile) */
.wt-toc-toggle{ display:none; margin:10px 0; padding:8px 12px; background:var(--wt-panel); border:1px solid #1f2a37; border-radius:8px; color:var(--wt-text); font-size:14px; }
@media (max-width: 980px){
  .wt-toc-toggle{ display:inline-block; }
  body.toc-open .wt-sidebar{ display:block !important; position:fixed; left:0; top:0; bottom:0; width:80%; max-width:320px; background:var(--wt-panel); z-index:9999; overflow:auto; padding:20px; }
  body.toc-open::after{ content:''; position:fixed; left:0; top:0; right:0; bottom:0; background:rgba(0,0,0,0.6); z-index:9998; }
}


/* Mobile TOC toggle & panel */
.wt-toc-mobile-wrap{ margin:6px 0 12px; display:none; }
.wt-toc-toggle{ background:var(--wt-primary); color:#111; border:none; border-radius:10px; padding:8px 12px; font-weight:600; cursor:pointer; }
.wt-toc-panel{ position:fixed; inset:0; background:rgba(0,0,0,.5); display:none; z-index:9999; }
.wt-toc-panel .panel-inner{ position:absolute; left:0; top:0; bottom:0; width:80%; max-width:340px; background:var(--wt-panel); border-right:1px solid #1f2a37; transform:translateX(-100%); transition:transform .2s ease; overflow:auto; }
.wt-toc-panel.open{ display:block; }
.wt-toc-panel.open .panel-inner{ transform:translateX(0); }
.wt-toc-panel .panel-head{ display:flex; align-items:center; justify-content:space-between; padding:12px; border-bottom:1px solid #1f2a37; }
.wt-toc-panel .panel-head .title{ font-weight:700; }
.wt-toc-panel .panel-head .close{ background:transparent; color:var(--wt-text); border:none; font-size:22px; line-height:1; cursor:pointer; }
.toc-mobile ul{ list-style:none; margin:0; padding:8px 8px 12px }
.toc-mobile li{ margin:2px 0 }
.toc-mobile a{ color:var(--wt-text); text-decoration:none; display:block; padding:8px 10px; border-radius:8px }
.toc-mobile .lv3 a{ opacity:.85; padding-left:20px }

@media (max-width: 980px){
  .wt-toc-mobile-wrap{ display:block; }
}


/* --- v1.2.8: Books index hardening against theme overrides --- */
.wt-index .wt-books-grid{
  display:grid !important;
  grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap:16px !important;
  list-style:none !important;
  padding:0 16px !important;
  max-width:1200px !important;
  margin:24px auto !important;
}
.wt-index .wt-books-grid > *{ margin:0 !important; }
.wt-index .book-card{
  display:block !important;
  background:var(--wt-panel) !important;
  border:1px solid #1f2a37 !important;
  border-radius:14px !important;
  padding:16px !important;
  color:var(--wt-text) !important;
  text-decoration:none !important;
  box-shadow:none !important;
  transition:transform .15s ease, border-color .15s ease !important;
}
.wt-index .book-card h3{ margin:0 0 6px !important; font-size:18px !important; }
.wt-index .book-card p{ margin:0 !important; color:var(--wt-muted) !important; }
.wt-index .book-card:hover{ transform:translateY(-2px) !important; border-color:var(--wt-primary) !important; }
.wt-index a{ color:inherit !important; }
.wt-index .wt-hero .search{ position:relative; }
@media (max-width: 680px){
  .wt-index .wt-books-grid{ grid-template-columns: 1fr !important; padding:0 12px !important; }
}


/* Mobile chapters toggle & panel (reuse slide panel) */
.wt-toc-mobile-wrap .wt-chapters-toggle{
  background:#121823; color:var(--wt-text); border:1px solid #1f2a37; border-radius:10px; padding:8px 12px; font-weight:600; cursor:pointer; margin-left:8px;
}
.wt-slide-panel{ position:fixed; inset:0; background:rgba(0,0,0,.5); display:none; z-index:9999; }
.wt-slide-panel .panel-inner{ position:absolute; left:0; top:0; bottom:0; width:80%; max-width:340px; background:var(--wt-panel); border-right:1px solid #1f2a37; transform:translateX(-100%); transition:transform .2s ease; overflow:auto; }
.wt-slide-panel.open{ display:block; }
.wt-slide-panel.open .panel-inner{ transform:translateX(0); }
.wt-slide-panel .panel-head{ display:flex; align-items:center; justify-content:space-between; padding:12px; border-bottom:1px solid #1f2a37; }
.wt-slide-panel .panel-head .title{ font-weight:700; }
.wt-slide-panel .panel-head .close{ background:transparent; color:var(--wt-text); border:none; font-size:22px; line-height:1; cursor:pointer; }

.chapters-mobile .wt-chapters-nav{ list-style:none; margin:0; padding:8px 8px 20px }
.chapters-mobile .wt-chapters-nav a{ color:var(--wt-text); text-decoration:none; display:block; padding:8px 10px; border-radius:8px }
.chapters-mobile .wt-chapters-nav li.active>a, .chapters-mobile .wt-chapters-nav a:hover{ background:#121823; border-left:2px solid var(--wt-primary); padding-left:8px }
.chapters-mobile .wt-chapters-nav .child{ margin-left:10px }


/* v1.2.14: Collapsible chapter tree */
.wt-sidebar .sb-title{ display:flex; align-items:center; justify-content:space-between; }
.sb-tools button{ background:#121823; color:var(--wt-text); border:1px solid #1f2a37; width:24px; height:24px; border-radius:6px; line-height:1; margin-left:6px; cursor:pointer }
.wt-tree{ list-style:none; margin:4px 0 0; padding:0 }
.wt-tree li{ position:relative; margin:2px 0; }
.wt-tree .twist{ width:20px; height:20px; margin-right:6px; border:none; background:transparent; cursor:pointer; vertical-align:middle; }
.wt-tree .twist::before{ content:''; display:inline-block; width:0; height:0; border-left:6px solid var(--wt-muted); border-top:5px solid transparent; border-bottom:5px solid transparent; transition:transform .12s ease; }
.wt-tree li[aria-expanded="true"] > .twist::before{ transform:rotate(90deg); border-left-color: var(--wt-primary); }
.wt-tree .twist.placeholder{ visibility:hidden }
.wt-tree a{ color:var(--wt-text); display:inline-block; padding:6px 10px; border-radius:8px; text-decoration:none; }
.wt-tree li.active>a{ background:#121823; border-left:2px solid var(--wt-primary); padding-left:8px }
.wt-tree ul.child{ margin-left:18px; padding-left:4px; border-left:1px dashed #1f2a37; }
.wt-tree li[aria-expanded="false"] > ul.child{ display:none; }
@media (max-width: 980px){
  .chapters-mobile .wt-tree{ padding:8px; }
  .chapters-mobile .wt-tree ul.child{ margin-left:14px; }
}

/* v1.2.15: Namespace chapters list to avoid theme .nav conflicts */
.wt-chapters-nav{ list-style:none; margin:0; padding:0; display:block !important; }
.wt-chapters-nav li{ float:none !important; display:block !important; }
.wt-chapters-nav a{ display:block; text-decoration:none; }

/* v1.2.16: Remove TOC */
#wt-toc-left, #wt-toc-panel, .wt-toc-toggle { display:none !important; }

/* v1.2.18: Sidebar tabs & sections */
.sb-tabs{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px }
.sb-tab{ background:#0e1116; border:1px solid #1f2a37; color:var(--wt-text); border-radius:10px; padding:8px 10px; cursor:pointer }
.sb-tab.active{ background:#121823; border-color:var(--wt-primary) }
.sb-pane{ display:none }
.sb-pane.active{ display:block }
.sb-section{ border-top:1px solid #1f2a37; padding-top:10px; margin-top:12px }
.sb-section:first-of-type{ border-top:none; padding-top:0; margin-top:0 }
.sb-section-title{ font-weight:700; margin:6px 0 8px; }
.sb-kv{ list-style:none; margin:0; padding:0 }
.sb-kv li{ display:flex; justify-content:space-between; gap:8px; padding:6px 0; border-bottom:1px dashed #1f2a37 }
.sb-kv li:last-child{ border-bottom:none }
.sb-actions{ display:flex; flex-wrap:wrap; gap:8px }
.btn.subtle{ background:#121823; color:var(--wt-text); border:1px solid #1f2a37; border-radius:8px; padding:6px 10px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; }
.btn.subtle:hover{ border-color:var(--wt-primary) }
.muted{ color:var(--wt-muted); }

@media (max-width: 980px){
  .sb-tabs{ display:none; } /* Hide tabs on mobile sidebar (mobile uses panel) */
}

/* v1.2.19: Force vertical tree for chapter lists (override theme bullets/columns) */
.wt-docs .wt-chapters-nav{
  list-style:none !important;
  margin:0 !important;
  padding:0 !important;
  display:block !important;
  column-count: initial !important;
  -webkit-column-count: initial !important;
  -moz-column-count: initial !important;
  columns: initial !important;
}
.wt-docs .wt-chapters-nav li{
  display:block !important;
  float:none !important;
  margin:2px 0 !important;
  break-inside: avoid !important;
  -webkit-column-break-inside: avoid;
  -moz-column-break-inside: avoid;
}
.wt-docs .wt-chapters-nav a{
  display:block !important;
  text-decoration:none !important;
  color:var(--wt-text) !important;
  padding:6px 10px !important;
  border-radius:8px !important;
}
.wt-docs .wt-chapters-nav .child{ margin-left:14px !important; padding-left:4px !important; border-left:1px dashed #1f2a37 !important; }

/* v1.3.1: TOC in sidebar with scroll-spy highlight */
.toc-left .toc-nav{ list-style:none; margin:0; padding:0 }
.toc-left .toc-nav li{ margin:2px 0 }
.toc-left .toc-nav a{ display:block; padding:6px 10px; color:var(--wt-text); text-decoration:none; border-radius:6px }
.toc-left .toc-nav a.active, .toc-left .toc-nav a:hover{ background:#121823; border-left:2px solid var(--wt-primary); padding-left:8px }
.toc-left .lv3 a{ opacity:.85; padding-left:18px }
/* WT FAQ & WT Steps */
.wt-faq .faq-title{ font-weight:700; margin:6px 0 10px }
.wt-faq .faq-item{ background:#0e1116; border:1px solid #1f2a37; border-radius:12px; padding:8px 12px; margin:8px 0 }
.wt-faq .faq-item summary{ cursor:pointer; list-style:none; font-weight:600; }
.wt-faq .faq-item summary::-webkit-details-marker{ display:none }
.wt-faq .faq-item summary::after{ content:'+'; float:right; opacity:.7 }
.wt-faq .faq-item[open] summary::after{ content:'−'; }
.wt-faq .faq-item .answer{ margin-top:6px; opacity:.95 }

.wt-steps .steps-title{ font-weight:700; margin:6px 0 10px }
.wt-steps ol.steps{ counter-reset: step; list-style:none; margin:0; padding:0 }
.wt-steps .step{ background:#0e1116; border:1px solid #1f2a37; border-radius:12px; padding:10px 12px; margin:10px 0 }
.wt-steps .st-head{ display:flex; align-items:center; gap:10px; font-weight:700 }
.wt-steps .st-num{ width:28px; height:28px; border-radius:50%; border:1px solid #1f2a37; display:inline-flex; align-items:center; justify-content:center; }
.wt-steps .st-num::before{ counter-increment: step; content: counter(step); }
.wt-steps .st-body{ margin-top:6px; opacity:.95 }
