/* ============================================================
   kkkey.ttts — общий стиль. Ч/б авангард, mobile-first.
   ============================================================ */

:root {
  --ink: #0a0a0a;
  --paper: #f4f2ee;
  --ball: 68px; /* диаметр шарика-меню */
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* зерно поверх всего */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0.07;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2"/></filter><rect width="160" height="160" filter="url(%23n)"/></svg>');
}

::selection { background: var(--ink); color: var(--paper); }

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- верхняя плашка ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 150;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.topbar a { pointer-events: auto; text-decoration: none; }
.topbar .page { opacity: 0.75; }

/* ---------- шарик-меню ---------- */
.menu-ball {
  position: fixed;
  top: 0; left: 0;
  width: var(--ball);
  height: var(--ball);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  z-index: 310;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  will-change: transform;
  transition: scale 0.25s ease;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.menu-ball:active { scale: 0.92; }
.menu-ball .x { display: none; font-size: 22px; font-weight: 300; }
body.menu-open .menu-ball { background: var(--paper); color: var(--ink); }
body.sheet-open .menu-ball { z-index: 230; } /* под шторкой товара */
body.lb-open .menu-ball { z-index: 255; }   /* под открытой работой */
body.menu-open .menu-ball .label { display: none; }
body.menu-open .menu-ball .x { display: block; }

/* ---------- оверлей меню ---------- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  clip-path: circle(0px at 50% 50%);
  transition: clip-path 0.55s cubic-bezier(0.7, 0, 0.2, 1);
  visibility: hidden;
}
body.menu-open .menu-overlay { visibility: visible; }

.menu-overlay nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.menu-overlay nav a {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 8.5vw, 64px);
  line-height: 1.25;
  text-decoration: none;
  text-transform: lowercase;
  opacity: 0;
  translate: 0 18px;
  transition: opacity 0.3s ease, translate 0.3s ease;
}
body.menu-open .menu-overlay nav a {
  opacity: 1;
  translate: 0 0;
}
.menu-overlay nav a:nth-child(1) { transition-delay: 0.15s; }
.menu-overlay nav a:nth-child(2) { transition-delay: 0.21s; }
.menu-overlay nav a:nth-child(3) { transition-delay: 0.27s; }
.menu-overlay nav a:nth-child(4) { transition-delay: 0.33s; }
.menu-overlay nav a.current {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--paper);
}
.menu-overlay nav a:hover { font-style: italic; }
.menu-overlay .menu-contact {
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  opacity: 0;
  transition: opacity 0.3s ease 0.4s;
}
body.menu-open .menu-overlay .menu-contact { opacity: 0.8; }

/* ---------- главная ---------- */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 16px 8vh;
  position: relative;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 14vw, 160px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  word-break: break-word;
}
.hero .sub {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  max-width: 34ch;
  line-height: 1.6;
}
.hero .spin {
  position: absolute;
  top: 12vh;
  right: 8vw;
  width: min(38vw, 220px);
  animation: spin 24s linear infinite;
  opacity: 0.9;
}
@keyframes spin { to { rotate: 360deg; } }

.home-links {
  display: flex;
  flex-direction: column;
}
.home-links a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 26px 16px;
  border-bottom: 1.5px solid var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 7vw, 56px);
  text-transform: lowercase;
  transition: background 0.2s ease, color 0.2s ease;
}
.home-links a:first-child { border-top: 1.5px solid var(--ink); }
.home-links a small {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  font-weight: 400;
}
.home-links a:hover,
.home-links a:active {
  background: var(--ink);
  color: var(--paper);
}

.footer {
  padding: 40px 16px 110px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 2;
  letter-spacing: 0.06em;
}
.footer a { text-underline-offset: 3px; }

/* ---------- магазин: сцена с шарами ---------- */
.shop-page { overflow: hidden; height: 100dvh; }
.shop-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
/* платформа-стол: шары лежат на её верхней кромке */
.shop-floor {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: clamp(90px, 13vh, 130px);
  border-top: 2px solid var(--ink);
  background:
    repeating-linear-gradient(-45deg, var(--ink) 0 1.5px, transparent 1.5px 10px);
  pointer-events: none;
}

.tilt-btn {
  position: fixed;
  bottom: calc(clamp(90px, 13vh, 130px) + 18px);
  left: 50%;
  translate: -50% 0;
  z-index: 6;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
}

.ball-item {
  position: absolute;
  top: 0; left: 0;
  border-radius: 50%;
  /* белый диск, вещь вписана в круг целиком: 72% — самый большой
     квадрат, который влезает в круг, не обрезаясь по краям */
  background-color: #fff;
  background-size: 72%;
  background-repeat: no-repeat;
  background-position: center;
  border: 1.5px solid var(--ink);
  will-change: transform;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.ball-item .tag {
  position: absolute;
  left: 50%;
  bottom: 9%;
  translate: -50% 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: var(--ink);
  color: var(--paper);
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}
.ball-item.sold {
  opacity: 0.5;
  border-style: dashed;
}
.ball-item.sold::after {
  content: "sold out";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--paper);
  background: rgba(10, 10, 10, 0.55);
  border-radius: 50%;
  rotate: -12deg;
}

/* ---------- шторка товара ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(10, 10, 10, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 250;
  background: var(--ink);
  color: var(--paper);
  border-radius: 26px 26px 0 0;
  padding: 14px 22px calc(26px + env(safe-area-inset-bottom));
  /* +40px, чтобы карточка пряталась целиком и на десктопе, где у неё отступ снизу */
  translate: 0 calc(105% + 40px);
  transition: translate 0.42s cubic-bezier(0.7, 0, 0.2, 1);
  max-height: 82dvh;
  overflow-y: auto;
}
body.sheet-open .sheet { translate: 0 0; }
.sheet .grip {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--paper);
  opacity: 0.4;
  margin: 0 auto 18px;
}
/* фото-галерея сверху карточки: свайп по горизонтали */
.sheet .sheet-gallery-wrap {
  position: relative;
  margin: 0 -22px 18px;
}
.sheet .sheet-gallery {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.sheet .sheet-gallery::-webkit-scrollbar { display: none; }
.sheet .sheet-gallery .ph {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  scroll-snap-align: center;
  background-size: cover;
  background-position: center;
  filter: contrast(1.03);
  cursor: zoom-in;
}

/* просмотр фото почти на весь экран */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: rgba(10, 10, 10, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-viewer.open { display: flex; }
.photo-viewer img {
  max-width: 96vw;
  max-height: 92dvh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.photo-viewer .pv-count {
  position: absolute;
  top: 20px;
  left: 50%;
  translate: -50% 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--paper);
  opacity: 0.7;
}
.photo-viewer .pv-count:empty { display: none; }
.photo-viewer .pv-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1.5px solid var(--paper);
  background: none;
  color: var(--paper);
  font-size: 18px;
  cursor: pointer;
}
.photo-viewer .pv-nav { position: absolute; inset: 0; display: none; }
.photo-viewer.multi .pv-nav { display: flex; }
.photo-viewer .pv-nav button {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
}
.photo-viewer .pv-prev { cursor: w-resize; }
.photo-viewer .pv-next { cursor: e-resize; }
.sheet .sheet-count {
  position: absolute;
  right: 30px;
  bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 10px;
  border-radius: 999px;
}
.sheet .sheet-count:empty { display: none; }
.sheet h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 6vw, 30px);
  line-height: 1.1;
  text-transform: lowercase;
}
.sheet .price {
  font-family: var(--font-mono);
  font-size: 15px;
  margin-top: 6px;
}
.sheet .price .sold-label { opacity: 0.6; text-decoration: line-through solid 1.5px; }
.sheet .meta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.75;
}
.sheet .desc {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.55;
  max-width: 52ch;
}
.sheet .order-btn {
  display: block;
  margin-top: 22px;
  text-align: center;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 16px;
  border-radius: 999px;
}
.sheet .order-btn:active { opacity: 0.8; }
.sheet .order-btn.disabled {
  pointer-events: none;
  background: transparent;
  color: var(--paper);
  border: 1.5px dashed var(--paper);
  opacity: 0.6;
}

/* ---------- тату: бесконечное полотно ---------- */
.tattoo-page { overflow: hidden; height: 100dvh; }

.tt-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: var(--paper);
}
.tt-viewport.grabbing { cursor: grabbing; }

.tt-canvas {
  position: absolute;
  top: 0; left: 0;
  will-change: transform;
}

.tt-links {
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}

/* нода графа: точка + подпись, спозиционирована по центру */
.tt-node {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* появление каскадом + вечное лёгкое парение.
     translate/scale — отдельные свойства, не спорят с transform-позицией */
  animation: tt-in 0.36s cubic-bezier(0.2, 0.9, 0.3, 1) backwards,
             tt-float 7s ease-in-out infinite;
}
@keyframes tt-in {
  from { opacity: 0; scale: 0.3; }
  to   { opacity: 1; scale: 1; }
}
@keyframes tt-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -5px; }
}
.tt-node .dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  margin-left: -6.5px;
  margin-top: -6.5px;
}
.tt-node .cap {
  position: absolute;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.6;
}
.tt-node .cnt {
  position: absolute;
  top: -22px;
  left: 50%;
  translate: -50% 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  opacity: 0.4;
}
.tt-node.is-open .cap { opacity: 1; font-weight: 500; }
.tt-node.is-open .dot { background: var(--ink); }

/* невидимый хитбокс: узлы (кроме работ-листьев) ловят нажатие в
   круге ~1.8× шире самой точки — так в них проще попасть пальцем */
.tt-root::before,
.tt-year::before,
.tt-style::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  translate: -50% -50%;
  border-radius: 50%;
}
.tt-root::before  { width: 48px; height: 48px; }
.tt-year::before  { width: 40px; height: 40px; }
.tt-style::before { width: calc(var(--s, 24px) * 1.8); height: calc(var(--s, 24px) * 1.8); }

.tt-root .dot {
  width: 22px; height: 22px;
  margin-left: -11px; margin-top: -11px;
  background: var(--ink);
}
.tt-root .cap {
  top: 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0;
  opacity: 1;
  text-transform: lowercase;
}
.tt-year .dot { width: 17px; height: 17px; margin-left: -8.5px; margin-top: -8.5px; }
.tt-year .cap { font-size: 13px; }

/* узел стиля: размер задаётся в JS от числа работ (--s) */
.tt-style .dot {
  width: var(--s, 22px);
  height: var(--s, 22px);
  margin-left: calc(var(--s, 22px) / -2);
  margin-top: calc(var(--s, 22px) / -2);
  border-width: 2px;
}
.tt-style .cap { top: calc(var(--s, 22px) / 2 + 4px); }
.tt-style .cnt { top: calc(var(--s, 22px) / -2 - 16px); }

/* работа — мини-карточка: чёрный эскиз на белом */
.tt-work {
  width: 74px;
  height: 74px;
  margin-left: -37px;
  margin-top: -37px;
  background: #fff;
  border: 1.5px solid var(--ink);
  overflow: hidden;
}
.tt-work img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.04);
  pointer-events: none;
  -webkit-user-drag: none;
}
@media (hover: hover) {
  .tt-work:hover { outline: 3px solid var(--ink); }
  .tt-node:hover .cap { opacity: 1; }
}

/* карточка работы */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: var(--ink);
  color: var(--paper);
  display: none;
  flex-direction: column;
}
.lightbox.open { display: flex; }

.lightbox .lb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 20px;
}
.lightbox .lb-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: contrast(1.04);
}
/* зоны листания живут только поверх фото, текст под ними не блокируется */
.lightbox .lb-nav {
  position: absolute;
  inset: 0;
  display: flex;
}
.lightbox .lb-nav button {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
}

.lightbox .lb-info {
  flex: none;
  padding: 20px 22px calc(24px + env(safe-area-inset-bottom));
  border-top: 1.5px solid rgba(244, 242, 238, 0.25);
  max-height: 46dvh;
  overflow-y: auto;
}
.lightbox .lb-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  opacity: 0.55;
}
.lightbox .lb-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1.1;
  text-transform: lowercase;
  margin: 6px 0 10px;
}
.lightbox .lb-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1.5px solid var(--paper);
  border-radius: 999px;
  padding: 3px 12px;
}
.lightbox .lb-note {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.55;
  max-width: 60ch;
  opacity: 0.85;
}
.lightbox .lb-cta {
  display: inline-block;
  margin-top: 18px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 24px;
  border-radius: 999px;
}
.lightbox .lb-cta:active { opacity: 0.8; }

.lightbox .lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 3;
  background: var(--ink);
  border: 1.5px solid var(--paper);
  color: var(--paper);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
}

/* ---------- вики ---------- */
.wiki {
  max-width: 660px;
  margin: 0 auto;
  padding: 96px 20px 60px;
}
.wiki .lead {
  font-size: clamp(22px, 5.6vw, 32px);
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.wiki section {
  margin-top: 64px;
}
.wiki .num {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 14px;
}
.wiki h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 6.5vw, 40px);
  text-transform: lowercase;
  line-height: 1.1;
  margin-bottom: 18px;
}
.wiki p {
  font-size: 17px;
  line-height: 1.65;
  margin-bottom: 14px;
}
.wiki .facts {
  list-style: none;
  border-top: 1.5px solid var(--ink);
}
.wiki .facts li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.wiki .facts li span:last-child { text-align: right; }
/* картины на вики */
.wiki .painting-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--ink);
  border: 1.5px solid var(--ink);
  margin: 22px 0 14px;
}
.wiki .painting-grid figure {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--paper);
}
.wiki .painting-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.04);
}
.wiki .painting-grid figcaption {
  position: absolute;
  left: 6px;
  bottom: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  background: var(--ink);
  color: var(--paper);
  padding: 1px 6px;
}
.wiki .painting-note {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.55;
}

.wiki blockquote {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(20px, 5.5vw, 30px);
  line-height: 1.35;
  padding-left: 18px;
  border-left: 2px solid var(--ink);
  margin: 26px 0;
}

/* ---------- десктоп ---------- */
@media (min-width: 800px) {
  .topbar { padding: 20px 28px; font-size: 13px; }
  .hero { padding: 0 40px 10vh; }
  .home-links a { padding: 34px 40px; }
  .wiki { padding-top: 140px; }

  /* карточка работы: фото слева, текст колонкой справа */
  .lightbox { flex-direction: row; }
  .lightbox .lb-stage { padding: 40px; }
  .lightbox .lb-info {
    width: 400px;
    max-height: none;
    border-top: none;
    border-left: 1.5px solid rgba(244, 242, 238, 0.25);
    padding: 90px 34px 34px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .painting-grid { grid-template-columns: repeat(3, 1fr); }
  .sheet {
    left: auto;
    right: 28px;
    bottom: 28px;
    width: 520px;
    max-height: 88dvh;
    border-radius: 26px;
  }
  .sheet .sheet-gallery .ph { aspect-ratio: 1 / 1; } /* крупнее фото на десктопе */
  .footer { padding: 60px 40px 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero .spin { animation: none; }
  .tt-node { animation: none; }
}
