/*
  TextBases Core Template System V1
  File: /assets/css/textbases-components.css

  Purpose:
  - Reusable buttons, cards, hero, related sections, FAQ, tables, TOC, callouts
  - Shared by tool pages and article pages
*/

.tb-hero,
.tb-section,
.tb-card,
.tb-tool-card,
.tb-related-card,
.tb-example,
.tb-mini-card,
.tb-callout {
  border: 1px solid var(--tb-border);
  background:
    linear-gradient(180deg, var(--tb-surface), var(--tb-surface-soft)),
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 22rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tb-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--tb-radius-2xl);
  padding: 26px;
  background:
    linear-gradient(135deg, var(--tb-surface-strong), rgba(15, 23, 42, 0.72)),
    radial-gradient(circle at 88% 0%, rgba(56, 189, 248, 0.18), transparent 18rem);
  box-shadow: var(--tb-shadow-blue);
}

.tb-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background:
    linear-gradient(90deg, rgba(96, 165, 250, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(96, 165, 250, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, black, transparent 82%);
}

.tb-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 920px;
}

.tb-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 900;
}

.tb-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--tb-cyan);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.9);
}

.tb-hero h1 {
  margin: 0;
  color: var(--tb-heading);
  font-size: clamp(34px, 5.4vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.tb-lead {
  margin: 16px 0 0;
  max-width: 860px;
  color: var(--tb-text);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.7;
}

.tb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tb-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.32);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 850;
}

.tb-btn,
.tb-btn-primary {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 15px;
  width: 100%;
  height: 50px;
  min-height: 50px;
  max-height: 50px;
  padding: 0 14px;
  margin: 0;
  position: relative;
  top: 0;
  line-height: 1;
  background: rgba(15, 23, 42, 0.74);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s ease;
}

.tb-btn:hover {
  border-color: rgba(96, 165, 250, 0.54);
  color: var(--tb-heading);
  transform: translateY(-1px);
}

.tb-btn-primary {
  border-color: rgba(37, 99, 235, 0.9);
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.22);
}

.tb-icon {
  width: 17px;
  height: 17px;
  min-width: 17px;
  flex: 0 0 17px;
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.tb-section {
  margin-top: 16px;
  border-radius: 26px;
  padding: 26px;
}

.tb-section h2,
.tb-related-title h2 {
  margin: 0 0 10px;
  color: var(--tb-heading);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.tb-section p {
  margin: 0 0 14px;
  color: #a8bfd8;
  font-size: 15px;
  line-height: 1.8;
}

.tb-section ol,
.tb-section ul {
  margin: 14px 0 0;
  padding-left: 30px;
}

.tb-section li {
  padding-left: 8px;
  margin: 10px 0;
  color: #b8c7dc;
  line-height: 1.76;
}

.tb-section li::marker {
  color: var(--tb-blue-link);
  font-weight: 900;
}

.tb-grid-2,
.tb-grid-3,
.tb-related-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.tb-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tb-grid-3,
.tb-related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tb-mini-card {
  border-radius: 18px;
  padding: 18px;
}

.tb-mini-card strong,
.tb-related-card strong {
  display: block;
  color: var(--tb-heading);
  font-size: 16px;
  margin-bottom: 8px;
}

.tb-mini-card p,
.tb-related-card p {
  margin: 0;
  color: var(--tb-text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.tb-faq {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.tb-faq-item {
  border: 1px solid var(--tb-border-soft);
  border-radius: 18px;
  padding: 16px;
  background: rgba(2, 6, 23, 0.26);
}

.tb-faq-item h3 {
  margin: 0 0 8px;
  color: var(--tb-heading);
  font-size: 17px;
}

.tb-faq-item p {
  margin: 0;
}

.tb-related-title {
  margin: 28px 2px 14px;
}

.tb-related-title p {
  margin: 6px 0 0;
  max-width: 720px;
  color: var(--tb-text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.tb-related-card {
  display: block;
  text-decoration: none;
  border-radius: 20px;
  padding: 18px;
  transition: 0.22s ease;
}

.tb-related-card:hover {
  transform: translateY(-3px);
  border-color: rgba(96, 165, 250, 0.68);
  box-shadow: var(--tb-shadow-card);
}

.tb-toc ol {
  list-style: none;
  counter-reset: toc;
  padding-left: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.tb-toc li {
  counter-increment: toc;
  margin: 0;
  padding: 0;
}

.tb-toc li a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--tb-border-soft);
  border-radius: 13px;
  background: rgba(2, 6, 23, 0.24);
  color: #dbeafe;
  text-decoration: none;
  font-weight: 850;
  line-height: 1.2;
}

.tb-toc li a::before {
  content: counter(toc);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
  color: var(--tb-blue-link);
  font-size: 12px;
  font-weight: 950;
}

.tb-callout {
  padding: 20px 22px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.tb-callout strong {
  display: block;
  margin: 0;
  color: var(--tb-heading);
  font-size: 15px;
  line-height: 1.35;
}

.tb-callout p {
  margin: 0;
  color: #b8c7dc;
  font-size: 14px;
  line-height: 1.72;
}

.tb-table-wrap {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  margin-top: 14px;
}

.tb-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.tb-table th,
.tb-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.13);
  vertical-align: top;
}

.tb-table th {
  color: var(--tb-heading);
  background: rgba(15, 23, 42, 0.72);
  font-size: 13px;
}

.tb-table td {
  color: #a8bfd8;
  font-size: 14px;
  line-height: 1.65;
}

.tb-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .tb-hero,
  .tb-section {
    padding: 20px;
    border-radius: 24px;
  }

  .tb-grid-2,
  .tb-grid-3,
  .tb-related-grid {
    grid-template-columns: 1fr;
  }

  .tb-btn,
  .tb-btn-primary {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
  }

  .tb-section ol,
  .tb-section ul {
    padding-left: 26px;
  }

  .tb-section li {
    padding-left: 6px;
  }

  .tb-callout {
    min-height: 0;
    padding: 18px;
  }
}


/* TextBases Global Card/Grid Mobile Safety V1 */
.tb-grid-2,
.tb-grid-3,
.tb-related-grid,
.tb-tool-grid,
.tb-action-bar {
  min-width: 0;
}

.tb-grid-2 > *,
.tb-grid-3 > *,
.tb-related-grid > *,
.tb-tool-grid > *,
.tb-action-bar > * {
  min-width: 0;
}

@media (max-width: 768px) {
  .tb-grid-2,
  .tb-grid-3,
  .tb-related-grid {
    grid-template-columns: 1fr !important;
  }
}


/* =========================================================
   TextBases Article Mobile Overflow HARD Fix V2
   Strong override for mobile article overflow caused by parent
   width, pre/code/table, grids, long links, and nested cards.
   ========================================================= */

html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

.tb-page,
.tb-article-page,
.tb-article-layout,
.tb-article-body,
.tb-content,
.tb-section,
.tb-card,
.tb-article-section,
.tb-callout,
.tb-mini-card,
.tb-faq,
.tb-faq-item,
.tb-tool-cta-card,
.tb-related-title,
.tb-related-grid,
.tb-related-card,
.tb-table-wrap {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.tb-content *,
.tb-section *,
.tb-article-section *,
.tb-callout *,
.tb-faq-item *,
.tb-tool-cta-card *,
.tb-related-card * {
  box-sizing: border-box !important;
  min-width: 0 !important;
}

.tb-content p,
.tb-content li,
.tb-content a,
.tb-content strong,
.tb-content span,
.tb-content h1,
.tb-content h2,
.tb-content h3,
.tb-section p,
.tb-section li,
.tb-section a,
.tb-section strong,
.tb-section h2,
.tb-section h3,
.tb-article-section p,
.tb-article-section li,
.tb-article-section a,
.tb-article-section strong,
.tb-article-section h2,
.tb-article-section h3 {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  word-wrap: break-word !important;
}

.tb-code-sample,
.tb-content pre,
.tb-content code,
.tb-article-section pre,
.tb-article-section code,
pre,
code {
  max-width: 100% !important;
  overflow-x: auto !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.tb-table-wrap {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.tb-table {
  width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 900px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .tb-page,
  .tb-article-page {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .tb-hero,
  .tb-section,
  .tb-card,
  .tb-article-section,
  .tb-callout,
  .tb-mini-card,
  .tb-faq-item,
  .tb-tool-cta-card,
  .tb-related-title,
  .tb-related-card {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    overflow: hidden !important;
  }

  .tb-article-layout,
  .tb-article-body,
  .tb-grid-2,
  .tb-grid-3,
  .tb-related-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 14px !important;
  }

  .tb-tool-cta-card {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .tb-tool-cta-card a {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .tb-content ol,
  .tb-content ul,
  .tb-section ol,
  .tb-section ul,
  .tb-toc ol {
    padding-left: 1.15rem !important;
    margin-left: 0 !important;
  }

  .tb-content li,
  .tb-section li {
    padding-left: 0.25rem !important;
  }

  .tb-code-sample,
  .tb-content pre,
  .tb-article-section pre {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
  }
}

@media (max-width: 420px) {
  .tb-page,
  .tb-article-page {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .tb-hero,
  .tb-section,
  .tb-card,
  .tb-article-section,
  .tb-callout,
  .tb-mini-card,
  .tb-faq-item,
  .tb-tool-cta-card,
  .tb-related-card {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}


/* =========================================================
   TextBases Footer System V1
   Shared footer for migrated tool/article pages.
   ========================================================= */

.tb-site-footer {
  width: 100%;
  margin-top: 72px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 34%),
    rgba(2, 6, 23, 0.72);
}

.tb-site-footer__inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 2fr);
  gap: 36px;
}

.tb-site-footer__brand p {
  max-width: 460px;
  margin: 14px 0 0;
  color: rgba(203, 213, 225, 0.76);
  line-height: 1.75;
}

.tb-site-footer__links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.tb-site-footer__links div {
  display: grid;
  gap: 10px;
  align-content: start;
}

.tb-site-footer__links strong {
  color: rgba(248, 250, 252, 0.94);
  font-size: 0.94rem;
}

.tb-site-footer__links a {
  color: rgba(203, 213, 225, 0.72);
  text-decoration: none;
  line-height: 1.45;
}

.tb-site-footer__links a:hover {
  color: #7dd3fc;
}

@media (max-width: 760px) {
  .tb-site-footer {
    margin-top: 54px;
  }

  .tb-site-footer__inner {
    width: min(100% - 28px, 1180px);
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 32px 0;
  }

  .tb-site-footer__links {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
