/* Learn hub styles — mirrors the BinDec design tokens (English-only section). */
:root {
  --bg: #0f1420;
  --card: #171e2e;
  --border: #263049;
  --text: #e8ecf4;
  --muted: #9aa4bd;
  --accent: #4f8cff;
  --accent2: #8b5cf6;
  --accent-soft: rgba(79, 140, 255, .12);
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 96px; }
::selection { background: rgba(79, 140, 255, .35); }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Header / nav (mirrors site chrome) */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 32, .9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.nav {
  max-width: 860px; margin: 0 auto; padding: .8rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: nowrap; gap: .8rem;
}
.nav-links {
  display: flex; gap: .4rem; flex-wrap: nowrap; overflow-x: auto; align-items: center;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { flex-shrink: 0; color: var(--muted); text-decoration: none; font-size: .92rem; padding: .6rem .8rem; border-radius: 8px; }
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }
.nav-links a.active { color: var(--text); background: var(--accent-soft); }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; flex: none; }
.brand:hover { color: var(--accent); }
.brand-mark { display: inline-flex; flex: none; }
.brand-mark svg { display: block; }

/* Layout */
main { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 1rem 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); margin: 0 0 .6rem; letter-spacing: -.02em; line-height: 1.12; }
.hero .lede { color: var(--muted); font-size: 1.08rem; max-width: 42rem; margin: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.4rem; }

/* Article typography */
.article { max-width: 68ch; }
.article h2 { font-size: 1.45rem; letter-spacing: -.015em; margin: 2rem 0 .7rem; }
.article h2::after { content: ""; display: block; width: 2.6rem; height: 3px; border-radius: 2px; margin-top: .45rem; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.article h3 { font-size: 1.12rem; margin: 1.4rem 0 .4rem; }
.article p, .article li { color: #c9d1e3; }
.article p { margin: 0 0 1rem; }
.article ul, .article ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.article li { margin-bottom: .35rem; }
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(79, 140, 255, .1); padding: .1em .35em; border-radius: 6px; font-size: .92em; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; margin: 0 0 1.2rem; }
/* Contain unwrapped tables on narrow screens: internal scroll, never page overflow */
.card table, .content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
thead th { background: rgba(79, 140, 255, .07); }
th, td { text-align: start; padding: .55rem .7rem; border-bottom: 1px solid var(--border); font-family: ui-monospace, monospace; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(79, 140, 255, .05); }
th { color: var(--muted); font-family: inherit; font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
td.eq { white-space: nowrap; }

/* Code blocks */
pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem; overflow-x: auto; font-size: .9rem; margin: 0 0 1.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* FAQ accordions */
.faq { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 .6rem; background: var(--card); }
.faq summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::marker { content: ""; }
.faq summary::after { content: "+"; flex: none; color: var(--accent); font-size: 1.25rem; font-weight: 700; line-height: 1; }
.faq[open] summary::after { content: "\2212"; }
.faq .faq-a { padding: 0 1.1rem 1rem; margin: 0; color: #c9d1e3; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* Try-it boxes */
.try-box { border: 1px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, rgba(79,140,255,.45), rgba(139,92,246,.28)) border-box; }
.try-box h2 { margin-top: 0; }
.try-box h2::after { display: none; }
.try-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.btn-link {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: .95rem;
  color: #fff; background: linear-gradient(135deg, #4f8cff, #7c5cff);
  padding: .65rem 1.1rem; border-radius: 10px; box-shadow: 0 4px 18px rgba(79,140,255,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-link:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(79,140,255,.45); color: #fff; }

/* Takeaways */
.takeaways { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .55rem; }
.takeaways li { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem .75rem 2.4rem; position: relative; color: #c9d1e3; }
.takeaways li::before { content: "✓"; position: absolute; left: .95rem; color: var(--accent); font-weight: 700; }

/* Hub topic cards */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; margin: 1.4rem 0; }
.topic-card { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.topic-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(20, 40, 90, .4); }
.topic-num { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .15rem .6rem; margin-bottom: .6rem; }
.topic-card h2 { font-size: 1.08rem; margin: 0 0 .4rem; color: var(--text); }
.topic-card p { font-size: .9rem; color: var(--muted); margin: 0; }

/* Related links */
.related { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.related h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.related h2::after { display: none; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.related a { text-decoration: none; }
.related a:hover { text-decoration: underline; }
@media (max-width: 560px) { .related { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { color: var(--muted); font-size: .88rem; padding: 1.6rem 1rem 2.4rem; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.5rem; max-width: 860px; margin: 0 auto; text-align: start; }
.footer-tag { margin: .4rem 0; }
.footer-copy { margin: 0; font-size: .82rem; }
.footer-h { font-weight: 700; color: var(--text); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .5rem; }
.footer-nav { display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.footer-nav a:hover { color: var(--accent); }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* Skip link + back-to-top */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 0; }
#toTop { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 20; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#toTop:hover { border-color: var(--accent); color: var(--accent); }
#toTop[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #dfe6f2;
  --text: #141d33;
  --muted: #4e5c82;
  --accent: #2b64f5;
  --accent2: #8b5cf6;
  --accent-soft: rgba(43, 100, 245, .10);
}
[data-theme="light"] .site-header { background: rgba(255, 255, 255, .88); }

/* Theme toggle (mirrors main stylesheet) */
.theme-toggle { background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; padding: .45rem .55rem; display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 44px; min-height: 44px; }
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
