/* ─────────────────────────────────────────────
   Страница раздела — «внутри ящика»
   Цвета ящика приходят из --crate / --crate-ink / --crate-accent на <html>.
   ───────────────────────────────────────────── */

/* портал прибытия: виден с первой отрисовки, пока двери не распахнутся */
.page-service .portal {
  display: none;
  --portal-color: var(--crate);
  --portal-ink: var(--crate-ink);
  --portal-accent: var(--crate-accent);
}
html.is-arriving .page-service .portal,
.page-service .portal.is-on { display: block; }
html.is-arriving, html.is-arriving body { overflow: hidden; }

/* ── Шапка раздела ── */
.svc-hero {
  position: relative; overflow: hidden;
  color: var(--crate-ink);
  background-color: var(--crate);
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,.28), rgba(0,0,0,0) 40%, rgba(0,0,0,.12)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 2px, rgba(255,255,255,.06) 2px 4px, transparent 4px 34px, rgba(0,0,0,.06) 34px 38px, transparent 38px 46px);
  padding: clamp(28px, 4vw, 44px) 0 clamp(56px, 7vw, 96px);
}
.svc-hero::after { /* полоса разметки по низу */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: repeating-linear-gradient(-45deg, var(--crate-accent) 0 12px, transparent 12px 24px);
  opacity: .9;
}
.svc-hero__inner { position: relative; z-index: 1; }
.svc-hero__stencil {
  position: absolute; right: -0.04em; bottom: -0.2em; z-index: 0;
  font: 700 clamp(180px, 34vw, 520px)/1 var(--font-display);
  color: currentColor; opacity: .07; pointer-events: none; letter-spacing: -.04em;
}
.svc-back {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 16px 0 12px;
  border: 1.5px solid currentColor; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-decoration: none;
  opacity: .9; transition: background .2s, color .2s, opacity .2s;
}
.svc-back svg { transform: rotate(180deg); }
.svc-back:hover { opacity: 1; background: var(--crate-ink); color: var(--crate); }
.svc-hero__no {
  margin-top: clamp(28px, 5vw, 64px);
  font: 500 13px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; opacity: .7;
}
.svc-hero__no span { opacity: 1; }
.svc-hero__title {
  margin-top: 14px; max-width: 14ch;
  font: 700 clamp(44px, 7.4vw, 116px)/.92 var(--font-display);
  text-transform: uppercase; letter-spacing: -.01em;
}
.svc-hero__lead { margin-top: clamp(16px, 2.4vw, 28px); max-width: 640px; font-size: clamp(16px, 1.5vw, 20px); line-height: 1.5; opacity: .92; }
.svc-hero__toc { list-style: none; padding: 0; margin-top: clamp(24px, 3.4vw, 40px); display: flex; flex-wrap: wrap; gap: 8px; }
.svc-hero__toc a {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 8px 14px;
  background: rgba(0,0,0,.18); color: inherit; text-decoration: none;
  font-size: 14px; font-weight: 600; line-height: 1.2;
  border-radius: 3px; transition: background .2s;
}
.svc-hero__toc a span { font: 500 11px/1 var(--font-mono); opacity: .7; }
.svc-hero__toc a:hover { background: rgba(0,0,0,.34); }

/* ── Содержание ── */
.svc-layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 88px);
  padding-top: clamp(48px, 6vw, 88px); padding-bottom: clamp(48px, 6vw, 88px);
}
.svc-aside { position: relative; }
.svc-aside__sticky { position: sticky; top: calc(var(--header-h) + 28px); }
.svc-toc__h { font-size: 11px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.svc-toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; border-left: 2px solid var(--line); }
.svc-toc li { counter-increment: toc; }
.svc-toc a {
  display: block; padding: 9px 0 9px 16px; margin-left: -2px; border-left: 2px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; color: var(--ink-2);
  transition: color .2s, border-color .2s;
}
.svc-toc a::before { content: '0' counter(toc) '  '; font: 500 11px/1 var(--font-mono); color: var(--muted); white-space: pre; }
.svc-toc a:hover, .svc-toc a.is-current { color: var(--ink); border-left-color: var(--red); }
.svc-aside__cta { margin-top: 28px; width: 100%; }

.svc-intro { font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; color: var(--ink); max-width: 760px; padding-bottom: clamp(36px, 4vw, 56px); }

.svc-block { padding-top: 26px; border-top: 2px solid var(--ink); margin-bottom: clamp(52px, 6vw, 88px); scroll-margin-top: calc(var(--header-h) + 20px); }
.svc-block__no { font: 500 12px/1 var(--font-mono); letter-spacing: .14em; color: var(--red); }
/* подраздел, к которому привёз кран */
.svc-block { transition: box-shadow .6s, background-color .6s; }
.svc-block.is-target { background-color: rgba(242,180,0,.14); box-shadow: -14px 0 0 rgba(242,180,0,.14), 14px 0 0 rgba(242,180,0,.14), inset 0 2px 0 var(--yellow); }
.svc-block__title { margin-top: 12px; font: 600 clamp(28px, 3.2vw, 44px)/1 var(--font-display); text-transform: uppercase; letter-spacing: -.005em; max-width: 22ch; }
.svc-block__body { margin-top: clamp(18px, 2vw, 26px); max-width: 860px; }
.svc-block__body > p { font-size: 17px; color: var(--ink-2); max-width: 720px; }
.svc-block__body > p + p { margin-top: .8em; }
.svc-block__body h3 { margin: 28px 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px clamp(24px, 4vw, 56px); }
.cols--3 { grid-template-columns: repeat(3, 1fr); }
.note { margin-top: 24px; padding: 16px 18px 16px 20px; background: var(--paper-2); border-left: 4px solid var(--yellow); font-size: 15px; color: var(--ink-2); }

.ticks { list-style: none; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 22px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.ticks li::before { content: ''; position: absolute; left: 0; top: .62em; width: 9px; height: 9px; background: var(--red); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.ticks--2col { grid-template-columns: 1fr 1fr; column-gap: clamp(24px, 4vw, 56px); }
.ticks--num { counter-reset: t; }
.ticks--num li { counter-increment: t; padding-left: 36px; }
.ticks--num li::before { content: counter(t, decimal-leading-zero); clip-path: none; background: none; width: auto; height: auto; top: .18em; font: 500 12px/1.4 var(--font-mono); color: var(--red); }
.steps { list-style: none; padding: 0; counter-reset: s; display: grid; gap: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 40px; font-size: 15.5px; color: var(--ink-2); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center; background: var(--ink); color: #fff; font: 600 13px/1 var(--font-display); }
.steps li::after { content: ''; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 8px 14px; border: 1.5px solid var(--ink); font-weight: 700; font-size: 14px; }

/* таблица «до / после» */
.table-wrap { margin-top: 24px; overflow-x: auto; }
.cmp { width: 100%; border-collapse: collapse; font-size: 15px; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmp thead th { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--ink); }
.cmp tbody th { font-weight: 700; width: 22%; }
.cmp td { color: var(--ink-2); }
.cmp td:last-child { background: rgba(242,180,0,.12); color: var(--ink); }

/* диаграмма неисправностей: одна серия — один цвет, значения подписаны у полос */
.bars { margin: 28px 0 0; padding: 22px 22px 18px; background: #fff; border: 1px solid var(--line); }
.bars figcaption { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--ink); margin-bottom: 16px; }
.bars__list { list-style: none; padding: 0; display: grid; gap: 4px; }
.bars__row {
  display: grid; grid-template-columns: minmax(120px, 210px) 1fr 88px; align-items: center; gap: 14px;
  padding: 6px 8px; margin: 0 -8px; border-radius: 4px; transition: background .15s;
}
.bars__row:hover { background: var(--paper); }
.bars__name { font-size: 14px; color: var(--ink-2); }
.bars__track { height: 14px; position: relative; }
.bars__track::before { content: ''; position: absolute; inset: 6px 0; background: var(--line); opacity: .5; }
.bars__fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: max(2px, calc(var(--v) * 100%));
  background: var(--ink); border-radius: 0 4px 4px 0;
  transition: background .15s;
}
.bars__row:hover .bars__fill { background: var(--red); }
.bars__val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bars__val b { color: var(--ink); font-weight: 700; font-size: 15px; }

/* ── Соседние ящики ── */
.svc-next { background: var(--paper-2); padding: clamp(32px, 4vw, 56px) 0; border-top: 1px solid var(--line); }
.svc-next__grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(12px, 2vw, 24px); align-items: stretch; }
.svc-next__card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  min-height: 150px; padding: 20px 22px 26px;
  color: var(--crate-ink); text-decoration: none;
  background-color: var(--crate);
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 2px, rgba(255,255,255,.07) 2px 3px, transparent 3px 22px, rgba(0,0,0,.06) 22px 25px, transparent 25px 30px);
  border-radius: 3px;
  transition: transform .25s;
}
.svc-next__card::after { content: ''; position: absolute; left: 22px; right: 22px; bottom: 0; height: 8px; background: repeating-linear-gradient(-45deg, var(--crate-accent) 0 8px, transparent 8px 16px); }
.svc-next__card:hover { transform: translateY(-4px); }
.svc-next__card--next { text-align: right; align-items: flex-end; }
.svc-next__lbl { position: absolute; top: 18px; left: 22px; right: 22px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; opacity: .75; }
.svc-next__no { font: 600 30px/1 var(--font-display); opacity: .85; }
.svc-next__title { font: 600 clamp(18px, 1.8vw, 24px)/1.05 var(--font-display); text-transform: uppercase; }
.svc-next__hall {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-width: 150px; padding: 18px; text-align: center; text-decoration: none;
  border: 2px dashed var(--ink-2); color: var(--ink); font-weight: 700; font-size: 14px; line-height: 1.25;
  transition: background .2s, color .2s;
}
.svc-next__hall:hover { background: var(--ink); color: #fff; border-style: solid; }

/* ── Адаптив ── */
@media (max-width: 960px) {
  .svc-layout { grid-template-columns: 1fr; }
  .svc-aside { display: none; }
  .cols--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .cols, .cols--3, .ticks--2col { grid-template-columns: 1fr; }
  .svc-hero__toc a { font-size: 13px; }
  .bars__row { grid-template-columns: 1fr 76px; grid-template-areas: "name val" "bar bar"; row-gap: 6px; }
  .bars__name { grid-area: name; } .bars__val { grid-area: val; } .bars__track { grid-area: bar; }
  .cmp thead { display: none; }
  .cmp, .cmp tbody, .cmp tr, .cmp th, .cmp td { display: block; width: 100%; }
  .cmp tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .cmp tbody th, .cmp td { border: 0; padding: 4px 0; width: 100%; }
  .cmp td::before { content: attr(data-label) ' — '; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .cmp td:last-child { padding: 8px 10px; margin-top: 4px; }
  .svc-next__grid { grid-template-columns: 1fr 1fr; }
  .svc-next__hall { grid-column: 1 / -1; grid-row: 2; flex-direction: row; min-height: 56px; }
  .svc-next__card { min-height: 130px; padding: 16px 14px 22px; }
  .svc-next__lbl { left: 14px; right: 14px; top: 14px; font-size: 10px; letter-spacing: .1em; }
}
