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

  Purpose:
  - Global design tokens
  - Base typography
  - Page container
  - Dark futuristic TextBases foundation

  Do not put tool-specific or article-specific layout here.
*/

:root {
  --tb-bg: #020617;
  --tb-bg-soft: #07111f;
  --tb-surface: rgba(15, 23, 42, 0.78);
  --tb-surface-strong: rgba(15, 23, 42, 0.96);
  --tb-surface-soft: rgba(15, 23, 42, 0.58);
  --tb-surface-deep: rgba(2, 6, 23, 0.34);

  --tb-border: rgba(51, 65, 85, 0.92);
  --tb-border-soft: rgba(148, 163, 184, 0.14);
  --tb-border-blue: rgba(96, 165, 250, 0.34);

  --tb-text: #cbd5e1;
  --tb-text-soft: #94a3b8;
  --tb-text-muted: #64748b;
  --tb-heading: #f8fafc;

  --tb-blue: #2563eb;
  --tb-blue-soft: #60a5fa;
  --tb-blue-link: #93c5fd;
  --tb-cyan: #38bdf8;

  --tb-radius-sm: 12px;
  --tb-radius-md: 16px;
  --tb-radius-lg: 20px;
  --tb-radius-xl: 24px;
  --tb-radius-2xl: 30px;
  --tb-radius-hero: 32px;

  --tb-shadow-blue: 0 24px 80px rgba(37, 99, 235, 0.18);
  --tb-shadow-panel: 0 22px 70px rgba(0, 0, 0, 0.26);
  --tb-shadow-card: 0 18px 44px rgba(37, 99, 235, 0.12);

  --tb-page-width: 1180px;
  --tb-article-width: 1140px;
  --tb-mobile-gutter: 16px;

  --tb-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tb-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(37, 99, 235, 0.22), transparent 32rem),
    radial-gradient(circle at 88% 6%, rgba(56, 189, 248, 0.12), transparent 28rem),
    linear-gradient(180deg, var(--tb-bg) 0%, var(--tb-bg-soft) 44%, var(--tb-bg) 100%);
  color: var(--tb-text);
  font-family: var(--tb-font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--tb-blue-link);
}

.tb-page {
  width: min(var(--tb-page-width), calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 86px;
}

.tb-article-page {
  width: min(var(--tb-article-width), calc(100% - 32px));
}

.tb-breadcrumb {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 12px;
  color: var(--tb-text-soft);
  font-size: 13px;
  font-weight: 750;
}

.tb-breadcrumb a,
.tb-back-home {
  color: #bfdbfe;
  text-decoration: none;
}

.tb-back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 850;
  opacity: 0.95;
  transition: 0.2s ease;
}

.tb-back-home:hover {
  color: var(--tb-heading);
  transform: translateX(-2px);
}

.tb-soft-link,
.tb-content a {
  color: var(--tb-blue-link);
  text-decoration: none;
  font-weight: 850;
  border-bottom: 1px solid rgba(147, 197, 253, 0.34);
}

.tb-soft-link:hover,
.tb-content a:hover {
  color: #bfdbfe;
  border-bottom-color: rgba(191, 219, 254, 0.72);
}

@media (max-width: 900px) {
  .tb-page,
  .tb-article-page {
    width: calc(100% - var(--tb-mobile-gutter));
    padding-top: 16px;
  }
}


/* =========================================================
   TextBases Global Navbar
   Locked direction: dark template color, fixed top, mobile hamburger
   ========================================================= */

.tb-site-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  border-bottom: 1px solid rgba(51, 65, 85, 0.82);
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.97), rgba(7, 17, 31, 0.94)),
    radial-gradient(circle at 16% 0%, rgba(56, 189, 248, 0.10), transparent 20rem);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tb-site-navbar__inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tb-site-brand {
  display: inline-flex;
  align-items: center;
  color: #f8fafc;
  font-size: 21px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.tb-site-brand span {
  color: #38bdf8;
}

.tb-site-navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-site-navlinks a {
  color: #dbeafe;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  padding: 10px 12px;
  border-radius: 999px;
  transition: 0.18s ease;
}

.tb-site-navlinks a:hover {
  color: #f8fafc;
  background: rgba(37, 99, 235, 0.16);
}

.tb-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.tb-nav-toggle svg {
  width: 24px;
  height: 24px;
}

.tb-mobile-nav {
  display: none;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 14px;
  padding: 10px;
  border: 1px solid rgba(51, 65, 85, 0.82);
  border-radius: 20px;
  background: rgba(2, 6, 23, 0.72);
}

.tb-mobile-nav a {
  display: block;
  color: #dbeafe;
  text-decoration: none;
  font-weight: 850;
  padding: 12px 14px;
  border-radius: 14px;
}

.tb-mobile-nav a:hover {
  background: rgba(37, 99, 235, 0.16);
}

body {
  padding-top: 72px;
}

.tb-page {
  padding-top: 24px;
}

@media (max-width: 820px) {
  .tb-site-navbar__inner {
    min-height: 64px;
    width: min(100% - 24px, 1180px);
  }

  .tb-site-navlinks {
    display: none;
  }

  .tb-nav-toggle {
    display: inline-flex;
  }

  .tb-mobile-nav.is-open {
    display: block;
  }

  body {
    padding-top: 64px;
  }

  .tb-page {
    padding-top: 18px;
  }
}

/* Better visible before/after samples for whitespace articles */
.tb-code-sample {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.55);
  color: #dbeafe;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: normal;
  font-size: 13px;
  line-height: 1.7;
}


/* =========================================================
   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;
  }
}
