:root {
  /* Цвета */
  --color-bg: #e7dcc8;
  --color-ink: #1f1d18;
  --color-ink-soft: #5d574b;
  --color-accent: #3f4a2c;
  --color-line: rgba(31, 29, 24, 0.18);
  --color-card: #ddd0b8;
  --color-plate: #ddd1bb; /* плашки на странице купюры: чуть темнее фона */
  --color-chip: #c9c0af; /* плашка номинала и активный пункт переключателей */
  --color-switch-bg: rgba(231, 220, 200, 0.86);

  /* Шрифты */
  --font-head: "Manrope", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-text: "Manrope", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --tracking-text: -0.03em;
  --tracking-head: -0.02em;

  /* Размеры */
  --gutter: clamp(16px, 3.2vw, 48px);
  --size-display: clamp(44px, 9vw, 148px);
  --size-title: clamp(36px, 6vw, 96px);
  --size-text: 1rem;
  --size-small: 12px;
  --size-caption: 1rem;
  --line-tight: 0.92;
  --detail-width: 600px;
  --page-pad: 4rem; /* поля страницы купюры: заголовок занимает всю ширину между ними */
  --plate-width: 976px;
  --text-width: 880px;
  --title-overlap: 48px; /* на столько заголовок заезжает под купюру */
  --label-opacity: 0.75;
  --close-size: 40px;
  --radius-chip: 4px;
  --radius-switch: 8px;

  /* Слои */
  --z-stage: 0;
  --z-content: 1;
  --z-detail: 2;
  --z-ui: 3;
  --z-preloader: 4;
  --z-grain: 5;

  /* Плёнка шума */
  --grain-opacity: 0.06;
  --grain-size: 160px;

  /* Сетка без WebGL */
  --grid-min: 280px;
  --grid-gap: clamp(24px, 4vw, 56px);
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: var(--size-text);
  letter-spacing: var(--tracking-text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, figure, p, dl, dd { margin: 0; }

h1, h2 {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: var(--tracking-head);
}

button { font: inherit; letter-spacing: inherit; color: inherit; }

::selection { background: var(--color-accent); color: var(--color-bg); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Сцена и шум ---------- */

/* Дизеринг символами валют вокруг курсора — над фоном, под всем остальным */
.dither {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-stage);
  pointer-events: none;
}

.stage {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-stage);
  pointer-events: none;
}

.is-webgl .stage { display: block; }

/* На странице купюра лежит поверх текста: при прокрутке она прилипает к верху, а текст уходит под неё */
.is-webgl[data-view="detail"] .stage { z-index: var(--z-ui); }

html.is-over-note,
html.is-over-note * { cursor: grab; }

html.is-flipping,
html.is-flipping * {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  background-image: url("assets/noise.png");
  background-size: var(--grain-size) var(--grain-size);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}

/* ---------- Курс к доллару ---------- */

.rate-line {
  margin: 0;
  font-size: var(--size-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
  white-space: nowrap;
}

.rate-line:empty { display: none; }

/* Главная: под башней и под сценой — купюры при движении проходят поверх */
.home-rate { display: none; }

.is-webgl[data-view="wheel"]:not(.is-loading) .home-rate {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-stage);
  pointer-events: none;
}

.detail__rate { text-align: center; }

/* ---------- Прелоадер ---------- */

.preloader { display: none; }

.is-webgl.is-loading .preloader {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  align-items: flex-end;
  padding: var(--gutter);
  pointer-events: none;
}

.preloader__count {
  font-family: var(--font-head);
  font-size: var(--size-display);
  line-height: 0.8;
  letter-spacing: var(--tracking-head);
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Переключатели: вид и язык ---------- */

.segmented { display: none; }

.is-webgl .segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-switch-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-switch);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.is-webgl.is-loading .segmented { visibility: hidden; }

.segmented button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-switch) - 2px);
  background: transparent;
  padding: 8px 12px;
  font-size: var(--size-small);
  text-transform: uppercase;
  color: var(--color-ink-soft);
  cursor: pointer;
}

.segmented button:hover { color: var(--color-ink); }

.segmented button[aria-pressed="true"] {
  color: var(--color-ink);
  background: var(--color-chip);
}

/* Переключатель звука: волны — звук включён, крестик — выключен */
.segmented .sound__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
}
.sound__toggle[aria-pressed="true"] .sound__off,
.sound__toggle[aria-pressed="false"] .sound__waves { display: none; }

/* Правый верхний угол: вид коллекции, язык и звук */
.controls {
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  right: calc(var(--gutter) + env(safe-area-inset-right, 0px));
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Логотип и подпись по центру сверху, на одной высоте с переключателями */
.masthead { display: none; }

.is-webgl .masthead {
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: var(--z-ui);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--color-ink);
  pointer-events: none;
  transition: opacity 0.4s;
}

.masthead__logo {
  display: block;
  width: 217px;
  max-width: 50vw;
  height: auto;
  margin-top: 5px; /* центр логотипа на уровне центра переключателей */
}

.masthead__lead {
  display: flex;
  flex-direction: column;
  align-items: inherit; /* по центру на колесе, слева на карте — как у шапки */
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-ink-soft);
  white-space: nowrap;
}

/* Две строки подписи — отдельные элементы по ширине текста: каждая едет к своему месту
   при смене раскладки, а не перескакивает внутри общей строки */
.masthead__line {
  margin: 0;
  width: max-content;
}

.is-webgl.is-loading .masthead,
html[data-view="detail"] .masthead { opacity: 0; }

/* Прогресс колеса слева */
.wheel-progress {
  position: absolute;
  left: max(24px, env(safe-area-inset-left, 0px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.wheel-progress__tick {
  display: block;
  width: 52px;
  height: 1px;
  background: var(--color-ink);
  transform-origin: 0 50%;
  will-change: transform, opacity;
}

/* Телефон: прогресс справа, зеркально — черты растут от правого края */
.wheel-view__list.is-flat ~ .wheel-progress {
  left: auto;
  right: max(16px, env(safe-area-inset-right, 0px));
  align-items: flex-end;
  transform: none; /* top и height задаёт views.js */
  justify-content: space-between;
  gap: 0;
}

.wheel-view__list.is-flat ~ .wheel-progress .wheel-progress__tick {
  width: 40px;
  transform-origin: 100% 50%;
}

/* На странице купюры выбор вида не нужен */
html[data-view="detail"] .switcher { visibility: hidden; }

/* ---------- Колесо и карта ---------- */

.wheel-view,
.map-view { display: none; }

.is-webgl[data-view="wheel"] .wheel-view,
.is-webgl[data-view="map"] .map-view,
.is-webgl.is-transit .wheel-view,
.is-webgl.is-transit .map-view,
.is-webgl[data-view="detail"] .wheel-view.is-origin,
.is-webgl[data-view="detail"] .map-view.is-origin {
  display: block;
  position: fixed;
  inset: 0;
  z-index: var(--z-content);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.is-webgl.is-loading .wheel-view { visibility: hidden; }

/* Пока открыта купюра, исходный вид остаётся под ней для обратной анимации */
.is-webgl[data-view="detail"] .is-origin { pointer-events: none; }

/* Переход колесо ↔ карта: купюры улетают поверх въезжающей карты, лишнее прячется */
.is-webgl.is-transit .stage { z-index: var(--z-detail); }
.is-transit .home-rate { opacity: 0; }
.is-transit .switcher { pointer-events: none; }

/* На карте логотип и подпись — слева сверху (класс ставится в начале перехода,
   main.js переводит логотип и строки подписи с места на место) */
@media (min-width: 721px) {
  .is-webgl.is-map-layout .masthead {
    left: calc(var(--gutter) + env(safe-area-inset-left, 0px));
    transform: none;
    align-items: flex-start;
    text-align: left;
  }
  .is-map-layout .masthead__logo { margin-left: -8px; }
}

/* Карта */

.map-view__stage {
  position: absolute;
  inset: 0;
}

.map-view__globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.map-view.is-pointing .map-view__globe { cursor: pointer; }
.map-view.is-dragging,
.map-view.is-dragging * { cursor: grabbing; }

.map-view__badges {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Миниатюра собранной купюры на карте */
.map-badge {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
  transition: opacity 0.25s;
}

.map-badge.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.map-badge.is-hover { z-index: 1; }

.map-badge__thumb {
  display: block;
  width: 40px;
  height: 20px;
  object-fit: cover;
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(31, 29, 24, 0.35);
  transition: transform 0.25s;
}

.map-badge.is-hover .map-badge__thumb { transform: scale(1.15); }

/* Номинал над купюрой на глобусе: въезжает снизу с появлением, уезжает вверх с исчезанием */
.map-flag {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
}

.map-flag__in {
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}

.map-flag.is-shown { pointer-events: auto; }
.map-flag.is-shown .map-flag__in { opacity: 1; transform: none; }
.map-flag.is-leaving .map-flag__in { transform: translateY(-6px); }
.map-flag.no-anim .map-flag__in { transition: none; }

/* Купюра и номинал справа от страны в списке; клик открывает страницу купюры */
.map-pick {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.map-pick.is-shown {
  opacity: 1;
  pointer-events: auto;
}

.is-transit .map-pick { opacity: 0; }

.map-pick button,
.map-flag button {
  border: 0;
  font: 500 14px/1 var(--font-text);
  letter-spacing: var(--tracking-text);
  cursor: pointer;
}

.map-pick__thumb {
  display: block;
  margin-right: 8px;
  padding: 0;
  background: none;
}

.map-pick__thumb img {
  display: block;
  width: 60px;
  height: 30px;
  object-fit: cover;
  border-radius: 1px;
  box-shadow: 0 4px 10px rgba(31, 29, 24, 0.25);
}

.map-pick__chip,
.map-pick__arrow {
  padding: 5px 8px;
  border-radius: var(--radius-chip);
  background: var(--color-chip);
  color: var(--color-ink-soft);
  white-space: nowrap;
  transition: color 0.2s;
}

.map-pick__chip:hover,
.map-pick__arrow:hover { color: var(--color-ink); }

/* Подсказка над страной без купюры */
.map-tip {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--color-switch-bg);
  color: var(--color-ink);
  font: 400 14px/1.1 var(--font-text);
  letter-spacing: var(--tracking-text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.map-tip.is-shown { opacity: 1; }
.map-tip__name { font-weight: 600; }
.map-tip__currency { color: var(--color-ink-soft); }
.map-tip__note { color: var(--color-ink-soft); opacity: var(--label-opacity); }

/* Список стран по алфавиту */
.map-view__list {
  position: absolute;
  left: calc(var(--gutter) + env(safe-area-inset-left, 0px));
  top: 200px;
  bottom: 24px;
  width: 240px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  /* Скроллбара нет. Край, за которым есть ещё страны, уходит в прозрачность —
     так видно, что список прокручивается. Наверху градиент появляется после начала прокрутки,
     внизу исчезает, когда список докручен до конца (map.js ставит классы). */
  --fade: 64px;
  --fade-top: 0px;
  --fade-bottom: 0px;
  -webkit-mask-image: linear-gradient(transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
  mask-image: linear-gradient(transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
}

.map-view__list.has-more-above { --fade-top: var(--fade); }
.map-view__list.has-more-below { --fade-bottom: var(--fade); }

.map-view__list::-webkit-scrollbar { display: none; }

.map-view__country {
  display: inline-block;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: 500 16px/1.1 var(--font-text);
  letter-spacing: var(--tracking-text);
  text-align: left;
  cursor: pointer;
  transition: color 0.2s, transform 0.25s;
}

/* Наведение и выбранная страна: название темнеет до коричневого и сдвигается вправо */
.map-view__country.is-hover,
.map-view__country.is-open { color: #483920; }
.map-view__country.is-open { transform: translateX(8px); }

.wheel-chip {
  padding: 3px 8px;
  border-radius: var(--radius-chip);
  background: var(--color-chip);
  color: var(--color-ink-soft);
  font-family: var(--font-text);
  font-size: var(--size-caption);
  letter-spacing: var(--tracking-text);
  white-space: nowrap;
}

/* Колесо */

.wheel-view { cursor: ns-resize; }

.wheel-view__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wheel-item {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  transform-origin: 0 0;
  white-space: nowrap;
  will-change: transform, opacity;
  cursor: pointer;
}

.wheel-item__name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--wheel-font, 72px);
  line-height: 1.1;
  letter-spacing: var(--tracking-head);
  color: var(--color-ink-soft);
  transition: color 0.3s;
}

.wheel-item:hover .wheel-item__name,
.wheel-item.is-active .wheel-item__name { color: var(--color-ink); }

.wheel-item__tags {
  display: flex;
  gap: 4px;
  visibility: hidden;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

.wheel-item.is-active .wheel-item__tags {
  visibility: visible;
  opacity: 1;
  transform: none;
}

/* Телефон: список прямой, слева; название и номинал активной купюры — справа */
.wheel-view__info { display: none; }

/* Телефон: плашка с валютой — рядом с названием страны, справа ничего не дублируется */
.wheel-view__list.is-flat .wheel-chip--open { display: none; }

.wheel-view__list.is-flat .wheel-chip {
  max-width: 38vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wheel-view__list.is-flat + .wheel-view__info { display: none; }

.wheel-view__info.is-entering { animation: info-in 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes info-in {
  from { opacity: 0; transform: translateY(calc(-50% + 16px)); }
  to { opacity: 1; transform: translateY(-50%); }
}

.wheel-info__name { font-size: 1.25rem; font-weight: 500; line-height: 1.15; }

.wheel-chip--open {
  border: 0;
  cursor: pointer;
  color: var(--color-accent);
}

/* Прозрачная зона поверх купюры справа: клик открывает её страницу */
.wheel-view__hit {
  position: absolute;
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

/* ---------- Страница купюры ---------- */

.detail {
  position: relative;
  z-index: var(--z-detail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  min-height: 100vh;
  /* место под фиксированный крестик + отступ */
  padding-top: calc(var(--gutter) + env(safe-area-inset-top, 0px) + var(--close-size) + 24px);
  padding-bottom: 160px;
  padding-left: max(var(--page-pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-pad), env(safe-area-inset-right, 0px));
}

.detail[hidden] { display: none; }

.detail__controls {
  width: min(var(--detail-width), 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.detail__close {
  /* fixed, а не sticky: на iOS sticky-кнопка под WebGL-сценой пропадала при прокрутке */
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: calc(50% - var(--close-size) / 2);
  z-index: 1;
  appearance: none;
  width: var(--close-size);
  height: var(--close-size);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-ink);
  border-radius: 50%;
  background: var(--color-bg); /* текст уходит под крестик при прокрутке */
  color: var(--color-ink);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.detail__close:hover { background: var(--color-ink); color: var(--color-bg); }

.detail__nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.detail__step {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  background: none;
  font-size: var(--size-text);
  color: var(--color-ink);
  cursor: pointer;
}

.detail__step { white-space: nowrap; }
.step-short { display: none; }

.detail__step:hover span { text-decoration: underline; text-underline-offset: 4px; }

/* Место купюры в потоке страницы: 3D-купюра встаёт на него и прилипает к верху при прокрутке */
.detail__note {
  width: min(var(--detail-width), 100%);
  aspect-ratio: var(--note-aspect, 2);
}

/* Подсказка у курсора */
.flip-hint {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-preloader);
  margin: 0;
  padding: 6px 10px;
  border-radius: var(--radius-chip);
  background: var(--color-ink);
  color: var(--color-bg);
  font-size: var(--size-small);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}

.flip-hint.is-visible { opacity: 1; }

.detail__body {
  width: 100%;
  display: grid;
  margin-top: calc(-1 * (var(--title-overlap) + 24px)); /* 24px — зазор между блоками страницы */
}

.detail__body > * { grid-area: 1 / 1; min-width: 0; }

.detail-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 64px;
}

/* Заголовок во всю ширину: размер шрифта подбирает main.js */
.detail-title {
  width: 100%;
  font-family: var(--font-text);
  font-weight: 500;
  letter-spacing: var(--tracking-text);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  margin-bottom: -24px;
}

.detail-title > span {
  display: inline-block;
  transform-origin: 50% 0;
}

.label {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 400;
  letter-spacing: var(--tracking-text);
  font-size: var(--size-small);
  text-transform: uppercase;
  opacity: var(--label-opacity);
}

/* Плашки: основные данные и источники */
.plate {
  width: min(var(--plate-width), 100%);
  padding: 40px 48px;
  background: var(--color-plate);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.plate__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.plate__facts > div,
.plate__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plate__facts dd { font-size: 1.125rem; line-height: 1.3; font-weight: 600; }

.plate__summary {
  padding-top: 28px;
  border-top: 1px solid var(--color-line);
}

.plate__summary p:last-child { font-size: 1.125rem; line-height: 1.4; font-weight: 600; }

/* История о том, как купюра попала в коллекцию: подпись как у фактов, текст обычным начертанием */
.plate__story p:last-child { font-weight: 400; }

/* Разделы текста */
.detail-sections {
  width: min(var(--text-width), 100%);
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-section h2 {
  font-family: var(--font-text);
  font-size: clamp(1.75rem, 2.6vw, 2.25rem);
  font-weight: 500;
  letter-spacing: var(--tracking-text);
  line-height: 1.15;
  text-wrap: balance;
}

.detail-section p,
.detail-list p,
.detail-people dd {
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 68ch;
}

.detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: detail;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-list li { counter-increment: detail; }

.detail-list h3,
.detail-people dt {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
}

.detail-list h3::before { content: counter(detail) ". "; }

.detail-people {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-placeholder { color: var(--color-ink-soft); }

/* Источники */
.sources__group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sources__group ol {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.5;
}

.sources__group a {
  color: var(--color-ink);
  text-decoration-color: var(--color-line);
  text-underline-offset: 3px;
}

.sources__group a:hover { text-decoration-color: currentColor; }

.sources__note { color: var(--color-ink-soft); }

/* ---------- Список: резервная сетка без WebGL и текст для скринридеров ---------- */

.fallback { padding: var(--gutter); }

.collection {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: var(--grid-gap);
}

.note figure { display: flex; flex-direction: column; gap: 12px; }

.note img {
  display: block;
  width: 100%;
  height: auto;
}

.note__name { font-size: clamp(28px, 3vw, 40px); line-height: 1; }
.note__caption { color: var(--color-accent); }
.note__quote { color: var(--color-ink-soft); }

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

/* ---------- Обо мне ---------- */

.about-link { display: none; }

.is-webgl:not(.is-loading):is([data-view="wheel"], [data-view="map"]) .about-link {
  display: block;
  position: fixed;
  right: calc(var(--gutter) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-ui);
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: 500 1.125rem/1.2 var(--font-text);
  letter-spacing: var(--tracking-text);
  cursor: pointer;
  transition: opacity 0.3s;
}

.about-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.is-transit .about-link,
.is-about .about-link { opacity: 0; pointer-events: none; }

/* На телефоне крестик окна встаёт на место заголовка — заголовок прячем */
@media (max-width: 720px) {
  .is-about .masthead { opacity: 0; }
}

.about {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
}

.about[hidden] { display: none; }

/* Прозрачная подложка: клик мимо окна закрывает его */
.about__backdrop {
  position: absolute;
  inset: 0;
}

.about__close {
  position: absolute;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: calc(50% - var(--close-size) / 2);
  z-index: 1;
  width: var(--close-size);
  height: var(--close-size);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-ink);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-ink);
  cursor: pointer;
}

.about__close:hover { background: var(--color-ink); color: var(--color-bg); }

.about__panel {
  position: absolute;
  left: 50%;
  --about-top: calc(var(--gutter) + var(--close-size) + 32px + env(safe-area-inset-top, 0px));
  --about-bottom: calc(var(--gutter) + 40px + env(safe-area-inset-bottom, 0px));
  top: var(--about-top);
  width: min(1000px, calc(100% - 2 * var(--gutter)));
  max-height: calc(100% - var(--about-top) - var(--about-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 20px 36px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 24px;
  background: #e4d9c6;
  box-shadow: 0 30px 80px rgba(31, 29, 24, 0.22), 0 0 0 1px rgba(31, 29, 24, 0.06);
  color: var(--color-ink);
}

.about__panel::-webkit-scrollbar { display: none; }

.about__photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1496 / 552;
  object-fit: cover;
  border-radius: 16px;
  flex-shrink: 0;
}

.about__text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 1.125rem;
  line-height: 1.4;
  letter-spacing: var(--tracking-text);
}

.about__text p { margin: 0; }

.about__socials {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.about__socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #1e170c;
  transition: background 0.2s;
}

.about__socials a:hover { background: rgba(31, 29, 24, 0.08); }
.about__socials svg { width: 40px; height: 40px; }

/* ---------- Lenis ---------- */

html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }

/* ---------- Мобильный ---------- */

@media (max-width: 720px) {
  /* Узкий экран: короткие подписи, чтобы стрелки и курс уместились в одну строку */
  .step-long { display: none; }
  .step-short { display: inline; }

  /* Телефон: вид коллекции остаётся внизу, логотип меньше */
  .switcher {
    position: fixed;
    left: 50%;
    bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
  }
  .masthead__logo { width: 172px; transform: translate(-8px, 4px); } /* 150px + 15% */
  .masthead__lead { font-size: 12px; }
  .is-webgl .masthead { left: max(16px, env(safe-area-inset-left, 0px)); transform: none; align-items: flex-start; text-align: left; }

  /* Карта на телефоне: глобус сверху, под ним список в две колонки */
  .map-view__list {
    top: var(--list-top, 60vh);
    right: max(16px, env(safe-area-inset-right, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(var(--rows, 23), auto);
    grid-auto-flow: column;
    align-content: start;
    column-gap: 16px;
  }
  .map-view__country { font-size: 14px; }

  /* Обо мне: кнопка справа от переключателя видов, окно почти на весь экран */
  .is-webgl:not(.is-loading):is([data-view="wheel"], [data-view="map"]) .about-link {
    bottom: calc(var(--gutter) + 10px + env(safe-area-inset-bottom, 0px));
    font-size: 0.875rem;
  }
  .about__panel {
    --about-top: calc(var(--gutter) + var(--close-size) + 16px + env(safe-area-inset-top, 0px));
    --about-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    padding: 12px 12px 28px;
    gap: 20px;
    border-radius: 20px;
  }
  .about__photo { aspect-ratio: 4 / 3; border-radius: 12px; }
  .about__text { font-size: 1rem; }
  /* У выбранной страны в списке — только купюра; номинал висит над её миниатюрой на глобусе */
  .map-pick .map-pick__chip,
  .map-pick .map-pick__arrow,
  .map-flag .map-pick__arrow { display: none; }

  .plate { padding: 28px 20px; }
  .plate__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  :root {
    --page-pad: 16px;
    --title-overlap: 10px;
    --size-title: clamp(34px, 11vw, 56px);
    --grid-min: 100%;
  }
}
