﻿/*!
 * Adeeb Al-Silwy - Responsive layout for text lesson page (v2)
 * Coherent design across all screen sizes (xs -> 2xl).
 */

/* ---------- base fluid typography ---------- */
.adeeb-lesson-body { font-size: clamp(14.5px, 1.1vw + 12px, 16px); overflow-wrap: anywhere; word-break: break-word; }
.adeeb-lesson-body h1 { font-size: clamp(1.35rem, 4vw, 1.7rem); }
.adeeb-lesson-body h2 { font-size: clamp(1.15rem, 3vw, 1.35rem); word-break: break-word; }
.adeeb-lesson-body h3 { font-size: clamp(1.02rem, 2.6vw, 1.15rem); }
.adeeb-lesson-body h4 { font-size: clamp(0.96rem, 2.4vw, 1.05rem); }

/* ---------- headings: anchors + accent bar ---------- */
.adeeb-lesson-body h1,
.adeeb-lesson-body h2,
.adeeb-lesson-body h3,
.adeeb-lesson-body h4,
.adeeb-lesson-body h5,
.adeeb-lesson-body h6 { scroll-margin-top: 100px; }

.adeeb-lesson-body h2 {
  position: relative;
  padding-inline-start: 14px;
  margin-top: 1.9em;
}
.adeeb-lesson-body h2::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, #3b74c4, #7c5cff);
}
.dark-mode .adeeb-lesson-body h2::before {
  background: linear-gradient(180deg, #6ea8ff, #a78bfa);
}

/* ---------- images ---------- */
.adeeb-lesson-body img,
.text-lesson-contents img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 12px;
  display: block;
  margin: 0.6em auto;
}

/* ---------- code blocks: scrollable, never overflow ---------- */
.adeeb-lesson-body pre,
.adeeb-code pre {
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
}
.adeeb-lesson-body code { font-size: 0.94em; }

/* ---------- tables ---------- */
.adeeb-lesson-body table {
  width: 100%;
  margin: 1.2em 0;
}
.adeeb-lesson-body th,
.adeeb-lesson-body td { vertical-align: top; }

/* on small screens: table scrolls horizontally instead of breaking layout */
@media (max-width: 767.98px) {
  .adeeb-lesson-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: separate;
  }
  .adeeb-lesson-body th { white-space: nowrap; min-width: 110px; }
  .adeeb-lesson-body td { white-space: normal; min-width: 130px; }
}

/* ---------- callouts / blockquotes ---------- */
.adeeb-lesson-body blockquote,
.adeeb-lesson-body .alert-info,
.adeeb-lesson-body .callout {
  border-radius: 12px;
  padding: 12px 16px;
}

/* ---------- TOC ---------- */
.adeeb-lesson-body .blog-toc,
.adeeb-lesson-body [class*="toc"] {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
  margin: 1em 0;
}
.dark-mode .adeeb-lesson-body .blog-toc,
.dark-mode .adeeb-lesson-body [class*="toc"] {
  background: #0d1526;
  border-color: #26324e;
}
.adeeb-lesson-body [class*="toc"] ul { padding-inline-start: 1.2em; margin: 0; }

/* ---------- page header card ---------- */
.text-lesson-header .rounded-32 { padding: 16px !important; }
@media (min-width: 992px) {
  .text-lesson-header .rounded-32 { padding: 32px !important; }
}
.text-lesson-header h1 { overflow-wrap: anywhere; line-height: 1.35; }
@media (min-width: 992px) {
  .text-lesson-header .rounded-32 {
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  }
}

/* ---------- content card ---------- */
.text-lesson-contents { padding: 16px !important; }
@media (min-width: 768px) { .text-lesson-contents { padding: 24px !important; } }
@media (min-width: 1200px) { .text-lesson-contents { padding: 32px !important; } }
@media (min-width: 992px) {
  .text-lesson-contents { box-shadow: 0 24px 60px rgba(15, 23, 42, 0.06); }
}

/* ---------- sidebar ---------- */
@media (max-width: 991.98px) {
  .text-lesson-contents { border-radius: 20px !important; }
  .col-lg-3 .card-with-mask { margin-bottom: 16px; }
}
@media (min-width: 992px) {
  .text-lesson-sidebar {
    position: sticky;
    top: 16px;
    align-self: flex-start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: #d4dce8 transparent;
  }
  .text-lesson-sidebar::-webkit-scrollbar { width: 6px; }
  .text-lesson-sidebar::-webkit-scrollbar-thumb {
    background: #d4dce8;
    border-radius: 99px;
  }
  .text-lesson-sidebar::-webkit-scrollbar-track { background: transparent; }
}

/* ---------- bottom fixed bar ---------- */
.text-lesson-bottom-fixed-card {
  padding-block: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
  border-top: 1px solid #eef2f7;
}
@media (max-width: 575.98px) {
  .text-lesson-bottom-fixed-card .btn { width: 100%; justify-content: center; }
  .text-lesson-bottom-fixed-card .container { gap: 8px; }
}

/* ---------- hero height ----------
   The header card overlaps the hero by 119px, so the hero must stay tall
   enough that the cover image remains visible below/behind it.          */
@media (max-width: 575.98px) {
  .text-lesson-hero { height: 240px !important; }
}
@media (min-width: 576px) and (max-width: 991.98px) {
  .text-lesson-hero { height: 300px !important; }
}

/* ---------- long links / slugs ---------- */
.adeeb-lesson-body a { overflow-wrap: anywhere; }
