/* Title screen — right ankety list (events-like hover).
   Does not rewrite the horizontal track: keeps original 100vw title panel. */

.mainSection.titleScreen {
  --ta-gold: #eacda3;
  --ta-gold-mid: #ab8b62;
  --ta-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ta-pad: 3rem;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #111111;
}

.titleScreen__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s var(--ta-ease);
}

.titleScreen.has-bg .titleScreen__bg {
  opacity: 1;
}

.titleScreen__bgVideo,
.titleScreen__bgImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.titleScreen__bgVideo {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: opacity 1.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.titleScreen.is-photo .titleScreen__bgVideo {
  opacity: 0;
}

.titleScreen__bgImg {
  opacity: 0;
  transform: scale(1.01);
  transition:
    opacity 1.65s cubic-bezier(0.4, 0, 0.2, 1),
    transform 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.titleScreen__bgImg.is-ready {
  opacity: 1;
  transform: scale(1);
}

.titleScreen__bgImg--buff {
  z-index: 1;
}

.titleScreen__bgImg:not(.titleScreen__bgImg--buff) {
  z-index: 2;
}

.titlePart__panel--detail.is-swap-out {
  opacity: 0;
  pointer-events: none;
}

.titlePart__panel--detail.is-swap-in {
  opacity: 1;
}

.titleScreen__bgVeil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(17, 17, 17, 0.88) 0%,
      rgba(17, 17, 17, 0.62) 42%,
      rgba(17, 17, 17, 0.78) 100%
    ),
    linear-gradient(
      180deg,
      rgba(17, 17, 17, 0.35) 0%,
      rgba(17, 17, 17, 0.2) 35%,
      rgba(17, 17, 17, 0.82) 100%
    );
}

.titleScreen__main {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
  width: 100%;
  min-height: 0;
}

.titleScreen .titlePart {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 36rem;
  min-width: 0;
  position: relative;
}

.titlePart__panel {
  width: 100%;
  transition:
    opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.titlePart__panel[hidden] {
  display: none !important;
}

.titlePart__panel.is-leaving {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  opacity: 0;
  transform: none;
  pointer-events: none;
  z-index: 0;
}

.titlePart__panel.is-entering {
  opacity: 0;
  transform: none;
  z-index: 1;
}

.titlePart__panel.is-entering.is-shown {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .titlePart__panel,
  .titleScreen__bgVideo,
  .titleScreen__bgImg {
    transition: none !important;
  }

  .titlePart__panel.is-leaving,
  .titlePart__panel.is-entering {
    transform: none;
  }
}

/* Don't run the reveal while the boot loader covers the hero — iOS freezes
   mid-blur if the animation starts off-screen / under the overlay. */
html:not(.anketa-ready) .titlePart .titlePart__panel--default [data-glitch],
.titlePart:not(.is-reveal-ready) .titlePart__panel--default [data-glitch] {
  animation: none !important;
  opacity: 0;
  -webkit-filter: none !important;
  filter: none !important;
}

.titlePart [data-glitch].is-revealed {
  animation: none !important;
  opacity: 1 !important;
  -webkit-filter: none !important;
  filter: none !important;
}

/* iPhone / iPad: filter:blur animations stall next to <video>. Fade only. */
html.is-apple-touch .titlePart .titlePart__panel--default [data-glitch] {
  animation-name: title-fade-in;
  -webkit-filter: none !important;
  filter: none !important;
}

@keyframes title-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .titlePart .titlePart__panel--default [data-glitch],
  html:not(.anketa-ready) .titlePart .titlePart__panel--default [data-glitch],
  .titlePart:not(.is-reveal-ready) .titlePart__panel--default [data-glitch] {
    animation: none !important;
    opacity: 1 !important;
    -webkit-filter: none !important;
    filter: none !important;
  }
}

/* Disable legacy word focus-in animation on detail panel (meta + CTA spans) */
.titlePart__panel--detail span,
.titleScreen .titlePart.is-detail .titlePart__panel--detail span {
  animation: none !important;
  animation-delay: 0s !important;
  opacity: 1 !important;
  -webkit-filter: none !important;
  filter: none !important;
}

.titleScreen .heliosOracleTitle {
  white-space: nowrap;
}

.titleScreen .titlePart.is-detail .titlePart__anketaTitle {
  white-space: nowrap;
  max-width: none;
}

.titlePart__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  margin: 0.85rem 0 0;
  font-family: "Arimo", sans-serif;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ta-gold);
  opacity: 1;
  transition: none;
  animation: none;
}

.titlePart__metaItem {
  display: inline-flex;
  align-items: center;
}

.titlePart__metaDivider {
  color: var(--ta-gold);
  letter-spacing: 0;
  opacity: 1;
}

.titleScreen .subtitle {
  font-family: "Montserrat", "Arimo", system-ui, sans-serif;
  font-weight: 250;
}

.titleScreen .subtitle.titlePart__tagline {
  margin-top: 1rem !important;
  font-family: "Montserrat", "Arimo", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 250;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.titlePart__result {
  margin: 1.25rem 0 0;
  max-width: 34ch;
  font-family: "Arimo", sans-serif;
  font-size: 20px;
  line-height: 1.4;
  color: #ffffff;
}

.titlePart__deliverables {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 34ch;
}

.titlePart__deliverables li {
  position: relative;
  padding-left: 1.35rem;
  font-family: "Arimo", sans-serif;
  font-size: 18px;
  line-height: 1.4;
  color: #ffffff;
}

.titlePart__deliverables li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0;
  background: url("../images/questionnaires/star.svg") center / contain no-repeat;
}

.titlePart__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  box-sizing: border-box;
  min-height: clamp(3rem, 4.1vw, 3.6875rem);
  max-width: 100%;
  margin-top: 1.75rem;
  padding: 0 clamp(2rem, 4.17vw, 3.75rem);
  border: 0;
  border-radius: 1000px;
  background: linear-gradient(
    90deg,
    #e2c987 0%,
    #d9b362 50%,
    #b28b46 100%
  );
  color: #101521;
  font-family: "Arimo", system-ui, sans-serif;
  font-size: clamp(0.875rem, 1.11vw, 1rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.titlePart__cta:hover,
.titlePart__cta:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(226, 201, 135, 0.25);
  outline: none;
  color: #101521;
}

.titlePart__cta img {
  width: 1.3125rem;
  height: auto;
  flex-shrink: 0;
}

.titleScreen .titlePart .anketyMenuButton {
  margin-top: 1.75rem;
}

/* Active row highlight in the right list */
.titleAnkety__item.is-active .titleAnkety__title {
  opacity: 1;
}

.titleAnkety__item.is-active .titleAnkety__num {
  opacity: 1;
}

.titleAnkety {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  width: 100%;
}

.titleAnkety__item {
  /* Reserved room for meta line under the title */
  --ta-body-slot: 2.75rem;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 36rem;
  /* Reserved room for meta + tagline so hover doesn’t jump */
  padding-bottom: var(--ta-body-slot);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.titleAnkety__item:hover,
.titleAnkety__item:focus-within,
.titleAnkety__item.is-expanded {
  z-index: 2;
}

.titleAnkety__stretch {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

@media screen and (max-width: 959px) {
  .titleAnkety__stretch {
    pointer-events: none;
  }

  .titleAnkety__item.is-expanded .titleAnkety__stretch {
    pointer-events: auto;
  }
}

@media screen and (min-width: 960px) {
  .titleAnkety:hover .titleAnkety__item:first-child:not(:hover):not(:focus-within):not(.is-expanded) .titleAnkety__stretch {
    pointer-events: none;
  }
}

.titleAnkety__head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1rem;
  width: 100%;
}

.titleAnkety__num {
  flex-shrink: 0;
  min-width: 2rem;
  font-family: "Cormorant", serif;
  font-weight: 500;
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  line-height: 1;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--ta-gold);
  opacity: 0.35;
  transform: translateY(0.05em);
  transition: opacity 0.4s var(--ta-ease);
}

.titleAnkety__title {
  margin: 0;
  font-family: "Cormorant", serif;
  font-weight: 500;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.25;
  color: #ffffff;
  opacity: 0.7;
  transition: opacity 0.4s var(--ta-ease);
}

/* Absolute in reserved slot — no layout shift, no fade */
.titleAnkety__body {
  position: absolute;
  right: 0;
  top: calc(100% - var(--ta-body-slot));
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  max-width: 100%;
  height: var(--ta-body-slot);
  padding-top: 0.55rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: none;
  pointer-events: none;
  transition: none;
}

.titleAnkety__metaRow {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.55rem;
}

.titleAnkety__meta {
  margin: 0;
  font-family: "Arimo", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ta-gold-mid);
}

.titleAnkety__metaDivider {
  color: rgba(234, 205, 163, 0.45);
  font-size: 0.75rem;
  line-height: 1;
}

.titleAnkety__tagline {
  margin: 0;
  font-family: "Arimo", sans-serif;
  font-size: 0.875rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.72);
  max-width: 52ch;
  text-align: right;
}

.titleAnkety__link {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  font-family: "Arimo", sans-serif;
  font-size: 0.9375rem;
  color: var(--ta-gold) !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.titleAnkety__link:hover {
  color: #ffffff !important;
}

.titleAnkety__item:hover .titleAnkety__num,
.titleAnkety__item:focus-within .titleAnkety__num,
.titleAnkety__item.is-expanded .titleAnkety__num {
  opacity: 1;
}

.titleAnkety__item:hover .titleAnkety__title,
.titleAnkety__item:focus-within .titleAnkety__title,
.titleAnkety__item.is-expanded .titleAnkety__title {
  opacity: 1;
}

.titleAnkety__item:hover .titleAnkety__body,
.titleAnkety__item:focus-within .titleAnkety__body,
.titleAnkety__item.is-expanded .titleAnkety__body {
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media screen and (min-width: 960px) {
  .mainSection.titleScreen {
    /* 100% of the visible page (hero-only layout; no horizontal track) */
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 100%;
    flex-flow: column;
    justify-content: space-between;
    padding: var(--ta-pad);
    padding-right: 54px;
  }

  .titleScreen__main {
    position: relative;
    display: block;
    height: 100%;
    min-height: 0;
  }

  .titleScreen .titlePart {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    max-width: min(36rem, 42vw);
  }

  .titleScreen .titlePart.is-detail {
    max-width: min(48rem, 52vw);
  }

  .titleAnkety {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(36rem, 48vw);
    box-sizing: border-box;
  }

  .titleScreen .footerPart {
    justify-content: flex-end;
  }

  /* Active / expanded rows driven by JS (.is-active / .is-expanded) */
  .titleAnkety__item.is-active .titleAnkety__num,
  .titleAnkety__item.is-expanded .titleAnkety__num {
    opacity: 1;
  }

  .titleAnkety__item.is-active .titleAnkety__title,
  .titleAnkety__item.is-expanded .titleAnkety__title {
    opacity: 1;
  }

  .titleAnkety__item.is-active .titleAnkety__body,
  .titleAnkety__item.is-expanded .titleAnkety__body {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

.titleAnkety__empty {
  font-family: "Arimo", sans-serif;
  color: rgba(255, 255, 255, 0.55);
  text-align: right;
}

/* Bottom-center: scroll cue */
.titleScreen__bottomControls {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  transform: translateX(-50%);
}

.titleScreen__scrollCue {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ta-gold, #eacda3);
  text-decoration: none;
  transform: translateX(-50%);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.25s var(--ta-ease), color 0.25s var(--ta-ease);
}

.titleScreen__bottomControls .titleScreen__scrollCue {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
}

.titleScreen__scrollCue:hover,
.titleScreen__scrollCue:focus-visible {
  opacity: 1;
  color: #fff;
  outline: none;
}

.titleScreen__scrollCueArrow {
  display: block;
  width: 1rem;
  height: 0.7rem;
  animation: titleScrollCueBounce 1.7s ease-in-out infinite;
}

.titleScreen__scrollCueArrow::before {
  content: "";
  display: block;
  width: 0.7rem;
  height: 0.7rem;
  margin: 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transform-origin: 50% 50%;
}

@keyframes titleScrollCueBounce {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 0.45;
  }
  50% {
    transform: translate3d(0, 0.45rem, 0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .titleScreen__scrollCueArrow {
    animation: none;
  }
}

/* Phone + tablet: no scroll cue / video toggle */
@media screen and (max-width: 959px) {
  .titleScreen__bottomControls,
  .titleScreen__scrollCue,
  .testQlist__scrollCue {
    display: none !important;
  }
}

@media screen and (max-width: 959px) {
  .mainSection.titleScreen {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 100svh;
    height: 100svh;
    max-height: 100svh;
    padding: clamp(1.25rem, 4vw, 2rem);
    overflow: hidden;
  }

  .titleScreen__main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 0;
    padding-top: clamp(1.25rem, 4vh, 2.25rem);
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px)); /* room for bottom CTA */
    gap: 0;
  }

  .titleScreen .titlePart {
    /* Let the CTA position against .titleScreen (viewport), not this box */
    position: static;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-align: center;
  }

  /* Brand only — no inline anketa picker on phone/tablet */
  .titleAnkety {
    display: none !important;
  }

  .titlePart__panel--detail {
    display: none !important;
  }

  .titleScreen .titlePart__panel--default {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .titleScreen .heliosOracleTitle {
    white-space: normal;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    font-size: clamp(2.8rem, 10.5vw, 4.15rem);
  }

  .titleScreen .subtitle {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    text-align: left;
    font-size: clamp(1.1rem, 4vw, 1.45rem) !important;
    font-weight: 500 !important;
    line-height: 1.45;
  }

  /* «Выбрать маршрут» — bottom of hero screen, clear of title/subtitle */
  .titleScreen .titlePart .anketyMenuButton {
    position: absolute;
    left: clamp(1.25rem, 4vw, 2rem);
    right: clamp(1.25rem, 4vw, 2rem);
    bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 5;
    width: auto;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    justify-content: center;
  }
}

/* Phone: CTA full bleed within side padding */
@media screen and (max-width: 640px) {
  .titleScreen .titlePart .anketyMenuButton {
    left: clamp(1.25rem, 4vw, 2rem);
    right: clamp(1.25rem, 4vw, 2rem);
    bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
    width: auto;
  }
}

/* Tablet: bottom CTA centered, natural width; title left like subtitle */
@media screen and (min-width: 641px) and (max-width: 959px) {
  .titleScreen .titlePart,
  .titleScreen .titlePart__panel--default {
    align-items: flex-start;
    text-align: left;
  }

  .titleScreen .heliosOracleTitle {
    margin-left: 0;
    margin-right: 0;
    text-align: left;
    font-size: clamp(3.25rem, 6.75vw, 4.3rem);
  }

  .titleScreen .titlePart .anketyMenuButton {
    left: 50%;
    right: auto;
    bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    min-width: 16rem;
    max-width: min(22rem, calc(100% - 3rem));
    transform: translateX(-50%);
  }
}

@media screen and (min-width: 960px) and (max-width: 1280px) {
  .mainSection.titleScreen {
    --ta-pad: 2.25rem;
    padding-right: clamp(2rem, 3vw, 3.25rem);
  }

  .titleScreen .heliosOracleTitle {
    font-size: clamp(2.25rem, 3.6vw, 3.75rem);
  }

  .titleScreen .subtitle {
    font-size: clamp(1rem, 1.4vw, 1.35rem) !important;
  }

  .titleScreen .titlePart {
    max-width: min(32rem, 40vw);
  }

  .titleAnkety {
    width: min(32rem, 46vw);
  }
}

@media screen and (min-width: 960px) and (max-height: 800px) {
  .mainSection.titleScreen {
    overflow: visible;
    height: auto;
    max-height: none;
    min-height: 100svh;
  }

  .titleScreen__main {
    height: auto;
    min-height: calc(100svh - 2 * var(--ta-pad));
  }

  .titleScreen .titlePart {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    max-width: min(36rem, 48%);
  }

  .titleAnkety {
    position: relative;
    right: auto;
    bottom: auto;
    margin-left: auto;
    margin-top: 2rem;
    width: min(36rem, 48%);
  }

  .titleScreen__main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }
}
