/* Страница /patrons. Полотно во весь экран, поверх него подсказки. */

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

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('/fonts/unbounded-latin.woff2') format('woff2');
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', sans-serif;
  background-color: #f5f0ea;
  background-image:
    radial-gradient(ellipse 90% 55% at 15% -5%,  rgba(242,114,192,0.16) 0%, transparent 65%),
    radial-gradient(ellipse 70% 55% at 88% 10%,  rgba(242,114,192,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 75% 60% at 50% 105%, rgba(242,114,192,0.11) 0%, transparent 60%);
  color: #1a1412;
}

a:focus-visible, button:focus-visible {
  outline: 3px solid #d44fa8;
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── ШАПКА ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  background: rgba(245,240,234,0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(26,20,18,0.06);
  pointer-events: auto;
}
.nav-logo {
  font-family: 'Unbounded', sans-serif;
  font-size: .95rem;
  font-weight: 900;
  letter-spacing: .16em;
  color: #1a1412;
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-link {
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(26,20,18,.55);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: #1a1412; }

/* ── ПОЛОТНО ── */
#web {
  position: fixed;
  inset: 0;
  /* canvas это замещаемый элемент: без явных размеров он остаётся
     в своих дефолтных 300x150 и inset его не растягивает */
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#web.dragging { cursor: grabbing; }

/* ── ЗАГОЛОВОК ПОВЕРХ ── */
.overlay {
  position: fixed;
  left: 26px;
  bottom: 26px;
  z-index: 10;
  max-width: 340px;
  padding: 20px 22px;
  border-radius: 22px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 4px 32px rgba(0,0,0,0.07);
}
.overlay h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.overlay p {
  font-size: .78rem;
  line-height: 1.5;
  color: rgba(26,20,18,.62);
  margin-bottom: 14px;
}
.ov-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.ov-stat { display: flex; flex-direction: column; gap: 2px; }
.ov-val {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -.02em;
}
.ov-key {
  font-size: .5rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(26,20,18,.5);
  font-weight: 600;
}
.ov-note {
  margin-top: 12px;
  font-size: .58rem;
  letter-spacing: .06em;
  color: rgba(26,20,18,.42);
}

/* ── ЛЕГЕНДА ── */
.legend {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 10;
  max-height: 62vh;
  overflow-y: auto;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 4px 32px rgba(0,0,0,0.07);
  scrollbar-width: thin;
}
.legend-title {
  font-size: .5rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(26,20,18,.45);
  margin-bottom: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  width: 100%;
  text-align: left;
  transition: opacity .2s;
}
.legend-item:hover { opacity: .6; }
.legend-item.dim { opacity: .3; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-n {
  margin-left: auto;
  font-size: .6rem;
  color: rgba(26,20,18,.45);
  font-weight: 500;
  padding-left: 10px;
}

/* ── ПОДСКАЗКА ── */
.tip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(26,20,18,0.92);
  color: #f5f0ea;
  font-size: .72rem;
  line-height: 1.45;
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
  opacity: 0;
  transition: opacity .12s;
  max-width: 260px;
}
.tip.show { opacity: 1; }
.tip-name { font-weight: 700; margin-bottom: 4px; }
.tip-cols { color: rgba(245,240,234,.7); font-size: .66rem; }
.tip-hint {
  margin-top: 6px;
  font-size: .56rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(242,114,192,.9);
}

/* ── КНОПКИ МАСШТАБА ── */
.zoom {
  position: fixed;
  right: 26px;
  top: 84px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom button {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 1rem;
  font-weight: 700;
  color: #1a1412;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0,0,0,0.06);
  transition: transform .15s, background .15s;
  font-family: 'Inter', sans-serif;
}
.zoom button:hover { transform: translateY(-1px); background: rgba(255,255,255,0.95); }
.zoom button:active { transform: translateY(0); }

.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(26,20,18,.4);
  z-index: 5;
}

@media (max-width: 780px) {
  /* Шапка в две строки: логотип сверху, ссылки прокручиваемой строкой. */
  .nav { padding: 10px 14px; flex-wrap: wrap; row-gap: 8px; }
  .nav-logo { font-size: .85rem; }
  .nav-links {
    width: 100%;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { font-size: .58rem; }

  /* Легенда становится лентой чипов под шапкой, а не панелью поверх графа. */
  .legend {
    left: 0; right: 0; top: 74px;
    bottom: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    scrollbar-width: none;
  }
  .legend::-webkit-scrollbar { display: none; }
  .legend-title { display: none; }
  /* чипы лежат во вложенном блоке, флекс нужен именно ему */
  #legendItems { display: flex; gap: 8px; }
  .legend-item {
    width: auto;
    flex: 0 0 auto;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 100px;
    background: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.9);
    font-size: .58rem;
    white-space: nowrap;
  }
  .legend-n { margin-left: 4px; padding-left: 0; font-size: .54rem; }

  .overlay {
    left: 10px; right: 10px; bottom: 10px;
    max-width: none;
    padding: 13px 15px;
    border-radius: 16px;
  }
  .overlay h1 { font-size: 1.05rem; margin-bottom: 5px; }
  .overlay p { font-size: .68rem; line-height: 1.4; margin-bottom: 9px; }
  .ov-stats { gap: 14px; }
  .ov-val { font-size: .9rem; }
  .ov-note { margin-top: 8px; font-size: .52rem; }
  .zoom { display: none; }
  .tip { max-width: 210px; font-size: .66rem; padding: 10px 12px; }
}
