/* ============================================================
   News modal — overlay, dialog panel, carousel
   ============================================================ */

/* ---------- Overlay ---------- */
.news-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.news-modal-overlay--hidden {
    opacity: 0;
}
.news-modal-overlay--visible {
    opacity: 1;
}
.news-modal-overlay--enter,
.news-modal-overlay--leave {
    transition: opacity var(--dur) var(--ease-out);
}

/* ---------- Dialog panel ---------- */
.news-modal {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    outline: none;
    display: flex;
    flex-direction: column;
}

.news-modal--hidden {
    opacity: 0;
    transform: scale(0.98);
}
.news-modal--visible {
    opacity: 1;
    transform: scale(1);
}
.news-modal--enter,
.news-modal--leave {
    transition:
        opacity var(--dur) var(--ease-out),
        transform var(--dur) var(--ease-out);
}

/* ---------- Modal header ---------- */
.news-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.news-modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition:
        background var(--dur-fast) var(--ease-standard),
        color var(--dur-fast) var(--ease-standard);
}
.news-modal__close:hover {
    background: var(--surface-3);
    color: var(--text);
}

/* ---------- Carousel ---------- */
.news-modal__carousel {
    position: relative;
    background: var(--surface-2);
    flex-shrink: 0;
}

.news-modal__slide {
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Images open at full size without cropping, incl. vertical/portrait */
img.news-modal__media {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

/* Videos keep a stable 16:9 frame */
video.news-modal__media,
.news-modal__video-fallback {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
}
video.news-modal__media {
    object-fit: contain;
    background: #000;
}

.news-modal__video-fallback {
    position: relative;
}

/* Poster inside the video fallback still fills the 16:9 frame */
.news-modal__video-fallback img.news-modal__media {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
}

.news-modal__play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    transition: background var(--dur-fast) var(--ease-standard);
}
.news-modal__video-fallback:hover .news-modal__play-btn {
    background: rgba(0, 0, 0, 0.6);
}

/* Arrows */
.news-modal__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    color: var(--text-muted);
    cursor: pointer;
    transition:
        background var(--dur-fast) var(--ease-standard),
        color var(--dur-fast) var(--ease-standard);
}
.news-modal__arrow:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text);
}
.news-modal__arrow:disabled {
    opacity: 0.35;
    cursor: default;
}
.news-modal__arrow--prev {
    left: var(--space-3);
}
.news-modal__arrow--next {
    right: var(--space-3);
}

/* Dot indicators */
.news-modal__dots {
    position: absolute;
    bottom: var(--space-3);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-2);
}

.news-modal__dot {
    width: 6px;
    height: 6px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.45);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background var(--dur-fast) var(--ease-standard);
}
.news-modal__dot--active {
    background: #fff;
}
.news-modal__dot:hover {
    background: rgba(255, 255, 255, 0.75);
}

/* ---------- Body ---------- */
.news-modal__body {
    padding: var(--space-5);
    flex: 1;
}

.news-modal__text {
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
    color: var(--text-muted);
    white-space: pre-line;
}

.news-modal__prose {
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
    color: var(--text-muted);
    white-space: pre-line;
}

.news-modal__prose b,
.news-modal__prose strong {
    color: var(--text);
    font-weight: 600;
}

.news-modal__prose i,
.news-modal__prose em {
    font-style: italic;
}

.news-modal__prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.news-modal__prose a:hover {
    color: var(--accent-hover);
}

.news-modal__prose code {
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    padding: 1px 4px;
}

.news-modal__prose blockquote {
    border-left: 3px solid var(--border-strong);
    margin: var(--space-3) 0;
    padding: var(--space-2) var(--space-4);
    color: var(--text-faint);
    font-style: italic;
}

/* ---------- Footer ---------- */
.news-modal__footer {
    padding: var(--space-3) var(--space-5) var(--space-5);
    flex-shrink: 0;
}

.news-modal__tg-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    text-decoration: none;
}

/* ---------- Miniature card adjustments ---------- */
.news-item {
    cursor: pointer;
}

.news-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.news-item__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--accent);
    pointer-events: none;
}

.news-item__preview {
    position: relative;
}

.news-item__media-badge {
    position: absolute;
    bottom: var(--space-2);
    right: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: var(--r-sm);
    padding: 2px 6px;
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
}

.news-item__media-badge--video {
    background: rgba(10, 6, 3, 0.72);
}

@media (prefers-reduced-motion: reduce) {
    .news-modal-overlay--enter,
    .news-modal-overlay--leave,
    .news-modal--enter,
    .news-modal--leave {
        transition: none;
    }
}
