/* WordPress groups may add an inner container in classic themes. */
.mm-borsen-overview,
.mm-borsen-overview > .wp-block-group__inner-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.mm-borsen-overview > .wp-block-group__inner-container {
    grid-column: 1 / -1;
}

.mm-borsen-overview .mm-borsen-overview__chart,
.mm-borsen-overview .mm-borsen-overview__today {
    min-width: 0;
    margin: 0;
}

.mm-borsen-overview__chart {
    border: 1px solid var(--mm-ui-border, color-mix(in srgb, currentColor 20%, transparent));
    border-radius: 12px;
    background: var(--mm-ui-surface, transparent);
    padding: clamp(.75rem, 2vw, 1rem);
}

.mm-borsen-overview__index-links {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin-block: 0 .75rem;
    font-size: .875rem;
}

.mm-borsen-overview__index-links a {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
}

.mm-borsen-overview__index-links a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 2px;
}

.mm-borsen-overview__chart .mm-borsen-widget[data-widget="embed-widget-symbol-overview.js"] {
    position: relative;
}

/* Fill the widget's reserved space while TradingView prepares its iframe. */
.mm-borsen-overview__chart .mm-borsen-widget[data-widget="embed-widget-symbol-overview.js"]:not(:has(iframe))::before {
    content: "Diagram från TradingView";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--mm-ui-raised, color-mix(in srgb, currentColor 4%, transparent));
    color: var(--mm-ui-muted, currentColor);
    border-radius: 8px;
    font-size: .875rem;
    pointer-events: none;
}

.mm-borsen-market-day,
.mm-borsen-product-link {
    --mm-market-day-line: var(--mm-ui-border, color-mix(in srgb, currentColor 20%, transparent));
    border: 1px solid var(--mm-market-day-line);
    border-radius: 12px;
    padding: clamp(.75rem, 2vw, 1rem);
    background: var(--mm-ui-surface, transparent);
    font-size: .9375rem;
    line-height: 1.45;
}

.mm-borsen-market-day__header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .25rem .75rem;
}

.entry-content-text .mm-borsen-market-day h2,
.entry-content-text .mm-borsen-market-day h3,
.entry-content-text .mm-borsen-market-day p {
    margin: 0;
}

.entry-content-text .mm-borsen-market-day h2 {
    font-size: 1.375rem;
}

.entry-content-text .mm-borsen-market-day h3 {
    font-size: .9375rem;
}

.entry-content-text .mm-borsen-market-day p {
    margin-top: .25rem;
    font-size: inherit;
    line-height: inherit;
}

.mm-borsen-market-day__header time,
.mm-borsen-market-day__calendar,
.entry-content-text .mm-borsen-market-day .mm-borsen-market-day__next,
.entry-content-text .mm-borsen-market-day .mm-borsen-market-day__source {
    font-size: .8125rem;
    color: var(--mm-ui-muted, currentColor);
}

.mm-borsen-market-day__section {
    border-top: 1px solid var(--mm-market-day-line);
    margin-top: .75rem;
    padding-top: .75rem;
}

.entry-content-text .mm-borsen-insider-fact a:any-link {
    color: var(--mm-ui-text, inherit);
}

.mm-borsen-insider-fact__logo {
    display: inline-block;
    inline-size: 1.25rem;
    block-size: 1.25rem;
    margin-inline-end: .375rem;
    vertical-align: -.25rem;
    border-radius: .25rem;
    background: center / contain no-repeat;
}

.mm-borsen-market-day__session {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .125rem .625rem;
    font-weight: 600;
}

.mm-borsen-market-day__hours {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.mm-borsen-market-day__calendar {
    display: inline-block;
    margin-top: .25rem;
}

.entry-content-text .mm-borsen-market-day .mm-borsen-market-day__shortcuts {
    list-style: none;
    margin: .75rem 0 0;
    padding: .625rem 0 0;
}

.mm-borsen-market-day__shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .375rem;
}

.entry-content-text .mm-borsen-market-day__shortcuts li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.entry-content-text .mm-borsen-today-reports ul {
    list-style: none;
    margin: .25rem 0 0;
    padding: 0;
}

.entry-content-text .mm-borsen-today-reports li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .375rem;
    min-height: 1.75rem;
    margin: 0;
    padding: .125rem 0;
    overflow-wrap: anywhere;
}

.entry-content-text .mm-borsen-today-reports :is(a, .mm-borsen-today-reports__status) {
    font-size: .8125rem;
    color: var(--mm-ui-muted, currentColor);
}

.entry-content-text .mm-borsen-today-reports a {
    display: inline-grid;
    place-items: center;
    min-height: 24px;
    min-width: 44px;
    color: var(--mm-ui-text, inherit);
    font-variant-numeric: tabular-nums;
    text-decoration: underline;
}

.entry-content-text .mm-borsen-today-reports :is(a, h3):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 2px;
}

.mm-borsen-product-link {
    margin-top: .75rem;
}

.entry-content-text .mm-borsen-product-link h2 {
    font-size: 1.125rem;
    margin: 0;
}

.entry-content-text .mm-borsen-product-link p {
    color: var(--mm-ui-muted, currentColor);
    font-size: .875rem;
    margin: .25rem 0 .625rem;
    line-height: inherit;
}

.entry-content-text .mm-borsen-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-block: 0 .75rem;
    --mm-market-day-line: var(--mm-ui-border, color-mix(in srgb, currentColor 20%, transparent));
}

.mm-borsen-product-links {
    display: grid;
    gap: .375rem;
}

.entry-content-text :is(.mm-borsen-quick-links, .mm-borsen-market-day__shortcuts, .mm-borsen-product-links) a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .375rem;
    min-height: 44px;
    padding: .375rem .625rem;
    border: 1px solid var(--mm-market-day-line);
    border-radius: 8px;
    background: var(--mm-ui-raised, color-mix(in srgb, currentColor 5%, transparent));
    color: var(--mm-ui-text, inherit);
    font-size: .875rem;
    line-height: 1.25;
    font-weight: 600;
    text-decoration: none;
}

.entry-content-text .mm-borsen-product-links a:first-child {
    border-color: var(--mm-ui-muted, currentColor);
}

.entry-content-text :is(.mm-borsen-quick-links, .mm-borsen-market-day__shortcuts, .mm-borsen-product-links) a:hover {
    text-decoration: underline;
}

:is(.mm-borsen-quick-links, .mm-borsen-market-day, .mm-borsen-product-link) a:focus-visible {
    outline: 2px solid var(--mm-ui-text, currentColor);
    outline-offset: 2px;
}

/* Decorative assets for the two cards beside the Börsen overview chart. */
.mm-borsen-overview__today :is(.mm-borsen-market-day__header h2, .mm-borsen-market-day__section:first-of-type h3, .mm-borsen-product-link h2) {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.mm-borsen-overview__today :is(.mm-borsen-market-day__header h2, .mm-borsen-market-day__section:first-of-type h3, .mm-borsen-product-link h2)::before {
    content: "";
    flex: 0 0 1rem;
    height: 1rem;
    margin-top: max(0px, calc(.5lh - .5rem));
}

.mm-borsen-overview__today .mm-borsen-market-day__header h2::before {
    background: var(--mm-ui-muted, currentColor);
    mask: url("../editorial/assets/clock.svg") center / contain no-repeat;
}

.mm-borsen-overview__today .mm-borsen-market-day__section:first-of-type h3::before {
    background: url("../editorial/assets/author-flag-se.svg") center / contain no-repeat;
}

.mm-borsen-overview__today .mm-borsen-product-link h2::before {
    background: var(--mm-ui-text, currentColor);
    mask: url("../../assets/global-shell/logomark.svg") center / contain no-repeat;
}

@media (min-width: 900px) {
    .mm-borsen-overview,
    .mm-borsen-overview > .wp-block-group__inner-container {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (min-width: 1024px) {
    /* Only rearrange the landing page once both overview groups are present. */
    .warrantlist-wrapper:has(> :first-child > .site-content > .content-area > .entry-content > .mm-borsen-overview + .mm-borsen-overview__below) {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;

        & > :first-child,
        & > :first-child > .site-content,
        & .content-area,
        & .content-area > .entry-content {
            display: contents;
        }

        & .content-area > .entry-header,
        & .entry-content > .mm-borsen-overview {
            grid-column: 1 / -1;
        }

        & .content-area > .entry-header {
            max-width: none;
        }

        & .content-area > .entry-header > div {
            width: auto;
            margin-inline: 0;
            padding-inline: 0;
        }

        & .entry-content > .mm-borsen-overview {
            margin-bottom: 1.5rem;
        }

        & .entry-content > .mm-borsen-overview__below {
            grid-column: 1;
            min-width: 0;
        }

        & > .main-sidebar {
            grid-column: 2;
            padding-top: 0;
        }

        /* Keep the chart and the right rail aligned after moving the market cards into the rail. */
        &:has(> .main-sidebar > [data-mm-borsen-sidebar-market-day]) {
            column-gap: 1rem;

            & .entry-content > .mm-borsen-overview,
            & .entry-content > .mm-borsen-overview > .wp-block-group__inner-container {
                display: contents;
            }

            & .entry-header,
            & .entry-content > :has(~ .mm-borsen-overview),
            & .mm-borsen-overview__chart,
            & > .main-sidebar {
                order: -1;
            }

            & .mm-borsen-overview__chart {
                grid-column: 1;
            }

            & > .main-sidebar {
                grid-row: span 2;
                min-width: 0;
            }

            & .entry-content > .mm-borsen-overview__below {
                margin-top: 1.5rem;
            }

            & [data-mm-borsen-sidebar-market-day] {
                margin-bottom: 1rem;
            }
        }
    }

    .mm-dark [data-mm-borsen-sidebar-market-day] .mm-borsen-market-day__calendar {
        color: var(--mm-ui-text, #f5f7f6);
    }
}

/* Keep the editorial continuation in reading order when the desktop grid flattens its wrapper. */
@media (min-width: 1024px) {
    .page-id-3908 .entry-content:has(> .mm-borsen-overview + .mm-borsen-overview__below) > :not(.mm-borsen-overview) {
        grid-column: 1;
        min-width: 0;
    }
}
