/* ------------------------------------------------------------------ */
/* Diagram download toolbar                                             */
/* ------------------------------------------------------------------ */

.diagram-wrapper {
  position: relative;
  margin: 1.5rem 0;
}

.diagram-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--md-code-bg-color, #f5f5f5);
  border: 1px solid var(--md-default-fg-color--lightest, #e0e0e0);
  border-radius: 0.25rem;
  font-size: 0.72rem;
}

.diagram-toolbar__label {
  color: var(--md-default-fg-color--light, #888);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.diagram-toolbar__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: var(--md-primary-fg-color, #1565c0);
  color: var(--md-primary-bg-color, #fff);
  border: none;
  border-radius: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.diagram-toolbar__btn:hover {
  opacity: 0.85;
}

.diagram-toolbar__btn:active {
  opacity: 0.7;
}

/* ------------------------------------------------------------------ */
/* Page-level PDF toolbar (appears below H1)                           */
/* ------------------------------------------------------------------ */

.page-pdf-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.diagram-toolbar__btn--pdf {
  padding: 0.3rem 0.9rem;
  font-size: 0.78rem;
  background: var(--md-accent-fg-color, #0d47a1);
}

/* ------------------------------------------------------------------ */
/* Print / PDF styles                                                   */
/* ------------------------------------------------------------------ */

@media print {
  /* Hide navigation, search, and interactive controls */
  .md-header,
  .md-sidebar,
  .md-tabs,
  .md-footer,
  .md-search,
  .diagram-toolbar,
  .page-pdf-toolbar,
  .md-content__button,
  .md-nav__toggle,
  [data-md-component="skip"],
  .md-top {
    display: none !important;
  }

  /* Full-width content */
  .md-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .md-content__inner {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1cm !important;
  }

  /* Mermaid SVGs scale to page width */
  .mermaid svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Keep code blocks readable */
  pre, code {
    white-space: pre-wrap;
    font-size: 0.75rem;
  }

  /* Avoid page breaks inside tables and diagrams */
  table, figure, .mermaid {
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  /* Colour adjustments for print */
  body {
    color: #000 !important;
    background: #fff !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  /* Print URL after links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.7rem;
    color: #555;
  }
}
