/* Справочник: поиск, оглавление по темам и страница статьи. */

.room-top.compact {
  min-height: clamp(190px, 28vh, 250px);
  padding-bottom: 34px;
}
.room-top.compact .room-title {
  margin-top: auto;
  padding-top: 18px;
}

/* ── Поиск ── */
.wsearch {
  margin: 8px 0 0;
}
.wsearch label {
  display: block;
  margin: 0 0 8px;
  font: 800 clamp(18px, 4.8vw, 23px) / 1.15 var(--display);
}
.warticle + section .wsearch label {
  font-size: 16px;
}
.wsearch-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.wsearch input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  box-shadow: inset 0 3px 0 rgba(30, 21, 17, 0.08);
  color: var(--ink);
  font: 400 17px/1.2 var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.wsearch input::placeholder {
  color: #7a6a5c;
}
.wsearch input:focus-visible {
  outline: 3px solid var(--mustard-deep);
  outline-offset: 2px;
  border-radius: 999px;
}
.no-js .wsearch-row {
  display: none;
}
.wresults:empty {
  display: none;
}
.wresults {
  margin-top: 12px;
}
.wcount {
  margin: 0 0 8px !important;
}
.whits {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sheet .whits a {
  display: grid;
  gap: 2px;
  padding: 11px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  font-weight: 400 !important;
  text-decoration: none !important;
}
.whits strong {
  font: 800 14.5px/1.25 var(--display);
}
.whits small {
  color: var(--note);
  font: 700 11.5px/1.2 var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.whits span {
  font-size: 14.5px;
  line-height: 1.4;
}
.whits mark {
  padding: 0 1px;
  border-radius: 3px;
  background: #ffd98a;
  color: inherit;
}

/* ── Темы ── */
.wtopics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.wtopic {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px 12px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  scroll-margin-top: 14px;
}
.wtopic .card-pic {
  grid-row: auto;
  width: 56px;
  height: 56px;
}
.wtopic .card-pic img,
.wtopic .card-pic .sprite-pic {
  max-width: 46px;
  max-height: 46px;
}
.wtopic .card-pic .sprite-pic {
  display: block;
  width: 46px;
  height: 46px;
}
.wtopic h3 {
  margin: 1px 0 2px;
  font-size: 15.5px;
}
.sheet .wtopic h3 a {
  font: inherit !important;
}
.wtopic .card-pic {
  overflow: hidden;
}
.wtopic p.small {
  margin: 0 0 8px;
}
.warts {
  margin: 0;
  padding: 0;
  list-style: none;
}
.warts li {
  padding: 7px 0 6px;
  border-top: 1px solid var(--line);
}
.warts a {
  display: inline-block;
  padding: 4px 0;
}
.warts span {
  display: block;
  color: var(--note);
  font-size: 14px;
  line-height: 1.35;
}

/* ── Статья ── */
.warticle {
  padding-top: 16px;
}
.crumbs {
  margin: 0 0 12px;
  color: var(--note);
  font-size: 14px;
}
.crumbs a {
  display: inline-block;
  padding: 6px 0;
}
.warticle h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 10px;
  scroll-margin-top: 14px;
}
.wi {
  flex: none;
  display: inline-block;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  object-fit: contain;
  vertical-align: middle;
}
.sprite-pic {
  background-repeat: no-repeat;
}
.tcap {
  margin: 0 0 6px !important;
  color: var(--note);
  font-size: 14.5px;
  font-weight: 700;
}
/* Таблица занимает ширину листа; если столбцы не помещаются (широкие таблицы на телефоне),
   она прокручивается внутри своей рамки, а тень у края показывает, что там есть ещё. */
.table {
  margin: 0 0 14px;
  overflow-x: auto;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background:
    linear-gradient(to right, var(--white) 40%, rgba(255, 251, 244, 0)) left center / 36px 100% no-repeat local,
    linear-gradient(to left, var(--white) 40%, rgba(255, 251, 244, 0)) right center / 36px 100% no-repeat local,
    linear-gradient(to right, rgba(30, 21, 17, 0.2), rgba(30, 21, 17, 0)) left center / 12px 100% no-repeat scroll,
    linear-gradient(to left, rgba(30, 21, 17, 0.2), rgba(30, 21, 17, 0)) right center / 12px 100% no-repeat scroll,
    var(--white);
  -webkit-overflow-scrolling: touch;
}
.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.4;
}
.table th,
.table td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table td {
  white-space: pre-line;
}
.table thead th {
  border-top: 0;
  background: rgba(253, 238, 203, 0.92);
  font: 700 11.5px/1.25 var(--text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: bottom;
}
.table tbody tr:first-child th,
.table tbody tr:first-child td {
  border-top-color: transparent;
}
.table thead + tbody tr:first-child th,
.table thead + tbody tr:first-child td {
  border-top-color: var(--ink);
}
.table.facts th {
  width: 36%;
  font-weight: 700;
}
/* Значок слева от подписи. */
.table .has-pic {
  position: relative;
  padding-left: 46px;
}
.table .has-pic .wi {
  position: absolute;
  left: 11px;
  top: 6px;
  margin: 0;
}
/* Числовые столбцы: узкие, по центру. */
.table.n2 tr > :nth-child(2),
.table.n3 tr > :nth-child(3),
.table.n4 tr > :nth-child(4),
.table.n5 tr > :nth-child(5),
.table.n6 tr > :nth-child(6) {
  width: 1%;
  text-align: center;
  white-space: nowrap;
}
/* Заголовок числового столбца может переноситься: иначе длинное слово растянет узкий столбец. */
.table[class*=" n"] thead th:nth-child(n) {
  white-space: normal;
}
@media (max-width: 480px) {
  .table table {
    font-size: 14.5px;
  }
  .table th,
  .table td {
    padding: 8px 9px;
    /* На телефоне длинное слово переносится по слогам — так таблица умещается в лист,
       а не уезжает вбок из-за одного слова. Короткие слова не рвутся, обрывков по две-три
       буквы не бывает. */
    -webkit-hyphens: auto;
    hyphens: auto;
    -webkit-hyphenate-limit-before: 4;
    -webkit-hyphenate-limit-after: 4;
    hyphenate-limit-chars: 9 4 4;
  }
  /* Название в первом столбце остаётся целым. */
  .table tbody tr > :first-child {
    -webkit-hyphens: manual;
    hyphens: manual;
  }
  .table thead th {
    hyphenate-limit-chars: 8 4 4;
  }
  .table.c3 th,
  .table.c3 td {
    padding: 8px;
  }
  .table .has-pic,
  .table.c3 .has-pic {
    padding-left: 38px;
  }
  .table .has-pic .wi {
    left: 6px;
    width: 26px;
    height: 26px;
  }
  .table.c4 th,
  .table.c4 td,
  .table.c5 th,
  .table.c5 td,
  .table.c6 th,
  .table.c6 td {
    padding: 8px 7px;
    font-size: 13.5px;
  }
  .table.c4 thead th,
  .table.c5 thead th,
  .table.c6 thead th {
    font-size: 10px;
    letter-spacing: 0.02em;
  }
  /* Значку нужно место и в тесной таблице: правило выше сбросило бы отступ. */
  .table.c4 .has-pic,
  .table.c5 .has-pic,
  .table.c6 .has-pic {
    padding-left: 38px;
  }
  .table.c4 .has-pic .wi,
  .table.c5 .has-pic .wi,
  .table.c6 .has-pic .wi {
    left: 6px;
    width: 26px;
    height: 26px;
  }
}
.wfig {
  margin: 0 0 14px;
  text-align: center;
}
.wp {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
}
.wfig.banner .wp {
  width: 100%;
  height: 190px;
  max-height: none;
  border: 2px solid var(--ink);
  border-radius: 16px;
  object-fit: cover;
}
.wfig figcaption {
  margin-top: 6px;
  color: var(--note);
  font-size: 13.5px;
}
.wgal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px 8px;
  margin: 0 0 14px;
  padding: 12px 10px 10px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 20%, #4a3a86, var(--indigo));
  list-style: none;
}
.wgal li {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #fff;
  font: 700 12.5px/1.2 var(--text);
  text-align: center;
}
.wgal small {
  color: #d9cdf5;
  font-weight: 400;
}
.sheet .wgal a {
  color: #fff !important;
}
.wt {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(10, 4, 24, 0.6));
}
.note.warn {
  background: #ffe1da;
}
.note.live {
  border-style: dashed;
  background: var(--white);
}
.see {
  margin: 22px 0 0;
}
.see p {
  margin: 0 0 8px;
  color: var(--note);
  font: 700 11.5px/1.2 var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.see ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 15px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  color: var(--ink);
  font: 700 14px/1.2 var(--text);
  text-decoration: none;
}
.chip:hover {
  background: #fff;
}
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 26px 0 0;
}
.sheet .pager a {
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  font: 800 13.5px/1.25 var(--display) !important;
  text-decoration: none !important;
}
.pager a[rel="next"] {
  text-align: right;
}
.pager small {
  color: var(--note);
  font: 700 11.5px/1.2 var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
