/* =========================================================
   TextBases Article Components V1
   Standard article blocks: TOC, CTA, examples, tables,
   lists, troubleshooting, and content spacing.
   ========================================================= */

.tb-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}

.tb-article-body {
  display: grid;
  gap: 24px;
}

.tb-article-section {
  padding: var(--tb-card-pad);
}

.tb-content a {
  color: #7dd3fc;
  border-bottom: 1px solid rgba(125, 211, 252, 0.24);
}

.tb-content a:hover {
  color: #bae6fd;
  border-bottom-color: rgba(186, 230, 253, 0.55);
}

.tb-content ol,
.tb-content ul {
  padding-left: 1.35rem;
  margin-left: 0;
}

.tb-content li + li {
  margin-top: 0.52rem;
}

.tb-toc ol {
  display: grid;
  gap: 8px;
  padding-left: 1.1rem;
}

.tb-toc a {
  color: rgba(203, 213, 225, 0.86);
}

.tb-tool-cta-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.tb-code-sample,
.tb-content pre {
  width: 100%;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 16px;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-md);
  background: rgba(2, 6, 23, 0.78);
  color: rgba(226, 232, 240, 0.92);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
}

.tb-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--tb-radius-lg);
  border: 1px solid var(--tb-border);
}

.tb-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: rgba(15, 23, 42, 0.72);
}

.tb-table th,
.tb-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--tb-border-soft);
  text-align: left;
  vertical-align: top;
}

.tb-table th {
  color: var(--tb-text);
  background: rgba(56, 189, 248, 0.08);
}

@media (max-width: 900px) {
  .tb-article-layout,
  .tb-tool-cta-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .tb-tool-cta-card a {
    width: 100%;
  }

  .tb-article-section {
    padding-left: clamp(18px, 5vw, 24px);
    padding-right: clamp(18px, 5vw, 24px);
  }
}


/* =========================================================
   TextBases Article Components V1.1
   Polished article intro system: Quick Answer + On This Page.
   This intentionally overrides older article intro/card behavior.
   ========================================================= */

.tb-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: clamp(18px, 2.4vw, 28px);
  align-items: stretch;
  margin: clamp(24px, 4vw, 42px) 0 clamp(26px, 4vw, 46px);
}

.tb-article-layout > .tb-card,
.tb-article-layout > .tb-toc,
.tb-article-layout > aside,
.tb-article-layout > section {
  min-width: 0;
  max-width: 100%;
}

.tb-quick-answer,
.tb-article-layout .tb-card:first-child {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: clamp(26px, 3.6vw, 42px);
  border-radius: var(--tb-radius-2xl);
  border: 1px solid rgba(125, 211, 252, 0.20);
  background:
    radial-gradient(circle at 16% 12%, rgba(56, 189, 248, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.72));
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.tb-quick-answer::before,
.tb-article-layout .tb-card:first-child::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(56, 189, 248, 0.18), transparent 38%),
    radial-gradient(circle at 88% 82%, rgba(124, 58, 237, 0.18), transparent 30%);
  opacity: 0.58;
}

.tb-quick-answer > *,
.tb-article-layout .tb-card:first-child > * {
  position: relative;
  z-index: 1;
}

.tb-quick-answer h2,
.tb-article-layout .tb-card:first-child h2 {
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
  letter-spacing: -0.045em;
}

.tb-quick-answer p,
.tb-article-layout .tb-card:first-child p {
  max-width: 62ch;
  margin: 0;
  color: rgba(219, 234, 254, 0.86);
  font-size: clamp(1rem, 1.6vw, 1.08rem);
  line-height: 1.85;
}

.tb-toc,
.tb-article-layout aside {
  padding: clamp(22px, 3vw, 30px);
  border-radius: var(--tb-radius-2xl);
  border: 1px solid rgba(125, 211, 252, 0.18);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 34%),
    rgba(15, 23, 42, 0.76);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.tb-toc h2,
.tb-article-layout aside h2 {
  margin: 0 0 16px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.045em;
}

.tb-toc ol,
.tb-article-layout aside ol {
  list-style: none;
  counter-reset: tb-toc;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.tb-toc li,
.tb-article-layout aside li {
  margin: 0;
  padding: 0;
  line-height: 1.35;
  counter-increment: tb-toc;
}

.tb-toc a,
.tb-article-layout aside a {
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.34);
  color: rgba(241, 245, 249, 0.92);
  font-weight: 760;
  text-decoration: none;
  box-shadow: none;
}

.tb-toc a::before,
.tb-article-layout aside a::before {
  content: counter(tb-toc);
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(59, 130, 246, 0.16)),
    rgba(15, 23, 42, 0.92);
  color: #bfdbfe;
  font-size: 0.75rem;
  font-weight: 850;
  border: 1px solid rgba(125, 211, 252, 0.20);
}

.tb-toc a:hover,
.tb-article-layout aside a:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
}

.tb-toc a:hover::before,
.tb-article-layout aside a:hover::before {
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, 0.42);
}

@media (max-width: 900px) {
  .tb-article-layout {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    margin-top: 22px;
  }

  .tb-quick-answer,
  .tb-article-layout .tb-card:first-child {
    min-height: auto;
    padding: clamp(22px, 6vw, 30px);
  }

  .tb-toc,
  .tb-article-layout aside {
    padding: clamp(20px, 5vw, 26px);
  }

  .tb-toc a,
  .tb-article-layout aside a {
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  .tb-toc a,
  .tb-article-layout aside a {
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 10px 11px;
    gap: 9px;
    font-size: 0.94rem;
  }
}


/* =========================================================
   TextBases Article Components V1.1.1
   TOC counter hard fix.
   Fixes browsers showing all On This Page badges as 0.
   ========================================================= */

.tb-toc ol,
.tb-article-layout aside ol {
  counter-reset: tb-toc-step 0 !important;
}

.tb-toc li,
.tb-article-layout aside li {
  counter-increment: tb-toc-step 1 !important;
}

.tb-toc li > a::before,
.tb-article-layout aside li > a::before {
  content: counter(tb-toc-step) !important;
}

.tb-toc a::before,
.tb-article-layout aside a::before {
  content: counter(tb-toc-step) !important;
}

