/* Стили статьи «HTTP и HTTPS: как браузер и сервер разговаривают». Участники, мини-сайт и карта серии — в shared/css/how-web.css. */

.hh-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.hh-explain { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-strong); font-size: 14px; line-height: 1.55; color: var(--muted); }
.hh-empty { display: grid; place-items: center; min-height: 92px; padding: 12px; border-radius: 12px; border: 1px dashed var(--border-strong); font-size: 13px; color: var(--muted); text-align: center; }
.hh-empty--wait { animation: hh-pulse 1.2s ease-in-out infinite; }
@keyframes hh-pulse { 50% { opacity: .5; } }
.hh-presets { flex-wrap: wrap; }
.hh-preset { font-size: 12.5px; }
.hh-preset[aria-pressed='true'] { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }

/* Окно HTTP-сообщения */
.hh-msg { display: grid; gap: 1px; padding: 8px 0; border-radius: 12px; background: var(--surface); font-family: var(--font-mono); font-size: 12px; line-height: 1.5; min-width: 0; animation: demo-in .3s var(--ease-out) both; }
.hh-msg__title { padding: 0 12px 6px; font-size: 11px; color: var(--muted); }
.hh-msg__row { padding: 2px 12px; overflow-wrap: anywhere; transition: background var(--transition); }
.hh-msg__row--pick { cursor: pointer; }
.hh-msg__row--pick:hover { background: var(--surface-2); }
.hh-msg__row--on, .hh-msg__row--on:hover { background: var(--primary-soft); box-shadow: inset 2px 0 0 var(--primary-fg); }
.hh-msg__start { font-weight: 600; }
.hh-msg__h b { font-weight: 500; color: var(--primary-fg); }
.hh-msg__gap { height: 6px; }
.hh-msg__body pre { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.hh-msg__body--none { color: var(--muted); font-family: var(--font-body); font-size: 12.5px; font-style: italic; }
.hh-msg mark, .hh-bar__url mark { background: color-mix(in srgb, var(--danger) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.hh-method { color: var(--primary-fg); }
.hh-code { font-family: var(--font-mono); font-weight: 600; }
.hh-code--ok { color: var(--mint-fg); }
.hh-code--move { color: var(--signal-fg); }
.hh-code--err { color: var(--danger); }

/* ---------- 01. Запрос и ответ ---------- */

.hh-anat { display: grid; gap: 12px; }
.hh-anat__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.hh-anat .hh-explain { min-height: 76px; color: var(--text); }
@media (max-width: 640px) { .hh-anat__cols { grid-template-columns: 1fr; } }

/* ---------- 02. Форма заявки ---------- */

.hh-formdemo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.hh-formdemo__site, .hh-formdemo__wire { display: grid; gap: 10px; min-width: 0; }
.hh-win { border-radius: 14px; border: 1px solid var(--border); background: var(--panel); overflow: hidden; }
.hh-bar { display: flex; align-items: center; gap: 5px; padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.hh-bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; }
.hh-bar__url { flex: 1; min-width: 0; margin-left: 6px; padding: 3px 9px; border-radius: 12px; background: var(--panel); font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; line-height: 1.5; }
.hh-win__body { padding: 10px; }
.hh-form { display: grid; gap: 10px; padding: 14px; border-radius: 10px; background: var(--hero-grad); }
.hh-form[hidden], .hh-form__done[hidden], .hh-errpage[hidden], .hh-shield[hidden], .hh-pop[hidden], .hh-risks[hidden], .hh-insecure[hidden] { display: none; }
.hh-form__title { font-family: var(--font-heading); font-weight: 500; font-size: 17px; line-height: 1.15; }
.hh-form__hint { margin-top: -6px; font-size: 12px; color: color-mix(in srgb, var(--text) 72%, transparent); }
.hh-field { display: grid; gap: 3px; font-size: 11.5px; color: color-mix(in srgb, var(--text) 78%, transparent); }
.hh-field .input { width: 100%; padding: 7px 10px; font-size: 13.5px; background: var(--panel); }
.hh-form__btn {
  justify-self: start;
  padding: 7px 16px;
  border: 0;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}
.hh-form__btn:disabled { opacity: .6; cursor: default; }
.hh-form__err { padding: 6px 10px; border-radius: 8px; background: var(--panel); color: var(--danger); font-size: 12.5px; }
.hh-form__done { display: grid; justify-items: center; gap: 6px; padding: 22px 14px; border-radius: 10px; background: var(--hero-grad); text-align: center; font-size: 13px; }
.hh-form__done b { font-family: var(--font-heading); font-weight: 500; font-size: 17px; }
.hh-form__done .btn { margin-top: 6px; }
.hh-form__ok { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); color: var(--mint-fg); font-weight: 700; font-size: 18px; }
.hh-slot { min-width: 0; }
.hh-warn { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); }
.hh-warn:empty { display: none; }
@media (max-width: 680px) { .hh-formdemo { grid-template-columns: 1fr; } }

/* ---------- 03. Коды ответа ---------- */

.hh-codes { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hh-codes__main { display: grid; gap: 10px; min-width: 0; }
.hh-log { display: grid; gap: 2px; padding: 6px; border-radius: 12px; background: var(--surface); min-height: 104px; align-content: start; }
.hh-log__row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 40px; gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 7px; font-family: var(--font-mono); font-size: 12.5px; animation: demo-in .3s var(--ease-out) both; }
.hh-log__row--head { font-size: 10.5px; color: var(--muted); animation: none; }
.hh-log__path { min-width: 0; overflow-wrap: anywhere; }
.hh-log__path small { display: block; font-size: 11px; color: var(--signal-fg); }
.hh-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.hh-group { display: grid; gap: 1px; padding: 6px 8px; border-radius: 9px; background: var(--surface); font-size: 11.5px; color: var(--muted); line-height: 1.3; transition: background var(--transition), color var(--transition); }
.hh-group b { font-family: var(--font-mono); font-size: 13px; }
.hh-group--on { color: var(--text); }
.hh-group--ok.hh-group--on { background: var(--mint-soft); }
.hh-group--ok.hh-group--on b { color: var(--mint-fg); }
.hh-group--move.hh-group--on { background: color-mix(in srgb, var(--signal) 16%, transparent); }
.hh-group--move.hh-group--on b { color: var(--signal-fg); }
.hh-group--err.hh-group--on { background: var(--danger-soft); }
.hh-group--err.hh-group--on b { color: var(--danger); }
.hh-codes .hh-explain { min-height: 96px; }
.hh-errpage { position: absolute; inset: 10px; display: grid; place-content: center; justify-items: center; gap: 4px; padding: 12px; border-radius: 10px; background: var(--hero-grad); text-align: center; animation: demo-in .3s var(--ease-out) both; }
.hh-errpage b { font-family: var(--font-heading); font-weight: 500; font-size: 44px; line-height: 1; }
.hh-errpage div { font-family: var(--font-heading); font-weight: 500; font-size: 15px; }
.hh-errpage span { font-size: 12px; color: color-mix(in srgb, var(--text) 72%, transparent); }
@media (max-width: 680px) { .hh-codes { grid-template-columns: 1fr; } }
@media (max-width: 440px) { .hh-groups { grid-template-columns: 1fr 1fr; } }

/* ---------- 04. Что видно по дороге ---------- */

.hh-wire { display: grid; gap: 16px; }
.hh-route { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 4px; }
.hh-route__track { position: absolute; left: 12.5%; right: 12.5%; top: 30px; border-top: 2px dashed var(--border-strong); }
.hh-packet {
  position: absolute;
  z-index: 2;
  top: 31px;
  left: 12.5%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  opacity: 0;
  transition: left .6s var(--ease-out), opacity .2s ease;
}
.hh-packet--on { opacity: 1; }
.hh-packet--open { background: var(--danger); }
.hh-packet--lock { background: var(--mint-fg); }
.hh-wire__cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.hh-seen { display: grid; gap: 8px; min-width: 0; }
.hh-seen__text { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; animation: demo-in .3s var(--ease-out) both; }
.hh-open--hot { color: var(--danger); font-weight: 600; }
.hh-seen__text--cipher { color: var(--muted); letter-spacing: .02em; }
.hh-seen__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hh-seen__meta div { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); min-width: 0; }
.hh-seen__meta span { font-size: 11px; color: var(--muted); }
.hh-seen__meta b { font-family: var(--font-mono); font-weight: 500; font-size: 12.5px; overflow-wrap: anywhere; }
.hh-seen__note { font-size: 12.5px; color: var(--mint-fg); }
.hh-risks { display: grid; gap: 6px; align-content: start; padding-top: 19px; }
.hh-risk { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.hh-risk i { flex: none; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); }
.hh-risk--ok { background: var(--mint-soft); }
.hh-risk--ok i { background: var(--mint-fg); }
.hh-risk--err { background: var(--danger-soft); }
.hh-risk--err i { background: var(--danger); }
@media (max-width: 680px) {
  .hh-wire__cols { grid-template-columns: 1fr; }
  .hh-risks { padding-top: 0; }
  .hh-route .hw-node__icon { width: 42px; height: 42px; border-radius: 13px; }
  .hh-route__track { top: 25px; }
  .hh-packet { top: 26px; }
  .hh-route .hw-node__name { font-size: 11px; }
}

/* ---------- 05. Сертификат ---------- */

.hh-cert { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hh-cert__site { min-width: 0; }
.hh-cert .hw-site__lock { cursor: pointer; padding: 2px; margin: -2px; border-radius: 4px; }
.hh-cert .hw-site__lock:hover { background: var(--mint-soft); }
.hh-cert .hw-site__lock[hidden] { display: none; }
.hh-insecure { flex: none; font-family: var(--font-body); font-size: 10.5px; color: var(--danger); padding-right: 6px; border-right: 1px solid var(--border-strong); }
.hh-shield { position: absolute; inset: 0; display: grid; align-content: center; gap: 8px; padding: 16px 18px; background: var(--panel); font-size: 12.5px; line-height: 1.5; animation: demo-in .3s var(--ease-out) both; }
.hh-shield i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--danger); color: #fff; font-style: normal; font-weight: 700; }
.hh-shield--http i { background: var(--signal-fg); color: var(--bg); }
.hh-shield b { font-family: var(--font-heading); font-weight: 500; font-size: 16px; line-height: 1.25; }
.hh-shield p { margin: 0; color: var(--muted); }
.hh-shield p strong { color: var(--text); font-weight: 600; }
.hh-shield code { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.hh-shield__btn {
  justify-self: start;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.hh-shield__btn--main { border-color: var(--primary); background: var(--primary); color: #fff; cursor: default; }
.hh-pop { position: absolute; z-index: 3; top: 6px; left: 10px; right: 10px; display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow); font-size: 12px; animation: demo-in .25s var(--ease-out) both; }
.hh-pop b { font-family: var(--font-heading); font-weight: 500; font-size: 14px; color: var(--mint-fg); margin-bottom: 2px; }
.hh-pop__row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.hh-pop__row span { color: var(--muted); }
.hh-pop__row b { font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; overflow-wrap: anywhere; }
.hh-cert .hh-explain { color: var(--text); }
@media (max-width: 680px) { .hh-cert { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */

.hero__visual { display: flex; align-items: center; justify-content: center; }
.hero-hh { width: 100%; max-width: 400px; display: grid; }
.hero-hh .hw-site { box-shadow: var(--shadow); }
.hero-hh .hw-site__view { min-height: 150px; }
.hero-hh .hw-site__label, .hero-hh .hw-site__menu { display: none; }
.hero-hh__wire { position: relative; display: grid; gap: 8px; margin: -26px 0 0 30px; }
.hero-hh__msg {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s var(--ease-out);
}
.hero-hh__msg.is-on { opacity: 1; transform: none; }
.hero-hh__msg--req { margin-right: 60px; transform: translateY(8px) rotate(-1.5deg); }
.hero-hh__msg--req.is-on { transform: rotate(-1.5deg); }
.hero-hh__msg--res { margin-left: 40px; }
.hero-hh__dir { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.hero-hh__msg code { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-hh__msg--req b { color: var(--primary-fg); }
.hero-hh__msg--res b { color: var(--mint-fg); }
@media (max-width: 640px) { .hero-hh__wire { margin: -18px 0 0 10px; } }

/* Переключатели на телефоне во всю ширину */
@media (max-width: 480px) {
  .demo__controls .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .demo__controls .seg__btn { padding-left: 4px; padding-right: 4px; }
  .hh-cert__controls .seg { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
}
