/* Printable cheat sheets for Jupyter / NumPy / Pandas / Matplotlib */

.cheat-sheet {
  --cheat-border: #d8d8d8;
  --cheat-text-muted: #555;
  --cheat-bg-soft: #f6f7f8;
  max-width: 100%;
  margin: 0 auto;
  color: #111;
}

.cheat-sheet .cheat-header {
  text-align: center;
  margin: 0 0 1.2rem;
}

.cheat-sheet .cheat-header h1 {
  margin-bottom: .2rem;
  font-size: 2rem;
  line-height: 1.25;
}

.cheat-sheet .cheat-subtitle {
  color: var(--cheat-text-muted);
  font-size: .95rem;
}

.cheat-sheet .cheat-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: .5rem 0 1rem;
}

.cheat-sheet .cheat-print-button {
  border: 1px solid #888;
  border-radius: 5px;
  background: #fff;
  padding: .45rem .75rem;
  font-size: .9rem;
  cursor: pointer;
}

.cheat-sheet .cheat-print-button:hover {
  background: var(--cheat-bg-soft);
}

.cheat-sheet .cheat-callout {
  border: 1px solid #777;
  border-radius: 6px;
  padding: .7rem .9rem;
  margin: 0 0 1rem;
  text-align: center;
  background: #fff;
}

.cheat-sheet .cheat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.cheat-sheet .cheat-card {
  border: 1px solid var(--cheat-border);
  border-radius: 7px;
  padding: .75rem .85rem;
  background: #fff;
  break-inside: avoid;
}

.cheat-sheet .cheat-card h2 {
  margin: 0 0 .55rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid #222;
  font-size: 1.2rem;
  line-height: 1.3;
}

.cheat-sheet table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: .92rem;
}

.cheat-sheet th,
.cheat-sheet td {
  padding: .42rem .35rem;
  border-bottom: 1px solid var(--cheat-border);
  text-align: left;
  vertical-align: top;
}

.cheat-sheet th {
  background: var(--cheat-bg-soft);
  font-weight: 600;
}

.cheat-sheet tr:last-child td {
  border-bottom: 0;
}

.cheat-sheet code {
  white-space: nowrap;
  font-size: .88em;
}

.cheat-sheet kbd {
  display: inline-block;
  min-width: 1.7em;
  margin: 0 .05em;
  padding: .1em .42em;
  border: 1px solid #777;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafafa;
  box-shadow: none;
  font-family: Consolas, "Courier New", monospace;
  font-size: .85em;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.cheat-sheet .cheat-note {
  margin-top: 1rem;
  padding-top: .7rem;
  border-top: 1px solid #bbb;
  color: var(--cheat-text-muted);
  font-size: .88rem;
}

@media (max-width: 760px) {
  .cheat-sheet .cheat-grid {
    grid-template-columns: 1fr;
  }

  .cheat-sheet .cheat-toolbar {
    justify-content: flex-start;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 9mm;
  }

  .book-summary,
  .book-header,
  .navigation,
  .cheat-sheet .cheat-print-button,
  .cheat-sheet .cheat-toolbar,
  footer {
    display: none !important;
  }

  html,
  body,
  .book,
  .book-body,
  .body-inner,
  .page-wrapper,
  .page-inner {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    position: static !important;
  }

  .book-body {
    left: 0 !important;
  }

  .cheat-sheet {
    font-size: 9.5px;
    line-height: 1.25;
  }

  .cheat-sheet .cheat-header {
    margin-bottom: 6px;
  }

  .cheat-sheet .cheat-header h1 {
    font-size: 18px;
    margin: 0 0 2px;
  }

  .cheat-sheet .cheat-subtitle {
    font-size: 9px;
  }

  .cheat-sheet .cheat-callout {
    padding: 5px 7px;
    margin-bottom: 7px;
  }

  .cheat-sheet .cheat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .cheat-sheet .cheat-card {
    padding: 5px 6px;
    border-radius: 4px;
  }

  .cheat-sheet .cheat-card h2 {
    font-size: 11px;
    margin-bottom: 3px;
    padding-bottom: 2px;
  }

  .cheat-sheet table {
    font-size: 8.6px;
  }

  .cheat-sheet th,
  .cheat-sheet td {
    padding: 2.5px 3px;
  }

  .cheat-sheet kbd {
    font-size: 7.8px;
    padding: 0 3px;
  }

  .cheat-sheet .cheat-note {
    margin-top: 6px;
    padding-top: 4px;
    font-size: 8px;
  }

  .cheat-sheet a {
    color: inherit !important;
    text-decoration: none !important;
  }
}
