.article--mastra {
  --mastra-reading: 725px;
  --mastra-frame: #f0e9e3;
  max-width: 1120px;
  padding-top: clamp(32px, 5vw, 72px);
  padding-bottom: 0;
}

.article--mastra h1 {
  max-width: 1000px;
  font-size: clamp(39px, 5.4vw, 78px);
  line-height: 1.06;
}

.article--mastra .lead {
  max-width: 63ch;
  color: var(--mute);
}

.mastra-opening {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin-top: 20px;
}

.article--mastra > .lead + p {
  color: var(--mute);
  font-size: .86em;
}

.mastra-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.mastra-actions > a:not(.button) {
  font-size: .9em;
}

.mastra-actions .button {
  background: var(--wine);
  color: var(--paper);
  transition: background-color 140ms, transform 140ms;
}

.mastra-actions .button:hover { background: #61354a; }
.mastra-actions .button:active { transform: translateY(1px); }

.article--mastra .mastra-shot {
  min-width: 0;
  max-width: 950px;
  margin: clamp(22px, 4vw, 42px) auto;
}

.article--mastra .mastra-hero-shot {
  max-width: none;
  margin-top: clamp(22px, 3.2vw, 38px);
}

.mastra-shot figcaption {
  max-width: 78ch;
  margin-bottom: 9px;
  color: var(--mute);
  line-height: 1.45;
}

.mastra-shot a {
  display: block;
  background: var(--mastra-frame);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
}

.mastra-shot img {
  display: block;
  width: 100%;
}

.article--mastra .mastra-narrow-shot {
  max-width: min(100%, 460px);
}

.mastra-contents {
  max-width: var(--mastra-reading);
  margin: clamp(34px, 5vw, 62px) auto 0;
  padding: clamp(20px, 3vw, 36px);
  background: var(--mastra-frame);
  border-top: 2px solid var(--wine);
}

.article--mastra .mastra-contents h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.035em;
}

.mastra-contents ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
  margin: 14px 0 0;
  padding-left: 1.1em;
  font-size: .9em;
}

.mastra-contents a {
  display: inline-block;
  padding-block: 4px;
}

.mastra-chapter {
  padding-block: clamp(48px, 7vw, 88px);
  scroll-margin-top: 18px;
}

.article--mastra .mastra-chapter h2 {
  margin-top: 0;
  font-size: clamp(32px, 3.8vw, 53px);
  line-height: 1.13;
}

.mastra-chapter > :is(h2, p, dl, table, .mastra-exercise, .mastra-supply-contact),
.mastra-subsection > :is(h3, p) {
  max-width: var(--mastra-reading);
  margin-inline: auto;
}

.mastra-chapter h3 {
  font-size: clamp(22px, 2.4vw, 29px);
  letter-spacing: -.027em;
}

.mastra-chapter p,
.mastra-chapter dd {
  line-height: 1.65;
}

.mastra-chapter p a {
  text-decoration-color: #9c746c;
}

.mastra-subsection {
  margin-top: clamp(40px, 6vw, 65px);
}

.mastra-definitions {
  margin-block: 26px;
}

.mastra-definitions > div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 15px;
  border-top: 1px solid var(--rule);
  padding-block: 14px;
}

.mastra-definitions > div:last-child { border-bottom: 1px solid var(--rule); }
.mastra-definitions dt { font-weight: 650; }
.mastra-definitions dd { margin: 0; }

.mastra-checks {
  width: 100%;
  margin-block: 28px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .9em;
  line-height: 1.42;
  text-align: left;
}

.mastra-checks caption {
  padding-bottom: 9px;
  color: var(--mute);
  font-weight: 650;
  text-align: left;
}

.mastra-checks :is(th, td) {
  padding: 12px clamp(6px, 1.5vw, 15px);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.mastra-checks thead th { background: var(--mastra-frame); }
.mastra-checks tbody th { font-weight: 550; }

.mastra-exercise {
  margin-top: 30px;
  padding: clamp(18px, 3vw, 30px);
  background: var(--mastra-frame);
  border-left: 3px solid var(--wine);
}

.mastra-shot-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-block: 28px;
}

.article--mastra .mastra-shot-pair .mastra-shot {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 2;
  gap: 0;
  align-items: start;
  margin: 0;
}

.mastra-chapter code {
  padding: 0 .25em;
  background: var(--mastra-frame);
  font-size: .9em;
  overflow-wrap: anywhere;
}

.mastra-chapter .mastra-supply-contact {
  margin-top: 22px;
  padding: 0;
  background: none;
  color: var(--ink);
}

.mastra-supply-contact .button { margin: 0; }
.article--mastra .mastra-workshop { border: 0; }

#praktikum {
  scroll-margin-top: 18px;
}

#praktikum .button {
  margin-right: 12px;
}

#praktikum .button + .button {
  margin-left: 0;
}

@media (min-width: 1024px) {
  .mastra-hero-shot a {
    aspect-ratio: 3.1;
  }

  .mastra-hero-shot img {
    height: 100%;
    object-fit: cover;
    object-position: center top;
  }
}

@media (max-width: 650px) {
  .article--mastra h1 { font-size: clamp(35px, 8.5vw, 49px); }
  .mastra-contents ul { grid-template-columns: 1fr; }
  .mastra-definitions > div { grid-template-columns: 1fr; gap: 3px; }
  .mastra-shot-pair { display: block; }
  .article--mastra .mastra-shot-pair .mastra-shot { display: block; margin-block: 20px; }
  .mastra-checks { font-size: .79em; }
}

@media (prefers-reduced-motion: no-preference) {
  .article--mastra h1,
  .mastra-opening {
    animation: mastra-enter 460ms ease-out both;
  }
}

@keyframes mastra-enter {
  from { opacity: .7; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

body:has(.mastra-scroll-mascot) {
  --mastra-lane: clamp(29px, 4.2vw, 58px);
}

main:has(.mastra-scroll-mascot:not([hidden])) {
  padding-inline-end: max(var(--gutter), calc(var(--mastra-lane) + 4px));
}

@media (min-width: 1280px) {
  body:has(.mastra-scroll-mascot) { --mastra-lane: min(108px, calc((100vw - 1120px) / 2 - 5px)); }
  main:has(.mastra-scroll-mascot:not([hidden])) { padding-inline-end: var(--gutter); }
}

.mastra-scroll-mascot {
  position: fixed;
  z-index: 1;
  inset-block: max(64px, 11svh) max(24px, 8svh);
  inset-inline-end: max(2px, env(safe-area-inset-right, 0px));
  inline-size: var(--mastra-lane);
  pointer-events: none;
  visibility: hidden;
}

.mastra-scroll-mascot[data-active] {
  visibility: visible;
}

.mastra-scroll-mascot canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .mastra-scroll-mascot { display: none; }
}

.mastra-chapter > :is(ol, ul),
.mastra-subsection > :is(ol, ul) {
  box-sizing: border-box;
  max-inline-size: var(--mastra-reading);
  margin-inline: auto;
  padding-inline-start: 1.55em;
  overflow-wrap: anywhere;
}

.mastra-chapter > :is(ol, ul) > li + li,
.mastra-subsection > :is(ol, ul) > li + li { margin-block-start: .45em; }

.article--mastra .mastra-banner-shot {
  max-inline-size: 480px;
  margin: clamp(24px, 4vw, 42px) auto;
  scroll-margin-block-start: 24px;
}

.mastra-banner-shot img { height: auto; }
