/*
 * Print rules for the MCP Azure Security Guide. Checklists, the minimum safe baseline, and risk pages print
 * as clean pages: no header, tabs, navigation, footer, or buttons, and every external link shows its URL.
 */

@media print {
  /* Every tab prints: shadcn shows only the selected tab's panel, after all the labels. */
  .typography .tabbed-set > :is(label, .tabbed-content) {
    order: 0;
  }

  .typography .tabbed-set > .tabbed-content {
    display: block !important;
  }
}

@media print {
  @page {
    margin: 16mm 14mm 18mm;
  }

  :root,
  .dark {
    color-scheme: light;
    --guide-bg: #ffffff;
    --guide-fg: #000000;
    --guide-muted: #3f3f46;
    --guide-border: #b4b4bc;
    --guide-border-strong: #8b8b94;
    --guide-surface: #ffffff;
    --guide-surface-2: #ffffff;
    --guide-accent: #000000;
    --guide-accent-fg: #ffffff;
    --guide-accent-surface: #ffffff;
    --guide-focus: #000000;
    --g-code-bg: #ffffff;
  }

  /* Paper takes the theme's light palette. A page printed from the dark scheme keeps the theme's dark variables
     otherwise, and they paint the page and its cards dark and the admonition titles and page dates near white. */
  .dark {
    --background: oklch(100% 0 0);
    --foreground: oklch(14.5% 0 0);
    --card: oklch(100% 0 0);
    --card-foreground: oklch(14.5% 0 0);
    --popover: oklch(100% 0 0);
    --popover-foreground: oklch(14.5% 0 0);
    --primary: oklch(20.5% 0 0);
    --primary-foreground: oklch(98.5% 0 0);
    --secondary: oklch(97% 0 0);
    --secondary-foreground: oklch(20.5% 0 0);
    --muted: oklch(97% 0 0);
    --muted-foreground: oklch(55.6% 0 0);
    --accent: oklch(97% 0 0);
    --accent-foreground: oklch(20.5% 0 0);
    --destructive: oklch(57.7% 0.245 27.325);
    --border: oklch(92.2% 0 0);
    --input: oklch(92.2% 0 0);
    --ring: oklch(70.8% 0 0);
    --surface: oklch(98% 0 0);
    --surface-foreground: var(--foreground);
    --code-highlight: oklch(96% 0 0);
    --code-number: oklch(56% 0 0);
  }

  html,
  body {
    background: #ffffff !important;
  }

  .g-header,
  .g-announce,
  [data-slot="sidebar"],
  [data-slot="docs"] > .sticky,
  .g-footer,
  #bottom-navigation,
  #page-header,
  .codehilite > button,
  #cookie-banner,
  .g-copy-page,
  .g-copy-page__status,
  .g-feedback,
  .g-footer-links,
  .g-journey,
  .g-diagram__open,
  .g-banner__icon,
  .typography .headerlink,
  .typography .button {
    display: none !important;
  }

  article {
    margin: 0 !important;
    padding: 0 !important;
  }

  article {
    max-width: none;
  }

  .typography {
    color: #000000;
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .typography :is(h2, h3, h4) {
    break-after: avoid;
    page-break-after: avoid;
  }

  .typography h2 {
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1pt solid #000000;
  }

  .typography a {
    color: #000000;
    text-decoration: underline;
  }

  .typography a[href^="http"]:not(.g-banner a, .g-risk-card a, .g-chip--service, .g-ref--service, .g-cap__service)::after {
    content: " (" attr(href) ")";
    display: inline;
    width: auto;
    height: auto;
    margin: 0;
    color: #3f3f46;
    font-size: 0.85em;
    font-weight: 400;
    vertical-align: baseline;
    overflow-wrap: anywhere;
    background: none;
    -webkit-mask: none;
    mask: none;
  }

  /* The banner prints as a plain title block. */
  .typography .g-banner,
  .typography .g-hero {
    display: block;
    margin: 0 0 1.5rem;
    padding: 0 0 0.75rem;
    color: #000000;
    border-bottom: 2pt solid #000000;
    border-radius: 0;
    background: none;
  }

  .typography :is(.g-banner, .g-hero)::before,
  .typography :is(.g-banner, .g-hero)::after {
    display: none;
  }

  .typography .g-banner__eyebrow {
    display: block;
    margin: 0 0 0.375rem;
    padding: 0;
    color: #3f3f46;
    border: 0;
  }

  .typography :is(.g-banner > h1, .g-hero__title),
  .typography :is(.g-banner__summary, .g-hero__promise),
  .typography ul.g-banner__meta {
    color: #000000;
  }

  .typography .g-banner__meta {
    border-top: 0;
  }

  .typography .g-banner .g-chip {
    color: #000000;
    border-color: #52525b;
    background: none;
  }

  .typography .g-banner .g-badge {
    --g-badge-on-dark: currentColor;
    color: var(--g-badge);
  }

  .typography .g-banner .g-badge__label {
    border-color: var(--g-badge);
    background: none;
  }

  /* A hover card prints inline after its trigger, in parentheses: a status badge's checked date and note, or a term's
     expansion. A badge's source link stays on screen. */
  .typography .g-hovercard[popover] {
    position: static;
    display: inline !important;
    inset: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    color: #3f3f46;
    font-size: 0.9em;
    font-weight: 400;
    white-space: normal;
    border: 0;
    background: none;
    box-shadow: none;
    animation: none;
  }

  .typography .g-hovercard[popover]::before {
    content: " (";
  }

  .typography .g-hovercard[popover]::after {
    content: ")";
  }

  .typography .g-hovercard :is(.g-hovercard__meta, .g-hovercard__note) {
    display: inline;
    margin: 0;
  }

  .typography .g-hovercard__source {
    display: none;
  }

  .typography .g-hovercard__note::before {
    content: ";";
  }

  .typography .g-hovercard__trigger:not(.g-badge__label) {
    text-decoration: none;
  }

  .typography .g-badge__label:has(+ .g-hovercard .g-hovercard__note)::after {
    display: none;
  }

  /* Cards, chips, and badges keep their borders; large tints drop to save ink. */
  .typography :is(.admonition, details, .g-diagram, .g-incident, .g-handson, .g-risk-card, .g-path-card, figure, img, tr, .codehilite) {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* On paper a camp in the hands-on card flows as text again, so its printed address follows its name. */
  .typography .g-handson .g-chip {
    display: inline;
  }

  .typography .g-handson .g-chip--camp::before {
    margin-right: 0.4em;
  }

  /* In a table cell a camp keeps its box, and its printed address takes a line of its own under the name instead
     of a column a few characters wide beside it. */
  .typography :is(th[scope="row"], td) .g-chip--camp {
    flex-wrap: wrap;
  }

  .typography :is(th[scope="row"], td) .g-chip--camp > .g-chip__label {
    flex: 1 1 0;
    min-width: 0;
  }

  .typography :is(th[scope="row"], td) .g-chip--camp[href^="http"]::after {
    flex-basis: 100%;
  }

  .typography :is(.admonition, details:not(.g-diagram__desc), .g-handson, .g-incident, .g-diagram) {
    border: 1pt solid #8b8b94 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .typography :is(.g-badge, .g-badge__label, .g-chip--camp::before, .g-seen::before, .task-list-control > input) {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .typography .g-risk-card__coverage::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .typography details > summary::after,
  .typography details.g-diagram__desc > summary::before {
    display: none;
  }

  .typography details::details-content {
    content-visibility: visible;
  }

  /* Each box prints its tick: empty for a pen, or ticked in black. The progress line prints its count once a box is
     ticked, without its button. */
  .typography .task-list-control > input[type="checkbox"],
  .typography .task-list-control > input[type="checkbox"]:checked {
    border: 1.2pt solid #000000;
    background: #ffffff;
  }

  .typography .task-list-indicator {
    background: #000000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .typography .task-list-item:has(> .task-list-control > input:checked) {
    color: inherit;
  }

  .typography .g-checklist[data-done="0"],
  .typography .g-checklist__reset {
    display: none;
  }

  .typography .g-checklist:has(> .g-checklist__reset:not([hidden])) > .g-checklist__status::after {
    content: none;
  }

  .typography .task-list-item {
    break-inside: avoid;
    margin-bottom: 0.375rem;
  }

  /* Tables and code fit the page instead of scrolling. */
  .g-table-wrap,
  .table-wrapper {
    overflow: visible !important;
  }

  .typography :is(.g-table, table:not([class])) {
    min-width: 0 !important;
    font-size: 9pt;
  }

  .typography thead {
    display: table-header-group;
  }

  .typography pre > code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #ffffff;
  }

  .typography .codehilite {
    box-shadow: inset 0 0 0 1pt #b4b4bc;
  }

  /* Every tab prints, each label before its block (the first block of this file); the label reads as a small
     heading. */
  .typography .tabbed-set > label {
    padding: 0.75rem 0 0.25rem;
    color: #000000;
    font-weight: 700;
  }

  /* Paper has room for the wide diagram layout. */
  .typography .g-diagram__art--wide {
    display: block !important;
  }

  .typography .g-diagram__art--narrow {
    display: none !important;
  }
}
