/*
 * Site header of the new design on the pages that keep the previous one.
 * Same rules as the header in assets/home/css/styles.css, scoped to .header and with the
 * previous header rules of indigo/dist/styles.css (.header, .header__logo, .header__phone) reset.
 */

.header {
  --purple: #520099;
  --purple-light: #cdb8f5;
  --lav: #ece7f5;
  --ink: #18161c;
  --dark: #1e1e1e;
  --white: #fff;
  --radius: 20px;
  --font: "Raleway", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* the header is inside .layout, which has its own font and letter spacing */
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

.header *,
.header *::before,
.header *::after { box-sizing: border-box; }
.header img { display: block; max-width: 100%; height: auto; }
.header a { color: inherit; text-decoration: none; }
.header ul { margin: 0; padding: 0; list-style: none; }
.header button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
.header :focus-visible { outline: 2px solid var(--purple-light); outline-offset: 2px; }

/* ---------- buttons ---------- */
.header .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 49px; padding: 0 26px; border-radius: 999px;
  font-size: 16px; font-weight: 700; line-height: 1; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s;
}
.header .btn--44 { height: 44px; padding: 0 20px; }
.header .btn--purple { background: var(--purple); color: var(--white); }
.header .btn--purple:hover { background: #42007c; }
.header .btn--white { background: var(--white); color: var(--ink); }
.header .btn--white:hover { background: var(--lav); }

/* ---------- header ---------- */
.header {
  position: sticky; top: 10px; left: auto; z-index: 50;
  display: flex; align-items: center;
  width: auto; height: 70px; margin: 20px 20px 0; padding: 0 14px 0 30px;
  background: var(--dark); border-radius: 35px; color: var(--white);
  transition: box-shadow .25s;
}
.header.is-scrolled { box-shadow: 0 10px 30px rgba(24, 22, 28, .22); }
.header .header__logo { position: static; top: auto; left: auto; transform: none; width: auto; height: auto; flex: none; margin-right: 72px; }
.header .header__logo img { width: 208px; height: 30px; }

.header .nav__list { display: flex; align-items: center; gap: 27px; }
.header .nav__item { position: relative; }
.header .nav__link { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; line-height: 70px; white-space: nowrap; transition: color .2s; }
.header .nav__link:hover { color: var(--purple-light); }
.header .nav__chev { width: 9px; height: 5px; }
.header .nav__item--has-sub > .nav__link { margin-right: 3px; }
.header .nav__sub {
  position: absolute; top: calc(100% - 8px); left: -20px; min-width: 260px;
  padding: 8px;
  background: var(--dark); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  color: var(--white);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .2s, transform .2s, visibility .2s;
}
.header .nav__sub a { display: block; padding: 11px 14px; border-radius: 10px; font-size: 15px; line-height: 1.3; transition: background-color .15s, color .15s; }
.header .nav__sub a:hover { background: rgba(255, 255, 255, .08); color: var(--purple-light); }
.header .nav__item--has-sub:hover .nav__sub,
.header .nav__item--has-sub:focus-within .nav__sub { opacity: 1; visibility: visible; transform: none; }

.header .header__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header .header__phone { width: 235px; padding: 0 20px; gap: 11px; background-image: none; cursor: pointer; }
.header .header__book { width: 132px; padding: 0; }
.header .header__user {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--white);
  transition: background-color .2s;
}
.header .header__user:hover { background: var(--lav); }
.header .header__burger { display: none; }
/* пункты, нужные только в мобильном меню */
.header .nav__item--cta, .header .nav__sub-all { display: none; }

/* the header is in the flow now: the content starts below it, not under it */
.layout__holder { padding-top: 32px; }
/* keeps the top margin of the header inside .layout, otherwise it collapses through and shows a white strip above */
.layout { display: flow-root; }

/* шапка сжимается раньше бургера: меньше отступы, затем у телефона остается только иконка */
@media (max-width: 1440px) {
  .header .header__logo { margin-right: clamp(24px, 2.5vw, 36px); }
  .header .nav__list { gap: clamp(16px, 1.5vw, 22px); }
  .header .header__phone { width: auto; }
}
@media (max-width: 1360px) {
  .header .header__phone { width: 44px; padding: 0; border-radius: 50%; }
  .header .header__phone-text { display: none; }
}

/* бургер-меню */
@media (max-width: 1180px) {
  .header .nav {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: 12px;
    background: var(--dark); border-radius: var(--radius); box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
    display: none;
  }
  .header.is-open .nav { display: block; }
  .header .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .header .nav__link { display: flex; line-height: 1.3; padding: 12px 14px; font-size: 17px; }
  .header .nav__chev { display: none; }
  .header .nav__sub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding: 0 0 6px 12px; min-width: 0; }
  .header .nav__sub a { padding: 8px 14px; color: rgba(255, 255, 255, .78); }

  .header .header__burger {
    display: grid; place-content: center; gap: 4px; width: 44px; height: 44px; border-radius: 50%;
  }
  .header .header__burger span { display: block; width: 18px; height: 2px; border-radius: 1px; background: var(--white); transition: transform .2s, opacity .2s; }
  .header.is-open .header__burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .header.is-open .header__burger span:nth-child(2) { opacity: 0; }
  .header.is-open .header__burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

@media (max-width: 760px) {
  .header { height: 56px; margin: 10px 10px 0; padding: 0 6px 0 16px; border-radius: 28px; }
  .header .header__logo img { width: 166px; height: auto; }
  .header .header__phone { width: 44px; padding: 0; border-radius: 50%; }
  .header .header__phone-text, .header .header__book, .header .header__user { display: none; }
  .header .header__actions { gap: 2px; }

  /* мобильное меню: шапка раскрывается в темную панель */
  .header .header__logo, .header .header__actions { position: relative; z-index: 1; }
  .header .header__logo { margin-right: 0; }
  .header.is-open .header__actions { gap: 8px; }
  .header.is-open .header__user { display: grid; }
  /* панель меню накрывает контент, а не раздвигает страницу */
  .header .nav {
    position: absolute; top: 0; left: 0; right: 0; display: none;
    padding: 78px 0 34px; background: var(--dark); border-radius: 28px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, .35);
  }
  .header.is-open .nav {
    display: block; max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain;
    animation: menu-in .32s cubic-bezier(.4, 0, .2, 1);
  }
  .header .nav__list { align-items: center; }
  .header .nav__item { width: 100%; text-align: center; }
  .header .nav__link { justify-content: center; padding: 14px; font-size: 19px; letter-spacing: .04em; }
  .header .nav__item--cta { display: block; margin-bottom: 14px; }
  .header .nav__cta { height: 46px; padding: 0 22px; font-size: 18px; letter-spacing: .02em; }
  .header .nav__chev { display: inline-block; transition: transform .3s; }
  .header .nav__item--has-sub.is-sub-open .nav__chev { transform: rotate(180deg); }
  .header .nav__sub { display: none; padding: 0 0 8px; border: 0; background: none; }
  .header .nav__item--has-sub.is-sub-open .nav__sub { display: block; animation: menu-in .25s ease; }
  .header .nav__sub a { padding: 9px 14px; font-size: 16px; }
  .header .nav__sub-all { display: list-item; }
  html.menu-open { overflow: hidden; }

  .layout__holder { padding-top: 24px; }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
