/* ===========================================================================
 * Packt theme — Building a Network Observability Stack
 *
 * Packt orange approximated from packtpub.com — no official kit; swap hex
 * values if one arrives.
 *
 * Layered on top of Material's palette. The theme block is inherited from
 * mkdocs.yml (so `primary: teal` is still set there); the --md-primary-* and
 * --md-accent-* overrides below win on source order, because extra_css loads
 * after the theme's own stylesheet.
 *
 * Hero gradient stops are deliberately darker than the header orange: white
 * body text sits on them, and #e8590c only reaches 3.6:1 against white. Every
 * gradient stop below clears 4.5:1. The brighter oranges live on the header
 * bar, links, and the accent button (which carries dark text).
 * =========================================================================== */

/* Material scopes its palette on [data-md-color-primary=<name>] and
 * [data-md-color-accent=<name>], and the slate link colour on the two-attribute
 * selector. Matching that shape here means these win on source order rather
 * than losing to a more specific rule in palette.css. */

:root,
[data-md-color-primary] {
  --md-primary-fg-color: #e8590c;
  --md-primary-fg-color--light: #ff7a33;
  --md-primary-fg-color--dark: #b8430a;
  --md-typeset-a-color: #b8430a;
}

[data-md-color-accent] {
  --md-accent-fg-color: #b8430a;
  --md-accent-fg-color--transparent: #b8430a1a;
}

[data-md-color-scheme="slate"],
[data-md-color-scheme="slate"][data-md-color-primary] {
  --md-primary-fg-color: #e8590c;
  --md-primary-fg-color--light: #ff9a5c;
  --md-primary-fg-color--dark: #8a3208;
  --md-typeset-a-color: #ff9a5c;
}

[data-md-color-scheme="slate"][data-md-color-accent] {
  --md-accent-fg-color: #ff9a5c;
  --md-accent-fg-color--transparent: #ff9a5c1a;
}

:root {
  /* 8.3:1, 5.5:1 and 4.5:1 against white, in order. */
  --packt-gradient-start: #8a3208;
  --packt-gradient-mid: #b8430a;
  --packt-gradient-end: #c9510a;
  --packt-accent: #ffb08a;
  --packt-accent-ink: #2b1300;
}

[data-md-color-scheme="slate"] {
  --packt-gradient-start: #5c2105;
  --packt-gradient-mid: #8a3208;
  --packt-gradient-end: #a63c09;
  --packt-accent: #ffb08a;
  --packt-accent-ink: #2b1300;
}

/* ---------- Hero block ----------------------------------------------------- */

.packt-hero {
  background: linear-gradient(
    135deg,
    var(--packt-gradient-start) 0%,
    var(--packt-gradient-mid) 50%,
    var(--packt-gradient-end) 100%
  );
  color: #fff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin: 1rem 0 2rem;
  box-shadow: 0 8px 24px rgba(184, 67, 10, 0.18);
}

.packt-hero__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  margin-bottom: 1rem;
}

/* .md-typeset h1 sets its own colour at higher specificity; match it or the
 * hero title renders as dark grey on the orange gradient. */
.md-typeset .packt-hero__title {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.5rem;
  color: #fff;
}

.packt-hero__subtitle {
  font-size: 1.4rem;
  font-weight: 400;
  opacity: 0.95;
  margin: 0 0 1rem;
}

.packt-hero__lead {
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
  max-width: 56rem;
}

.packt-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.9rem;
  opacity: 0.85;
  margin-top: 1.25rem;
}

.packt-hero__meta span::before {
  content: "› ";
  opacity: 0.6;
  margin-right: 0.25rem;
}

/* CTAs sit below the hero (markdown-rendered .md-button) — keep as-is.
   On the hero itself we use a lighter button variant. */
.packt-hero a.md-button {
  background: #fff;
  color: var(--packt-gradient-start);
  border-color: #fff;
  font-weight: 600;
}

.packt-hero a.md-button--primary {
  background: var(--packt-accent);
  color: var(--packt-accent-ink);
  border-color: var(--packt-accent);
}

.packt-hero a.md-button:hover,
.packt-hero a.md-button:focus {
  background: var(--packt-accent);
  color: var(--packt-accent-ink);
  border-color: var(--packt-accent);
}

/* ---------- Inline Packt wordmark ------------------------------------------ */

.packt-mark {
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(
    90deg,
    var(--packt-gradient-start),
    var(--packt-gradient-end)
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Section hero (per-part) ---------------------------------------- */
/* Smaller, lower-key hero used at the top of each part guide. Tinted
 * background + left border accent so it reads as part-of-the-page rather
 * than a slab. */

.packt-section-hero {
  background: linear-gradient(
    100deg,
    rgba(232, 89, 12, 0.10) 0%,
    rgba(184, 67, 10, 0.06) 100%
  );
  border-left: 4px solid var(--packt-gradient-mid);
  border-radius: 0 8px 8px 0;
  padding: 1.5rem 1.75rem;
  margin: 0.5rem 0 2rem;
}

[data-md-color-scheme="slate"] .packt-section-hero {
  background: linear-gradient(
    100deg,
    rgba(255, 154, 92, 0.10) 0%,
    rgba(184, 67, 10, 0.06) 100%
  );
  border-left-color: var(--packt-accent);
}

.packt-section-hero__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  background: var(--packt-gradient-mid);
  color: #fff;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}

.packt-section-hero__title {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.35rem;
}

.packt-section-hero__subtitle {
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0 0 0.85rem;
  color: var(--md-default-fg-color--light);
}

.packt-section-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
  margin-top: 0.5rem;
}

.packt-section-hero__meta span::before {
  content: "› ";
  opacity: 0.5;
  margin-right: 0.2rem;
}

/* ---------- Cross-part navigation footer ----------------------------------- */
/* Two-card row that sits at the bottom of each part: previous on the left,
 * next on the right. Visually echoes Material's grid cards but with directional
 * arrows. */

.packt-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 3rem 0 1rem;
}

/* The markdown processor wraps anchors in <p>; flatten so the grid sees
 * one cell per nav link. */
.packt-nav-footer > p {
  margin: 0;
}

.packt-nav-footer a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
  text-decoration: none;
  color: var(--md-default-fg-color);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.packt-nav-footer a:hover {
  border-color: var(--packt-gradient-mid);
  background: rgba(232, 89, 12, 0.06);
  transform: translateY(-1px);
}

.packt-nav-footer__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.25rem;
}

.packt-nav-footer__title {
  font-size: 1.05rem;
  font-weight: 600;
}

.packt-nav-footer__next {
  text-align: right;
}

.packt-nav-footer__placeholder {
  visibility: hidden;
}

@media (max-width: 600px) {
  .packt-nav-footer {
    grid-template-columns: 1fr;
  }
  .packt-nav-footer__next {
    text-align: left;
  }
}

/* ---------- Material polish ------------------------------------------------- */
/* Subtle reading-experience refinements that ride on top of Material's
 * defaults — softer admonitions, code blocks that lift on hover, and
 * blockquotes that read as senior-engineer voice rather than dead quote. */

.md-typeset .admonition,
.md-typeset details {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 600;
}

.md-typeset pre > code {
  border-radius: 8px;
  transition: box-shadow 0.15s ease;
}

.md-typeset .highlight:hover pre > code {
  box-shadow: 0 4px 12px rgba(184, 67, 10, 0.10);
}

.md-typeset blockquote {
  border-left-width: 4px;
  border-left-color: var(--packt-gradient-mid);
  background: rgba(232, 89, 12, 0.04);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
}

[data-md-color-scheme="slate"] .md-typeset blockquote {
  background: rgba(255, 154, 92, 0.05);
  border-left-color: var(--packt-accent);
}

/* Slightly tighter table styling for the many comparison tables in the
 * guides (vendor-A vs vendor-B, gNMI-raw vs canonical, etc.) */
.md-typeset table:not([class]) th {
  background: rgba(184, 67, 10, 0.06);
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: rgba(255, 154, 92, 0.06);
}

/* ---------- Screenshots ---------------------------------------------------- */
/* Rounded-corner Grafana shots used in the visual reference gallery and at
 * the top of each part page. Click-to-zoom behavior comes from wrapping the
 * <img> in an <a> that points at the same image. */

.md-typeset img.screenshot {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--md-default-fg-color--lightest);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.md-typeset a:hover img.screenshot {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(184, 67, 10, 0.18);
}

[data-md-color-scheme="slate"] .md-typeset img.screenshot {
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.40);
}

/* Per-part section preview — a single screenshot right after the section
 * hero, tighter caption, full width of the content area. */
.md-typeset figure.section-preview {
  margin: 0 0 2rem;
  text-align: center;
}

.md-typeset figure.section-preview figcaption {
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ---------- Wider layout ---------------------------------------------------- */
/* Material's default content max-width is ~61rem (~976px). Bump the outer
 * grid AND the inner content cap so tables / screenshots / wide code blocks
 * have room to breathe on modern displays. */

.md-grid {
  max-width: 1600px;
}

.md-content {
  max-width: 72rem;
  margin-right: auto;
}

/* On very wide viewports, push the TOC against the right gutter so the
 * content sits naturally between the two rails. */
@media screen and (min-width: 1600px) {
  .md-sidebar--secondary {
    margin-left: auto;
  }
}

/* ---------- Search bar polish ---------------------------------------------- */
/* Make the header search input feel more like a discrete control (rounded
 * pill, subtle border, hover affordance) rather than a barely-there strip. */

.md-search__form {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.md-search__form:hover {
  background: rgba(255, 255, 255, 0.18);
}

[dir="ltr"] .md-search__input {
  padding-left: 2.6rem;
}

.md-search__icon[for="__search"] {
  opacity: 0.9;
}

[data-md-toggle="search"]:checked ~ .md-header .md-search__form,
.md-search__form:focus-within {
  background: #fff;
  color: var(--md-default-fg-color);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

.md-search__form:focus-within .md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}

/* ---------- Header logo (book cover) -------------------------------------- */
/* The book cover is portrait (406x500); Material's header is 2.4rem tall.
 * Constrain to a square so the cover doesn't stretch the header bar. */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.8rem;
  width: 1.8rem;
  object-fit: contain;
  border-radius: 2px;
}
