/* ============================================================
   Прототип: адаптация таблиц для мобильных экранов.
   Стиль «бумага · чернила · кумач» сохранён, токены из folk.css.
   Десктоп не меняется. Ниже 48rem таблицы превращаются в карточки.
   ============================================================ */

@media (max-width: 48rem) {

  /* контейнер больше не скроллится горизонтально */
  .table-wrap { overflow-x: visible; border: none; }

  table.songs { min-width: 0; border-collapse: separate; border-spacing: 0; }

  table.songs thead { display: none; }

  table.songs tbody tr,
  table.songs tbody td { display: block; width: 100%; }
  table.songs tbody tr[hidden] { display: none; }

  table.songs tbody tr {
    border: 2px solid var(--ink);
    background: var(--paper);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }

  table.songs tbody td { border-bottom: none; padding: 0; }

  /* подписи колонок из data-label (паттерн .info-panel dt) */
  table.songs tbody td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-display);
    font-size: .75rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: var(--space-1);
  }

  /* ===== таблица песен: № / герой / название / сюжет ===== */
  .tbl-songs tbody td:nth-child(-n+3)::before { content: none; }

  .tbl-songs tbody td:nth-child(1) {           /* номер — крупно, красным */
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.375rem;
    color: var(--red-deep);
    margin-bottom: var(--space-1);
  }
  .tbl-songs tbody td:nth-child(2) {           /* герой / цикл — мелким капсом */
    font-size: .8125rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: var(--space-2);
  }
  .tbl-songs tbody td.song-title {             /* зачин — главное в карточке */
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-bottom: var(--space-2);
  }
  .tbl-songs tbody td.song-title a { text-decoration: none; }
  .tbl-songs tbody td.song-title a:hover { color: var(--red-deep); }
  .tbl-songs tbody td:nth-child(4) {           /* сюжет с подписью */
    color: var(--ink-2);
    font-size: .9375rem;
  }

  /* ===== список пунктов: название / современный адрес ===== */
  .locations tbody td:nth-child(1) {
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-bottom: var(--space-2);
  }
  .locations tbody td:nth-child(1)::before { content: none; }
  .locations tbody td:nth-child(1) a { text-decoration: none; }
  .locations tbody td:nth-child(1) a:hover { color: var(--red-deep); }
  .locations tbody td:nth-child(2) {
    color: var(--ink-2);
    font-size: .9375rem;
  }

  /* ===== информанты: ФИО / год рождения ===== */
  .informants tbody td:nth-child(1) {
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-bottom: var(--space-1);
  }
  .informants tbody td:nth-child(1)::before { content: none; }
  .informants tbody td:nth-child(2) {
    color: var(--ink-2);
    font-size: .9375rem;
  }

  /* ===== песни пункта: год / том / № / стр. / название / сюжет ===== */
  /* метаданные — одной строкой: «1903 · том 1.2 · № 74 · с. 35» */
  .songlist tbody td:nth-child(-n+4) {
    display: inline;
    font-size: .8125rem;
    letter-spacing: .08em;
    color: var(--ink-3);
  }
  .songlist tbody td:nth-child(-n+4)::before {
    content: none;
    display: inline;
  }
  .songlist tbody td:nth-child(2)::before   { content: "том "; }
  .songlist tbody td:nth-child(3)::before   { content: "№ "; }
  .songlist tbody td:nth-child(4)::before   { content: "с. "; }
  .songlist tbody td:nth-child(-n+3)::after { content: " · "; }
  .songlist tbody td:nth-child(4) { margin-bottom: var(--space-2); }

  .songlist tbody td.song-title {              /* название — главное в карточке */
    display: block;
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }
  .songlist tbody td.song-title::before { content: none; }
  .songlist tbody td.song-title a { text-decoration: none; }
  .songlist tbody td.song-title a:hover { color: var(--red-deep); }
  .songlist tbody td:nth-child(6) {            /* сюжет с подписью */
    color: var(--ink-2);
    font-size: .9375rem;
  }

  /* ===== результаты поиска: год / том / № / стр. / название / сюжет / пункт ===== */
  /* метаданные — одной строкой: «1903 · том 2 · № 60 · с. 163» */
  .results tbody td:nth-child(-n+4) {
    display: inline;
    font-size: .8125rem;
    letter-spacing: .08em;
    color: var(--ink-3);
  }
  .results tbody td:nth-child(-n+4)::before {
    content: none;
    display: inline;
  }
  .results tbody td:nth-child(2)::before   { content: "том "; }
  .results tbody td:nth-child(3)::before   { content: "№ "; }
  .results tbody td:nth-child(4)::before   { content: "с. "; }
  .results tbody td:nth-child(-n+3)::after { content: " · "; }
  .results tbody td:nth-child(4) { margin-bottom: var(--space-2); }

  .results tbody td.song-title {               /* название — главное в карточке */
    display: block;
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }
  .results tbody td.song-title::before { content: none; }
  .results tbody td.song-title a { text-decoration: none; }
  .results tbody td.song-title a:hover { color: var(--red-deep); }
  .results tbody td:nth-child(6),            /* сюжет и населённый пункт — с подписями */
  .results tbody td:nth-child(7) {
    color: var(--ink-2);
    font-size: .9375rem;
  }
}
