/*
 * Shared edge-banner contract. The controller owns visibility, state and the
 * numeric outer height; the inner wrapper stays naturally sized for measuring.
 */
html {
    --page-border-top: 10px;
    --page-border-bottom: 10px;
    --page-footer-offset: 0px;
}

html.has-page-border-banners #profile {
    top: var(--page-banner-top-inset, 0px);
    max-height: calc(100% - var(--page-banner-top-inset, 0px) - var(--page-about-bottom-inset, 0px));
}

html.has-page-border-banners #wrapper {
    border-top-width: var(--page-border-top, 10px);
    border-bottom-width: var(--page-border-bottom, 10px);
    transition-property: height, width, left, opacity, border-top-width, border-bottom-width;
    transition-duration: 250ms, 250ms, 250ms, 250ms,
        var(--page-border-motion-duration, 250ms), var(--page-border-motion-duration, 250ms);
}

.page-border-banner {
    position: fixed;
    z-index: 2900;
    inset-inline: 0;
    box-sizing: border-box;
    width: 100%;
    height: 10px;
    max-height: calc(100dvh - var(--page-border-bottom, 10px) - var(--page-footer-offset, 0px) - env(safe-area-inset-top, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--opening-border-color, var(--project-background, Canvas));
    color: var(--project-text, CanvasText);
    transition: height 260ms ease-in-out;
    will-change: height;
}

#studio-news.page-border-banner:not([data-border-state="open"]),
#analytics-consent.page-border-banner:not([data-border-state="open"]) {
    overflow-y: hidden;
}

.page-border-banner[data-border-position="top"] {
    top: 0;
}

.page-border-banner[data-border-position="bottom"] {
    bottom: var(--page-footer-offset, 0px);
    max-height: calc(100dvh - var(--page-border-top, 10px) - var(--page-footer-offset, 0px) - env(safe-area-inset-bottom, 0px));
    transition-duration: 260ms;
}

.page-border-banner[data-border-position="bottom"][data-border-state="closing"] {
    transition-duration: 160ms;
}

.page-border-banner[data-border-position="top"][data-border-state="closing"] {
    transition-duration: 160ms;
}

.page-border-banner[hidden] {
    display: none !important;
}

.page-border-banner-inner {
    box-sizing: border-box;
    width: 100%;
    min-height: 10px;
    padding: 8px clamp(14px, 2.2vw, 28px);
}

.page-border-banner :where(p) {
    margin: 0;
    color: inherit;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    overflow-wrap: anywhere;
}

.page-border-banner :where(a, button) {
    color: inherit;
}

.page-border-banner :where(a) {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.page-border-banner :where(a, button):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.page-border-banner[data-border-position="top"] .page-border-banner-inner {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
}

.page-border-banner[data-border-position="bottom"] .page-border-banner-inner {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

.studio-news-banner {
    z-index: 2800;
    font: 400 12px/1.4 "Figtree", sans-serif;
    text-transform: uppercase;
}

.studio-news-banner .page-border-banner-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-height: 52.4px;
    padding-inline: clamp(62px, 8vw, 92px);
}

/* The shared grid cell makes the banner as tall as its tallest item, while
   fading between items without changing the measured banner height. */
.studio-news-items {
    display: grid;
    min-width: 0;
    text-align: center;
}

.studio-news-item {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    max-width: 100%;
    align-self: center;
    color: inherit;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 320ms ease-in-out, visibility 0s linear 320ms;
}

.studio-news-item[hidden] {
    display: none;
}

.studio-news-item.is-active {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 320ms ease-in-out, visibility 0s;
}

.studio-news-banner[data-news-reduced="true"] .studio-news-items {
    display: grid;
    gap: 6px;
}

.studio-news-banner[data-news-reduced="true"] .studio-news-item {
    grid-area: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
}

.studio-news-banner .studio-news-item :where(p) {
    flex: 0 1 auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    text-align: center;
    text-transform: uppercase;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.studio-news-date {
    display: block;
    flex: 0 0 auto;
    max-width: 100%;
    color: inherit;
    min-height: 1lh;
    opacity: 1;
    white-space: nowrap;
}

.studio-news-close {
    display: inline-grid;
    width: 44px;
    height: 100%;
    flex: 0 0 44px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
    transition: filter 180ms ease-in-out;
}

#studio-news .studio-news-text a {
    color: inherit;
    background: transparent;
    text-decoration: none;
}

#studio-news .studio-news-text a:hover,
#studio-news .studio-news-close:hover {
    color: inherit;
    background: transparent;
    opacity: 1;
    filter: drop-shadow(0 0 var(--site-hover-glow, 0.02rem) currentColor);
}

.studio-news-close svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.studio-news-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.studio-news-close {
    position: absolute;
    inset-inline-end: 10px;
    inset-block: 0;
    height: auto;
}

.studio-news-banner :where(button, a):focus-visible {
    outline-offset: 1px;
}

.studio-news-banner [data-news-items]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

html.has-page-border-banners #info {
    bottom: 0;
}

@media (max-width: 700px) {
    .page-border-banner-inner {
        padding-inline: 14px;
    }

    .studio-news-banner .page-border-banner-inner {
        padding-inline: 58px;
    }

    .studio-news-close {
        inset-inline-end: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-border-banner,
    .page-border-banner[data-border-position="top"],
    .page-border-banner[data-border-position="bottom"] {
        transition-duration: 0.01ms;
        transition-delay: 0ms;
        will-change: auto;
    }

    .studio-news-item,
    .studio-news-close {
        transition-duration: 1ms;
        transition-delay: 0ms;
    }
}
