/* ==========================================================================
   Dynamic Mockups — the template catalogue
   --------------------------------------------------------------------------
   template-grid and template-row, plus the card both render. These are the
   highest-traffic surfaces on the site (~24,000 URLs), so the card is the one
   piece of CSS here worth being careful about: it is painted 24 at a time on
   every category and tag page.

   The card carries its title as an overlay rather than a caption row. Template
   titles are long and near-identical ("Woman wearing blank white plain hoodie
   mockup 256"), so a caption under each card makes every card a different
   height and the grid unreadable. Over the render, clipped to one line, the
   picture does the work.
   ========================================================================== */

/* ==========================================================================
   The card
   ========================================================================== */
.dm-tpl-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--dm-radius-card);
  background: var(--dm-surface-card);
  box-shadow: var(--dm-card-inset);
  aspect-ratio: 3 / 4;
}

.dm-tpl-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* A render that has not arrived yet should not flash the card's ground. */
  background: var(--dm-surface-card);
}

.dm-tpl-card-blank {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--dm-surface-card);
}

.dm-tpl-card-title {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 14px 12px;
  background: linear-gradient(to top, rgb(33 34 29 / .74), rgb(33 34 29 / 0));
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #F4F5F1;
  /* One line: these titles run to ten words and would otherwise cover the
     render they are labelling. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-motion .dm-tpl-card img { transition: transform .35s var(--dm-ease-press, ease); }
.dm-motion .dm-tpl-card:hover img { transform: scale(1.04); }

.dm-tpl-card:focus-visible {
  outline: 2px solid var(--dm-ink);
  outline-offset: 3px;
}

/* ==========================================================================
   template-grid
   ========================================================================== */
.dm-tpl-head {
  max-width: 62ch;
  margin-bottom: 40px;
}

.dm-tpl-head .dm-lead { max-width: 60ch; margin-top: 12px; }

.dm-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.dm-tpl-empty {
  padding: 48px 0;
  font-size: var(--dm-text-body-md);
  color: var(--dm-text-secondary);
}

/* ---- pagination ---- */
.dm-tpl-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
}

/* paginate_links() emits <a class="page-numbers"> and <span class="current">,
   so the selectors here are WordPress's, not ours — do not rename them. */
.dm-tpl-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--dm-border-card);
  border-radius: var(--dm-radius-button);
  background: var(--dm-surface-white);
  font-size: var(--dm-text-body-sm);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-tpl-pagination .page-numbers:hover { border-color: var(--dm-border-hairline); }

.dm-tpl-pagination .page-numbers.current {
  border-color: var(--dm-ink);
  background: var(--dm-ink);
  color: var(--dm-on-ink);
}

.dm-tpl-pagination .page-numbers.dots {
  border-color: transparent;
  background: none;
}

/* ==========================================================================
   template-row
   ========================================================================== */
.dm-tpl-row + .dm-tpl-row { margin-top: 64px; }

.dm-tpl-row .dm-container { padding-block: 0; }

.dm-tpl-row-head { align-items: center; margin-bottom: 28px; }
.dm-tpl-row-head .dm-h2 { margin-bottom: 0; }

.dm-tpl-row-ctl {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* The rail's cards keep a fixed width; the carousel scrolls them. */
.dm-tpl-row .dm-car-track .dm-tpl-card {
  flex: none;
  width: 260px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .dm-tpl-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .dm-tpl-row .dm-car-track .dm-tpl-card { width: 190px; }
  .dm-tpl-row + .dm-tpl-row { margin-top: 48px; }
  .dm-tpl-card-title { padding: 20px 10px 9px; font-size: 12px; }
}

/* ==========================================================================
   The hub (/templates/)
   ========================================================================== */
/* Centred: the hub opens on a statement, and the category rails below it are
   left-aligned — a left-aligned h1 over them just reads as another rail head. */
.dm-tpl-hub-head .dm-container {
  padding-block: 72px 56px;
  text-align: center;
}

.dm-tpl-hub-head h1 {
  max-width: 20ch;
  margin-inline: auto;
  font-family: var(--dm-font-display);
  font-weight: 400;
  font-size: clamp(36px, 4.6vw, 58px);
  line-height: var(--dm-leading-display);
  letter-spacing: var(--dm-tracking-display);
  color: var(--dm-ink);
}

.dm-tpl-hub-head .dm-lead {
  max-width: 58ch;
  margin: 18px auto 0;
  font-size: var(--dm-text-body-lg);
}

.dm-tpl-hub-rows { padding-bottom: 96px; }

@media (max-width: 720px) {
  .dm-tpl-hub-head .dm-container { padding-block: 48px 40px; }
  .dm-tpl-hub-rows { padding-bottom: 64px; }
}

/* ==========================================================================
   Breadcrumb (split-hero)
   ========================================================================== */
.dm-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--dm-text-tertiary);
}

.dm-crumbs a { color: var(--dm-text-secondary); }
.dm-crumbs a:hover { color: var(--dm-ink); }
.dm-crumbs [aria-current] { color: var(--dm-ink); font-weight: 600; }

/* On a CPT single the crumbs sit above the hero rather than inside it, so they
   bring their own top space. Breadcrumb NavXT emits bare <a>s and a separator
   as text, so the gap comes from the flex row, not from margins on links. */
.dm-crumbs-wrap { padding-block: 24px 0; }
.dm-crumbs-wrap .dm-crumbs { margin-bottom: 0; }

/* An ACF media slot can hold a shortcode — an embedded editor, a free tool —
   which the pool cannot express as a section, so it is echoed after the hero. */
.dm-landing-embed { padding-block: 24px 8px; }
.dm-landing-embed > :only-child { margin-inline: auto; }

/* ==========================================================================
   split-hero's media slot
   ========================================================================== */
.dm-shero-media {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--dm-radius-card-inner);
  background: var(--dm-surface-card);
  box-shadow: var(--dm-card-inset);
}

.dm-shero-media video,
.dm-shero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-shero-media-empty {
  padding: 20px;
  font-family: var(--dm-font-mono);
  font-size: var(--dm-text-label);
  text-align: center;
  color: var(--dm-text-tertiary);
}

/* ==========================================================================
   pill-bar
   ========================================================================== */
.dm-pills--card { background: var(--dm-surface-card); }

.dm-pills .dm-container { padding-block: 24px; }

.dm-pills-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.dm-pills-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.dm-pills-label {
  font-family: var(--dm-font-mono);
  font-size: var(--dm-text-label);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dm-text-tertiary);
}

.dm-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.dm-pills-list li {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--dm-surface-white);
  box-shadow: var(--dm-card-inset);
  font-size: 13px;
  font-weight: 500;
  color: var(--dm-ink);
}

.dm-pills-divider {
  width: 1px;
  height: 24px;
  background: var(--dm-border-hairline);
}

/* ==========================================================================
   link-chips: the sibling-category rail
   ========================================================================== */
.dm-chip.is-current {
  border-color: var(--dm-ink);
  background: var(--dm-ink);
  color: var(--dm-on-ink);
}

.dm-chip.is-current svg { color: currentColor; }

@media (max-width: 720px) {
  .dm-pills-divider { display: none; }
  .dm-pills-inner { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   template-hero — one template's own page
   ========================================================================== */
.dm-thero .dm-container { padding-block: 40px 72px; }

.dm-thero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}

/* min-width: 0 on both, or the render's intrinsic width widens its own track
   past the ratio — the same trap as split-hero. */
.dm-thero-media,
.dm-thero-copy { min-width: 0; }

.dm-thero-media {
  overflow: hidden;
  border-radius: var(--dm-radius-card-inner);
  background: var(--dm-surface-card);
  box-shadow: var(--dm-card-inset);
}

.dm-thero-media img {
  display: block;
  width: 100%;
  height: auto;
}

.dm-thero-copy h1 {
  font-family: var(--dm-font-display);
  font-weight: 400;
  font-size: clamp(28px, 3vw, 40px);
  line-height: var(--dm-leading-display);
  letter-spacing: var(--dm-tracking-display);
  color: var(--dm-ink);
}

.dm-thero-desc {
  margin-top: 16px;
  font-size: var(--dm-text-body-md);
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

.dm-thero-desc p + p { margin-top: 12px; }

.dm-thero-label {
  margin-bottom: 10px;
  font-family: var(--dm-font-mono);
  font-size: var(--dm-text-label);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dm-text-tertiary);
}

/* ---- colour swatches ---- */
.dm-thero-colours { margin-top: 28px; }

.dm-thero-colours ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.dm-swatch {
  display: block;
  padding: 3px;
  border: 1px solid var(--dm-border-card);
  border-radius: 50%;
  transition: border-color .15s ease;
}

.dm-swatch span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  /* A white swatch on a white ring needs an edge of its own to be a circle. */
  box-shadow: inset 0 0 0 1px rgb(33 34 29 / .12);
}

.dm-swatch:hover { border-color: var(--dm-border-hairline); }
.dm-swatch.is-current { border-color: var(--dm-ink); border-width: 2px; padding: 2px; }

.dm-swatch:focus-visible {
  outline: 2px solid var(--dm-ink);
  outline-offset: 2px;
}

.dm-thero-actions { margin-top: 28px; }

/* ---- tags ---- */
.dm-thero-tags {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--dm-border-card);
}

.dm-thero-tags ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.dm-thero-tags a {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--dm-surface-card);
  font-size: var(--dm-text-label);
  color: var(--dm-text-secondary);
}

.dm-thero-tags a:hover { color: var(--dm-ink); }

@media (max-width: 900px) {
  .dm-thero-grid { grid-template-columns: 1fr; gap: 28px; }
  .dm-thero .dm-container { padding-block: 24px 48px; }
}

/* ---- template-hero extras (the batch-routed page) ---- */
.dm-thero-byline {
  margin-top: 12px;
  font-size: 13px;
  color: var(--dm-text-tertiary);
}

.dm-thero-byline a { color: var(--dm-text-secondary); }
.dm-thero-byline a:hover { color: var(--dm-ink); }

.dm-thero-features { margin-top: 24px; }

.dm-thero-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--dm-text-tertiary);
}

.dm-thero-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  list-style: none;
}

.dm-thero-logos img {
  height: 20px;
  width: auto;
  filter: grayscale(1);
  opacity: .5;
}

/* ---- template-grid: fixed column counts, and the angle card's subtitle ---- */
.dm-tpl-grid--3 { grid-template-columns: repeat(3, 1fr); }
.dm-tpl-grid--4 { grid-template-columns: repeat(4, 1fr); }

.dm-tpl-card-sub {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: var(--dm-text-label);
  opacity: .8;
}

/* ---- versus-table: the matrix shape ---- */
/* Seven columns need tighter cells than two, or every value wraps. */
.dm-vs-table--matrix { min-width: 960px; }
.dm-vs-table--matrix th[scope="row"] { width: auto; min-width: 200px; }

.dm-vs-table--matrix th,
.dm-vs-table--matrix td {
  padding: 12px 14px;
  font-size: 13px;
}

.dm-vs-table--matrix td,
.dm-vs-table--matrix thead th { text-align: center; }

.dm-vs-table--matrix th[scope="row"] { text-align: left; }

.dm-vs-mark {
  display: inline-flex;
  vertical-align: -3px;
  margin-right: 5px;
}

.dm-vs-mark--check { color: var(--dm-check); }
.dm-vs-mark--close { color: var(--dm-neutral-300); }
.dm-vs-mark--info-circle { color: var(--dm-yellow-700); }

@media (max-width: 900px) {
  .dm-tpl-grid--3,
  .dm-tpl-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   prose — an article body
   --------------------------------------------------------------------------
   These rules style content this section does not control (a Growth Engine
   write-up, a knowledge piece), so they hang off the container and reach
   whatever HTML arrives rather than naming classes that may not exist.
   ========================================================================== */
.dm-prose--card { background: var(--dm-surface-card); }

.dm-prose-body {
  /* Long-form at container width is unreadable; about 70 characters is the
     line length prose wants. */
  max-width: 70ch;
}

.dm-prose-body .dm-h2 { margin-top: 12px; }

.dm-prose-body > h2,
.dm-prose-body > h3,
.dm-prose-body > h4 {
  margin-top: 40px;
  font-family: var(--dm-font-display);
  font-weight: 400;
  line-height: var(--dm-leading-display);
  letter-spacing: var(--dm-tracking-display);
  color: var(--dm-ink);
}

.dm-prose-body > h2 { font-size: var(--dm-text-h3); }
.dm-prose-body > h3 { font-size: var(--dm-text-h4); }
.dm-prose-body > h4 { font-size: var(--dm-text-body-lg); font-weight: 600; font-family: var(--dm-font-body); }

.dm-prose-body > p,
.dm-prose-body > ul,
.dm-prose-body > ol {
  margin-top: 16px;
  font-size: var(--dm-text-body-md);
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

.dm-prose-body > ul,
.dm-prose-body > ol { padding-left: 22px; }
.dm-prose-body > ul { list-style: disc; }
.dm-prose-body > ol { list-style: decimal; }
.dm-prose-body li + li { margin-top: 6px; }

.dm-prose-body a { color: var(--dm-ink); text-decoration: underline; }
.dm-prose-body a:hover { color: var(--dm-accent-primary); }
.dm-prose-body strong { font-weight: 600; color: var(--dm-ink); }

.dm-prose-body img {
  display: block;
  margin-top: 24px;
  border-radius: var(--dm-radius-card);
}

/* The angle the hero is already showing. */
.dm-tpl-card.is-current { box-shadow: inset 0 0 0 2px var(--dm-ink); }

.dm-tpl-card-mark {
  display: inline-block;
  margin-left: 5px;
  vertical-align: -2px;
  color: var(--dm-check);
}

/* ==========================================================================
   swatch-grid
   ========================================================================== */
.dm-swatches-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 32px;
  align-items: start;
}

.dm-swatches-panel {
  padding: 28px;
  background: var(--dm-surface-white);
  box-shadow: var(--dm-card-inset);
}

.dm-swatches-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 22px 12px;
  margin-top: 20px;
  list-style: none;
  text-align: center;
}

.dm-swatch-dot {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  /* A white or very pale swatch needs an edge of its own to read as a circle. */
  box-shadow: inset 0 0 0 1px rgb(33 34 29 / .14);
}

.dm-swatch-name {
  display: block;
  margin-top: 10px;
  font-family: var(--dm-font-mono);
  font-size: var(--dm-text-label);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--dm-text-secondary);
}

.dm-swatches-aside h3 {
  font-family: var(--dm-font-display);
  font-weight: 400;
  font-size: var(--dm-text-h3);
  line-height: var(--dm-leading-display);
  letter-spacing: var(--dm-tracking-display);
  color: var(--dm-ink);
}

.dm-swatches-text {
  margin-top: 14px;
  font-size: var(--dm-text-body-md);
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

.dm-swatches-note {
  margin-top: 24px;
  padding: 20px;
  background: var(--dm-surface-white);
  box-shadow: var(--dm-card-inset);
}

.dm-swatches-note-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--dm-text-body-md);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-swatches-note p:last-child {
  margin-top: 8px;
  font-size: 13px;
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

.dm-swatches-points-label { margin-top: 26px; }

.dm-swatches-points {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.dm-swatches-points li {
  font-size: var(--dm-text-body-sm);
  color: var(--dm-text-secondary);
}

.dm-swatches-points strong { color: var(--dm-ink); font-weight: 600; }

.dm-swatches-cta { margin-top: 24px; }

.dm-swatches-cta a {
  font-size: var(--dm-text-body-sm);
  font-weight: 700;
  color: var(--dm-ink);
}

.dm-swatches-cta a:hover { color: var(--dm-accent-primary); }

@media (max-width: 900px) {
  .dm-swatches-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   split-panels — two related lists, side by side
   ========================================================================== */
.dm-panels--card { background: var(--dm-surface-card); }

.dm-panels-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.dm-panels-grid--even { grid-template-columns: 1fr 1fr; }
.dm-panels-grid--wide-left { grid-template-columns: 1.2fr .8fr; }
.dm-panels-grid--wide-right { grid-template-columns: .8fr 1.2fr; }

/* A panel whose blocks sit side by side as their own cards — two lists being
   compared, rather than one list after another. */
.dm-panel--cols { display: flex; flex-direction: column; }

.dm-panel-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  /* The cards carry their own padding, so the panel's would double it. */
  margin: 0 -4px;
}

.dm-panel-col {
  padding: 20px;
  border-radius: var(--dm-radius-card);
  background: var(--dm-surface-white);
  box-shadow: var(--dm-card-inset);
}

.dm-panel-col--ink {
  background: var(--dm-surface-dark);
  box-shadow: none;
}

.dm-panel-col > :first-child { margin-top: 0; }
.dm-panel-col .dm-panel-specs { margin-bottom: 0; }

.dm-panel-label--yes,
.dm-panel-label--no { display: flex; align-items: center; gap: 6px; }

.dm-panel-label--yes span { color: var(--dm-check); }
.dm-panel-label--no span { color: var(--dm-accent-primary); }

.dm-panel {
  min-width: 0;
  padding: 32px;
  border-radius: var(--dm-radius-card-inner);
  background: var(--dm-surface-white);
  box-shadow: var(--dm-card-inset);
}

.dm-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-family: var(--dm-font-display);
  font-weight: 400;
  font-size: var(--dm-text-h4);
  line-height: var(--dm-leading-heading);
  color: var(--dm-ink);
}

.dm-panel-title svg { color: var(--dm-accent-primary); }

.dm-panel-label { margin-top: 26px; }
.dm-panel-title + .dm-panel-label { margin-top: 0; }

.dm-panel-text {
  font-size: var(--dm-text-body-md);
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

.dm-panel-text p + p { margin-top: 12px; }

/* ---- specs ---- */
.dm-panel-specs > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--dm-border-card);
}

.dm-panel-specs > div:last-child { border-bottom: 0; }

.dm-panel-specs dt {
  font-size: var(--dm-text-body-sm);
  color: var(--dm-text-secondary);
}

.dm-panel-specs dd {
  font-family: var(--dm-font-mono);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  color: var(--dm-ink);
  overflow-wrap: anywhere;
}

.dm-panel-specs dd a { text-decoration: underline; }

/* ---- steps ---- */
.dm-panel-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  list-style: none;
}

.dm-panel-steps > li {
  display: flex;
  gap: 14px;
}

.dm-panel-step-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dm-ink);
  font-family: var(--dm-font-mono);
  font-size: 11px;
  color: var(--dm-on-ink);
}

.dm-panel-steps strong {
  display: block;
  font-size: var(--dm-text-body-sm);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-panel-steps strong + span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

/* ---- links ---- */
.dm-panel-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.dm-panel-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--dm-border-card);
  border-radius: var(--dm-radius-button);
  transition: border-color .15s ease;
}

.dm-panel-links a:hover { border-color: var(--dm-ink); }

.dm-panel-links strong {
  display: block;
  font-size: var(--dm-text-body-sm);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-panel-links strong + span {
  display: block;
  margin-top: 2px;
  font-size: var(--dm-text-label);
  color: var(--dm-text-tertiary);
}

.dm-panel-links svg { flex: none; color: var(--dm-text-tertiary); }

/* ---- Q&A ---- */
.dm-panel-qa > div + div {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--dm-border-card);
}

.dm-panel-qa dt {
  font-size: var(--dm-text-body-sm);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-panel-qa dd {
  margin-top: 6px;
  font-size: 13px;
  line-height: var(--dm-leading-body);
  color: var(--dm-text-secondary);
}

/* ---- chips ---- */
.dm-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.dm-panel-chips li > * {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--dm-border-card);
  border-radius: 999px;
  font-size: var(--dm-text-label);
  color: var(--dm-text-secondary);
}

.dm-panel-chips a:hover { border-color: var(--dm-ink); color: var(--dm-ink); }

/* ---- stats ---- */
.dm-panel-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.dm-panel-stats .dm-card {
  padding: 18px;
  background: var(--dm-surface-page);
  box-shadow: var(--dm-card-inset);
}

.dm-panel-stat-value {
  font-family: var(--dm-font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: var(--dm-tracking-display);
  color: var(--dm-accent-primary);
}

.dm-panel-stat-label {
  margin-top: 8px;
  font-size: var(--dm-text-body-sm);
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-panel-stat-note {
  margin-top: 4px;
  font-size: var(--dm-text-label);
  line-height: 1.45;
  color: var(--dm-text-tertiary);
}

@media (max-width: 900px) {
  .dm-panels-grid--even,
  .dm-panels-grid--wide-left,
  .dm-panels-grid--wide-right { grid-template-columns: 1fr; }
  .dm-panel { padding: 24px; }
}

/* ==========================================================================
   Performance study — the research band and its calculator
   --------------------------------------------------------------------------
   An ink island: `.dm-dark` on the section re-declares the semantic tokens, so
   every child below reads the right ground without a single override. Do not
   reach for a colour ramp token in here — that is what breaks on inversion.
   ========================================================================== */

.dm-study { background: var(--dm-surface-page); }

.dm-study-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 40px;
  margin-bottom: 32px;
}

.dm-study-head .dm-h2 { margin: 4px 0 0; }

.dm-study-note {
  max-width: 30ch;
  margin: 0;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--dm-text-secondary);
  text-align: right;
}

/* ---- the four figures ---- */

.dm-study-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}

.dm-study-stats .dm-card {
  padding: 20px;
  background: var(--dm-surface-card);
  border-radius: var(--dm-radius-card);
  box-shadow: var(--dm-card-inset);
}

.dm-study-stats dt {
  margin: 0 0 10px;
  font-family: var(--dm-font-mono);
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--dm-accent-primary);
}

.dm-study-stats dd { margin: 0; }

.dm-study-stats dd strong {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-study-stats dd span {
  display: block;
  margin-top: 4px;
  font-size: .75rem;
  line-height: 1.45;
  color: var(--dm-text-secondary);
}

/* ---- the one finding, and the tiers that prove it ---- */

.dm-study-finding {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 40px;
  padding: 18px 24px;
  /* The accent rule on the left is the whole point of the row: this is the
     finding, not another stat. */
  border: 1px solid var(--dm-accent-primary);
  border-left-width: 3px;
  border-radius: var(--dm-radius-card);
}

.dm-study-finding-title {
  margin: 0;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-study-finding-text {
  max-width: 52ch;
  margin: 4px 0 0;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--dm-text-secondary);
}

.dm-study-tiers {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dm-study-tiers li {
  position: relative;
  text-align: right;
}

.dm-study-tier-value {
  display: block;
  font-family: var(--dm-font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dm-text-secondary);
}

.dm-study-tier-label {
  display: block;
  margin-top: 2px;
  font-family: var(--dm-font-mono);
  font-size: .625rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dm-text-tertiary);
}

.dm-study-tiers .is-optimal .dm-study-tier-value {
  font-size: 1.5rem;
  color: var(--dm-ink);
}

.dm-study-tiers .is-optimal .dm-study-tier-label { color: var(--dm-accent-primary); }

.dm-study-optimal {
  display: block;
  margin-bottom: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--dm-accent-primary);
  color: #FFFFFF;
  font-family: var(--dm-font-mono);
  font-size: .5625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---- the calculator: inputs on paper, the answer on accent ---- */

.dm-study-calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-top: 32px;
  border-radius: var(--dm-radius-card-inner);
  overflow: hidden;
}

/* Two grounds inside one dark band, so each half re-declares its own tokens
   rather than overriding each child. Same island rule, one level down. */
.dm-study-calc-inputs {
  --dm-surface-page: #F4F5F1;
  --dm-surface-card: #FFFFFF;
  --dm-ink: #21221D;
  --dm-text-body: #4F5049;
  --dm-text-secondary: #6B6C63;
  --dm-text-tertiary: #93948B;
  --dm-border-hairline: #DDDED4;
  padding: 28px;
  background: var(--dm-surface-page);
  color: var(--dm-text-body);
}

.dm-study-calc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--dm-ink);
}

.dm-study-calc-title svg { color: var(--dm-accent-primary); }

.dm-study-calc-text {
  margin: 6px 0 24px;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--dm-text-secondary);
}

.dm-study-field { position: relative; }

/* Stacked fields need the gap; the two inside a pair are siblings too, and
   the gap dropped the second one half a row down. The pair owns its own. */
.dm-study-calc-inputs > .dm-study-field + .dm-study-field,
.dm-study-calc-inputs > .dm-study-field + .dm-study-pair,
.dm-study-calc-inputs > .dm-study-pair + .dm-study-field { margin-top: 20px; }

.dm-study-field label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--dm-font-mono);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dm-text-secondary);
}

.dm-study-field output {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--dm-font-mono);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--dm-accent-primary);
}

.dm-study-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* The theme styles bare `input`, so every control resets explicitly. */
.dm-study-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: var(--dm-surface-card);
  border: 1px solid var(--dm-border-hairline);
  border-radius: var(--dm-radius-button);
}

.dm-study-input span {
  font-family: var(--dm-font-mono);
  font-size: .75rem;
  color: var(--dm-text-tertiary);
}

.dm-study-input input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font-family: var(--dm-font-mono);
  font-size: .875rem;
  font-weight: 600;
  color: var(--dm-ink);
  -webkit-appearance: textfield;
  appearance: textfield;
}

.dm-study-input input:focus { outline: none; }
.dm-study-input:focus-within { border-color: var(--dm-accent-primary); }

.dm-study-field input[type="range"] {
  display: block;
  width: 100%;
  height: 4px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  /* --dm-range is the filled fraction, written by catalogue.js. */
  background: linear-gradient(
    to right,
    var(--dm-accent-primary) 0 var(--dm-range, 10%),
    var(--dm-border-hairline) var(--dm-range, 10%) 100%
  );
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.dm-study-field input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--dm-accent-primary);
  -webkit-appearance: none;
  appearance: none;
  cursor: grab;
}

.dm-study-field input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--dm-accent-primary);
  cursor: grab;
}

.dm-study-field input[type="range"]:focus-visible {
  outline: 2px solid var(--dm-accent-primary);
  outline-offset: 6px;
}

/* The answer half — accent ground, so it re-declares tokens the same way. */
.dm-study-calc-out {
  --dm-ink: #FFFFFF;
  --dm-text-body: #FFFFFF;
  --dm-text-secondary: rgb(255 255 255 / .76);
  --dm-border-hairline: rgb(255 255 255 / .28);
  --dm-surface-white: #FFFFFF;
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--dm-accent-primary);
  color: var(--dm-text-body);
  text-align: center;
}

.dm-study-out-label {
  margin: 0;
  font-family: var(--dm-font-mono);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dm-text-secondary);
}

.dm-study-out-figure {
  margin: 8px 0 20px;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--dm-ink);
  font-variant-numeric: tabular-nums;
}

.dm-study-out-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 20px;
  padding: 20px 0 0;
  border-top: 1px solid var(--dm-border-hairline);
}

.dm-study-out-pair dt {
  margin: 0 0 4px;
  font-family: var(--dm-font-mono);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dm-text-secondary);
}

.dm-study-out-pair dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--dm-ink);
  font-variant-numeric: tabular-nums;
}

.dm-study-out-cta {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

@media (max-width: 1023px) {
  .dm-study-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dm-study-calc { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
  .dm-study-note { text-align: left; }
  .dm-study-stats { grid-template-columns: minmax(0, 1fr); }
  .dm-study-finding { padding: 16px 18px; }
  .dm-study-tiers { gap: 18px; }
  .dm-study-tiers li { text-align: left; }
}

/* One button under a template grid — the ACF `templates_category_grid` layout
   carries a call to action, and every use case uses it. */
.dm-tpl-cta {
  margin-top: 36px;
  text-align: center;
}
