/* Minimal custom styles on top of Tailwind */

.se-section-body h1,
.se-section-body h2,
.se-section-body h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.se-section-body p {
  margin-bottom: 0.5rem;
}

.se-section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.se-section-body table th,
.se-section-body table td {
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.5rem;
}

.se-section-body table th {
  background-color: #f8fafc;
  font-weight: 600;
}

/* Simple definition box */
.se-definition {
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  padding: 0.4rem 0.6rem;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

/* Quiz feedback helpers */
.quiz-correct {
  color: #166534;
}
.quiz-wrong {
  color: #b91c1c;
}

/* Clamp helper (non-critical) */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Hide default markers for <details><summary> */
.se-details-summary::-webkit-details-marker {
  display: none;
}
.se-details-summary::marker {
  content: '';
}

/* Book structure: rotate custom chevron */
.se-bs-chevron {
  transition: transform 150ms ease;
}
details[open] > summary .se-bs-chevron {
  transform: rotate(90deg);
}

/* -------------------------------------------------
   Reader typography: equations & tables
   ------------------------------------------------- */

.se-reader {
  background: var(--se-reader-bg, #ffffff);
  color: var(--se-reader-text, #0f172a);
}

.se-reader .se-section-body {
  font-size: var(--se-reader-font-size, 1rem);
  line-height: var(--se-reader-line-height, 1.75);
  max-width: 75ch;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1024px) {
  .se-reader .se-section-body {
    max-width: none;
  }
}

.se-reader[data-size='sm'] {
  --se-reader-font-size: 0.95rem;
  --se-reader-line-height: 1.7;
}
.se-reader[data-size='md'] {
  --se-reader-font-size: 1rem;
  --se-reader-line-height: 1.75;
}
.se-reader[data-size='lg'] {
  --se-reader-font-size: 1.075rem;
  --se-reader-line-height: 1.85;
}

.se-reader[data-theme='sepia'] {
  --se-reader-bg: #f7f2e8;
  --se-reader-text: #0f172a;
}

.se-reader[data-theme='dark'] {
  --se-reader-bg: #0b1220;
  --se-reader-text: #e2e8f0;
  border-color: #1e293b !important;
}

.se-reader[data-theme='dark'] .text-slate-900,
.se-reader[data-theme='dark'] .text-slate-800 {
  color: #e2e8f0 !important;
}
.se-reader[data-theme='dark'] .text-slate-700,
.se-reader[data-theme='dark'] .text-slate-600 {
  color: #cbd5e1 !important;
}
.se-reader[data-theme='dark'] .text-slate-500,
.se-reader[data-theme='dark'] .text-slate-400 {
  color: #94a3b8 !important;
}

.se-reader[data-theme='dark'] .border-slate-200,
.se-reader[data-theme='dark'] .border-slate-100 {
  border-color: #1e293b !important;
}

.se-reader[data-theme='dark'] select,
.se-reader[data-theme='dark'] textarea,
.se-reader[data-theme='dark'] input {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

.se-reader[data-theme='dark'] a {
  color: #93c5fd;
}

.se-section-body img {
  max-width: 100%;
  height: auto;
}

.se-section-body pre {
  overflow-x: auto;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #334155; /* Darker border */
  background: #0f172a;       /* Dark background (Slate-900) */
  color: #f1f5f9;            /* Light text (Slate-100) */
  font-size: 0.9em;
}

.se-reader[data-theme='dark'] .se-section-body pre {
  border-color: #334155;
  background: #0f172a;
}

.se-section-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.se-reader[data-theme='dark'] .se-section-body table th {
  background-color: #0f172a;
}

.se-reader[data-theme='dark'] .se-section-body table th,
.se-reader[data-theme='dark'] .se-section-body table td {
  border-color: #334155;
}

.se-section-body .se-equation {
  margin: 1rem auto;
  text-align: center;
}

.se-section-body .se-equation-inner {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background-color: #f8fafc; /* slate-50 */
  border: 1px solid #e2e8f0; /* slate-200 */
}

.se-section-body .se-equation-caption {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #64748b; /* slate-500 */
}

/* Tables in content area */

.se-section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.se-section-body th,
.se-section-body td {
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.se-section-body thead th {
  background-color: #f1f5f9; /* slate-100 */
  font-weight: 600;
}

.se-section-body tbody tr:nth-child(even) {
  background-color: #f8fafc; /* slate-50 */
}
