/* Все услуги на одном экране (OXEN-356), идея «Спектр бренда»: кадр спектрографа — спектрограмма и график
   яркости по длине волны, девять линий-услуг с выносками, внизу спектры брендов и одна кнопка.
   Монохром: один фирменный циан на чёрном, без радужной раскраски — так выглядит кадр настоящего прибора.
   Всё помещается в 1280×720 без прокрутки; на телефоне — список линий без 3D. Префикс srv-: имена svc-* заняты (layout.css). */

.srv-spec {
  --srv-ink: var(--cherenkov);
  --srv-hair: rgba(255, 255, 255, 0.14);
  --srv-top: clamp(104px, 15.5vh, 140px);
  --srv-ccd-h: clamp(36px, 7vh, 72px);
  --srv-plot-h: clamp(100px, 17.6vh, 230px);
  position: relative;
  min-height: 100svh;
  overflow: hidden;
}

.srv-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Источник света справа от заголовка; кадр прибора начинается ниже его диска */
.srv-source {
  position: absolute;
  top: calc(var(--srv-top) - 44px);
  right: 0;
  width: min(46vw, 620px);
  height: clamp(140px, 23vh, 250px);
  pointer-events: none;
}

.srv-source-hole {
  position: absolute;
  inset: 0;
}

.srv-frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-top: var(--srv-top);
  padding-bottom: clamp(14px, 2.2vh, 40px);
}

.srv-head {
  max-width: min(660px, 52vw);
}

.srv-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 3.4vw, 52px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

/* Подзаголовок и «?» в одной строке: подсказка садится в хвост второй строки, кадр прибора не сдвигается */
.srv-lead {
  margin-top: 12px;
  font-size: 20px;
  line-height: 1.45;
  color: var(--text-dim);
}

.srv-lead-text {
  display: inline;
  font: inherit;
  color: inherit;
}

.srv-how {
  display: inline-block;
  margin-left: 4px;
  font-size: 18px;
  color: var(--text-dim);
  vertical-align: baseline;
}

.srv-how summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  cursor: pointer;
  list-style: none;
}

.srv-how summary::-webkit-details-marker { display: none; }

.srv-how summary:hover,
.srv-how[open] summary { color: var(--starlight); }

.srv-how-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-glow);
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  color: var(--srv-ink);
}

.srv-how p {
  position: absolute;
  z-index: 3;
  max-width: 520px;
  margin-top: 8px;
  padding: 16px 20px;
  border: 1px solid var(--srv-hair);
  border-radius: 12px;
  background: rgba(2, 2, 6, 0.94);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ───────────── Кадр прибора ───────────── */

.srv-instrument {
  margin: clamp(12px, 2vh, 32px) 0 0;
}

.srv-ccd {
  position: relative;
  height: var(--srv-ccd-h);
  border: 1px solid var(--srv-hair);
  background: #000;
  color: var(--srv-ink);
  overflow: hidden;
}

.srv-ccd-still,
.srv-ccd-live {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.srv-ccd-live { display: none; }
.srv-spec.is-live .srv-ccd-live { display: block; }
.srv-spec.is-live .srv-ccd-still { display: none; }

.srv-plot {
  position: relative;
  background: rgba(0, 0, 0, 0.5);
  height: var(--srv-plot-h);
  margin-top: 6px;
  border-bottom: 1px solid var(--srv-hair);
}

.srv-plot-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.srv-plot-area { fill: rgba(0, 240, 255, 0.07); }

.srv-plot-line {
  fill: none;
  stroke: var(--srv-ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* Линия под курсором — её собственный вклад поверх континуума, как в разложении спектра на компоненты */
.srv-plot-hot {
  fill: none;
  stroke: var(--starlight);
  stroke-width: 2;
  stroke-linejoin: round;
}

.srv-mark {
  stroke: var(--starlight);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  opacity: 0;
  transition: opacity 0.3s;
}

.srv-spec.is-unknown .srv-mark { opacity: 0.35; }
.srv-mark.is-hot { opacity: 0.5; }

.srv-axis {
  position: relative;
  height: 28px;
  font-size: 18px;
  line-height: 28px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.srv-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.srv-tick::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 1px;
  height: 6px;
  background: var(--srv-hair);
}

.srv-axis-name {
  position: absolute;
  right: 0;
  top: 0;
  padding-left: 16px;
  background: var(--void);
}

.srv-leaders {
  display: block;
  width: 100%;
  height: clamp(16px, 2.8vh, 34px);
  overflow: visible;
}

.srv-leader {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  transition: stroke 0.25s, opacity 0.25s;
}

.srv-leader.is-hot { stroke: var(--srv-ink); }
.srv-leader.is-off { opacity: 0.25; stroke-dasharray: 2 4; }

/* Подписи линий — ровный ряд из девяти, каждая ведёт на страницу услуги */
.srv-lines {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.srv-line-link {
  display: block;
  padding: 4px 6px 6px;
  text-align: center;
  color: var(--starlight);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.25s, opacity 0.25s;
}

.srv-mini,
.srv-line-result { display: none; }

.srv-line-name {
  display: block;
  hyphens: manual;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.srv-line-ion {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  line-height: 1.3;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.srv-line.is-hot .srv-line-name { color: var(--srv-ink); }
.srv-line.is-hot .srv-line-ion { color: var(--text-dim); }
.srv-line.is-off .srv-line-link { opacity: 0.38; }
.srv-line-link:focus-visible { outline: 2px solid var(--srv-ink); outline-offset: 2px; }

/* ───────────── Низ: подпись к линии или кейсу, спектры брендов, кнопка ───────────── */

.srv-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "detail cta"
    "cases cases";
  align-items: center;
  row-gap: clamp(8px, 1.4vh, 20px);
  column-gap: 32px;
  margin-top: auto;
  padding-top: clamp(8px, 1.4vh, 28px);
  padding-right: 76px;   /* справа внизу — круглая кнопка чата сайта */
  align-items: end;
}

.srv-detail {
  grid-area: detail;
  min-height: 60px;
}

.srv-detail-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
}

.srv-detail-card[hidden] { display: none; }

.srv-detail-hint {
  font-size: 18px;
  color: var(--text-dim);
}

.srv-detail-img {
  flex: none;
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.srv-detail-text {
  min-width: 0;
}

.srv-detail-title {
  font-size: 20px;
  color: var(--starlight);
  font-weight: 600;
  line-height: 1.3;
}

.srv-detail-body {
  margin-top: 2px;
  font-size: 18px;
  line-height: 1.45;
  color: var(--text-dim);
}

.srv-detail-work { color: var(--text-muted); }

.srv-detail-link {
  color: var(--srv-ink);
  text-decoration: none;
  white-space: nowrap;
}

.srv-detail-link:hover { text-decoration: underline; }

.srv-detail-absent {
  display: none;
  margin-top: 2px;
  font-size: 18px;
  color: var(--text-muted);
}

.srv-detail-card.is-absent .srv-detail-absent { display: block; }

.srv-cases {
  grid-area: cases;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.srv-cases-label {
  margin-right: 8px;
  font-size: 18px;
  color: var(--text-muted);
}

.srv-case {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--srv-hair);
  border-radius: 24px;
  background: transparent;
  font: inherit;
  font-size: 18px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.srv-case:hover { color: var(--starlight); border-color: var(--border-glow); }

.srv-case[aria-checked="true"] {
  color: var(--starlight);
  border-color: var(--srv-ink);
  background: var(--cherenkov-dim);
}

.srv-case:focus-visible { outline: 2px solid var(--srv-ink); outline-offset: 2px; }

.srv-cta {
  grid-area: cta;
  min-height: 52px;
}

/* ───────────── Узкий экран: заголовок, кейсы, список линий ───────────── */

@media (max-width: 1100px) {
  .srv-line-name { font-size: 18px; }
  .srv-line-ion { white-space: normal; }
}

@media (max-width: 860px) {
  .srv-spec { min-height: 0; }
  .srv-source,
  .srv-ccd,
  .srv-plot,
  .srv-axis,
  .srv-leaders { display: none; }

  .srv-frame {
    min-height: 0;
    padding-top: 108px;
    padding-bottom: 56px;
  }

  .srv-head { max-width: none; }
  .srv-title { font-size: clamp(32px, 9vw, 40px); }
  .srv-lead { font-size: 18px; }
  .srv-how { display: block; margin: 10px 0 0; }
  .srv-how p { position: static; }

  /* Порядок на телефоне: заголовок, кейсы, подпись кейса, список линий, кнопка */
  .srv-head { order: 1; }
  .srv-foot { display: contents; }
  .srv-cases {
    order: 2;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 28px -20px 0;
    padding: 0 20px 4px;
    scrollbar-width: none;
  }

  .srv-cases::-webkit-scrollbar { display: none; }
  .srv-cases-label { display: none; }
  .srv-case { flex: none; }

  .srv-detail { order: 3; min-height: 0; margin-top: 16px; }
  .srv-detail-card:not(.srv-detail-case) { display: none; }
  .srv-detail-img { width: 72px; height: 54px; }

  .srv-instrument { order: 4; margin-top: 20px; }

  .srv-cta {
    order: 5;
    align-self: stretch;
    justify-content: center;
    margin-top: 28px;
  }

  .srv-lines {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--srv-hair);
  }

  .srv-line { border-bottom: 1px solid var(--srv-hair); }

  .srv-line-link {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 14px 0;
    text-align: left;
    border-radius: 0;
  }

  .srv-mini {
    display: block;
    width: 84px;
    height: 36px;
    overflow: visible;
  }

  .srv-mini path {
    fill: none;
    stroke: var(--srv-ink);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
  }

  .srv-line.is-off .srv-mini path { stroke: var(--text-muted); stroke-dasharray: 3 4; }

  .srv-line-ion { margin-top: 4px; white-space: normal; }

  .srv-line-result {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.4;
    color: var(--text-dim);
  }
}

@media (max-width: 360px) {
  .srv-line-link { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .srv-mini { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .srv-mark,
  .srv-leader,
  .srv-line-link,
  .srv-case { transition: none; }
}

/* Со скриптами первый кадр рисует браузер с экспозиции ноль; серверный кадр ждёт его и показывается сам,
   если живой кадр не запустился за 2 с */
@media (scripting: enabled) and (min-width: 861px) {
  .srv-spec:not(.is-live):not(.is-still) .srv-ccd-still,
  .srv-spec:not(.is-live):not(.is-still) .srv-plot-svg path {
    opacity: 0;
    animation: srv-reveal 0.01s 2s forwards;
  }
}

@keyframes srv-reveal { to { opacity: 1; } }
