/* ============================================
   xrayGraphDB — Learn / Explained
   Layered, plain-English explainer styles.
   Themed to style.css dark palette (tokens reused).
   ============================================ */

/* --- Learn layout: sticky sidebar TOC + content --- */
.learn-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

.learn-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 0.9rem;
}
.learn-toc h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.learn-toc ol {
  list-style: none;
  border-left: 1px solid var(--border-subtle);
}
.learn-toc li { margin: 0; }
.learn-toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  line-height: 1.35;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.learn-toc a:hover {
  color: var(--text-primary);
  border-left-color: var(--accent-blue);
}

@media (max-width: 900px) {
  .learn-layout { grid-template-columns: 1fr; gap: 0; }
  .learn-toc { display: none; }
}

/* --- Hero --- */
.learn-hero {
  text-align: center;
  padding: 96px 0 56px;
  border-bottom: 1px solid var(--border-subtle);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 153, 255, 0.08), transparent 70%);
}
.learn-hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  margin-bottom: 14px;
}
.learn-hero .tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 14px;
}
.learn-hero .blurb {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}
.learn-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-blue);
  border: 1px solid var(--border-accent);
  background: rgba(0, 153, 255, 0.06);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 22px;
}

/* --- Section blocks --- */
.learn-section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.learn-section:last-of-type { border-bottom: none; }
.learn-section h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  margin-bottom: 6px;
}
.learn-section .kicker {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 10px;
}
.learn-section .lead {
  font-size: 1.12rem;
  color: var(--text-primary);
  max-width: 70ch;
  margin: 14px 0;
}
.learn-section p {
  color: var(--text-secondary);
  max-width: 70ch;
  margin: 12px 0;
}
.learn-section .analogy {
  border-left: 3px solid var(--accent-blue);
  padding: 4px 0 4px 18px;
  margin: 18px 0;
  color: var(--text-primary);
  font-size: 1.05rem;
}
.learn-section ul.plain {
  margin: 14px 0;
  padding-left: 0;
  list-style: none;
  max-width: 70ch;
}
.learn-section ul.plain li {
  position: relative;
  padding-left: 26px;
  margin: 9px 0;
  color: var(--text-secondary);
}
.learn-section ul.plain li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--accent-blue);
  font-weight: 700;
}

/* --- "Go deeper" expandable --- */
.go-deeper {
  margin: 22px 0 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
}
.go-deeper > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.go-deeper > summary::-webkit-details-marker { display: none; }
.go-deeper > summary::before {
  content: "\25B8";
  transition: transform 0.2s ease;
  color: var(--text-muted);
}
.go-deeper[open] > summary::before { transform: rotate(90deg); }
.go-deeper > summary:hover { background: var(--bg-card-hover); }
.go-deeper .gd-body {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border-subtle);
}
.go-deeper .gd-body p { color: var(--text-secondary); }

/* --- Code sample --- */
.learn-code {
  background: #0c0c14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--green);
  overflow-x: auto;
  margin: 14px 0;
  line-height: 1.7;
}
.learn-code .cmt { color: var(--text-muted); }
.learn-code .kw  { color: var(--accent-blue); }
.translate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}
.translate .t-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.translate .t-card h5 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
@media (max-width: 640px) { .translate { grid-template-columns: 1fr; } }

/* --- Stat highlight inline --- */
.stat-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--green);
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  font-size: 0.95em;
}

/* ============================================
   CONSOLIDATION DIAGRAM  (N boxes -> 1 box)
   ============================================ */
.consolidate {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  margin: 36px 0;
}
@media (max-width: 760px) {
  .consolidate { grid-template-columns: 1fr; }
  .consolidate .arrow-col { transform: rotate(90deg); justify-self: center; }
}
.consolidate .col-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-align: center;
}
.before-stack {
  position: relative;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
}
.before-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.db-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.db-box small {
  display: block;
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.tangle-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 14px;
}
.arrow-col {
  font-size: 2rem;
  color: var(--accent-blue);
  text-align: center;
}
.after-box {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.10), rgba(0, 153, 255, 0.04));
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-lg);
  padding: 34px 20px;
  text-align: center;
  box-shadow: var(--shadow-glow);
}
.after-box .name {
  font-size: 1.2rem;
  font-weight: 800;
}
.after-box .name span { color: var(--accent-blue); }
.after-box .tags {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.after-box .tags span {
  font-size: 0.72rem;
  background: rgba(0, 153, 255, 0.10);
  border: 1px solid var(--border-accent);
  color: var(--accent-blue);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ============================================
   SPEED BAR
   ============================================ */
.speed-chart {
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 760px;
}
.speed-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
}
.speed-row .lbl {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: right;
}
.speed-row .lbl strong { color: var(--text-primary); display: block; }
.speed-track {
  position: relative;
  height: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.speed-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #06121a;
  white-space: nowrap;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.speed-fill.blink   { width: 100%;  background: var(--text-muted); color: var(--text-primary); }
.speed-fill.cross   { width: 38%;   background: var(--orange); }
.speed-fill.warm    { width: 4%;    min-width: 6px; background: var(--green); }
.speed-row .ext {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  margin-left: 8px;
}
.speed-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}
@media (max-width: 640px) {
  .speed-row { grid-template-columns: 1fr; }
  .speed-row .lbl { text-align: left; }
}

/* ============================================
   DOTS-AND-STRINGS GRAPH ILLUSTRATION (SVG)
   ============================================ */
.graph-illo {
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 8px auto 0;
  display: block;
}
.graph-illo .edge { stroke: var(--border-accent); stroke-width: 1.5; }
.graph-illo .edge-hot { stroke: var(--accent-blue); stroke-width: 2; }
.graph-illo .node { fill: var(--bg-card); stroke: var(--accent-blue); stroke-width: 2; }
.graph-illo .node-hot { fill: var(--accent-blue); }
.graph-illo .node-lbl { fill: var(--text-secondary); font-size: 9px; font-family: var(--font-sans); text-anchor: middle; }
.graph-illo .edge-lbl { fill: var(--text-muted); font-size: 7.5px; font-family: var(--font-mono); text-anchor: middle; }

/* ============================================
   CARD GRID (links to chapter deep-dives)
   ============================================ */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 28px 0;
}
.chapter-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  color: var(--text-primary);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chapter-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.chapter-card .num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-blue);
}
.chapter-card h3 {
  font-size: 1.08rem;
  margin: 8px 0 6px;
}
.chapter-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}
.chapter-card .more {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
}

/* --- Try-it CTA band --- */
.try-band {
  text-align: center;
  padding: 72px 24px;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(0, 153, 255, 0.10), transparent 70%);
  border-top: 1px solid var(--border-subtle);
}
.try-band h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 12px; }
.try-band p { color: var(--text-secondary); max-width: 560px; margin: 0 auto 28px; }
.try-band .btn-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Chapter prev/next nav --- */
.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin: 48px 0 8px;
  padding-top: 28px;
  border-top: 1px solid var(--border-subtle);
}
.chapter-nav .cn-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chapter-nav .cn-link:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}
.chapter-nav .cn-hub { color: var(--text-muted); }
.chapter-nav .cn-next { color: var(--accent-blue); }
@media (max-width: 560px) {
  .chapter-nav { flex-direction: column; align-items: stretch; }
  .chapter-nav .cn-link { text-align: center; }
}
