/* FONTS */

/* VARIABLES */

:root {
  --font-primary: 'DM Sans', Inter, system-ui, Helvetica, Tahoma, Arial, sans-serif;
  --font-secondary: 'Sofia Sans Condensed', Inter, system-ui, Helvetica, Verdana, Arial, sans-serif;

  --color-accent: #400FC7;
  --color-dark-text: #121117;
  --color-medium-text: #594F64;
  --color-light-text: #89789C;
}


/* DOCUMENT */

html, body {
  margin: 0;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: break-word;
  -webkit-tap-highlight-color: transparent;
}

body {
  box-sizing: border-box;
  min-width: 360px;
}

/* RESETS */

h1, h2, h3 {
  margin: 0;
}

svg {
  pointer-events: none;
}

/* PAGE */

.page__header {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 64px;
  background: #1B0D2A;

  @media (min-width: 960px) {
    position: relative;
    display: flex;
    justify-content: space-between;
    height: 88px;
  }
}

.page__controls {
  display: none;
  padding: 26px 24px;
  gap: 16px;

  @media (min-width: 960px) {
    display: flex;
  }
}

.page__body {
  background: url('/_/bg.svg') top center no-repeat;
  background-size: 640px 160px;

  @media (min-width: 640px) {
    background-size: 1200px 300px;
  }

  @media (min-width: 960px) {
    background-size: contain;
  }

  @media (min-width: 960px) {
    display: grid;
    /* TODO: вернуть, когда будет TOC, но протестить, как он будет работать на средних экранах вроде 960px */
    /*grid-template-areas: 'sidebar content toc';*/
    /*grid-template-columns: 240px 1fr 240px;*/
    grid-template-areas: 'sidebar content';
    grid-template-columns: 240px 1fr;
    gap: 64px;
  }
}

.page__headline {
  font-weight: 600;
  font-size: 32px;
  line-height: 40px;
  color: var(--color-dark-text);

  @media (min-width: 960px) {
    font-size: 40px;
    line-height: 48px;
  }
}

.page__subheadline {
  margin-bottom: 8px;
  font-family: var(--font-secondary);
  font-size: 17px;
  line-height: 20px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-accent);
}

.page__section {
  margin-top: 32px;
}

.page__sidebar {
  display: none;
  padding: 12px;
  background: #fff;

  @media (min-width: 960px) {
    display: block;
  }
}

.page__content {
  grid-area: content;
  box-sizing: border-box;
  min-height: calc(100vh - 64px);
  padding: 24px 20px 48px;

  @media (min-width: 960px) {
    /* TODO: вернуть, когда будет TOC, но протестить, как он будет работать на средних экранах вроде 960px */
    /*justify-self: center;*/
    max-width: 800px;
    width: 100%;
    padding: 48px 0;
  }
}

.page__footer {
  padding: 24px 20px;
  text-align: center;
  font-size: 15px;
  line-height: 20px;
  background: #121117;
  color: var(--color-light-text);

  a {
    text-decoration: underline;
    color: var(--color-light-text);;

    /* TODO: уточнить стиль тут */
    &:hover {
      text-decoration: none;
    }
  }

  p {
    @media (min-width: 960px) {
      max-width: 760px;
      margin-left: auto;
      margin-right: auto;
    }
  }
}

.page_type_home {
  .page__body {
    @media (min-width: 960px) {
      display: block;
    }
  }

  .page__content {
    @media (min-width: 960px) {
      margin: 0 auto;
      max-width: 1076px;
      width: 100%;
      padding: 48px;
    }
  }

  .page__headline {
    font-size: 24px;
    line-height: 28px;

    @media (min-width: 960px) {
      font-size: 28px;
      line-height: 32px;
    }
  }
}

.page_type_heroes {
  .page__body {
    @media (min-width: 960px) {
      padding-right: 64px;
    }
  }
}

.page_type_hero {
  .page__body {
    @media (min-width: 960px) {
      padding-right: 64px; /* TODO: убрать, когда будет TOC? */
    }
  }
}

.page_type_error-404 {
  .page__body {
    @media (min-width: 960px) {
      display: block;
    }
  }

  .page__content {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding: 0 24px 24px;
  }
}

/* LOGO */

.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 100%;
  background: url('/_/logo.png') center no-repeat;
  background-size: 109px 40px;
  font-size: 0;

  @media (min-width: 960px) {
    position: static;
    transform: none;
    width: 178px;
    height: 88px;
    background-size: 130px 48px;
  }
}

/* ARTICLE */

.article__header {
  padding: 0 0 20px;
  border-bottom: 1px solid rgba(130, 136, 168, 0.2);

  @media (min-width: 960px) {
    padding-bottom: 24px;
  }
}

.article__category {
  font-family: var(--font-secondary);
  font-size: 17px;
  line-height: 20px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-accent);
}

.article__headline {
  font-weight: 600;
  font-size: 32px;
  line-height: 40px;
  color: var(--color-dark-text);

  @media (min-width: 960px) {
    font-size: 40px;
    line-height: 48px;
  }
}

.article__meta {
  margin-top: 16px;
  font-size: 15px;
  line-height: 24px;
  color: var(--color-light-text);
}

.article__content {
  margin-top: 24px;
  font-size: 15px;
  line-height: 24px;
  color: var(--color-medium-text);

  @media (min-width: 960px) {
    margin-top: 32px;
  }

  p {
    margin: 8px 0;

    &:first-child {
      margin-top: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  h2 {
    margin: 24px 0 16px;
    font-size: 24px;
    line-height: 28px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--color-dark-text);

    @media (min-width: 960px) {
      margin-top: 32px;
      font-size: 28px;
      line-height: 32px;
    }
  }

  h3 {
    margin: 24px 0 16px;
    font-size: 20px;
    line-height: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-dark-text);

    @media (min-width: 960px) {
      margin-top: 32px;
    }
  }

  h4 {
    margin: 24px 0 16px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    color: var(--color-dark-text);
  }

  ol, ul {
    margin: 8px 0;
    padding: 0 0 0 24px;

    li {
      margin: 8px 0;
    }
  }

  a {
    text-decoration: none;
    color: var(--color-accent);

    /* TODO: уточнить стиль тут */
    &:hover {
      text-decoration: underline;
    }

    &:not([href^="#"]):not([href^="/"]) {
      &::after {
        content: url('/_/external-link.svg');
        position: relative;
        top: 3px;
      }
    }
  }

  video {
    display: block;
    max-width: 100%;
    max-height: 600px;
    background: #000;
  }
}

/* HOTKEY */

.hotkey {
  white-space: nowrap;
}

.hotkey__text {
  display: inline-block;
  box-sizing: border-box;
  font-family: var(--font-secondary);
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  background: #E5E7F3;
  border: 1px solid rgba(64, 15, 199, 0.5);
  box-shadow: inset 0px -2px 0px rgba(64, 15, 199, 0.2);
  border-radius: 3px;
  color: var(--color-accent);
}

.hotkey_size_m {
  .hotkey__icon {
    height: 20px;
    margin-right: 3px;
    vertical-align: -4px;
  }

  .hotkey__text {
    min-width: 20px;
    padding: 0px 5px 0;
    margin-right: 3px;
    vertical-align: 2px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
  }
}

.hotkey_size_l {
  .hotkey__icon {
    height: 24px;
    margin-right: 8px;
    vertical-align: -5px;
  }

  .hotkey__text {
    min-width: 24px;
    padding: 1px 5px 0;
    margin-right: 8px;
    font-size: 15px;
    line-height: 21px;
    vertical-align: 2px;
    letter-spacing: normal; /* иначе от h3 может прийти :-) */
  }
}

.hotkey_key-only {
  .hotkey__icon,
  .hotkey__text {
    margin-right: 0;
  }
}

/* INLINE SPOILER */

.inline-spoiler {
  padding: 2px 4px;
  background: rgba(229, 231, 243, 0.3);
  border: 1px solid rgba(89, 79, 100, 0.2);
  border-radius: 2px;
  color: #594F64;

  &:hover {
    background: rgba(229, 231, 243, 0.6);
    border-color: rgba(89, 79, 100, 0.2);
  }
}

.inline-spoiler_open {
  border-color: rgba(64, 15, 199, 0.5);
  background: rgba(229, 231, 243, 0.6);
}

/* SPOILER CONTENT */

.spoiler-content {
  display: none;
  padding: 8px;
  border: 1px solid rgba(89, 79, 100, 0.2);
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.spoiler-content_visible {
  display: flex;
  flex-direction: column;
}

/* HAMBURGER */

.hamburger {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  height: 64px;
  background: none;
  border: none;
  padding: 0;

  @media (min-width: 960px) {
    display: none;
  }
}

/* MOBILE SIDEBAR */

.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
}

.mobile-sidebar__backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #121117;
  opacity: .6;
}

.mobile-sidebar__fake-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #1B0D2A;
}

.mobile-sidebar__content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 320px;
  box-shadow: 0px 8px 32px rgba(27, 13, 42, 0.3);
}

.mobile-sidebar__header {
  position: relative;
  box-sizing: border-box;
  display: flex;
  gap: 16px;
  height: 64px;
  padding: 16px 20px;
  background: #1B0D2A;
}

.mobile-sidebar__close-button {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  background: none;
}

.mobile-sidebar__body {
  position: relative;
  box-sizing: border-box;
  overflow: auto;
  height: calc(100% - 64px);
  padding: 8px;
  background: #fff;
}

/* PLATFORM SWITCH */

.platform-switch {
  display: flex;
  width: fit-content;
  background: #251D39;
}

.platform-switch__button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(193, 184, 218, .6);

  @media (min-width: 960px) {
    width: 52px;
    height: 36px;
  }

  &:hover {
    background: rgba(199, 202, 245, 0.1);
  }

  svg {
    /* на мобилке нам нужно 16px вместо 20px */
    transform: scale(.8);
    transform-origin: 50% 50%;

    @media (min-width: 960px) {
      transform: none;
    }
  }
}

.platform-switch__button_active {
  color: #fff;

  &, &:hover {
    background: #0984EC;
  }
}

/* TOOLTIP */

.tooltip {
  position: relative;

  &:hover {
    .tooltip__content {
      display: block;
    }
  }
}

.tooltip__content {
  display: none;
  position: absolute;
  top: 50%;
  left: 100%;
  z-index: 1;
  transform: translateY(-50%);
  padding: 5px 7px;
  margin-left: 9px;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  border: 1px solid rgba(64, 15, 199, 0.2);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0px 4px 8px rgba(27, 13, 42, 0.1);
  color: var(--color-dark-text);
  pointer-events: none;

  @media (min-width: 960px) {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    margin-top: 9px;
  }

  &::before {
    content: '';
    position: absolute;
    width: 9px;
    height: 9px;
    left: -0.5px;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    transform-origin: 50% 50%;
    border: 1px solid #400FC740;
    border-top: 0;
    border-right: 0;
    background: #fff;

    @media (min-width: 960px) {
      top: -0.5px;
      left: 50%;
      border-top-width: 1px;
      border-bottom: 0;
    }
  }
}

/* LANG SWITCH */

.lang-switch {
  display: flex;
  width: fit-content;
  background: #251D39;
}

.lang-switch__button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 32px;
  text-transform: uppercase;
  text-decoration: none;
  font-family: var(--font-secondary);
  font-size: 16px;
  font-weight: 600;
  line-height: 16px;
  color: #C1B8DA;

  @media (min-width: 960px) {
    width: 52px;
    height: 36px;
    font-size: 20px;
    line-height: 20px;
  }

  &:not([href]) {
    background: #4D426C;
    color: #fff;
  }

  &[href] {
    &:hover {
      background: rgba(199, 202, 245, 0.1);
    }
  }
}

/* MAIN MENU */

.main-menu {
  display: none;
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);

  @media (min-width: 960px) {
    display: flex;
  }
}

.main-menu__category {
  box-sizing: border-box;
  height: 48px;
  padding: 13px 32px 11px; /* исправляем кривости шрифта */
  font-family: var(--font-secondary);
  font-size: 22px;
  font-weight: 600;
  line-height: 24px;
  text-decoration: none;
  text-transform: uppercase;
  background: #4D426C;
  clip-path: polygon(
    10px 0,
    100% 0,
    calc(100% - 10px) 100%,
    0 100%
  );
  color: #C1B8DA;

  &:hover {
    background: #5D527B;
    color: #fff;
  }

  & + & {
    margin-left: -12px;
  }
}

.main-menu__category_active {
  &, &:hover {
    background: #FFD700;
    color: #1B0D2A;
  }
}

/* MOBILE MAIN MENU */

.mobile-main-menu {
  position: relative;
}

.mobile-main-menu__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 8px 12px 6px; /* компенсируем кривости шрифта */
  font-family: var(--font-secondary);
  font-weight: 600;
  font-size: 20px;
  line-height: 24px;
  text-transform: uppercase;
  text-align: left;
  border-radius: 2px;
  border: 1px solid rgba(64, 15, 199, 0.2);
  background: rgba(229, 231, 243, 0.6);
  color: var(--color-accent);

  svg {
    margin-top: -2px; /* компенсируем компенсацию кривостей шрифта :-) */
    transform-origin: 50% 50%;
    opacity: 0.6;
  }
}

.mobile-main-menu__options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  margin-top: 8px;
  padding: 7px;
  border: 1px solid rgba(64, 15, 199, 0.2);
  background: #fff;
  box-shadow: 0px 8px 32px rgba(27, 13, 42, 0.3);
}

.mobile-main-menu__option {
  box-sizing: border-box;
  height: 40px;
  padding: 8px 12px 6px; /* компенсируем кривости шрифта */
  font-family: var(--font-secondary);
  font-weight: 600;
  font-size: 20px;
  line-height: 24px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-light-text);

  /* не имеет смысла на мобилках, но всё ж */
  &:hover {
    background: rgba(84, 34, 222, 0.1);
  }
}

.mobile-main-menu__option_selected {
  background: rgba(84, 34, 222, 0.1);
  color: var(--color-accent);
}

.mobile-main-menu_open {
  .mobile-main-menu__label {
    border-color: var(--color-accent);

    svg {
      opacity: 1;
      transform: rotate(180deg);
    }
  }

  .mobile-main-menu__options {
    display: flex;
  }
}

/* SIDEBAR MENU */

.sidebar-menu {
  padding: 8px 0;
}

.sidebar-menu__section {
  & + & {
    margin-top: 24px;
  }
}

.sidebar-menu__headline {
  display: block;
  box-sizing: border-box;
  height: 32px;
  padding: 8px 12px 6px; /* компенсируем кривости шрифта */
  font-family: var(--font-secondary);
  font-size: 17px;
  font-weight: 600;
  line-height: 20px;
  text-transform: uppercase;
  color: #1B0D2A;
}

.sidebar-menu__item {
  display: block;
  box-sizing: border-box;
  height: 32px;
  padding: 6px 12px;
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 20px;
  text-decoration: none;
  color: var(--color-light-text);

  &[href] {
    &:hover {
      background: rgba(84, 34, 222, 0.1);
    }
  }

  &:not([href]) {
    background: rgba(84, 34, 222, 0.1);
    color: var(--color-accent);
  }
}

/* MOBILE MAIN MENU */

.mobile-main-menu__category {
  display: block;
  padding: 7px 12px 6px; /* компенсируем кривости шрифта */
  font-family: var(--font-secondary);
  font-size: 20px;
  line-height: 23px; /* компенсируем кривости шрифта */
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-dark-text);

  &:hover {
    color: var(--color-accent);
  }
}

/* HERO CARDS */

.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  flex-wrap: wrap;
  gap: 8px 12px;

  @media (min-width: 960px) {
    gap: 20px 40px;
  }
}

.hero-cards_view_snippet {
  position: relative;
  padding: 24px 0;

  > *:nth-child(5) {
    display: none;
  }

  @media (min-width: 526px) {
    > *:nth-child(4) {
      display: none;
    }
  }

  @media (min-width: 692px) {
    > *:nth-child(4) {
      display: block;
    }
  }

  @media (min-width: 858px) {
    > *:nth-child(5) {
      display: block;
    }
  }

  @media (min-width: 960px) {
    gap: 20px 32px;
    padding: 16px 0;

    > *:nth-child(5) {
      display: none;
    }
  }

  @media (min-width: 994px) {
    gap: 20px 32px;
    padding: 16px 0;

    > *:nth-child(5) {
      display: block;
    }
  }
}

.hero-cards__more {
  box-sizing: border-box;
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  height: 36px;
  margin-top: 12px;
  padding: 8px 12px;
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  text-decoration: none;
  background: rgba(84, 34, 222, 0.1);
  color: var(--color-accent);

  @media (min-width: 960px) {
    position: absolute;
    top: -36px;
    right: 0;
    margin-top: 0;
  }

  &:hover {
    color: #fff;
    background: var(--color-accent);
  }
}

/* HERO CARD */

.hero-card {
  position: relative;

  &:hover, &:active {
    transform: scale(1.05);
    transform-origin: 50% 50%;
    z-index: 1;

    &::before {
      display: block;
    }
  }

  &::before {
    content: '';
    display: none;
    position: absolute;
    left: -28%;
    top: -3.2%;
    right: 0;
    bottom: 0;
    width: 148%;
    height: 113%;
    background: url('/_/hero-card-hover-bg.svg') center no-repeat;
    background-size: cover;
  }
}

.hero-card__body {
  position: relative;
  display: block;
  background: url('/_/hero-card-bg.webp') center no-repeat;
  background-size: cover;
  clip-path: polygon(
    0 22px,
    100% 2px,
    calc(100% - 2px) calc(100% - 22px),
    2px calc(100% - 4px)
  );

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: url('/_/hero-card-content-bg.webp') center no-repeat;
    background-size: cover;
  }
}

.hero-card__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 170 / 307;
}

.hero-card__content {
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28%;
  padding: 14px 12px 0;
}

.hero-card__title {
  font-family: var(--font-secondary);
  font-size: 17px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
}

.hero-card__meta {
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-light-text);
}

/* ERROR 404 */

.error-404 {
  text-align: center;
}

.error-404__code-image {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.error-404__headline {
  font-size: 28px;
  line-height: 32px;
  font-weight: 600;
  color: var(--color-dark-text);
}

.error-404__text {
  margin-top: 16px;
  font-size: 15px;
  line-height: 24px;
  color: var(--color-medium-text);

  p {
    margin: 0;

    + p {
      margin-top: 4px;
    }
  }

  a {
    text-decoration: none;
    color: var(--color-accent);

    /* TODO: уточнить стиль тут */
    &:hover {
      text-decoration: underline;
    }
  }
}


/* TOC */

/*.toc {
  position: fixed;
  top: 76px;
  right: 12px;
  bottom: 0;
  max-width: 260px;
  width: fit-content;
  height: fit-content;
}

.toc_open {
  height: auto;
  overflow: auto;
}

.toc__content {
  display: none;
}

.toc__trigger {
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid rgba(64, 15, 199, 0.2);
  box-shadow: 0px 8px 16px rgba(27, 13, 42, 0.15);
}*/
