/* ===== Чабань Tea Bao: посуда в cel-shading стиле (толстый контур, жёсткие тени, штриховка) ===== */
.teaware {
  --tw-ink: #140c07;
  --tw-paper: #f3e3c0;
  --tw-gold: #f4c86a;
  --tw-red: #c8402a;
  --tw-side: max(24px, calc((100vw - 1160px) / 2));
  position: absolute;
  z-index: 4;
  right: var(--tw-side);
  bottom: 96px;
  width: min(660px, calc(100vw - 2 * var(--tw-side) - 500px));
}

/* старая контурная картинка уступает место чабани */
.hero.has-chaban .hero-scene { display: none; }

.tw-stage {
  position: relative;
  perspective: 1400px;
}
.tw-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130%;
  aspect-ratio: 1;
  translate: -50% -50%;
  background:
    radial-gradient(circle, rgba(244, 200, 106, .16), transparent 46%),
    repeating-conic-gradient(from 0deg, rgba(244, 200, 106, .06) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 14%, transparent 56%);
  mask: radial-gradient(circle, #000 14%, transparent 56%);
  animation: tw-spin 90s linear infinite;
  will-change: transform;
  pointer-events: none;
}
.tw-hint {
  position: absolute;
  z-index: 2;
  top: -6px;
  left: 50%;
  translate: -50% 0;
  padding: 5px 11px 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tw-ink);
  background: var(--tw-gold);
  border: 2.5px solid var(--tw-ink);
  box-shadow: 3px 3px 0 var(--tw-ink);
  transform: rotate(-2deg);
  pointer-events: none;
  transition: opacity .3s;
}
.teaware:has(.tw-card:not([hidden])) .tw-hint { opacity: 0; }
.tw-hint-touch { display: none; }
@media (hover: none) {
  .tw-hint-desk { display: none; }
  .tw-hint-touch { display: inline; }
}
.tw-scene {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--tw-rx, 0deg)) rotateY(var(--tw-ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.tw-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}

/* ---- hit targets ---- */
.tw-hit { cursor: pointer; outline: none; }
.tw-hit { transition: opacity .3s ease; }
.tw-svg.has-active .tw-item:not(.is-active) { opacity: .5; }
.tw-svg.has-active.tray-active .tw-item { opacity: 1; }
.tw-tray-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .5s cubic-bezier(.34, 1.7, .5, 1);
}
.tw-tray.is-active .tw-tray-body { transform: translateY(-5px) scale(1.015); }

/* idle bob + "надувание" */
.tw-float, .tw-body, .tw-shadow, .tw-burst, .tw-steam {
  transform-box: fill-box;
}
.tw-float {
  transform-origin: 50% 100%;
  animation: tw-bob 4.2s ease-in-out infinite;
}
.tw-item[data-tw="budai"] .tw-float { animation: tw-sway 5s ease-in-out infinite; }
.tw-item[data-tw="pitcher"] .tw-float { animation-delay: -1.4s; }
.tw-item[data-tw="cup"] .tw-float { animation-delay: -2.6s; }
.tw-item[data-tw="gaiwan"] .tw-float { animation-delay: -.7s; }
.tw-item[data-tw="chahe"] .tw-float { animation-delay: -3.3s; }
.tw-week-tag {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: tw-tag-swing 3.6s ease-in-out infinite;
}
.tw-item[data-tw="chahe"].is-active .tw-week-tag { animation-duration: .9s; }
@keyframes tw-tag-swing {
  0%, 100% { rotate: 0deg; }
  50% { rotate: 2.5deg; }
}

.tw-body {
  transform-origin: 50% 100%;
  transition: transform .55s cubic-bezier(.3, 2.1, .5, 1);
}
.tw-item.is-active .tw-body { transform: translateY(-10px) scale(1.24); }
.tw-item.is-active .tw-float { animation: tw-jelly 1.5s ease-in-out infinite; }
.tw-item[data-tw="budai"].is-active .tw-float { animation: tw-jelly 1.2s ease-in-out infinite; }

.tw-shadow {
  transform-origin: 50% 50%;
  transition: transform .45s ease, opacity .45s ease;
}
.tw-item.is-active .tw-shadow { transform: scale(.78); opacity: .28; }

.tw-burst {
  transform-origin: 50% 50%;
  transform: scale(.2) rotate(-20deg);
  opacity: 0;
  transition: transform .5s cubic-bezier(.3, 1.9, .5, 1), opacity .25s ease;
  pointer-events: none;
}
.tw-item.is-active .tw-burst { transform: scale(1.18) rotate(0deg); opacity: 1; }

.tw-steam {
  transform-origin: 50% 100%;
  animation: tw-steam 3.2s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  opacity: 0;
  pointer-events: none;
}

/* ---- product card ---- */
.tw-card {
  position: absolute;
  z-index: 5;
  width: min(310px, calc(100% - 24px));
  padding: 16px 16px 14px;
  text-align: left;
  color: var(--tw-ink);
  background:
    radial-gradient(rgba(20, 12, 7, .09) 1px, transparent 1.3px) 0 0 / 6px 6px,
    var(--tw-paper);
  border: 4px solid var(--tw-ink);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  filter: drop-shadow(6px 7px 0 var(--tw-ink));
  transform-origin: var(--tw-ox, 50%) 100%;
  animation: tw-card-in .5s cubic-bezier(.3, 1.8, .5, 1) both;
  will-change: transform, opacity;
  pointer-events: auto;
}
.tw-card.is-leaving {
  animation: tw-card-out .2s ease-in both;
  pointer-events: none;
}
.tw-card[data-below] { transform-origin: var(--tw-ox, 50%) 0; }
.tw-card[hidden] { display: none; }
.tw-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.tw-card-zh {
  flex: 0 0 auto;
  padding: 4px 6px 3px;
  font: 700 15px/1 "Noto Serif SC", "Songti SC", serif;
  color: #fff6e7;
  background: var(--tw-red);
  border: 2.5px solid var(--tw-ink);
  transform: rotate(-4deg);
}
.tw-card-kicker {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7a4a1d;
}
.tw-card h3 {
  margin: 0 0 2px;
  font-family: "Russo One", Impact, "Arial Black", sans-serif;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.tw-card-sub {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #6b4a2a;
}
.tw-card-text {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.45;
}
.tw-card-specs {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.tw-card-specs li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(20, 12, 7, .08);
  border-left: 4px solid var(--tw-ink);
}
.tw-card-specs b { font-weight: 800; text-align: right; }
.tw-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--tw-gold);
  background: var(--tw-ink);
  border: 2.5px solid var(--tw-ink);
  transition: transform .2s cubic-bezier(.3, 2, .5, 1), background .2s;
}
.tw-card-btn:hover, .tw-card-btn:focus-visible { transform: translateY(-2px) rotate(-1deg); background: #2b1a0d; }
.tw-card-btn.is-ghost { color: var(--tw-ink); background: transparent; }
.tw-card-btn.is-ghost:hover { background: rgba(20, 12, 7, .08); }
/* ---- карточка «Чай недели» (чахэ) ---- */
.tw-week-head {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: center;
  margin: 2px 0 10px;
}
.tw-week-head h3 { margin-top: 0; }
.tw-week-head .tw-card-sub { margin-bottom: 8px; }
.tw-week-photo {
  position: relative;
  border: 3px solid var(--tw-ink);
  box-shadow: 4px 4px 0 var(--tw-ink);
  background: #f3efe6;
  rotate: -1deg;
  overflow: hidden;
}
.tw-week-photo img {
  display: block;
  width: 100%;
  height: 98px;
  object-fit: cover;
  filter: contrast(1.08) saturate(1.05);
}
.tw-week-sale {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 6px 1px;
  font: 400 13px/1.2 "Russo One", Impact, "Arial Black", sans-serif;
  color: var(--tw-ink);
  background: #f4c86a;
  border: 3px solid var(--tw-ink);
  box-shadow: 3px 3px 0 var(--tw-ink);
  rotate: 6deg;
}
.tw-week-notes {
  margin: -4px 0 10px;
  font-size: 13px;
  line-height: 1.4;
}
.tw-week-notes span {
  margin-right: 4px;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tw-week-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
}
.tw-week-price b { font: 400 20px/1 "Russo One", Impact, "Arial Black", sans-serif; }
.tw-week-price del { font-size: 14px; font-weight: 700; opacity: .55; }
.tw-week-out { font-size: 12px; font-weight: 800; color: #9c2f1c; }
.tw-card.is-weekly .tw-card-text { margin-bottom: 8px; }

.tw-card-close {
  position: absolute;
  top: 6px;
  right: 12px;
  width: 28px;
  height: 28px;
  font: 900 20px/1 system-ui, sans-serif;
  color: var(--tw-ink);
  background: none;
  border: 0;
  cursor: pointer;
  display: none;
}

/* до 900px: чабань идёт в потоке под текстом, карточка — под ней */
@media (max-width: 900px) {
  .teaware {
    position: relative;
    right: auto;
    bottom: auto;
    width: min(560px, 100%);
    margin: 18px auto 6px;
  }
  .hero.has-chaban { min-height: 0; }
}
@media (max-width: 700px) {
  .tw-card {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: auto;
    margin: 12px 0 0;
    transform-origin: 50% 0;
  }
  .tw-card-close { display: block; }
  .tw-card h3 { font-size: 23px; padding-right: 26px; }
  .tw-hint { font-size: 10px; top: -10px; }
}

/* ---- keyframes ---- */
@keyframes tw-spin { to { rotate: 360deg; } }
@keyframes tw-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes tw-sway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg) translateY(-2px); }
}
@keyframes tw-jelly {
  0%, 100% { transform: scale(1, 1); }
  25% { transform: scale(1.035, .965); }
  50% { transform: scale(.975, 1.03) translateY(-3px); }
  75% { transform: scale(1.02, .98); }
}
@keyframes tw-steam {
  0% { opacity: 0; transform: translateY(10px) scaleY(.7); }
  25% { opacity: .95; }
  70% { opacity: .55; }
  100% { opacity: 0; transform: translateY(-26px) scaleY(1.1); }
}
@keyframes tw-card-out {
  from { opacity: 1; transform: scale(1) rotate(-1.2deg); }
  to { opacity: 0; transform: scale(.82) rotate(-4deg); }
}
@keyframes tw-card-in {
  0% { opacity: 0; transform: scale(.35) rotate(-7deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: scale(1) rotate(-1.2deg); }
}

.teaware.is-offscreen .tw-float,
.teaware.is-offscreen .tw-steam,
.teaware.is-offscreen .tw-rays { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .tw-float, .tw-steam, .tw-rays, .tw-item.is-active .tw-float { animation: none; }
  .tw-steam { opacity: .7; }
  .tw-scene { transform: none !important; }
  .tw-card { animation-duration: .01s; }
  .tw-week-tag { animation: none; }
}

/* Нет чая недели — табличку на чахэ не показываем */
.tw-no-weekly .tw-week-tag { display: none; }

/* На компьютере карточка не мешает водить мышкой: сквозь неё видны и
   наводятся предметы сцены, «ловят» курсор только кнопки карточки. */
@media (hover: hover) and (min-width: 701px) {
  .tw-card { pointer-events: none; }
  .tw-card a, .tw-card button { pointer-events: auto; }
}

/* Широкий экран: сцена чуть левее, карточка поуже — она открывается справа
   от предметов и не закрывает их. */
@media (min-width: 1100px) {
  .teaware { translate: -70px 0; }
  .tw-card { width: 280px; }
}

/* Пакет «Набор для знакомства» справа от чабани (только на широком экране). */
.tw-pouch { display: none; }
@media (min-width: 1360px) {
  .tw-pouch {
    display: block;
    position: absolute;
    z-index: 3;
    left: calc(100% + 6px);
    bottom: 8px;
    width: clamp(150px, calc(var(--tw-side) + 50px), 200px);
    color: inherit;
    text-decoration: none;
    transform-origin: 50% 100%;
    animation: tw-pouch-in .7s cubic-bezier(.3, 1.6, .5, 1) .3s backwards;
  }
  .tw-pouch svg { display: block; width: 100%; height: auto; overflow: visible; transition: transform .35s cubic-bezier(.3, 1.8, .5, 1); }
  .tw-pouch:hover svg, .tw-pouch:focus-visible svg { transform: translateY(-6px) rotate(-3deg) scale(1.04); }
  .tw-pouch-tag {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 6px);
    translate: -50% 0;
    white-space: nowrap;
    padding: 5px 10px 6px;
    font: 800 11px/1 "Russo One", Impact, sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tw-ink);
    background: var(--tw-gold);
    border: 3px solid var(--tw-ink);
    box-shadow: 3px 3px 0 var(--tw-ink);
    rotate: -3deg;
    opacity: 0;
    transition: opacity .2s, translate .25s;
    pointer-events: none;
  }
  .tw-pouch:hover .tw-pouch-tag, .tw-pouch:focus-visible .tw-pouch-tag { opacity: 1; translate: -50% -6px; }
}
@keyframes tw-pouch-in { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tw-pouch { animation: none; } }
/* Пока открыта карточка посуды, пакет уходит, чтобы не перекрывать её. */
.tw-pouch { transition: opacity .2s ease, translate .25s ease; }
.teaware:has(.tw-card:not([hidden]):not(.is-leaving)) .tw-pouch { opacity: 0; translate: 14px 0; pointer-events: none; }
