/*
 * TCP UDP Ports — дизайн-система.
 *
 * Токены перенесены один в один из React-версии (src/index.css): те же значения
 * HSL, те же тени, те же шрифты. Tailwind не используется — на сервере он не нужен,
 * а классы утилит заменены смысловыми именами компонентов.
 */

/* ==========================================================================
   1. Токены
   ========================================================================== */

:root {
  /* Цвет — значения из React-версии, формат HSL без функции, чтобы можно было
     подставлять альфу через hsl(var(--x) / .5). */
  --background: 225 20% 3%;
  --foreground: 210 20% 93%;
  --card: 225 18% 5.5%;
  --card-foreground: 210 15% 88%;
  --card-elevated: 225 16% 7.5%;
  --primary: 245 58% 56%;
  --primary-foreground: 0 0% 100%;
  --primary-glow: 245 80% 78%;
  --secondary: 225 18% 8%;
  --secondary-foreground: 225 12% 58%;
  --muted: 225 18% 6.5%;
  --muted-foreground: 225 12% 52%;
  --accent: 245 45% 48%;
  --destructive: 0 65% 48%;
  --success: 160 55% 40%;
  --warning: 40 60% 52%;
  --border: 225 16% 9%;
  --ring: 245 58% 56%;

  /* Протоколы — цветовая кодировка из PortListSection. */
  --proto-tcp: 245 60% 74%;
  --proto-udp: 160 55% 62%;
  --proto-both: 200 60% 70%;
  --proto-other: 280 55% 74%;

  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  --gradient-accent: linear-gradient(135deg, hsl(245 55% 52%), hsl(280 50% 45%));
  --gradient-accent-subtle: linear-gradient(135deg, hsl(245 55% 52% / 0.12), hsl(280 50% 45% / 0.06));

  --shadow-card: 0 1px 2px hsl(225 25% 2% / 0.5), 0 8px 32px -8px hsl(225 25% 2% / 0.4);
  --shadow-button: 0 1px 2px hsl(225 25% 2% / 0.5), 0 4px 16px -2px hsl(245 60% 50% / 0.25);
  --shadow-button-hover: 0 2px 4px hsl(225 25% 2% / 0.5), 0 8px 28px -4px hsl(245 60% 50% / 0.35);

  --font-display: 'Space Grotesk', 'Space Grotesk Fallback', system-ui, sans-serif;
  --font-body: 'Inter', 'Inter Fallback', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: 'Instrument Serif', 'Instrument Serif Fallback', Georgia, serif;

  --container: 1200px;
  /* 1.5rem — как padding у Tailwind-контейнера в React-макете. */
  --container-pad: 1.5rem;
  --header-h: 56px;

  /* --------------------------------------------------------------------
   * Шкала слоёв.
   *
   * Единственный источник правды по z-index. Произвольные числа вроде
   * z-index: 999 запрещены: они лечат симптом и ломаются при следующем блоке.
   * Значения разрежены, чтобы между ними было куда вставить новый слой.
   * ------------------------------------------------------------------ */
  --z-decor: 0;        /* фоны, свечения, градиенты, декоративные пятна */
  --z-content: 10;     /* обычный контент секций */
  --z-raised: 30;      /* поднятые элементы внутри секции (кнопка «наверх») */
  --z-header: 50;      /* липкая шапка */
  --z-search: 60;      /* выпадающий список поиска — выше шапки и контента */
  --z-mobile-nav: 70;  /* мобильное меню */
  --z-modal: 80;       /* диалоги */

  /* Тонкие разделители — повторяются по всему макету. */
  --hairline: 1px solid hsl(210 20% 95% / 0.06);
  --hairline-faint: 1px solid hsl(210 20% 95% / 0.035);
}

/* ==========================================================================
   1a. Резервные шрифты с подогнанными метриками
   ==========================================================================
   Пока грузится веб-шрифт, текст рисуется системным. Если их метрики не
   совпадают, при подмене страница дёргается — это и был CLS 0.246 на главной.
   Ниже системный шрифт растягивается так, чтобы его строки совпадали по высоте
   и ширине с целевым: подмена перестаёт двигать раскладку. */

@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial'), local('Helvetica'), local('Liberation Sans');
  ascent-override: 90%;
  descent-override: 22.43%;
  line-gap-override: 0%;
  size-adjust: 107.12%;
}

@font-face {
  font-family: 'Space Grotesk Fallback';
  src: local('Arial'), local('Helvetica'), local('Liberation Sans');
  ascent-override: 95.5%;
  descent-override: 26.5%;
  line-gap-override: 0%;
  size-adjust: 103.5%;
}

@font-face {
  font-family: 'Instrument Serif Fallback';
  src: local('Georgia'), local('Times New Roman'), local('Liberation Serif');
  ascent-override: 88%;
  descent-override: 24%;
  line-gap-override: 0%;
  size-adjust: 106%;
}

/* ==========================================================================
   2. База
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
   Панель WordPress

   WordPress сдвигает документ через `html { margin-top: 32px !important }`
   (46px до 782px), но шапка у нас `position: fixed` и позиционируется от
   вьюпорта, а не от html — поэтому без своего отступа она уезжает под панель
   и панель перехватывает клики по меню.

   Высоты взяты из `wp-includes/css/admin-bar.css`, а не подобраны.

   До 600px значение снова 0: там WordPress переключает `#wpadminbar` в
   `position: absolute`, панель уезжает вместе со страницей, и постоянный
   отступ оставил бы под шапкой мёртвую полосу на всю прокрутку.

   Объявляется на `:root`, а не на `body.admin-bar`: класс `admin-bar` WordPress
   вешает на `<body>`, а `scroll-padding-top` ниже принадлежит `<html>` и до
   переменной с body не достанет. Дубль на `body.admin-bar` — запасной путь для
   браузеров без `:has()`; там сдвинется всё, кроме позиции якорей.
   --------------------------------------------------------------------------- */

:root {
  --tup-admin-bar-h: 0px;
}

:root:has(body.admin-bar),
body.admin-bar {
  --tup-admin-bar-h: 32px;
}

@media screen and (max-width: 782px) {
  :root:has(body.admin-bar),
  body.admin-bar {
    --tup-admin-bar-h: 46px;
  }
}

@media screen and (max-width: 600px) {
  :root:has(body.admin-bar),
  body.admin-bar {
    --tup-admin-bar-h: 0px;
  }

  /* Панель здесь `absolute` и уезжает вместе со страницей, поэтому постоянный
     отступ оставил бы под шапкой мёртвую полосу на всю прокрутку. Пока страница
     не прокручена, опускаем шапку под панель; как только пользователь тронул
     страницу, шапка встаёт на своё место, а панель уходит вверх сама.

     `is-scrolled` вешает JS темы (assets/js/main.js) при scrollY > 20 —
     переиспользуем существующий класс, отдельной логики не заводим. */
  body.admin-bar .site-header {
    top: 46px;
    transition: top 0.2s ease, background 0.35s ease, border-color 0.35s ease;
  }

  body.admin-bar .site-header.is-scrolled {
    top: 0;
  }

  /* Мобильное меню лежит внутри .site-header, поэтому селектор вложенный,
     а не соседний. Позиционируется оно от вьюпорта (fixed внутри fixed),
     так что отступ считаем от верха экрана, а не от шапки. */
  body.admin-bar .site-header .mobile-nav {
    inset: calc(var(--header-h) + 46px) 0 0 0;
  }

  body.admin-bar .site-header.is-scrolled .mobile-nav {
    inset: var(--header-h) 0 0 0;
  }
}

html {
  scroll-behavior: smooth;
  /* Липкая шапка не должна закрывать заголовок при переходе по якорю. */
  scroll-padding-top: calc(var(--header-h) + var(--tup-admin-bar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  /* Ни один элемент не должен создавать горизонтальную прокрутку страницы. */
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Инлайновые иконки не имеют атрибутов width/height, поэтому без явного размера
   они растягиваются по контейнеру. Базовый размер — по кеглю текста; конкретные
   компоненты ниже задают свой. */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
}

a {
  color: hsl(var(--primary-glow));
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: hsl(245 85% 84%);
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 700;
}

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.35rem; }
li { margin-bottom: 0.4rem; }

code, pre, .mono { font-family: var(--font-mono); }

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(210 20% 95% / 0.06) 20%, hsl(210 20% 95% / 0.06) 80%, transparent);
  margin: 2.5rem 0;
}

::selection {
  background: hsl(var(--primary) / 0.35);
  color: hsl(var(--foreground));
}

/* Видимый фокус обязателен — outline не убирается, а заменяется на заметный. */
:focus-visible {
  outline: 2px solid hsl(var(--primary-glow));
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: hsl(var(--primary));
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   3. Раскладка
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--container-pad);
}

.container-narrow {
  max-width: 840px;
}

.section {
  padding-block: clamp(3rem, 7vw, 6rem);
  position: relative;
}

.section--tight { padding-block: clamp(2rem, 4vw, 3.5rem); }

.stack > * + * { margin-top: 1rem; }

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }

.main-content { padding-top: var(--header-h); }

/* ==========================================================================
   4. Типографика
   ========================================================================== */

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: hsl(245 60% 74%);
  margin-bottom: 1rem;
}

.section-label::before {
  content: '';
  width: 20px;
  height: 1px;
  background: hsl(245 55% 55% / 0.4);
}

.h-display {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.h-page {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
}

.h-section {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  scroll-margin-top: calc(var(--header-h) + var(--tup-admin-bar-h) + 1rem);
}

.h-sub {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
}

/* Курсивный serif-акцент — подпись дизайна из React-версии. */
.accent-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: hsl(var(--foreground) / 0.75);
  letter-spacing: -0.01em;
}

.text-gradient {
  background-image: var(--gradient-accent);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.lead {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: hsl(210 14% 67%);
  line-height: 1.7;
  max-width: 34rem;
}

.muted { color: hsl(210 14% 62%); }
.dim { color: hsl(210 14% 56%); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

.answer-box {
  border: var(--hairline);
  border-left: 3px solid hsl(var(--primary) / 0.7);
  background: var(--gradient-accent-subtle);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: hsl(var(--foreground) / 0.92);
  margin-bottom: 1.75rem;
}

/* ==========================================================================
   5. Шапка
   ========================================================================== */

.site-header {
  position: fixed;
  /* Отступ сверху — под панель WordPress. У гостя переменная равна 0px,
     то есть для посетителя правило вычисляется в прежнее `inset: 0 …`. */
  inset: var(--tup-admin-bar-h) 0 auto 0;
  z-index: var(--z-header);
  height: var(--header-h);
  transition: background 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}

/* Класс вешает JS при прокрутке — как в React-версии. */
.site-header.is-scrolled {
  background: hsl(225 20% 3% / 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom-color: hsl(210 20% 95% / 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  flex-shrink: 0;
}

.brand:hover { color: inherit; }

.brand svg {
  width: 20px;
  height: 20px;
  color: hsl(245 70% 76%);
  filter: drop-shadow(0 0 8px hsl(245 60% 60% / 0.35));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
  color: hsl(var(--foreground) / 0.85);
}

/* Без альфы: прозрачность на почти чёрном фоне роняла контраст до 2.2:1.
   Приглушённость даёт сама светлота. */
.brand-name span { color: hsl(225 10% 62%); }

.brand-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(225 10% 60%);
  margin-top: 2px;
}

.primary-nav { display: none; }

@media (min-width: 1024px) {
  .primary-nav {
    display: flex;
    align-items: center;
    gap: 2px;
  }
}

.primary-nav > ul {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-nav li { margin: 0; position: relative; }

.primary-nav a {
  display: block;
  padding: 0.5rem 0.7rem;
  font-size: 13px;
  color: hsl(210 14% 66%);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  color: hsl(var(--foreground) / 0.92);
  background: hsl(210 20% 95% / 0.04);
}

/* Мега-меню: раскрывается на hover и на focus-within, поэтому доступно с клавиатуры. */
.primary-nav .menu-item-has-children > .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  padding: 0.5rem;
  margin: 0;
  list-style: none;
  background: hsl(225 18% 5.5%);
  border: var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.primary-nav .menu-item-has-children:hover > .sub-menu,
.primary-nav .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.primary-nav .sub-menu a {
  padding: 0.5rem 0.75rem;
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* Кнопка в шапке — компактная, как в макете (px-4 py-1.5, 12px). */
@media (min-width: 1024px) {
  .header-actions .btn {
    min-height: 0;
    padding: 0.375rem 1rem;
    font-size: 12px;
    border-radius: 0.5rem;
  }
  .header-actions .btn svg { width: 12px; height: 12px; }
}

/* Кнопка в шапке остаётся видимой и на телефоне — как в макете. Раньше она
   вместе с подписью логотипа выдавливала переключатель меню за экран, поэтому
   на узких ширинах подпись скрывается, а сама кнопка ужимается. */
@media (max-width: 640px) {
  .header-actions .btn {
    min-height: 36px;
    padding: 0.375rem 0.75rem;
    font-size: 12px;
    border-radius: 0.75rem;
  }
  .header-actions .btn svg { width: 12px; height: 12px; }
}

@media (max-width: 460px) {
  .brand-tag { display: none; }
}

/* Совсем узкие экраны: подпись у кнопки уступает место переключателю меню. */
@media (max-width: 359px) {
  .header-actions .btn span { display: none; }
  .header-actions .btn { padding-inline: 0.6rem; }
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -0.5rem;
  background: none;
  border: 0;
  color: hsl(210 14% 66%);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.menu-toggle:hover { color: hsl(var(--foreground)); }

@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded='true'] .icon-open { display: none; }
.menu-toggle[aria-expanded='true'] .icon-close { display: block; }

/* --- Мобильное меню --- */

.mobile-nav {
  position: fixed;
  /* Начинается под шапкой, а шапка — под панелью: иначе верхние пункты
     мобильного меню оказываются за шапкой. */
  inset: calc(var(--header-h) + var(--tup-admin-bar-h)) 0 0 0;
  z-index: var(--z-mobile-nav);
  background: hsl(225 20% 3% / 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: var(--hairline);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0 3rem;
  display: none;
}

.mobile-nav.is-open { display: block; }

@media (min-width: 1024px) {
  .mobile-nav,
  .mobile-nav.is-open { display: none; }
}

.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav li { margin: 0; }

.mobile-nav a {
  display: block;
  /* Тач-цель не меньше 44px по высоте. */
  padding: 0.85rem 0.5rem;
  min-height: 44px;
  font-size: 15px;
  color: hsl(210 14% 67%);
  border-bottom: var(--hairline-faint);
}

.mobile-nav a:hover { color: hsl(var(--foreground)); }

.mobile-nav .sub-menu { padding-left: 1rem; }
.mobile-nav .sub-menu a { font-size: 14px; color: hsl(210 14% 60%); }

body.menu-open { overflow: hidden; }

/* ==========================================================================
   6. Кнопки
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 1.15rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn--primary {
  background: var(--gradient-accent);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-button);
}

.btn--primary:hover {
  color: #fff;
  box-shadow: var(--shadow-button-hover);
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn--soft {
  background: hsl(245 55% 52% / 0.1);
  border-color: hsl(245 55% 52% / 0.18);
  color: hsl(245 70% 80%);
}

.btn--soft:hover {
  background: hsl(245 55% 52% / 0.16);
  color: hsl(245 60% 80%);
}

.btn--ghost {
  background: hsl(210 20% 95% / 0.03);
  border-color: hsl(210 20% 95% / 0.06);
  color: hsl(210 14% 67%);
}

.btn--ghost:hover {
  color: hsl(var(--foreground));
  background: hsl(210 20% 95% / 0.06);
}

.btn--sm {
  padding: 0.4rem 0.75rem;
  min-height: 36px;
  font-size: 12px;
}

/* ==========================================================================
   7. Карточки
   ========================================================================== */

.card {
  border: var(--hairline);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, hsl(225 20% 5.5% / 0.5), hsl(225 20% 3.5% / 0.5));
  box-shadow: 0 4px 40px -10px hsl(225 25% 2% / 0.5), inset 0 1px 0 hsl(210 20% 95% / 0.03);
  padding: 1.35rem;
}

.card--link { display: block; color: inherit; transition: border-color 0.25s ease, transform 0.25s ease; }

.card--link:hover {
  color: inherit;
  border-color: hsl(245 55% 52% / 0.25);
  transform: translateY(-2px);
}

.card--flush { padding: 0; overflow: hidden; }

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
  color: hsl(var(--foreground) / 0.9);
}

.card-meta { font-size: 12px; color: hsl(210 14% 58%); }

/* Карточка порта в сетках «популярные порты». */
.port-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(225 20% 5.5% / 0.5);
  padding: 1rem 1.1rem;
  color: inherit;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.port-card:hover {
  color: inherit;
  border-color: hsl(245 55% 52% / 0.28);
  background: hsl(225 20% 7% / 0.6);
  transform: translateY(-2px);
}

.port-card-number {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: hsl(var(--foreground) / 0.92);
}

.port-card-service {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground) / 0.8);
}

.port-card-desc {
  font-size: 12px;
  color: hsl(210 14% 58%);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

/* ==========================================================================
   8. Бейджи
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--tcp   { background: hsl(var(--proto-tcp) / 0.08);   color: hsl(var(--proto-tcp));   border-color: hsl(var(--proto-tcp) / 0.16); }
.badge--udp   { background: hsl(var(--proto-udp) / 0.08);   color: hsl(var(--proto-udp) / 1.0); border-color: hsl(var(--proto-udp) / 0.18); }
.badge--both  { background: hsl(var(--proto-both) / 0.08);  color: hsl(var(--proto-both));  border-color: hsl(var(--proto-both) / 0.16); }
.badge--sctp,
.badge--dccp  { background: hsl(var(--proto-other) / 0.08); color: hsl(var(--proto-other)); border-color: hsl(var(--proto-other) / 0.16); }
.badge--neutral { background: hsl(210 20% 95% / 0.04); color: hsl(210 14% 63%); border-color: hsl(210 20% 95% / 0.06); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 12px;
  font-weight: 500;
}

.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--official { color: hsl(160 55% 66%); }
.status-dot--official::before { background: hsl(160 55% 45%); box-shadow: 0 0 8px hsl(160 55% 40% / 0.4); }
.status-dot--unofficial { color: hsl(40 60% 70%); }
.status-dot--unofficial::before { background: hsl(40 60% 52%); }

/* ==========================================================================
   9. Таблицы
   ========================================================================== */

.table-wrap {
  border: var(--hairline);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, hsl(225 20% 5.5% / 0.5), hsl(225 20% 3.5% / 0.5));
  box-shadow: 0 4px 40px -10px hsl(225 25% 2% / 0.5), inset 0 1px 0 hsl(210 20% 95% / 0.03);
  /* Широкая таблица прокручивается внутри своего контейнера, а не тянет страницу. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

.data-table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: hsl(210 14% 56%);
  padding: 0.9rem 1.1rem;
  border-bottom: var(--hairline);
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: var(--hairline-faint);
  vertical-align: top;
  color: hsl(210 14% 72%);
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.2s ease; }
.data-table tbody tr:hover { background: hsl(210 20% 95% / 0.02); }

.data-table .col-port {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--foreground) / 0.92);
  white-space: nowrap;
}

.data-table .col-service {
  font-family: var(--font-display);
  font-weight: 600;
  color: hsl(var(--foreground) / 0.85);
  /* Длинные имена сервисов не должны ломать раскладку. */
  overflow-wrap: anywhere;
}

.data-table .col-action { text-align: right; white-space: nowrap; }

/* На узких экранах таблица портов превращается в карточки. */
@media (max-width: 720px) {
  .data-table--stack { min-width: 0; }
  .data-table--stack thead { display: none; }
  .data-table--stack tbody tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: var(--hairline-faint);
  }
  .data-table--stack td {
    display: contents;
    padding: 0;
    border: 0;
  }
  .data-table--stack td::before {
    content: attr(data-label);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: hsl(210 14% 54%);
    padding-top: 2px;
  }
  .data-table--stack td > * { grid-column: 2; }
}

/* ==========================================================================
   10. Поиск
   ========================================================================== */

.search-form {
  position: relative;
  /* Форма с открытым списком должна подниматься над соседями своей секции. */
  z-index: var(--z-content);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(225 20% 6% / 0.85);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-form:focus-within,
.search-form:has(.search-suggest.is-open) { z-index: var(--z-search); }

.search-form:focus-within {
  border-color: hsl(245 55% 52% / 0.4);
  box-shadow: 0 0 0 4px hsl(245 55% 52% / 0.08);
}

.search-form svg { width: 17px; height: 17px; color: hsl(210 14% 54%); flex-shrink: 0; }

.search-form input[type='search'],
.search-form input[type='text'] {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: hsl(var(--foreground) / 0.9);
  /* 16px — иначе iOS зумит страницу при фокусе. */
  font-size: 16px;
  font-family: var(--font-body);
  padding: 0.55rem 0;
}

.search-form input::placeholder { color: hsl(210 14% 52%); }

.search-form--hero { padding: 0.5rem 0.5rem 0.5rem 1.15rem; }

.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: var(--z-search);
  /* Фон непрозрачный: сквозь список не должны просвечивать соседние секции. */
  background: hsl(225 18% 7%);
  border: var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 4px 8px hsl(225 25% 2% / 0.5), 0 24px 60px -12px hsl(225 25% 2% / 0.9);
  /* Длинная выдача прокручивается внутри списка, а не растёт вниз без предела. */
  max-height: min(360px, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
}

.search-suggest.is-open { display: block; }

/* Если под полем мало места, список разворачивается вверх (класс ставит JS). */
.search-suggest.is-above {
  top: auto;
  bottom: calc(100% + 8px);
}

.search-suggest ul { list-style: none; margin: 0; padding: 0.35rem; }
.search-suggest li { margin: 0; }

.search-suggest a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: hsl(210 14% 72%);
  font-size: 14px;
}

.search-suggest a:hover,
.search-suggest li.is-active a {
  background: hsl(245 55% 52% / 0.12);
  color: hsl(var(--foreground));
}

.search-suggest .s-title { font-family: var(--font-mono); font-weight: 600; flex-shrink: 0; }

.search-suggest .s-sub {
  font-size: 12px;
  color: hsl(210 14% 58%);
  /* Длинное имя сервиса обрезается многоточием, а не рвёт строку списка. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Протокол — справа, не сжимается. */
.search-suggest .s-proto {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: hsl(210 20% 95% / 0.05);
  color: hsl(210 14% 62%);
}
.search-suggest mark { background: hsl(245 55% 52% / 0.25); color: inherit; border-radius: 3px; }

.search-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: hsl(210 14% 58%);
}

/* ==========================================================================
   11. Хлебные крошки, пагинация, prev/next
   ========================================================================== */

.breadcrumbs {
  font-size: 12px;
  color: hsl(210 14% 55%);
  margin-bottom: 1.25rem;
  /* Длинная цепочка прокручивается, а не переносится рвано. */
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumbs ol { display: flex; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { margin: 0; display: flex; gap: 0.5rem; align-items: center; }
.breadcrumbs li + li::before { content: '/'; color: hsl(210 14% 47%); }
.breadcrumbs a { color: hsl(210 14% 62%); }
.breadcrumbs a:hover { color: hsl(var(--primary-glow)); }
.breadcrumbs [aria-current='page'] { color: hsl(210 14% 70%); }

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 2.5rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.75rem;
  border: var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  color: hsl(210 14% 65%);
}

.pagination a:hover { border-color: hsl(245 55% 52% / 0.3); color: hsl(var(--foreground)); }
.pagination .current { background: hsl(245 55% 52% / 0.14); border-color: hsl(245 55% 52% / 0.25); color: hsl(245 55% 74%); }

.prev-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.prev-next a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  border: var(--hairline);
  border-radius: var(--radius);
  color: inherit;
}

.prev-next a:hover { border-color: hsl(245 55% 52% / 0.28); color: inherit; }
.prev-next .pn-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: hsl(210 14% 54%); }
.prev-next .pn-title { font-family: var(--font-mono); font-size: 14px; color: hsl(var(--foreground) / 0.85); }
.prev-next .pn-next { text-align: right; }

/* ==========================================================================
   12. FAQ (accordion)
   ========================================================================== */

.faq { border-top: var(--hairline-faint); }

.faq-item { border-bottom: var(--hairline-faint); }

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.15rem 0.25rem;
  min-height: 44px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground) / 0.88);
}

.faq-q:hover { color: hsl(var(--foreground)); }

.faq-q .chev {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: hsl(210 14% 56%);
  transition: transform 0.25s ease;
}

.faq-q[aria-expanded='true'] .chev { transform: rotate(180deg); }

.faq-a {
  padding: 0 0.25rem 1.25rem;
  color: hsl(210 14% 66%);
  font-size: 14.5px;
  line-height: 1.7;
  max-width: 36rem;
}

.faq-a[hidden] { display: none; }

/* ==========================================================================
   13. Блоки кода
   ========================================================================== */

.code-block {
  position: relative;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(225 22% 4.5%);
  margin-bottom: 1rem;
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: var(--hairline-faint);
  font-size: 12px;
  color: hsl(210 14% 59%);
}

.code-block pre {
  margin: 0;
  padding: 0.9rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: hsl(210 16% 78%);
  white-space: pre;
  tab-size: 2;
}

.code-note {
  padding: 0.6rem 0.9rem;
  border-top: var(--hairline-faint);
  font-size: 12px;
  color: hsl(210 14% 58%);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  min-height: 32px;
  background: hsl(210 20% 95% / 0.04);
  border: var(--hairline);
  border-radius: 6px;
  color: hsl(210 14% 65%);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover { color: hsl(var(--foreground)); border-color: hsl(245 55% 52% / 0.3); }
.copy-btn.is-copied { color: hsl(160 55% 66%); border-color: hsl(160 55% 45% / 0.35); }
.copy-btn svg { width: 13px; height: 13px; }

/* ==========================================================================
   14. Подвал
   ========================================================================== */

/* Подвал перенесён из SiteFooter.tsx: py-12, тонкая верхняя граница,
   блок бренда слева и сетка мелких ссылок справа. */
.site-footer {
  border-top: 1px solid hsl(210 20% 95% / 0.025);
  padding-block: 3rem;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .footer-top { flex-direction: row; align-items: flex-start; }
}

.footer-brand { max-width: 24rem; }

.footer-brand__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.footer-brand__row svg { width: 16px; height: 16px; color: hsl(225 10% 55%); }

.footer-brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.03em;
  color: hsl(var(--foreground) / 0.75);
}

.footer-brand__name span { color: hsl(225 10% 55%); }

.footer-brand__desc {
  font-size: 12px;
  color: hsl(225 10% 52%);
  line-height: 1.8;
  margin: 0;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 2.5rem;
}

@media (min-width: 640px) {
  .footer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.footer-nav ul { list-style: none; margin: 0; padding: 0; }
.footer-nav li { margin: 0 0 0.625rem; }

.footer-nav a {
  font-size: 12px;
  color: hsl(225 10% 55%);
  transition: color 0.2s ease;
}

.footer-nav a:hover { color: hsl(var(--foreground) / 0.75); }

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(210 20% 95% / 0.02);
  font-size: 12px;
  /* 48% давало контраст 4.32 при требуемых 4.5 — поднято до проходного. */
  color: hsl(225 10% 58%);
  text-align: center;
}

/* Ссылка внутри абзаца не должна отличаться только цветом: подчёркиваем её,
   иначе контраст с окружающим текстом ниже требуемых 3:1. */
.footer-bottom a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-bottom a:hover { color: hsl(var(--foreground) / 0.9); }

@media (min-width: 640px) {
  .footer-bottom { flex-direction: row; text-align: left; }
  .footer-bottom__note { text-align: right; }
}

/* ==========================================================================
   15. Кнопка «наверх»
   ========================================================================== */

.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: var(--z-raised);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: hsl(225 18% 8% / 0.9);
  border: var(--hairline);
  backdrop-filter: blur(12px);
  color: hsl(210 14% 67%);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: hsl(var(--foreground)); border-color: hsl(245 55% 52% / 0.3); }
.to-top svg { width: 18px; height: 18px; }

@media (min-width: 768px) {
  .to-top { right: 1.5rem; bottom: 1.5rem; }
}

/* ==========================================================================
   16. Hero
   ========================================================================== */

.hero {
  position: relative;
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem);
  overflow: hidden;
}

/* Мягкое свечение позади героя — из React-версии. */
.hero::before {
  content: '';
  position: absolute;
  top: -140px;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, 130vw);
  height: 460px;
  background: radial-gradient(ellipse, hsl(245 60% 50% / 0.14), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}

.hero > .container { position: relative; z-index: 1; }

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.75rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
  max-width: 9rem;
}

.hero .lead { margin-bottom: 2rem; }

.hero-search { max-width: 620px; margin-bottom: 1.25rem; }

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  min-height: 32px;
  border: var(--hairline);
  border-radius: 999px;
  background: hsl(210 20% 95% / 0.02);
  font-family: var(--font-mono);
  font-size: 12px;
  color: hsl(210 14% 63%);
}

.chip:hover { color: hsl(var(--foreground) / 0.9); border-color: hsl(245 55% 52% / 0.3); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(50%, 130px), 1fr));
  gap: 1px;
  margin-top: 2.5rem;
  border: var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: hsl(210 20% 95% / 0.05);
}

.stat {
  background: hsl(225 20% 4%);
  padding: 1rem 1.1rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: hsl(var(--foreground) / 0.92);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(210 14% 54%);
  margin-top: 0.2rem;
}

/* ==========================================================================
   17. Контент статей
   ========================================================================== */

.prose { max-width: 36rem; }
.prose h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); margin-top: 2.5rem; }
.prose h3 { font-size: clamp(1.1rem, 2.4vw, 1.3rem); margin-top: 2rem; }
.prose p { color: hsl(210 14% 67%); }
.prose li { color: hsl(210 14% 67%); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: var(--radius); margin-block: 1.5rem; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-block: 1.5rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td { padding: 0.6rem 0.8rem; border: var(--hairline-faint); text-align: left; }

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.15rem;
  border-left: 3px solid hsl(var(--primary) / 0.5);
  background: hsl(210 20% 95% / 0.02);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: hsl(210 12% 66%);
}

/* Оглавление на длинных страницах. */
.toc {
  border: var(--hairline);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
  background: hsl(225 20% 4.5% / 0.6);
}

.toc h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(210 14% 54%);
  margin: 0 0 0.7rem;
  font-family: var(--font-body);
  font-weight: 600;
}

.toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 1.5rem; }
.toc li { margin-bottom: 0.35rem; break-inside: avoid; }
.toc a { font-size: 13px; color: hsl(210 14% 63%); }

@media (max-width: 640px) {
  .toc ul { columns: 1; }
}

/* ==========================================================================
   18. Служебное
   ========================================================================== */

.notice {
  border: var(--hairline);
  border-left: 3px solid hsl(40 60% 52% / 0.6);
  border-radius: var(--radius-sm);
  background: hsl(40 60% 52% / 0.05);
  padding: 0.85rem 1.1rem;
  font-size: 13.5px;
  color: hsl(40 45% 78%);
  margin-bottom: 1.25rem;
}

.sources { font-size: 13px; color: hsl(210 14% 58%); }
.sources li { margin-bottom: 0.4rem; }

.checked-at {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  color: hsl(210 14% 55%);
  font-family: var(--font-mono);
}

.checked-at svg { width: 14px; height: 14px; }
.section-label svg { width: 13px; height: 13px; }
.status-dot svg { width: 13px; height: 13px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Перенос строки только на широких экранах — эквивалент `br.hidden lg:block`. */
.lg-only { display: none; }

@media (min-width: 1024px) {
  .lg-only { display: block; }
}

/* ==========================================================================
   19. Анимация
   ========================================================================== */

/* Появления секций при прокрутке здесь сознательно нет.
 *
 * В React-версии секции выезжали через framer-motion whileInView. При серверном
 * рендеринге такой эффект означает, что контент физически присутствует в потоке
 * (высота зарезервирована), но невидим, пока до него не доскроллят. Проверено на
 * мобильной главной: ниже первого экрана оставалась пустота во всю высоту
 * страницы. Ломаются полностраничные скриншоты, печать и быстрая прокрутка,
 * а выигрыш — доли секунды декоративного движения.
 *
 * Класс .reveal оставлен в разметке как точка расширения, но ничего не скрывает.
 * Движение осталось там, где оно реагирует на действие пользователя: hover
 * карточек и кнопок, аккордеон FAQ, мобильное меню. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   20. Тач-цели
   ==========================================================================
   На указательных устройствах без точного курсора все интерактивные элементы
   должны быть не меньше 44px — иначе по ним трудно попасть пальцем. */

@media (pointer: coarse), (max-width: 900px) {
  .btn--sm { min-height: 44px; padding-block: 0.6rem; }

  .search-form input[type='search'],
  .search-form input[type='text'] { min-height: 44px; }

  .chip { min-height: 44px; padding-inline: 0.9rem; }

  .copy-btn { min-height: 44px; padding-inline: 0.8rem; }

  .menu-toggle { width: 44px; min-width: 44px; margin-right: 0; }

  .brand { min-height: 44px; }

  .footer-nav a,
  .breadcrumbs a {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
  }

  .footer-nav li { margin-bottom: 0; }

  /* Ссылки внутри таблиц занимают всю высоту ячейки: иначе попасть пальцем
     в номер порта высотой 20px практически невозможно. */
  .data-table a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 0.25rem;
    margin-inline: -0.25rem;
  }

  .data-table .col-action a { padding-inline: 0.75rem; margin-inline: 0; }

  .prev-next a,
  .port-card,
  .card--link { min-height: 44px; }
}

/* ---------------------------------------------------------------------------
   Редакционный текст страницы порта (post_content).

   Здесь появляются <pre> с командами и inline <code> с именами сервисов —
   и то и другое длиннее 390px. Блок кода прокручивается внутри себя, а не
   растягивает страницу; inline-код переносится по символам. Без этого на
   390px возникал горизонтальный скролл всей страницы.
   --------------------------------------------------------------------------- */

.port-prose {
  min-width: 0;
}

.port-prose > * + * {
  margin-top: 1rem;
}

.port-prose h2 {
  margin-top: 2rem;
}

.port-prose pre {
  margin: 1.25rem 0;
  padding: 0.9rem;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(225 22% 4.5%);
  color: hsl(210 16% 78%);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.port-prose pre code {
  background: none;
  padding: 0;
  border: 0;
  font-size: inherit;
  color: inherit;
  white-space: inherit;
}

.port-prose code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.port-prose ul {
  padding-left: 1.25rem;
}

.port-prose li + li {
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Изображения конвейера

   aspect-ratio задан явно на каждый слот: браузер резервирует место до
   загрузки файла, и картинка не двигает текст под собой. width/height в
   разметке для этого недостаточно, когда ширина резиновая.

   Изображения лежат на --z-content и НЕ создают собственный stacking context
   выше него: выпадающий список поиска (--z-search) должен оставаться сверху.
   --------------------------------------------------------------------------- */

.pipeline-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(var(--card));
  object-fit: cover;
  position: relative;
  z-index: var(--z-content);
}

/* Блок сравнения TCP/UDP на главной. */
.cmp-side__figure {
  margin-top: 1.75rem;
  aspect-ratio: 16 / 9;
}

/* Вспомогательный визуал раздела «What is a port». */
.wip-panel__figure {
  margin-top: 1.25rem;
  aspect-ratio: 16 / 9;
}

/* Featured-иллюстрации страниц, статей и терминов. */
.page-figure,
.guide-figure,
.term-figure {
  margin: 1.5rem 0 2rem;
  aspect-ratio: 16 / 9;
}

.term-figure {
  aspect-ratio: 4 / 3;
  max-width: 520px;
}

@media (max-width: 640px) {
  /* На узких экранах кадр обрезается сильнее: держим фокус в центре
     и не отдаём картинке половину первого экрана. */
  .cmp-side__figure,
  .wip-panel__figure,
  .page-figure,
  .guide-figure {
    aspect-ratio: 3 / 2;
  }

  .term-figure {
    max-width: 100%;
  }
}

/* Собственные SVG-схемы: точность важнее декоративности, поэтому у них
   светлая рамка и подпись, а не «фоновое» оформление иллюстраций. */
.diagram-figure {
  margin: 2rem 0;
  max-width: 800px;
}

.diagram-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: var(--hairline);
  border-radius: var(--radius);
  background: hsl(var(--background));
}

.diagram-figure figcaption {
  margin-top: 0.65rem;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}
