@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --mentis-bg: #F9F9F7;
  --mentis-surface: #FFFFFF;
  --mentis-dark: #121316;
  --mentis-accent: #9A7B56;
  --mentis-accent-light: #F6F2EC;
  --mentis-border: #E8E8E2;
}

/* style.css */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

/* Корректировка контейнера main с учетом челки сверху и бара снизу */
main {
  height: calc(100dvh - 72px - 60px - var(--sat) - var(--sab)) !important;
  max-height: calc(100dvh - 72px - 60px - var(--sat) - var(--sab)) !important;
}

@media (min-width: 768px) {
  main {
    height: calc(100vh - 80px) !important;
    max-height: calc(100vh - 80px) !important;
  }
}

/* Снятие жесткой фиксации body для предотвращения клиппинга */
html, body {
  height: 100%;
  min-height: 100dvh;
  width: 100%;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

/* Корректировка высоты основного рабочего пространства */
main {
  height: calc(100dvh - 72px - 60px - var(--sab)) !important;
  max-height: calc(100dvh - 72px - 60px - var(--sab)) !important;
}

@media (min-width: 768px) {
  main {
    height: calc(100vh - 80px) !important;
    max-height: calc(100vh - 80px) !important;
  }
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--mentis-bg);
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #141518;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

/* Полный отказ от засечек: делаем заголовки стильными и плотными */
.font-serif-luxury { 
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, sans-serif !important; 
  letter-spacing: -0.02em;
}

.text-balance { text-wrap: balance; }

/* Увеличенный читаемый текст статей */
.article-title {
  font-size: 1.1rem !important; /* ~17.5px */
  line-height: 1.35 !important;
  font-weight: 800 !important;
  color: #121316;
  letter-spacing: -0.015em;
}

.article-body-text {
  font-size: 0.925rem !important; /* ~15px */
  line-height: 1.65 !important;
  color: #27272a;
  font-weight: 400;
}

.mentis-card {
  background: var(--mentis-surface);
  border-radius: 32px;
  border: 1px solid var(--mentis-border);
  box-shadow: 0 10px 30px -5px rgba(18, 19, 22, 0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mentis-card:hover {
  box-shadow: 0 14px 35px -5px rgba(18, 19, 22, 0.06);
}

.glass-pill {
  background: rgba(18, 19, 22, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.topic-pill:checked + label { 
  background-color: var(--mentis-dark); 
  color: #FFFFFF; 
  border-color: var(--mentis-dark); 
  font-weight: 600; 
  box-shadow: 0 4px 12px rgba(18, 19, 22, 0.15);
}

.day-pill:checked + label { 
  background-color: #121316; 
  color: #ffffff; 
  border-color: #121316; 
  box-shadow: 0 4px 12px rgba(18, 19, 22, 0.15);
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.shorts-container {
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  height: 100% !important;
}

.shorts-slide, .journal-slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
}

@keyframes heartBeat {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); opacity: 0.95; }
  100% { transform: scale(1); opacity: 0; }
}
.heart-animate { animation: heartBeat 0.8s ease-out forwards; }

/* Модальное окно и шторка */
#psychModal {
  overscroll-behavior-y: contain;
}

#psychModalContainer {
  will-change: transform;
  overscroll-behavior-y: contain;
}

/* Фиксация высоты карточек в Журнале и Закладках */
#subTabBookmarksView .journal-slide,
#journalPostsView .journal-slide {
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
}

/* Предотвращение сдвигов и прыжков экрана при модальных окнах */
body {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

main {
  position: relative;
  overflow: hidden;
  height: calc(100dvh - 72px) !important;
}

@media (min-width: 640px) {
  main {
    height: calc(100vh - 80px) !important;
  }
}

/* Фиксация высоты карточек в разделе «Запросы» (Shorts/Journal стиль) */
#myRequestsInnerList {
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  height: 100% !important;
  max-height: 100% !important;
}

#myRequestsInnerList .journal-slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
}

/* Надёжное раскрытие текстовых блоков и списков тегов */
.is-expanded {
  max-height: none !important;
  overflow: visible !important;
}

/* Фирменный тумблер режимов Mentis */
.mentis-mode-switch {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* Активное состояние «Эксперт»: темная благородная дорожка и золотой акцент */
.mentis-mode-switch.is-expert {
  background-color: #141518 !important;
  border-color: #27272a !important;
}

.mentis-mode-switch.is-expert #mentisModeSlider {
  transform: translateX(34px);
  background: linear-gradient(135deg, #FAF7F2 0%, #FFFFFF 100%);
  color: #9A7B56 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.mentis-mode-switch.is-expert #iconSwitchClient {
  opacity: 0.4;
  color: #a1a1aa;
}

.mentis-mode-switch.is-expert #iconSwitchExpert {
  opacity: 0.9;
  color: #9A7B56;
}

/* Состояние «Клиент»: мягкий светлый фон */
.mentis-mode-switch:not(.is-expert) #mentisModeSlider {
  transform: translateX(0px);
  color: #141518;
}

.mentis-mode-switch:not(.is-expert) #iconSwitchClient {
  opacity: 0.9;
  color: #141518;
}

.mentis-mode-switch:not(.is-expert) #iconSwitchExpert {
  opacity: 0.35;
  color: #71717a;
}

/* Состояние тумблера у обычного клиента (заблокирован до аккредитации) */
.mentis-mode-switch.is-client-locked {
  background-color: #F0EFEA !important;
  border-color: #E2DFD7 !important;
  opacity: 0.75;
}

.mentis-mode-switch.is-client-locked #mentisModeSlider {
  background: #FFFFFF !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Фиксация высоты карточек и скролла в разделе «Мои статьи» */
#myPostsInnerList {
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  height: 100% !important;
  max-height: 100% !important;
}

#myPostsInnerList .journal-slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
}

/* Плавный переход со сменой режима кабинета (Scale & Blur) */
#profileViewBox {
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity, filter;
}

/* Состояние в фазе скрытия */
.cabinet-transition-out {
  opacity: 0 !important;
  transform: scale(0.96) translateY(6px) !important;
  filter: blur(5px) !important;
}

/* Мягкое появление нового кабинета */
.cabinet-transition-in {
  animation: cabinetFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cabinetFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

/* Контекстное меню сообщений Telegram-стиля */
.chat-context-menu {
  animation: contextFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes contextFadeIn {
  0% { opacity: 0; transform: scale(0.92) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-bubble {
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.chat-bubble:active {
  filter: brightness(0.98);
}
/*
@media (min-width: 1024px) {
  .desktop-content-frame {
    height: calc(100vh - 165px) !important;
    max-height: 780px !important;
  }
}
*/
/* Фирменная тень и скругление подменю на всех вкладках без двойных рамок */
#journalNavTabs > div,
#messagesSubTabsNav > div,
#tab-profile .sticky .grid {
  box-shadow: 0 4px 20px -2px rgba(18, 19, 22, 0.05) !important;
  border: 1px solid var(--mentis-border) !important;
}

/* Снимаем любые внешние границы и отступы со скролл-обёртки рейтинга */
#ratingsFilterScrollWrapper {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
}

#ratingsFilterButtonsBox {
  box-shadow: 0 4px 20px -2px rgba(18, 19, 22, 0.05);
  border: 1px solid var(--mentis-border);
}

/* Блокировка горизонтальной ориентации на смартфонах */
@media screen and (max-width: 900px) and (orientation: landscape) {
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #121316;
    z-index: 99999;
  }

  body::after {
    content: "Пожалуйста, поверните устройство вертикально для использования Mentis";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FAF7F2;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
    z-index: 100000;
    font-family: 'Inter', sans-serif;
  }
}