.ds-activity {
  --ds-tool-bg: #f4eee4;
  margin-block: clamp(1.8rem, 4.2vw, 3.5rem);
  min-width: 0;
  padding: clamp(1rem, 3.4vw, 2.25rem);
  border: 1px solid var(--ds-line, #d9cfc5);
  border-radius: 1.25rem;
  color: var(--ds-ink, #391e1c);
  background: var(--ds-tool-bg);
  overflow-wrap: anywhere;
}
.ds-activity [hidden] { display: none !important; }
.ds-activity :focus-visible { outline: 2px solid var(--ds-brand, #751f2a); outline-offset: 3px; }
.ds-activity :where(p, figure, ol, ul, h3, h4, table, dl, dd) { margin: 0; }
.ds-activity :where(a) { color: var(--ds-brand, #751f2a); text-underline-offset: 0.18em; }
.ds-activity-heading { max-width: 42rem; margin-bottom: 1rem; }
.ds-activity-heading h3 { font-size: clamp(1.65rem, 4.15vw, 2.5rem); line-height: 1.02; }
.ds-activity-heading p { margin-top: .55rem; font-size: .98rem; line-height: 1.5; }
.ds-activity h4 { color: var(--ds-ink, #391e1c); font-size: 1.12rem; line-height: 1.25; }
.ds-tool-action, .ds-tool-option {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  padding: .45rem .85rem;
  border: 1px solid var(--ds-ink, #391e1c);
  border-radius: .5rem;
  color: var(--ds-ink, #391e1c);
  background: var(--ds-paper, #fbf8f2);
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: start;
  cursor: pointer;
}
.ds-tool-action { color: white; border-color: var(--ds-brand, #751f2a); background: var(--ds-brand, #751f2a); }
.ds-tool-option[aria-pressed="true"] { color: white; border-color: var(--ds-ink, #391e1c); background: var(--ds-ink, #391e1c); }
.ds-tool-option:not([aria-pressed="true"]):hover { background: #efe1d4; }
.ds-tool-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.ds-tool-pane, .ds-term, .ds-audit-row, .ds-model-grid > div {
  min-width: 0;
  padding: .9rem;
  border: 1px solid var(--ds-line, #d9cfc5);
  border-radius: .65rem;
  background: var(--ds-paper, #fbf8f2);
}
.ds-tool-panes { display: grid; gap: .6rem; }
.ds-tool-pane h4 + p, .ds-tool-pane p + p, .ds-term > p { margin-top: .35rem; }
.ds-tool-pane p, .ds-term p, .ds-tool-disclosure > p, .ds-audit-row p { font-size: .9rem; line-height: 1.5; }
.ds-tool-output {
  margin-top: .65rem;
  padding: .65rem .8rem;
  border-inline-start: 3px solid var(--ds-brand, #751f2a);
  color: var(--ds-ink, #391e1c);
  background: var(--ds-paper, #fbf8f2);
  font-size: .88rem;
  line-height: 1.45;
}

.ds-tool-list { display: grid; align-content: start; gap: .55rem; }
.ds-tool-disclosure { min-width: 0; border: 1px solid var(--ds-line, #d9cfc5); border-radius: .65rem; background: var(--ds-paper, #fbf8f2); }
.ds-tool-disclosure summary { display: flex; align-items: center; gap: .45rem; min-height: 44px; padding: .55rem .8rem; font-size: .9rem; font-weight: 650; cursor: pointer; list-style: none; }
.ds-tool-disclosure summary::-webkit-details-marker { display: none; }
.ds-tool-disclosure summary::after { width: 6px; height: 6px; flex: none; margin-inline-start: auto; border: solid currentColor; border-width: 0 1px 1px 0; content: ''; transform: rotate(45deg); }
.ds-tool-disclosure[open] summary::after { transform: rotate(225deg); }
.ds-tool-disclosure > :where(p, dl, div) { padding: 0 .8rem .85rem; }
.ds-data-disclosure { margin-top: .75rem; }
.ds-tool-media { min-width: 0; }
.ds-tool-picture { position: relative; }
.ds-tool-media img { display: block; width: 100%; height: auto; border-radius: .7rem; background: #ede3d6; }
.ds-tool-media figcaption { padding-top: .44rem; color: #64504d; font-size: .76rem; line-height: 1.4; }
.ds-hotspots { display: grid; grid-template-columns: minmax(0, min(49%, 410px)) minmax(0, 1fr); align-items: start; gap: 1rem; }
.ds-spot, .ds-point-number { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; line-height: 1; }
.ds-spot {
  position: absolute;
  inset-inline-start: var(--ds-x);
  inset-block-start: var(--ds-y);
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 2px solid white;
  color: white;
  background: var(--ds-brand, #751f2a);
  box-shadow: 0 2px 7px #391e1c42;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
}
.ds-spot[aria-expanded="true"] { color: var(--ds-brand, #751f2a); background: white; border-color: var(--ds-brand, #751f2a); }
.ds-point-number { width: 1.35rem; height: 1.35rem; flex: none; color: white; background: var(--ds-brand, #751f2a); font-size: .72rem; }
.ds-flip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem; }
.ds-flip summary { flex-wrap: wrap; align-content: center; min-height: 4.5rem; padding: .85rem; }
.ds-flip summary::after { display: none; }
.ds-flip-question { width: 100%; font-size: 1rem; }
.ds-flip-prompt { color: var(--ds-brand, #751f2a); font-size: .79rem; text-decoration: underline; text-underline-offset: .18em; }
.ds-flip[open] { background: #efe1d4; animation: ds-card-turn .25s ease-out both; }
.ds-flip:not([open]) .ds-flip-back, .ds-flip[open] .ds-flip-front { display: none; }
@keyframes ds-card-turn { from { transform: perspective(45rem) rotateY(-36deg); } to { transform: perspective(45rem) rotateY(0); } }

.ds-estimate-controls > label, .ds-model-controls > label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem; font-size: .9rem; font-weight: 650; }
.ds-estimate-controls output, .ds-model-controls output { color: var(--ds-brand, #751f2a); }
.ds-activity input[type='range'] { display: block; width: 100%; min-height: 44px; margin: 0; accent-color: var(--ds-brand, #751f2a); cursor: pointer; }
.ds-scale-labels { display: flex; justify-content: space-between; color: #64504d; font-size: .77rem; }
.ds-estimate-controls > button { margin-top: .8rem; }
.ds-chart-name { margin-bottom: .55rem; font-size: .93rem; font-weight: 650; }
.ds-chart-bars { display: grid; gap: .65rem; padding: 0; list-style: none; }
.ds-chart-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .27rem .72rem; align-items: end; font-size: .86rem; }
.ds-chart-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.ds-chart-track { display: block; grid-column: 1 / -1; height: .58rem; border-radius: 100px; background: #e3d4c8; }
.ds-chart-track i { display: block; width: var(--ds-bar); height: 100%; border-radius: inherit; background: var(--ds-brand, #751f2a); transition: width .24s ease; }
.ds-table-container { max-width: 100%; overflow-x: auto; }
.ds-tool-table { width: 100%; border-collapse: collapse; text-align: start; font-size: .8rem; }
.ds-tool-table :is(th, td) { padding: .43rem; border-top: 1px solid var(--ds-line, #d9cfc5); text-align: start; }

.ds-timeline .ds-tool-option { font-variant-numeric: tabular-nums; }
.ds-timeline-stop { display: grid; align-items: start; grid-template-columns: 1fr; gap: 1rem; }
.ds-timeline-stop:has(.ds-tool-media) { grid-template-columns: minmax(0, 1fr) minmax(0, min(43%, 300px)); }
.ds-timeline-stop:has(.ds-tool-portrait) { grid-template-columns: minmax(0, 1fr) minmax(0, min(33%, 120px)); }
.ds-timeline-date { display: block; margin-bottom: .3rem; color: var(--ds-brand, #751f2a); font-size: .79rem; font-weight: 700; }
.ds-route .ds-tool-pane { border-inline-start: 3px solid var(--ds-brand, #751f2a); }
.ds-route .ds-tool-pane h4 + p { font-weight: 600; }
.ds-lookup label { display: block; margin-bottom: .3rem; font-size: .88rem; font-weight: 650; }
.ds-activity :is(input[type='search'], select) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .63rem;
  color: var(--ds-ink, #391e1c);
  border: 1px solid #9a827d;
  border-radius: .4rem;
  background: var(--ds-paper, #fbf8f2);
  font: inherit;
}
.ds-term-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem; margin-top: .65rem; padding: 0; list-style: none; }
.ds-term-role { display: block; margin-top: .14rem; color: var(--ds-brand, #751f2a); font-size: .79rem; font-weight: 650; }
.ds-lookup [data-ds-no-results] { margin-top: .65rem; font-size: .9rem; }
.ds-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .4rem .7rem; align-items: center; padding-bottom: .65rem; }
.ds-match-row label { font-size: .9rem; font-weight: 650; }
.ds-match-row select[data-ds-correct='true'] { border-color: #286844; }
.ds-match-row select[data-ds-correct='false'] { border-color: #a64732; }
.ds-match dt { font-weight: 650; }
.ds-match dd + dt { margin-top: .5rem; }
.ds-audit-list { display: grid; gap: .6rem; }
.ds-audit-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .2rem .6rem; }
.ds-audit-row:has([type='checkbox'][hidden]) { grid-template-columns: 1fr; }
.ds-audit-row input { width: 1.05rem; height: 1.05rem; margin-top: .15rem; accent-color: var(--ds-brand, #751f2a); }
.ds-audit-row label, .ds-audit-row p { grid-column: -2 / -1; }
.ds-audit-row label { font-size: .93rem; font-weight: 650; }
.ds-audit-row:has(:checked) { border-color: var(--ds-brand, #751f2a); }
.ds-model-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .65rem; margin-top: .75rem; }
.ds-model-grid p { font-weight: 650; }
.ds-model-grid strong { display: block; margin-block: .22rem; color: var(--ds-brand, #751f2a); font-size: clamp(1.2rem, 5.3vw, 2.3rem); font-variant-numeric: tabular-nums; line-height: 1.05; }
.ds-model-grid small { display: block; font-size: .79rem; }
.ds-model-note { margin-top: .65rem; color: #64504d; font-size: .8rem; line-height: 1.4; }
.ds-comparison .ds-tool-pane:has(.ds-tool-media) { display: grid; grid-template-columns: minmax(0, min(49%, 370px)) minmax(0, 1fr); gap: 1rem; align-items: center; }
.ds-comparison .ds-tool-pane:has(.ds-tool-portrait) { grid-template-columns: minmax(0, min(38%, 205px)) minmax(0, 1fr); }
.ds-diagram-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .5rem; margin-top: .8rem; padding: .7rem 0 0; border-top: 1px solid var(--ds-line, #d9cfc5); list-style: none; }
.ds-diagram-branches li { padding: .5rem .6rem; color: var(--ds-ink, #391e1c); background: var(--ds-tool-bg); border: 1px solid var(--ds-line, #d9cfc5); border-radius: .35rem; font-size: .83rem; font-weight: 600; }
.ds-diagram-branches strong { display: block; margin-bottom: .3rem; color: var(--ds-brand); }
.ds-diagram-branches li:has(strong) { font-weight: 400; }

.ds-editorial-chapter .ds-activity {
  --ds-tool-bg: #fbf8f2;
  margin: 0 0 clamp(12px, 2vw, 20px);
  padding: clamp(12px, 2vw, 22px);
  border-radius: var(--ds-round);
}
.ds-editorial-chapter .ds-activity-heading { margin-bottom: 12px; }
.ds-editorial-chapter .ds-activity-heading h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
.ds-editorial-chapter .ds-tool-pane { padding: 10px 12px; }
.ds-diagram .ds-tool-options:not([hidden]) + .ds-tool-panes .ds-tool-pane h4 { display: none; }
.ds-editorial-chapter .ds-diagram-branches { margin-top: 7px; padding-top: 7px; }
#coating-construction .ds-hotspots { grid-template-columns: minmax(0, min(39%, 240px)) minmax(0, 1fr); }
#coating-construction .ds-spot { inset-block-start: clamp(22px, var(--ds-y), calc(100% - 22px)); }
/* Keep the neighbouring rim and interior markers clear of each other at narrow portrait widths. */
#coating-construction [data-ds-marker='0'] { inset-inline-start: min(var(--ds-x), calc(54.5% - 26px)); }
#coating-construction [data-ds-marker='1'] { inset-inline-start: max(var(--ds-x), calc(54.5% + 26px)); }

@media (max-width: 720px) {
  #coating-construction .ds-hotspots { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ds-hotspots, .ds-timeline-stop:has(.ds-tool-media), .ds-comparison .ds-tool-pane:has(.ds-tool-media) { grid-template-columns: 1fr; }
  .ds-timeline-stop:has(.ds-tool-portrait) { grid-template-columns: minmax(0, 1fr) minmax(0, 37%); }
  .ds-hotspots { gap: .8rem; }
  .ds-match-row, .ds-diagram-branches:has(strong) { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .ds-model-grid > div { padding: .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-flip[open] { animation: none; }
  .ds-chart-track i { transition: none; }
}
