/* "What's new" pop-up: announcements slide in at the bottom left until the learner acknowledges them.
   The bottom right stays free for the error toasts and the cookie notice. */
:root {
    --whats-new-accent: #ff8c00;
    --whats-new-accent-2: #ff4f6d;
    --whats-new-surface: var(--surface, #fff);
    --whats-new-text: var(--text, #000);
    --whats-new-muted: var(--text-muted, rgba(0, 0, 0, .6));
    --whats-new-ring: rgba(0, 0, 0, .08);
    --whats-new-shadow: 0 28px 60px -18px rgba(20, 24, 28, .45), 0 10px 24px -12px rgba(20, 24, 28, .25);
    --whats-new-kind-bg: rgba(255, 140, 0, .14);
    --whats-new-kind-text: #8a4300;
    --whats-new-ghost-hover: rgba(0, 0, 0, .06);
}

:root[data-theme="dark"] {
    --whats-new-ring: rgba(255, 255, 255, .1);
    --whats-new-shadow: 0 28px 60px -18px rgba(0, 0, 0, .85), 0 10px 24px -12px rgba(0, 0, 0, .6);
    --whats-new-kind-bg: rgba(255, 140, 0, .18);
    --whats-new-kind-text: #ffb766;
    --whats-new-ghost-hover: rgba(255, 255, 255, .08);
}

.whats-new {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 1001;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

.whats-new__card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    pointer-events: auto;
    color: var(--whats-new-text);
    background: var(--whats-new-surface);
    border-radius: 20px;
    box-shadow: var(--whats-new-shadow), 0 0 0 1px var(--whats-new-ring);
    transform-origin: 50% 100%;
    opacity: 0;
    transform: translateY(calc(100% + 48px)) scale(.55);
    transition:
        transform .7s cubic-bezier(.22, 1.4, .36, 1),
        opacity .4s ease;
    will-change: transform, opacity;
}

.whats-new__card.is-visible {
    opacity: 1;
    transform: none;
}

.whats-new__card.is-leaving {
    opacity: 0;
    transform: translateY(32px) scale(.9);
    transition:
        transform .32s cubic-bezier(.4, 0, 1, 1),
        opacity .25s ease-in;
}

/* Gradient rim along the top, slowly moving */
.whats-new__card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    z-index: 2;
    background: linear-gradient(90deg, var(--whats-new-accent), var(--whats-new-accent-2), #ffc24a, var(--whats-new-accent));
    background-size: 300% 100%;
    animation: whats-new-rim 6s linear infinite;
}

/* Soft warm glow behind the content */
.whats-new__glow {
    position: absolute;
    z-index: -1;
    top: -120px;
    right: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 140, 0, .22), rgba(255, 79, 109, .1) 45%, transparent 70%);
    pointer-events: none;
}

.whats-new__media {
    margin: 0;
    aspect-ratio: 16 / 8;
    overflow: hidden;
    background: var(--surface-sunken, #edf0f6);
}

.whats-new__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.08);
    transition: transform 1.4s cubic-bezier(.22, 1, .36, 1) .2s;
}

.whats-new__card.is-visible .whats-new__media img {
    transform: none;
}

.whats-new__body {
    padding: 18px 20px 20px;
}

.whats-new__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.whats-new__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--whats-new-muted);
}

.whats-new__sparkle {
    fill: var(--whats-new-accent);
    animation: whats-new-twinkle 2.4s ease-in-out infinite;
}

.whats-new__kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--whats-new-kind-text);
    background: var(--whats-new-kind-bg);
    white-space: nowrap;
}

.whats-new__kind::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--whats-new-accent);
    box-shadow: 0 0 0 0 rgba(255, 140, 0, .6);
    animation: whats-new-pulse 2s ease-out infinite;
}

.whats-new__counter {
    margin-left: auto;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    color: var(--whats-new-muted);
}

.whats-new__close {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: -4px -8px -4px 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--whats-new-muted);
    background: transparent;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .2s ease;
}

.whats-new__counter:empty + .whats-new__close {
    margin-left: auto;
}

.whats-new__close:hover {
    color: var(--whats-new-text);
    background: var(--whats-new-ghost-hover);
    transform: rotate(90deg);
}

.whats-new__close svg,
.whats-new__button svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.whats-new__title {
    margin: 0 0 6px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.01em;
    color: var(--whats-new-text);
}

.whats-new__message {
    margin: 0;
    font-size: .93rem;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: var(--whats-new-muted);
}

.whats-new__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.whats-new__button {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease, filter .2s ease;
}

.whats-new__button:active {
    transform: scale(.97);
}

.whats-new__button.is-primary,
.whats-new__button.is-primary:visited {
    color: #1b1b1b;
    background: linear-gradient(135deg, #ffa227, var(--whats-new-accent) 55%, #ff7a1a);
    box-shadow: 0 8px 18px -8px rgba(255, 120, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.whats-new__button.is-primary:hover {
    color: #1b1b1b;
    text-decoration: none;
    filter: brightness(1.05);
    box-shadow: 0 12px 24px -8px rgba(255, 120, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.whats-new__button.is-ghost {
    flex: 0 0 auto;
    color: var(--whats-new-text);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--whats-new-ring);
}

.whats-new__button.is-ghost:hover {
    background: var(--whats-new-ghost-hover);
}

.whats-new__close:focus-visible,
.whats-new__button:focus-visible {
    outline: 2px solid var(--whats-new-accent);
    outline-offset: 2px;
}

.whats-new__all {
    display: inline-block;
    margin-top: 12px;
    font-size: .85rem;
    color: var(--whats-new-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.whats-new__all:hover {
    color: var(--whats-new-text);
}

/* The news page: every live announcement with the recording that shows the feature */
.news-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 64px;
    color: var(--whats-new-text);
}

.news-page__header {
    max-width: 40em;
    margin-bottom: 16px;
}

.news-page__eyebrow {
    margin: 0 0 6px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--whats-new-accent);
}

.news-page__title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 2.75rem);
    line-height: 1.15;
    letter-spacing: -.02em;
}

.news-page__lead,
.news-page__empty {
    margin: 0 0 12px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--whats-new-muted);
}

.news-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 48px 0;
    border-top: 1px solid var(--whats-new-ring);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}

.news-item.is-revealed {
    opacity: 1;
    transform: none;
}

.news-item.has-media {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 48px;
}

.news-item__text {
    max-width: 34em;
}

.news-item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: .85rem;
    color: var(--whats-new-muted);
}

.news-item__new {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #1b1b1b;
    background: linear-gradient(135deg, #ffa227, var(--whats-new-accent));
}

.news-item__title {
    margin: 0 0 10px;
    font-size: clamp(1.4rem, 2.4vw, 1.8rem);
    line-height: 1.25;
    letter-spacing: -.01em;
}

.news-item__message {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: var(--whats-new-muted);
}

.whats-new__title a,
.news-item__title a,
.whats-new__message a,
.news-item__message a {
    color: var(--whats-new-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.news-item__link {
    flex: 0 0 auto;
    margin-top: 20px;
    text-decoration: none;
}

.news-item__frame {
    overflow: hidden;
    border-radius: 14px;
    background: #000;
    box-shadow: var(--whats-new-shadow), 0 0 0 1px var(--whats-new-ring);
}

.news-item__clip {
    display: block;
    width: 100%;
    height: auto;
}

.news-feedback {
    max-width: 40em;
    padding: 48px 0 0;
    border-top: 1px solid var(--whats-new-ring);
}

.news-feedback__form {
    margin-top: 20px;
}

.news-feedback__label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 600;
}

.news-feedback__input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    line-height: 1.5;
    color: var(--whats-new-text);
    background: var(--whats-new-surface);
    border: 1px solid var(--whats-new-ring);
    border-radius: 10px;
    resize: vertical;
}

.news-feedback__input:focus-visible {
    outline: 2px solid var(--whats-new-accent);
    outline-offset: 1px;
}

.news-feedback__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.news-feedback__status {
    margin: 20px 0 0;
    font-size: .9rem;
    color: var(--whats-new-muted);
}

@media (max-width: 860px) {
    .news-item.has-media {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .news-item {
        padding: 36px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-item {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* The admin form shows the card in place, without the entrance animation */
.whats-new--preview {
    position: static;
    width: min(400px, 100%);
    pointer-events: auto;
}

.whats-new--preview .whats-new__card {
    opacity: 1;
    transform: none;
}

@keyframes whats-new-rim {
    to {
        background-position: 300% 0;
    }
}

@keyframes whats-new-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 140, 0, .55);
    }
    70%, 100% {
        box-shadow: 0 0 0 7px rgba(255, 140, 0, 0);
    }
}

@keyframes whats-new-twinkle {
    0%, 100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
    50% {
        transform: scale(.82) rotate(12deg);
        opacity: .75;
    }
}

@media (max-width: 560px) {
    .whats-new {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }

    .whats-new__body {
        padding: 16px 16px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .whats-new__card,
    .whats-new__card.is-leaving {
        transform: none;
        transition: opacity .2s ease;
    }

    .whats-new__card::before,
    .whats-new__sparkle,
    .whats-new__kind::before {
        animation: none;
    }

    .whats-new__media img {
        transform: none;
        transition: none;
    }
}

.whats-new--preview .whats-new__card[hidden] {
    display: block;
}

.whats-new--preview .whats-new__media img {
    transform: none;
}
