/* ── LESSON PAGE ──────────────────────────────────────────────────────────────── */

.lesson-layout {
  display: flex;
  gap: 24px;
  padding: 20px 24px 40px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Main content */
.lesson-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero section */
.lesson-hero { padding: 4px 0 0; }
.lesson-title {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  color: var(--on-surf);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.lesson-summary { font-size: 14px; color: var(--on-surf-var); line-height: 1.6; }

/* YouTube embed */
.yt-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--outline-hi);
  flex-shrink: 0;
}
.yt-wrapper iframe,
.yt-wrapper img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Prerequisites */
.prereq-callout {
  border-left: 4px solid var(--tertiary);
  background: rgba(163,201,228,0.06);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 12px 16px;
}
.prereq-callout p { font-size: 13.5px; color: var(--on-surf); margin-top: 6px; }

/* Lesson section */
.lesson-section { display: flex; flex-direction: column; gap: 12px; }

/* Resources */
.resources-list { display: flex; flex-direction: column; gap: 10px; }
.resource-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surf);
  border: 1px solid var(--outline);
  border-radius: var(--r-md);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.resource-card:hover { border-color: var(--outline-hi); }
.resource-icon { font-size: 24px; flex-shrink: 0; }
.resource-info { flex: 1; min-width: 0; }
.resource-title { font-size: 13.5px; font-weight: 600; color: var(--on-surf); margin-bottom: 3px; }
.resource-desc  { font-size: 12px; color: var(--on-surf-var); margin-bottom: 6px; }
.resource-meta  { display: flex; align-items: center; gap: 8px; }
.resource-size, .resource-dl-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--on-surf-var);
}

/* OnePlaceForAI section */
.opfai-section { padding: 4px 0; }

/* Comment form */
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.login-prompt { padding: 16px 0; }

/* Sidebar */
.lesson-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: flex-start;
  position: sticky;
  top: 0;
}
.sidebar-section {
  background: var(--surf);
  border: 1px solid var(--outline);
  border-radius: var(--r-md);
  padding: 16px;
}
.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surf-var);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--mono);
  margin-bottom: 12px;
}
.sidebar-lessons { display: flex; flex-direction: column; gap: 10px; }
.sidebar-lesson {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: opacity 0.15s;
}
.sidebar-lesson:hover { opacity: 0.8; }
.sidebar-thumb {
  width: 56px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surf-high);
}
.sidebar-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-lesson-title {
  font-size: 12px;
  color: var(--on-surf);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  /* lesson-layout normally scrolls internally; on mobile the page scrolls instead */
  .lesson-layout {
    flex-direction: column;
    padding: 14px 16px 32px;
    overflow-y: visible;
    min-height: auto;
  }
  .lesson-sidebar {
    width: 100%;
    position: static;
  }
  .lesson-title { font-size: 20px; }

  /* Resource cards: stack icon+info above button on very small screens */
  .resource-card { flex-wrap: wrap; gap: 10px; }

  /* Lesson section padding tighter */
  .lesson-section { gap: 10px; }
}
