/* toptradersbot Academy — public lesson pages. Light theme matching the app. */
:root {
  --bg: #f6f8fc; --panel: #fff; --panel2: #f1f5fb; --line: #e2e8f0; --text: #182235; --muted: #475263;
  --blue: #245bff; --blue2: #1746cd; --green: #116e40; --red: #b42839; --gold: #895907; --purple: #7c3aed;
  --cyan: #0891b2; --radius: 14px; --shadow: 0 1px 2px rgba(24, 34, 53, .05), 0 8px 24px rgba(24, 34, 53, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 Inter, "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 9; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* header & footer */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px); background: rgba(246, 248, 252, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-size: 17px; letter-spacing: -.01em; }
.brand small { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav a { padding: 7px 11px; border-radius: 999px; color: var(--muted); font-size: 15px; font-weight: 600; }
.top-nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.top-nav .app-link { background: var(--text); color: #fff; }
.top-nav .app-link:hover { background: var(--blue2); color: #fff; }
main { max-width: 1160px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 48px; }
.foot { border-top: 1px solid var(--line); padding: 28px clamp(16px, 4vw, 40px); text-align: center; font-size: 14px; }
.foot p { margin: 4px auto; max-width: 720px; }
.foot-links a { color: var(--muted); font-weight: 600; }

/* social links (footer) — round monochrome icons, brand colour on hover */
.social-links { margin: 0 auto 16px; }
.social-links ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 0; padding: 0; }
.social-link { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); border-radius: 12px; }
.social-link:hover { text-decoration: none; color: var(--text); }
.social-bubble { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); overflow: hidden;
  transition: color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.social-bubble::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--brand, var(--text)); opacity: 0; transition: opacity .2s ease; }
.social-icon { position: relative; display: block; }
.social-caption { font-size: 12px; font-weight: 600; line-height: 1.2; letter-spacing: .01em; }
.social-link:hover .social-bubble, .social-link:focus-visible .social-bubble { color: #fff; border-color: transparent; transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(24, 34, 53, .16); }
.social-link:hover .social-bubble::before, .social-link:focus-visible .social-bubble::before { opacity: 1; }
.social-link:focus { outline: none; }
.social-link:focus-visible .social-bubble { outline: 3px solid var(--blue); outline-offset: 3px; }
.social-x { --brand: #000; }
.social-facebook { --brand: #1877f2; }
.social-telegram { --brand: #229ed9; }
.social-instagram { --brand: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
@media (prefers-reduced-motion: reduce) {
  .social-bubble, .social-bubble::before { transition: none; }
  .social-link:hover .social-bubble, .social-link:focus-visible .social-bubble { transform: none; }
}

/* community strip (Academy home) */
.community { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-top: 20px;
  padding: 18px clamp(18px, 3vw, 28px); border: 1px solid #cfe6f5; border-radius: 18px; background: linear-gradient(135deg, #eaf6fd, #eef3ff); }
.community-text { flex: 1 1 320px; }
.community h2 { margin: 0 0 4px; font-size: 22px; }
.community p { margin: 0; color: var(--muted); font-size: 16px; }
.button.community-button { display: inline-flex; align-items: center; gap: 10px; background: #0f6fa3; color: #fff; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(15, 111, 163, .25); transition: background-color .2s ease, transform .2s ease; }
.button.community-button:hover { background: #0b5a85; transform: translateY(-1px); }
.button.community-button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* shared bits */
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.eyebrow a { color: inherit; }
.lead { font-size: 19px; color: var(--muted); max-width: 760px; }
h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; letter-spacing: -.025em; margin: 0 0 12px; }
h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.015em; margin: 0 0 12px; }
h3 { font-size: 19px; margin: 18px 0 8px; }
.button { display: inline-block; background: var(--blue); color: #fff; font-weight: 700; padding: 12px 20px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 700; cursor: pointer; }
.button:hover { background: var(--blue2); text-decoration: none; }
.button.ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.button.small { padding: 8px 14px; font-size: 15px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; letter-spacing: .02em; }
.level-beginner { background: #e7f6ee; color: var(--green); }
.level-intermediate { background: #e8eeff; color: var(--blue); }
.level-advanced { background: #f1eafe; color: var(--purple); }
.kind { font-size: 13px; color: var(--muted); font-weight: 600; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 18px; font-size: 14px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.crumbs li:last-child a { color: var(--muted); }

/* index */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: clamp(22px, 4vw, 44px); box-shadow: var(--shadow); }
.hero-logo { width: clamp(140px, 20vw, 220px); border-radius: 26px; box-shadow: 0 10px 30px rgba(36, 91, 255, .18); }
.progress { font-weight: 700; color: var(--green); }
.levels ul { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.levels li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 15px; color: var(--muted); }
.levels .badge { margin-right: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 6px; }
.chip { font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.track { margin-top: 38px; }
.track-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.track-head h2 { margin: 0; }
.track-head p { margin: 0; color: var(--muted); flex: 1 1 360px; }
.count { font-size: 13px; font-weight: 700; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: #b9c7ef; }
.card strong { font-size: 18px; line-height: 1.3; }
.card .summary { font-size: 15px; color: var(--muted); line-height: 1.5; }
.card-top { display: flex; align-items: center; gap: 8px; }
.mins { margin-left: auto; font-size: 13px; color: var(--muted); }
.done-flag { position: absolute; top: -9px; right: 12px; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.card.is-done { border-color: #9fd6b8; }
.card[hidden] { display: none; }

/* lesson */
.lesson-head { margin-bottom: 20px; }
.meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--muted); font-size: 15px; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.lesson-body { min-width: 0; }
.lesson-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 14px; }
.lesson-section h2 { font-size: 22px; }
.lesson-section p { margin: 0 0 12px; }
.lesson-section p:last-child, .lesson-section ul:last-child, .lesson-section ol:last-child { margin-bottom: 0; }
.lesson-section ul, .lesson-section ol { padding-left: 22px; margin: 0 0 12px; }
.lesson-section li { margin: 6px 0; }
.lesson-section li > ul, .lesson-section li > ol { margin: 6px 0; }
.one-sentence { background: linear-gradient(135deg, #eef3ff, #f7f2ff); border-color: #d6e0ff; font-size: 19px; }
.one-sentence h2 { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.key-points { border-left: 4px solid var(--green); }
.lesson-section code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.table-wrap { overflow-x: auto; margin: 0 0 12px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel2); font-weight: 700; }
.diagram { margin: 0 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.diagram img { display: block; width: 100%; border-radius: 10px; }
.diagram figcaption { font-size: 14px; color: var(--muted); padding: 8px 6px 2px; }
.diagram.photo img { max-height: 720px; object-fit: contain; background: #0f1320; }
.lesson-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.aside-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: 15px; }
.aside-box h2, .aside-box h3 { margin: 0 0 8px; font-size: 16px; }
.aside-box ul { padding-left: 18px; margin: 0 0 10px; }
.tags { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--panel2); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.terms, .sources { margin-top: 20px; font-size: 15px; }
.terms ul, .sources ul { padding-left: 18px; }
.sources h3 { font-size: 14px; color: var(--muted); }
.sources a { color: var(--muted); }
.mark-done { margin: 6px 0 4px; }
.mark-done.is-done { background: var(--green); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.pager a { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); font-weight: 700; }
.pager a:hover { text-decoration: none; border-color: #b9c7ef; }
.pager small { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.pager .next { text-align: right; }

/* questions */
.check { margin-top: 26px; }
.question { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; }
.question.big { font-size: 18px; border-width: 2px; }
.q { font-weight: 700; margin: 0 0 10px; }
.qn { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px; border-radius: 50%; background: var(--panel2); font-size: 14px; }
.options { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.option { width: 100%; text-align: left; font: inherit; font-size: 16px; background: var(--panel2); border: 1.5px solid transparent; border-radius: 10px;
  padding: 10px 14px; cursor: pointer; color: var(--text); }
.option:hover { border-color: #b9c7ef; }
.option.correct { background: #e7f6ee; border-color: var(--green); }
.option.wrong { background: #fdecee; border-color: var(--red); }
.option:disabled { cursor: default; }
.reveal summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: 15px; }
.reveal p { margin: 8px 0; }
.question.answered .reveal summary { display: none; }

.what-happened { margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--line); }
.what-happened h2 { font-size: 20px; margin-top: 0; }
.what-happened ul { padding-left: 20px; }
.source-note { font-size: 13px; color: var(--muted); }

/* glossary */
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; position: sticky; top: 62px; background: var(--bg); padding: 8px 0; z-index: 2; }
.letters a { width: 34px; height: 34px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
dl { margin: 0 0 20px; }
.term { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; scroll-margin-top: 120px; }
.term:target { border-color: var(--blue); box-shadow: 0 0 0 3px #e8eeff; }
dt { font-weight: 800; }
dd { margin: 4px 0 0; color: var(--text); }
.seen { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-aside { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; }
  .hero-logo { order: -1; width: 120px; }
  html { scroll-padding-top: 94px; }
  .top { padding: 8px 14px; gap: 4px 10px; flex-wrap: wrap; }
  .brand img { width: 32px; height: 32px; border-radius: 8px; }
  .brand strong { font-size: 15px; }
  .brand small { font-size: 10px; }
  .brand { flex-shrink: 0; }
  .top-nav { flex: 1 0 100%; flex-wrap: wrap; gap: 0; margin-left: 0; }
  .top-nav a { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
  .lead { font-size: 17px; }
  h1 { font-size: 30px; }
  .lesson-section { padding: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .social-caption { display: none; }
  .social-links ul { gap: 12px; }
  .community-button { width: 100%; justify-content: center; }
}
