/**
 * Подбор рынков (/find-markets/) — стили раздела (вынесены из инлайн-<style> views/*.php,
 * чтобы кэшировались браузером). Подключается fileConnect'ом в public/find-markets/index.php.
 * Только то, чего нет в утилитах Bootstrap 5.3/silicon: сцена героя, стеклянные острова,
 * степпер визарда кодов.
 */

/* ===== Hero (views/hero.php) ===== */
.fm-hero{
    --ink:#0c0e11; --paper:#f3ede3; --amber:#f0ac4d; --amber-2:#e0863a;
    --muted:rgba(243,237,227,.62); --line:rgba(243,237,227,.14);
    position:relative; overflow:hidden; isolation:isolate;
    /* flex:0 0 auto — <body> это flex-колонка; без этого hero (flex:0 1 auto) СЖИМАЕТСЯ и
       на низких экранах контент/тикер вылезают за overflow:hidden и обрезаются. С 0 0 auto
       hero РАСТЁТ под контент (min-height — только пол), поэтому универсально на любой высоте. */
    flex:0 0 auto;
    min-height:min(88vh,760px); display:flex; flex-direction:column; justify-content:flex-start;
    padding:clamp(3rem,8vw,7rem) clamp(1.25rem,6vw,6rem) 0;
    background:var(--ink); color:var(--paper);
}
.fm-hero__bg{
    position:absolute; inset:0; z-index:-4; background-size:cover; background-position:center 40%;
    transform:scale(1.08); animation:fmKen 24s ease-in-out infinite alternate;
    filter:saturate(1.05) contrast(1.02);
}
@keyframes fmKen{ from{transform:scale(1.08) translate3d(0,0,0)} to{transform:scale(1.16) translate3d(-1.5%,-1%,0)} }
.fm-hero__veil{
    position:absolute; inset:0; z-index:-3;
    background:
        linear-gradient(105deg, rgba(9,10,13,.94) 0%, rgba(9,10,13,.72) 38%, rgba(9,10,13,.20) 72%, rgba(9,10,13,.05) 100%),
        linear-gradient(0deg, rgba(9,10,13,.92) 0%, rgba(9,10,13,0) 42%);
}
.fm-hero__glow{
    position:absolute; z-index:-2; left:-8%; top:8%; width:46vw; height:46vw; max-width:640px; max-height:640px;
    background:radial-gradient(circle at 30% 30%, rgba(240,172,77,.20), rgba(240,172,77,0) 62%);
    filter:blur(10px); pointer-events:none;
}
.fm-hero__grain{
    position:absolute; inset:0; z-index:-1; opacity:.05; pointer-events:none; mix-blend-mode:overlay;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Контент — гибкая средняя зона: flex:1 0 auto заполняет всё пространство над тикером и
   центрирует внутри себя (justify-content:center), но НЕ сжимается ниже своего контента
   (0 = flex-shrink) → на низких экранах ничего не наезжает, hero растёт. display:flex здесь
   не меняет ширины детей (align-items:stretch по умолчанию = как блок). */
.fm-hero__inner{
    position:relative; width:100%; max-width:1180px; margin:0 auto;
    flex:1 0 auto; display:flex; flex-direction:column; justify-content:center;
}

/* Заголовок — единственное место с Fraunces (класс .fraunces задаёт family/вес). */
.fm-hero__title{
    margin:0; max-width:16ch; text-wrap:balance; color:var(--paper);
    text-shadow:0 2px 40px rgba(0,0,0,.35);
    opacity:0; animation:fmUp 1s cubic-bezier(.2,.7,.2,1) .1s forwards;
}
.fm-hero__dot{ color:var(--amber); }

/* Остальной текст — стандартным шрифтом (наследуется от body). */
.fm-hero__sub{
    font-size:clamp(1.02rem,1.6vw,1.28rem); line-height:1.55;
    color:var(--muted); max-width:56ch; margin:1.5rem 0 0; font-weight:400;
    opacity:0; animation:fmUp 1s cubic-bezier(.2,.7,.2,1) .24s forwards;
}
.fm-hero__stats{
    display:flex; flex-wrap:wrap; gap:2.4rem; margin:2.2rem 0 0;
    opacity:0; animation:fmUp 1s cubic-bezier(.2,.7,.2,1) .38s forwards;
}
.fm-hero__feat{ flex:1 1 220px; max-width:300px; display:flex; flex-direction:column; gap:.4rem; position:relative; padding-left:1.1rem; }
.fm-hero__feat::before{ content:""; position:absolute; left:0; top:.15rem; bottom:.15rem; width:2px; background:linear-gradient(var(--amber),var(--amber-2)); border-radius:2px; }

.fm-hero__note{
    font-size:.8rem; line-height:1.6; color:var(--muted);
    max-width:60ch; margin:2rem 0 0; padding-top:1.2rem; border-top:1px solid var(--line);
    opacity:0; animation:fmUp 1s cubic-bezier(.2,.7,.2,1) .5s forwards;
}

/* Тикер — нижняя полоса фиксированной высоты (flex:0 0 auto, не сжимается). К низу его
   прижимает flex:1 у .fm-hero__inner (заполняет пространство сверху); margin-top — только
   минимальный зазор. Позиция тикера не зависит ни от длины текста, ни от высоты экрана. */
.fm-hero__ticker{ position:relative; flex:0 0 auto; margin-top:clamp(1rem,3vw,2rem); padding:1rem 0 1.4rem; border-top:1px solid var(--line);
    -webkit-mask-image:linear-gradient(90deg,transparent,#000 8%,#000 92%,transparent); mask-image:linear-gradient(90deg,transparent,#000 8%,#000 92%,transparent);
    opacity:0; animation:fmFade 1.2s ease .68s forwards; }
.fm-hero__track{ display:inline-flex; align-items:center; white-space:nowrap; will-change:transform; animation:fmMarquee 80s linear infinite; }
.fm-hero__mk{ display:inline-flex; align-items:center; gap:.55rem; font-size:.9rem; font-weight:500; color:var(--paper); }
.fm-hero__mk img{ border-radius:50%; opacity:.9; }
.fm-hero__tsep{ color:var(--amber); margin:0 1.6rem; }
@keyframes fmMarquee{ from{transform:translateX(0)} to{transform:translateX(-50%)} }

/* Панель управления фоном (только админ). top:5rem — ниже фиксированного хедера (~59px). */
.fm-hero__admin{ position:absolute; top:5rem; right:1rem; z-index:20; display:flex; flex-direction:column; gap:.5rem; align-items:flex-end; }
.fm-hero__upload{ cursor:pointer; background:rgba(12,14,17,.7); color:var(--paper); border:1px solid rgba(240,172,77,.5); backdrop-filter:blur(6px); margin:0; }
.fm-hero__upload:hover{ background:var(--amber); color:#111; border-color:var(--amber); }

@keyframes fmUp{ from{opacity:0; transform:translateY(22px)} to{opacity:1; transform:none} }
@keyframes fmFade{ to{opacity:1} }

@media (max-width:575.98px){ .fm-hero__stats{ gap:1.4rem } .fm-hero__feat{ max-width:none } }
@media (prefers-reduced-motion:reduce){
    .fm-hero__bg,.fm-hero__track{ animation:none !important }
    .fm-hero__title,.fm-hero__sub,.fm-hero__stats,.fm-hero__note,.fm-hero__ticker{ opacity:1 !important; animation:none !important }
}

/* ===== Острова фильтров и навигации (views/filters.php) ===== */
/* Sticky-обёртка островов — под фиксированным хедером (~60px); z-index даёт .sticky-top. */
.fm-sticky { top: 60px; }
/* Единая высота контролов в острове фильтров и фиксированные ширины полей
   (у Bootstrap нет утилит точного размера). */
.fm-ctl { height: 38px; }
.fm-w-160 { width: 160px; }
.fm-w-80 { width: 80px; }
/* Дропдаун выбора страны: длинный список прокручивается, поиск прилипает сверху. */
#fmMyCountryMenu { max-height: 360px; overflow-y: auto; min-width: 280px; }
#fmMyCountryMenu .fm-menu-search { z-index: 2; }
/* min-width:0 — иначе flex-элемент не сжимается и лента стран не скроллится. */
#fmSectionNavDock { min-width: 0; }
#fmDockNavScroll { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
#fmDockNavScroll::-webkit-scrollbar { display: none; }
/* Острова — «стеклянные» пилюли поверх контента (как public/company-foreign):
   блюр на самих островах, а НЕ на sticky-обёртке. */
#fmFiltersDock, #fmSectionNavDock, #fmHelpDock {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
[data-bs-theme="dark"] #fmFiltersDock,
[data-bs-theme="dark"] #fmSectionNavDock,
[data-bs-theme="dark"] #fmHelpDock {
    background: rgba(255, 255, 255, 0.06) !important;
}
[data-bs-theme="dark"] #fmFiltersDock.bg-light,
[data-bs-theme="dark"] #fmSectionNavDock.bg-light,
[data-bs-theme="dark"] #fmHelpDock.bg-light {
    --bs-bg-opacity: 0;
}
/* На md+: форма — строго по контенту (не растягивается), остров стран забирает
   всё свободное место, остров действий — справа. На мобильном — стек. */
@media (min-width: 768px) {
    #fmFiltersDock { flex: 0 0 auto; }
    #fmSectionNavDock { flex: 1 1 0; }
}
/* Появление 2-го острова (нав по странам) при уходе ленты выбора стран за экран. */
@keyframes fmDockIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
#fmSectionNavDock.fm-dock-in { animation: fmDockIn .25s ease; }
@media (prefers-reduced-motion: reduce) {
    #fmSectionNavDock.fm-dock-in { animation: none; }
}
/* Вуаль CTA-карточки тура — общий класс .orionm-tour-cta-veil в globus.css */

/* ===== Визард уточнения кодов (views/modal-codes.php) ===== */
#fmCodesModal .fm-focus { display: grid; grid-template-columns: 232px 1fr; height: 58vh; }
#fmCodesModal .fm-rail { overflow-y: auto; background: var(--si-gray-100); border-right: 1px solid var(--si-border-color); }
#fmCodesModal .fm-pane { overflow-y: auto; }

/* Рельс-степпер — нативного компонента такого размера в Bootstrap/Silicon нет, поэтому кастом. */
#fmCodesModal .fm-step { display: flex; gap: 12px; padding: 7px 0; position: relative; cursor: pointer; }
#fmCodesModal .fm-dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; line-height: 1; background: var(--si-body-bg); border: 2px solid var(--si-border-color); color: var(--si-gray-600); box-shadow: 0 .125rem .3rem -.0625rem rgba(11,15,25,.06); z-index: 2; }
#fmCodesModal .fm-step.done .fm-dot { background: var(--si-primary); border-color: var(--si-primary); color: #fff; }
#fmCodesModal .fm-step.active .fm-dot { border-color: var(--si-primary); color: var(--si-primary); box-shadow: 0 0 0 4px rgba(var(--si-primary-rgb), .16); }
#fmCodesModal .fm-step:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 33px; bottom: -7px; width: 2px; background: var(--si-border-color); z-index: 1; }
#fmCodesModal .fm-step.done:not(:last-child)::before { background: var(--si-primary); }
#fmCodesModal .fm-step.active .fm-step-name, #fmCodesModal .fm-step.done .fm-step-name { color: var(--si-gray-900) !important; }
#fmCodesModal .fm-step:hover .fm-step-name { color: var(--si-primary) !important; }

/* Ряды кодов — раскладка на утилитах Bootstrap; кастом только hover. */
#fmCodesModal .fm-frow { cursor: pointer; }
#fmCodesModal .fm-frow:last-child { border-bottom: 0 !important; }
#fmCodesModal .fm-frow:hover { background: var(--si-gray-100); border-radius: 12px; }
/* Описание кода ТН ВЭД показываем полностью — без обрезки в 2 строки.
   line-height перебивает inline-класс lh-1 из JS (иначе многострочный текст слипается). */
#fmCodesModal .fm-desc { overflow-wrap: anywhere; line-height: 1.35 !important; }

@media (max-width: 640px) {
    #fmCodesModal .fm-focus { grid-template-columns: 1fr; height: auto; }
    #fmCodesModal .fm-rail { border-right: none; border-bottom: 1px solid var(--si-border-color); overflow-x: auto; }
    /* Шаги лежат в обёртке (buildWizardRail) — горизонтальной делаем её, иначе список стран
       шёл столбиком на весь экран, а коды и «Далее» уезжали ниже. */
    #fmCodesModal .fm-rail > div { display: flex; gap: 16px; }
    #fmCodesModal .fm-step { padding: 4px 0; flex-shrink: 0; }
    #fmCodesModal .fm-step:not(:last-child)::before { display: none; }
    #fmCodesModal .fm-pane { max-height: 50vh; }
}

/* ===== Лендинг под формой (views/landing.php), пока нет результатов ===== */
.fm-land__eyebrow{ letter-spacing:.08em; }
.fm-land__mark{ width:26px; height:26px; border-radius:50%; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
  font-size:.8rem; font-weight:700; color:#9a6400; background:#fff4dc; border:2px solid #f0a500; }
.fm-land__mark--abs{ position:absolute; }
.fm-land__m1{ left:-12px; top:66px; }
.fm-land__m2{ left:63%; top:-13px; }
.fm-land__m3{ right:48px; top:-13px; }
.fm-land__srow{ display:grid; grid-template-columns:52px minmax(0,1.2fr) minmax(0,1.5fr) minmax(0,.9fr) 96px; align-items:center; column-gap:12px; padding:8px; }
.fm-land__shead{ padding-top:0; padding-bottom:0; }
.fm-land__score{ height:36px; display:flex; align-items:center; justify-content:center; }
.fm-land__verdict{ font-size:.8rem; padding:.45em .9em; }
@media (max-width:575.98px){
  .fm-land__srow{ grid-template-columns:44px minmax(0,1fr) auto minmax(0,.8fr); column-gap:8px; }
  .fm-land__verdict{ font-size:.7rem; }
}
.fm-land__icon{ width:44px; height:44px; border-radius:14px; display:inline-flex; align-items:center; justify-content:center;
  background:rgba(99,102,241,.1); color:#6366f1; font-size:1.25rem; }
.fm-land__icon--dark{ background:rgba(255,255,255,.12); color:#fff; }
.fm-land__step{ width:40px; height:40px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background:rgba(99,102,241,.1); color:#6366f1; font-weight:700; font-size:1.05rem; }
.fm-land__bars{ display:flex; align-items:flex-end; gap:8px; height:64px; }
.fm-land__bars i{ flex:1; display:block; border-radius:6px 6px 0 0; background:rgba(99,102,241,.15); }
.fm-land__bars i:last-child{ background:#6366f1; }
.fm-land__range{ position:relative; height:54px; }
.fm-land__rl{ position:absolute; left:0; right:0; top:32px; height:6px; border-radius:3px; background:var(--bs-secondary-bg, #e6e8f0); }
.fm-land__rm{ position:absolute; top:26px; width:2px; height:18px; background:var(--bs-secondary-color, #6f7287); }
.fm-land__ry{ position:absolute; top:0; transform:translateX(-50%); font-size:.75rem; font-weight:700; color:#fff; background:#6366f1; border-radius:999px; padding:2px 10px; }
.fm-land__chip{ display:inline-flex; align-items:center; gap:8px; font-size:.75rem; background:var(--bs-tertiary-bg, #f3f6ff); border-radius:999px; padding:6px 12px; }
.fm-land__chip i{ display:block; width:64px; height:8px; border-radius:4px; background:var(--bs-secondary-bg, #e6e8f0); }
.fm-land__kv{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.fm-land__kv--3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.fm-land__kv span{ display:flex; flex-direction:column; gap:2px; font-size:.72rem; line-height:1.25; color:var(--bs-secondary-color, #6f7287);
  background:var(--bs-tertiary-bg, #f3f6ff); border-radius:12px; padding:8px 10px; }
.fm-land__kv b{ font-size:.95rem; color:var(--bs-body-color, #33354d); }

/* Обзор рынков: от xl — фиксированная ширина строк с прокруткой в контейнере (см. js: .fm-ov-inner);
   до xl (телефон, планшет, узкий ноутбук) степпер/фото/спрос/«Почему» скрыты классами d-none d-xl-* и строка помещается. */
@media (min-width: 1200px) { .fm-ov-inner { min-width: 960px; } }
