/**
 * NC Clinic — Archive: Статьи
 * Стили взяты из эталонного макета Макты/articles.html
 * Подключается из inc/enqueue.php (handle: nc-design-archive-article)
 * Зависит от tokens.css (--primary, --text, --bg, --border и т.д.)
 */

/* ───── Hero ───── */
.articles-hero {
    padding: 56px 0 36px;
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--purple-soft) 50%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}
.articles-hero__eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; background: rgba(255,255,255,0.7);
    border: 1px solid var(--primary-border);
    color: var(--primary); border-radius: 999px;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    margin-bottom: 16px;
}
.articles-hero h1 { font-size: clamp(32px, 4.5vw, 48px); margin-bottom: 12px; letter-spacing: -0.025em; }
.articles-hero p { font-size: 17px; color: var(--text-body); max-width: 64ch; line-height: 1.6; }

/* ───── 2-column shell ───── */
.articles-shell {
    padding: 40px 0 80px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: start;
}
.articles-shell .col-aside {
    position: sticky; top: 100px;
    display: flex; flex-direction: column; gap: 20px;
    align-self: start;
}

@media (max-width: 960px) {
    /* minmax(0,1fr), НЕ 1fr: голый 1fr = minmax(auto,1fr) — трек тянется до
       min-content самого широкого потомка (.lead-card ~356px) и вылезает за
       .articles-shell (312px на 360) → правый жёлоб съезжает в минус. */
    .articles-shell { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .articles-shell .col-aside { position: static; }
}

/* ───── Main column head ───── */
.articles-main__head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.articles-main__head h2 { font-size: 22px; }
.articles-main__count { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.articles-main__sort {
    display: inline-flex; gap: 4px; align-items: center;
    font-size: 13px; color: var(--text-muted);
}
.articles-main__sort select {
    border: 1px solid var(--border); background: var(--surface);
    padding: 6px 30px 6px 10px; border-radius: var(--r-xs);
    font: inherit; font-size: 13px; color: var(--text);
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: right 8px center;
}

/* ───── Lead (hero) article — first item in feed ───── */
.lead-card {
    display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-bottom: 28px;
    transition: box-shadow .2s, border-color .2s, transform .2s;
}
.lead-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); transform: translateY(-2px); }
.lead-card__thumb { position: relative; min-height: 248px; }
.lead-card__thumb .thumb-ph { position: absolute; inset: 0; }
.lead-card__thumb .nc-badge { position: absolute; top: 14px; left: 14px; }
.lead-card__lead-flag {
    position: absolute; top: 14px; right: 14px;
    background: var(--text); color: #fff;
    padding: 5px 12px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 6px;
}
.lead-card__body { padding: 28px 28px 24px; display: flex; flex-direction: column; }
.lead-card__meta {
    display: flex; gap: 10px; align-items: center;
    font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.lead-card h2 { font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 12px; text-wrap: pretty; }
.lead-card__excerpt { color: var(--text-body); font-size: 14px; line-height: 1.65; margin-bottom: 18px; }
.lead-card__author {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-muted);
    margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
}
.lead-card__author .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
}
.lead-card__author b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
    .lead-card { grid-template-columns: 1fr; }
    .lead-card__thumb { min-height: 200px; aspect-ratio: 16/9; }
}

/* ───── Top picks (compact list) ───── */
.top-picks {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 18px 20px;
    margin-bottom: 28px;
}
.top-picks__title {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.top-picks__title::before {
    content: ""; width: 16px; height: 1.5px; background: var(--text-muted);
}
.top-picks ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.top-picks li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.top-picks li:last-child, .top-picks li:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.top-picks li .num {
    flex-shrink: 0;
    font-size: 18px; font-weight: 800; color: var(--text-faint);
    line-height: 1; letter-spacing: -0.02em; min-width: 22px;
    font-feature-settings: "tnum";
}
.top-picks li a {
    font-size: 13px; line-height: 1.4; color: var(--text); font-weight: 600;
}
.top-picks li a:hover { color: var(--primary); }
@media (max-width: 640px) { .top-picks ul { grid-template-columns: 1fr; } }

/* ───── Article rows (rest of feed) ───── */
.feed { display: flex; flex-direction: column; }
.feed-item {
    display: grid; grid-template-columns: 220px 1fr;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.feed-item:first-child { padding-top: 0; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--bg-alt); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-radius: var(--r-sm); border-bottom-color: transparent; }
.feed-item:hover + .feed-item { border-top: 1px solid transparent; }
.feed-item__thumb {
    position: relative; aspect-ratio: 4/3;
    border-radius: var(--r-sm); overflow: hidden;
    border: 1px solid var(--border);
}
.feed-item__thumb .thumb-ph { width: 100%; height: 100%; }
.feed-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-item__thumb .nc-badge { position: absolute; top: 10px; left: 10px; font-size: 11px; padding: 3px 8px; }
.feed-item__body { display: flex; flex-direction: column; min-width: 0; }
.feed-item__meta {
    display: flex; gap: 10px; align-items: center;
    font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}
.feed-item h3 {
    font-size: 19px; line-height: 1.3; letter-spacing: -0.015em;
    margin-bottom: 8px; text-wrap: pretty; color: var(--text);
}
.feed-item:hover h3 { color: var(--primary); }
.feed-item__excerpt { color: var(--text-body); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.feed-item__foot {
    display: flex; align-items: center; gap: 10px;
    margin-top: auto; font-size: 12px; color: var(--text-muted);
}
.feed-item__foot .avatar {
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 10px; font-weight: 700;
}
.feed-item__foot b { color: var(--text); font-weight: 600; }
@media (max-width: 600px) {
    .feed-item { grid-template-columns: 1fr; gap: 12px; }
    .feed-item__thumb { aspect-ratio: 16/9; max-height: 200px; }
}

/* ───── Pagination ───── */
.articles-pagination {
    display: flex; justify-content: center; gap: 4px; margin-top: 36px;
    flex-wrap: wrap;
}
.articles-pagination .page-numbers {
    min-width: 40px; height: 40px;
    display: inline-grid; place-items: center;
    font-size: 14px; font-weight: 600; color: var(--text-body);
    border-radius: var(--r-xs); padding: 0 12px;
    transition: background .15s;
    border: 0; background: transparent; cursor: pointer;
}
.articles-pagination .page-numbers:hover { background: var(--bg-alt); }
.articles-pagination .page-numbers.current { background: var(--primary); color: #fff; }
.articles-pagination .page-numbers.dots { color: var(--text-faint); cursor: default; }
.articles-pagination .page-numbers.disabled { opacity: 0.4; pointer-events: none; }

/* ───── Sidebar widgets ───── */
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px;
}
.widget--accent {
    background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
    border-color: var(--primary-border);
}
.widget__title {
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.widget__title svg { color: var(--primary); }

/* Sidebar — search */
.widget-search {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 6px 4px 16px;
    display: flex; align-items: center; gap: 8px;
}
.widget-search svg { color: var(--text-muted); flex-shrink: 0; }
.widget-search input {
    flex: 1; min-width: 0; height: 40px; border: 0; background: transparent;
    font: inherit; outline: none; color: var(--text); font-size: 13px;
}
.widget-search input::placeholder { color: var(--text-faint); }

/* Sidebar — topics */
.topics-list { display: flex; flex-direction: column; gap: 2px; margin: -6px -8px -6px -8px; }
.topics-list a {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 12px;
    font-size: 13.5px; color: var(--text-body);
    border-radius: var(--r-xs);
    transition: background .15s, color .15s;
}
.topics-list a:hover { background: var(--bg-alt); color: var(--primary); }
.topics-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.topics-list a .count { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.topics-list a.active .count { color: var(--primary); }

/* Sidebar — popular */
.popular-list { display: flex; flex-direction: column; gap: 14px; }
.popular-list a {
    display: flex; gap: 12px; align-items: flex-start;
    padding-bottom: 14px; border-bottom: 1px dashed var(--border);
}
.popular-list a:last-child { padding-bottom: 0; border-bottom: 0; }
.popular-list .num {
    flex-shrink: 0; width: 24px;
    font-size: 18px; font-weight: 800;
    color: var(--text-faint); line-height: 1; letter-spacing: -0.02em;
    font-feature-settings: "tnum";
}
.popular-list .body { min-width: 0; }
.popular-list h4 {
    font-size: 13px; line-height: 1.35; font-weight: 600;
    color: var(--text); margin-bottom: 4px; text-wrap: pretty;
}
.popular-list a:hover h4 { color: var(--primary); }
.popular-list .meta { font-size: 11px; color: var(--text-muted); }

/* Sidebar — author chips */
.authors-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.authors-grid a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color .15s, background .15s;
}
.authors-grid a:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.authors-grid .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.authors-grid .avatar img { width: 100%; height: 100%; object-fit: cover; }
.authors-grid .name {
    font-size: 12px; font-weight: 600; color: var(--text);
    line-height: 1.2;
}
.authors-grid .role { font-size: 10.5px; color: var(--text-muted); }

/* Sidebar — newsletter */
.widget-newsletter h3 { font-size: 17px; margin-bottom: 6px; letter-spacing: -0.015em; }
.widget-newsletter p { font-size: 13px; color: var(--text-body); line-height: 1.55; margin-bottom: 14px; }
.widget-newsletter form { display: flex; flex-direction: column; gap: 8px; }
.widget-newsletter input {
    height: 42px; padding: 0 14px;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--r-sm); font: inherit; font-size: 13px;
}
.widget-newsletter input:focus { outline: none; border-color: var(--primary); }
.widget-newsletter .small {
    font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4;
}

/* Thumb placeholder (статьи без фото) — база, как в archive-doctor.css (принятая
   архитектура дублирования базы между per-page бандлами). */
.thumb-ph {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
  position: relative;
}
.thumb-ph--green  { background: linear-gradient(135deg, var(--green-soft), var(--primary-soft)); }
.thumb-ph--amber  { background: linear-gradient(135deg, var(--amber-soft), var(--rose-soft)); }
.thumb-ph--sky    { background: linear-gradient(135deg, var(--sky-soft), var(--primary-soft)); }
.thumb-ph--teal   { background: linear-gradient(135deg, var(--teal-soft), var(--green-soft)); }
.thumb-ph--purple { background: linear-gradient(135deg, var(--purple-soft), var(--primary-soft)); }
.thumb-ph::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.6) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.4) 0%, transparent 50%);
}
