/*
 * Хроники Заречья. Палитра — та же, что у лендинга (mir.css): почти-чёрный,
 * сливки, блёклый лён, охра и одна красная нить. Бумага — только у
 * предметов на столе и у папки дела: на ней длинный текст и читается.
 */

@font-face {
  font-family: 'ST Nizhegorodsky';
  src: url('/media/nizhegorodsky.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #0b0906;
  --ink: #dfcfae;
  --ink-soft: #9f8b65;
  --accent: #8a683c;
  --red: #c1523f;
  --red-deep: #8e2f22;
  --paper: #e9ddc3;
  --paper-dark: #d9c8a6;
  --paper-ink: #2b2117;
  --paper-ink-soft: #6b5638;
  --font-display: 'ST Nizhegorodsky', 'Old Standard TT', 'Times New Roman', serif;
  --font-body: 'Old Standard TT', Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms;
  --t-normal: 320ms;
  --shadow-lezhit: 0 2px 3px rgba(0, 0, 0, 0.5), 0 10px 22px rgba(0, 0, 0, 0.45);
  --shadow-podnyat: 0 6px 8px rgba(0, 0, 0, 0.45), 0 26px 44px rgba(0, 0, 0, 0.6);
  --gutter: clamp(16px, 4vw, 48px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  overflow-x: hidden;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--paper-ink);
  z-index: 10;
}
.skip:focus {
  top: 12px;
}

/* ── Шапка ─────────────────────────────────────────────────────── */

.shapka {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px var(--gutter);
}
.shapka__domoj {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  font-family: var(--font-display);
  letter-spacing: 0.12em;
  color: var(--ink);
}
.shapka__pravo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.pult__yazyk {
  display: inline-flex;
}
.pult__yazyk button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.pult__yazyk button[aria-pressed='true'] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 6px;
}
.shapka__zov {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  background: #a63a2a;
  color: #f2e6c9;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background var(--t-fast);
}
.shapka__zov:hover {
  background: var(--red);
}

.zaglavie {
  padding: clamp(12px, 3vw, 36px) var(--gutter) 8px;
  max-width: 1600px;
  margin: 0 auto;
}
.zaglavie__nad {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.zaglavie h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 1.2rem + 4vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
  color: var(--red);
  text-shadow: 0 0 34px rgba(166, 58, 42, 0.35);
}
.zaglavie__slovo {
  max-width: 56ch;
  margin: 16px 0 0;
  font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.18rem);
  line-height: 1.55;
  color: var(--ink);
}

/* ── Пульт ─────────────────────────────────────────────────────── */

.pult[hidden],
.stol__gruppa[hidden] {
  display: none;
}
.pult {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  max-width: 1600px;
  margin: 22px auto 0;
  padding: 0 var(--gutter);
}
.pult__vid {
  display: inline-flex;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
}
.pult__vid-knopka,
.pult__rod {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.98rem;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.pult__vid-knopka[aria-pressed='true'] {
  background: var(--ink);
  color: var(--bg);
}
.pult__vid-knopka:hover:not([aria-pressed='true']),
.pult__rod:hover {
  color: var(--ink);
}
.pult__rody {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}
.pult__rod {
  padding: 0 10px;
  border-bottom: 2px solid transparent;
}
.pult__rod span {
  color: color-mix(in srgb, var(--ink-soft) 70%, transparent);
  font-size: 0.85em;
}
.pult__rod[aria-pressed='true'] {
  color: var(--ink);
  border-bottom-color: var(--red);
}
.pult__poisk {
  flex: 1 1 240px;
  max-width: 380px;
  margin-left: auto;
}
.pult__poisk input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--ink) 5%, var(--bg));
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.pult__poisk input::placeholder {
  color: color-mix(in srgb, var(--ink-soft) 80%, transparent);
  font-style: italic;
}
.pult__itog {
  max-width: 1600px;
  margin: 10px auto 0;
  padding: 0 var(--gutter);
  min-height: 1.4em;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-style: italic;
}

/* ── Стол ──────────────────────────────────────────────────────── */

.stol {
  max-width: 1680px;
  margin: 12px auto 0;
  padding: 0 clamp(0px, 2vw, 24px);
}
.stol[hidden] {
  display: none;
}

/*
 * Поверхность меряется собственной шириной (cqw), а не окном: предметы
 * лежат на тех же местах при любой ширине стола, и на 1024, и на 1920.
 */
.stol__poverhnost {
  position: relative;
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1a120b url('/media/chronicles/desk.webp') center / cover no-repeat;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

/* Лампа: круг тьмы с дырой света. Двигается только transform'ом. */
.stol__svet {
  position: absolute;
  left: -80cqw;
  top: -80cqw;
  width: 160cqw;
  height: 160cqw;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(circle at center, transparent 0 17cqw, rgba(5, 4, 3, 0.42) 46cqw);
  transform: translate3d(42cqw, 22cqw, 0);
  transition: transform 700ms var(--ease-out);
}
.stol__svet--ruka {
  transition: transform 180ms linear;
}

.stol__niti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}
.stol__niti path {
  fill: none;
  stroke: #b3382a;
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: nit 520ms var(--ease-out) forwards;
}
.niti--srazu path {
  animation: none;
  stroke-dashoffset: 0;
}
@keyframes nit {
  to {
    stroke-dashoffset: 0;
  }
}

.stol__gruppa {
  position: absolute;
  z-index: 3;
}
.stol__yarlyk {
  margin: 0 0 0.9cqw;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: max(0.78rem, 1.05cqw);
  letter-spacing: 0.16em;
  color: color-mix(in srgb, var(--ink) 75%, transparent);
  text-shadow: 0 1px 2px #000;
}

/* Общий закон предмета: лежит под наклоном, на руке выпрямляется и
   приподнимается. Связанные нитью — подсвечены. */
.predmet {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transform: rotate(var(--naklon, 0deg));
  transition:
    transform var(--t-normal) var(--ease-out),
    opacity var(--t-normal),
    filter var(--t-normal);
}
.predmet:hover,
.predmet:focus-visible {
  transform: translateY(-0.5cqw) rotate(0deg) scale(1.04);
  z-index: 5;
}
.predmet.pogashen {
  opacity: 0.22;
  filter: grayscale(0.8);
}
.predmet.svyazan {
  filter: drop-shadow(0 0 0.5cqw rgba(193, 82, 63, 0.75));
}
.novoe {
  position: absolute;
  top: -0.7cqw;
  right: -0.7cqw;
  display: grid;
  place-items: center;
  width: 3.2cqw;
  min-width: 34px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c54a38, #7d2418 70%);
  color: #f3d9c4;
  font-family: var(--font-display);
  font-size: max(0.6rem, 0.72cqw);
  letter-spacing: 0.06em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  transform: rotate(-14deg);
}

/* Карта с булавками. */
.stol__karta {
  left: 4.5cqw;
  top: 4.2cqw;
  width: 23cqw;
}
.karta {
  position: relative;
  transform: rotate(-2.2deg);
  padding: 0.6cqw;
  background: var(--paper-dark);
  box-shadow: var(--shadow-lezhit);
}
.karta img {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(0.25) contrast(0.95);
}
.karta__bulavki {
  position: absolute;
  inset: 0.6cqw;
}
.bulavka {
  position: absolute;
  translate: -50% -100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bulavka__golovka {
  width: 1.5cqw;
  min-width: 16px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e46a55, #8d2416 70%);
  box-shadow: 0 0.35cqw 0.4cqw rgba(0, 0, 0, 0.55);
}
.bulavka__imya {
  order: -1;
  margin-bottom: 0.3cqw;
  padding: 0.2cqw 0.6cqw;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: max(0.72rem, 0.92cqw);
  white-space: nowrap;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

/* Места без булавки — бирками под картой. */
.yarlyki {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8cqw;
  margin-top: 1.2cqw;
}
.yarlyk {
  padding: 0.45cqw 1cqw 0.45cqw 1.8cqw;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: max(0.72rem, 0.92cqw);
  clip-path: polygon(0.9cqw 0, 100% 0, 100% 100%, 0.9cqw 100%, 0 50%);
  box-shadow: var(--shadow-lezhit);
}
.yarlyk::before {
  content: '';
  position: absolute;
  left: 0.75cqw;
  top: 50%;
  width: 0.45cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1a120b;
  translate: 0 -50%;
}

/* Сколько ещё ждёт в указателе. */
.stol__eshchyo {
  display: block;
  margin-top: 0.9cqw;
  padding: 0.2cqw 0;
  min-height: 32px;
  border: 0;
  background: none;
  color: color-mix(in srgb, var(--ink) 80%, transparent);
  font: inherit;
  font-style: italic;
  font-size: max(0.78rem, 0.9cqw);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-underline-offset: 4px;
  text-shadow: 0 1px 2px #000;
  cursor: pointer;
}
.stol__eshchyo:hover {
  color: var(--ink);
}

/* Мифы: листы из старых книг, с печатью. */
.stol__listy {
  left: 71.5cqw;
  top: 35cqw;
  width: 25cqw;
}
.listy {
  display: flex;
  gap: 1cqw;
}
.list {
  flex: 1 1 0;
  padding: 0.6cqw 0.6cqw 1.6cqw;
  background:
    radial-gradient(90% 70% at 50% 40%, transparent 55%, rgba(110, 78, 40, 0.28)),
    #e4d6b5;
  color: var(--paper-ink);
  box-shadow: var(--shadow-lezhit);
}
.list img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50% 50% 0.3cqw 0.3cqw;
  filter: sepia(0.75) contrast(1.05);
}
.list__imya {
  display: block;
  margin-top: 0.5cqw;
  font-family: var(--font-display);
  font-size: max(0.7rem, 0.92cqw);
  line-height: 1.1;
  text-align: center;
  color: var(--red-deep);
}
.list__pechat {
  position: absolute;
  bottom: -0.8cqw;
  left: 50%;
  width: 2cqw;
  min-width: 22px;
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% 0;
  background: radial-gradient(circle at 35% 30%, #b8402f, #6d1e13 72%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
}

/* Лица: фотокарточки на паспарту. */
.stol__lica {
  left: 31cqw;
  top: 2.6cqw;
  width: 37cqw;
}
/* Две строки по четыре: люди — главное, что приносят новые выпуски. */
.lica {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4cqw 1.2cqw;
}
.lico {
  padding: 0.55cqw 0.55cqw 0;
  background: #efe5cf;
  color: var(--paper-ink);
  box-shadow: var(--shadow-lezhit);
}
.lico:hover,
.lico:focus-visible {
  box-shadow: var(--shadow-podnyat);
}
.lico__foto {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}
.lico__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.35) saturate(0.85);
}
.lico__podpis {
  display: block;
  padding: 0.5cqw 0.1cqw 0.6cqw;
  font-style: italic;
  font-size: max(0.72rem, 0.95cqw);
  line-height: 1.2;
}

/* Вырезки из уездного листка. */
.stol__vyrezki {
  left: 31.5cqw;
  top: 36cqw;
  width: 37cqw;
}
.vyrezki {
  display: flex;
  gap: 1.4cqw;
  align-items: flex-start;
}
.vyrezka {
  flex: 0 1 calc((100% - 2.8cqw) / 3);
  padding: 0.8cqw 0.9cqw 1cqw;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    #ddd2b8;
  color: #221a12;
  box-shadow: var(--shadow-lezhit);
  clip-path: polygon(0 1%, 4% 0, 30% 1.4%, 62% 0.3%, 100% 1%, 99.2% 40%, 100% 99%, 70% 100%, 35% 98.8%, 0 100%, 0.7% 60%);
}
.vyrezka:nth-child(2) {
  margin-top: 2cqw;
}
.vyrezka__shapka {
  display: block;
  padding-bottom: 0.3cqw;
  border-bottom: 1px solid #221a12;
  font-family: var(--font-display);
  font-size: max(0.6rem, 0.72cqw);
  letter-spacing: 0.2em;
  text-align: center;
}
.vyrezka__zag {
  display: block;
  margin: 0.5cqw 0;
  font-weight: 700;
  font-size: max(0.8rem, 1.1cqw);
  line-height: 1.15;
}
.vyrezka img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15) brightness(1.05);
  mix-blend-mode: multiply;
}
.vyrezka__tekst {
  display: block;
  margin-top: 0.5cqw;
  font-size: max(0.7rem, 0.86cqw);
  line-height: 1.3;
  column-rule: 1px solid rgba(0, 0, 0, 0.3);
}

/* Книга о нечистой силе. */
.stol__kniga {
  left: 71cqw;
  top: 3.2cqw;
  width: 25.5cqw;
}
.kniga {
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  transform: rotate(1.6deg);
  padding: 0.7cqw;
  background: linear-gradient(90deg, #3a2414, #4b2e19 48%, #2c1a0e 50%, #4b2e19 52%, #3a2414);
  box-shadow: var(--shadow-lezhit);
}
.kniga__list {
  margin: 0;
  padding: 1.4cqw 1.1cqw;
  background: linear-gradient(90deg, #d8c9a8, #e9ddc3 30%);
  color: var(--paper-ink);
  list-style: none;
}
.kniga__list--levyj {
  background: linear-gradient(270deg, #cdbd9a, #e9ddc3 30%);
  text-align: center;
}
.kniga__zag {
  margin: 1.6cqw 0 0.8cqw;
  font-family: var(--font-display);
  font-size: max(0.9rem, 1.45cqw);
  line-height: 1.1;
  color: var(--red-deep);
}
.kniga__pod {
  margin: 0;
  font-style: italic;
  font-size: max(0.7rem, 0.86cqw);
  line-height: 1.35;
  color: var(--paper-ink-soft);
}
.kniga__list--pravyj li + li {
  border-top: 1px solid rgba(43, 33, 23, 0.18);
}
.stroka {
  display: grid;
  grid-template-columns: 3.4cqw 1fr;
  column-gap: 0.8cqw;
  align-items: center;
  width: 100%;
  padding: 0.6cqw 0.2cqw;
}
.stroka img {
  grid-row: span 2;
  align-self: center;
  width: 3.4cqw;
  height: 3.4cqw;
  border-radius: 50%;
  object-fit: cover;
  filter: sepia(0.7) contrast(1.1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.stroka__imya {
  font-weight: 700;
  font-size: max(0.78rem, 1.02cqw);
}
.stroka__slovo {
  font-style: italic;
  font-size: max(0.68rem, 0.8cqw);
  line-height: 1.25;
  color: var(--paper-ink-soft);
}
.stroka:hover .stroka__imya,
.stroka:focus-visible .stroka__imya {
  color: var(--red-deep);
}
.stroka .novoe {
  top: 0.2cqw;
  right: -0.4cqw;
  width: 2.4cqw;
}

/* ── Узкое окно: стол ложится стопкой ─────────────────────────── */

@media (max-width: 899px) {
  .shapka__pravo {
    gap: 4px;
  }
  .shapka__zov {
    padding: 0 12px;
    font-size: 0.9rem;
  }
  .zaglavie__nad {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }
  .pult {
    gap: 10px;
  }
  /* Рода — одной лентой вбок, а не тремя строками кнопок над столом. */
  .pult__rody {
    flex-wrap: nowrap;
    width: calc(100% + 2 * var(--gutter));
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .pult__rod {
    flex: none;
  }
  .pult__poisk {
    max-width: none;
    margin-left: 0;
  }
  .stol {
    padding: 0;
  }
  .stol__poverhnost {
    aspect-ratio: auto;
    container-type: normal;
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding: 28px 16px 40px;
    background:
      linear-gradient(rgba(11, 9, 6, 0.35), rgba(11, 9, 6, 0.35)),
      #1a120b url('/media/chronicles/desk.webp') center top / 260% auto repeat-y;
  }
  .stol__svet,
  .stol__niti {
    display: none;
  }
  .stol__gruppa {
    position: static;
    width: auto;
  }
  .stol__yarlyk {
    margin-bottom: 12px;
    font-size: 0.85rem;
  }
  .stol__lica {
    order: 1;
  }
  .stol__karta {
    order: 2;
  }
  .stol__vyrezki {
    order: 3;
  }
  .stol__listy {
    order: 4;
  }
  .stol__kniga {
    order: 5;
  }
  .yarlyki {
    gap: 10px;
    margin-top: 14px;
  }
  .yarlyk {
    padding: 8px 14px 8px 26px;
    font-size: 0.95rem;
    clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  }
  .yarlyk::before {
    left: 10px;
    width: 6px;
  }
  .stol__eshchyo {
    margin-top: 12px;
    font-size: 0.95rem;
    min-height: 44px;
  }
  .listy {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .list {
    padding: 6px 6px 18px;
  }
  .list__imya {
    margin-top: 6px;
    font-size: 0.8rem;
  }
  .list__pechat {
    bottom: -9px;
  }
  .lica {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 14px;
  }
  .lico {
    padding: 6px 6px 0;
  }
  .lico__podpis {
    padding: 8px 2px 10px;
    font-size: 0.95rem;
  }
  .karta,
  .kniga {
    transform: none;
  }
  .karta {
    padding: 6px;
  }
  .karta__bulavki {
    inset: 6px;
  }
  .bulavka__golovka {
    width: 20px;
  }
  .bulavka__imya {
    font-size: 0.82rem;
    padding: 3px 8px;
  }
  .vyrezki {
    flex-direction: column;
    gap: 16px;
  }
  .vyrezka {
    flex: none;
    width: 100%;
    padding: 12px 14px 16px;
  }
  .vyrezka:nth-child(2) {
    margin-top: 0;
  }
  .vyrezka__shapka {
    font-size: 0.66rem;
  }
  .vyrezka__zag {
    font-size: 1.15rem;
    margin: 8px 0;
  }
  .vyrezka__tekst {
    font-size: 0.95rem;
  }
  .kniga {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .kniga__list {
    padding: 14px 16px;
  }
  .kniga__zag {
    margin: 4px 0;
    font-size: 1.2rem;
  }
  .kniga__pod {
    font-size: 0.9rem;
  }
  .stroka {
    grid-template-columns: 52px 1fr;
    column-gap: 12px;
    padding: 10px 2px;
    min-height: 64px;
  }
  .stroka img {
    width: 52px;
    height: 52px;
  }
  .stroka__imya {
    font-size: 1.02rem;
  }
  .stroka__slovo {
    font-size: 0.9rem;
  }
  .novoe,
  .stroka .novoe {
    top: -8px;
    right: -8px;
    width: 38px;
    font-size: 0.62rem;
  }
  .predmet:hover,
  .predmet:focus-visible {
    transform: rotate(0deg);
  }
}

/* ── Указатель ─────────────────────────────────────────────────── */

.ukazatel {
  max-width: 1600px;
  margin: 18px auto 0;
  padding: 0 var(--gutter);
}
.ukazatel[hidden],
.ukazatel__rod[hidden],
.ukazatel li[hidden] {
  display: none;
}
.ukazatel__rod + .ukazatel__rod {
  margin-top: 44px;
}
.ukazatel h2 {
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem);
  letter-spacing: 0.06em;
  color: var(--red);
}
.ukazatel ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.kartochka {
  display: grid;
  grid-template-columns: 112px 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: 16px;
  padding: 10px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.kartochka:hover,
.kartochka:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.kartochka img {
  grid-row: 1 / 4;
  align-self: start;
  width: 112px;
  height: 112px;
  object-fit: cover;
  filter: sepia(0.2);
}
.kartochka__rod {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.kartochka__rod b {
  color: var(--red);
  font-weight: 400;
}
.kartochka__imya {
  margin: 4px 0 6px;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}
.kartochka__slovo {
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--ink) 78%, var(--ink-soft));
}

/* ── Папка дела ────────────────────────────────────────────────── */

.papka {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper-ink);
  overflow: hidden;
}
.papka::backdrop {
  background: rgba(5, 4, 3, 0.72);
}
.papka[open] {
  animation: papka-vhod 420ms var(--ease-out);
}
@keyframes papka-vhod {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
.papka__list {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(20px, 5vw, 56px) 48px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.14), transparent 3%),
    var(--paper);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
}
.papka__verh {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  background: linear-gradient(var(--paper) 70%, transparent);
}
.papka__shtamp {
  display: inline-block;
  padding: 4px 12px;
  border: 2px solid var(--red-deep);
  color: var(--red-deep);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  transform: rotate(-3deg);
  opacity: 0.85;
}
.papka__zakryt {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(43, 33, 23, 0.35);
  background: none;
  color: var(--paper-ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.papka__zakryt:hover {
  background: rgba(43, 33, 23, 0.08);
}
.papka__kartina {
  margin: 4px 0 0;
  padding: 8px;
  background: #f4ecda;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 26px rgba(0, 0, 0, 0.2);
  transform: rotate(-0.6deg);
}
.papka__kartina img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 679;
  object-fit: cover;
  background: #2a1f14;
}
.papka__title {
  margin: 30px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
  color: var(--red-deep);
}
.papka__title:focus {
  outline: none;
}
.papka__tagline {
  margin: 12px 0 0;
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--paper-ink-soft);
}
.papka__tekst {
  max-width: 62ch;
  margin-top: 22px;
  font-size: clamp(1.08rem, 1rem + 0.25vw, 1.2rem);
  line-height: 1.68;
}
.papka__tekst p {
  margin: 0 0 1em;
}
.papka__tekst p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.1em 0 0;
  font-family: var(--font-display);
  font-size: 3.4em;
  line-height: 0.8;
  color: var(--red-deep);
}
.papka__sm {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid rgba(43, 33, 23, 0.25);
}
.papka__sm h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
}
.papka__sm ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.papka__sm a {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: background var(--t-fast), transform var(--t-fast);
}
.papka__sm a:hover,
.papka__sm a:focus-visible {
  background: rgba(255, 255, 255, 0.55);
  transform: translateY(-2px);
}
.papka__sm img {
  width: 64px;
  height: 64px;
  object-fit: cover;
}
.papka__sm span {
  font-weight: 700;
  line-height: 1.2;
}
.papka__sm small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-ink-soft);
}
.papka__niz {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 30px;
}
.papka__niz button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(43, 33, 23, 0.35);
  background: none;
  color: var(--paper-ink);
  font: inherit;
  cursor: pointer;
}
.papka__niz button:hover {
  background: rgba(43, 33, 23, 0.08);
}

/* ── Подвал ────────────────────────────────────────────────────── */

.podval {
  max-width: 1600px;
  margin: 64px auto 0;
  padding: 28px var(--gutter) 48px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.podval a {
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .predmet:hover,
  .predmet:focus-visible {
    transform: rotate(var(--naklon, 0deg));
  }
}

/* Ярлык карты отодвинут от лампы: её латунное основание лежит в том же углу. */
@media (min-width: 900px) {
  .stol__karta .stol__yarlyk {
    margin-left: 7cqw;
  }
}
