/* SpaGalaxy — главная страница блога (список статей). Работает поверх article.css:
   токены, кнопки, пузырьки, волна и появление при скролле берутся оттуда, здесь только блоки списка (sgb-*).
   Корень страницы: <main class="sga sgb">. Карточки и полки рисует engine/blog.js. */

.sgb .sga-btn { padding-block: 12px; line-height: 1.3; text-align: center; } /* длинная надпись на телефоне переносится в две строки */
.sgb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sgb-tag { font-size: 11px; font-weight: 700; line-height: 1.3; letter-spacing: .2em; text-transform: uppercase; color: var(--aqua-ink); }
.sgb-meta { font-size: 13px; line-height: 1.4; color: var(--muted); }

/* ---------- первый экран: ночная вода, слово-контур, главная статья ---------- */
.sgb-hero { position: relative; overflow: hidden; padding: clamp(48px, 7vw, 96px) 0 clamp(104px, 13vw, 180px); background: radial-gradient(120% 90% at 50% 0%, #17222e 0%, var(--night) 62%); color: #fff; }
.sgb-hero__in { position: relative; z-index: 2; }
.sgb-hero__word { position: absolute; z-index: 1; right: -1.5vw; top: .08em; font-size: clamp(140px, 31vw, 470px); font-weight: 800; line-height: .84; letter-spacing: -.04em; text-transform: uppercase; color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .12); pointer-events: none; user-select: none; }
.sgb-hero__top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: clamp(18px, 4vw, 64px); align-items: end; }
.sgb-hero h1 { margin-top: 22px; font-size: clamp(34px, 5.4vw, 72px); line-height: 1.04; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.sgb-hero h1 em { display: block; margin-top: .18em; font-style: normal; font-weight: 300; font-size: .62em; line-height: 1.2; letter-spacing: 0; color: var(--aqua); }
.sgb-hero__sub { padding-left: 18px; border-left: 2px solid var(--aqua); font-size: clamp(16px, 1.35vw, 18px); line-height: 1.6; color: #b8c0cb; }

.sgb-lead { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 60px); margin-top: clamp(30px, 4.5vw, 60px); }
.sgb-lead > :first-child { display: flex; } /* главная статья тянется на высоту списка справа */
.sgb-feat { position: relative; overflow: hidden; flex: 1; display: flex; align-items: flex-end; min-height: clamp(380px, 37vw, 500px); background: var(--night-2); box-shadow: 14px 14px 0 rgba(54, 194, 207, .3); transform: perspective(1400px) rotateX(calc(var(--rx, 0deg) * .35)) rotateY(calc(var(--ry, 0deg) * .35)); transition: transform .3s ease-out, box-shadow .5s var(--ease); }
.sgb-feat:hover, .sgb-feat:focus-within { box-shadow: 20px 20px 0 rgba(54, 194, 207, .5); }
.sgb-feat > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.6s var(--ease); }
.sgb-feat:hover > img { transform: scale(1.06); }
.sgb-feat::before { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(to top, rgba(12, 15, 20, .96) 0%, rgba(12, 15, 20, .74) 38%, rgba(12, 15, 20, .08) 76%); }
.sgb-feat::after { content: ""; position: absolute; z-index: 1; inset: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(54, 194, 207, .2), transparent 70%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.sgb-feat:hover::after { opacity: 1; }
.sgb-feat__body { position: relative; z-index: 3; display: grid; gap: 14px; justify-items: start; padding: clamp(20px, 3vw, 40px); }
.sgb-feat .sgb-tag { padding: 7px 12px; background: rgba(12, 15, 20, .74); color: var(--aqua); }
.sgb-feat h2 { max-width: 20ch; font-size: clamp(24px, 3vw, 40px); line-height: 1.12; font-weight: 700; letter-spacing: -.015em; color: #fff; text-wrap: balance; }
.sgb-feat h2 a { text-decoration: none; }
.sgb-feat h2 a:focus-visible { outline: none; }
.sgb-feat__link { position: absolute; z-index: 4; inset: 0; } /* вся обложка кликается мышью; для клавиатуры и чтения с экрана — ссылка в заголовке */
.sgb-feat:focus-within { outline: 2px solid var(--aqua); outline-offset: 4px; }
.sgb-by { display: flex; align-items: center; gap: 14px; font-size: 14px; line-height: 1.4; color: #b8c0cb; }
.sgb-by b { display: block; font-size: 15px; font-weight: 700; color: #fff; }
.sgb-by .sga-ava { width: 46px; height: 46px; }
.sgb-feat .sga-btn { margin-top: 4px; pointer-events: none; }

.sgb-fresh { display: flex; flex-direction: column; }
.sgb-fresh > h2 { font-size: 12px; line-height: 1.5; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--aqua); }
.sgb-fresh ol { flex: 1; display: grid; margin-top: 14px; }
.sgb-fresh li { position: relative; display: grid; gap: 8px; align-content: center; padding: 18px 34px 18px 0; border-top: 1px solid rgba(255, 255, 255, .16); }
.sgb-fresh li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .16); }
.sgb-fresh .sgb-tag { color: #8fdce4; }
.sgb-fresh a { justify-self: start; text-decoration: none; font-size: clamp(16px, 1.45vw, 19px); line-height: 1.32; font-weight: 600; color: #fff; background: linear-gradient(var(--aqua), var(--aqua)) 0 100% / 0 2px no-repeat; transition: background-size .5s var(--ease); }
.sgb-fresh a::after { content: ""; position: absolute; inset: 0; }
.sgb-fresh li:hover a, .sgb-fresh a:focus-visible { background-size: 100% 2px; outline: none; }
.sgb-fresh .sgb-meta { color: #8f99a6; }
.sgb-fresh li::after { content: "→"; position: absolute; pointer-events: none; right: 0; top: 50%; translate: -10px -50%; font-size: 20px; color: var(--aqua); opacity: 0; transition: translate .4s var(--ease), opacity .3s; }
.sgb-fresh li:hover::after, .sgb-fresh li:focus-within::after { translate: 0 -50%; opacity: 1; }

/* ---------- пузырьки гидромассажа: всплывают по обложке при наведении ---------- */
.sgb-fizz { position: absolute; z-index: 2; left: 0; right: 0; top: 100%; height: 130%; pointer-events: none; opacity: 0;
  --b: rgba(255, 255, 255, .12) 0 74%, rgba(255, 255, 255, .8) 80% 92%, transparent 97%;
  background:
    radial-gradient(circle closest-side, var(--b)) 7% 8% / 22px 22px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 21% 46% / 10px 10px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 33% 18% / 14px 14px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 46% 70% / 26px 26px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 58% 30% / 9px 9px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 69% 88% / 16px 16px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 80% 12% / 12px 12px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 91% 56% / 20px 20px no-repeat,
    radial-gradient(circle closest-side, var(--b)) 14% 92% / 8px 8px no-repeat; }
.sgb-fizz--b { scale: -1 1; }
.sgb-cell:hover .sgb-card .sgb-fizz, .sgb-card:focus-within .sgb-fizz, .sgb-feat:hover .sgb-fizz { animation: sgb-fizz 2.8s linear infinite; }
.sgb-cell:hover .sgb-card .sgb-fizz--b, .sgb-card:focus-within .sgb-fizz--b, .sgb-feat:hover .sgb-fizz--b { animation-duration: 3.9s; animation-delay: -1.7s; }
@keyframes sgb-fizz { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 82% { opacity: .9; } 100% { transform: translateY(-185%); opacity: 0; } }

/* ---------- полоса подбора ---------- */
.sgb-band { padding: clamp(20px, 3vw, 40px) 0 0; background: var(--sand); }
.sgb-band .sga-cta { margin: 0; }

/* ---------- темы и поиск ---------- */
.sgb-feed-sec { padding: clamp(36px, 5vw, 64px) 0 clamp(64px, 9vw, 120px); background: var(--sand); }
.sgb-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); gap: 14px 24px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.sgb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sgb-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font: 600 13px/1 Montserrat, Arial, sans-serif; white-space: nowrap; cursor: pointer; transition: transform .3s var(--spring), background-color .25s, border-color .25s, color .25s; }
.sgb-chip b { font-size: 11px; font-weight: 700; color: var(--muted); transition: color .25s; }
.sgb-chip:hover { border-color: var(--ink); transform: translateY(-2px); }
.sgb-chip:focus-visible, .sgb-search input:focus-visible, .sgb-more:focus-visible, .sgb-card:has(a:focus-visible) { outline: 2px solid var(--aqua-ink); outline-offset: 3px; }
.sgb-card h3 a:focus-visible { outline: none; } /* рамку фокуса рисует вся карточка */
.sgb-chip[aria-pressed="true"] { background: var(--night); border-color: var(--night); color: #fff; }
.sgb-chip[aria-pressed="true"] b { color: var(--aqua); }
.sgb-search { position: relative; display: block; margin: 0; font: inherit; color: inherit; } /* тема задаёт label свой кегль и отступ снизу */
.sgb-search input { width: 100%; height: 44px; margin: 0; padding: 0 44px 0 14px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font: 500 14px/1 Montserrat, Arial, sans-serif; -webkit-appearance: none; appearance: none; }
.sgb-search input::placeholder { color: var(--muted); }
.sgb-search svg { position: absolute; right: 13px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; color: var(--aqua-ink); pointer-events: none; }

/* ---------- полки и сетка ---------- */
.sgb-shelf { padding-top: clamp(36px, 5.5vw, 72px); }
.sgb-shelf__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: clamp(18px, 2.4vw, 30px); }
.sgb-shelf__head h2 { position: relative; padding-top: 18px; font-size: clamp(26px, 3.2vw, 40px); line-height: 1.12; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.sgb-shelf__head h2::before { content: ""; position: absolute; left: 0; top: 0; width: 56px; height: 3px; background: var(--aqua); }
.sgb-more { flex: none; display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.sgb-more b { margin-right: 4px; font-size: clamp(34px, 4vw, 52px); font-weight: 800; line-height: .8; letter-spacing: -.02em; color: transparent; -webkit-text-stroke: 1px var(--aqua-ink); transition: color .3s; }
.sgb-more::after { content: "→"; font-size: 18px; color: var(--aqua-ink); transition: translate .35s var(--ease); }
.sgb-more:hover b { color: var(--aqua); }
.sgb-more:hover::after { translate: 6px 0; }
.sgb-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.2vw, 28px); }

/* ---------- карточка ---------- */
.sgb-cell { min-width: 0; } /* неподвижная ячейка: по ней считается наведение, на ней же появление при скролле */
.sgb-card { position: relative; display: flex; flex-direction: var(--dir, column); height: 100%; background: #fff; border: 1px solid var(--line); transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px)); transition: transform .3s ease-out, box-shadow .45s var(--ease), border-color .3s; }
.sgb-cell:hover .sgb-card, .sgb-card:focus-within { --lift: -6px; border-color: transparent; box-shadow: 0 32px 56px -30px rgba(12, 15, 20, .5); }
.sgb-card::before { content: ""; position: absolute; z-index: 1; inset: 0; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(54, 194, 207, .14), transparent 70%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.sgb-cell:hover .sgb-card::before { opacity: 1; }
.sgb-card::after { content: ""; position: absolute; z-index: 2; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--aqua); transform: scaleX(0); transform-origin: 0 50%; transition: transform .5s var(--ease); }
.sgb-cell:hover .sgb-card::after, .sgb-card:focus-within::after { transform: none; }
.sgb-card__cover { position: relative; overflow: hidden; flex: var(--cover, none); aspect-ratio: var(--ratio, 3 / 2); min-height: var(--cover-min, 0); background: var(--night-2); }
.sgb-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease); }
.sgb-cell:hover .sgb-card .sgb-card__cover img, .sgb-card:focus-within .sgb-card__cover img { transform: scale(1.08); }
.sgb-card__cover::after { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(to top, rgba(12, 15, 20, .62), transparent 48%); }
.sgb-card__min { position: absolute; z-index: 3; left: 14px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: #fff; }
.sgb-card__min::before { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--aqua); border-right-color: rgba(255, 255, 255, .35); transition: rotate .8s var(--ease); }
.sgb-cell:hover .sgb-card .sgb-card__min::before { rotate: 360deg; }
.sgb-card__demo { position: absolute; z-index: 3; right: 0; top: 0; padding: 6px 10px; background: rgba(12, 15, 20, .78); font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #cfe9ed; }
.sgb-card__body { flex: 1; display: flex; flex-direction: column; justify-content: var(--just, flex-start); gap: 10px; padding: var(--pad, clamp(16px, 1.8vw, 22px)); }
.sgb-card h3 { font-size: var(--h3, clamp(17px, 1.45vw, 20px)); line-height: 1.3; font-weight: 700; color: var(--ink); text-wrap: balance; }
.sgb-card h3 a { text-decoration: none; }
.sgb-card h3 a::after { content: ""; position: absolute; z-index: 4; inset: 0; } /* вся карточка — одна ссылка */
.sgb-card__body > p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.sgb-card__meta { display: flex; align-items: center; gap: 10px; margin-top: var(--meta-top, auto); padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.sgb-card__meta img { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.sgb-card__meta b { font-weight: 600; color: var(--ink); }

/* сетка без пустых мест: если в последнем ряду остаётся дырка, первая карточка становится широкой
   (три колонки: при 2, 5, 8… статьях — на две колонки, при 4, 7, 10… — на всю строку; две колонки: при нечётном числе) */
@media (min-width: 1024px) {
  .sgb-row:not(.sgb-row--shelf) > :first-child:nth-last-child(3n + 2) { grid-column: span 2; --dir: row; --cover: 0 0 52%; --ratio: auto; --cover-min: 300px; --just: center; --pad: clamp(20px, 2.6vw, 36px); --h3: clamp(21px, 2.1vw, 28px); --meta-top: 6px; }
  .sgb-row:not(.sgb-row--shelf) > :first-child:nth-last-child(3n + 1):not(:only-child) { grid-column: 1 / -1; --dir: row; --cover: 0 0 52%; --ratio: auto; --cover-min: 300px; --just: center; --pad: clamp(20px, 2.6vw, 36px); --h3: clamp(21px, 2.1vw, 28px); --meta-top: 6px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .sgb-row:not(.sgb-row--shelf) > :first-child:nth-last-child(odd):not(:only-child) { grid-column: 1 / -1; --dir: row; --cover: 0 0 52%; --ratio: auto; --cover-min: 300px; --just: center; --pad: clamp(20px, 2.6vw, 36px); --h3: clamp(21px, 2.1vw, 28px); --meta-top: 6px; }
}

/* ---------- ничего не найдено ---------- */
.sgb-empty { display: grid; gap: 18px; justify-items: center; padding: clamp(48px, 7vw, 96px) 0 0; text-align: center; }
.sgb-empty p { max-width: 44ch; font-size: clamp(18px, 1.7vw, 22px); line-height: 1.5; font-weight: 500; color: var(--ink); }

/* ---------- автор ---------- */
.sgb-author h2 { margin-top: 12px; }
.sgb-author p { margin-top: 1.1em; }
.sgb-author .sga-btn { margin-top: 26px; }

/* ---------- планшет и телефон ---------- */
@media (max-width: 1023px) {
  .sgb-lead { grid-template-columns: 1fr; }
  .sgb-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* полка листается вбок: три карточки в двух колонках оставили бы дырку. Отступы с запасом, чтобы тень и подъём не срезались */
  .sgb-row--shelf { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gut); margin: -12px calc(-1 * var(--gut)) -34px; padding: 12px var(--gut) 64px; scrollbar-width: none; }
  .sgb-row--shelf::-webkit-scrollbar { display: none; }
  .sgb-row--shelf > .sgb-cell { flex: 0 0 44%; scroll-snap-align: start; }
}
@media (max-width: 767px) {
  .sgb-hero__top { grid-template-columns: 1fr; }
  .sgb-feat { min-height: 420px; box-shadow: 8px 8px 0 rgba(54, 194, 207, .3); margin-right: 8px; }
  .sgb-feat .sga-btn { width: 100%; }
  .sgb-tools { grid-template-columns: minmax(0, 1fr); }
  .sgb-search { order: -1; }
  .sgb-search input { font-size: 16px; } /* при шрифте мельче 16 px iPhone приближает страницу на вводе */
  .sgb-chips { flex-wrap: nowrap; overflow-x: auto; margin: -4px calc(-1 * var(--gut)); padding: 8px var(--gut); scrollbar-width: none; }
  .sgb-chips::-webkit-scrollbar { display: none; }
  .sgb-shelf__head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .sgb-row { grid-template-columns: 1fr; }
  .sgb-row--shelf > .sgb-cell { flex-basis: 80%; }
}

/* Тема красит все ссылки в чёрный с !important (см. пояснение у кнопок в article.css) — светлые ссылки первого экрана возвращаем так же. */
.sgb.sgb.sgb .sgb-feat h2 a, .sgb.sgb.sgb .sgb-fresh a { color: #fff !important; }

/* ---------- встраивание в шаблон списка блога (тема Amely) ----------
   Этот файл грузится только вместе с блоком страницы, поэтому правила ниже действуют лишь там, где новая страница выведена.
   Раскладку темы (две колонки) настройкой не меняем — она общая с рубриками и тегами блога: боковую колонку и кнопку её
   открытия на телефоне прячем, колонку со страницей растягиваем на всю ширину окна. Заголовок полосы скрыт: свой h1 — в первом экране. */
.blog-index-index .sidebar-main, .blog-index-index .sidebar-action-mobile--left { display: none !important; }
.blog-index-index.page-layout-2columns-left .row > .col.column.main { flex: 0 0 100%; max-width: 100%; } /* у темы здесь 75 %, вес 0,5,0 */
.blog-index-index .page-title-wrapper .page-title { display: none; }
.blog-index-index #maincontent { padding-top: 0 !important; padding-bottom: 0 !important; }
.column.main .sgb { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }
@media (max-width: 767px) { .blog-index-index .page-title-wrapper { display: none; } } /* на телефоне крошки темой скрыты — полоса пустая */
