/**
 * Блог — современный дизайн
 */
.blog-page {
    --header-offset: 13rem; /* header + волна + запас (~208px) */
}
html:has(body.blog-page) {
    scroll-padding-top: 13rem;
}
.blog-page main {
    padding-top: var(--header-offset);
}

.blog-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0 1rem;
}
.blog-admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-muted);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s;
}
.blog-admin-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent);
}
.blog-rss-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.blog-rss-link:hover {
    color: var(--accent);
    background: var(--accent-muted);
}

/* Hero — тёмная тема */
.blog-hero {
    position: relative;
    min-height: 42vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem 5rem;
    overflow: hidden;
    width: 100%;
}
.blog-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
}
.blog-hero-mesh {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        linear-gradient(225deg, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        linear-gradient(45deg, transparent 30%, rgba(6, 182, 212, 0.03) 70%);
}
.blog-hero-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.06) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 15%, transparent 65%);
}
.blog-hero-lines {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(105deg, transparent 40%, rgba(6, 182, 212, 0.04) 45%, transparent 50%),
        linear-gradient(75deg, transparent 50%, rgba(59, 130, 246, 0.03) 55%, transparent 60%),
        linear-gradient(165deg, transparent 30%, rgba(6, 182, 212, 0.03) 35%, transparent 40%);
    mask-image: radial-gradient(ellipse 100% 80% at 50% 40%, black 30%, transparent 70%);
}
.blog-hero-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(6, 182, 212, 0.15) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(ellipse 85% 65% at 50% 50%, black 10%, transparent 60%);
}
.blog-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    animation-duration: 12s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
.blog-hero-orb-1 {
    top: 20%;
    left: 15%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
    animation-delay: 0s;
}
.blog-hero-orb-2 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 350px;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.12) 0%, transparent 65%);
    animation-delay: -4s;
}
.blog-hero-orb-3 {
    bottom: 10%;
    right: 20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
    animation-delay: -8s;
}
.blog-hero-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    pointer-events: none;
}
.blog-hero-orb-1 { animation-name: blog-orb-float-1; }
.blog-hero-orb-2 { animation-name: blog-orb-float-2; }
.blog-hero-orb-3 { animation-name: blog-orb-float-3; }
@keyframes blog-orb-float-1 {
    0%, 100% { opacity: 0.6; transform: translate(0, 0); }
    50% { opacity: 1; transform: translate(10px, -15px); }
}
@keyframes blog-orb-float-2 {
    0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}
@keyframes blog-orb-float-3 {
    0%, 100% { opacity: 0.6; transform: translate(0, 0); }
    50% { opacity: 1; transform: translate(-10px, 10px); }
}
.blog-hero-inner {
    position: relative;
    text-align: center;
    z-index: 1;
}
.blog-hero-badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}
.blog-hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.blog-hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Hero — светлая тема */
[data-theme="light"] .blog-hero-mesh {
    background: 
        linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        linear-gradient(225deg, rgba(5, 150, 105, 0.06) 0%, transparent 50%),
        linear-gradient(45deg, transparent 30%, rgba(124, 58, 237, 0.04) 70%);
}
[data-theme="light"] .blog-hero-grid {
    background-image: 
        linear-gradient(rgba(124, 58, 237, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.06) 1px, transparent 1px);
}
[data-theme="light"] .blog-hero-lines {
    background: 
        linear-gradient(105deg, transparent 40%, rgba(124, 58, 237, 0.05) 45%, transparent 50%),
        linear-gradient(75deg, transparent 50%, rgba(5, 150, 105, 0.04) 55%, transparent 60%),
        linear-gradient(165deg, transparent 30%, rgba(124, 58, 237, 0.04) 35%, transparent 40%);
}
[data-theme="light"] .blog-hero-orb-1 {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.18) 0%, transparent 70%);
}
[data-theme="light"] .blog-hero-orb-2 {
    background: radial-gradient(ellipse, rgba(5, 150, 105, 0.12) 0%, transparent 65%);
}
[data-theme="light"] .blog-hero-orb-3 {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 70%);
}
[data-theme="light"] .blog-hero-dots {
    background-image: radial-gradient(circle, rgba(124, 58, 237, 0.12) 1px, transparent 1px);
}
[data-theme="light"] .blog-hero-glow {
    background: linear-gradient(to top, var(--bg-dark), transparent);
}
[data-theme="light"] .blog-hero-title {
    background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Content */
.blog-content {
    padding: 2rem 1.5rem 5rem;
}

/* Empty state */
.blog-empty {
    text-align: center;
    padding: 5rem 2rem;
}
.blog-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--accent);
    opacity: 0.5;
}
.blog-empty-icon svg {
    width: 100%;
    height: 100%;
}
.blog-empty h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.blog-empty p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}
@media (min-width: 900px) {
    .blog-grid {
        gap: 2rem;
    }
    .blog-card-featured {
        grid-column: 1 / -1;
    }
}

/* Cards */
.blog-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: visible;
    transition: transform 0.3s ease, opacity 0.5s ease;
}
.blog-card-source-vcru {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
@media (hover: hover) {
    .blog-card-source-vcru { opacity: 0.85; }
    .blog-card:hover .blog-card-source-vcru { opacity: 1; }
}
.blog-card-source-vcru:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.blog-card-source-vcru-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.blog-card-edit {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
@media (hover: hover) {
    .blog-card-edit { opacity: 0.7; }
    .blog-card:hover .blog-card-edit { opacity: 1; }
}
.blog-card-edit:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.blog-card.reveal {
    opacity: 0;
    transform: translateY(24px);
}
.blog-card.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.blog-card-link {
    display: block;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.blog-card-link:hover {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(6, 182, 212, 0.1);
}
.blog-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}
.blog-card-featured .blog-card-image {
    aspect-ratio: 21 / 9;
}
.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-card-link:hover .blog-card-image img {
    transform: scale(1.05);
}
.blog-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 14, 23, 0.9) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}
.blog-card-link:hover .blog-card-overlay {
    opacity: 1;
}
.blog-card-placeholder {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(59, 130, 246, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    opacity: 0.5;
}
.blog-card-featured .blog-card-placeholder {
    aspect-ratio: 21 / 9;
}
.blog-card-placeholder svg {
    width: 48px;
    height: 48px;
}
.blog-card-presentation {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-card);
    pointer-events: auto;
}
.blog-card-featured .blog-card-presentation {
    aspect-ratio: 21 / 9;
}
.blog-card-presentation iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    transform-origin: top left;
}
.blog-card-presentation-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    backdrop-filter: blur(8px);
}
.blog-card-presentation-fullscreen-btn {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 44px;
    height: 44px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}
.blog-card-presentation-fullscreen-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.5);
}
.blog-card-presentation-fullscreen-btn:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 1) 0%, rgba(59, 130, 246, 1) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}
.blog-card-presentation-fullscreen-btn svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.blog-card-body {
    padding: 1.5rem;
}
.blog-card-featured .blog-card-body {
    padding: 2rem;
}
.blog-card-date {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 0.5rem;
}
.blog-card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}
.blog-card-link:hover h2 {
    color: var(--accent);
}
.blog-card-featured h2 {
    font-size: 1.6rem;
}
.blog-card-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.blog-card-cta {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: gap 0.2s;
}
.blog-card-link:hover .blog-card-cta {
    gap: 0.5rem;
}

/* Pagination */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 0 1rem;
    flex-wrap: wrap;
}
.blog-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.blog-pagination-btn,
.blog-pagination-num,
.blog-pagination-current,
.blog-pagination-ellipsis {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    border-radius: 10px;
    transition: all 0.2s;
}
.blog-pagination-btn,
.blog-pagination-num {
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.blog-pagination-btn:hover,
.blog-pagination-num:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.blog-pagination-current {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--accent);
}
.blog-pagination-ellipsis {
    color: var(--text-muted);
    pointer-events: none;
}

/* Post page */
.post-header {
    padding: 2rem 0 2rem;
}
.post-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.post-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.post-meta-sep { opacity: 0.6; }
.post-reading-time { color: var(--accent); opacity: 0.9; }
.post-source-vcru {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.post-source-vcru:hover {
    color: var(--accent);
}
.post-source-vcru-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Share buttons */
.post-share {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.post-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.post-share-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.post-share-btn.copied {
    border-color: #22c55e;
    color: #22c55e;
}
.post-share-btn.post-bionic-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-muted);
}

.post-body {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    order: -1;
}
/* Принудительно убрать узкие обёртки из контента VC.ru и др. */
.post-body > div {
    width: 100%;
    max-width: none !important;
    min-width: 0;
}
.post-body div,
.post-body section,
.post-body aside:not(.content-quote):not(.content-callout):not(.content-stat) {
    max-width: none !important;
}
.post-body div[style*="max-width"],
.post-body div[style*="width:"],
.post-body span[style*="max-width"],
.post-body section[style*="max-width"],
.post-body aside[style*="max-width"] {
    width: 100% !important;
    max-width: none !important;
}
.post-body h2,
.post-body h3,
.post-body h4 {
    scroll-margin-top: var(--header-offset, 13rem);
}
.post-body h2 {
    font-size: 1.35rem;
    margin: 2rem 0 1rem;
}
.post-body h3 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.75rem;
}
.post-body p {
    margin-bottom: 1rem;
}
.post-body ul,
.post-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}
.post-body li {
    margin-bottom: 0.5rem;
}
.post-body pre,
.post-body code {
    background: var(--bg-card);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}
.post-body pre {
    padding: 1rem;
    overflow-x: auto;
    position: relative;
}
.post-body pre .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.post-body pre .copy-btn:hover {
    background: var(--accent);
    color: #0a0e17;
}
.post-body pre .copy-btn.copied {
    background: #22c55e;
    border-color: #22c55e;
    color: #0a0e17;
}
.post-featured-image {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.post-featured-image img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}
.post-presentation-wrapper {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-height: 400px;
    max-height: 80vh;
    -webkit-overflow-scrolling: touch;
}
.post-presentation {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    display: block;
    transform-origin: top left;
    -webkit-overflow-scrolling: touch;
    object-fit: contain;
}
.post-presentation-fullscreen-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
}
.post-presentation-fullscreen-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.5);
}
.post-presentation-fullscreen-btn:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 1) 0%, rgba(59, 130, 246, 1) 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}
.post-presentation-fullscreen-btn svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.post-presentation-fullscreen-btn span {
    display: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
@media (min-width: 769px) {
    .post-presentation-fullscreen-btn span {
        display: inline;
    }
}
.post-article .post-header {
    padding-top: 6rem;
}

/* Post body wrapper + TOC */
.post-body-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0 4rem;
}
@media (min-width: 960px) {
    .post-body-wrapper {
        grid-template-columns: 1fr 240px;
        gap: 3rem;
    }
}

/* Оглавление справа */
.post-toc-wrap {
    order: 1;
}
@media (min-width: 960px) {
    .post-toc-wrap {
        position: sticky;
        top: 100px;
        order: 1;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
    }
}

.post-toc-header {
    position: relative;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.post-toc-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 20px;
    overflow: hidden;
}

.post-toc-wave-bg {
    position: absolute;
    inset: 0;
    width: 300%;
    background: linear-gradient(
        90deg,
        #06b6d4,
        #3b82f6,
        #8b5cf6,
        #06b6d4,
        #3b82f6,
        #8b5cf6,
        #06b6d4
    );
    background-size: 200% 100%;
    animation: toc-wave-shimmer 8s linear infinite;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 20' preserveAspectRatio='none'%3E%3Cpath d='M0,12 C80,0 160,24 240,12 C320,0 400,24 400,12 L400,20 L0,20 Z' fill='white'/%3E%3C/svg%3E");
    mask-size: 100% 100%;
    mask-repeat: no-repeat;
    mask-position: center;
}

@keyframes toc-wave-shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.post-toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}

.post-toc .toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.post-toc .toc-link {
    position: relative;
    display: block;
    padding: 0.4rem 0 0.4rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s, padding-left 0.2s;
}

.post-toc .toc-link:hover {
    color: var(--accent);
    border-left-color: rgba(6, 182, 212, 0.5);
}

.post-toc .toc-link.is-active-link {
    color: var(--accent);
    font-weight: 500;
    border-left-color: var(--accent);
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.1), transparent);
}

.post-toc .toc-list .toc-list {
    padding-left: 0.75rem;
    margin-top: 0.2rem;
    border-left: 1px solid var(--border);
    margin-left: 0.5rem;
}

.post-toc .toc-list-item {
    margin-bottom: 0.1rem;
}

.post-toc .toc-list-item:last-child {
    margin-bottom: 0;
}
.post-reading-actions { margin-top: 1rem; }
.post-bionic-toggle {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.post-bionic-toggle:hover { border-color: var(--accent); color: var(--accent); }
.post-bionic-toggle.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* Bionic Reading — strong внутри текста */
.post-body.bionic-reading strong { font-weight: 700; }

/* Related posts */
.post-related {
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
}
.post-related-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}
.post-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.post-related-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.post-related-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.post-related-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}
.post-related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.post-related-card:hover .post-related-image img {
    transform: scale(1.05);
}
.post-related-body {
    padding: 1rem;
}
.post-related-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    line-height: 1.35;
    transition: color 0.2s;
}
.post-related-card:hover h3 {
    color: var(--accent);
}
.post-related-body time {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.post-related-card.no-image .post-related-body {
    padding-top: 1.25rem;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2rem 0 4rem;
    border-top: 1px solid var(--border);
}
.post-footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.post-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-muted);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s;
}
.post-edit-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent);
}
.post-back {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.post-back:hover { color: var(--accent-hover); }
.post-rss {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
}
.post-rss:hover { color: var(--accent); }
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}
.post-body iframe {
    max-width: 100%;
    border-radius: 8px;
}

/* Ссылки в тексте статьи — в стиле сайта */
.post-body a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    position: relative;
}
.post-body a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-decoration-color: var(--accent-hover);
    text-underline-offset: 3px;
}
/* Ссылки внутри заголовков */
.post-body h2 a,
.post-body h3 a,
.post-body h4 a {
    font-weight: inherit;
}
/* Ссылки внутри блоков */
.post-body .content-callout a,
.post-body .content-quote a,
.post-body .content-spoiler a {
    text-decoration-color: rgba(6, 182, 212, 0.4);
}
.post-body .content-callout a:hover,
.post-body .content-quote a:hover,
.post-body .content-spoiler a:hover {
    text-decoration-color: var(--accent-hover);
}

/* Контент-блоки — в стиле сайта, оригинальное оформление */
.post-body hr {
    border: none;
    height: 2px;
    margin: 2.5rem 0;
    background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* ——— Врезка (callout) ——— */
.post-body .content-callout {
    position: relative;
    margin: 2rem 0;
    padding: 1.5rem 1.75rem 1.5rem 2.25rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.06) 0%, rgba(59, 130, 246, 0.04) 50%, rgba(139, 92, 246, 0.03) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(6, 182, 212, 0.25);
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.06) inset, 0 4px 20px rgba(0, 0, 0, 0.15);
}
.post-body .content-callout::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient);
    border-radius: 4px 0 0 4px;
    opacity: 0.9;
}
.post-body .content-callout::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.post-body .content-callout p {
    position: relative;
    margin: 0;
    font-size: 1.06rem;
    line-height: 1.7;
    color: var(--text);
    font-weight: 450;
}

/* ——— Цифра (stat) ——— */
.post-body .content-stat {
    position: relative;
    margin: 2rem 0;
    padding: 2.25rem 2rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.04) 0%, transparent 40%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(6, 182, 212, 0.2);
    overflow: hidden;
    box-shadow: 0 0 40px -10px rgba(6, 182, 212, 0.12);
}
.post-body .content-stat::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), transparent 40%, transparent 60%, rgba(59, 130, 246, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.post-body .content-stat p:first-child {
    margin: 0;
    font-size: clamp(2.25rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(6, 182, 212, 0.2);
}
.post-body .content-stat p:last-child {
    margin: 0.6rem 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ——— Спойлер ——— */
.post-body .content-spoiler {
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.post-body .content-spoiler[open],
.post-body .content-spoiler.is-open {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.1);
}
/* Кнопка-заголовок (новая структура) */
.post-body .content-spoiler .spoiler-summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 1rem 1.35rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    text-align: left;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    color: var(--text);
}
.post-body .content-spoiler .spoiler-summary::before {
    content: '';
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 5px solid var(--accent);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-left: 2px;
    transition: transform 0.2s;
}
.post-body .content-spoiler.is-open .spoiler-summary::before {
    transform: rotate(90deg);
    margin-left: 0;
    margin-right: 2px;
}
.post-body .content-spoiler .spoiler-summary:hover {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), transparent);
}
/* summary (details/summary — старая структура) */
.post-body .content-spoiler summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.35rem;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    color: var(--text);
}
.post-body .content-spoiler summary::-webkit-details-marker { display: none; }
.post-body .content-spoiler summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid var(--accent);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-left: 2px;
    transition: transform 0.2s;
}
.post-body .content-spoiler[open] summary::before {
    transform: rotate(90deg);
    margin-left: 0;
    margin-right: 2px;
}
.post-body .content-spoiler summary:hover {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), transparent);
}
/* Тело спойлера — скрыто по умолчанию в div-структуре (data-spoiler=js) */
.post-body .content-spoiler[data-spoiler="js"]:not(.is-open) .spoiler-body {
    display: none;
}
.post-body .content-spoiler[data-spoiler="js"].is-open .spoiler-body {
    display: block;
}
.post-body .content-spoiler .spoiler-body {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.03) 0%, transparent 100%);
}
.post-body .content-spoiler .spoiler-body p {
    margin: 0 0 0.5rem;
}
.post-body .content-spoiler .spoiler-body p:last-child {
    margin-bottom: 0;
}

/* ——— Цитата (блок цитаты с автором) ——— */
.post-body .content-quote {
    position: relative;
    margin: 2.25rem 0;
    padding: 2rem 2.5rem 1.75rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.05) 0%, rgba(59, 130, 246, 0.03) 50%, rgba(10, 14, 23, 0.5) 100%);
    border: 1px solid rgba(6, 182, 212, 0.2);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.post-body .content-quote::before {
    content: '"';
    position: absolute;
    top: 0.5rem;
    left: 1.25rem;
    font-size: 4rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.5;
    line-height: 1;
}
.post-body .content-quote::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    top: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), #3b82f6);
    border-radius: 3px 0 0 3px;
    opacity: 0.8;
}
.post-body .content-quote p {
    margin: 0;
    padding-left: 1.75rem;
    font-size: 1.12rem;
    line-height: 1.65;
    color: var(--text);
    font-style: italic;
}
.post-body .content-quote cite {
    display: block;
    margin-top: 1.25rem;
    padding-left: 1.75rem;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--accent);
    font-weight: 500;
}
.post-body .content-quote cite::before {
    content: '— ';
    opacity: 0.8;
}

/* ——— Обычный blockquote (если есть в контенте) ——— */
.post-body blockquote {
    position: relative;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem 1.25rem 2rem;
    border-left: 4px solid;
    border-image: var(--gradient) 1;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.06) 0%, transparent 100%);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.65;
}
.post-body blockquote p:last-child {
    margin-bottom: 0;
}

/* ——— Слайд-шоу ——— */
.post-body .content-slideshow {
    position: relative;
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.post-body .content-slideshow .slideshow-viewport {
    overflow: hidden;
    aspect-ratio: 16 / 10;
}
.post-body .content-slideshow .slideshow-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}
.post-body .content-slideshow .slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.post-body .content-slideshow .slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.post-body .content-slideshow .slideshow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.7);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    z-index: 2;
}
.post-body .content-slideshow .slideshow-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.post-body .content-slideshow .slideshow-prev {
    left: 0.75rem;
}
.post-body .content-slideshow .slideshow-next {
    right: 0.75rem;
}
.post-body .content-slideshow .slideshow-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.35rem;
    z-index: 2;
}
.post-body .content-slideshow .slideshow-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.post-body .content-slideshow .slideshow-dots .dot:hover {
    background: rgba(255, 255, 255, 0.7);
}
.post-body .content-slideshow .slideshow-dots .dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #22d3ee);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* Мобильная адаптация для презентаций */
@media (max-width: 768px) {
    .post-presentation-wrapper {
        min-height: 300px;
        max-height: 50vh;
        overflow: hidden;
        position: relative;
    }
    
    .post-presentation {
        min-height: 300px;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }
    
    .post-presentation-fullscreen-btn {
        display: flex;
        bottom: 0.75rem;
        right: 0.75rem;
        padding: 0.65rem 1.1rem;
        border-radius: var(--radius-lg);
        font-size: 0.85rem;
        min-height: 44px;
    }
    
    .post-presentation-fullscreen-btn span {
        display: inline;
    }
    
    .blog-card-presentation-fullscreen-btn {
        width: 48px;
        height: 48px;
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    .blog-card-presentation-fullscreen-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .blog-card-presentation {
        aspect-ratio: 16 / 10;
        overflow: hidden;
    }
    
    .blog-card-featured .blog-card-presentation {
        aspect-ratio: 16 / 10;
    }
    
    .blog-card-presentation iframe {
        transform: scale(1);
        width: 100%;
        height: 100%;
        pointer-events: none;
    }
    
    .blog-card-presentation-fullscreen-btn {
        display: flex;
    }
}

@media (max-width: 480px) {
    .post-presentation-wrapper {
        min-height: 250px;
        max-height: 45vh;
        margin-bottom: 1rem;
    }
    
    .post-presentation {
        min-height: 250px;
    }
    
    .post-presentation-fullscreen-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    .blog-card-presentation-fullscreen-btn {
        width: 48px;
        height: 48px;
    }
    
    .blog-card-presentation-fullscreen-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .blog-card-presentation {
        aspect-ratio: 16 / 9;
    }
    
    .blog-card-featured .blog-card-presentation {
        aspect-ratio: 16 / 9;
    }
}

/* Полноэкранное модальное окно для презентации */
.presentation-fullscreen-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.presentation-fullscreen-modal.open {
    display: flex;
    opacity: 1;
    visibility: visible;
}
/* Скрытие шапки при открытом модальном окне */
body.presentation-fullscreen-active .header,
body.presentation-fullscreen-active header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(-100%) !important;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
}
.presentation-fullscreen-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.presentation-fullscreen-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1;
}
.presentation-fullscreen-iframe-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.presentation-fullscreen-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.presentation-fullscreen-close:hover {
    background: rgba(10, 14, 23, 1);
    border-color: rgba(6, 182, 212, 0.6);
    color: #22d3ee;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}
.presentation-fullscreen-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    background: var(--bg-card);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .presentation-fullscreen-content {
        padding: 0;
    }
    
    .presentation-fullscreen-iframe-wrap {
        align-items: center;
        justify-content: center;
    }
    
    .presentation-fullscreen-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .blog-card-presentation-fullscreen-btn {
        display: flex;
    }
    
    .post-presentation-fullscreen-btn {
        display: flex;
    }
    
    .post-presentation-fullscreen-btn span {
        display: inline;
    }
}
