.ws-libro-chapters {
  --ws-libro-chapters-radius: 1rem;
  --ws-libro-chapters-border: color-mix(in srgb, currentColor 14%, transparent);
  --ws-libro-chapters-muted: color-mix(in srgb, currentColor 65%, transparent);
  --ws-libro-chapters-soft: color-mix(in srgb, currentColor 5%, transparent);
  --ws-libro-chapters-soft-strong: color-mix(in srgb, currentColor 9%, transparent);

  box-sizing: border-box;
  width: 100%;
  max-width: var(--ws-libro-chapters-max-width, 100%);
  margin-inline: auto;
  color: inherit;
}

.ws-libro-chapters *,
.ws-libro-chapters *::before,
.ws-libro-chapters *::after {
  box-sizing: border-box;
}

.ws-libro-chapters--align-left {
  text-align: left;
}

.ws-libro-chapters--align-center {
  text-align: center;
}

.ws-libro-chapters--align-right {
  text-align: right;
}

.ws-libro-chapters__header {
  display: grid;
  gap: 0.6rem;
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.ws-libro-chapters__heading {
  margin: 0;
  line-height: 1.15;
}

.ws-libro-chapters__description {
  max-width: 68ch;
  margin: 0;
  color: var(--ws-libro-chapters-muted);
  line-height: 1.65;
}

.ws-libro-chapters--align-center .ws-libro-chapters__description {
  margin-inline: auto;
}

.ws-libro-chapters--align-right .ws-libro-chapters__description {
  margin-left: auto;
}

.ws-libro-chapters__count {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--ws-libro-chapters-border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85em;
  font-weight: 600;
  background: var(--ws-libro-chapters-soft);
}

.ws-libro-chapters--align-center .ws-libro-chapters__count {
  margin-inline: auto;
}

.ws-libro-chapters--align-right .ws-libro-chapters__count {
  margin-left: auto;
}

.ws-libro-chapters__empty {
  border: 1px dashed var(--ws-libro-chapters-border);
  border-radius: var(--ws-libro-chapters-radius);
  padding: 1rem;
  color: var(--ws-libro-chapters-muted);
  background: var(--ws-libro-chapters-soft);
}

.ws-libro-chapters__items {
  display: grid;
  gap: 0.85rem;
}

.ws-libro-chapters__item {
  color: inherit;
}

.ws-libro-chapters--card .ws-libro-chapters__item,
.ws-libro-chapters--boxed .ws-libro-chapters__item {
  border: 1px solid var(--ws-libro-chapters-border);
  border-radius: var(--ws-libro-chapters-radius);
  background: color-mix(in srgb, currentColor 3%, transparent);
}

.ws-libro-chapters--boxed .ws-libro-chapters__items {
  border: 1px solid var(--ws-libro-chapters-border);
  border-radius: var(--ws-libro-chapters-radius);
  padding: 0.75rem;
  background: var(--ws-libro-chapters-soft);
}

.ws-libro-chapters--boxed .ws-libro-chapters__item {
  background: color-mix(in srgb, Canvas 85%, transparent);
}

.ws-libro-chapters--minimal .ws-libro-chapters__item {
  border-bottom: 1px solid var(--ws-libro-chapters-border);
  padding-bottom: 1rem;
}

.ws-libro-chapters--minimal .ws-libro-chapters__item:last-child {
  border-bottom: 0;
}

.ws-libro-chapters__item-header,
.ws-libro-chapters__content {
  display: grid;
  gap: 0.55rem;
  padding: clamp(1rem, 2vw, 1.25rem);
}

.ws-libro-chapters__item-header + .ws-libro-chapters__content {
  padding-top: 0;
}

.ws-libro-chapters__summary {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: clamp(1rem, 2vw, 1.25rem);
}

.ws-libro-chapters__summary::-webkit-details-marker {
  display: none;
}

.ws-libro-chapters__summary::after {
  content: "+";
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--ws-libro-chapters-border);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  background: var(--ws-libro-chapters-soft);
}

.ws-libro-chapters__item[open] > .ws-libro-chapters__summary::after {
  content: "−";
}

.ws-libro-chapters__summary-main {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.ws-libro-chapters__sequence {
  display: inline-flex;
  width: fit-content;
  color: var(--ws-libro-chapters-muted);
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ws-libro-chapters--align-center .ws-libro-chapters__sequence {
  margin-inline: auto;
}

.ws-libro-chapters--align-right .ws-libro-chapters__sequence {
  margin-left: auto;
}

.ws-libro-chapters__title {
  margin: 0;
  color: inherit;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  line-height: 1.25;
  font-weight: 700;
}

span.ws-libro-chapters__title {
  display: block;
}

.ws-libro-chapters__subtitle {
  color: var(--ws-libro-chapters-muted);
  line-height: 1.5;
}

.ws-libro-chapters__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ws-libro-chapters__summary .ws-libro-chapters__badges {
  justify-content: flex-end;
}

.ws-libro-chapters--align-center .ws-libro-chapters__badges {
  justify-content: center;
}

.ws-libro-chapters--align-right .ws-libro-chapters__badges {
  justify-content: flex-end;
}

.ws-libro-chapters__badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--ws-libro-chapters-border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.2;
  background: var(--ws-libro-chapters-soft);
  color: inherit;
  white-space: nowrap;
}

.ws-libro-chapters__meta {
  font-size: 0.94rem;
  line-height: 1.5;
  color: inherit;
}

.ws-libro-chapters__meta-label {
  font-weight: 700;
}

.ws-libro-chapters__meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
}

.ws-libro-chapters__abstract {
  color: var(--ws-libro-chapters-muted);
  line-height: 1.7;
}

.ws-libro-chapters--compact .ws-libro-chapters__items {
  gap: 0.55rem;
}

.ws-libro-chapters--compact .ws-libro-chapters__item-header,
.ws-libro-chapters--compact .ws-libro-chapters__content,
.ws-libro-chapters--compact .ws-libro-chapters__summary {
  padding: 0.85rem 1rem;
}

.ws-libro-chapters--compact .ws-libro-chapters__abstract {
  display: none;
}

.ws-libro-chapters--compact .ws-libro-chapters__title {
  font-size: 1rem;
}

@media (max-width: 700px) {
  .ws-libro-chapters__summary {
    display: grid;
  }

  .ws-libro-chapters__summary::after {
    position: absolute;
    right: 1rem;
    top: 1rem;
  }

  .ws-libro-chapters__item--accordion {
    position: relative;
  }

  .ws-libro-chapters__summary .ws-libro-chapters__badges {
    justify-content: flex-start;
    padding-right: 2.4rem;
  }

  .ws-libro-chapters--align-center .ws-libro-chapters__summary .ws-libro-chapters__badges {
    justify-content: center;
  }

  .ws-libro-chapters--align-right .ws-libro-chapters__summary .ws-libro-chapters__badges {
    justify-content: flex-end;
  }
}