/* Nudge Material toward the Plaintext terminal aesthetic on content pages.
   The landing hero carries its own scoped styles in overrides/home.html.

   Both color schemes are supported (mkdocs.yml defines a slate/default palette
   toggle). The terminal neon (#00ff88) only works on dark grounds, so light
   mode swaps in contrast-legible equivalents. All rules below read the
   --px-* tokens — never a hardcoded color. */

[data-md-color-scheme="slate"] {
  --md-accent-fg-color: #00ff88;
  --md-typeset-a-color: #00aaff;
  --px-accent: #00ff88;
  --px-code-fg: #8affc8;
  --px-tint: rgba(0, 255, 136, 0.06);
  --px-tint-strong: rgba(0, 255, 136, 0.08);
}

[data-md-color-scheme="default"] {
  --md-accent-fg-color: #067a4b;
  --md-typeset-a-color: #0b63a8;
  --px-accent: #067a4b;
  --px-code-fg: #056b42;
  --px-tint: rgba(6, 122, 75, 0.07);
  --px-tint-strong: rgba(6, 122, 75, 0.1);
}

/* Blockquotes are used for the standing authorization / safety notes —
   give them a green left rule so they read as a callout. */
.md-typeset blockquote {
  border-left: 0.2rem solid var(--px-accent);
}

/* Inline code: subtle green, matching the curriculum's tool references. */
.md-typeset code {
  color: var(--px-code-fg);
}

/* Per-module metadata strip (difficulty · time · prerequisites) rendered
   just under the module hook line. Reads as a quiet, scannable bar. */
.md-typeset p.module-meta {
  margin: 0.6rem 0 1rem;
  padding: 0.5rem 0.8rem;
  border-left: 0.2rem solid var(--px-accent);
  background: var(--px-tint);
  border-radius: 0.1rem;
  font-size: 0.72rem;
  line-height: 1.6;
}

/* Client-side progress tracking: a checkbox the local-progress.js script
   injects at the top of every module page, plus the per-track progress pill. */
.module-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.8rem;
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  font-size: 0.72rem;
}

.module-progress input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--px-accent);
  cursor: pointer;
  margin: 0;
}

.module-progress label {
  cursor: pointer;
  user-select: none;
}

.module-progress.is-done {
  border-color: var(--px-accent);
  background: var(--px-tint-strong);
}

.module-progress .module-progress__reset {
  margin-left: auto;
  font-size: 0.66rem;
  background: none;
  border: none;
  color: var(--md-default-fg-color--light);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ---------------------------------------------------------------------------
   Cheat-sheet layout (overrides/cheatsheet.html). Pages opting in via
   `template: cheatsheet.html` + `hide: [navigation, toc]` render as a
   full-bleed, multi-column reference card: the h1 + companion lines span the
   page, and the h2 sections flow into columns sized so most code lines fit
   unwrapped. Prints as the one-pager the "print it, pin it" tagline promises. */

/* Lift the 61rem grid cap only when a cheat-sheet page is on screen. */
body:has(.px-cheatsheet) .md-grid {
  max-width: 110rem;
}

.px-cheatsheet {
  column-width: 30rem;
  column-gap: 2.4rem;
  column-rule: 1px solid var(--md-default-fg-color--lightest);
}

/* The title and its companion/reviewed lines read as a page-wide header band. */
.px-cheatsheet h1,
.px-cheatsheet h1 + p,
.px-cheatsheet h1 + p + p {
  column-span: all;
}

.px-cheatsheet h1 {
  margin-bottom: 0.4em;
}

.px-cheatsheet h1 + p,
.px-cheatsheet h1 + p + p {
  color: var(--md-default-fg-color--light);
  font-size: 0.7rem;
  margin: 0.2em 0;
}

/* Each h2 opens a "card": hairline top rule + terminal prompt marker. */
.px-cheatsheet h2 {
  font-size: 0.85rem;
  margin: 1.4em 0 0.6em;
  padding-top: 0.7em;
  border-top: 1px solid var(--md-default-fg-color--lightest);
  break-after: avoid;
}

.px-cheatsheet h2::before {
  content: "$ ";
  color: var(--px-accent);
  font-family: var(--md-code-font-family);
  font-size: 0.75em;
}

/* Never split a snippet, table, or admonition across columns. */
.px-cheatsheet .highlight,
.px-cheatsheet pre,
.px-cheatsheet table,
.px-cheatsheet .admonition,
.px-cheatsheet blockquote {
  break-inside: avoid;
}

/* Comments stay a page-wide strip below the columns. */
.px-cheatsheet .px-comments {
  column-span: all;
}

@media print {
  .px-cheatsheet {
    column-width: auto;
    column-count: 2;
    column-gap: 1.6rem;
    font-size: 0.62rem;
  }
  .px-cheatsheet pre code {
    font-size: 0.58rem;
  }
  .px-cheatsheet .px-comments {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Mermaid diagrams — larger by default + click-to-enlarge (mermaid-zoom.js)
   --------------------------------------------------------------------------- */

/* Render inline diagrams at full content width so they're legible on big
   monitors, framed subtly so they read as a distinct object. */
.mermaid {
  width: 100%;
  max-width: 100%;
  margin: 1.1rem 0;
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  background: var(--md-default-bg-color);
  text-align: center;
}
.mermaid svg {
  width: 100% !important;
  max-width: 960px !important;   /* scale up small diagrams; cap the huge ones */
  height: auto;
}

/* Click-to-enlarge affordance. */
.px-mermaid-zoomable {
  cursor: zoom-in;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.px-mermaid-zoomable:hover {
  border-color: var(--md-accent-fg-color);
  box-shadow: 0 0 0 1px var(--md-accent-fg-color);
}
.px-mermaid-zoomable::after {
  content: "⤢ click to enlarge";
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  font-size: 0.62rem;
  color: var(--md-default-fg-color--light);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.px-mermaid-zoomable:hover::after { opacity: 0.9; }

/* Full-screen lightbox overlay. */
#px-mermaid-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  overflow: hidden;
}
#px-mermaid-overlay.is-open { display: flex; }
#px-mermaid-overlay .px-mz-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
#px-mermaid-overlay .px-mz-stage:active { cursor: grabbing; }
#px-mermaid-overlay .px-mz-stage svg {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  background: #fff;         /* keep dark-drawn strokes legible on the backdrop */
  border-radius: 6px;
  padding: 1rem;
  will-change: transform;
}
#px-mermaid-overlay .px-mz-close {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
}
#px-mermaid-overlay .px-mz-hint {
  position: absolute;
  bottom: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}
