/* Blog articles (build-articles.js). --t is the article's topic colour, set on <main>; colour marks things
   (tags, bars, bullets) while text stays in the ink colour. These pages don't load tools.css, so the brand
   colours are defined here. */
.ar {
  --dl-purple: #a349a4;
  --dl-purple-dark: #7d3480;
  --dl-ink: #303d4e;
  --dl-muted: #5f6b7a;
  --dl-line: #e3e6ea;
  --t: var(--dl-purple);
}

/* ---- header (selector weight matches style.css's section spacing rule, and wins by coming later) */
main.page-sections.ar > section.ar-hero {
  padding: 124px 0 44px;
  background:
    radial-gradient(600px 320px at 90% 10%, color-mix(in srgb, var(--t) 16%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--t) 5%, #fff), #fff);
}

.ar-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--dl-muted);
}

.ar-crumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: #b9bfc8;
}

.ar-crumbs a {
  color: var(--dl-purple-dark);
}

.ar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: center;
}

.ar-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--t) 12%, #fff);
  color: var(--dl-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.ar-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--t);
}

a.ar-tag:hover {
  background: color-mix(in srgb, var(--t) 20%, #fff);
  color: var(--dl-ink);
}

.ar-hero h1 {
  margin: 14px 0 14px;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--dl-ink);
}

.ar-standfirst {
  max-width: 680px;
  margin: 0 0 20px;
  font-size: 19px;
  line-height: 1.6;
  color: var(--dl-muted);
}

.ar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--dl-muted);
}

.ar-meta li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ar-meta i {
  color: var(--t);
}

/* the illustration: always the same size, so no image can take over the page */
.ar-art {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 45%, #fff 0%, color-mix(in srgb, var(--t) 12%, #fff) 72%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t) 16%, transparent);
}

.ar-art img {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  object-fit: contain;
}

/* ---- body: contents list beside a comfortable reading column */
main.page-sections.ar > section.ar-main {
  padding: 40px 0 56px;
}

.ar-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  justify-content: center;
  gap: 48px;
  align-items: start;
}

.ar-toc {
  position: sticky;
  top: 104px;
}

.ar-toc summary {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--dl-muted);
  list-style: none;
  cursor: default;
}

.ar-toc summary::-webkit-details-marker {
  display: none;
}

.ar-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--dl-line);
}

.ar-toc a {
  display: block;
  margin-left: -2px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid transparent;
  font-size: 14px;
  line-height: 1.4;
  color: var(--dl-muted);
  text-decoration: none;
}

.ar-toc a:hover {
  color: var(--dl-ink);
}

.ar-toc a.is-current {
  border-left-color: var(--t);
  color: var(--dl-ink);
  font-weight: 700;
}

.ar-content {
  min-width: 0;
  font-size: 17px;
  line-height: 1.75;
  color: #3c4757;
}

.ar-content > p:first-child {
  font-size: 18px;
}

.ar-content p,
.ar-content ul,
.ar-content > ol,
.ar-callout > ol {
  margin: 0 0 18px;
}

.ar-content > h2,
.ar-callout > h2,
.ar-sources > h2 {
  position: relative;
  margin: 44px 0 14px;
  padding-top: 18px;
  scroll-margin-top: 100px;
  font-family: "Montserrat", sans-serif;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--dl-ink);
}

/* a short topic-coloured bar above each section */
.ar-content > h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--t);
}

.ar-content > h3,
.ar-callout > h3 {
  margin: 28px 0 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--dl-ink);
}

.ar-content strong {
  color: var(--dl-ink);
}

.ar-content a {
  color: var(--dl-purple-dark);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--dl-purple) 40%, transparent);
  text-underline-offset: 3px;
}

.ar-content a:hover {
  text-decoration-color: var(--dl-purple);
}

.ar-content > ul,
.ar-callout > ul,
.ar-sources > ul {
  padding-left: 0;
  list-style: none;
}

.ar-content > ul > li,
.ar-callout > ul > li,
.ar-sources > ul > li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 24px;
}

.ar-content > ul > li::before,
.ar-callout > ul > li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--t);
}

.ar-content > ol,
.ar-callout > ol {
  padding-left: 0;
  list-style: none;
  counter-reset: ar-step;
}

.ar-content > ol > li,
.ar-callout > ol > li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 40px;
  counter-increment: ar-step;
}

.ar-content > ol > li::before,
.ar-callout > ol > li::before {
  content: counter(ar-step);
  position: absolute;
  top: 2px;
  left: 0;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--t) 14%, #fff);
  color: var(--dl-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

/* figures: diagrams and screenshots at the column width, open full size in a new tab */
.ar-figure {
  margin: 26px 0 30px;
}

.ar-figure a {
  display: block;
  padding: 10px;
  border: 1px solid var(--dl-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(48, 61, 78, 0.07);
  cursor: zoom-in;
}

.ar-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.ar-figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dl-muted);
}

.ar-figure figcaption i {
  margin-left: 6px;
  font-size: 12px;
}

/* a highlighted note */
.ar-callout {
  margin: 28px 0;
  padding: 22px 24px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--t) 22%, #fff);
  background: color-mix(in srgb, var(--t) 7%, #fff);
}

.ar-callout > :first-child {
  margin-top: 0;
}

.ar-callout > :last-child {
  margin-bottom: 0;
}

.ar-callout h2,
.ar-callout h3 {
  padding-top: 0;
  font-size: 20px;
}

.ar-callout h2::before {
  display: none;
}

/* sources: a card at the end of the article */
.ar-sources {
  margin: 44px 0 0;
  padding: 24px 26px;
  border-radius: 18px;
  background: #f6f7f9;
  border: 1px solid var(--dl-line);
}

.ar-sources h2 {
  margin: 0 0 12px;
  padding-top: 0;
  font-size: 18px;
}

.ar-sources h2::before {
  display: none;
}

.ar-sources ul {
  margin: 0;
}

.ar-sources ul > li {
  padding-left: 26px;
  font-size: 15px;
  line-height: 1.55;
}

.ar-sources ul > li::before {
  content: "\F1C5";
  top: 0.15em;
  left: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-family: "bootstrap-icons";
  font-size: 14px;
  color: var(--t);
}

/* ---- related reading */
main.page-sections.ar > section.ar-related {
  padding: 48px 0 64px;
  background: #f7f8fa;
}

.ar-related h2 {
  margin: 0 0 20px;
  font-family: "Montserrat", sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--dl-ink);
}

.ar-rel-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ar-rel {
  display: flex;
  height: 100%;
  border: 1px solid var(--dl-line);
  border-radius: 16px;
  background: #fff;
  color: var(--dl-ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ar-rel:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--t) 40%, #fff);
  box-shadow: 0 14px 30px rgba(48, 61, 78, 0.1);
  color: var(--dl-ink);
}

.ar-rel-art {
  position: relative;
  flex: 0 0 104px;
  background: radial-gradient(circle at 50% 45%, #fff 0%, color-mix(in srgb, var(--t) 12%, #fff) 72%);
}

.ar-rel-art img {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
}

.ar-rel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
}

.ar-rel .ar-tag {
  align-self: flex-start;
  font-size: 12px;
}

.ar-rel-title {
  flex: 1;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.ar-rel-go {
  font-size: 13px;
  font-weight: 700;
  color: var(--dl-purple);
}

.ar-toc a:focus-visible,
.ar-rel:focus-visible,
.ar-figure a:focus-visible,
.ar-tag:focus-visible {
  outline: 3px solid var(--dl-purple);
  outline-offset: 3px;
}

/* ---- sizes */
@media (max-width: 1199px) {
  .ar-rel-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  main.page-sections.ar > section.ar-hero {
    padding: 108px 0 32px;
  }

  .ar-head {
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 24px;
  }

  .ar-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  /* the contents list becomes a collapsible box above the article */
  .ar-toc {
    position: static;
    padding: 12px 16px;
    border: 1px solid var(--dl-line);
    border-radius: 14px;
    background: #fff;
  }

  .ar-toc summary {
    margin: 0;
    cursor: pointer;
  }

  .ar-toc summary::after {
    content: "\F282";
    float: right;
    font-family: "bootstrap-icons";
    font-size: 13px;
    transition: transform 0.2s ease;
  }

  .ar-toc details[open] summary {
    margin-bottom: 10px;
  }

  .ar-toc details[open] summary::after {
    transform: rotate(180deg);
  }
}

@media (max-width: 575px) {
  main.page-sections.ar > section.ar-hero {
    padding: 100px 0 26px;
  }

  .ar-head {
    grid-template-columns: 1fr;
  }

  /* on phones the illustration is a small accent, not a full-width picture */
  .ar-art {
    order: -1;
    width: 120px;
    border-radius: 18px;
  }

  .ar-art img {
    inset: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
  }

  .ar-standfirst {
    font-size: 17px;
  }

  .ar-content {
    font-size: 16px;
  }

  .ar-content > h2,
.ar-callout > h2,
.ar-sources > h2 {
    font-size: 22px;
  }

  .ar-sources {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-rel,
  .ar-toc summary::after {
    transition: none;
  }
}
