/* ═══════════════════════════════════════════════════════════════════
   home.css — стили главной страницы v3
   Блоки: HERO / DIR / CATS / TOP50 / BRANDS / NEWS / BLOG
   ═══════════════════════════════════════════════════════════════════ */

/* Глобально запретить горизонтальный скролл (слайдеры могут торчать) */
body { overflow-x: hidden; }

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ══════════════ БЛОК 1: HERO ═══════════════════════════════════════ */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-bg {
    position: absolute; inset: 0;
    z-index: 0;
}
.hero-slide {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.4s ease;
    transform: scale(1.05);
    animation: hero-zoom 14s ease-in-out infinite alternate;
}
.hero-slide.active { opacity: 1; }
@keyframes hero-zoom {
    from { transform: scale(1.0); }
    to   { transform: scale(1.08); }
}
.hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg,
        rgba(7,24,36,.55) 0%,
        rgba(7,24,36,.45) 40%,
        rgba(7,24,36,.75) 100%);
    z-index: 1;
}
.hero-inner {
    position: relative; z-index: 2;
    width: 100%;
    max-width: 1000px;
    padding: 20px 20px calc(60px + env(safe-area-inset-bottom));
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
}
.hero-h1 {
    color: #fff;
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.08;
    text-align: center;
    margin: 0 0 20px;
    text-shadow: 0 2px 20px rgba(0,0,0,.4);
    letter-spacing: -0.01em;
}
.hero-lead {
    font-size: 2rem;
    text-align: center;
    line-height: 1.55;
    color: rgba(255,255,255,.92);
    margin: 0;
    text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.hero-lead strong { color: #ffb347; font-weight: 800; }
.hero-lead-accent { color: #6ee1ff; }

.hero-h2 {
    color: #fff !important;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 700;
    margin: 0 0 14px;
    text-shadow: 0 1px 8px rgba(0,0,0,.4);
}

/* ── AI-textarea с neural glow */
.ai-form { width: 100%; max-width: 640px; margin: 0 auto; }
.ai-wrap {
    position: relative;
    padding: 2px;
    border-radius: 18px;
    background: conic-gradient(from var(--angle),
        #2ec8ff 0%, #a855f7 25%, #2ec8ff 50%, #ff6bcb 75%, #2ec8ff 100%);
    animation: ai-spin 5s linear infinite;
    box-shadow: 0 10px 40px rgba(46,200,255,.25), 0 0 60px rgba(168,85,247,.2);
}
@keyframes ai-spin { to { --angle: 360deg; } }
/* fallback для браузеров без @property */
@supports not (background: conic-gradient(from var(--angle), #000, #fff)) {
    .ai-wrap {
        background: linear-gradient(135deg, #2ec8ff, #a855f7, #ff6bcb, #2ec8ff);
        background-size: 300% 300%;
        animation: ai-shift 5s ease infinite;
    }
    @keyframes ai-shift {
        0%   { background-position: 0% 50%; }
        50%  { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }
}
.hero-ai {
    margin-top: 50px;
}
.ai-glow {
    position: absolute; inset: 2px;
    border-radius: 16px;
    background: radial-gradient(circle at 30% 20%, rgba(46,200,255,.18), transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(168,85,247,.15), transparent 60%);
    pointer-events: none;
    z-index: 1;
}
.ai-input {
    position: relative;
    z-index: 2;
    width: 100%;
    display: block;
    background: rgba(12, 24, 38, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 0;
    border-radius: 16px;
    color: #fff;
    font-size: 1rem;
    padding: 18px 58px 18px 20px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    min-height: 76px;
}
.ai-input::placeholder { color: rgba(255,255,255,.55); }
.ai-input:focus {
    background: rgba(12, 24, 38, 0.75);
}
.ai-submit {
    position: absolute;
    right: 10px; bottom: 10px;
    z-index: 3;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #2ec8ff, #a855f7);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 4px 16px rgba(46,200,255,.4);
}
.ai-submit:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(168,85,247,.6); }
.ai-hint {
    margin: 10px 0 0;
    font-size: .78rem;
    color: rgba(255,255,255,.65);
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* Мобильный: учитываем фиксированный .bar 70px снизу */
@media (max-width: 768px) {
    #hero {
        margin-top: 0;
        padding-top: 46px;
    }
    .hero-inner {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        gap: 20px;
    }
    .hero-scroll { bottom: calc(80px + env(safe-area-inset-bottom)); }
    .ai-input { min-height: 66px; padding: 14px 50px 14px 16px; font-size: .95rem; }
    .hero-lead br { display: none; }
}

/* ══════════════ БЛОК 2: 8 иконок направлений ═════════════════════ */
#dir {
    padding: 20px 0 20px;
    background: #fff;
}
.dir-scroll {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 16px;
    padding: 4px;
}
.dir-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #0c2233;
    gap: 10px;
    padding: 12px 4px;
    border-radius: 14px;
    transition: background .2s ease, transform .2s ease;
}
.dir-item:hover {
    text-decoration: none;
    color: #1b6b8f;
    background: #f3f9fc;
    transform: translateY(-2px);
}
.dir-ico {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e7f5fc, #d8ecf8);
    border: 1.5px solid #cde5f2;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 1.55rem;
    color: #1b6b8f;
    flex-shrink: 0;
    transition: background .2s ease, border-color .2s ease;
}
.dir-item:hover .dir-ico {
    background: linear-gradient(135deg, #1b6b8f, #0c2d44);
    color: #ffb347;
    border-color: #0c2d44;
}
.dir-label {
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
}
@media (max-width: 768px) {
    #dir { padding: 24px 0 14px; }
    .dir-scroll {
        display: flex;
        grid-template-columns: none;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 4px 16px 12px;
        gap: 10px;
        scrollbar-width: none;
    }
    .dir-scroll::-webkit-scrollbar { display: none; }
    .dir-item {
        scroll-snap-align: start;
        flex: 0 0 92px;
        padding: 8px 0;
    }
    .dir-ico { width: 60px; height: 60px; font-size: 1.3rem; }
    .dir-label { font-size: .72rem; }
}

/* ══════════════ БЛОК 3: Категории (карточки на дектопе / аккордеон на моб) ═════ */
#cats {
    background: linear-gradient(180deg, #fff 0%, #eef4f9 100%);
    padding: 48px 0 56px;
    position: relative;
    overflow: hidden;
}
#cats::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 0%, rgba(255,179,71,.06), transparent 40%),
        radial-gradient(circle at 90% 100%, rgba(26,82,118,.05), transparent 50%);
    pointer-events: none;
}
#cats > .container { position: relative; }
.sec-h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #0c2233;
    margin: 0 0 20px;
    text-align: center;
}
.sec-sub {
    text-align: center;
    color: #7a9aaa;
    font-size: .9rem;
    margin: -12px 0 24px;
}
.cats-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;     /* mobile: 1 колонка */
}
.cat-exp {
    background: linear-gradient(135deg, #071824 0%, #1a3e5a 100%);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,179,71,0);
    transition: border-color .3s ease, box-shadow .3s ease, transform .25s ease;
    position: relative;
}
.cat-exp::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255,179,71,.18), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s ease;
}
.cat-exp[open]::before, .cat-exp:hover::before { opacity: 1; }
.cat-exp[open] {
    border-color: #ffb347;
    box-shadow: 0 8px 32px rgba(7,24,36,.22);
}
.cat-sum {
    list-style: none;
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    user-select: none;
    position: relative;
    z-index: 1;
}
.cat-sum::-webkit-details-marker { display: none; }
.cat-ico-big {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,179,71,.15), rgba(255,179,71,.04));
    border: 1px solid rgba(255,179,71,.32);
    color: #ffb347;
    font-size: 1.55rem;
    flex-shrink: 0;
    transition: transform .3s ease, color .3s ease;
}
.cat-exp:hover .cat-ico-big,
.cat-exp[open] .cat-ico-big {
    color: #ffd280;
    transform: scale(1.06);
}
.cat-name {
    font-size: 1.08rem;
    font-weight: 800;
    flex: 1;
    line-height: 1.2;
    min-width: 0;
}
.cat-name a {
    color: #fff;
    text-decoration: none;
}
.cat-name a:hover { color: #ffd280; text-decoration: none; }
.cat-name small {
    display: block;
    font-size: .68rem;
    color: rgba(255,255,255,.5);
    font-weight: 500;
    margin-top: 4px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.cat-count {
    color: #ffb347;
    font-size: .85rem;
    font-weight: 700;
    background: rgba(255,179,71,.12);
    padding: 4px 11px;
    border-radius: 14px;
    flex-shrink: 0;
}
.cat-chev {
    transition: transform .3s ease;
    font-size: .9rem;
    color: rgba(255,255,255,.45);
    margin-left: 2px;
}
.cat-exp[open] .cat-chev { transform: rotate(180deg); color: #ffb347; }
.cat-body {
    padding: 4px 20px 20px;
    color: #fff;
    position: relative;
    z-index: 1;
    animation: cat-open .3s ease;
}
@keyframes cat-open {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cat-sub-ttl {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.5);
    margin: 10px 0 10px;
    font-weight: 700;
}
.cat-sub-ttl-2 { margin-top: 16px; }

/* Сетка мощностей для «Моторные» — chips с переносом */
.cat-motors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cat-motor {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 10px;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.08);
    transition: background .2s ease, border-color .2s ease, transform .15s ease, color .2s ease;
}
.cat-motor small { display: block; font-size: .65rem; font-weight: 500; color: rgba(255,255,255,.55); margin-top: 2px; }
.cat-motor:hover {
    background: rgba(255,179,71,.15);
    border-color: #ffb347;
    color: #ffb347;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Подкатегории — chips с переносом */
.cat-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cat-sub {
    background: rgba(255,255,255,.05);
    color: #fff;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,.08);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.cat-sub em {
    font-style: normal;
    color: rgba(255,255,255,.45);
    font-size: .72rem;
    font-weight: 700;
}
.cat-sub:hover {
    background: rgba(255,179,71,.12);
    border-color: rgba(255,179,71,.4);
    color: #ffb347;
    text-decoration: none;
}
.cat-sub:hover em { color: rgba(255,179,71,.6); }
.cat-all {
    display: inline-block;
    margin-top: 14px;
    color: #ffb347;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}
.cat-all:hover { color: #ffd280; text-decoration: underline; }

/* Mobile (по умолчанию): аккордеон, всё свёрнуто, клик раскрывает */
@media (max-width: 767px) {
    #cats { padding: 32px 0 40px; }
    .sec-h2 { font-size: 1.3rem; }
    .sec-sub { font-size: .82rem; padding: 0 16px; }
    .cat-sum { padding: 14px 16px; gap: 12px; }
    .cat-ico-big { width: 44px; height: 44px; font-size: 1.3rem; border-radius: 12px; }
    .cat-name { font-size: .98rem; }
    .cat-name small { font-size: .62rem; margin-top: 3px; }
    .cat-body { padding: 2px 16px 18px; }
}

/* Desktop: карточная сетка, всё раскрыто принудительно (без необходимости клика) */
@media (min-width: 768px) {
    .cats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    /* Принудительно показываем содержимое <details> на десктопе — без атрибута open */
    .cat-exp > *:not(summary) { display: block !important; }
    .cat-exp { border-color: rgba(255,179,71,.18); }
    .cat-sum { cursor: default; padding: 20px 22px 14px; }
    .cat-chev { display: none; }
    .cat-exp:hover {
        border-color: #ffb347;
        box-shadow: 0 12px 36px rgba(7,24,36,.22);
        transform: translateY(-3px);
    }
}
@media (min-width: 1100px) {
    .cats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ══════════════ БЛОК 4: ТОП-50 ═════════════════════════════════════ */
#top50 {
    padding: 48px 0 40px;
    background: #fff;
}
.top50-head { text-align: center; margin-bottom: 28px; padding: 0 16px; }
.top50-foot { text-align: center; margin-top: 30px; }
.top50-all {
    display: inline-block;
    background: linear-gradient(135deg, #071824, #1a5276);
    color: #ffb347;
    padding: 14px 32px;
    border-radius: 30px;
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(7,24,36,.15);
    transition: transform .2s ease, box-shadow .2s ease;
}
.top50-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(7,24,36,.25);
    color: #ffd280;
    text-decoration: none;
}
@media (max-width: 768px) {
    #top50 { padding: 28px 0 24px; }
}

/* ══════════════ БЛОК 5: Производители (слайдер) ═══════════════════ */
#brands {
    padding: 48px 0 40px;
    background: #f5f9fc;
}
.brands-head { text-align: center; margin-bottom: 24px; }

.brands-slider {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}
.brands-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 48px) / 4);
    grid-template-rows: repeat(3, auto);
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 4px;
    scrollbar-width: none;
}
.brands-track::-webkit-scrollbar { display: none; }

.brand-card {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 14px;
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #e4eef5;
    text-decoration: none;
    color: #0c2233;
    gap: 4px;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
    min-height: 140px;
}
.brand-card:hover {
    text-decoration: none;
    border-color: #ffb347;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(7,24,36,.1);
    color: #0c2233;
}
.brand-logo {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #071824, #1a5276);
    color: #ffb347;
    font-weight: 900;
    font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.brand-name {
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
}
.brand-city {
    font-size: .7rem;
    color: #8ba1ae;
    font-weight: 500;
}
.brand-count {
    font-size: .72rem;
    color: #1b6b8f;
    font-weight: 700;
    margin-top: auto;
    padding-top: 4px;
}

.brands-arr {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 0;
    background: #fff;
    color: #0c2233;
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease, color .2s ease;
}
.brands-arr:hover { background: #0c2233; color: #ffb347; }
.brands-arr-l { left: -20px; }
.brands-arr-r { right: -20px; }

.brands-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
}
.brands-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #cfdde6;
    transition: background .2s ease, width .2s ease;
    cursor: pointer;
    border: 0;
    padding: 0;
}
.brands-dot.active { background: #0c2233; width: 22px; border-radius: 4px; }

@media (max-width: 768px) {
    #brands { padding: 28px 0 24px; }
    .brands-track {
        grid-template-rows: auto;
        grid-auto-columns: calc(50% - 8px);
    }
    .brands-arr { display: none; }
    .brand-card { min-height: 120px; padding: 14px 10px; }
    .brand-logo { width: 40px; height: 40px; font-size: 1.15rem; }
    .brand-name { font-size: .8rem; }
}

/* ══════════════ БЛОК 6-7: Новости/Блог (заглушки) ═════════════════ */
#news, #blog {
    padding: 44px 0 40px;
    background: #fff;
}
#blog { background: #f5f9fc; }
.stub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
}
.stub-card {
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #e4eef5;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.stub-img {
    height: 140px;
    background: linear-gradient(135deg, #cfe6f5, #a8d2eb);
    position: relative;
    overflow: hidden;
}
.stub-img::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    animation: stub-shimmer 2.4s ease-in-out infinite;
}
.stub-img-alt { background: linear-gradient(135deg, #e5ddfb, #c0aae6); }
@keyframes stub-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.stub-body { padding: 16px; }
.stub-tag {
    display: inline-block;
    background: #f3f9fc;
    color: #1b6b8f;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 4px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.stub-card p { color: #5a7080; font-size: .88rem; line-height: 1.45; margin: 0; }
.sec-foot { text-align: center; margin-top: 26px; }
.sec-foot a {
    color: #1b6b8f;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
}
.sec-foot a:hover { text-decoration: underline; color: #0c2233; }

@media (max-width: 768px) {
    .stub-grid { grid-template-columns: 1fr; gap: 12px; }
    .stub-img { height: 110px; }
    #news, #blog { padding: 28px 0 24px; }
    .hero-h1 {
        font-size: 3rem;
        text-align: left;
    }
    .hero-lead {
        text-align: left;
    }
}

/* Убираем нижний «пустой» отступ для блока .for-footer на главной
   (award-strip скрывается на мобиле, десктопная версия — через footer.php) */
