/* ============================================================
   visual-touch.css — прототип визуала под телефоны и планшеты.
   Не катить на прод, пока не согласуем по скринам.
   ============================================================ */

/* ── Общие поля и шапка ───────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --header-h: 52px; }

  header { height: var(--header-h); }

  header > div,
  header > .header-inner-wrap {
    padding: 0 12px;
    gap: 8px;
  }

  .logo { gap: 8px; font-size: 15px; }
  .logo img { width: 26px; border-radius: 7px; }

  .container { padding: 0 12px; }

  section.programs { padding: 0 10px 6px; }

  .user-btn {
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 99px;
  }

  .dl-limit-pill {
    margin: 8px 10px 10px;
    min-height: 40px;
    padding: 7px 14px;
  }
}

/* ── Липкие названия секций каталога ──────────────────────── */
@media (max-width: 1100px) {
  section.programs > h2 {
    position: sticky;
    top: var(--header-h);
    z-index: 20;
    display: flex;
    width: calc(100% + 20px);
    margin: 0 -10px 2px;
    padding: 8px 14px;
    font-size: 15px;
    background: rgba(5, 6, 15, 0.9);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--glass-border);
  }

  section.programs > h2::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  section.programs > h2 {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--surface-solid);
  }
}

/* ── Каталог: телефон — сетка как у лаунчера, без тяжёлого стекла ─ */
@media (max-width: 480px) {
  .programs-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 4px;
  }

  .program-card {
    padding: 6px 2px 4px;
    gap: 6px;
    min-height: 0;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 12px;
  }

  .program-card::before { display: none; }

  .program-icon-frame {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .program-card h3 {
    font-size: 10.5px;
    line-height: 1.25;
    hyphens: none;
    -webkit-hyphens: none;
  }
}

/* ── Каталог: широкий телефон ─────────────────────────────── */
@media (min-width: 481px) and (max-width: 767px) {
  .programs-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }

  .program-card {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 8px 4px 6px;
  }

  .program-card::before { display: none; }

  .program-icon-frame {
    width: 60px;
    height: 60px;
  }

  .program-card h3 { hyphens: none; -webkit-hyphens: none; }
}

/* ── Каталог: планшет — 5 колонок, крупнее иконки ─────────── */
@media (min-width: 768px) and (max-width: 1100px) {
  .programs-grid {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 14px 10px;
  }

  .program-card {
    padding: 12px 6px 10px;
    background: rgba(255, 255, 255, 0.03);
  }

  .program-icon-frame {
    width: 68px;
    height: 68px;
    border-radius: 18px;
  }

  .program-card h3 {
    font-size: 12.5px;
    hyphens: none;
    -webkit-hyphens: none;
  }

  section.programs { padding: 0 16px 10px; }

  section.programs > h2 {
    width: calc(100% + 32px);
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    font-size: 17px;
  }
}

/* ── Главная: гость-hero — меньше воздуха, каталог первым ─── */
@media (max-width: 600px) {
  main .home-hero {
    margin: 8px 12px 10px;
    padding: 14px 14px 12px;
    border-radius: 16px;
    text-align: left;
  }

  main .home-hero h1 {
    font-size: 20px;
    margin-bottom: 6px;
  }

  main .home-hero p {
    margin: 0 0 12px;
    max-width: none;
    font-size: 13px;
    line-height: 1.45;
  }

  main .home-hero-cta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  main .home-hero-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }

  main .home-hero-btn-main { grid-column: 1 / -1; }

  main .home-hero-note {
    text-align: left;
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.35;
  }
}

@media (min-width: 601px) and (max-width: 1100px) {
  main .home-hero {
    margin: 12px 16px 16px;
    padding: 20px 20px 16px;
  }
}

/* ── Новости: телефон — ряд «обложка + текст» ─────────────── */
@media (max-width: 639px) {
  main .news-section-hd {
    margin: 4px 12px 10px;
  }

  main .news-section-ttl { font-size: 20px; }

  main .news-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 12px 8px;
  }

  main .news-card {
    flex-direction: row;
    align-items: stretch;
    border-radius: 14px;
    min-height: 92px;
  }

  main .news-card-cover {
    width: 96px;
    min-width: 96px;
    aspect-ratio: 1;
    height: auto;
    flex-shrink: 0;
  }

  main .news-card-cover::after { display: none; }

  main .news-card-body {
    padding: 10px 12px 8px;
    min-width: 0;
    justify-content: center;
  }

  main .news-card-title {
    font-size: 13.5px;
    margin-bottom: 6px;
    -webkit-line-clamp: 2;
  }

  main .news-card-date-badge,
  main .news-card-media-tags { display: none; }

  /* «Новое» — только молния, без текста на крошечном кадре */
  main .news-card-fresh-badge {
    top: 6px;
    right: 6px;
    padding: 4px;
    font-size: 0;
    letter-spacing: 0;
    line-height: 0;
    gap: 0;
    border-radius: 8px;
  }

  main .news-card-fresh-badge .icon {
    width: 11px;
    height: 11px;
    margin: 0;
  }

  main .news-card-reactions {
    gap: 6px;
    padding-top: 4px;
    border-top: none;
  }

  main .react-btn {
    min-height: 32px;
    padding: 3px 8px;
    font-size: 12px;
  }

  main .no-news { padding: 48px 16px; }
}

/* ── Новости: планшет — 2 колонки, чуть ниже кадр ─────────── */
@media (min-width: 640px) and (max-width: 1100px) {
  main .news-section-hd {
    margin: 8px 16px 14px;
  }

  main .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 0 16px 16px;
  }

  main .news-card { border-radius: 16px; }

  main .news-card-cover { aspect-ratio: 16 / 10; }

  .news-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 0 16px;
  }
}

@media (max-width: 639px) {
  .news-preview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 12px;
  }

  .news-preview-card { height: 148px; border-radius: 14px; }
}

/* ── Статья новости ───────────────────────────────────────── */
@media (max-width: 720px) {
  .np-wrap { padding: 12px 12px 96px; }

  .np-back {
    min-height: 44px;
    padding: 10px 16px;
    margin-bottom: 14px;
  }

  .np-hero {
    border-radius: 14px;
    margin-bottom: 14px;
  }

  .np-article {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .np-title { font-size: 20px; }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .np-wrap { padding: 16px 20px 96px; max-width: 820px; }
}

/* ── Карточка приложения ──────────────────────────────────── */
@media (max-width: 720px) {
  .app-bc {
    padding: 8px 12px 0;
    font-size: 12px;
  }

  .app-bc a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .app-wrap {
    padding: 4px 12px 96px;
    max-width: none;
  }

  .app-card {
    padding: 16px 14px 20px;
    border-radius: 18px;
  }

  .app-hero { gap: 12px; margin-bottom: 14px; }

  .app-hero-actions {
    width: 100%;
    margin-left: 0;
  }

  .app-hero-dl,
  .app-hero-themes {
    flex: 1;
    justify-content: center;
    min-height: 48px;
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 16px;
  }

  .app-hero-share {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .app-wrap {
    max-width: 860px;
    padding: 12px 20px 96px;
  }

  .app-hero-dl { min-height: 46px; }
}

/* Тач: без hover-подъёма, лёгкий press */
@media (hover: none) and (pointer: coarse) {
  .news-card:active,
  .program-card:active,
  .home-hero-btn:active,
  .app-hero-dl:active,
  .app-hero-themes:active {
    transform: scale(0.98);
  }
  .program-card:active .program-icon-frame {
    transform: scale(0.94);
  }
}

@media (hover: hover) and (pointer: fine) {
  .home-hero-btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
  }
  .home-hero-btn-ghost:hover {
    transform: translateY(-1px);
    border-color: var(--glass-border-h);
  }
}

/* ============================================================
   Движение — интерфейс отвечает, не выступает.
   Stagger только first screen (≤6 новостей). Каталог целиком,
   не по карточкам. Loop — только CTA и бейдж «новое».
   Reduced motion сбрасывается глобально в style.css.
   ============================================================ */

@keyframes la-rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes la-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes la-sheen {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

@keyframes la-shimmer {
  0%, 55% { transform: translateX(-130%); }
  75%, 100% { transform: translateX(130%); }
}

@keyframes la-pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.06); }
}

main .home-hero {
  position: relative;
  overflow: hidden;
  animation: la-rise 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

main .home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.07) 0%, transparent 42%),
    radial-gradient(ellipse 80% 50% at 50% -12%, var(--accent-glow), transparent 70%);
  animation: la-sheen 10s ease-in-out infinite alternate;
}

main .home-hero > * { position: relative; z-index: 1; }

main .home-hero h1 {
  color: var(--text);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  main .home-hero h1 {
    background: linear-gradient(180deg, #fff 18%, var(--accent) 160%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

main .home-hero-btn-main {
  position: relative;
  overflow: hidden;
}

main .home-hero-btn-main::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: la-shimmer 4.8s ease-in-out infinite;
}

main .news-section-hd {
  animation: la-rise 0.48s 0.06s cubic-bezier(0.22, 1, 0.36, 1) both;
}

main .news-card-wrap:nth-child(1) { animation: la-rise 0.45s 0.10s cubic-bezier(0.22, 1, 0.36, 1) both; }
main .news-card-wrap:nth-child(2) { animation: la-rise 0.45s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both; }
main .news-card-wrap:nth-child(3) { animation: la-rise 0.45s 0.26s cubic-bezier(0.22, 1, 0.36, 1) both; }
main .news-card-wrap:nth-child(4) { animation: la-rise 0.45s 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
main .news-card-wrap:nth-child(5) { animation: la-rise 0.45s 0.42s cubic-bezier(0.22, 1, 0.36, 1) both; }
main .news-card-wrap:nth-child(6) { animation: la-rise 0.45s 0.50s cubic-bezier(0.22, 1, 0.36, 1) both; }

main .news-card-fresh-badge {
  animation: la-pulse-soft 2.8s ease-in-out infinite;
}

.dl-limit-pill {
  animation: la-fade 0.4s ease both;
}

section.programs .programs-grid {
  animation: la-fade 0.4s 0.08s ease both;
}

.app-bc {
  animation: la-fade 0.35s ease both;
}

.app-card {
  position: relative;
  overflow: hidden;
  animation: la-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.app-hero-dl {
  position: relative;
  overflow: hidden;
}

.app-hero-dl::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: la-shimmer 4.8s ease-in-out infinite;
}

.program-icon-frame {
  transition: transform var(--transition);
}

.np-article,
.np-hero {
  animation: la-rise 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.np-hero { animation-delay: 0.04s; }
.np-article { animation-delay: 0.1s; }
