/* ============================================================
   BUSINESS INTEGRATOR — main.css
   Порядок подключения: tokens.css → fonts.css → main.css
   ============================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bi-bg);
  color: var(--bi-text);
  font-family: var(--bi-font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgba(110,43,240,.35); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---- Keyframes ---- */
@keyframes biDrift {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes biDriftB {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(10px); }
}
@keyframes plateOFA-top {
  0%, 45%  { background: var(--bi-amber); }
  55%, 100% { background: var(--bi-green); }
}
@keyframes plateOFA-bot {
  0%, 45%  { background: var(--bi-green); }
  55%, 100% { background: var(--bi-amber); }
}
@keyframes revealIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Layout ---- */
.bi-wrap {
  position: relative;
  background: var(--bi-bg);
  overflow-x: hidden;
}
.bi-container {
  max-width: var(--bi-maxw);
  margin: 0 auto;
  padding-left: var(--bi-gutter);
  padding-right: var(--bi-gutter);
}

/* ---- Header ---- */
.bi-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 88px;
  background: rgba(10,10,12,.74);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--bi-hairline);
}
.bi-header__inner {
  max-width: var(--bi-maxw);
  margin: 0 auto;
  padding: 0 var(--bi-gutter);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.bi-logo { display: block; height: 19px; width: auto; flex: none; }
.bi-nav {
  display: flex;
  align-items: center;
  gap: 38px;
  font-family: var(--bi-font-mono);
  font-size: var(--bi-nav);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bi-text-2);
}
.bi-nav a { transition: color .2s; }
.bi-nav a.active { color: var(--bi-text); }
.nav-link { position: relative; }
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -7px;
  height: 2px;
  background: var(--bi-coral);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .26s ease;
}
.nav-link.active::after { transform: scaleX(1); }
/* :hover rules scoped to hover-capable devices only — on touch (iOS Safari), an
   :after-changing :hover with no click handler eats the first tap to trigger
   the hover state, requiring a second tap to actually follow the link. */
@media (hover: hover) {
  .bi-nav a:hover { color: var(--bi-text); }
  .nav-link:hover::after { transform: scaleX(1); }
}

/* Burger (CSS-only, checkbox) */
.bi-burger-cb { display: none; }
.bi-burger { display: none; }

/* ---- Narrow desktop nav (761–1120px): компактнее, чтобы влезло 5 пунктов ---- */
@media (min-width: 761px) and (max-width: 1120px) {
  .bi-nav { gap: 18px !important; font-size: 11.5px !important; letter-spacing: .05em !important; }
}

/* ---- Mobile nav / burger (≤760px) ---- */
@media (max-width: 760px) {
  /* Burger icon: show */
  .bi-burger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0 !important;
    color: var(--bi-text);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    flex: none;
  }
  /* Nav: collapse in header, expand on checkbox */
  .bi-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0 !important;
    background: var(--bi-bg);
    border-bottom: 1px solid var(--bi-hairline);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s ease;
    z-index: 49;
  }
  .bi-burger-cb:checked ~ .bi-nav { max-height: 340px; }
  .bi-nav a { padding: 15px 24px; width: 100%; border-top: 1px solid rgba(255,255,255,.05); }
  /* Header — логотип-вордмарк на всю строку */
  header > div { gap: 8px !important; padding-left: 20px !important; padding-right: 20px !important; }
  header > div > a:first-child { flex: 1 1 auto !important; display: block !important; }
  header > div > a:first-child img { width: 100% !important; height: auto !important; max-height: 22px !important; }
  /* Typography */
  h1 { font-size: clamp(34px,8.4vw,46px) !important; line-height: 1.05 !important; }
  h2 { line-height: 1.1 !important; font-family: 'Onest',sans-serif !important; font-weight: 600 !important; letter-spacing: -0.012em !important; }
  p.bi-statement { font-family: 'Onest',sans-serif !important; font-weight: 600 !important; font-size: 24px !important; line-height: 1.26 !important; }
  p.bi-lead { font-family: 'Onest',sans-serif !important; font-size: 21px !important; line-height: 1.32 !important; font-weight: 500 !important; color: #ECEBE8 !important; margin: 0 0 16px !important; }
  p.bi-note { font-size: 15.5px !important; line-height: 1.56 !important; color: #8E8B94 !important; margin: 0 0 14px !important; }
  /* Hero */
  .bi-hero { display: block !important; min-height: 0 !important; padding-top: 28px !important; padding-bottom: 44px !important; padding-left: 22px !important; padding-right: 22px !important; }
  .bi-hero-plate { position: relative !important; top: auto !important; right: auto !important; bottom: auto !important; left: auto !important; width: 100% !important; max-width: 100% !important; height: 168px !important; margin-bottom: 30px !important; }
  .bi-hero-plate2 { display: none !important; }
  .bi-hero-body { padding: 0 !important; max-width: 100% !important; }
  /* Plates — hero main (top:0 right:-40px) → mobile banner, same as bi-hero-plate */
  .bi-plate[style*="top:0; right:-40px"] { position: relative !important; top: auto !important; right: auto !important; bottom: auto !important; left: auto !important; width: 100% !important; max-width: 100% !important; height: 168px !important; margin-bottom: 30px !important; display: block !important; }
  /* Plates — decorative absolute (off-screen) → keep hidden */
  .bi-plate[style*="left:-80px"], .bi-plate[style*="top:-40px"], .bi-plate[style*="top:-90px"] { display: none !important; }
  /* Solution cards inner padding (index.html) */
  .sol-card > div { padding-left: 16px !important; padding-right: 16px !important; }
  /* Career/feature cards with heavy inline padding (kariera.html) */
  div[style*="padding:36px 36px"] { padding-left: 20px !important; padding-right: 20px !important; }
  /* Grids — named classes */
  .items-grid { grid-template-columns: 1fr !important; }
  .cases-grid { grid-template-columns: 1fr !important; }
  .depth-grid { grid-template-columns: 1fr !important; }
  .form2-grid { grid-template-columns: 1fr !important; }
  .contacts-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
  #contact-form button[type="submit"] { width: 100% !important; }
  /* Grids — inline-style fallbacks (ofa / kariera / index) */
  [style*="grid-template-columns:minmax(0,340px)"] { display: block !important; }
  [style*="grid-template-columns:repeat(2,1fr)"] { grid-template-columns: 1fr !important; }
  [style*="minmax(280px,1fr)"] { grid-template-columns: 1fr !important; }
  /* Attr selectors for inline-style elements */
  p[style*="font-size:19px"] { font-size: 17px !important; line-height: 1.5 !important; }
  p[style*="font-size:17px"] { font-size: 15.5px !important; line-height: 1.5 !important; }
}

/* ---- Skew-маркер ---- */
.bi-skew {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--bi-coral);
  transform: skewX(-14deg);
  flex: none;
}
.bi-section-label {
  display: flex;
  align-items: center;
  gap: 11px;
}
.bi-section-label span:last-child {
  font-family: var(--bi-font-mono);
  font-size: var(--bi-label);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--bi-text-3);
}

/* ---- Плашка-орнамент ---- */
.bi-plate {
  position: relative;
  z-index: 0;
  overflow: hidden;
  border-radius: var(--bi-radius-plate);
  animation: biDrift 10s ease-in-out infinite;
}
.bi-plate.drift-b { animation-name: biDriftB; animation-duration: 12s; }
.bi-plate svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bi-plate-inner {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr;
}
.bi-plate-layer {
  position: absolute;
  inset: 0;
  transition: opacity .7s ease;
}

/* OFA пульсация */
.plate-ofa-top {
  background: var(--bi-amber);
  animation: biDrift 10s ease-in-out infinite, plateOFA-top 11s ease-in-out infinite;
}
.plate-ofa-bot {
  background: var(--bi-green);
  animation: biDrift 12s ease-in-out infinite, plateOFA-bot 11s ease-in-out infinite;
}

/* ---- Reveal on scroll ---- */
/* Без JS — контент полностью видим. JS добавляет reveal-init, потом revealed. */
[data-reveal].reveal-init {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--bi-reveal-dur) var(--bi-ease),
              transform var(--bi-reveal-dur) var(--bi-ease);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--bi-reveal-dur) var(--bi-ease),
              transform var(--bi-reveal-dur) var(--bi-ease);
}

/* ---- Solution cards ---- */
.sol-card {
  background: var(--bi-card);
  border: 1px solid var(--bi-hairline);
  border-radius: var(--bi-radius-card);
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease;
}
.sol-card:hover {
  border-color: rgba(255,255,255,.2);
  transform: translateY(-2px);
}
.sol-more {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .4s ease, opacity .3s ease;
}
.sol-card:hover .sol-more { max-height: 400px; opacity: 1; }

/* ---- Items grid (resheniya: solution bullet list) ---- */
.items-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; }

/* ---- Cases grid ---- */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
}
.cases-grid > * {
  display: flex;
  flex-direction: column;
}

/* ---- Depth grid (OFA) ---- */
.depth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* ---- Contacts ---- */
.contacts-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
}
.form2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fld {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: var(--bi-text);
  font-family: var(--bi-font-display);
  font-size: 16px;
  padding: 12px 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.fld:focus { border-color: rgba(255,255,255,.3); }
textarea.fld { resize: vertical; min-height: 100px; display: block; }

/* ---- Footer ---- */
.bi-footer {
  background: var(--bi-bg);
  border-top: 1px solid var(--bi-hairline);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 56px;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px 32px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px 20px;
  font-family: var(--bi-font-mono);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--bi-text-2);
}
.footer-nav a { transition: color .2s; }
.footer-nav a:hover { color: var(--bi-text); }

/* ---- Tooltip ---- */
.bi-tooltip-wrap {
  position: relative;
  display: inline;
  cursor: default;
}
.bi-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,26,.97);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--bi-text-2);
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  font-family: var(--bi-font-display);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.bi-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(20,20,26,.97);
}
.bi-tooltip-wrap:hover .bi-tooltip { display: block; }

/* ---- OFA Modal ---- */
.bi-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.bi-modal-overlay.open { display: flex; }
.bi-modal {
  background: #0C0C12;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--bi-shadow-modal);
  position: relative;
}
.bi-modal__head {
  padding: 36px 40px 24px;
  border-bottom: 1px solid var(--bi-hairline);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.bi-modal__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
}
.bi-modal__close {
  background: none;
  border: none;
  color: var(--bi-text-3);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px;
  flex: none;
  transition: color .2s;
}
.bi-modal__close:hover { color: var(--bi-text); }
.bi-modal__body { padding: 28px 40px 36px; }
.bi-modal__thanks {
  display: none;
  padding: 40px;
  text-align: center;
}
.bi-modal__thanks h3 { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
.bi-modal__thanks p { font-size: 17px; color: var(--bi-text-2); margin: 0; line-height: 1.6; }
.bi-modal.sent .bi-modal__head,
.bi-modal.sent .bi-modal__body { display: none; }
.bi-modal.sent .bi-modal__thanks { display: block; }

/* Form */
.bi-form { display: flex; flex-direction: column; gap: 18px; }
.bi-field { display: flex; flex-direction: column; gap: 6px; }
.bi-field label {
  font-size: 13px;
  font-family: var(--bi-font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bi-text-3);
}
.bi-field input,
.bi-field select,
.bi-field textarea {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: var(--bi-text);
  font-family: var(--bi-font-display);
  font-size: 16px;
  padding: 12px 16px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
  -webkit-appearance: none;
}
.bi-field input:focus,
.bi-field select:focus,
.bi-field textarea:focus { border-color: rgba(255,255,255,.3); }
.bi-field select { cursor: pointer; }
.bi-field select option { background: #0C0C12; }
.bi-field textarea { resize: vertical; min-height: 90px; }
.bi-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bi-field.required label::after { content: ' *'; color: var(--bi-coral); }
.bi-btn-coral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bi-coral);
  color: var(--bi-coral-ink);
  font-family: var(--bi-font-display);
  font-weight: 600;
  font-size: 17px;
  padding: 17px 34px;
  border-radius: var(--bi-radius-btn);
  border: none;
  cursor: pointer;
  transition: transform .2s;
  width: 100%;
  margin-top: 8px;
}
.bi-btn-coral:hover { transform: translateY(-2px); }
.bi-btn-emerald {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bi-emerald);
  color: var(--bi-text);
  font-weight: 600;
  font-size: 17px;
  padding: 17px 34px;
  border-radius: var(--bi-radius-btn);
  border: none;
  cursor: pointer;
  transition: transform .2s, background .2s;
}
.bi-btn-emerald:hover { transform: translateY(-2px); background: #1C7D5E; }

/* ---- Kariera grids ---- */
.roles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }

/* ---- Catalog grid (resheniya subpages) ---- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 768px) { .cat-grid { grid-template-columns: 1fr; } }

/* ---- Responsive: tablet / modal ---- */
@media (max-width: 1024px) {
  .bi-modal__head { padding: 28px 32px 20px; }
  .bi-modal__body { padding: 24px 32px 32px; }
}
@media (max-width: 768px) {
  .bi-modal__head { padding: 24px 24px 20px; }
  .bi-modal__body { padding: 20px 24px 28px; }
  .bi-form-row { grid-template-columns: 1fr; gap: 18px; }
}

