/* Calendly Block (Terminbuchung) */

.mm-calendly-block {
    --mm-cal-primary: #1e3c50;
    --mm-cal-gray: #ebe9e8;
    --mm-cal-header: 80px; /* fixed site header, mobile */
    text-align: center;
}

@media only screen and (min-width: 769px) {
    .mm-calendly-block {
        --mm-cal-header: 120px;
    }
}

/* Details (formerly rendered inside Calendly).
   body prefix: beats .entry-content ul li (bullet, padding) and the Customizer ul margin. */
body .mm-calendly-block .mm-calendly-block__details {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em 1.75em;
    margin: 0 0 1em;
    padding: 0;
    list-style: none;
    color: var(--mm-cal-primary);
}

body .mm-calendly-block .mm-calendly-block__details li {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    margin: 0;
    padding: 0;
}

/* On the span: .entry-content ul li forces font-weight 200 !important on the li */
.mm-calendly-block__details li span {
    font-weight: 600;
}

body .mm-calendly-block .mm-calendly-block__details li::before {
    content: none;
    display: none;
}

.mm-calendly-block__details svg {
    flex: none;
}

body .mm-calendly-block .mm-calendly-block__text {
    max-width: 40em;
    margin: 0 auto 1.5em;
    color: var(--mm-cal-primary);
}

/* Mobile: calendar first, the description moves below it */
@media only screen and (max-width: 768px) {
    .mm-calendly-block {
        display: flex;
        flex-direction: column;
    }

    body .mm-calendly-block .mm-calendly-block__text {
        order: 1;
        margin: 1.5em auto 0;
    }
}

/* Embed */
.mm-calendly {
    position: relative;
    min-width: 280px;
    scroll-margin-top: calc(var(--mm-cal-header) + 16px);
    /* Calendly switches layout by iframe width (650px / 1000px), not viewport,
       so reserved height and skeleton follow the same container widths. */
    container-type: inline-size;
}

/* Reserved height until calendly.page_height arrives (values measured from Calendly) */
.mm-calendly__frame {
    height: 602px;
    scroll-margin-top: calc(var(--mm-cal-header) + 16px);
}

.mm-calendly--details .mm-calendly__frame {
    height: 1114px;
}

@container (min-width: 650px) {
    .mm-calendly__frame {
        height: 700px;
    }

    .mm-calendly--details .mm-calendly__frame {
        height: 1203px;
    }
}

/* Two-column card: Calendly only renders the full card in an iframe >= 798px tall,
   below that it switches to a compact card with a clipped, scrolling left column.
   min-height keeps smaller page_height reports from flipping it into that mode. */
@container (min-width: 1000px) {
    .mm-calendly__frame,
    .mm-calendly--details .mm-calendly__frame {
        height: 798px;
        min-height: 798px;
    }
}

.mm-calendly__frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Loading overlay, covers the empty iframe until Calendly has rendered the calendar */
.mm-calendly__loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #fff;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.mm-calendly.is-ready .mm-calendly__loading {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* Status pill on top of the skeleton. Not sticky: html/body { overflow-x: hidden }
   in the theme makes body the scroll container, so sticky would never engage. */
.mm-calendly__status-wrap {
    position: relative;
    z-index: 1;
    width: fit-content;
    max-width: calc(100% - 32px);
    margin: 12px auto 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 14px rgb(30 60 80 / 18%);
    text-align: center;
}

.mm-calendly__status {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    margin: 0;
    color: var(--mm-cal-primary);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.mm-calendly__spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--mm-cal-gray);
    border-top-color: var(--mm-cal-primary);
    border-radius: 50%;
}

.mm-calendly__fallback {
    display: none;
    margin: 6px 0 0;
}

.mm-calendly.is-slow .mm-calendly__fallback {
    display: block;
}

.mm-calendly__fallback a,
.mm-calendly__noscript a {
    color: var(--mm-cal-primary);
    text-decoration: underline;
    pointer-events: auto;
}

.mm-calendly__noscript {
    margin: 0;
    padding: 16px;
}

.mm-calendly--preview {
    padding: 40px 16px;
    border: 1px dashed var(--mm-cal-primary);
    color: var(--mm-cal-primary);
}

/*
 * Skeleton of Calendly's layout. Positions are measured from the rendered embed:
 * < 650px: no card, stacked | 650–999px: card, stacked | >= 1000px: card, two columns.
 */
.mm-cal-sk {
    --sk: #e6eaef;
    --sk-line: #d4e0ed;
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.mm-cal-sk,
.mm-cal-sk * {
    box-sizing: border-box;
}

.mm-cal-sk .mm-ph {
    display: block;
    border-radius: 4px;
    background: var(--sk);
}

.mm-cal-sk__card {
    position: relative;
    height: 100%;
}

/* Event details */
.mm-cal-sk__info {
    position: relative;
    height: 513px;
    border-bottom: 1px solid var(--sk-line);
}

.mm-cal-sk__brand {
    display: flex;
    justify-content: center;
    height: 89px;
    padding-top: 25px;
    border-bottom: 1px solid var(--sk-line);
}

.mm-cal-sk .mm-cal-sk__logo {
    width: 46px;
    height: 40px;
}

.mm-cal-sk__avatar,
.mm-cal-sk__name,
.mm-cal-sk__title,
.mm-cal-sk__meta,
.mm-cal-sk__desc,
.mm-cal-sk__heading,
.mm-cal-sk__month,
.mm-cal-sk__week,
.mm-cal-sk__days,
.mm-cal-sk__tz-label,
.mm-cal-sk__tz,
.mm-cal-sk__privacy {
    position: absolute;
}

.mm-cal-sk .mm-cal-sk__avatar {
    top: 112px;
    left: 50%;
    width: 65px;
    height: 65px;
    margin-left: -32px;
    border-radius: 50%;
}

.mm-cal-sk__name {
    top: 189px;
    left: 50%;
    width: 86px;
    height: 13px;
    transform: translateX(-50%);
}

.mm-cal-sk__title {
    top: 212px;
    left: 50%;
    width: 250px;
    max-width: calc(100% - 40px);
    height: 22px;
    transform: translateX(-50%);
}

.mm-cal-sk__meta,
.mm-cal-sk__desc {
    left: 50%;
    width: min(calc(100% - 46px), 294px);
    transform: translateX(-50%);
}

.mm-cal-sk__meta {
    top: 273px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mm-cal-sk__meta span {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 24px;
}

.mm-cal-sk .mm-cal-sk__meta i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.mm-cal-sk__meta b {
    width: 24px;
    height: 12px;
}

.mm-cal-sk__meta span + span b {
    width: 115px;
}

.mm-cal-sk__desc {
    top: 342px;
}

.mm-cal-sk__desc b {
    height: 12px;
    margin: 6px 0;
}

.mm-cal-sk__desc b:nth-child(1) { width: 95%; }
.mm-cal-sk__desc b:nth-child(2) { width: 100%; }
.mm-cal-sk__desc b:nth-child(3) { width: 91%; }
.mm-cal-sk__desc b:nth-child(4) { width: 97%; }
.mm-cal-sk__desc b:nth-child(5) { width: 88%; }
.mm-cal-sk__desc b:nth-child(6) { width: 45%; }

.mm-cal-sk .mm-cal-sk__privacy {
    display: none;
}

/* Calendar */
.mm-cal-sk__cal {
    --sk-heading: 31px;
    --sk-month: 83px;
    --sk-week: 131px;
    --sk-days: 147px;
    --sk-row: 48px;
    --sk-tz: 411px;
    position: relative;
    width: min(100%, 400px);
    height: 600px;
    margin: 0 auto;
}

/* Without event details Calendly adds 20px between heading and month */
.mm-calendly:not(.mm-calendly--details) .mm-cal-sk__cal {
    --sk-month: 103px;
    --sk-week: 151px;
    --sk-days: 167px;
    --sk-tz: 431px;
}

.mm-cal-sk__heading {
    top: var(--sk-heading);
    left: 50%;
    width: 255px;
    max-width: calc(100% - 40px);
    height: 20px;
    transform: translateX(-50%);
}

.mm-cal-sk__month {
    top: var(--sk-month);
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 196px;
    height: 21px;
    margin-left: -98px;
}

.mm-cal-sk__month i {
    width: 10px;
    height: 16px;
}

.mm-cal-sk__month b {
    width: 110px;
    height: 13px;
}

.mm-cal-sk__week,
.mm-cal-sk__days {
    right: 18px;
    left: 18px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.mm-cal-sk__week {
    top: var(--sk-week);
    height: 12px;
}

.mm-cal-sk__week em {
    justify-self: center;
    width: 16px;
    height: 10px;
}

.mm-cal-sk__days {
    top: var(--sk-days);
    grid-auto-rows: var(--sk-row);
}

.mm-cal-sk__days i {
    align-self: center;
    justify-self: center;
    width: 14px;
    height: 11px;
}

.mm-cal-sk__tz-label,
.mm-cal-sk__tz {
    left: 16px;
    height: 11px;
}

.mm-cal-sk__tz-label {
    top: var(--sk-tz);
    width: 62px;
}

.mm-cal-sk__tz {
    top: calc(var(--sk-tz) + 28px);
    width: 170px;
}

/* 650–999px: centered card, still stacked */
@container (min-width: 650px) {
    /* Calendly is transparent around its card, the page background shows through */
    .mm-calendly__loading {
        background: transparent;
    }

    .mm-cal-sk__card {
        background: #fff;
        width: min(calc(100% - 35px), 680px);
        height: calc(100% - 98px);
        margin: 66px auto 0;
        overflow: hidden;
        border: 1px solid var(--sk-line);
        border-radius: 8px;
        box-shadow: 0 1px 8px rgb(0 0 0 / 8%);
    }

    .mm-cal-sk__info {
        height: 504px;
    }

    .mm-cal-sk__brand {
        height: 109px;
    }

    .mm-cal-sk .mm-cal-sk__logo {
        width: 70px;
        height: 60px;
    }

    .mm-cal-sk .mm-cal-sk__avatar {
        top: 132px;
    }

    .mm-cal-sk__name {
        top: 209px;
    }

    .mm-cal-sk__title {
        top: 232px;
        width: 270px;
        height: 24px;
    }

    .mm-cal-sk__meta {
        top: 293px;
        flex-direction: row;
        justify-content: center;
        gap: 24px;
        width: auto;
    }

    .mm-cal-sk__desc {
        top: 333px;
        width: 340px;
    }

    .mm-cal-sk__cal,
    .mm-calendly:not(.mm-calendly--details) .mm-cal-sk__cal {
        --sk-heading: 34px;
        --sk-month: 96px;
        --sk-week: 148px;
        --sk-days: 168px;
        --sk-row: 52px;
        --sk-tz: 457px;
    }

    .mm-cal-sk__heading {
        left: 32px;
        width: 240px;
        transform: none;
    }

    .mm-cal-sk__week,
    .mm-cal-sk__days {
        right: 17px;
        left: 19px;
    }

    .mm-cal-sk__tz-label,
    .mm-cal-sk__tz {
        left: 32px;
    }
}

/* >= 1000px: card with details left, calendar right */
@container (min-width: 1000px) {
    .mm-calendly--details .mm-cal-sk__card {
        display: flex;
        width: min(calc(100% - 36px), 800px);
    }

    .mm-calendly:not(.mm-calendly--details) .mm-cal-sk__card {
        width: 402px;
    }

    .mm-cal-sk__info {
        flex: 0 0 399px;
        height: auto;
        border-right: 1px solid var(--sk-line);
        border-bottom: 0;
    }

    .mm-cal-sk__brand {
        height: 174px;
        padding-top: 26px;
    }

    .mm-cal-sk .mm-cal-sk__logo {
        width: 139px;
        height: 120px;
    }

    .mm-cal-sk .mm-cal-sk__avatar {
        top: 197px;
        left: 30px;
        margin-left: 0;
    }

    .mm-cal-sk__name,
    .mm-cal-sk__title,
    .mm-cal-sk__meta,
    .mm-cal-sk__desc {
        left: 30px;
        transform: none;
    }

    .mm-cal-sk__name {
        top: 274px;
    }

    .mm-cal-sk__title {
        top: 297px;
    }

    .mm-cal-sk__meta {
        top: 358px;
        flex-direction: column;
        gap: 9px;
    }

    .mm-cal-sk__desc {
        top: 423px;
        width: 338px;
    }

    .mm-cal-sk .mm-cal-sk__privacy {
        display: block;
        bottom: 36px;
        left: 6px;
        width: 96px;
        height: 10px;
    }

    .mm-cal-sk__cal {
        flex: 1;
        width: auto;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .mm-calendly__spinner {
        animation: mm-cal-spin 0.9s linear infinite;
    }

    /* Placeholders only: pulsing the white card would let the iframe show through */
    .mm-cal-sk .mm-ph {
        animation: mm-cal-pulse 1.4s ease-in-out infinite;
    }
}

@keyframes mm-cal-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes mm-cal-pulse {
    50% {
        opacity: 0.55;
    }
}
