/* ООО «БЕРГ ГРУПП» — корпоративный сайт.
   Дизайн-система общая с berggroups.site: белый премиум-минимализм.
   Мотив «≡» — три полосы из E в логотипе BERG.
   Кейсы поданы как инженерный чертёж: линейная графика на миллиметровке. */

:root {
  --bg:      #ffffff;
  --bg-2:    #fafafa;
  --bg-3:    #f5f5f7;
  --bg-4:    #ededf0;
  --ink:     #111113;
  --ink-2:   #1c1c1f;
  --text:    #1d1d1f;
  --muted:   #6e6e73;
  --muted-2: #a1a1a6;
  --line:    rgba(0,0,0,0.08);
  --line-2:  rgba(0,0,0,0.14);
  --line-on-ink: rgba(255,255,255,0.12);
  --grid:    rgba(17,17,19,0.05);
  --radius:  18px;
  --radius-lg: 28px;
  --nav-h:   52px;
  --accent:  #0066cc;
  --shadow-soft: 0 2px 10px rgba(0,0,0,0.04);
  --shadow-lift: 0 18px 44px rgba(0,0,0,0.12);
  --font-display: 'Unbounded', -apple-system, "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Inter, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.47059;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ── Навигация ── */

.site-nav-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { height: 14px; width: auto; display: block; }
.brand-dim {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.nav-links { display: flex; align-items: center; gap: 26px; }

.nav-link {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s;
  line-height: 1;
  padding: 6px 0;
}
.nav-link:hover { color: var(--text); }

.nav-cta {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  transition: opacity 0.2s;
}
.nav-cta:hover { opacity: 0.85; }

.nav-burger { display: none; }

@media (max-width: 900px) {
  .nav-burger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 40px; height: 40px;
    margin-right: -8px;
    background: none; border: 0; padding: 0;
    cursor: pointer;
  }
  .nav-burger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s;
  }
  .menu-open .nav-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .menu-open .nav-burger span:nth-child(2) { opacity: 0; }
  .menu-open .nav-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
  }
  .menu-open .nav-links { display: flex; }
  .nav-links .nav-link {
    padding: 14px 0;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
  }
  .nav-cta { align-self: flex-start; margin-top: 16px; padding: 10px 20px; }
}

/* ── Секции ── */

main { flex: 1; padding-top: var(--nav-h); }

.section { padding: 84px 0; }
.section + .section { padding-top: 0; }

section { scroll-margin-top: 76px; }

/* Разделитель-мотив «≡» */
.rule {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 26px;
  margin-bottom: 30px;
}
.rule span { height: 2px; background: var(--ink); border-radius: 1px; }
.rule span:nth-child(2) { width: 78%; }
.rule span:nth-child(3) { width: 52%; }

.section-head { margin-bottom: 30px; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 20ch;
}
.section-head h2 b { font-weight: 700; }

.section-intro {
  font-size: clamp(15px, 1.5vw, 17px);
  color: var(--muted);
  max-width: 640px;
  line-height: 1.7;
  margin-top: 18px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 16px;
}

/* ── Герой ── */

.hero { padding: 76px 0 60px; }

.hero-logo {
  width: min(330px, 66vw);
  height: auto;
  display: block;
  margin-bottom: 32px;
  animation: logoReveal 1.1s cubic-bezier(.22,1,.36,1) 0.1s backwards;
}
@keyframes logoReveal {
  from { clip-path: inset(0 100% 0 0); opacity: 0.4; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.6vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 300;
  max-width: 22ch;
  margin-bottom: 28px;
}
.hero h1 b { font-weight: 700; }

.hero-sub {
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--muted);
  max-width: 540px;
  line-height: 1.7;
  margin-bottom: 34px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn-cta {
  display: inline-block;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  padding: 13px 26px;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-cta:hover { opacity: 0.86; transform: translateY(-1px); }

.btn-ghost {
  display: inline-block;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-3);
  border-radius: 999px;
  padding: 13px 26px;
  transition: background 0.2s;
}
.btn-ghost:hover { background: var(--bg-4); }

/* ── Полоса фактов ── */

.factbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fact { background: var(--bg); padding: 26px 24px 26px 0; }
.fact + .fact { padding-left: 24px; }
.fact-num {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 9px;
}
.fact-label { font-size: 12.5px; color: var(--muted); line-height: 1.45; max-width: 22ch; }

@media (max-width: 760px) {
  .factbar { grid-template-columns: repeat(2, 1fr); }
  .fact { padding-right: 14px; }
}

/* ── Карточки услуг ── */

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: 30px 28px;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  background: var(--bg);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}
.card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 13px;
  line-height: 1.28;
}
.card p { font-size: 14px; color: var(--muted); line-height: 1.62; flex: 1; }
.card-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ── Процесс: настоящая последовательность, поэтому нумерация ── */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 26px;
  row-gap: 8px;
  counter-reset: step;
}
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.step {
  padding: 26px 0 30px;
  border-top: 2px solid var(--ink);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.step h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 11px;
  line-height: 1.3;
}
.step p { font-size: 13.5px; color: var(--muted); line-height: 1.62; }

/* ── Кейсы: чертёж ── */

.case {
  display: grid;
  /* Ровно 1:1 — граница листа обязана совпасть со средним
     разделителем полосы метрик, иначе линии не сходятся встык */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 20px;
}
.case:last-child { margin-bottom: 0; }

@media (max-width: 880px) {
  .case { grid-template-columns: 1fr; }
}

/* Лист чертежа */
.sheet {
  position: relative;
  background-color: var(--bg-2);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  /* Привязка к правому нижнему углу: клетка заканчивается ровно на границе
     с полосой метрик, а не обрывается на середине квадрата */
  background-position: right bottom;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 30px;
  min-height: 320px;
}
@media (max-width: 880px) {
  .sheet { border-right: 0; border-bottom: 1px solid var(--line); min-height: 260px; }
}

.sheet-tag {
  position: absolute;
  top: 16px; left: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.bp { width: 100%; height: auto; max-width: 360px; color: var(--ink); display: block; }
.bp .ln   { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.bp .ln-2 { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; opacity: 0.42; }
.bp .ln-3 { fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; opacity: 0.24; }
.bp .dash { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.4; }
.bp .fill { fill: currentColor; }
.bp text {
  font-family: var(--font-mono);
  font-size: 8.5px;
  fill: currentColor;
  opacity: 0.5;
  letter-spacing: 0.04em;
}
.bp .glyph { font-family: var(--font-display); font-size: 20px; fill: currentColor; opacity: 0.32; }
.bp .fill-2 { fill: currentColor; opacity: 0.12; }
.bp .fill-3 { fill: currentColor; opacity: 0.06; }

/* Правая колонка кейса */
.case-body {
  padding: 34px 34px 30px;
  display: flex;
  flex-direction: column;
}
@media (max-width: 520px) { .case-body { padding: 26px 22px 28px; } }

.case-body h3 {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.1vw, 23px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.22;
  margin-bottom: 14px;
}
.case-desc { font-size: 14.5px; color: var(--muted); line-height: 1.68; }

.case-list { list-style: none; margin: 20px 0 0; }
.case-list li {
  position: relative;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 10px;
}
.case-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 9px;
  width: 11px; height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

.case-stack {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.7;
  margin-top: auto;
  padding: 22px 0 0;
}

/* Полоса метрик внизу кейса */
.metric-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
@media (max-width: 560px) { .metric-strip { grid-template-columns: repeat(2, 1fr); } }

.metric { background: var(--bg); padding: 20px 22px 22px; }
.metric-num {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 7px;
}
.metric-label { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ── Тёмный блок-якорь: госзаказчикам ── */

.ink-block {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 58px 52px;
}
@media (max-width: 640px) { .ink-block { padding: 38px 24px; border-radius: var(--radius); } }

.ink-block .eyebrow { color: rgba(255,255,255,0.45); }
.ink-block .rule span { background: #fff; }
.ink-block h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.14;
  margin-bottom: 20px;
  max-width: 17ch;
}
.ink-block h2 b { font-weight: 700; }
.ink-block > p {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  max-width: 620px;
  margin-bottom: 38px;
}

.ink-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line-on-ink);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 780px) { .ink-grid { grid-template-columns: 1fr; } }

.ink-cell { background: var(--ink); padding: 24px 22px; }
.ink-cell h3 {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 11px;
  color: #fff;
}
.ink-cell p { font-size: 13px; color: rgba(255,255,255,0.58); line-height: 1.62; }

/* ── Реквизиты ── */

.req-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.req-table tr { border-bottom: 1px solid var(--line); }
.req-table tr:first-child { border-top: 1px solid var(--line); }
.req-table th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  padding: 15px 24px 15px 0;
  width: 260px;
  vertical-align: top;
  font-size: 13px;
}
.req-table td { padding: 15px 0; vertical-align: top; }
.req-table td.mono { font-size: 13.5px; }
@media (max-width: 640px) {
  .req-table th { width: 128px; padding-right: 14px; font-size: 12px; }
  .req-table td { font-size: 13px; }
}

/* ── Контакты ── */

.contact-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}
.contact-card:hover {
  background: var(--bg);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}
.contact-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
}
.contact-card p { font-size: 13.5px; color: var(--muted); line-height: 1.62; flex: 1; }
.contact-handle {
  align-self: flex-start;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* ── Подвал ── */

footer {
  border-top: 1px solid var(--line);
  padding: 44px 0 52px;
  background: var(--bg-2);
  margin-top: 84px;
}
.foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  flex-wrap: wrap;
}
.foot-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.foot-brand img { height: 13px; width: auto; }
.foot-legal { font-size: 12.5px; color: var(--muted); line-height: 1.75; max-width: 60ch; }
.foot-links { display: flex; flex-direction: column; gap: 10px; }
.foot-links a { font-size: 13px; color: var(--muted); }
.foot-links a:hover { color: var(--text); }

/* ── Появление при прокрутке ── */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s cubic-bezier(.22,1,.36,1), transform 0.7s cubic-bezier(.22,1,.36,1);
}
.reveal.in { opacity: 1; transform: none; }

/* Поочерёдное появление элементов внутри сетки */
.stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.62s cubic-bezier(.22,1,.36,1), transform 0.62s cubic-bezier(.22,1,.36,1);
}
.stagger.in > * { opacity: 1; transform: none; }
.stagger.in > *:nth-child(2) { transition-delay: 0.07s; }
.stagger.in > *:nth-child(3) { transition-delay: 0.14s; }
.stagger.in > *:nth-child(4) { transition-delay: 0.21s; }
.stagger.in > *:nth-child(5) { transition-delay: 0.28s; }
.stagger.in > *:nth-child(6) { transition-delay: 0.35s; }

/* Фон этих сеток и есть линии-разделители — держим его прозрачным,
   пока ячейки не появились, иначе мелькает сплошной прямоугольник */
.factbar.stagger, .ink-grid.stagger { transition: background-color 0.5s ease 0.2s; }
.factbar.stagger:not(.in), .ink-grid.stagger:not(.in) { background-color: transparent; }

/* Знак «≡» прочерчивается слева направо */
.reveal .rule span,
.stagger .rule span {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(.22,1,.36,1);
}
.reveal.in .rule span,
.stagger.in .rule span { transform: scaleX(1); }
.reveal.in .rule span:nth-child(2) { transition-delay: 0.09s; }
.reveal.in .rule span:nth-child(3) { transition-delay: 0.18s; }

/* Чертёж вычерчивается: подготовка состояний, запуск из JS */
.bp.pending .fill,
.bp.pending .fill-2,
.bp.pending .fill-3,
.bp.pending .dash,
.bp.pending text { opacity: 0; }
.bp.drawn .fill,
.bp.drawn .fill-2,
.bp.drawn .fill-3,
.bp.drawn .dash,
.bp.drawn text { transition: opacity 0.55s ease 0.5s; }
.bp.drawn .fill { opacity: 1; }
.bp.drawn .fill-2 { opacity: 0.12; }
.bp.drawn .fill-3 { opacity: 0.06; }
.bp.drawn .dash { opacity: 0.4; }
.bp.drawn text { opacity: 0.5; }
.bp.drawn .glyph { opacity: 0.32; }

/* Тень навигации после прокрутки */
.site-nav-bar { transition: box-shadow 0.3s, border-color 0.3s; }
.site-nav-bar.scrolled { box-shadow: 0 1px 16px rgba(0,0,0,0.06); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .stagger > * { opacity: 1; transform: none; transition: none; }
  .reveal .rule span, .stagger .rule span { transform: none; transition: none; }
  .hero-logo { animation: none; }
  .card:hover, .contact-card:hover, .btn-cta:hover { transform: none; }
}
