/* Global background for the whole site */
body {
  background-image: url("/blog/background.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Left-align post titles within their centered containers */
.postTitle {
  text-align: left !important;
}

/* Mermaid diagrams */
.mermaid {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(37, 38, 39, 0.5);
  border-radius: 8px;
  overflow-x: auto;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.mermaid:hover {
  background: rgba(37, 38, 39, 0.7);
}

.mermaid svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Mermaid lightbox modal */
.mermaid-modal {
  display: none;
  position: fixed !important;
  z-index: 9999 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  cursor: zoom-out;
  overflow: auto;
  padding: 2rem;
  margin: 0 !important;
}

.mermaid-modal.active {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.mermaid-modal-content {
  max-width: 95vw;
  max-height: 95vh;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-modal-content svg {
  width: auto !important;
  height: auto !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  min-width: 60vw;
  min-height: 40vh;
}

.mermaid-modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  color: #f8f8ff;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  background: rgba(45, 55, 72, 0.8);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #80AADD;
}

.mermaid-modal-close:hover {
  background: rgba(45, 55, 72, 1);
  border-color: #63b3ed;
}

/* Callout blocks for important information */
.callout {
  margin: 2rem 0;
  padding: 1.5rem;
  border-left: 4px solid #6b7280;
  background: rgba(107, 114, 128, 0.1);
  border-radius: 0 4px 4px 0;
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Callout variants */
.callout.info {
  border-left-color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
}

.callout.warning {
  border-left-color: #92703a;
  background: rgba(146, 112, 58, 0.1);
}

.callout.success {
  border-left-color: #4a7058;
  background: rgba(74, 112, 88, 0.1);
}

.callout.danger {
  border-left-color: #8a5a5c;
  background: rgba(138, 90, 92, 0.1);
}

/* Table styling for better readability */
/* Only target tables NOT inside pre/code blocks */
.postWrapper > table,
.postWrapper p + table,
.postWrapper h2 + table,
.postWrapper h3 + table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 2rem 0 !important;
  font-size: 0.9rem !important;
}

.postWrapper > table th,
.postWrapper > table td,
.postWrapper p + table th,
.postWrapper p + table td,
.postWrapper h2 + table th,
.postWrapper h2 + table td,
.postWrapper h3 + table th,
.postWrapper h3 + table td {
  padding: 1rem 2rem !important;
  text-align: left !important;
  border: 1px solid rgba(107, 114, 128, 0.3) !important;
}

.postWrapper > table th,
.postWrapper p + table th,
.postWrapper h2 + table th,
.postWrapper h3 + table th {
  font-weight: 600 !important;
  background: rgba(58, 74, 92, 0.4) !important;
  border-bottom: 2px solid rgba(107, 114, 128, 0.5) !important;
}

.postWrapper > table tr:hover,
.postWrapper p + table tr:hover,
.postWrapper h2 + table tr:hover,
.postWrapper h3 + table tr:hover {
  background: rgba(58, 74, 92, 0.2) !important;
}

.postWrapper > table td:first-child,
.postWrapper > table th:first-child,
.postWrapper p + table td:first-child,
.postWrapper p + table th:first-child,
.postWrapper h2 + table td:first-child,
.postWrapper h2 + table th:first-child,
.postWrapper h3 + table td:first-child,
.postWrapper h3 + table th:first-child {
  font-weight: 600 !important;
}

/* Ensure code blocks are not affected */
pre table,
code table,
pre code table {
  all: revert !important;
}

pre table td,
code table td,
pre code table td {
  padding: 0 !important;
  border: none !important;
}
