/* ========================================
   EDITORIAL TYPOGRAPHY SYSTEM
   Газетная типографика в стиле The New Yorker, FT, Le Monde
   Строгая иерархия, вертикальный ритм, минимализм
   ======================================== */

/* ===============================
   ШРИФТОВЫЕ ПЕРЕМЕННЫЕ
   =============================== */
:root {
    /* Editorial Serif для заголовков */
    --font-editorial: 'Libre Baskerville', 'Playfair Display', 'Canela', Georgia, serif;
    
    /* Sans-serif для основного текста и UI */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Цвета - светлая тема */
    --color-text: #111;
    --color-text-secondary: #777;
    --color-text-muted: #666;
    --color-border: rgba(0, 0, 0, 0.1);
    --color-border-light: #e5e5e5;
    --color-bg: #ffffff;
    --color-bg-secondary: #f5f5f5;
    --color-sidebar-bg: #ffffff;
    --color-sidebar-border: #e5e7eb;
}

/* Темная тема */
[data-theme="dark"] {
    --color-text: #f5f5f5;
    --color-text-secondary: #a0a0a0;
    --color-text-muted: #888888;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-light: rgba(255, 255, 255, 0.08);
    --color-bg: #111111;
    --color-bg-secondary: #1a1a1a;
    --color-sidebar-bg: #111111;
    --color-sidebar-border: rgba(255, 255, 255, 0.1);
}

/* ===============================
   H1 - Главный заголовок статьи / страницы
   =============================== */
.article-header .article-title,
.article-header .article-header-content .article-title,
.article-header-content .article-title,
body .article-header .article-title,
body .article-header .article-header-content .article-title,
html body .article-header .article-title,
html body .article-header .article-header-content .article-title,
.article-content .article-header .article-title,
.article-content .article-header .article-header-content .article-title,
.medium-article .article-header .article-title,
.medium-article .article-header .article-header-content .article-title,
.article-title {
    font-family: var(--font-editorial) !important;
    font-style: normal !important;
    font-weight: 500 !important;
    font-size: clamp(42px, 6vw, 72px) !important;
    line-height: 1.05 !important;
    letter-spacing: -0.02em !important;
    text-transform: none !important;
    color: var(--color-text) !important;
    margin: 0 0 clamp(0px, 1vw, 8px) 0 !important;
    padding: 0 !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 1024–1440: h1 на 24px меньше для кейсов (clamp 42–72 → 18–48). Typography идёт после CaseStudiesContent — правило перекрывает базовый clamp. */
@media (min-width: 1024px) and (max-width: 1440px) {
    .article-header .article-title,
    .article-header .article-header-content .article-title,
    .article-header-content .article-title,
    body .article-header .article-title,
    body .article-header .article-header-content .article-title,
    html body .article-header .article-title,
    html body .article-header .article-header-content .article-title,
    .article-content .article-header .article-title,
    .article-content .article-header .article-header-content .article-title,
    .medium-article .article-header .article-title,
    .medium-article .article-header .article-header-content .article-title,
    .article-title {
        font-size: clamp(18px, calc(6vw - 24px), 48px) !important;
    }
}

/* ===============================
   H2 - Подзаголовок раздела
   =============================== */
body.case-study .medium-article .article-content .article-section h2,
body.case-study .medium-article .article-content h2,
body.case-study .article-content .article-section h2,
body.case-study .article-content h2,
body.case-study .article-section h2,
.medium-article .article-content .article-section h2,
.medium-article .article-content h2,
.article-content .article-section h2,
.article-content h2,
.article-section h2 {
    font-family: var(--font-editorial) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-size: clamp(28px, 4vw, 40px) !important;
    line-height: 1.15 !important;
    color: var(--color-text) !important;
    letter-spacing: -0.01em !important;
    text-align: left !important;
    margin: clamp(96px, 12vw, 120px) 0 clamp(24px, 3vw, 32px) 0 !important;
    text-transform: none !important;
}

/* Первый H2 в секции - без верхнего отступа */
body.case-study .medium-article .article-content .article-section h2:first-of-type,
body.case-study .medium-article .article-content h2:first-of-type,
body.case-study .article-content .article-section h2:first-of-type,
body.case-study .article-content h2:first-of-type,
body.case-study .article-section h2:first-of-type,
.medium-article .article-content .article-section h2:first-of-type,
.medium-article .article-content h2:first-of-type,
.article-content .article-section h2:first-of-type,
.article-content h2:first-of-type,
.article-section h2:first-of-type {
    margin-top: 0 !important;
    margin-bottom: clamp(24px, 3vw, 32px) !important;
}

/* H2 в секции experience (about-me) */
#experience h2,
.job-item h2 {
    font-family: var(--font-editorial) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-size: clamp(28px, 4vw, 40px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em !important;
    text-transform: none !important;
    color: var(--color-text) !important;
    text-align: left !important;
    margin: clamp(96px, 12vw, 120px) 0 clamp(24px, 3vw, 32px) 0 !important;
}

#experience h2:first-of-type,
.job-item:first-child h2 {
    margin-top: 0 !important;
}

/* ===============================
   H3 - Внутренний заголовок
   =============================== */
.article-content h3,
.article-section h3 {
    font-family: var(--font-editorial) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-size: clamp(22px, 2.5vw, 24px) !important;
    line-height: 1.3 !important;
    color: var(--color-text) !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    margin: 64px 0 16px 0 !important;
}

/* H3 после H2 - уменьшенный отступ сверху */
.article-section h2 + h3,
.article-content h2 + h3 {
    margin-top: 48px !important;
}

/* H3 после параграфа */
.article-section p + h3,
.article-content p + h3 {
    margin-top: 64px !important;
}

/* ===============================
   H4 - Рубрика / Категория (если используется)
   =============================== */
.article-content h4,
.article-section h4 {
    font-family: var(--font-body) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: var(--color-text-secondary) !important;
    margin: 0 0 16px 0 !important;
}

/* ===============================
   ОСНОВНОЙ КОНТЕНТ (Body Text)
   =============================== */
.article-content p,
.article-content li,
.article-section p {
    font-family: var(--font-body) !important;
    font-size: 22px !important;
    font-weight: 400 !important;
    line-height: 1.65 !important;
    color: var(--color-text) !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    margin: 0 0 1.2em 0 !important;
    max-width: 680px !important;
}

/* Параграфы после заголовков - без extra margin-top */
.article-section h2 + p,
.article-section h3 + p,
.article-content h2 + p,
.article-content h3 + p {
    margin-top: 0;
}

/* Параграфы, следующие друг за другом */
.article-section p + p,
.article-content p + p {
    margin-top: 0;
}

/* Последний параграф в секции */
.article-section p:last-child,
.article-content p:last-child {
    margin-bottom: 0;
}

/* Intro-блок статьи - увеличенный размер */
.article-content #introduction p,
.article-section #introduction p,
#introduction p {
    font-size: 19px !important;
    line-height: 1.7 !important;
    margin-bottom: 1.3em !important;
}

/* Параграфы в секции #about (about-me) */
#about p {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.65 !important;
    font-weight: 400;
    color: var(--color-text) !important;
    letter-spacing: 0;
    margin-bottom: 1.2em;
    max-width: 680px;
}

#about p:last-child {
    margin-bottom: 0;
}

/* Body для кейсов */
body.case-study .hero-image-section ~ .article-section p:not(.image-caption),
body.case-study .article-section p:not(.image-caption) {
    font-family: var(--font-body) !important;
    font-size: 22px !important;
    font-weight: 400;
    line-height: 1.65 !important;
    color: var(--color-text) !important;
    letter-spacing: 0;
    text-align: left;
    margin: 0 0 1.2em 0;
    max-width: 680px;
}

body.case-study .hero-image-section ~ .article-section p:not(.image-caption):last-child,
body.case-study .article-section p:not(.image-caption):last-child {
    margin-bottom: 0;
}

/* ===============================
   СПИСКИ (Как в газетах)
   =============================== */
.article-content ul,
.article-section ul {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.7 !important;
    padding-left: 1.2em !important;
    margin: 24px 0 32px 0 !important;
    list-style: none !important;
    list-style-type: none !important;
    max-width: 680px;
}

.article-content ul:last-child,
.article-section ul:last-child {
    margin-bottom: 0;
}

.article-content ul li,
.article-section ul li {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    font-weight: 400;
    line-height: 1.7 !important;
    color: var(--color-text) !important;
    letter-spacing: 0;
    margin-bottom: 8px !important;
    padding-left: 0 !important;
    list-style: none !important;
    list-style-type: none !important;
    position: relative;
}

.article-content ul li:last-child,
.article-section ul li:last-child {
    margin-bottom: 0 !important;
}

/* Минимальный маркер - тире */
.article-content ul li::before,
.article-section ul li::before,
body .article-content ul li::before,
body .article-section ul li::before,
html body .article-content ul li::before,
html body .article-section ul li::before {
    content: "—" !important;
    position: absolute !important;
    left: -1.2em !important;
    width: auto !important;
    height: auto !important;
    background-color: transparent !important;
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    color: var(--color-text) !important;
    line-height: 1.7 !important;
}

/* Списки в секции experience */
#experience ul li,
.job-item ul li {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.7 !important;
    margin-bottom: 8px !important;
}

#experience ul li::before,
.job-item ul li::before {
    content: "—" !important;
    font-size: 18px !important;
}

/* Списки после заголовков */
.article-section h2 + ul,
.article-section h3 + ul,
.article-content h2 + ul,
.article-content h3 + ul {
    margin-top: 0;
}

/* Списки в кейсах */
body.case-study .hero-image-section ~ .article-section ul li,
body.case-study .article-section ul li {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    font-weight: 400;
    line-height: 1.7 !important;
    color: var(--color-text) !important;
    letter-spacing: 0;
    text-align: left;
    margin-bottom: 8px !important;
    padding-left: 0 !important;
    list-style: none !important;
    position: relative;
}

body.case-study .hero-image-section ~ .article-section ul li::before,
body.case-study .article-section ul li::before {
    content: "—" !important;
    font-size: 18px !important;
}

body.case-study .hero-image-section ~ .article-section ul li:last-child,
body.case-study .article-section ul li:last-child {
    margin-bottom: 0;
}

/* Ordered lists */
.article-content ol,
.article-section ol {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.7 !important;
    padding-left: 1.5em !important;
    margin: 24px 0 32px 0 !important;
    max-width: 680px;
}

.article-content ol li,
.article-section ol li {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.7 !important;
    margin-bottom: 8px !important;
    padding-left: 0.5em;
}

.article-content ol li:last-child,
.article-section ol li:last-child {
    margin-bottom: 0 !important;
}

/* ===============================
   ЦИТАТЫ / АКЦЕНТЫ (Blockquote)
   =============================== */
.article-content blockquote,
.article-section blockquote,
body.case-study .article-section p.quote,
body.case-study .article-section p:has(> strong:only-child) {
    font-family: var(--font-editorial) !important;
    font-size: clamp(22px, 2.5vw, 26px) !important;
    line-height: 1.4 !important;
    font-weight: 400;
    font-style: italic !important;
    color: var(--color-text) !important;
    margin: 64px 0 !important;
    padding: 0 !important;
    max-width: 560px !important;
    background: transparent !important;
    border: none !important;
    letter-spacing: 0;
    position: relative;
}

body.case-study .article-section p.quote:last-child,
body.case-study .article-section p:has(> strong:only-child):last-child {
    margin-bottom: 0;
}

/* Убираем кавычки если они есть */
body.case-study .article-section p.quote::before,
body.case-study .article-section p:has(> strong:only-child)::before,
body.case-study .article-section p.quote::after,
body.case-study .article-section p:has(> strong:only-child)::after {
    display: none !important;
}

/* ===============================
   МЕТА-ТЕКСТ / РУБРИКИ / ДАТЫ
   =============================== */
.article-description,
.job-item .job-meta,
#experience .job-meta {
    font-family: var(--font-body) !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: var(--color-text-secondary) !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    margin-bottom: 16px !important;
    font-style: normal !important;
}

.job-item .job-meta {
    margin-top: 0 !important;
}

/* ===============================
   ПОДПИСИ ПОД КАРТИНКАМИ (Captions)
   =============================== */
.image-caption,
.article-section .image-caption,
.article-content .image-caption,
.article-image .image-caption {
    font-family: var(--font-body) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: var(--color-text-muted) !important;
    margin: 12px 0 0 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-weight: 400 !important;
    max-width: 680px;
}

/* ===============================
   МЕЛКИЙ ТЕКСТ / FOOTNOTES
   =============================== */
.article-content small,
.article-section small,
.article-content .small,
.article-section .small {
    font-family: var(--font-body) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: var(--color-text-secondary) !important;
}

/* ===============================
   РАЗДЕЛИТЕЛИ (Editorial Rules)
   =============================== */
.section-divider,
.job-divider,
.divider-1,
.divider-2,
.divider-3,
.divider-4,
.divider-5,
.divider-6,
.divider-7,
.divider-8,
.divider-9,
.divider-10,
.divider-11 {
    width: 100%;
    height: 1px;
    background-color: var(--color-border-light) !important;
    margin: clamp(64px, 8vw, 96px) 0;
    padding: 0;
    border: none;
    display: block;
}

/* Разделитель после intro */
#introduction + .section-divider,
#introduction ~ .article-section:first-of-type::before {
    margin-top: 64px;
}

/* ===============================
   ВСТАВНЫЕ БЛОКИ (Sidebars / Notes)
   =============================== */
.article-content aside,
.article-section aside,
.data-point {
    border-left: 2px solid #000000 !important;
    padding-left: 24px !important;
    font-family: var(--font-body) !important;
    font-size: 16px !important;
    color: #444 !important;
    margin: 64px 0 !important;
    max-width: 680px;
    background: transparent !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: fit-content;
}

.data-points {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    max-width: 680px;
}

.data-point {
    border-left: 2px solid #000000 !important;
    padding-left: 24px !important;
    padding-bottom: 0;
    margin-bottom: 32px;
    border-bottom: none !important;
    background: transparent !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: fit-content;
}

.data-point:last-child {
    margin-bottom: 0;
}

.data-point h3 {
    font-family: var(--font-editorial) !important;
    font-size: clamp(22px, 2.5vw, 24px) !important;
    line-height: 1.3 !important;
    margin: 24px 0 16px 0 !important;
}

.data-point p {
    font-family: var(--font-body) !important;
    font-size: 18px !important;
    line-height: 1.65 !important;
    margin: 0;
}

/* ===============================
   SECTION SPACING (Вертикальный ритм)
   =============================== */
.article-section {
    margin-bottom: 0;
}

/* Между крупными секциями */
.article-section + .article-section {
    margin-top: clamp(120px, 15vw, 160px);
}

/* Уменьшаем отступы между секциями на мобильных и iPad */
@media (max-width: 1024px) {
    .article-section + .article-section {
        margin-top: 48px !important;
    }
    
    #problem,
    #hypothesis,
    #interviews,
    #validation,
    #pivot,
    #design,
    #components,
    #launch,
    #results,
    #learnings {
        margin-top: 48px !important;
    }
    
    #introduction {
        margin-bottom: 40px !important;
    }
}

@media (max-width: 767px) {
    .article-section + .article-section {
        margin-top: 32px !important;
    }
    
    #problem,
    #hypothesis,
    #interviews,
    #validation,
    #pivot,
    #design,
    #components,
    #launch,
    #results,
    #learnings {
        margin-top: 32px !important;
    }
    
    #introduction {
        margin-bottom: 32px !important;
    }
    
    /* Уменьшаем отступы у списков на мобильных */
    .article-content ul,
    .article-section ul {
        margin: 16px 0 20px 0 !important;
    }
    
    .article-content ul li,
    .article-section ul li {
        margin-bottom: 8px !important;
    }
    
    .article-content ol li,
    .article-section ol li {
        margin-bottom: 8px !important;
    }
}

@media (max-width: 1024px) {
    /* Уменьшаем отступы у списков на iPad */
    .article-content ul,
    .article-section ul {
        margin: 20px 0 24px 0 !important;
    }
}

/* Между логическими блоками внутри статьи */
#problem,
#hypothesis,
#interviews,
#validation,
#pivot,
#design,
#components,
#launch,
#results,
#learnings {
    margin-top: clamp(64px, 8vw, 96px);
}

/* Intro отделён линией */
#introduction {
    margin-bottom: 64px;
    padding-bottom: 0;
}

/* ===============================
   ИЗОБРАЖЕНИЯ (Editorial Style)
   =============================== */
.article-image,
.featured-image-container {
    margin: clamp(48px, 6vw, 64px) 0 16px 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

.featured-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px !important;
    border: 1px solid #E5E8EB !important;
    box-shadow: none !important;
    display: block;
    margin: 0;
}

.case-image,
.case-video,
.article-section img:not(.hero-image):not(.hero-video):not(.featured-image) {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px !important;
    border: 1px solid #E5E8EB !important;
    box-shadow: none !important;
    display: block;
    margin: 0;
}

.article-image img,
.article-section img {
    margin: 0;
}

/* Hero: уменьшенный отступ между заголовком и картинкой во всех кейсах */
.hero-image-section {
    margin: clamp(32px, 4vw, 48px) 0;
}

/* Full-width image как пауза между секциями (не hero) */
.article-image.full-width {
    margin: clamp(96px, 12vw, 120px) 0;
}

/* Уменьшаем отступы hero на iPad */
@media (max-width: 1024px) {
    .hero-image-section {
        margin: 24px 0 !important;
    }
    .article-image.full-width {
        margin: 32px 0 !important;
    }
}

@media (max-width: 767px) {
    .hero-image-section {
        margin: 20px 0 !important;
    }
    .article-image.full-width {
        margin: 24px 0 !important;
    }
}

.video-wrapper {
    margin: clamp(48px, 6vw, 64px) 0 16px 0;
    border-radius: 4px !important;
    border: 1px solid #E5E8EB !important;
    box-shadow: none !important;
}

/* ===============================
   RESPONSIVE (Минимальные корректировки)
   =============================== */
@media (max-width: 767px) {
    .article-content p,
    .article-section p,
    .article-content ul li,
    .article-section ul li {
        font-size: 22px !important;
        line-height: 1.65 !important;
    }
    
    .article-section h2 + .article-section {
        margin-top: 80px;
    }
}

@media (min-width: 1920px) {
    .article-content p,
    .article-section p {
        line-height: 1.75;
    }
}

/* ===============================
   ЗАПРЕТЫ (Override любых конфликтов)
   =============================== */
.article-content *,
.article-section * {
    /* Запрет центрирования текста */
    text-align: left !important;
}

.article-content p,
.article-section p {
    /* Запрет растягивания на всю ширину */
    max-width: 680px !important;
}

/* Убираем декоративные элементы */
.article-content ::before:not(ul li::before),
.article-section ::before:not(ul li::before) {
    display: none !important;
}

/* Запрет цветных акцентов */
.article-content strong:not(blockquote strong),
.article-section strong:not(blockquote strong) {
    font-weight: 400 !important;
    font-style: italic !important;
}

/* Убираем кнопки из редакционного контента */
.article-content .btn,
.article-section .btn,
.article-content button:not([type="hidden"]):not(.share-button),
.article-section button:not([type="hidden"]):not(.share-button) {
    display: none !important;
}

/* Исключение для кнопки Share в cta-wrapper и article-header */
.cta-wrapper .share-button,
.article-header .share-button {
    display: flex !important;
}
