/*
 * Страница материала (новость, мероприятие, обзор): обложка, текст,
 * ссылки, файлы, ролик, фото, «Поделиться», блоки обзора, графики
 * и просмотр фото.
 * Общий язык с лендингом (style.css): зелёный, золото, синий, Inter.
 */

.share-button:focus-visible,
.link-card:focus-visible,
.file-card:focus-visible,
.photo-grid-item:focus-visible,
.review-photo:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 3px;
}

.page-hero.is-article .page-title {
    font-size: clamp(1.75rem, 3.6vw, 2.5rem);
    line-height: 1.2;
}

/* === Материал: новость, мероприятие, обзор === */

/* Части материала — <section>, но без больших отступов разделов главной */
.article-section,
.review-block,
.article-more {
    padding: 0;
}

.article {
    max-width: 780px;
    margin: 0 auto;
}

.article-cover {
    position: relative;
    margin-bottom: 2.25rem;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-light);
    isolation: isolate;
}

/* Вертикальная обложка не растягивается: по бокам — её же размытая копия */

.article-cover::before {
    content: '';
    position: absolute;
    inset: -24px;
    z-index: -1;
    background-image: var(--cover);
    background-position: center;
    background-size: cover;
    filter: blur(28px) saturate(1.1);
    opacity: 0.55;
}

.article-cover img {
    display: block;
    width: 100%;
    max-height: 560px;
    object-fit: contain;
}

.event-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-bottom: 2.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-light);
}

.event-facts-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 200px;
}

.event-facts-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.event-facts-when {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 700;
}

.event-facts-zone {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.rich-text {
    color: var(--text-primary);
    font-size: 1.0625rem;
    line-height: 1.75;
    overflow-wrap: break-word;
}

.rich-text p,
.rich-text ul,
.rich-text ol,
.rich-text blockquote {
    margin: 0 0 1.15em;
}

.rich-text > :last-child {
    margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
    padding-left: 1.4em;
}

.rich-text li + li {
    margin-top: 0.35em;
}

.rich-text li::marker {
    color: var(--primary-green);
}

.rich-text h3 {
    margin: 1.6em 0 0.6em;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
}

.rich-text blockquote {
    padding-left: 1rem;
    border-left: 3px solid var(--accent-gold);
    color: var(--text-secondary);
}

.rich-text a {
    color: var(--primary-green);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.rich-text a:hover {
    color: var(--primary-green-light);
}

.article-section {
    margin-top: 2.75rem;
}

.article-section-title {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 700;
}

.article-video {
    margin-bottom: 2.25rem;
}

.link-list,
.attachments {
    display: grid;
    gap: 0.75rem;
}

.link-card,
.file-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.link-card:hover,
.file-card:hover {
    border-color: var(--primary-green);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.link-card-icon,
.file-card-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(6, 95, 70, 0.1);
    color: var(--primary-green);
}

.file-card-icon {
    background: rgba(185, 28, 28, 0.08);
    color: var(--down);
}

.link-card-body,
.file-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.link-card-body strong,
.file-card-body strong {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.link-card-body span,
.file-card-body span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.file-card-action {
    color: var(--text-secondary);
}

.video-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: #000;
}

.video-embed iframe,
.video-embed-start {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-embed-start {
    padding: 0;
    background: #000;
    cursor: pointer;
}

.video-embed-start img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.88;
    transition: opacity 0.2s ease;
}

.video-embed-start:hover img {
    opacity: 1;
}

.video-embed-start:hover .play-badge {
    background: #ff0000;
}

.video-embed-start:focus-visible {
    outline: 3px solid var(--accent-gold);
    outline-offset: -3px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.photo-grid.count-1 {
    grid-template-columns: 1fr;
}

.photo-grid-item,
.review-photo {
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--bg-light);
    cursor: zoom-in;
}

.photo-grid-item {
    aspect-ratio: 4 / 3;
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease-out);
}

.photo-grid-item:hover img {
    transform: scale(1.04);
}

.attachment-video {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
}

.share-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.share-label {
    margin-right: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-white);
    color: var(--text-primary);
    font: 500 0.875rem/1.2 'Inter', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.share-button:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.article-more {
    margin-top: 4.5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

/* Блоки обзора */

.review-block + .review-block {
    margin-top: 2rem;
}

.block-meta {
    margin-top: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.review-figure-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.review-figure.count-2 .review-figure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-figure.count-3 .review-figure-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-photo img {
    display: block;
    width: 100%;
    height: auto;
}

/* Одно фото — в своём размере, без растягивания мелких картинок */
.review-figure.count-1 .review-photo {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.review-figure.count-1 .review-photo img {
    width: auto;
    max-width: 100%;
    max-height: 80vh;
}

.block-meta a {
    color: var(--primary-green);
}

.review-figure:not(.count-1) .review-photo {
    aspect-ratio: 4 / 3;
}

.review-figure:not(.count-1) .review-photo img {
    height: 100%;
    object-fit: cover;
}

.review-figure figcaption,
.review-file-caption,
.review-video-title {
    margin-top: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.review-file-caption {
    margin: 0 0 0.6rem;
}

.review-chart {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-white);
}

.review-chart-title {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
}

/* === Графики === */

.chart {
    width: 100%;
}

.chart-plot {
    position: relative;
    width: 100%;
}

.chart-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    font-family: 'Inter', sans-serif;
    touch-action: pan-y;
}

.chart-grid line {
    stroke: #eceef1;
}

.chart-grid text,
.chart-axis {
    fill: var(--text-secondary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-band {
    fill: currentColor;
    stroke: none;
    opacity: 0.12;
}

.chart-dot {
    fill: var(--bg-white);
    stroke: currentColor;
    stroke-width: 2;
}

.chart-mark {
    fill: currentColor;
    stroke: var(--bg-white);
    stroke-width: 2;
}

.chart-cursor {
    stroke: var(--text-secondary);
    stroke-dasharray: 3 3;
    opacity: 0.6;
}

.chart-hit {
    cursor: crosshair;
}

.series-0 {
    color: var(--chart-1);
}

.series-1 {
    color: var(--chart-2);
}

.series-2 {
    color: var(--chart-3);
}

.series-3 {
    color: var(--chart-4);
}

.series-4 {
    color: var(--chart-5);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-bottom: 0.9rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    list-style: none;
}

.chart-legend li,
.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.chart-swatch {
    display: inline-block;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: currentColor;
}

.chart-tooltip {
    position: absolute;
    top: -0.5rem;
    z-index: 2;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
}

.chart-tooltip-date {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.chart-tooltip-name {
    color: var(--text-secondary);
}

.chart-tooltip strong {
    font-variant-numeric: tabular-nums;
}

.chart-empty {
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}

/* === Просмотр фото === */

html.lightbox-open {
    overflow: hidden;
}

.lightbox {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 12, 18, 0.95);
    color: #fff;
}

.lightbox[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.lightbox-close,
.lightbox-nav {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.lightbox-close .icon,
.lightbox-nav .icon {
    width: 24px;
    height: 24px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-stage {
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 0 5rem 2rem;
    touch-action: pan-y;
}

.lightbox-media {
    max-width: 100%;
    max-height: calc(100dvh - 7rem);
    border-radius: 6px;
    object-fit: contain;
    transition: opacity 0.25s ease;
}

.lightbox-media.is-loading {
    opacity: 0;
}

@media (max-width: 768px) {
    .article-cover {
        margin-bottom: 1.75rem;
    }

    .rich-text {
        font-size: 1rem;
    }

    .event-facts {
        padding: 1rem 1.1rem;
    }

    .share-label {
        width: 100%;
    }

    .review-figure.count-3 .review-figure-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lightbox-stage {
        padding: 0 0.5rem 5.5rem;
    }

    .lightbox-media {
        max-height: calc(100dvh - 10rem);
    }

    .lightbox-nav {
        top: auto;
        bottom: 1.25rem;
        transform: none;
    }

    .lightbox-prev {
        left: calc(50% - 64px);
    }

    .lightbox-next {
        right: calc(50% - 64px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .photo-grid-item img,
    .link-card,
    .file-card {
        transition: none;
    }

    .link-card:hover,
    .file-card:hover {
        transform: none;
    }

    .photo-grid-item:hover img {
        transform: none;
    }
}
