/* chaos-monkey.com — site-owned stylesheet.
 *
 * The eleven stylesheets that shipped with the `blogdata` capture are the
 * theme's and are not edited. This file holds only furniture the capture had no
 * equivalent for, because the capture was a single homepage: post bodies, the
 * At a glance block, the sources block, the section disclosure, the hub filter,
 * the sidebar widgets and the text-only listing plate.
 *
 * Everything here draws on the theme's own custom properties (--pri-color,
 * --text-color, --border-color, --box-color2, …). Those flip automatically under
 * `body.dark`, which the theme's toggle sets, so nothing in this file needs its
 * own dark-mode rules — and anything added later should keep using them rather
 * than hard-coding a colour.
 *
 * Bump CSS_V in tools/build_chaos_monkey.py when you change this file, then read
 * the "`?v=` bump can be poisoned by the rolling update" gotcha in CLAUDE.md
 * before trusting that the bump took effect.
 */

/* --------------------------------------------------------------- dark mode */

/* The capture's logo is solid black artwork on transparency, so the theme's own
 * dark mode rendered it as an invisible rectangle against #1C1C1C — the header
 * lost its mark entirely and only the text title remained. Inverting is the
 * right repair rather than commissioning a second asset: the artwork is pure
 * black with no colour in it, so inverted it is pure white and nothing else
 * about it changes. */
body.dark .custom-logo {
  filter: invert(1);
}

/* --------------------------------------------------------------- listings */

.cm-band-lede {
  color: var(--text-color);
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 62ch;
  margin: 0 0 28px;
}

.cm-more {
  margin: 22px 0 40px;
  font-weight: 600;
}

.cm-more a,
.cm-brief a,
.cm-sources a {
  color: var(--pri-color);
}

.grid-card .cm-readtime {
  opacity: .75;
}

.bs-blog-meta .cm-readtime::before {
  content: "·";
  padding: 0 .45em;
  opacity: .6;
}

/* Listing card for a post with no photograph. The /failure-modes/ pipeline
 * cannot take one, so its entries get a plate rather than a borrowed picture. */
.cm-card-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  border-radius: var(--bxbra);
  background: linear-gradient(135deg, var(--pri-color) 0%, var(--secondary-color) 100%);
  text-decoration: none;
}

/* Background for any theme card rendering a post with no photograph — the
 * slider, the trending column, "You Missed" and the related strip all use the
 * theme's back-img treatment, which is a background-image and has nothing to
 * show. The gradient stands in for the picture rather than leaving a black box. */
.bs-blog-post.cm-plate-bg,
.bs-slide.cm-plate-bg {
  background-image: linear-gradient(135deg, var(--pri-color) 0%, var(--secondary-color) 100%);
  background-size: cover;
}

.cm-card-plate span {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #fff;
  opacity: .92;
}

.cm-empty {
  color: var(--text-color);
  padding: 28px 0 40px;
}

.cm-modes-band .cm-band-lede {
  margin-bottom: 22px;
}

/* -------------------------------------------------------------- hub filter */

/* No index and no backend: every post in the section is already in this page's
 * DOM, so js/search.js filters the list in place. */
.cm-search {
  margin: 0 0 26px;
}

.cm-search input {
  width: 100%;
  max-width: 520px;
  padding: 12px 16px;
  font: inherit;
  color: var(--stext-color);
  background: var(--box-color2);
  border: 1px solid var(--border-color);
  border-radius: var(--bxbra);
}

.cm-search input:focus-visible {
  outline: 2px solid var(--pri-color);
  outline-offset: 1px;
}

.cm-search-count {
  margin: 8px 0 0;
  font-size: .85rem;
  color: var(--text-color);
  opacity: .8;
  min-height: 1.2em;
}

/* ------------------------------------------------------------- post header */

.bs-blog-post.single .bs-header .cm-standfirst {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text-color);
  max-width: 60ch;
  margin: 14px 0 18px;
}

.cm-hero {
  margin: 0 0 32px;
}

.cm-hero img {
  width: 100%;
  height: auto;
  border-radius: var(--bxbra);
  display: block;
}

/* --------------------------------------------------------------- post body */

.cm-body {
  max-width: 68ch;
}

.cm-body > p:first-of-type {
  font-size: 1.3125rem;
  line-height: 1.55;
}

.cm-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--head-color);
  margin: 44px 0 16px;
}

.cm-body em {
  font-style: italic;
}

.cm-body ul,
.cm-body ol {
  margin: 0 0 28px 1.35em;
}

.cm-body li {
  margin-bottom: 10px;
  line-height: 1.55;
}

/* ---------------------------------------------------- At a glance / brief */

/* Rendered from the same posts.json object that drives the TechArticle schema,
 * so the visible page and the structured data cannot disagree. Deliberately
 * carries no metric — nothing on this site has been measured by this site. */
.cm-brief {
  margin: 44px 0 0;
  padding: 26px 28px;
  background: var(--box-color2);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--pri-color);
  border-radius: var(--bxbra);
}

.cm-brief-h {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pri-color);
  margin: 0 0 20px;
}

.cm-brief-dl {
  margin: 0 0 24px;
}

.cm-brief-dl dt {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--wtext-color);
  margin: 0 0 5px;
}

.cm-brief-dl dd {
  margin: 0 0 16px;
  color: var(--stext-color);
  line-height: 1.5;
}

.cm-brief-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
}

.cm-brief-h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--head-color);
  margin: 0 0 12px;
}

.cm-brief ul {
  margin: 0;
  padding: 0 0 0 1.15em;
}

.cm-brief li {
  margin-bottom: 9px;
  line-height: 1.5;
  color: var(--text-color);
  font-size: .95rem;
}

/* --------------------------------------------- disclosure + sources block */

/* Emitted by the builder on every /failure-modes/ page and its hub, not by the
 * model, so a bad draft cannot drop it. */
.cm-disclosure {
  margin: 0 0 32px;
  padding: 16px 20px;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-color);
  background: var(--box-color2);
  border: 1px dashed var(--border-color);
  border-radius: var(--bxbra);
}

.cm-sources {
  margin: 44px 0 0;
  padding: 24px 28px;
  background: var(--box-color2);
  border: 1px solid var(--border-color);
  border-radius: var(--bxbra);
}

.cm-sources ul {
  margin: 0;
  padding: 0 0 0 1.15em;
}

.cm-sources li {
  margin-bottom: 10px;
  line-height: 1.5;
  word-break: break-word;
  font-size: .9rem;
}

/* ----------------------------------------------------------------- sidebar */

/* The capture left the sidebar column completely empty. These widgets are the
 * site's only source of internal links between posts. */
.cm-side-list,
.cm-side-sections,
.cm-offcanvas-list,
.cm-404-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The long selector is load-bearing, not decoration. core.css carries
 * `.bs-sidebar .bs-widget ul li { display: flex }` at specificity (0,3,1), which
 * beat a bare `.cm-side-item` and laid each title and its meta line side by
 * side, running them together as one string. Matching the theme's own selector
 * depth is what wins it back. */
.bs-sidebar .bs-widget ul.cm-side-list li.cm-side-item {
  display: block;
  padding: 0 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.bs-sidebar .bs-widget ul.cm-side-list li.cm-side-item:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Matched to the theme's own selector depth for the same reason as the display
 * rule above: core.css colours sidebar links at (0,3,2) and won otherwise,
 * which left every title in the Latest widget noticeably dimmer than the
 * heading above it. */
.bs-sidebar .bs-widget ul.cm-side-list li a {
  display: block;
  font-weight: 600;
  line-height: 1.35;
  color: var(--wtitile-color);
}

.bs-sidebar .bs-widget ul.cm-side-list li a:hover {
  color: var(--pri-color);
}

.cm-side-meta {
  display: block;
  margin-top: 5px;
  font-size: .78rem;
  color: var(--wtext-color);
}

.cm-side-sections li,
.cm-offcanvas-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color);
}

.cm-side-sections li:last-child,
.cm-offcanvas-list li:last-child {
  border-bottom: 0;
}

.cm-side-sections a,
.cm-offcanvas-list a {
  font-weight: 600;
  color: var(--wtitile-color);
}

.cm-side-sections a:hover,
.cm-offcanvas-list a:hover {
  color: var(--pri-color);
}

.cm-side-count {
  font-size: .78rem;
  color: var(--wtext-color);
  font-variant-numeric: tabular-nums;
}

.cm-side-p {
  font-size: .9rem;
  line-height: 1.55;
  color: var(--wtext-color);
  margin: 0 0 12px;
}

.cm-btn {
  display: inline-block;
  padding: 9px 18px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(135deg, var(--pri-color) 0%, var(--secondary-color) 100%);
  border-radius: var(--bxbra);
}

.cm-btn:hover {
  color: #fff;
  opacity: .9;
}

/* ------------------------------------------------------------------ footer */

.cm-copyright {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: .85rem;
  color: var(--ftwtext-color);
}

.cm-copyright a {
  color: var(--ftwtext-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cm-404-list li {
  margin-bottom: 10px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 991px) {
  .bs-blog-post.single .bs-header .title {
    font-size: 2.15rem;
  }

  .bs-blog-post.single .bs-header .cm-standfirst {
    font-size: 1.1rem;
  }

  .cm-body > p:first-of-type {
    font-size: 1.1875rem;
  }

  .cm-brief,
  .cm-sources {
    padding: 22px 20px;
  }
}

@media (max-width: 575px) {
  .cm-body h2 {
    font-size: 1.35rem;
    margin-top: 34px;
  }

  .cm-card-plate {
    height: 150px;
  }
}
