/* ============================================================
   Water — Clean B&W Academic Override
   Loaded AFTER Tailwind so !important wins.
   Tailwind handles layout; this handles appearance.
   ============================================================ */

/* ── Kill decorative effects ── */
*, *::before, *::after {
  box-shadow: none !important;
  border-radius: 0 !important;
  text-shadow: none !important;
}

/* ── Typography ── */
body {
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 12pt !important;
  line-height: 1.6 !important;
  color: #111 !important;
  background: #fff !important;
  max-width: 800px !important;
  margin: 0 auto !important;
  padding: 2rem 2rem 4rem !important;
}

h1, h2, h3, h4, h5, h6, p, span, div, li, td, th, label,
section, article, main, header, footer, summary, details,
blockquote, figcaption, strong, b, em, i, ul, ol, dl, dt, dd {
  font-family: 'Times New Roman', Times, serif !important;
  color: #111 !important;
}

a {
  font-family: 'Times New Roman', Times, serif !important;
  color: #111 !important;
  text-decoration: underline !important;
}

/* ── Headings ── */
h1 {
  font-size: 16pt !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  text-align: center !important;
  margin-bottom: 1.5rem !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 2.5px solid #111 !important;
  letter-spacing: 0.03em !important;
  background: transparent !important;
}

h2 {
  font-size: 13pt !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  margin-top: 2rem !important;
  margin-bottom: 1rem !important;
  padding-bottom: 0.3rem !important;
  border-bottom: 1px solid #111 !important;
  background: transparent !important;
}

h3 {
  font-size: 12pt !important;
  font-weight: bold !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.5rem !important;
  padding-left: 0.8rem !important;
  border-left: 3px solid #111 !important;
  background: transparent !important;
}

h4 {
  font-size: 12pt !important;
  font-weight: bold !important;
  font-style: italic !important;
  margin-top: 1rem !important;
  margin-bottom: 0.5rem !important;
  background: transparent !important;
}

h5 {
  font-size: 11pt !important;
  font-weight: 600 !important;
  background: transparent !important;
}

p {
  text-align: justify !important;
  margin-bottom: 0.8rem !important;
  font-size: 12pt !important;
  background: transparent !important;
}

li {
  text-align: justify !important;
  margin-bottom: 0.4rem !important;
  background: transparent !important;
}

/* ── Kill ALL Tailwind colored backgrounds ── */
[class*="bg-blue"], [class*="bg-sky"], [class*="bg-indigo"],
[class*="bg-emerald"], [class*="bg-green"], [class*="bg-amber"],
[class*="bg-yellow"], [class*="bg-red"], [class*="bg-rose"],
[class*="bg-orange"], [class*="bg-teal"], [class*="bg-cyan"],
[class*="bg-purple"], [class*="bg-pink"], [class*="bg-stone"],
[class*="bg-slate"], [class*="bg-gray"], [class*="bg-gradient"],
[class*="bg-white"] {
  background: transparent !important;
}

/* ── Kill Tailwind colored text ── */
[class*="text-blue"], [class*="text-sky"], [class*="text-indigo"],
[class*="text-emerald"], [class*="text-green"], [class*="text-amber"],
[class*="text-red"], [class*="text-rose"], [class*="text-orange"],
[class*="text-teal"], [class*="text-cyan"], [class*="text-purple"],
[class*="text-pink"], [class*="text-slate"], [class*="text-gray"],
[class*="text-stone"], [class*="text-white"] {
  color: #111 !important;
}

/* ── Kill Tailwind colored borders ── */
[class*="border-blue"], [class*="border-sky"], [class*="border-indigo"],
[class*="border-emerald"], [class*="border-green"], [class*="border-amber"],
[class*="border-red"], [class*="border-rose"], [class*="border-orange"],
[class*="border-teal"], [class*="border-cyan"], [class*="border-purple"],
[class*="border-pink"], [class*="border-yellow"], [class*="border-slate"],
[class*="border-gray"], [class*="border-stone"] {
  border-color: #999 !important;
}

/* ── Kill shadow/rounded ── */
[class*="shadow"] {
  box-shadow: none !important;
}
[class*="rounded"] {
  border-radius: 0 !important;
}

/* ── Sections — transparent backgrounds ── */
section, article, div, header, main, footer, nav {
  background-color: transparent !important;
}

/* ── Binding edge ── */
.binding-edge, [class*="binding-edge"], .dm-toggle {
  display: none !important;
}

/* ── Tables ── */
table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1rem 0 !important;
  background: transparent !important;
}

th, td {
  border: 1px solid #111 !important;
  padding: 6px 10px !important;
  text-align: left !important;
  vertical-align: top !important;
  font-size: 12pt !important;
  background: transparent !important;
}

th {
  font-weight: bold !important;
  background: #f5f5f5 !important;
}

/* ── Equations ── */
.equation, .math-block, .math-display,
[class*="math-block"], [class*="math-display"] {
  display: block !important;
  margin: 1rem 0 !important;
  padding: 0.5rem !important;
  overflow-x: auto !important;
  background: transparent !important;
  border: none !important;
  border-left: 3px solid #111 !important;
  text-align: center !important;
}

.math-final, [class*="math-final"] {
  border: 2px solid #111 !important;
  border-left: 2px solid #111 !important;
}

/* ── Notes / callouts ── */
.callout, .exam-note, .note, blockquote {
  border: none !important;
  border-left: 3px solid #111 !important;
  padding: 0.5rem 1rem !important;
  margin: 1rem 0 !important;
  background: transparent !important;
}

.question-box, .given-data-table, .given, .answer {
  border: 1px solid #111 !important;
  padding: 0.8rem 1rem !important;
  margin: 1rem 0 !important;
  background: transparent !important;
}

/* ── Figures ── */
figure, .figure-container, [class*="figure"] {
  text-align: center !important;
  margin: 1.5rem 0 !important;
  padding: 0.5rem !important;
  border: 1px solid #999 !important;
  background: transparent !important;
}

figcaption, .figcaption {
  font-style: italic !important;
  margin-top: 0.5rem !important;
  text-align: center !important;
  font-size: 10pt !important;
}

svg {
  max-width: 100% !important;
  background: transparent !important;
}

/* ── Print button ── */
.print-btn {
  position: fixed !important;
  top: 1rem !important;
  right: 4rem !important;
  border: 2px solid #111 !important;
  background: #fff !important;
  color: #111 !important;
  padding: 0.4rem 0.8rem !important;
  font-weight: bold !important;
  cursor: pointer !important;
  font-family: 'Times New Roman', Times, serif !important;
  font-size: 11pt !important;
  z-index: 9995 !important;
}
.print-btn:hover {
  background: #111 !important;
  color: #fff !important;
}

/* ── MathJax ── */
mjx-container, .MathJax, .MathJax_Display {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
}

/* ── Force max-width containers ── */
[class*="max-w-4xl"], [class*="max-w-5xl"], [class*="max-w-3xl"],
[class*="max-w-2xl"], [class*="max-w-6xl"] {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ── Force single column grids ── */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: 1fr !important; }
  .md\:grid-cols-3 { grid-template-columns: 1fr !important; }
}

/* ── No-print elements ── */
.no-print { display: none !important; }

/* ── Print ── */
@media print {
  body {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .print-btn, .dm-toggle, .cm-dm-toggle, .cm-nav-bar,
  .dw-btn, .dw-tb, .dw-cv, .no-print {
    display: none !important;
  }
  section, .figure-container, .exam-note { page-break-inside: avoid; }
  h2, h3 { page-break-after: avoid; }
}

/* ════════════ DARK MODE ════════════ */
[data-theme="dark"] body {
  background: #141720 !important;
  color: #d8d5cd !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6,
[data-theme="dark"] strong, [data-theme="dark"] b {
  color: #e8e5dd !important;
}

[data-theme="dark"] p, [data-theme="dark"] span,
[data-theme="dark"] div, [data-theme="dark"] li,
[data-theme="dark"] td, [data-theme="dark"] th,
[data-theme="dark"] label, [data-theme="dark"] dt,
[data-theme="dark"] dd, [data-theme="dark"] blockquote,
[data-theme="dark"] figcaption, [data-theme="dark"] small,
[data-theme="dark"] em, [data-theme="dark"] i,
[data-theme="dark"] summary, [data-theme="dark"] details,
[data-theme="dark"] a, [data-theme="dark"] section,
[data-theme="dark"] article {
  color: #d8d5cd !important;
  background-color: transparent !important;
}

[data-theme="dark"] table { background: #1e2128 !important; }
[data-theme="dark"] th { background: #2a2d33 !important; color: #e0ddd5 !important; }
[data-theme="dark"] td { background: #1e2128 !important; }
[data-theme="dark"] table, [data-theme="dark"] th,
[data-theme="dark"] td { border-color: #3a3d44 !important; }

[data-theme="dark"] h1, [data-theme="dark"] h2 { border-color: #555 !important; }
[data-theme="dark"] h3 { border-color: #555 !important; }

[data-theme="dark"] .callout, [data-theme="dark"] .exam-note,
[data-theme="dark"] .note, [data-theme="dark"] blockquote,
[data-theme="dark"] .equation, [data-theme="dark"] .math-block,
[data-theme="dark"] .math-final, [data-theme="dark"] .question-box {
  border-color: #3a3d44 !important;
}

[data-theme="dark"] .print-btn {
  background: #1a1d23 !important;
  color: #d8d5cd !important;
  border-color: #3a3d44 !important;
}

[data-theme="dark"] svg text { fill: #d8d5cd !important; }
[data-theme="dark"] a { color: #8ab4f8 !important; }

[data-theme="dark"] figure, [data-theme="dark"] .figure-container {
  border-color: #3a3d44 !important;
}
