/* ═══════════════════════════════════════════════════
   BASE.CSS — МатМир
   Все переменные, типографика, глобальные стили
   За основу взят article_detail (light.html v2)
═══════════════════════════════════════════════════ */

/* ═══════════════════════════════
   ПЕРЕМЕННЫЕ
═══════════════════════════════ */
:root {
    /* Фоны */
    --cream:    #FAFAF7;
    --paper:    #F5F0E8;
    --white:    #FFFFFF;

    /* Текст */
    --ink:      #1A2332;
    --ink2:     #3A4A5C;
    --ink3:     #6B7A8D;

    /* Границы */
    --border:   #E2DDD5;

    /* Акцент — золото */
    --gold:     #C9973A;
    --gold2:    #E8B84B;
    --gold-bg:  #FDF3E0;
    --gold-bd:  rgba(201,151,58,.25);

    /* Акцент — бирюза */
    --teal:     #1A9E96;
    --teal-bg:  #E8F7F6;

    /* Акцент — коралл */
    --coral:    #D95F3B;
    --coral-bg: #FEF0EB;

    /* Тёмная тема (футер, навбар) */
    --navy:     #0D1B2A;
    --navy2:    #1E3352;

    /* Тени */
    --shadow-sm: 0 2px 16px rgba(26,35,50,.08);
    --shadow-md: 0 8px 32px rgba(26,35,50,.10);
    --shadow-lg: 0 16px 56px rgba(26,35,50,.13);

    /* Радиусы */
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-xl:   20px;
    --r-pill: 50px;

    /* Шрифты */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Lora', Georgia, serif;
    --font-ui:      'Nunito', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
}

/* ═══════════════════════════════
   СБРОС И БАЗА
═══════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ═══════════════════════════════
   ТИПОГРАФИКА — ЗАГОЛОВКИ
═══════════════════════════════ */

/* H1 — главный заголовок статьи */
h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--ink);
    margin-bottom: 2rem;
}

/* Курсив в h1 — золотой */
h1 em {
    font-style: italic;
    color: var(--gold);
}

/* H2 — заголовки разделов внутри статьи */
h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.3px;
    color: var(--ink);
    margin: 52px 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

/* H3 — подзаголовки */
h3 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    margin: 36px 0 14px;
}

/* H4 — лейблы, заголовки карточек */
h4 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}

/* ═══════════════════════════════
   ТИПОГРАФИКА — ТЕКСТ
═══════════════════════════════ */

p {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.8;
    color: var(--ink2);
    margin-bottom: 22px;
}

strong {
    font-weight: 600;
    color: var(--ink);
}

em { font-style: italic; }

small {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink3);
    line-height: 1.5;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color .2s;
}
a:hover { color: var(--gold2); }

code {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 2px 7px;
    color: var(--ink);
}

/* ═══════════════════════════════
   ШАПКА САЙТА — НАВБАР
═══════════════════════════════ */
.site-header {
    z-index: 100;
    background: var(--navy);
    border-bottom: 3px solid var(--gold);
}

.nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 48px;
    gap: 24px;
}

/* Логотип */
.nav-logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: -.5px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}
.nav-logo em {
    color: #fff;
    font-style: normal;
}

/* Десктопные ссылки */
.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}
.nav-links > a {
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,.6);
    letter-spacing: .3px;
    transition: color .2s;
}
.nav-links > a:hover { color: var(--gold); }
.nav-links > a.nav-active { color: #fff; }



/* Dropdown */
.nav-dd { position: relative; }
.nav-dd > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,.6);
    padding: 8px 14px;
    border-radius: var(--r-sm);
    transition: color .2s;
    white-space: nowrap;
    cursor: pointer;
}
.nav-dd > a::after {
    content: '';
    width: 5px; height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .22s;
    flex-shrink: 0;
}
.nav-dd:hover > a,
.nav-dd:focus-within > a { color: var(--gold); }
.nav-dd:hover > a::after,
.nav-dd:focus-within > a::after { transform: rotate(-135deg) translateY(1px); }

.nav-dd-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .2s, transform .22s, visibility .2s;
    z-index: 300;
}

/* невидимый мостик, чтобы курсор не "проваливался" в разрыв */
.nav-dd-panel::before {
    content: '';
    position: absolute;
    top: -10px;        /* высота разрыва */
    left: 0;
    right: 0;
    height: 10px;
    /* фон не нужен — элемент прозрачный, но ловит курсор */
}


.nav-dd:hover .nav-dd-panel,
.nav-dd:focus-within .nav-dd-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.nav-dd-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink2);
    transition: background .15s, color .15s;
}
.nav-dd-panel a:hover { background: var(--paper); color: var(--gold); }
.nav-dd-panel .ddi {
    width: 28px; height: 28px;
    border-radius: 7px;
    background: var(--gold-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.nav-dd-panel .dd-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink3);
    display: block;
    margin-top: 1px;
}

/* Бургер */
.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px; height: 42px;
    background: none;
    border: 1.5px solid rgba(255,255,255,.2);
    border-radius: var(--r-sm);
    cursor: pointer;
    margin-left: auto;
    transition: border-color .2s;
}
.nav-burger:hover { border-color: var(--gold); }
.nav-burger span {
    display: block;
    width: 20px; height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .28s ease, opacity .2s, width .2s;
    transform-origin: center;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; width: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Мобильное меню */
.nav-mobile {
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    background: var(--navy2);
    transition: max-height .35s cubic-bezier(.4,0,.2,1);
}
.nav-mobile.is-open { max-height: 680px; }
.nav-mobile-inner {
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mob-label {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 10px 12px 4px;
    margin-top: 4px;
}
.nav-mobile a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 700;
    color: rgba(255,255,255,.6);
    padding: 11px 12px;
    border-radius: var(--r-md);
    transition: background .15s, color .15s;
}
.nav-mobile a:hover { background: rgba(255,255,255,.06); color: var(--gold); }
.mob-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 0; }
.mob-cta {
    background: var(--gold) !important;
    color: var(--navy) !important;
    justify-content: center;
    font-weight: 800 !important;
    border-radius: var(--r-pill) !important;
    margin-top: 6px;
}
.mob-cta:hover { background: var(--gold2) !important; }

/* ═══════════════════════════════
   ПОИСК В НАВБАРЕ
═══════════════════════════════ */
.nav-right {
    display: flex;
    align-items: center;
}

.nav-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search-wrap input {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--r-pill);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px 8px 36px;
    width: 210px;
    outline: none;
    transition: background .25s, border-color .25s, width .3s ease, box-shadow .25s;
}

.nav-search-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.nav-search-wrap input:focus {
    background: rgba(255, 255, 255, 0.13);
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 151, 58, 0.18);
    width: 270px;
}

.nav-search-icon {
    position: absolute;
    left: 11px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0.45;
    line-height: 1;
    transition: opacity .25s;
}

.nav-search-wrap:focus-within .nav-search-icon {
    opacity: 1;
}

/* Поиск в мобильном меню */
.mob-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.mob-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-pill);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px 10px 38px;
    outline: none;
    transition: border-color .2s, background .2s;
}

.mob-search input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.mob-search input:focus {
    border-color: var(--gold);
    background: rgba(255, 255, 255, 0.11);
}

.mob-search-icon {
    position: absolute;
    left: 12px;
    font-size: 15px;
    pointer-events: none;
    opacity: 0.45;
}

@media (max-width: 960px) {
    .nav-right { display: none; }
}
/* ═══════════════════════════════
   ХЛЕБНЫЕ КРОШКИ
═══════════════════════════════ */
.breadcrumbs-wrap {
    position: relative;
    z-index: 1;
    padding: 10px 48px;
    border-bottom: 1px solid var(--border);
    background: var(--paper);
}
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    flex-wrap: wrap;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink3);
    max-width: 1200px;
    margin: 0 auto;
}
.breadcrumbs li { display: flex; align-items: center; gap: 8px; }
.breadcrumbs li + li::before { content: '›'; opacity: .5; }
.breadcrumbs a { color: var(--ink3); text-decoration: none; transition: color .2s; }
.breadcrumbs a:hover { color: var(--gold); }
.breadcrumbs li:last-child span { color: var(--ink); }

/* ═══════════════════════════════
   MAIN
═══════════════════════════════ */
.site-main {
    position: relative;
    z-index: 1;
    flex: 1;
}

/* ═══════════════════════════════
   ФУТЕР
═══════════════════════════════ */
.site-footer {
    position: relative;
    z-index: 1;
    background: var(--navy);
    border-top: 3px solid var(--gold);
    padding: 56px 48px 36px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 220px 1fr 1fr 1fr;
    gap: 48px;
}
.footer-logo-col .nav-logo { display: block; margin-bottom: 10px; }
.footer-logo-col p {
    font-family: var(--font-ui);
    font-size: 13px;
    color: rgba(255,255,255,.35);
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 0;
}
.footer-col h4 {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    margin-bottom: 18px;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 0;
}
.footer-col a {
    display: block;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,.5);
    margin-bottom: 12px;
    transition: color .2s;
}
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
    max-width: 1200px;
    margin: 36px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.footer-bottom p {
    font-family: var(--font-ui);
    font-size: 12px;
    color: rgba(255,255,255,.25);
    font-weight: 600;
    margin-bottom: 0;
}

/* ═══════════════════════════════
   АНИМАЦИИ
═══════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s ease both; }

/* ═══════════════════════════════
   АДАПТИВ
═══════════════════════════════ */
@media (max-width: 960px) {
    .nav-top { padding: 0 20px; }
    .nav-links { display: none; }
    .nav-burger { display: flex; }
    .nav-mobile { display: flex; }
    .breadcrumbs-wrap { padding: 10px 20px; }
}
@media (max-width: 720px) {
    .site-footer { padding: 40px 20px 28px; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 480px) {
    .footer-inner { grid-template-columns: 1fr; gap: 20px; }
    .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}


/* ──────────────────────────── СТРАНИЦА ПОИСКА ──────────────────────────── */

.search-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.search-page h1 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.search-page h1 em {
    font-style: normal;
    color: var(--color-accent, #c9a84c);
}

.search-section {
    margin-top: 2rem;
}

.search-section h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-muted, #888);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

/* ── Карточки ── */
.search-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-card {
    display: block;
    padding: 16px 20px;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, border-color .2s;
    background: var(--color-surface, #fff);
}

.search-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    border-color: var(--color-accent, #c9a84c);
}

.search-card-meta {
    font-size: .72rem;
    font-weight: 700;
    color: var(--color-accent, #c9a84c);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}

.search-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--color-heading, #1a1a1a);
}

.search-card-snippet {
    font-size: .88rem;
    color: var(--color-muted, #666);
    line-height: 1.6;
}

.search-empty {
    color: var(--color-muted, #888);
    margin-top: 1.5rem;
    font-size: 1rem;
}

.search-card-snippet mark {
    background: #fff3cd;
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
}

/* ── Мобильные ── */
@media (max-width: 600px) {
    .search-page h1 { font-size: 1.3rem; }
    .search-card { padding: 12px 14px; }
}