/**
 * lesson-stylish-ch2.css — overlay / MCQ styling for pages that use .ch2-stylish (Chapter 2, Structure, Schedules, etc.).
 * Loaded on all lesson pages via course_assets.php; rules are scoped under .ch2-stylish.
 */

main.chapter-main.ch2-stylish {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding-left: min(1.25rem, 4vw);
  padding-right: min(1.25rem, 4vw);
}

/* Intro follows the global .hero from header (no second in-page hero). */
.ch2-stylish .chapter-intro {
  margin-bottom: 1.75rem;
}

.ch2-stylish .stylish-teacher {
  border-left: 4px solid var(--accent, #0d9488);
  background: rgba(13, 148, 136, 0.08);
  border-radius: 8px;
  padding: 1rem 1.15rem;
}

.ch2-stylish .chapter-articles {
  margin-top: 0.5rem;
}

.ch2-stylish .chapter-article-card {
  margin-bottom: 0.9rem;
  border-left-width: 3px;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.08) 0%, rgba(13, 148, 136, 0.05) 100%);
}

.ch2-stylish .chapter-article-card h3 {
  margin: 0 0 0.6rem;
  font-family: var(--font-heading, Georgia, serif);
  font-size: 1.06rem;
}

.ch2-stylish .chapter-article-body {
  margin: 0;
  white-space: normal;
  line-height: 1.6;
  font-size: 0.98rem;
}

/* Article picker */
.ch2-stylish .stylish-articles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 2rem;
}

.ch2-stylish .article-btn.big-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.ch2-stylish .article-btn.big-btn:hover {
  border-color: var(--primary, #1d4ed8);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.12);
}

.ch2-stylish .article-btn.big-btn:focus-visible {
  outline: 2px solid var(--primary, #1d4ed8);
  outline-offset: 2px;
}

.ch2-stylish .article-btn .icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Full source text block */
.ch2-stylish .chapter-source-block {
  margin: 0 0 2rem;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.08) 0%, rgba(13, 148, 136, 0.03) 100%);
}

.ch2-stylish .chapter-source-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-heading, Georgia, serif);
  font-size: 1.15rem;
  line-height: 1.3;
}

.ch2-stylish .chapter-source-lead {
  margin: 0 0 0.75rem;
  color: var(--muted, #64748b);
  font-size: 0.94rem;
}

.ch2-stylish .chapter-source-lead code {
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  color: var(--text, #0f172a);
}

.ch2-stylish .chapter-source-pre {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 36rem;
}

@media (max-width: 700px) {
  .ch2-stylish .chapter-source-block {
    padding: 0.85rem 0.8rem 0.9rem;
  }

  .ch2-stylish .chapter-source-pre {
    padding: 0.7rem 0.75rem;
    font-size: 0.8rem;
    max-height: 26rem;
  }
}

/* Overlays: inside main.ch2-stylish (same pattern as Chapter 1) so .ch2-stylish scopes display/fixed layout */
.ch2-stylish .overlay.stylish-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: min(1.25rem, 4vw);
  background: rgba(15, 23, 42, 0.55);
  box-sizing: border-box;
}

.ch2-stylish .overlay.stylish-overlay.is-open {
  display: flex;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content {
  position: relative;
  width: min(42rem, 100%);
  max-height: min(85vh, 100%);
  overflow: auto;
  padding: 1.35rem 1.35rem 1.5rem;
  border-radius: 12px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  background: #f1f5f9;
  color: #334155;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .close-btn:hover {
  background: #e2e8f0;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content h3 {
  margin: 0 0 0.75rem;
  padding-right: 2.5rem;
  font-family: var(--font-heading, Georgia, serif);
}

.ch2-stylish .overlay.stylish-overlay .overlay-content ol {
  margin: 0;
  padding-left: 1.25rem;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content li + li {
  margin-top: 0.5rem;
}

/* Article overlays: main items vs indented sub-lists (aligned with lesson-stylish-base.css) */
.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content > ol {
  padding-left: 1.35rem;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content > ol > li {
  color: var(--text, #0f172a);
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol {
  margin-top: 0.55rem;
  margin-bottom: 0;
  margin-left: 0;
  padding: 0.65rem 0.9rem 0.75rem 1.85rem;
  border-left: 3px solid var(--accent, #0d9488);
  border-radius: 0 10px 10px 0;
  background: rgba(13, 148, 136, 0.1);
  list-style-type: lower-alpha;
  color: #0f766e;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol > li {
  color: #115e59;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol > li + li {
  margin-top: 0.4rem;
}

/* Deeper indent (e.g. Article 17 — roman sub-clauses) */
.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol > li > ol {
  margin-top: 0.45rem;
  padding: 0.55rem 0.85rem 0.65rem 1.65rem;
  border-left-color: var(--primary, #1d4ed8);
  background: rgba(29, 78, 216, 0.08);
  list-style-type: lower-roman;
  color: #1d4ed8;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol > li > ol > li {
  color: #1e40af;
}

.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content li > ol > li > ol > li + li {
  margin-top: 0.35rem;
}

/* Long-form article text (<br>-delimited) inside .constitution-article-content (e.g. Chapter 4) */
.ch2-stylish .overlay.stylish-overlay .overlay-content .constitution-article-content > p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text, #0f172a);
}

/* Plain text from chapter.txt — same visual language as curated overlays (e.g. Chapter 3 lists/prose) */
.ch2-stylish .overlay.stylish-overlay .overlay-content .stylish-article-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: inherit;
}

/* MCQ section */
.ch2-stylish .stylish-mcq {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

.ch2-stylish .stylish-mcq h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ch2-stylish .mcq-icon {
  font-size: 1.25rem;
}

.ch2-stylish .stylish-mcq-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ch2-stylish .stylish-mcq-block {
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #fff);
}

.ch2-stylish .mcq-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.ch2-stylish .mcq-block-head .mcq-q {
  margin: 0;
  flex: 1 1 auto;
}

.ch2-stylish .mcq-clue-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--primary, #1d4ed8);
  border-radius: 8px;
  color: var(--primary, #1d4ed8);
  background: #eff6ff;
  white-space: nowrap;
}

.ch2-stylish .mcq-clue-btn:hover:not(:disabled) {
  background: #dbeafe;
}

.ch2-stylish .mcq-clue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ch2-stylish #mcq-clue-overlay .mcq-clue-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text, #0f172a);
}

.ch2-stylish .overlay.stylish-overlay .overlay-content.overlay-content--wide {
  width: min(52rem, 100%);
}

.ch2-stylish .mcq-quiz-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}

.ch2-stylish .mcq-progress {
  margin: 0;
  font-weight: 600;
  color: var(--text, #0f172a);
}

.ch2-stylish .mcq-results-btn {
  margin: 0;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: #fff;
  background: var(--primary, #1d4ed8);
}

.ch2-stylish .mcq-results-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.ch2-stylish .mcq-results-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ch2-stylish .mcq-completed .mcq-results-btn:disabled {
  opacity: 0.35;
}

.ch2-stylish #mcq-results-overlay .mcq-results-body {
  margin-top: 0.75rem;
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ch2-stylish #mcq-results-overlay .mcq-result-summary {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.ch2-stylish #mcq-results-overlay .mcq-result-row {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #fff);
}

.ch2-stylish #mcq-results-overlay .mcq-result-row--ok {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.ch2-stylish #mcq-results-overlay .mcq-result-row--bad {
  border-color: #fecaca;
  background: #fef2f2;
}

.ch2-stylish #mcq-results-overlay .mcq-result-q {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.ch2-stylish #mcq-results-overlay .mcq-result-meta {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted, #64748b);
}

.ch2-stylish #mcq-results-overlay .mcq-result-mark {
  font-weight: 700;
  color: var(--text, #0f172a);
}

.ch2-stylish #mcq-results-overlay .mcq-result-row--ok .mcq-result-mark {
  color: var(--success, #059669);
}

.ch2-stylish #mcq-results-overlay .mcq-result-row--bad .mcq-result-mark {
  color: #b91c1c;
}

.ch2-stylish #mcq-results-overlay .mcq-result-exp {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.ch2-stylish #mcq-results-overlay .mcq-save-status {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.ch2-stylish #mcq-results-overlay .mcq-save-status--pending {
  background: #f1f5f9;
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #0f172a);
}

.ch2-stylish #mcq-results-overlay .mcq-save-status--ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.ch2-stylish #mcq-results-overlay .mcq-save-status--err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.ch2-stylish #mcq-results-overlay .mcq-save-status--note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.ch2-stylish .stylish-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
}

.ch2-stylish .stylish-mcq-opt {
  padding: 0.35rem 0.25rem;
  border-radius: 6px;
  cursor: pointer;
}

.ch2-stylish .stylish-mcq-opt:hover {
  background: #f8fafc;
}

/* Bottom nav */
.ch2-stylish .stylish-page-nav {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

/* Plain-text article body (split from chapter.txt) inside overlays */
.ch2-stylish .overlay-content pre.stylish-article-source,
.ch2-stylish .overlay-content pre.stylish-article-pre {
  margin: 0.75rem 0 0;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #f8fafc);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  max-height: min(72vh, 40rem);
  overflow: auto;
}
.ch2-stylish details.ch9-source-preamble {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #fff);
}

.ch2-stylish details.ch9-source-preamble summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.ch2-stylish details.ch9-source-preamble pre.stylish-article-source--preamble {
  margin-top: 0.75rem;
  max-height: min(40vh, 18rem);
}

/* Schedule lessons: full transcript text */
.ch2-stylish .schedule-full-text {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.ch2-stylish .schedule-full-text__wrap {
  padding: 1rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #f8fafc);
}

.ch2-stylish .schedule-full-text__pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  max-height: min(75vh, 42rem);
  overflow: auto;
}
