/* ============================================================
   LEARN BENTO — page shell only (loaded ONLY by learn.html)
   After learn.css. Does not touch lesson modal / unit / exercise styles.
   Palette matches Deb8er + learn tokens.
   Backout: remove this <link> from learn.html (or restore _learn.html.bak)
   ============================================================ */

:root {
  --lb-surface: rgba(255, 255, 255, 0.025);
  --lb-border: rgba(255, 255, 255, 0.07);
  --lb-border-hi: rgba(58, 190, 255, 0.22);
  --lb-radius: 16px;
  --lb-gap: 18px;
  --lb-blue: #3ABEFF;
  --lb-purple: #a68af9;
  --lb-muted: #9CA3AF;
  --lb-dim: #6B7280;
  --lb-grad: linear-gradient(135deg, #a68af9, #3ABEFF);
  --lb-grad-btn: linear-gradient(90deg, #a68af9, #3ABEFF);
  --lb-shadow-hi: 0 8px 28px rgba(58, 190, 255, 0.10);
}

/* ─── Page shell ─── */
.learn-section {
  max-width: 1160px;
  padding-left: 24px;
  padding-right: 24px;
}

.learn-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lb-gap);
  align-items: start;
}

.lb-span-4  { grid-column: span 4; }
.lb-span-6  { grid-column: span 6; }
.lb-span-8  { grid-column: span 8; }
.lb-span-12 { grid-column: span 12; }

/* ─── Shared tile surface (layout chrome only) ─── */
.learn-bento > .learn-header,
.learn-bento > .streak-reminder,
.learn-bento > #topSection,
.learn-bento > .learn-loading,
.learn-bento > .auth-message,
.learn-bento > .resources-section,
.learn-bento > #coursePath,
.learn-bento > .badges-section,
.learn-bento > .learn-debate-cta {
  min-width: 0;
}

.learn-header {
  margin-bottom: 0;
  padding: 4px 2px 0;
}

.streak-reminder {
  margin: 0;
}

#topSection {
  margin-bottom: 0;
}

.resources-section {
  margin-top: 0;
  margin-bottom: 0;
}

.badges-section {
  margin-top: 0;
  margin-bottom: 0;
}

.learn-loading {
  margin: 0;
  padding: 28px 0;
  text-align: center;
}

.auth-message {
  margin: 0;
}

/* ─── Top progress grid (level + quests + stats) ─── */
.lb-top {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lb-gap);
  align-items: stretch;
}

.lb-top .level-card {
  grid-column: span 8;
  margin-bottom: 0;
  height: 100%;
  box-sizing: border-box;
}

.lb-top .quests-card {
  grid-column: span 4;
  min-width: 0;
  height: 100%;
}

.lb-top .top-row {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--lb-gap);
  flex-wrap: unset;
}

.lb-top .top-row .stat-card {
  flex: unset;
  min-width: 0;
}

/* ─── Debate with Debix CTA (layout only — links to ai-debate.html) ─── */
.learn-debate-cta {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(135deg, rgba(166, 138, 249, 0.07) 0%, rgba(58, 190, 255, 0.05) 100%),
    var(--lb-surface);
  border: 1px solid rgba(166, 138, 249, 0.16);
  border-radius: var(--lb-radius);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.learn-debate-cta:hover {
  border-color: rgba(166, 138, 249, 0.32);
  transform: translateY(-2px);
  box-shadow: var(--lb-shadow-hi);
}

.learn-debate-cta:focus-visible {
  outline: 2px solid var(--lb-blue);
  outline-offset: 2px;
}

.learn-debate-cta-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 16px rgba(166, 138, 249, 0.25));
}

.learn-debate-cta-body {
  flex: 1;
  min-width: 0;
}

.learn-debate-cta-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lb-dim);
  margin-bottom: 4px;
}

.learn-debate-cta-label i {
  color: var(--lb-purple);
}

.learn-debate-cta-title {
  font-family: var(--heading-font, inherit);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #E5E7EB);
  margin: 0 0 6px;
}

.learn-debate-cta-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--lb-muted);
  margin: 0;
  max-width: 52ch;
}

.learn-debate-cta-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--lb-blue);
  background: rgba(58, 190, 255, 0.08);
  border: 1px solid rgba(58, 190, 255, 0.18);
}

.learn-debate-cta-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--lb-grad-btn);
  box-shadow: 0 4px 16px rgba(166, 138, 249, 0.28);
  white-space: nowrap;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.learn-debate-cta:hover .learn-debate-cta-btn {
  filter: brightness(1.1);
}

.learn-debate-cta-btn i {
  font-size: 11px;
}

/* ─── Focus ring on shell links ─── */
.learn-section a:focus-visible,
.learn-section button:focus-visible {
  outline: 2px solid var(--lb-blue);
  outline-offset: 2px;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .learn-bento {
    gap: 14px;
  }

  .lb-top {
    gap: 14px;
  }

  .lb-top .level-card,
  .lb-top .quests-card {
    grid-column: span 12;
  }

  .lb-top .top-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .learn-debate-cta {
    flex-wrap: wrap;
  }

  .learn-debate-cta-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .learn-section {
    max-width: 100%;
    padding-left: 14px;
    padding-right: 14px;
  }

  .learn-bento {
    gap: 12px;
  }

  .lb-span-4,
  .lb-span-6,
  .lb-span-8 {
    grid-column: span 12;
  }

  .lb-top {
    gap: 12px;
  }

  .lb-top .level-card,
  .lb-top .quests-card,
  .lb-top .top-row {
    grid-column: span 12;
  }

  .lb-top .top-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .learn-debate-cta {
    flex-direction: column;
    text-align: center;
    padding: 18px 16px;
    gap: 12px;
  }

  .learn-debate-cta-label {
    justify-content: center;
  }

  .learn-debate-cta-desc {
    max-width: none;
  }

  .learn-debate-cta-btn {
    width: 100%;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .lb-top .top-row {
    grid-template-columns: 1fr;
  }

  .learn-debate-cta-img {
    width: 56px;
    height: 56px;
  }
}
