/*
 * Series page: facts box ("Auf einen Blick"), image, "Nächste Termine", text. Phone: one column in source order
 * (facts, image, dates, text). Desktop: image and dates left, facts box in the right column next to the image.
 */
@layer components {
  .series__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-32);
  }

  .series__facts {
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
    padding: var(--component-card-padding);
    /* Bubble tip: bottom-left above the image on phones, bottom-right in the right-hand column (components.md rule 3). */
    border-radius: var(--component-bubble-radius-m) var(--component-bubble-radius-opposite-m) var(--component-bubble-radius-m) var(--component-bubble-radius-tip);
    border: var(--border-width-thin) solid var(--surface-raised-outline, var(--color-border-default));
    background-color: var(--surface-raised, var(--color-background-subtle));
    min-inline-size: 0;
  }

  .series__facts-title {
    font-size: var(--type-heading-m-size);
    line-height: var(--type-heading-m-line-height);
  }

  .series__facts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
    margin: 0;
  }

  .series__fact {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: var(--space-16);
    font-size: var(--type-text-small-size);
    line-height: var(--type-text-small-line-height);
  }

  .series__fact dt {
    color: var(--color-text-subtle);
  }

  .series__fact dd {
    margin: 0;
    font-weight: var(--font-weight-bold);
    overflow-wrap: anywhere;
  }

  .series__fact dd .icon {
    display: inline-block;
    vertical-align: -3px;
    margin-inline-end: var(--space-4);
  }

  .series__image {
    min-inline-size: 0;
  }

  .series__dates,
  .series__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
    min-inline-size: 0;
  }

  .series__rule {
    margin-block-start: calc(-1 * var(--space-8));
    color: var(--color-text-subtle);
    font-size: var(--type-text-small-size);
    line-height: var(--type-text-small-line-height);
  }

  .series__text-title {
    font-size: var(--type-heading-m-size);
    line-height: var(--type-heading-m-line-height);
  }

  .series__text .blocks {
    max-inline-size: var(--layout-container-text);
  }

  .series__dates .section-head__title {
    font-size: var(--type-heading-m-size);
    line-height: var(--type-heading-m-line-height);
  }

  @media (min-width: 1024px) {
    .series__layout {
      grid-template-columns: minmax(0, 1fr) 400px;
      column-gap: var(--layout-grid-gap);
      row-gap: var(--space-40);
      align-items: start;
    }

    .series__layout > * {
      grid-column: 1;
    }

    .series__layout > .series__facts {
      border-radius: var(--component-bubble-radius-opposite-m) var(--component-bubble-radius-m) var(--component-bubble-radius-tip) var(--component-bubble-radius-m);
      grid-column: 2;
      grid-row: 1 / span 4;
    }

    .series__layout--no-image > .series__facts {
      grid-row: 1 / span 3;
    }
  }

  /* Phones: one column in reading order; the facts box follows the dates instead of pushing them down. */
  @media (max-width: 1023px) {
    .series__image { order: 0; }
    .series__dates { order: 1; }
    .series__facts { order: 2; }
    .series__text { order: 3; }
  }

  /* Upcoming dates as cards follow text and facts box over the full width. */
  .series__layout + .series__wall {
    margin-block-start: var(--space-64);
  }

  /* Facts box stays in view while the text column scrolls, as on the event page. */
  @media (min-width: 1024px) and (min-height: 760px) {
    .series__layout > .series__facts {
      position: sticky;
      top: var(--space-24);
    }
  }

  /* Series dates have no place for a stacked group: keep the "Zuletzt" list in the reading width of the page. */
  .series-past .event-list {
    margin-block-start: var(--space-24);
  }
}

/* The image sits next to the facts box: the bubble tip points to it (components.md, tip rule 1). */
@layer utilities {
  @media (min-width: 1024px) {
    .series__image .bubble--tip-left {
      --bubble-tip-bl: var(--bubble-radius);
      --bubble-tip-br: var(--component-bubble-radius-tip);
      --bubble-tl: var(--bubble-opposite);
      --bubble-tr: var(--bubble-radius);
    }
  }
}
