/* css/style.css */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Roboto Mono", Menlo, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --container: 1120px;
  --shell: 720px;
}

html[data-theme="light"] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --text: #12151B;
  --text-muted: #374151;
  --text-faint: #4B5563;
  --border: #E1E4EA;
  --border-faint: #E9EBEF;
  --accent: #2A5BD7;
  --accent-hover: #1C44B8;
  --accent-ink: #FFFFFF;
  --accent-tint: rgba(42,91,215,0.08);
  --good: #18874C;
  --good-tint: rgba(24,135,76,0.09);
  --warn: #B5790F;
  --warn-tint: rgba(181,121,15,0.10);
  --severe: #D9530F;
  --severe-tint: rgba(217,83,15,0.09);
  --bad: #C73B43;
  --bad-tint: rgba(199,59,67,0.09);
  --shadow: 0 1px 2px rgba(15,17,21,0.04), 0 10px 28px rgba(15,17,21,0.06);
}

html[data-theme="dark"] {
  --bg: #0E1116;
  --surface: #161A22;
  --surface-2: #1C212B;
  --text: #ECEEF2;
  --text-muted: #D1D5DB;
  --text-faint: #9CA3AF;
  --border: #262C38;
  --border-faint: #1F242E;
  --accent: #6C97FF;
  --accent-hover: #94B5FF;
  --accent-ink: #0E1116;
  --accent-tint: rgba(108,151,255,0.12);
  --good: #3FCB80;
  --good-tint: rgba(63,203,128,0.12);
  --warn: #E3A847;
  --warn-tint: rgba(227,168,71,0.12);
  --severe: #F97316;
  --severe-tint: rgba(249,115,22,0.12);
  --bad: #F0626A;
  --bad-tint: rgba(240,98,106,0.12);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 12px 32px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.container { width: 100%; max-width: var(--container); margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }
.shell { max-width: var(--shell); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* КНОПКИ */
.tools-icon-mobile { display: none; }
.tools-text-desktop { display: inline; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; padding: 9px 14px;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }

.icon-btn {
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.btn-primary {
  border: none; background: var(--accent); color: var(--accent-ink);
  font-size: 15.5px; font-weight: 700; padding: 14px 30px; 
  border-radius: 12px; box-shadow: var(--shadow);
  transition: background-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px); }

.btn-text {
  border: none; background: none; padding: 0;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid transparent;
}
.btn-text:hover { border-bottom-color: var(--accent); }

/* ШАПКА */
.site-header { border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }

.logo { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.logo-mark { color: var(--accent); flex-shrink: 0; transform: translateY(1.5px); }
.logo-mark .ring1 { animation: pulse-ring 3.2s ease-out infinite; transform-origin: center; }
.logo-mark .ring2 { animation: pulse-ring 3.2s ease-out infinite 1.1s; transform-origin: center; }

@keyframes pulse-ring { 0% { opacity: .9; } 70% { opacity: .15; } 100% { opacity: .9; } }

.logo-text { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.logo-word { font-family: var(--font-mono); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.logo-word span { color: var(--accent); font-weight: 700; }
.logo-divider { width: 1px; height: 14px; background: var(--border); flex-shrink: 0; }
.logo-tag { font-size: 12.5px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА */
.lang-switch { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; }
.lang-code { font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.lang-btn svg { width: 13px; height: 13px; color: var(--text-faint); transition: transform .15s ease; }
.lang-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.lang-menu[hidden] { display: none; }
.lang-menu li {
  padding: 9px 12px; border-radius: 8px; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-muted); cursor: pointer;
}
.lang-menu li:hover { background: var(--surface-2); color: var(--text); }
.lang-menu li.is-active { color: var(--accent); font-weight: 600; }
.lang-menu li small { font-family: var(--font-mono); color: var(--text-faint); font-size: 11.5px; }

/* ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ */
.icon-sun, .icon-moon { position: absolute; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

/* ГЛАВНЫЙ ЭКРАН (HERO) */
.hero { padding: 88px 24px 0; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 22px;
}

/* СТАТУСНЫЕ ТОЧКИ */
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); transition: background-color .3s ease; flex-shrink: 0; }
.status-dot.is-good   { background: var(--good); box-shadow: 0 0 0 3px var(--good-tint); }
.status-dot.is-warn   { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-tint); }
.status-dot.is-severe { background: var(--severe); box-shadow: 0 0 0 3px var(--severe-tint); }
.status-dot.is-bad    { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }

.hero h1 { font-size: clamp(30px, 4.6vw, 48px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; max-width: 620px; margin-inline: auto; }
.hero p.lead { margin: 18px auto 0; max-width: 480px; color: var(--text-muted); font-size: 16px; line-height: 1.6; }

/* ДИНАМИЧЕСКАЯ ЗОНА */
.dynamic-zone { margin-top: 40px; padding-bottom: 110px; }
.scan-panel, .results-panel { display: none; }
.dynamic-zone[data-state="idle"] .scan-panel, .dynamic-zone[data-state="idle"] .results-panel { display: none; }
.dynamic-zone[data-state="scanning"] .cta-area, .dynamic-zone[data-state="scanning"] .results-panel { display: none; }
.dynamic-zone[data-state="scanning"] .scan-panel { display: block; }
.dynamic-zone[data-state="results"] .cta-area, .dynamic-zone[data-state="results"] .scan-panel { display: none; }
.dynamic-zone[data-state="results"] .results-panel { display: block; }

.cta-area { position: relative; display: inline-block; padding-top: 14px; }
.cta-area .ring { position: absolute; left: 50%; top: 50%; border: 1px solid var(--accent); border-radius: 50%; pointer-events: none; opacity: 0; }
.cta-area .ring-a { width: 160px; height: 60px; margin: -30px 0 0 -80px; animation: cta-pulse 2.6s ease-out infinite; }
.cta-area .ring-b { width: 160px; height: 60px; margin: -30px 0 0 -80px; animation: cta-pulse 2.6s ease-out infinite 1.3s; }

@keyframes cta-pulse { 0% { transform: scale(0.9); opacity: .35; } 100% { transform: scale(1.35); opacity: 0; } }

.scan-panel { max-width: 380px; margin-inline: auto; }
.progress-track { height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 99px; transition: width 0.45s cubic-bezier(0.25, 1, 0.5, 1); }
.scan-line { margin-top: 16px; min-height: 18px; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.scan-line .cursor { display: inline-block; width: 7px; height: 13px; background: var(--text-faint); margin-left: 2px; vertical-align: -2px; animation: blink 1s step-end infinite; }

@keyframes blink { 50% { opacity: 0; } }

.results-panel { text-align: left; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ВЕРДИКТ В ШАПКЕ РЕЗУЛЬТАТОВ */
.verdict { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.verdict.sev-good { border-color: color-mix(in srgb, var(--good) 35%, var(--border)); background: var(--good-tint); }
.verdict.sev-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: var(--warn-tint); }
.verdict.sev-bad  { border-color: color-mix(in srgb, var(--bad) 35%, var(--border));  background: var(--bad-tint); }

.verdict-icon { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface); }
.verdict.sev-good .verdict-icon { color: var(--good); }
.verdict.sev-warn .verdict-icon { color: var(--warn); }
.verdict.sev-bad  .verdict-icon { color: var(--bad); }

.verdict-title { font-size: 15.5px; font-weight: 700; }
.verdict-text { margin-top: 4px; font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.results-meta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--text-faint); text-align: center; flex-wrap: wrap; }
.results-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }


/* =========================================================================
   МОНОЛИТНАЯ КАРТОЧНАЯ АРХИТЕКТУРА (The Monolith Component)
========================================================================= */

.results-list {
  margin-top: 28px;
}

.analyzer-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.015);
}
.analyzer-card:last-child { margin-bottom: 0; }

.analyzer-card-head {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 42px;
  padding: 0 20px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-faint);
  line-height: 1;
  padding-bottom: 2px;
}

/* ТЕМНЫЙ ПОДБЛОК-КОНТЕЙНЕР */
.param-subgroup {
  background: var(--bg);
  border-bottom: 1px solid var(--border-faint);
}
.analyzer-card .param-subgroup:last-child {
  border-bottom: none;
}

/* СТРОКА ПАРАМЕТРА */
.param-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-faint);
  min-height: 44px;
}
.param-subgroup .param-row:last-of-type {
  border-bottom: none;
}

.param-label {
  font-size: 14px;
  color: var(--text-muted);
}

.param-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-mono);
}

/* КЛИКАБЕЛЬНЫЙ СИНИЙ IP */
.ip-copy-dash {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.ip-copy-dash:hover { opacity: 0.7; }

/* МИНИ-ПЛАШКИ В СТРОКАХ */
.result-row-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid currentColor;
  margin-left: 12px;
}
.result-row-status.is-good   { color: var(--good);   background: var(--good-tint); }
.result-row-status.is-warn   { color: var(--warn);   background: var(--warn-tint); }
.result-row-status.is-severe { color: var(--severe); background: var(--severe-tint); }
.result-row-status.is-bad    { color: var(--bad);    background: var(--bad-tint); }

/* ПОДВАЛЬНЫЙ ВЕРДИКТ ВНИЗУ ПОДБЛОКА */
.subgroup-verdict {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  border-top: 1px solid var(--border-faint);
}

/* --- ОТПОЛИРОВАННАЯ ЦВЕТОВАЯ ЛОГИКА --- */

.param-subgroup.group-is-good {
  background: color-mix(in srgb, var(--good) 3.5%, transparent);
  border-color: color-mix(in srgb, var(--good) 14%, transparent);
  padding-top: 4px;
}
.param-subgroup.group-is-good .subgroup-verdict {
  background: color-mix(in srgb, var(--good) 12%, transparent);
  color: var(--good);
}

.param-subgroup.group-is-warn {
  background: color-mix(in srgb, var(--warn) 4.5%, transparent);
  border-color: color-mix(in srgb, var(--warn) 20%, transparent);
  padding-top: 4px;
}
.param-subgroup.group-is-warn .subgroup-verdict {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}

.param-subgroup.group-is-bad,
.param-subgroup.group-is-severe {
  background: color-mix(in srgb, var(--bad) 6%, transparent);
  border-color: color-mix(in srgb, var(--bad) 24%, transparent);
  padding-top: 4px;
}
.param-subgroup.group-is-bad .subgroup-verdict,
.param-subgroup.group-is-severe .subgroup-verdict {
  background: var(--bad);
  color: #ffffff;
  font-weight: 800;
}

/* ЖЕСТКИЙ ПРАВИЛЬНЫЙ АДАПТИВ ПОД МОБИЛКИ (ЗАПРЕТ ПАДЕНИЯ КОЛОНОК) */
@media (max-width: 640px) {
  .param-row {
    flex-direction: row;
    flex-wrap: nowrap; /* Магия: строго запрещаем блокам падать друг под друга! */
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 16px;
    min-height: 40px;
  }
  
  .param-label {
    flex: 0 0 auto;
    max-width: 44%; /* Название параметра занимает не больше 44% ширины карточки */
  }
  
  .param-value {
    flex: 1 1 auto;
    min-width: 0; /* Магия Flexbox: разрешаем тексту справа сжиматься тоньше длинных слов */
    margin-left: 0;
    text-align: right;
    word-break: break-word;
    display: flex;
    justify-content: flex-end;
  }
  
  .tz-utc {
    display: block;
    margin-top: 2px;
  }

  .analyzer-card-head { padding: 0 16px; }
}


/* =========================================================================
   ПОДВАЛ САЙТА И МОДАЛКИ
========================================================================= */

.site-footer { border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 0.8fr 1fr; gap: 40px; padding-top: 56px; padding-bottom: 40px; }
.footer-brand .logo { margin-bottom: 14px; }
.footer-tagline { font-size: 13.5px; color: var(--text-muted); max-width: 260px; line-height: 1.6; }
.zerologs-badge { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 99px; padding: 5px 11px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.zerologs-badge svg { width: 12px; height: 12px; color: var(--good); }

.footer-col-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 14px; }
.footer-links li { margin-bottom: 11px; }
.footer-links a { font-size: 14px; color: var(--text-muted); transition: color .15s ease; }
.footer-links a:hover { color: var(--accent); }

.kb-card { display: block; border: 1px solid var(--accent); border-radius: var(--radius-lg); background: var(--accent-tint); padding: 18px; transition: transform .15s ease, box-shadow .15s ease; }
.kb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kb-card-top { display: flex; align-items: center; justify-content: space-between; }
.kb-card-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.kb-card-icon svg { width: 16px; height: 16px; }
.kb-card-arrow { color: var(--accent); width: 16px; height: 16px; }
.kb-card-title { margin-top: 13px; font-size: 15px; font-weight: 700; }
.kb-card-sub { margin-top: 5px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-bottom span { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* МОДАЛЬНОЕ ОКНО ИНСТРУМЕНТОВ */
.tools-overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; }
.tools-overlay.is-open { opacity: 1; visibility: visible; }
.tools-head { display: flex; align-items: center; justify-content: space-between; height: 72px; border-bottom: 1px solid var(--border); }
.tools-head h2 { font-size: 16px; font-weight: 700; }
.tools-body { flex: 1; overflow-y: auto; padding: 36px 24px 56px; }
.tools-grid { max-width: 920px; margin-inline: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card { display: block; text-decoration: none; color: inherit; position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 20px; transition: border-color .15s ease, transform .15s ease; }
.tool-card:not([href="#"]):hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.tool-card-icon svg { width: 17px; height: 17px; }
.tool-card-title { margin-top: 14px; font-size: 14.5px; font-weight: 700; }
.tool-card-desc { margin-top: 6px; font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.tool-card-soon { position: absolute; top: 16px; right: 16px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--border); border-radius: 99px; padding: 3px 8px; }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; padding-bottom: 32px; }
  .logo-tag { display: none; }
  .hero { padding-top: 64px; }
  .dynamic-zone { padding-bottom: 72px; }
}
@media (max-width: 620px) {
  .nav-actions .tools-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .tools-text-desktop { display: none; }
  .tools-icon-mobile { display: block; }
  .header-inner { height: 64px; }
}

#heroTitle, 
#heroSubtext {
  max-height: 400px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.38s ease;
}

#heroTitle.is-collapsed,
#heroSubtext.is-collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}