/* Движение интерфейса — один язык для сайта и мини-приложения.
   Наклейка: при наведении приподнимается, при нажатии вдавливается в тень и пружинит обратно,
   жёлтая ловит блик. Выбор чипа — короткий «щелчок», вкладка въезжает каскадом, лист выезжает на пружине.
   Подключается после site.css/app.css. Всё отключается при prefers-reduced-motion. */

:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);   /* отскок при отпускании */
  --out: cubic-bezier(.22, 1, .36, 1);         /* быстрое начало, мягкая посадка */
  --press: .06s;                               /* вдавливание — почти мгновенно */
  --release: .26s;                             /* возврат — с отскоком */
}

/* ---------- главные кнопки ---------- */
/* блик — фоновый градиент, а не псевдоэлемент с overflow:hidden (тот позволял grid сжать кнопку уже текста) */
.btn { background-image: linear-gradient(100deg, transparent 42%, rgb(255 255 255 / .6) 50%, transparent 58%);
  background-size: 250% 100%; background-position: 150% 0; background-repeat: no-repeat;
  transition: transform var(--release) var(--spring), box-shadow var(--release) var(--spring), background-color .14s; }
.btn:active { transition-duration: var(--press); transition-timing-function: ease-out; }
@media (hover: hover) {
  .btn:hover:not([disabled]) { animation: shine .62s var(--out); }
  .btn svg { transition: transform var(--release) var(--spring); }
  .btn:hover svg { transform: translateX(2px) rotate(-6deg) scale(1.08); }
}
@keyframes shine { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* занятая кнопка (форма отправляется) — бегущая штриховка, а не мёртвая серость */
.btn[disabled][aria-busy="true"], form[aria-busy="true"] .btn[type="submit"] {
  background-image: repeating-linear-gradient(-45deg, rgb(22 24 29 / .1) 0 8px, transparent 8px 16px);
  background-size: 22.6px 22.6px; animation: busy .6s linear infinite; }
@keyframes busy { to { background-position: 22.6px 0; } }

/* ---------- мелкие кнопки, чипы, сегменты ---------- */
.look-chip, .look-tabs button, .look-sw button, .seg button, .decor-btn, .vote-btn, .town-opt, .sheet-x,
.board-btn, .map3d-btns button, .map3d-stk button, .views-tabs button, .map3d-find button, .link-btn, .bd-opt, .chat-more {
  transition: transform var(--release) var(--spring), box-shadow var(--release) var(--spring),
    background-color .16s ease, color .16s ease, outline-offset .2s var(--spring); }
.look-chip:active, .look-tabs button:active, .look-sw button:active, .seg button:active, .decor-btn:active,
.vote-btn:active, .sheet-x:active, .board-btn:active, .map3d-btns button:active, .map3d-stk button:active,
.views-tabs button:active, .map3d-find button:active, .bd-opt:active, .chat-more:active {
  transform: translateY(1px) scale(.95); transition-duration: var(--press); }
@media (hover: hover) {
  .look-chip:hover:not(:disabled):not([aria-pressed="true"]),
  .decor-btn:hover:not(.on), .vote-btn:hover:not(.on), .bd-opt:hover {
    transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
  .look-tabs button:hover:not([aria-selected="true"]), .seg button:hover:not([aria-selected="true"]) { background: var(--tape); }
  .look-sw button:hover:not([aria-pressed="true"]) { transform: scale(1.1); }
  .sheet-x:hover { transform: rotate(90deg); box-shadow: 3px 3px 0 var(--ink); }
}
/* выбранный цвет: кольцо «защёлкивается» */
.look-sw button[aria-pressed="true"] { animation: ring-in .28s var(--spring); }
@keyframes ring-in { from { outline-offset: 8px; outline-color: transparent; } }

/* ---------- нижняя панель вкладок ---------- */
.tabbar button { transition: background-color .2s var(--out), color .2s var(--out); }
.tabbar button svg { transition: transform .3s var(--spring); }
.tabbar button:active svg { transform: scale(.82); transition-duration: var(--press); }
.tabbar button[aria-current="page"] svg { animation: hop .46s var(--spring); }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-5px) scale(1.12) rotate(-6deg); } 100% { transform: none; } }

/* ---------- вкладка въезжает каскадом (класс ставит openTab на 700 мс) ---------- */
.tab.tab-in > * { animation: rise .42s var(--out) both; }
.tab.tab-in > *:nth-child(2) { animation-delay: .04s; }
.tab.tab-in > *:nth-child(3) { animation-delay: .08s; }
.tab.tab-in > *:nth-child(4) { animation-delay: .12s; }
.tab.tab-in > *:nth-child(5) { animation-delay: .16s; }
.tab.tab-in > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- листы и всплывающие окна ---------- */
.sheet-pop:not([hidden]) { animation: veil .22s ease-out both; }
@keyframes veil { from { background-color: rgb(22 24 29 / 0); } }
.sheet { animation: sheet-spring .42s var(--spring) both; }
@keyframes sheet-spring { from { transform: translateY(70px); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  .sheet { animation-name: sheet-pop; }
  @keyframes sheet-pop { from { transform: translateY(24px) scale(.96) rotate(-.6deg); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- тост: наклейка прилетает и чуть доворачивается ---------- */
.toast:not(:empty) { animation: toast-in .4s var(--spring) both; }
@keyframes toast-in { from { transform: translateY(18px) rotate(-2deg) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- фокус с клавиатуры — заметный и одинаковый ---------- */
.btn:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* ---------- Публичная редакция: тёплый свет, неподвижные карточки ---------- */
:root {
  --expo-out: cubic-bezier(.16, 1, .3, 1);
}

html { scroll-behavior: smooth; }
::selection { background: #ffd454; color: #202638; }

.media-shell .eg-stats, .media-shell .pl-city-chip small, .media-shell .pl-event-date {
  font-variant-numeric: tabular-nums;
}

/* Page styles load after this file. Keep their static layout and focus rings,
   but explicitly replace their competing motion properties. */
.media-shell :is(.pl-city-chip, .pl-city-thumb, .pl-card, .pl-preview,
  .eg-route-card, .ed-visual-card, .business-card, .travel-offer,
  .eg-related-grid>a, .eg-city-index a, .eg-toc a, .eg-link,
  .mh-front-feature, .mh-front-article, .mh-front-events, .mh-film-card,
  .mh-button, .cp-button, .business-button, .travel-search-submit),
.media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty) {
  transition: border-color .18s ease, background-color .18s ease,
    color .18s ease, text-decoration-color .18s ease !important;
}

.media-shell :is(.pl-city-chip, .pl-card, .pl-preview, .eg-route-card,
  .ed-visual-card, .business-card, .travel-offer, .eg-related-grid>a,
  .eg-city-index a, .eg-toc a, .eg-link, .mh-button, .cp-button,
  .business-button, .travel-search-submit):is(:hover, :active, :focus-within),
.media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty):is(:hover, :active, :focus-within) {
  transform: none !important;
}

.media-shell :is(.pl-city-chip img, .pl-city-thumb img, .ed-cover img,
  .mh-cover img, .mh-play, .cp-episode-cover img, .pl-hero-art img) {
  transition: none !important;
  transform: none !important;
}

/* A lit edge marks the destination without moving the card or its contents. */
@media (hover: hover) {
  .media-shell :is(.pl-city-chip, .pl-card, .pl-preview, .eg-route-card,
    .ed-visual-card, .business-card, .travel-offer, .eg-related-grid>a,
    .eg-city-index a, .mh-front-article):hover,
  .media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty):hover {
    border-color: #94772b;
  }
  .media-shell .ed-visual-card:hover:not(:focus-visible),
  .media-shell .eg-related-grid>a:hover:not(:focus-visible) { box-shadow: 0 2px 6px #2026380a; }
  .media-shell .eg-city-index a:hover:not(:focus-visible),
  .media-shell :is(.mh-front-feature, .mh-front-article, .mh-front-events):hover:not(:focus-visible) { box-shadow: none; }
  .media-shell .business-card:hover { box-shadow: 0 4px 14px #141c290d; }
  .media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty):hover {
    box-shadow: 0 5px 17px rgba(25,33,45,.035);
  }
  .media-shell .pl-city-thumb:hover { border-color: #ffd454; }
  .media-shell .mh-cover:hover .mh-play,
  .media-shell .mh-film-card:hover .mh-play { background-color: #ffd454; }
}

.media-shell :is(.pl-card, .pl-preview, .business-card, .travel-offer):focus-within,
.media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty):focus-within {
  border-color: #94772b;
}

.media-shell :is(.pl-city-chip, .eg-link):active {
  border-color: #94772b;
}

.media-shell :is(.eg-card-cta, .mh-film-link, .mh-front-cta, .pl-text-link) {
  transition: text-decoration-color .16s ease;
}
.media-shell :is(.ed-visual-card, .eg-route-card, .mh-film-card, .mh-front-feature, .mh-front-article):is(:hover, :focus-visible)
  :is(.eg-card-cta, .mh-film-link, .mh-front-cta),
.media-shell .pl-text-link:is(:hover, :focus-visible) {
  text-decoration: underline;
  text-decoration-color: #b88d1b;
  text-underline-offset: 3px;
}
.media-shell .mh-front-feature:is(:hover, :focus-visible) .mh-front-cta {
  text-decoration-color: #ffd454;
}

/* The existing active-nav underline remains persistent. Other destinations
   get a short, warm line on hover/focus, not a moving link. */
.media-shell .media-nav a:not(.is-current)::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: #ffd454;
  border-radius: 2px;
  opacity: 0;
  transform: scaleX(.35);
  transform-origin: left center;
  pointer-events: none;
  transition: transform .16s var(--expo-out), opacity .16s ease;
}
.media-shell .media-nav a:not(.is-current):focus-visible::after {
  opacity: 1;
  transform: none;
}
@media (hover: hover) {
  .media-shell .media-nav a:not(.is-current):hover::after {
    opacity: 1;
    transform: none;
  }
}

/* A single quiet artwork reveal, with the image visible from the first frame.
   Never animate text or geometry; no repeating decorative motion. */
@media (prefers-reduced-motion: no-preference) {
  .media-shell :is(.mh-screen img, .mh-featured img, .cp-hero-poster,
    .eg-hero-art img, .travel-route-art, .business-hero-visual svg) {
    animation: media-window-light .36s var(--expo-out) both !important;
  }
}
@keyframes media-window-light { from { opacity: .88; } to { opacity: 1; } }

.media-shell .pl-city-banner {
  box-shadow: 0 10px 28px -14px rgb(15 20 34 / .45);
}

/* Public travel and business links are reading destinations, not game stickers.
   Keep their pointer targets fixed on both hover and press. */
.media-shell :is(.travel-offers, .cp-travel-offers) .portal-actions-grid>article>.btn,
.biz-detail-premium .bd-button {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease !important;
}
.media-shell :is(.travel-offers, .cp-travel-offers) .portal-actions-grid>article>.btn:is(:hover, :active),
.biz-detail-premium .bd-button:is(:hover, :active) {
  transform: none !important;
}
@media (hover: hover) {
  .media-shell :is(.travel-offers, .cp-travel-offers) .portal-actions-grid>article>.btn:hover,
  .media-shell form:not([aria-busy="true"]) .travel-search-submit:hover:not([disabled]):not([aria-busy="true"]) {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .media-shell :is(.pl-city-chip, .pl-city-thumb, .pl-card, .pl-preview,
    .eg-route-card, .ed-visual-card, .business-card, .travel-offer,
    .eg-related-grid>a, .eg-city-index a, .eg-toc a, .eg-link,
    .mh-front-feature, .mh-front-article, .mh-front-events, .mh-film-card,
    .mh-button, .cp-button, .business-button, .travel-search-submit,
    .pl-city-chip img, .pl-city-thumb img, .ed-cover img, .mh-cover img,
    .mh-play, .cp-episode-cover img, .pl-hero-art img, .mh-screen img,
    .mh-featured img, .cp-hero-poster, .eg-hero-art img, .travel-route-art,
    .business-hero-visual svg, .eg-card-cta, .mh-film-link, .mh-front-cta,
    .pl-text-link),
  .media-shell .travel-premium .travel-offers .portal-actions-grid>article:not(.portal-empty),
  .media-shell :is(.travel-offers, .cp-travel-offers) .portal-actions-grid>article>.btn,
  .biz-detail-premium .bd-button,
  .media-shell .media-nav a:not(.is-current)::after {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
  .btn, .btn svg, .tabbar button, .tabbar button svg, .look-chip, .look-tabs button, .look-sw button, .seg button,
  .decor-btn, .vote-btn, .town-opt, .sheet-x, .board-btn, .map3d-btns button, .map3d-stk button, .views-tabs button,
  .map3d-find button, .link-btn, .bd-opt, .chat-more { transition: none; }
  .btn:hover, .tab.tab-in > *, .tabbar button[aria-current="page"] svg, .sheet, .sheet-pop:not([hidden]),
  .toast:not(:empty), .look-sw button[aria-pressed="true"], .btn[disabled][aria-busy="true"],
  form[aria-busy="true"] .btn[type="submit"] { animation: none; }
}
