/* ==========================================================================
   ИСТ — Инженерный сервис теплообменников
   Design tokens: blueprint-technical direction, built from the brand mark.
   Red = горячий контур, синий = холодный контур (эхо логотипа) —
   этот же принцип "hot / cold" используется по всему сайту.
   ========================================================================== */

:root {
  /* Color */
  --navy-900: #0F1720;   /* глубокий фон (hero, footer) */
  --navy-800: #192432;   /* основной фирменный тёмный */
  --navy-700: #263141;   /* карточки на тёмном фоне */
  --red-600:  #DD1C1C;   /* горячий контур / основной CTA */
  --red-700:  #B71414;
  --blue-600: #0152B6;   /* холодный контур / вторичный акцент */
  --blue-100: #E8F0FC;
  --gray-600: #606572;   /* вторичный текст */
  --gray-400: #9AA3B2;
  --line:     #D8DCE2;   /* волосяные линии, чертёжная сетка */
  --paper:    #F4F5F7;   /* светлый фон секций */
  --white:    #FFFFFF;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --maxw: 1180px;
  --gutter: 24px;
  --radius: 2px; /* почти нет скругления — чертёжная точность */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--navy-800);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.08;
}
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Eyebrow / mono label — used for spec-style annotations, echoing
   engineering-drawing callouts (e.g. "Т1 140°C") */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-600);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--red-600);
}
.eyebrow.on-dark { color: #FF8A6B; }
.eyebrow.on-dark::before { background: #FF8A6B; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 14px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary {
  background: var(--red-600);
  color: var(--white);
}
.btn-primary:hover { background: var(--red-700); }
.btn-outline {
  border-color: rgba(255,255,255,0.35);
  color: var(--white);
}
.btn-outline:hover { border-color: var(--white); }
.btn-outline.on-light {
  border-color: var(--navy-800);
  color: var(--navy-800);
}
.btn-outline.on-light:hover { background: var(--navy-800); color: var(--white); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.site-header .logo { width: 150px; }
.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: 1;
  margin-left: 40px;
}
.site-nav a {
  font-size: 15px;
  color: var(--navy-800);
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
}
.site-nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--red-600);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .15s ease;
}
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--red-600); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-900);
  color: var(--gray-400);
  padding: 64px 0 28px;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-grid > * { flex: 1 1 0; min-width: 0; }
.footer-grid > *:first-child { flex-grow: 1.2; }
.footer-grid .logo { width: 140px; margin-bottom: 16px; }
.footer-grid p { max-width: 32ch; font-size: 14px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 18px;
  font-weight: 500;
}
.footer-col ul { display: flex; flex-direction: column; gap: 11px; }
.footer-col a, .footer-col li { font-size: 14px; }
.footer-col a:hover { color: var(--white); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ---------- Blueprint grid background ---------- */
.blueprint {
  position: relative;
  background-color: var(--navy-900);
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: 72px 0 56px;
  color: var(--white);
}
.page-hero h1 { font-size: clamp(34px, 4.5vw, 52px); }
.page-hero .eyebrow { margin-bottom: 18px; }
.page-hero .lede {
  margin-top: 18px;
  max-width: 60ch;
  font-size: 18px;
  color: var(--gray-400);
}

/* ---------- Generic section paddings ---------- */
.section { padding: 88px 0; }
.section-tight { padding: 56px 0; }
.section-light { background: var(--paper); }
.section-navy { background: var(--navy-800); color: var(--white); }

.section-head {
  max-width: 640px;
  margin-bottom: 48px;
}
.section-head h2 { font-size: clamp(28px, 3.2vw, 38px); margin-top: 14px; }
.section-head p { margin-top: 14px; color: var(--gray-600); font-size: 16px; }
.section-navy .section-head p { color: var(--gray-400); }

/* ---------- Reusable grid layouts (used across pages) ---------- */
/* min-width:0 on children is the actual fix for grid/flex "blowout":
   by default grid/flex items refuse to shrink below their content's
   min-content size, which forces the whole page wider than the
   viewport on mobile. Overriding it lets text wrap normally instead. */
.grid-2 { display: flex; flex-wrap: wrap; gap: 48px; }
.grid-2 > * { flex: 1 1 0; min-width: 0; }

.hero-grid { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; padding: 76px 24px 64px; }
.hero-grid > * { flex: 1 1 0; min-width: 0; }
.hero-grid > *:first-child { flex-grow: 1.05; }
.hero-grid > *:last-child { flex-grow: 0.95; }

.stat-strip { display: flex; gap: 56px; flex-wrap: wrap; font-family: var(--font-mono); color: #fff; }

.services-grid { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.services-grid > * { flex: 1 1 calc(25% - 0.75px); min-width: 0; }
.service-card { background: #fff; padding: 32px 26px; }

.process-grid { display: flex; flex-wrap: wrap; gap: 28px; }
.process-grid > * { flex: 1 1 calc(20% - 22.4px); min-width: 0; }

.teaser-grid { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.teaser-grid > * { flex: 1 1 0; min-width: 0; }
.teaser-grid > *:first-child { flex-grow: 1.1; }
.teaser-grid > *:last-child { flex-grow: 0.9; }

.timeline-row { display: flex; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.timeline-row > *:first-child { flex: 0 0 100px; }
.timeline-row > *:last-child { flex: 1 1 0; min-width: 0; }
.timeline-row--last { border-bottom: 1px solid var(--line); }

.contact-grid { display: flex; flex-wrap: wrap; gap: 64px; }
.contact-grid > * { flex: 1 1 0; min-width: 0; }

/* ---------- Brand chips (equipment manufacturers we service) ---------- */
.brand-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.brand-chip {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14.5px;
  color: var(--navy-800);
  background: #fff;
  border: 1px solid var(--line);
  padding: 9px 16px;
  cursor: default;
  transition: border-color .18s ease, background .18s ease;
}
.brand-chip .cyr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-600);
}
.brand-chip:hover,
.brand-chip:focus-within {
  border-color: var(--red-600);
}

/* hover tooltip */
.brand-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(6px);
  width: 240px;
  background: rgba(15, 23, 32, 0.94);
  color: #fff;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  border-radius: 2px;
  box-shadow: 0 10px 28px rgba(15,23,32,0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 30;
}
.brand-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 32, 0.94);
}
.brand-tip a { color: #FF8A6B; }
.brand-chip:hover .brand-tip,
.brand-chip:focus-within .brand-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
/* keep tooltip on-screen for chips near the left/right edge */
.brand-chip:nth-child(-n+3) .brand-tip { left: 0; transform: translateX(0) translateY(6px); }
.brand-chip:nth-child(-n+3):hover .brand-tip,
.brand-chip:nth-child(-n+3):focus-within .brand-tip { transform: translateX(0) translateY(0); }
.brand-chip:nth-child(-n+3) .brand-tip::after { left: 20px; transform: translateX(0); }
.brand-chip:nth-last-child(-n+3) .brand-tip { left: auto; right: 0; transform: translateX(0) translateY(6px); }
.brand-chip:nth-last-child(-n+3):hover .brand-tip,
.brand-chip:nth-last-child(-n+3):focus-within .brand-tip { transform: translateX(0) translateY(0); }
.brand-chip:nth-last-child(-n+3) .brand-tip::after { left: auto; right: 20px; transform: translateX(0); }

@media (max-width: 560px) {
  .brand-tip { width: 200px; font-size: 12px; }
}

/* ---------- Objects: photo gallery ---------- */
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.photo-card {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 0;
  display: block;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  aspect-ratio: 3/4;
}
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.photo-card:hover img {
  transform: scale(1.04);
}
@media (max-width: 860px) {
  .photo-card { flex-basis: calc(50% - 6px); }
}
@media (max-width: 560px) {
  .photo-card { flex-basis: 100%; aspect-ratio: 4/3; }
}

/* ---------- Lightbox: увеличенный просмотр фото ---------- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 32, 0.94);
  padding: 24px;
}
.lightbox.is-open { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  user-select: none;
}
.lightbox-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244,245,247,0.1);
  border: 1px solid rgba(244,245,247,0.25);
  color: var(--white);
  cursor: pointer;
  transition: background .2s ease;
}
.lightbox-btn:hover { background: rgba(244,245,247,0.22); }
.lightbox-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  font-family: var(--font-mono);
}
.lightbox-prev, .lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 26px;
  font-family: var(--font-mono);
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gray-400);
  font-family: var(--font-mono);
  font-size: 13px;
}
@media (max-width: 640px) {
  .lightbox-prev, .lightbox-next { width: 42px; height: 42px; font-size: 20px; }
  .lightbox-close { width: 38px; height: 38px; top: 12px; right: 12px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* ---------- Catalog: model/brand grid (3 per row) ---------- */
.model-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.model-card {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 20px 20px 18px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.model-card:hover {
  border-color: var(--red-600);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(25,36,50,0.08);
}
.model-card .model-card-brand {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--gray-400);
  text-transform: uppercase;
}
.model-card h3 {
  font-size: 19px;
  margin-top: 2px;
}
.model-card p {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 2px;
}
.model-card .model-card-link {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--red-600);
}

@media (max-width: 860px) {
  .model-card { flex-basis: calc(50% - 6px); }
}
@media (max-width: 560px) {
  .model-card { flex-basis: 100%; }
}

/* ---------- Blog: category chips ---------- */
.cat-chip {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 9px 16px;
  font-size: 14px;
  color: var(--navy-800);
  transition: border-color .18s ease, color .18s ease;
}
.cat-chip:hover {
  border-color: var(--red-600);
  color: var(--red-600);
}
.cat-chip[aria-current="page"] {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.related-articles {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 32px;
}
.related-articles h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 16px;
}
.related-articles ul { list-style: none; }
.related-articles li { margin-bottom: 12px; }
.related-articles a {
  color: var(--navy-800);
  font-size: 15.5px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.related-articles a:hover { color: var(--red-600); text-decoration-color: var(--red-600); }

/* ---------- Blog: article list ---------- */
.article-card {
  display: flex;
  gap: 28px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.article-card > .meta { flex: 0 0 120px; }
.article-card > div:not(.meta) { flex: 1 1 0; min-width: 0; }
.article-card:last-child { border-bottom: 1px solid var(--line); }
.article-card .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-400);
  padding-top: 2px;
}
.article-card .meta:has(svg.industry-icon) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding-top: 0;
}
.article-card .meta svg.industry-icon {
  opacity: .38;
}
svg.product-icon {
  flex-shrink: 0;
}
.article-card .tag-soon {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gray-400);
  border: 1px solid var(--line);
  padding: 3px 8px;
}
.article-card h3 {
  font-size: 21px;
  transition: color .15s ease;
}
.article-card a.title-link:hover h3 { color: var(--red-600); }
.article-card p.excerpt {
  margin-top: 10px;
  color: var(--gray-600);
  font-size: 15.5px;
  max-width: 68ch;
}
.article-card .read-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--red-600);
}

/* ---------- Blog: single article ---------- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-400);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--white); }
.article-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 18px;
}
.article-body {
  max-width: 72ch;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.75;
  color: var(--navy-800);
}
.article-body p { margin-top: 20px; }
.article-body p:first-child { margin-top: 0; }
.article-body h2 {
  font-size: 26px;
  margin-top: 44px;
}
.article-body h3 {
  font-size: 20px;
  margin-top: 32px;
}
.article-body ul, .article-body ol {
  margin-top: 18px;
  padding-left: 22px;
  list-style: disc;
  color: var(--navy-800);
}
.article-body ol { list-style: decimal; }
.article-body li { margin-top: 8px; }
.article-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--red-600);
  color: var(--gray-600);
  font-style: normal;
}
.article-body strong { color: var(--navy-800); }
.article-cta {
  max-width: 72ch;
  margin: 56px auto 0;
  background: var(--navy-800);
  padding: 32px;
  border-left: 4px solid var(--red-600);
}

/* Responsive */
html { overflow-x: hidden; } /* safety net against any remaining overflow */
body { overflow-x: hidden; }

@media (max-width: 1180px) and (min-width: 861px) {
  .site-nav { gap: 16px; margin-left: 24px; }
  .site-nav a { font-size: 14px; }
}

@media (max-width: 860px) {
  .site-nav { display: none; }
  .footer-grid { flex-direction: column; gap: 32px; }
  .footer-grid > *:first-child { flex-grow: 1; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }

  .hero-grid { flex-direction: column; padding: 48px 20px 36px; gap: 28px; }
  .hero-grid > *:first-child, .hero-grid > *:last-child { flex-grow: 1; }
  .hero-grid img { max-width: 300px; margin: 0 auto; }
  .grid-2, .teaser-grid, .contact-grid { flex-direction: column; gap: 32px; }
  .teaser-grid > *:first-child, .teaser-grid > *:last-child { flex-grow: 1; }
  .services-grid > * { flex-basis: calc(50% - 0.5px); }
  .process-grid { gap: 24px 20px; }
  .process-grid > * { flex-basis: calc(50% - 10px); }
}

@media (max-width: 560px) {
  .services-grid > * { flex-basis: 100%; }
  .process-grid > * { flex-basis: 100%; }
  .stat-strip { gap: 28px; }
  .timeline-row { gap: 12px; }
  .timeline-row > *:first-child { flex-basis: 56px; }
  .section { padding: 56px 0; }
  .section-tight { padding: 40px 0; }
  .article-card { flex-direction: column; gap: 8px; }
  .article-card > .meta { flex-basis: auto; }
  .article-body { font-size: 16px; }
  .article-body h2 { font-size: 22px; }
}

/* Accessibility: visible focus */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Защита от копирования текста ---------- */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
img { -webkit-user-drag: none; }
