@layer reset, base, tokens, components;

/* ─── RESET ─────────────────────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body { min-height: 100vh; }
  img, video { max-width: 100%; height: auto; display: block; }
  input, textarea, button { font: inherit; }
  a { color: inherit; text-decoration: none; }
  ul, ol { list-style: none; }
}

/* ─── TOKENS ─────────────────────────────────────── */
@layer tokens {
  :root {
    --s1: 4px;  --s2: 8px;  --s3: 16px; --s4: 24px;
    --s5: 32px; --s6: 48px; --s7: 64px;

    --t-xs: 12px; --t-sm: 13px; --t-base: 15px; --t-md: 17px;
    --t-lg: 19px; --t-xl: 22px; --t-2xl: 28px; --t-3xl: 36px;

    --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;

    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --dur-fast: 150ms; --dur-base: 200ms;

    /* Light theme — vc.ru style */
    --bg:         #FFFFFF;
    --bg-alt:     #F7F8FA;
    --bg-hover:   #F2F3F7;
    --text:       #1A1A1A;
    --text-muted: #6B6B8A;
    --text-dim:   #9999B3;
    --border:     #DCDCE8;
    --border-h:   #B9B9CE;
    --border-strong: #C6C6D8;

    /* Elevation — карточки на белом фоне */
    --sh-card:    0 1px 2px rgba(16, 16, 48, 0.04), 0 1px 3px rgba(16, 16, 48, 0.06);
    --sh-card-h:  0 4px 16px rgba(16, 16, 48, 0.10);

    /* Accent */
    --blue:      #2563EB;
    --blue-h:    #1D4ED8;
    --blue-bg:   #EFF6FF;
    --green:     #16A34A;
    --orange:    #EA580C;
    --purple:    #7C3AED;

    /* Category colors */
    --cat-ai:      #7C3AED;
    --cat-ai-bg:   #F5F3FF;
    --cat-startup: #059669;
    --cat-startup-bg: #ECFDF5;
    --cat-product: #2563EB;
    --cat-product-bg: #EFF6FF;
    --cat-auto:    #EA580C;
    --cat-auto-bg: #FFF7ED;
    --cat-business:#DC2626;
    --cat-business-bg: #FEF2F2;

    --nav-height: 48px;
    --cats-height: 44px;
    --header-height: 60px;
    --container: 1180px;
    --sidebar-w: 300px;
    --feed-gap: 1px;
  }
}

/* ─── BASE ───────────────────────────────────────── */
@layer base {
  html { font-size: 15px; }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-alt);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
  }
  ::selection { background: #DBEAFE; }
  :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  }
}

/* ─── WP ADMIN BAR COMPENSATION ─────────────────── */
.admin-bar .header { top: 32px; }
@media (max-width: 782px) { .admin-bar .header { top: 46px; } }

/* ─── COMPONENTS ─────────────────────────────────── */
@layer components {

  .container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--s3);
  }
  @media (min-width: 1024px) { .container { padding: 0 var(--s4); } }

  /* BUTTONS */
  .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--s3);
    background: var(--blue);
    color: #fff;
    font-size: var(--t-sm);
    font-weight: 600;
    border-radius: var(--r-md);
    border: none;
    cursor: pointer;
    transition: background var(--dur-fast), transform var(--dur-fast);
    text-decoration: none;
  }
  .btn-primary:hover { background: var(--blue-h); }
  .btn-primary:active { transform: scale(0.98); }

  .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--s3);
    background: transparent;
    color: var(--blue);
    font-size: var(--t-sm);
    font-weight: 600;
    border-radius: var(--r-md);
    border: 1.5px solid var(--blue);
    cursor: pointer;
    transition: background var(--dur-fast);
    text-decoration: none;
    white-space: nowrap;
  }
  .btn-outline:hover { background: var(--blue-bg); }

  .btn-subscribe {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    background: var(--blue);
    color: #fff;
    font-size: var(--t-xs);
    font-weight: 600;
    border-radius: var(--r-md);
    border: none;
    cursor: pointer;
    transition: background var(--dur-fast);
    text-decoration: none;
    white-space: nowrap;
  }
  .btn-subscribe:hover { background: var(--blue-h); }

  /* Выбор канала в модалке консультации: два равных квадрата — решение за один тап,
     без чтения текста. */
  /* Запись в календарь — основное действие в модалке: человеку, готовому говорить,
     не нужно сначала писать сообщение и ждать ответа. Мессенджеры остаются ниже
     для тех, кто хочет сперва спросить — у календаря порог заметно выше. */
  .consult-slot {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin-top: var(--s3);
    padding: var(--s3);
    background: var(--blue);
    border-radius: var(--r-md);
    color: #fff;
    text-decoration: none;
    transition: background var(--dur-fast);
  }
  .consult-slot:hover { background: var(--blue-h); }
  .consult-slot__icon { display: flex; flex-shrink: 0; }
  .consult-slot__text { display: flex; flex-direction: column; line-height: 1.3; }
  .consult-slot__title { font-size: var(--t-sm); font-weight: 600; }
  .consult-slot__sub { font-size: var(--t-xs); opacity: 0.85; }
  .consult-slot__arrow { margin-left: auto; font-size: var(--t-base); }
  .consult-or {
    margin-top: var(--s3);
    font-size: var(--t-xs);
    color: var(--text-dim);
    text-align: center;
  }
  .consult-choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s2); }
  .consult-choice__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    aspect-ratio: 1 / 1;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    text-decoration: none;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
  }
  .consult-choice__item:hover { border-color: var(--blue); box-shadow: 0 4px 12px rgba(37,99,235,0.12); }
  .consult-choice__item:active { transform: scale(0.98); }
  .consult-choice__icon { display: flex; }
  .consult-choice__item--tg .consult-choice__icon { color: #229ED9; }
  .consult-choice__item--vk .consult-choice__icon { color: #0077FF; }
  .consult-choice__label { font-size: var(--t-sm); font-weight: 600; color: var(--text); }

  /* ═══ TICKER ══════════════════════════════════════ */
  .ticker {
    background: var(--text);
    color: #fff;
    height: 32px;
    overflow: hidden;
    position: relative;
  }
  .ticker__inner {
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
  }
  .ticker__track {
    display: flex;
    align-items: center;
    gap: var(--s4);
    white-space: nowrap;
    animation: tickerScroll 55s linear infinite;
    padding-left: 100%;
  }
  @keyframes tickerScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
  }
  .ticker:hover .ticker__track { animation-play-state: paused; }
  .ticker__item {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur-fast);
  }
  .ticker__item:hover { color: #fff; }
  .ticker__label {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(255,255,255,0.15);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    margin-right: 6px;
  }
  .ticker__sep { color: rgba(255,255,255,0.3); font-size: 14px; }

  /* ═══ HEADER ══════════════════════════════════════ */
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .header__main {
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
  }
  .header__main-inner {
    display: flex;
    align-items: center;
    gap: var(--s4);
    height: 100%;
  }
  .header__logo {
    display: flex;
    align-items: center;
    gap: var(--s2);
    text-decoration: none;
    flex-shrink: 0;
  }
  .logo-ek {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    border-radius: var(--r-md);
    letter-spacing: -0.02em;
    flex-shrink: 0;
  }
  .logo-ek--img {
    background: none;
    padding: 0;
    overflow: hidden;
  }
  .logo-ek--img img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: var(--r-md);
  }
  .logo-name {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
  }
  .logo-name__title {
    font-size: var(--t-base);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
  }
  .logo-name__sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.01em;
  }
  .header__actions {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-left: auto;
  }
  .burger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--s1);
  }
  .burger span {
    display: block;
    width: 20px; height: 2px;
    background: var(--text);
    border-radius: var(--r-pill);
    transition: transform var(--dur-base), opacity var(--dur-base);
  }
  .burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .burger.open span:nth-child(2) { opacity: 0; }
  .burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* Nav tabs */
  .header__nav-inner {
    display: flex;
    align-items: center;
    gap: var(--s1);
    height: 100%;
    margin-left: var(--s5);
  }
  .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    font-size: var(--t-sm);
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    transition: background var(--dur-fast), color var(--dur-fast);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
  }
  .nav-tab__icon { font-size: 15px; line-height: 1; flex-shrink: 0; }
  .nav-tab:hover { background: var(--bg-hover); color: var(--text); }
  .nav-tab--active { background: var(--blue-bg); color: var(--blue); font-weight: 600; }
  .nav-tab--active:hover { background: #DBEAFE; }

  /* Category buttons */
  .header__cats {
    border-top: 1px solid var(--border);
    height: 44px;
    display: flex;
    align-items: center;
  }
  .cats-scroll {
    display: flex;
    align-items: center;
    gap: var(--s2);
    overflow-x: auto;
    scrollbar-width: none;
    padding: var(--s1) 0;
  }
  .cats-scroll::-webkit-scrollbar { display: none; }
  .cats-scroll--centered { justify-content: center; }
  .cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--t-xs);
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--dur-fast);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .cat-btn:hover { border-color: var(--border-h); color: var(--text); background: var(--bg-hover); }
  .cat-btn--active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; border-radius: var(--r-md); }
  .cat-btn__icon { font-size: 13px; }

  /* ═══ DRAWER ══════════════════════════════════════ */
  .drawer { display: none; }
  .drawer__overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-base);
  }
  .drawer.open .drawer__overlay { pointer-events: auto; }
  .drawer__menu {
    position: fixed;
    top: calc(var(--header-height) + 8px); right: 12px;
    width: min(240px, 78vw);
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(15,23,42,0.18);
    padding: var(--s2) var(--s2) var(--s2);
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateY(-12px) scale(0.96);
    opacity: 0;
    transform-origin: top right;
    transition: transform 0.26s var(--ease-out), opacity 0.22s var(--ease-out);
    pointer-events: none;
    z-index: 115;
  }
  .drawer.open .drawer__overlay { opacity: 1; }
  .drawer.open .drawer__menu {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
  .drawer__close {
    position: absolute;
    top: 6px; right: 8px;
    background: none; border: none;
    color: var(--text-dim); font-size: 14px;
    cursor: pointer; padding: 4px; line-height: 1;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
  }
  .drawer__close:hover { background: var(--bg-hover); }
  .drawer__link {
    font-size: var(--t-base);
    font-weight: 500;
    color: var(--text);
    padding: 13px var(--s3);
    border-radius: 8px;
    border-bottom: 1px solid var(--border);
    transition: background var(--dur-fast), color var(--dur-fast);
  }
  .drawer__link:last-of-type { border-bottom: none; }
  .drawer__link:hover,
  .drawer__link:active { background: rgba(37,99,235,0.06); color: var(--blue); }
  .drawer__menu .btn-subscribe { margin-top: var(--s3) !important; justify-content: center; width: 100%; }

  /* ═══ LAYOUT ══════════════════════════════════════ */
  .main {
    padding-top: var(--s4);
    padding-bottom: var(--s7);
  }
  .layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-w);
    gap: var(--s5);
    align-items: start;
  }
  .feed { display: flex; flex-direction: column; gap: 0; }

  /* ═══ BLOG CATS ═════════════════════════════════ */
  .blog-cats {
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    background: var(--bg-alt);
    padding: var(--s2) 0;
    margin-bottom: var(--s1);
  }

  /* ═══ SECTION HEAD ══════════════════════════════ */
  .section-head {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: var(--t-sm);
    font-weight: 700;
    color: var(--text);
    padding: var(--s4) 0 var(--s3);
    letter-spacing: -0.01em;
    scroll-margin-top: calc(var(--header-height) + 16px);
  }
  .section-head__icon { display: flex; align-items: center; }

  /* ═══ AUTHOR HERO ════════════════════════════════ */
  .author-hero {
    display: flex;
    gap: var(--s5);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: var(--s5);
    margin-bottom: var(--s3);
    align-items: flex-start;
    box-shadow: var(--sh-card);
  }
  .author-hero__photo-wrap {
    position: relative;
    flex-shrink: 0;
  }
  .author-hero__photo {
    width: 100px; height: 100px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 3px solid var(--border);
  }
  .author-hero__online {
    position: absolute;
    bottom: 4px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--green);
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
  .online-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
  }
  .author-hero__info { flex: 1; min-width: 0; }
  .author-hero__meta {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-bottom: 4px;
  }
  .author-hero__role {
    font-size: var(--t-xs);
    font-weight: 600;
    color: var(--blue);
    background: var(--blue-bg);
    padding: 2px 8px;
    border-radius: var(--r-pill);
  }
  .author-hero__dot { color: var(--text-dim); }
  .author-hero__city { font-size: var(--t-xs); color: var(--text-muted); }
  .author-hero__name {
    font-size: var(--t-2xl);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: var(--s2);
    line-height: 1.1;
  }
  .author-hero__bio {
    font-size: var(--t-base);
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: var(--s3);
    max-width: 520px;
  }
  /* Первая строка — позиционирование, вторая — расшифровка */
  .author-hero__bio strong {
    display: inline-block;
    margin-bottom: 2px;
    font-weight: 700;
    color: var(--text);
  }
  .author-hero__stats {
    display: flex;
    gap: var(--s4);
    margin-bottom: var(--s3);
  }
  .author-stat__num {
    font-size: var(--t-lg);
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
  }
  .author-stat__label {
    font-size: var(--t-xs);
    color: var(--text-muted);
    margin-top: 1px;
  }
  .author-hero__actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

  /* ═══ POST CARD ═══════════════════════════════════ */
  .post-card {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: var(--s4) var(--s4) var(--s3);
    margin-bottom: var(--s2);
    box-shadow: var(--sh-card);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  }
  .post-card:hover {
    border-color: var(--border-h);
    box-shadow: var(--sh-card-h);
  }
  .post-card--featured {
    border-color: #DBEAFE;
    background: linear-gradient(to bottom right, #FAFCFF, var(--bg));
  }

  .post-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s3);
  }
  .post-card__author {
    display: flex;
    align-items: center;
    gap: var(--s2);
  }
  .post-card__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
  }
  .post-card__author-name {
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--text);
  }
  .post-card__author-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
  }
  .post-card__cat {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--r-pill);
  }
  .post-card__cat--ai     { color: var(--cat-ai);      background: var(--cat-ai-bg); }
  .post-card__cat--startup{ color: var(--cat-startup);  background: var(--cat-startup-bg); }
  .post-card__cat--product{ color: var(--cat-product);  background: var(--cat-product-bg); }
  .post-card__cat--auto   { color: var(--cat-auto);     background: var(--cat-auto-bg); }
  .post-card__cat--business{color: var(--cat-business); background: var(--cat-business-bg);}

  .post-card__time {
    font-size: 11px;
    color: var(--text-dim);
  }
  .post-card__badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--orange);
    background: #FFF7ED;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    flex-shrink: 0;
  }

  .post-card__body {
    display: flex;
    gap: var(--s3);
    align-items: flex-start;
    margin-bottom: var(--s3);
  }
  .post-card__text { flex: 1; min-width: 0; }
  .post-card__title {
    font-size: var(--t-lg);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: var(--s2);
    cursor: pointer;
    transition: color var(--dur-fast);
  }
  .post-card__title:hover { color: var(--blue); }
  .post-card__desc {
    font-size: var(--t-sm);
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .post-card__cover {
    width: 160px;
    height: 110px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }
  .post-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border: none;
    outline: none;
    box-shadow: none;
  }
  .post-card__cover--ai      { background: linear-gradient(135deg, #EDE9FE, #DDD6FE); }
  .post-card__cover--startup { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); }
  .post-card__cover--product { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); }
  .post-card__cover--auto    { background: linear-gradient(135deg, #FEF3C7, #FDE68A); }
  .post-card__cover--ai2     { background: linear-gradient(135deg, #E0F2FE, #BAE6FD); }
  .post-card__cover--startup2{ background: linear-gradient(135deg, #D1FAE5, #A7F3D0); }
  .post-card__cover svg { display: block; }

  .post-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--s2);
    border-top: 1px solid var(--border);
  }
  .post-card__metrics {
    display: flex;
    align-items: center;
    gap: var(--s3);
  }
  .metric-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--t-xs);
    cursor: pointer;
    padding: var(--s1) 0;
    transition: color var(--dur-fast);
  }
  .metric-btn:hover { color: var(--text); }

  .post-card__actions {
    display: flex;
    align-items: center;
    gap: var(--s2);
  }
  .share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--dur-fast);
  }
  .share-btn:hover { border-color: var(--border-h); color: var(--text); background: var(--bg-hover); }

  .read-more-link {
    font-size: var(--t-xs);
    font-weight: 600;
    color: var(--blue);
    transition: color var(--dur-fast);
    white-space: nowrap;
  }
  .read-more-link:hover { color: var(--blue-h); }

  /* Load more */
  .load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--blue);
    font-size: var(--t-sm);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--s2);
    transition: background var(--dur-fast), border-color var(--dur-fast);
  }
  .load-more:hover { background: var(--bg-hover); border-color: var(--border-h); }

  /* ═══ SIDEBAR ════════════════════════════════════ */
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    position: sticky;
    top: var(--header-height);
  }

  .widget {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: var(--s3) var(--s4);
    box-shadow: var(--sh-card);
  }
  .widget--accent {
    background: var(--blue-bg);
    border-color: #BFDBFE;
  }
  .widget__title {
    font-size: var(--t-sm);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--s2);
    letter-spacing: -0.01em;
  }
  .widget__desc {
    font-size: var(--t-xs);
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: var(--s3);
  }
  .widget__note {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: var(--s2);
    text-align: center;
  }
  .widget__form { display: flex; flex-direction: column; gap: var(--s2); }

  /* Ловушка для спам-ботов — человек её не видит и не таббится в неё */
  .subscribe-trap {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* Ответ формы подписки */
  .subscribe-msg {
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
  }
  .subscribe-msg:empty { display: none; }
  .subscribe-msg.is-ok { color: #16A34A; }
  .subscribe-msg.is-error { color: #DC2626; }
  .widget__input {
    height: 36px;
    padding: 0 var(--s3);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: var(--t-sm);
    transition: border-color var(--dur-fast);
    width: 100%;
  }
  .widget__input:focus { outline: none; border-color: var(--blue); background: #fff; }
  .widget__input::placeholder { color: var(--text-dim); }

  .widget__author {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-bottom: var(--s2);
  }
  .widget__author-photo {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    flex-shrink: 0;
  }
  .widget__author-name { font-size: var(--t-sm); font-weight: 700; color: var(--text); }
  .widget__author-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

  .widget__links { display: flex; flex-direction: column; gap: var(--s1); margin-top: var(--s2); }
  .widget__link {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: var(--t-sm);
    color: var(--text-muted);
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    transition: color var(--dur-fast);
  }
  .widget__link:last-child { border-bottom: none; }
  .widget__link:hover { color: var(--blue); }

  .widget__link--email {
    background: none;
    border: none;
    font-family: inherit;
    font-size: var(--t-sm);
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 0;
    text-align: left;
    width: 100%;
  }

  .email-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9998;
  }
  .email-popup-overlay.is-open { display: block; }

  .email-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    padding: 24px;
    width: 320px;
    text-align: left;
  }
  .email-popup.is-open { display: block; }
  .email-popup__addr {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .email-popup__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
    margin-bottom: 4px;
  }
  .email-popup__btn:last-child { margin-bottom: 0; }
  .email-popup__btn:hover { background: var(--blue-bg); color: var(--blue); }

  /* Widget link variant */
  .widget--link {
    display: block;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
  }
  .widget--link:hover { box-shadow: 0 8px 32px rgba(37,99,235,0.13); transform: translateY(-2px); }
  .widget__title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
  .widget__title-row .widget__title { margin-bottom: 0; }
  .widget__arrow { font-size: 16px; color: var(--blue); font-weight: 600; transition: transform 0.2s; }
  .widget--link:hover .widget__arrow { transform: translateX(3px); }

  /* Case mini */
  .case-mini {
    display: flex;
    align-items: flex-start;
    gap: var(--s2);
    padding: var(--s2) 0;
    border-bottom: 1px solid var(--border);
  }
  .case-mini:last-child { border-bottom: none; padding-bottom: 0; }
  .case-mini__icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
  .case-mini__title { font-size: var(--t-xs); font-weight: 600; color: var(--text); line-height: 1.3; }
  .case-mini__result { font-size: 11px; font-weight: 700; color: var(--green); margin-top: 1px; }

  /* ═══ MODAL ═══════════════════════════════════════ */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .modal-overlay.is-open { display: flex; }
  .modal {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.25);
    padding: 36px 32px 32px;
    width: 100%;
    max-width: 420px;
    position: relative;
  }
  .modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #F1F5F9;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #64748B;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
  }
  .modal__close:hover { background: #E2E8F0; color: #0F172A; }
  .modal__title { font-size: 20px; font-weight: 700; color: #0F172A; margin-bottom: 8px; }
  .modal__desc { font-size: 14px; color: #64748B; margin-bottom: 20px; line-height: 1.5; }
  .modal__form { display: flex; flex-direction: column; gap: 12px; }
  .modal__form .widget__input {
    background: #F8FAFF;
    border: 1.5px solid #E2E8F0;
    color: #0F172A;
    font-size: 15px;
  }
  .modal__form .widget__input::placeholder { color: #94A3B8; }
  .modal__note { font-size: 13px; color: #94A3B8; text-align: center; margin-top: 12px; }

  /* ═══ FOOTER ══════════════════════════════════════ */
  .footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: var(--s4) 0 var(--s4);
    margin-top: var(--s4);
  }
  .footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
    flex-wrap: wrap;
    margin-bottom: var(--s3);
  }
  .footer__left { display: flex; flex-direction: column; gap: 4px; }
  .footer__logo { display: flex; align-items: center; gap: var(--s2); }
  .footer__tagline { font-size: var(--t-xs); color: var(--text-muted); }
  .footer__links {
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
  }
  .footer__link { font-size: var(--t-sm); color: var(--text-muted); transition: color var(--dur-fast); }
  .footer__link:hover { color: var(--text); }
  /* Кнопка отзыва cookie-согласия выглядит как обычная ссылка подвала */
  .footer__link--btn { font-family: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  .footer__socials { display: flex; gap: var(--s2); }
  .footer__social {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: color var(--dur-fast), border-color var(--dur-fast);
  }
  .footer__social:hover { color: var(--blue); border-color: var(--blue); }
  .footer__social--text { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: lowercase; line-height: 1; }
  .footer__bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s2);
    padding-top: var(--s3);
    border-top: 1px solid var(--border);
    font-size: var(--t-xs);
    color: var(--text-dim);
  }

  /* ═══ VALUE / FIT / CASES ════════════════════════ */
  .value {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s5);
    margin-bottom: var(--s3);
  }
  .value__head { margin-bottom: var(--s4); }
  .value__title {
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: var(--s2);
    overflow-wrap: break-word;
  }
  .value__sub {
    font-size: var(--t-base);
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 640px;
  }
  .value__sub strong {
    display: inline-block;
    margin-bottom: 2px;
    font-weight: 700;
    color: var(--text);
  }
  .value__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: var(--s3);
  }

  /* Карточка сегмента целиком кликабельна и ведёт в кейс.
     subgrid держит выгоду и пруф на одной линии во всех колонках */
  .offer {
    position: relative;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    gap: var(--s3);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: var(--s4) var(--s3) var(--s3);
    box-shadow: var(--sh-card);
    overflow: hidden;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
  }
  /* Цветной кант — единственный носитель категории, вместо пилюли и рамок */
  .offer::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
  }
  .offer--brand::before    { background: var(--cat-ai); }
  .offer--startup::before  { background: var(--cat-startup); }
  .offer--business::before { background: var(--cat-auto); }
  .offer:hover {
    border-color: var(--border-h);
    box-shadow: var(--sh-card-h);
    transform: translateY(-3px);
  }

  .offer__seg {
    display: flex;
    align-items: center;
    gap: var(--s2);
    font-size: var(--t-sm);
    font-weight: 700;
    letter-spacing: -0.01em;
  }
  .offer--brand    .offer__seg { color: var(--cat-ai); }
  .offer--startup  .offer__seg { color: var(--cat-startup); }
  .offer--business .offer__seg { color: var(--cat-auto); }
  .offer__seg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--r-md);
    flex-shrink: 0;
  }
  .offer--brand    .offer__seg-icon { background: var(--cat-ai-bg); }
  .offer--startup  .offer__seg-icon { background: var(--cat-startup-bg); }
  .offer--business .offer__seg-icon { background: var(--cat-auto-bg); }

  /* Выгода — единственный смысловой текст карточки */
  .offer__benefit {
    font-size: var(--t-md);
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
  }

  /* Пруф: имя клиента вордмарком + стрелка */
  .offer__proof {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s1) var(--s2);
    padding-top: var(--s3);
    border-top: 1px solid var(--border);
  }
  .offer__client {
    font-size: var(--t-base);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
  }
  .offer__link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--t-xs);
    font-weight: 600;
    color: var(--blue);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .offer__arrow { transition: transform var(--dur-fast); }
  .offer:hover .offer__arrow { transform: translateX(3px); }

  .value__cta {
    display: inline-flex;
    align-items: center;
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--blue);
    margin-top: var(--s4);
    transition: color var(--dur-fast);
  }
  .value__cta:hover { color: var(--blue-h); }
}

/* ─── MOBILE ─────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar .widget--accent { order: -1; }

  .cookie-banner { left: var(--s2); right: var(--s2); bottom: var(--s2); padding: var(--s2) var(--s3); gap: 10px; }
  .cookie-banner__text { font-size: 12px; line-height: 1.45; flex-basis: 100%; }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__btn { flex: 1; min-height: 44px; padding: 9px var(--s2); font-size: 13px; }

  .value__grid { grid-template-columns: 1fr; grid-template-rows: none; gap: var(--s3); }
  .offer { grid-template-rows: none; grid-row: auto; gap: var(--s2); }
  .offer__proof { padding-top: var(--s2); }
}

@media (max-width: 640px) {
  :root { --header-height: 52px; }

  /* Жёсткая защита от горизонтального выхода за экран */
  .main, .container, .layout, .feed, .feed__list, .post-card,
  .author-hero, .section-head, .blog-cats,
  .value, .value__grid, .offer { max-width: 100%; min-width: 0; }
  .value { box-sizing: border-box; }
  .post-card { box-sizing: border-box; }
  body { overflow-x: clip; }

  .ticker { display: none; }
  .header__nav-inner { display: none; }
  .header__cats { border-top: none; }
  .header__main { border-bottom: none; }
  .btn-subscribe { display: none; }
  .burger { display: flex; }
  .drawer { display: block; }

  .author-hero { flex-direction: column; align-items: center; text-align: center; }
  .author-hero__meta { justify-content: center; }
  .author-hero__bio { max-width: 100%; }
  .author-hero__stats { justify-content: center; }
  .author-hero__actions { justify-content: center; }

  /* Первый экран на коротких телефонах: hero занимал 496px из 640,
     и ряд кнопок уходил под фиксированный cookie-баннер — тапы попадали
     в баннер, а не в кнопку. Ужимаем hero, чтобы CTA всегда был выше баннера. */
  .author-hero { padding: var(--s4) var(--s3); gap: var(--s3); }
  .author-hero__photo { width: 76px; height: 76px; }
  .author-hero__bio { margin-bottom: var(--s2); }
  .author-hero__stats { margin-bottom: var(--s2); gap: var(--s3); }

  .post-card__cover { width: 36%; height: 96px; flex-shrink: 0; max-width: 130px; }
  .post-card__title { font-size: var(--t-base); }

  .value { padding: var(--s4) var(--s3); }
  .value__cta { width: 100%; justify-content: center; min-height: 48px; }

  /* Страница блога (page-blog) — фикс выхода за рамки */
  .layout { max-width: 100% !important; }
  .blog-cats { margin-left: calc(var(--s3) * -1); margin-right: calc(var(--s3) * -1); }
  .cats-scroll { padding-left: var(--s3); padding-right: var(--s3); -webkit-overflow-scrolling: touch; }
  .cats-scroll--centered { justify-content: flex-start; }
  .cat-btn { flex-shrink: 0; }
  .post-card__title,
  .post-card__desc { overflow-wrap: break-word; word-break: break-word; }

  .footer__inner { flex-direction: column; align-items: flex-start; gap: var(--s3); }
  .footer__bottom { flex-direction: column; }

  /* Тач-таргеты: до этого бургер был 22px, кнопки — 36px.
     Палец промахивается, и Google отмечает это в mobile usability. */
  .burger { width: 44px; height: 44px; align-items: center; justify-content: center; margin-right: -8px; }
  .drawer__close { width: 44px; height: 44px; }
  .btn-primary,
  .btn-outline,
  .btn-subscribe { min-height: 48px; }
  .share-btn { min-height: 40px; min-width: 40px; }
  .read-more-link,
  .widget__link { min-height: 40px; display: inline-flex; align-items: center; }
  .drawer__link { min-height: 48px; display: flex; align-items: center; }
  .cat-btn { min-height: 40px; }
  .footer__link { min-height: 40px; display: inline-flex; align-items: center; }
  .footer__social { min-width: 40px; min-height: 40px; }
  .header__logo { min-height: 44px; }

  /* Тело статьи: 15px мелковато для чтения с телефона */
  .post-body { font-size: 16px; }
  .post-body p { font-size: 16px; }

  .related__grid { grid-template-columns: 1fr; }
}

/* ─── СОГЛАСИЕ НА ОБРАБОТКУ ПДн ──────────────────── */
@layer components {
  /* ═══ COOKIE BANNER ══════════════════════════════ */
  .cookie-banner {
    position: fixed;
    left: var(--s3); right: var(--s3); bottom: var(--s3);
    z-index: 200;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 32px rgba(16, 16, 48, 0.16);
    padding: var(--s3);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  .cookie-banner.is-visible { opacity: 1; transform: none; }
  .cookie-banner__text {
    flex: 1 1 240px;
    font-size: var(--t-sm);
    line-height: 1.5;
    color: var(--text-muted);
  }
  .cookie-banner__text a { color: var(--blue); text-decoration: underline; }
  .cookie-banner__actions {
    display: flex;
    align-items: center;
    gap: var(--s2);
    flex-shrink: 0;
  }
  .cookie-banner__btn {
    font-family: inherit;
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 9px var(--s3);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
  }
  .cookie-banner__btn:hover { border-color: var(--border-h); color: var(--text); }
  .cookie-banner__btn--accept {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
  }
  .cookie-banner__btn--accept:hover { background: var(--blue-h); border-color: var(--blue-h); color: #fff; }

  .consent { display: flex; align-items: flex-start; gap: 8px; margin: var(--s2) 0; cursor: pointer; }
  .consent__box { width: 16px; height: 16px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--blue); cursor: pointer; }
  .consent__text { font-size: 12px; line-height: 1.45; color: var(--text-dim); }
  .consent__text a { color: var(--text-muted); text-decoration: underline; }
  .consent__text a:hover { color: var(--blue); }

  /* ─── ЗАГОЛОВОК АРХИВА ─────────────────────────── */
  .blog-head { margin-bottom: var(--s4); }
  .blog-head__title { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--text); margin-bottom: var(--s2); overflow-wrap: break-word; }
  .blog-head__sub { font-size: var(--t-sm); color: var(--text-muted); line-height: 1.6; max-width: 620px; }

  /* ─── СВЯЗАННЫЕ СТАТЬИ ─────────────────────────── */
  .related { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border); }
  .related__title { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin-bottom: var(--s3); }
  .related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
  .related__item { display: flex; flex-direction: column; gap: 8px; padding: var(--s3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
  .related__item:hover { border-color: var(--border-h); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
  .related__item-title { font-size: var(--t-sm); font-weight: 600; color: var(--text); line-height: 1.4; }

  /* ─── ПАГИНАЦИЯ ────────────────────────────────── */
  .pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: var(--s5); }
  .pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; font-size: var(--t-sm); font-weight: 600; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--dur-fast), color var(--dur-fast); }
  .pagination .page-numbers:hover { border-color: var(--border-h); color: var(--text); }
  .pagination .page-numbers.current { background: var(--blue); border-color: var(--blue); color: #fff; }
}
