/* Общие элементы бренда: логотип, кнопка «Здесь», переключатель оформления */

:root {
  --brand-teal: #2f6f6d;
  --brand-teal-hover: #255856;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo:hover,
.site-logo:focus {
  text-decoration: none;
}

.site-logo__img {
  display: block;
  width: 48px;
  height: auto;
  flex-shrink: 0;
}

.site-logo--compact .site-logo__img {
  width: 40px;
}

.site-logo__name {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.v3-brand.site-logo {
  font-family: var(--v3-serif, Georgia, serif);
  color: var(--v3-text, #2a2228);
}

.v3-brand.site-logo:hover {
  color: var(--v3-text, #2a2228);
}

.v2-logo.site-logo {
  font-family: var(--v2-font-serif, Georgia, serif);
  color: var(--v2-text, #2a2f28);
}

.v2-logo.site-logo:hover {
  color: var(--v2-text, #2a2f28);
}

.site-subnav {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.site-subnav .site-logo {
  color: #3b3b3b;
}

.site-subnav .nav-link {
  font-weight: 600;
  color: var(--brand-teal);
  text-decoration: none;
}

.site-subnav .nav-link:hover {
  color: var(--brand-teal-hover);
}

.cert-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-left: 0.35rem;
  padding: 0.18em 0.9em 0.22em;
  font-size: 0.92em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none !important;
  border-radius: 999px;
  border: 1px solid var(--cert-cta-border, var(--brand-teal));
  background: var(--cert-cta-bg, transparent);
  color: var(--cert-cta-color, var(--brand-teal)) !important;
  vertical-align: baseline;
  white-space: nowrap;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: none;
}

.cert-cta-btn::after {
  content: "→";
  font-size: 0.82em;
  line-height: 1;
  opacity: 0.72;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.cert-cta-btn:hover,
.cert-cta-btn:focus {
  background: var(--cert-cta-hover-bg, var(--brand-teal));
  border-color: var(--cert-cta-hover-bg, var(--brand-teal));
  color: #fff !important;
  transform: none;
  box-shadow: 0 4px 14px var(--cert-cta-shadow, rgba(47, 111, 109, 0.22));
}

.cert-cta-btn:hover::after,
.cert-cta-btn:focus::after {
  opacity: 1;
  transform: translateX(2px);
}

body.v2 .cert-cta-btn {
  --cert-cta-border: var(--v2-accent-dark);
  --cert-cta-color: var(--v2-accent-dark);
  --cert-cta-hover-bg: var(--v2-accent-dark);
  --cert-cta-shadow: rgba(79, 99, 82, 0.22);
}

body.v3 .cert-cta-btn {
  --cert-cta-border: var(--v3-accent);
  --cert-cta-color: var(--v3-accent-deep);
  --cert-cta-hover-bg: var(--v3-accent-deep);
  --cert-cta-shadow: rgba(61, 44, 53, 0.18);
}

.design-switch {
  margin-top: 1.25rem;
}

.design-switch__label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.design-switch__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.design-switch__link {
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.design-switch__link--current {
  font-weight: 700;
  text-decoration: none;
  pointer-events: none;
}

/* Классический шаблон (index0, documents) */
.site-footer .design-switch__label {
  color: #565758;
}

.site-footer .design-switch__link {
  color: #3d5a80;
}

.site-footer .design-switch__link:hover {
  color: #2c4466;
}

.site-footer .design-switch__link--current {
  color: #3b3b3b;
}

/* index0: логотип в шапке */
.navbar > .container > .site-logo {
  margin-right: 0.5rem;
}

@media screen and (min-width: 992px) {
  .navbar > .container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
  }

  .menu-wrapper {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
  }

  .menu-wrapper .navbar-collapse {
    flex: 1 1 auto;
    min-width: 0;
  }

  .menu-wrapper .heroLinks {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    flex-shrink: 0;
    gap: 0.75rem;
    margin-left: auto;
  }

  .menu-wrapper .heroLinks .custom-link {
    white-space: nowrap;
    margin-right: 0 !important;
  }
}

@media screen and (max-width: 991.98px) {
  .navbar > .container {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.75rem;
  }

  .navbar > .container > .site-logo {
    grid-column: 1;
    grid-row: 1;
    max-width: min(100%, 10rem);
  }

  .navbar > .container > .site-logo .site-logo__name {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-toggler {
    grid-column: 3;
    grid-row: 1;
  }

  .menu-wrapper .heroLinks {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    flex-wrap: nowrap;
  }

  .menu-wrapper .navbar-collapse {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .menu-wrapper {
    display: contents;
  }
}

/* Тёмные подвалы v2 / v3 */
.v2-footer .design-switch__label,
.v3-footer .design-switch__label {
  color: rgba(255, 255, 255, 0.75);
}

.v2-footer .design-switch__link,
.v3-footer .design-switch__link {
  color: rgba(255, 255, 255, 0.9);
}

.v2-footer .design-switch__link:hover,
.v3-footer .design-switch__link:hover {
  color: #fff;
}

.v2-footer .design-switch__link--current,
.v3-footer .design-switch__link--current {
  color: #fff;
}

/* Gilazoff LAB + копирайт в одной строке (как gilazov.ru / iidogovor) */
.footer-bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  text-align: center;
}

.v2-footer__bottom.footer-bottom-bar {
  color: rgba(255, 255, 255, 0.55);
}

.site-footer__bottom-bar.footer-bottom-bar {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--p-color, #717070);
}

html[data-theme="dark"] .site-footer__bottom-bar.footer-bottom-bar {
  border-top-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
}

.footer-bottom-bar .footer-lab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

.v2-footer__bottom.footer-bottom-bar .footer-lab-link:hover {
  color: rgba(255, 255, 255, 0.88);
}

.site-footer__bottom-bar.footer-bottom-bar .footer-lab-link:hover {
  color: var(--p-color, #717070);
  opacity: 0.85;
}

.footer-bottom-bar .footer-lab-mark {
  display: block;
  flex-shrink: 0;
}

.v2-footer__bottom.footer-bottom-bar .footer-brand {
  color: #e8ede8;
  font-weight: 400;
  letter-spacing: -0.4px;
}

.v2-footer__bottom.footer-bottom-bar .footer-lab-link:hover .footer-brand {
  color: #fff;
}

.v2-footer__bottom.footer-bottom-bar .brand-off {
  color: #9bb09b;
}

.v2-footer__bottom.footer-bottom-bar .brand-lab {
  color: #b8ccb8;
  font-size: 0.92em;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.v2-footer__bottom.footer-bottom-bar .footer-lab-hub {
  color: #b8ccb8;
  font-weight: 600;
  text-decoration: none;
}

.v2-footer__bottom.footer-bottom-bar .footer-lab-hub:hover {
  color: #dce6dc;
}

.site-footer__bottom-bar.footer-bottom-bar .footer-lab-hub {
  font-weight: 600;
  text-decoration: none;
  color: var(--primary-color, #ff4400);
}

.site-footer__bottom-bar.footer-bottom-bar .brand-off {
  color: #4a8bff;
}

.site-footer__bottom-bar.footer-bottom-bar .brand-lab {
  color: #3768c4;
  font-size: 0.92em;
  font-weight: 500;
}

.footer-bottom-bar .footer-sep {
  opacity: 0.45;
  user-select: none;
}

html[data-theme="dark"] body.v2 .footer-bottom-bar .brand-off {
  color: #7fb0ff;
}

html[data-theme="dark"] body.v2 .footer-bottom-bar .brand-lab,
html[data-theme="dark"] body.v2 .footer-bottom-bar .footer-lab-hub {
  color: #9eb8ff;
}

html[data-theme="dark"] body.v2 .footer-bottom-bar .footer-lab-hub:hover {
  color: #c5d4ff;
}

html[data-theme="dark"] .site-footer__bottom-bar.footer-bottom-bar .brand-off {
  color: #7fb0ff;
}

html[data-theme="dark"] .site-footer__bottom-bar.footer-bottom-bar .brand-lab,
html[data-theme="dark"] .site-footer__bottom-bar.footer-bottom-bar .footer-lab-hub {
  color: #9eb8ff;
}

/* Страница документов */
.documents-page__section {
  padding-top: 48px;
}

.documents-page .v2-section__head h1 {
  font-family: var(--v2-font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.v2-header__utilities--solo {
  margin-left: auto;
}

.v2-btn--compact {
  padding: 10px 16px;
  font-size: 0.88rem;
}

.doc-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
}

.doc-gallery__figure {
  margin: 0;
  border-radius: var(--v2-radius, 20px);
  background: var(--v2-surface, #fff);
  box-shadow: var(--v2-shadow, 0 18px 50px rgba(42, 42, 42, 0.08));
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.doc-gallery__figure:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 48px rgba(42, 42, 42, 0.12);
}

.doc-gallery__open {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  text-align: center;
}

.doc-gallery__open img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  image-orientation: from-image;
  background: #f3efe9;
}

.doc-gallery__figure[data-rotate="90"] .doc-gallery__open img {
  transform: rotate(90deg);
  max-height: none;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.doc-gallery__figure[data-rotate="270"] .doc-gallery__open img {
  transform: rotate(-90deg);
  max-height: none;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.doc-gallery__figure[data-rotate="180"] .doc-gallery__open img {
  transform: rotate(180deg);
}

.doc-gallery__zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(42, 42, 42, 0.72);
  color: #fff;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.doc-gallery__figure:hover .doc-gallery__zoom,
.doc-gallery__open:focus-visible .doc-gallery__zoom {
  opacity: 1;
}

.doc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgba(18, 20, 19, 0.88);
  backdrop-filter: blur(6px);
}

.doc-lightbox[hidden] {
  display: none !important;
}

body.doc-lightbox-open {
  overflow: hidden;
}

.doc-lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.doc-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.doc-lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 1100px);
  max-height: calc(100vh - 120px);
}

.doc-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  image-orientation: from-image;
}

.doc-lightbox__img--rotate-90 {
  transform: rotate(90deg);
  max-height: min(calc(100vh - 120px), 90vw);
}

.doc-lightbox__img--rotate-270 {
  transform: rotate(-90deg);
  max-height: min(calc(100vh - 120px), 90vw);
}

.doc-lightbox__img--rotate-180 {
  transform: rotate(180deg);
}

.doc-lightbox__caption {
  margin: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
  text-align: center;
}
