/* TraderBear /learn/ + /blog/ — dark theme matching trader-bear.com homepage.
   Inherits the homepage design system: --bg #080808, --purple #7855ff,
   --teal #28cdcf, Fraunces display / Inter Tight UI / Be Vietnam Pro body. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;0,9..144,800;1,9..144,600;1,9..144,700;1,9..144,800&family=Space+Grotesk:wght@500;600;700&family=Inter+Tight:wght@500;600;700;800&family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

:root {
  --bg:        #080808;
  --bg-card:   #111114;
  --bg-card2:  #17171c;
  --bg-card3:  #232329;
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --purple:    #7855ff;
  --purple-lt: #ebdbff;
  --purple-dp: #4b2fd1;
  --teal:      #28cdcf;
  --teal-lt:   #9cecee;
  --coral:     #ff7a8a;
  --amber:     #ffb454;

  --text:    #ffffff;
  --text-2:  #b8b8c4;
  --text-3:  #6a6b76;

  --radius:      14px;
  --radius-sm:   10px;
  --radius-pill: 999px;

  --font-display: 'Fraunces', 'Inter Tight', Georgia, serif;
  --font-ui:      'Inter Tight', system-ui, sans-serif;
  --font-body:    'Be Vietnam Pro', 'Inter Tight', sans-serif;
  --font-brand:   'Space Grotesk', 'Inter Tight', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-width: 320px;
  /* subtle radial glow behind the content, like the homepage's hero ambient */
  background-image:
    radial-gradient(800px 600px at 50% -100px, rgba(120, 85, 255, 0.10), transparent 70%),
    radial-gradient(900px 700px at 90% 30%, rgba(40, 205, 207, 0.06), transparent 65%);
  background-attachment: fixed;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.tb-shell {
  max-width: 740px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  position: relative;
  z-index: 1;
}

/* ───────── Top nav ──────────────────────────────────────────────────── */
.tb-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  font-family: var(--font-ui);
  font-size: 14px;
}
.tb-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  transition: color 160ms ease;
}
.tb-nav a:hover { color: var(--text); }
.tb-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--brand-font, var(--font-brand));
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tb-nav .brand img {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: block;
}

/* ───────── Legal disclaimer banner (required, no RIA license) ───────── */
.tb-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin: 0 0 24px;
  background: rgba(255, 180, 84, 0.06);
  border: 1px solid rgba(255, 180, 84, 0.18);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  letter-spacing: 0.005em;
}
.tb-disclaimer::before {
  content: "i";
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--bg);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.tb-disclaimer strong { color: var(--text); font-weight: 600; }

/* ───────── Breadcrumb ───────────────────────────────────────────────── */
.tb-crumb {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 18px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.tb-crumb a { color: var(--text-3); text-decoration: none; }
.tb-crumb a:hover { color: var(--teal); }

/* ───────── Typography ───────────────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0 0 18px;
  text-wrap: balance;
}
.tb-lede {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.6;
  color: var(--text-2);
  margin: 0 0 44px;
  max-width: 64ch;
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 56px 0 18px;
}

h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 32px 0 10px;
}

p { margin: 0 0 18px; color: var(--text-2); }
p strong { color: var(--text); font-weight: 600; }

ul, ol { margin: 0 0 24px; padding-left: 22px; color: var(--text-2); }
li { margin-bottom: 8px; }
li > strong { color: var(--text); font-weight: 600; }

a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid rgba(40, 205, 207, 0.3);
  transition: color 160ms ease, border-color 160ms ease;
}
a:hover {
  color: var(--teal-lt);
  border-bottom-color: var(--teal-lt);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(120, 85, 255, 0.10);
  color: var(--purple-lt);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(120, 85, 255, 0.18);
}

pre {
  background: var(--bg-card2);
  color: var(--text);
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 24px;
}
pre code {
  background: none;
  padding: 0;
  border: 0;
  color: var(--text-2);
}

blockquote {
  border-left: 2px solid var(--teal);
  margin: 0 0 24px;
  padding: 4px 0 4px 20px;
  color: var(--text-2);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 24px;
  font-size: 14px;
  font-family: var(--font-ui);
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  color: var(--text-2);
}
th {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr:hover { background: rgba(120, 85, 255, 0.04); }

/* ───────── Callout block ────────────────────────────────────────────── */
.tb-callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--teal);
  padding: 18px 22px;
  margin: 0 0 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-2);
}

/* ───────── FAQ disclosure ───────────────────────────────────────────── */
.tb-faq {
  margin-top: 12px;
}
.tb-faq details {
  border-top: 1px solid var(--border);
  margin: 0;
  transition: background 200ms ease;
}
.tb-faq details:last-of-type { border-bottom: 1px solid var(--border); }
.tb-faq details[open] { background: rgba(120, 85, 255, 0.03); }

.tb-faq summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  padding: 16px 36px 16px 4px;
  list-style: none;
  position: relative;
  transition: color 160ms ease;
}
.tb-faq summary::-webkit-details-marker { display: none; }
.tb-faq summary:hover { color: var(--teal); }
.tb-faq summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  font-family: var(--font-ui);
  transition: transform 200ms ease, color 160ms ease;
}
.tb-faq details[open] summary::after {
  content: "−";
  color: var(--teal);
}
.tb-faq details[open] {
  padding-bottom: 10px;
}
.tb-faq details p {
  padding: 0 16px 8px 4px;
  color: var(--text-2);
}

/* ───────── CTA card (purple→teal gradient like hero accent) ────────── */
.tb-cta {
  margin: 56px 0 32px;
  padding: 28px 28px 26px;
  position: relative;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg,
      rgba(120, 85, 255, 0.20) 0%,
      rgba(75, 47, 209, 0.15) 50%,
      rgba(40, 205, 207, 0.12) 100%),
    var(--bg-card);
  border: 1px solid var(--border-strong);
  overflow: hidden;
}
.tb-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(40, 205, 207, 0.15), transparent 60%);
  pointer-events: none;
}
.tb-cta h3 {
  color: var(--text);
  margin: 0 0 8px;
  font-size: 19px;
  font-family: var(--font-ui);
  font-weight: 700;
  position: relative;
}
.tb-cta p {
  color: var(--text-2);
  margin: 0 0 18px;
  font-size: 15px;
  position: relative;
}
.tb-cta a.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.005em;
  border-bottom: 0;
  transition: transform 160ms ease, background 160ms ease;
  position: relative;
}
.tb-cta a.button:hover {
  background: var(--teal-lt);
  color: var(--bg);
  transform: translateY(-1px);
  border-bottom: 0;
}

/* ───────── Related reads ────────────────────────────────────────────── */
.tb-related {
  margin: 56px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.tb-related h3 {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin: 0 0 14px;
}
.tb-related ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tb-related li { margin-bottom: 8px; }
.tb-related a {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid transparent;
}
.tb-related a:hover {
  border-bottom-color: var(--teal-lt);
}

/* ───────── Article meta line ────────────────────────────────────────── */
.tb-meta {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 32px;
  letter-spacing: 0.01em;
}

/* ───────── Footer ───────────────────────────────────────────────────── */
footer.tb-footer {
  margin: 72px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
footer.tb-footer a {
  color: var(--text-3);
  border-bottom: 0;
}
footer.tb-footer a:hover { color: var(--text-2); border-bottom: 0; }

/* ───────── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tb-shell { padding: 22px 18px 48px; }
  h1 { font-size: clamp(26px, 7vw, 32px); }
  h2 { font-size: clamp(20px, 5.5vw, 24px); margin: 40px 0 14px; }
  .tb-lede { font-size: 15px; margin-bottom: 32px; }
  .tb-cta { padding: 22px 20px; }
  body { font-size: 15.5px; }
}

/* ───────── Print ────────────────────────────────────────────────────── */
@media print {
  body { background: #fff; color: #000; }
  .tb-nav, .tb-cta, .tb-related, footer.tb-footer { display: none; }
  h1, h2, h3, p, li, td { color: #000 !important; }
  a { color: #000; border-bottom: 0; }
}
