/* artificial.kz — Новости (главная /{l}/): материалы ИИ-редакции. Поверх base.css и pub.css.
   Движение: появление карточек при прокрутке (news.js), бегущая строка, переход «карточка ↔ страница поста» (pub.css + head.js).
   prefers-reduced-motion — всё выключено. */

/* ---------- шапка раздела ---------- */
.nw-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; }
.nw-h h1 { font-size: clamp(48px, 6.6vw, 104px); margin-bottom: 0; }
/* ---------- бегущая строка свежих заголовков (декор: aria-hidden, ссылки вне Tab) ---------- */
.tk { position: relative; margin: clamp(28px, calc(4vh / var(--z, 1)), 44px) calc(-1 * var(--pad)) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; contain: paint; clip-path: inset(0); -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--pad), #000 calc(100% - var(--pad)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--pad), #000 calc(100% - var(--pad)), transparent); }
.tk-r { display: flex; width: max-content; animation: nw-tk var(--tk-d, 90s) linear infinite; }
.tk-s { display: flex; flex: none; }
.tk a { display: inline-flex; align-items: baseline; gap: 12px; padding: 13px 0; margin-right: 44px; font-size: 14px; color: var(--soft); white-space: nowrap; transition: color .2s; position: relative; }
.tk a::after { content: ""; position: absolute; right: -24px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: var(--dim); }
@media (hover: hover) { .tk:hover .tk-r { animation-play-state: paused; } .tk a:hover { color: var(--fg); } }
@keyframes nw-tk { to { transform: translateX(-50%); } }

/* ---------- «Главное»: крупный кадр + три второстепенных ---------- */
.top { margin-top: clamp(36px, calc(6vh / var(--z, 1)), 64px); }
.top > .idx, .lst > .idx { margin-bottom: 20px; }
.top-g { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: clamp(20px, 2.4vw, 40px); align-items: stretch; }
.top-s { display: grid; grid-template-rows: repeat(3, 1fr); border-bottom: 1px solid var(--line); }

/* ---------- карточка ---------- */
.nc { display: flex; flex-direction: column; gap: 16px; min-width: 0; color: var(--fg); position: relative; border-radius: 14px; }
.nc:focus-visible { outline-offset: 6px; }
.nc-i { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: var(--card); isolation: isolate; }
.nc-i img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.001); transition: transform 1.4s cubic-bezier(.2, .7, .1, 1), filter .6s; }
.nc-i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); pointer-events: none; }
.nc-b { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.nc-m { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--mid); }
.nc-tp { color: var(--soft); min-width: 0; }
.nc-tp::before { content: "/ "; color: var(--mid); }
.nc-m time { white-space: nowrap; flex: none; }
.nc-h { font-size: clamp(19px, 1.45vw, 23px); font-weight: 400; line-height: 1.24; letter-spacing: -.01em; text-wrap: pretty; overflow-wrap: anywhere; }
/* подчёркивание заголовка «прорисовывается» слева направо */
.nc-h span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .55s cubic-bezier(.2, .7, .1, 1);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; padding-bottom: 2px; }
/* текст новости не обрезается: заголовок и пересказ целиком, карточки выровнены по верху, высота — какая получится */
.nc-s { font-size: 15px; line-height: 1.5; color: var(--mid); text-wrap: pretty; }
.nc-src { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--mid); }
@media (hover: hover) {
  .nc:hover .nc-i img { transform: scale(1.06); }
  .nc:hover .nc-h span, .nc:focus-visible .nc-h span { background-size: 100% 1px; }
}
.nc:focus-visible .nc-h span { background-size: 100% 1px; }

/* без картинки — типографская карточка: крупный заголовок на поле из точек, без пустого серого прямоугольника */
.nc-t.nc-card { padding: 24px; min-height: 100%; justify-content: flex-start; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; transition: border-color .3s, background-color .3s; }
.nc-t.nc-card::before { content: ""; position: absolute; right: -1px; top: -1px; width: 60%; height: 70%; pointer-events: none;
  background: radial-gradient(circle, var(--edge) 1.3px, transparent 1.8px) 0 0 / 14px 14px;
  -webkit-mask-image: radial-gradient(ellipse at 100% 0, #000, transparent 70%); mask-image: radial-gradient(ellipse at 100% 0, #000, transparent 70%);
  transition: opacity .4s; opacity: .9; }
.nc-t.nc-card .nc-b { position: relative; flex: 1; gap: 14px; }
.nc-t.nc-card .nc-h { font-size: clamp(22px, 1.9vw, 30px); font-weight: 300; line-height: 1.14; letter-spacing: -.02em; margin-top: 28px; }
.nc-t.nc-card .nc-src { margin-top: auto; padding-top: 12px; }
@media (hover: hover) { .nc-t.nc-card:hover { border-color: var(--dim); background: var(--raised); } }

/* главная новость: кадр на всю карточку, заголовок поверх градиента */
.nc-lead { justify-content: flex-end; min-height: clamp(440px, calc(66vh / var(--z, 1)), 700px); border-radius: 22px; overflow: hidden; isolation: isolate;
  background: var(--card); gap: 0; }
.nc-lead .nc-i { position: absolute; inset: 0; z-index: -1; aspect-ratio: auto; border-radius: 0; }
.nc-lead .nc-i::after { border-radius: 22px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  background: linear-gradient(180deg, rgba(14, 14, 14, .35) 0, rgba(14, 14, 14, 0) 20%, rgba(14, 14, 14, .3) 38%, rgba(14, 14, 14, .84) 60%, rgba(14, 14, 14, .97) 100%); }
.nc-lead .nc-m, .nc-lead .nc-h, .nc-lead .nc-s { text-shadow: 0 1px 2px rgba(14, 14, 14, .55), 0 1px 24px rgba(14, 14, 14, .6); }
.nc-lead .nc-b { position: relative; padding: clamp(20px, 3vw, 44px); gap: 16px; max-width: 1040px; }
/* подложка под текстом: растёт вместе с заголовком — на светлых кадрах и длинных заголовках текст не тонет в точках */
.nc-lead:not(.nc-t) .nc-b::before { content: ""; position: absolute; z-index: -1; left: 0; right: -100vw; bottom: 0; top: -96px; pointer-events: none;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0) 0, rgba(14, 14, 14, .72) 96px, rgba(14, 14, 14, .86) 100%); }
.nc-lead .nc-m { align-self: flex-start; justify-content: flex-start; gap: 16px; color: var(--soft); padding: 7px 12px; border-radius: 12px;
  background: rgba(14, 14, 14, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.nc-lead .nc-tp { color: var(--fg); }
.nc-lead .nc-h { font-size: clamp(30px, 3.7vw, 60px); font-weight: 300; line-height: 1.04; letter-spacing: -.03em; text-wrap: balance; }
.nc-lead .nc-h span { background-image: linear-gradient(var(--fg), var(--fg)); }
.nc-lead .nc-s { font-size: clamp(16px, 1.2vw, 18px); color: var(--soft); max-width: 760px; }
.nc-lead .nc-src { color: var(--soft); }
.nc-lead.nc-t { background: radial-gradient(circle, var(--edge) 1.4px, transparent 2px) 0 0 / 16px 16px, var(--card); border: 1px solid var(--line); }
.nc-lead.nc-t .nc-h { font-size: clamp(34px, 4.4vw, 72px); }
@media (hover: hover) { .nc-lead:hover .nc-i img { transform: scale(1.035); } }

/* второстепенные: строка «текст + миниатюра» */
.nc-side { display: grid; grid-template-columns: minmax(0, 1fr) clamp(96px, 9vw, 148px); gap: 20px; align-items: start; padding: 22px 0; border-top: 1px solid var(--line); border-radius: 0; }
.nc-side .nc-i { grid-column: 2; grid-row: 1; aspect-ratio: 4 / 3; border-radius: 10px; }
.nc-side .nc-b { grid-column: 1; grid-row: 1; gap: 8px; }
.nc-side .nc-m { justify-content: flex-start; gap: 16px; }
.nc-side .nc-h { font-size: clamp(17px, 1.3vw, 20px); line-height: 1.26; }
.nc-side.nc-t { grid-template-columns: minmax(0, 1fr); }
.top-s .nc-side:first-child { border-top: 0; padding-top: 0; }
@media (hover: hover) { .nc-side:hover .nc-i img { transform: scale(1.08); } }

/* ---------- лента ---------- */
.lst { margin-top: clamp(56px, calc(9vh / var(--z, 1)), 104px); }
/* чипы фильтра — липкая полоса под шапкой; на телефоне одна строка с прокруткой вбок */
.nf { position: sticky; top: calc(60px + var(--sat)); z-index: 5; margin: 0 calc(-1 * var(--pad)) 28px; padding: 12px var(--pad);
  background: linear-gradient(var(--bg) 70%, rgba(14, 14, 14, 0)); }
.nf-r { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nf .pill { text-decoration: none; }
.nf .pill[aria-current="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.nf-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--dim); flex: none; }

.ng { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 4vw, 56px) clamp(20px, 2vw, 32px); align-items: start; }

/* появление при прокрутке: карточка ниже экрана ждёт (news.js ставит .rv), потом .in — с лёгкой лесенкой */
.nc.rv { opacity: 0; transform: translateY(28px); }
.nc.rv.in { opacity: 1; transform: none; transition: opacity .7s cubic-bezier(.2, .7, .1, 1) var(--d, 0s), transform .9s cubic-bezier(.2, .7, .1, 1) var(--d, 0s); }

/* первый кадр страницы: шапка, строка и «Главное» проявляются по очереди */
@media (prefers-reduced-motion: no-preference) {
  .nw-h, .tk, .top-g > .nc-lead, .top-s > .nc { animation: nw-up .8s cubic-bezier(.2, .7, .1, 1) both; }
  .tk { animation-delay: .08s; }
  .top-g > .nc-lead { animation-delay: .12s; }
  .top-s > .nc:nth-child(1) { animation-delay: .2s; } .top-s > .nc:nth-child(2) { animation-delay: .26s; } .top-s > .nc:nth-child(3) { animation-delay: .32s; }
}
@keyframes nw-up { from { opacity: 0; transform: translateY(18px); } }
/* пришли сюда переходом с другой страницы (news.js ставит html.vt-nav): страница уже въезжает — без второго появления */
html.vt-nav .nw-h, html.vt-nav .tk, html.vt-nav .top-g > .nc-lead, html.vt-nav .top-s > .nc { animation: none; }

/* пусто */
.nw-empty { display: grid; justify-items: start; gap: 24px; padding: clamp(64px, calc(14vh / var(--z, 1)), 160px) 0; color: var(--mid); }
.nw-dots { display: flex; gap: 10px; }
.nw-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); animation: nw-dot 1.6s ease-in-out infinite; }
.nw-dots i:nth-child(2) { animation-delay: .12s; } .nw-dots i:nth-child(3) { animation-delay: .24s; } .nw-dots i:nth-child(4) { animation-delay: .36s; } .nw-dots i:nth-child(5) { animation-delay: .48s; }
@keyframes nw-dot { 50% { background: var(--soft); transform: translateY(-4px); } }

/* ---------- ширины ---------- */
@media (max-width: 1100px) {
  .top-g { grid-template-columns: minmax(0, 1fr); }
  .top-s { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; gap: 24px; border-bottom: 0; }
  .top-s .nc-side { grid-template-columns: minmax(0, 1fr); padding: 0; border-top: 0; gap: 14px; }
  .top-s .nc-side .nc-i { grid-column: 1; grid-row: 1; aspect-ratio: 16 / 9; }
  .top-s .nc-side .nc-b { grid-row: 2; }
  .top-s .nc-side.nc-t .nc-b { grid-row: 1; padding-top: 18px; border-top: 1px solid var(--line); }
  .ng { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .top-s { grid-template-columns: minmax(0, 1fr); gap: 0; border-bottom: 1px solid var(--line); }
  .top-s .nc-side { grid-template-columns: minmax(0, 1fr) 104px; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
  .top-s .nc-side:first-child { padding-top: 18px; }
  .top-s .nc-side .nc-i { grid-column: 2; grid-row: 1; aspect-ratio: 4 / 3; }
  .top-s .nc-side .nc-b { grid-column: 1; grid-row: 1; }
  .top-s .nc-side.nc-t .nc-b { padding-top: 0; border-top: 0; }
  .top-g { gap: 8px; }
}
@media (max-width: 640px) {
  .nw-h { align-items: flex-start; flex-direction: column; gap: 12px; }
  .tk a { font-size: 13px; padding: 11px 0; }
  .nc-lead { min-height: min(520px, calc(78svh / var(--z, 1))); border-radius: 18px; }
  .nc-lead .nc-i::after { border-radius: 18px; }
  .nc-lead .nc-b { padding: 20px; gap: 12px; }
  .nc-lead .nc-h { font-size: clamp(27px, 7.6vw, 36px); }
  .nf { padding-top: 10px; padding-bottom: 10px; margin-bottom: 20px; }
  .nf-r { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent); }
  .nf-r::-webkit-scrollbar { display: none; }
  .nf .pill { flex: none; }
  .ng { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .nc-t.nc-card { padding: 20px; }
  .nc-t.nc-card .nc-h { margin-top: 20px; }
}
@media (pointer: coarse) { .nf .pill { min-height: 40px; } }

@media (prefers-reduced-motion: reduce) {
  .tk-r, .nw-dots i { animation: none; }
  .tk { overflow-x: auto; scrollbar-width: none; }
  .nc.rv { opacity: 1; transform: none; }
  .nc-i img, .nc-h span { transition: none; }
}

/* автор под заголовком: мини-портрет, имя, метка «ИИ» */
.nc-src { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: inherit; font-size: 13px; letter-spacing: 0; color: var(--soft); }
.nc-src .by-who { color: var(--soft); }
.nc-lead .nc-src, .nc-lead .nc-src .by-who { color: var(--fg); }
.nc-side .nc-src { font-size: 12px; }
.nc-m > span:empty { display: none; }

/* главная карточка с точечной обложкой (1200×630): кадр сверху в своих пропорциях, слово темы не прячется под текстом;
   ниже кадр плавно уходит в фон карточки */
.nc-lead:not(.nc-t) .nc-i { bottom: auto; aspect-ratio: 1200 / 630; }
.nc-lead:not(.nc-t) .nc-i::after { border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0) 0, rgba(14, 14, 14, 0) 55%, rgba(14, 14, 14, .75) 85%, var(--card) 100%); }
.nc-lead:not(.nc-t) .nc-b::before { top: -48px; }
@media (max-width: 640px) { .nc-lead:not(.nc-t) .nc-i::after { border-radius: 18px 18px 0 0; } .nc-lead { min-height: 0; padding-top: calc(52.5% + 8px); } }
/* телефон: кадр стоит над текстом, текст — на ровном фоне карточки: без тёмной подложки, теней и плашки у темы; рамка — по всей
   карточке. На широких экранах текст заходит на низ кадра — там подложка нужна */
@media (max-width: 640px) {
  .nc-lead:not(.nc-t) .nc-m, .nc-lead:not(.nc-t) .nc-h, .nc-lead:not(.nc-t) .nc-s { text-shadow: none; }
  .nc-lead:not(.nc-t) .nc-m { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding-left: 0; }
  .nc-lead:not(.nc-t) .nc-b::before { display: none; }
  .nc-lead:not(.nc-t) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
}
