@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;800&family=Unbounded:wght@500;700&display=swap');

:root {
  --bg: #0b0f16;
  --bg2: #0e1421;
  --panel: #121a2a;
  --line: #1f2c44;
  --text: #e8edf5;
  --muted: #98a5bb;
  --accent: #f97316;
  --accent-soft: #ffab6b;
  --green: #22c55e;
  --amber: #eab308;
  --orange: #f97316;
  --red: #ef4444;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(249, 115, 22, .45); }

h1, h2, h3 { font-family: 'Unbounded', 'Manrope', sans-serif; line-height: 1.2; }

a { color: var(--accent-soft); }

section, footer { scroll-margin-top: 76px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 860px; }

.muted { color: var(--muted); }

/* ---------- Иконки ---------- */
.icon {
  width: 1.1em; height: 1.1em;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.16em; flex-shrink: 0;
}

/* ---------- Навбар ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(10, 14, 21, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(38, 52, 80, .6);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Unbounded', sans-serif; font-size: 14px; letter-spacing: .08em;
  color: #fff; text-decoration: none; white-space: nowrap;
}
.brand strong { font-weight: 700; }
.brand-text { display: inline-block; }
.brand .icon { width: 22px; height: 22px; color: var(--accent); }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a {
  color: #aeb9cc; font-size: 14px; font-weight: 600; text-decoration: none;
  padding: 6px 2px; transition: color .2s;
}
.nav-links a:hover { color: #fff; }
@media (max-width: 940px) { .nav-links { display: none; } }

/* ---------- Hero / 3D ---------- */
.hero {
  position: relative;
  height: 100vh; min-height: 640px;
  overflow: hidden;
  background: var(--bg);
}
#scene { position: absolute; inset: 0; }
#scene canvas { display: block; }
.webgl-error { padding: 48px; text-align: center; color: var(--muted); }

#loader {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; align-content: center; gap: 16px;
  background: rgba(9, 12, 19, .88);
  transition: opacity .6s;
}
#loader.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid #24314e; border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
#loader p { color: var(--muted); font-size: 14px; }

.hero-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 120px 40px 24px;
  pointer-events: none;
}
.hero-copy { max-width: 620px; pointer-events: none; }
.hero-copy .btn { pointer-events: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(249, 115, 22, .4); background: rgba(249, 115, 22, .12);
  color: var(--accent-soft);
  border-radius: 999px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(1.8rem, 4.2vw, 3.2rem); font-weight: 700;
  margin: 22px 0 16px;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .7);
}
.hero-sub {
  color: #c3cddd; font-size: 17px; max-width: 540px; margin: 0 0 28px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .8);
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 12px;
  font: 700 15px 'Manrope', sans-serif;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s, filter .15s, border-color .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #16100a; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { border-color: rgba(255, 255, 255, .28); color: var(--text); background: rgba(11, 15, 22, .4); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-soft); }

.scene-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  margin: 0;
  font-size: 13px; color: var(--muted);
  background: rgba(10, 14, 22, .6); border: 1px solid rgba(38, 52, 80, .5);
  padding: 8px 16px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

.legend {
  position: absolute; right: 24px; bottom: 24px;
  width: 300px; max-height: min(58vh, 480px); overflow: auto;
  background: rgba(11, 15, 22, .8);
  border: 1px solid #263450; border-radius: 16px; padding: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}
.legend-title {
  margin: 2px 4px 10px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.legend-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; margin: 0 0 2px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--text); font: 600 13.5px 'Manrope', sans-serif;
  text-align: left; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.legend-chip:hover { background: #1a2438; border-color: #2c3c5c; }
.dot {
  width: 24px; height: 24px; min-width: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 800;
}
.dot.mini { width: 10px; height: 10px; min-width: 10px; }

@media (max-width: 760px) {
  .hero-overlay { padding: 96px 20px 16px; }
  .legend { left: 16px; right: 16px; bottom: 64px; width: auto; max-height: 32vh; }
  .scene-hint { bottom: 16px; white-space: normal; text-align: center; width: calc(100% - 40px); }
}

/* ---------- Полоса «опасность» ---------- */
.hazard-stripes {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, #131722 14px 28px);
  border-top: 1px solid #000; border-bottom: 1px solid #000;
}

/* ---------- Секции ---------- */
.section { padding: 92px 0; }
.section-tint { background: var(--bg2); }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s, transform .7s; }
.reveal.visible { opacity: 1; transform: none; }

.kicker {
  margin: 0 0 12px;
  color: var(--accent); font-size: 13px; font-weight: 800;
  letter-spacing: .2em; text-transform: uppercase;
}
h2 { font-size: clamp(1.5rem, 3vw, 2.3rem); margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 17px; max-width: 780px; margin: 0 0 42px; }

.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.grid.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 980px) { .grid.cols-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: #33507e; }
.card h3 { font-size: 17px; margin: 0 0 8px; }
.card p { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card li {
  position: relative; padding-left: 18px; margin: 8px 0;
  font-size: 14px; color: #cdd6e4;
}
.card li::before {
  content: ''; position: absolute; left: 0; top: 9px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(249, 115, 22, .1); color: var(--accent-soft);
  border-radius: 12px;
}
.card-icon .icon { width: 24px; height: 24px; }

.badge {
  padding: 5px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.badge.high { background: rgba(239, 68, 68, .14); color: #ff8f8f; border: 1px solid rgba(239, 68, 68, .4); }
.badge.med { background: rgba(234, 179, 8, .12); color: #ffd166; border: 1px solid rgba(234, 179, 8, .4); }

/* ---------- Матрица ---------- */
.matrix-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .matrix-grid { grid-template-columns: 1fr; } }

.matrix-wrap {
  overflow-x: auto; padding: 20px;
  background: #101828; border: 1px solid var(--line); border-radius: 18px;
}
table.matrix { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 560px; }
.matrix th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 6px 4px; text-align: center; vertical-align: bottom;
}
.matrix th span { display: block; font-size: 10.5px; font-weight: 500; color: #7c89a2; max-width: 92px; margin: 2px auto 0; }
.matrix th.axis { text-align: left; vertical-align: middle; max-width: 110px; }
.matrix td.cell {
  height: 54px; min-width: 54px;
  text-align: center; font-weight: 800; color: rgba(255, 255, 255, .88);
  border-radius: 8px; cursor: default;
  transition: transform .12s;
}
.matrix td.cell:hover { transform: scale(1.07); }
.cell.active { outline: 2px solid #fff; outline-offset: -2px; }

.lv-low  { background: rgba(34, 197, 94, .26); }
.lv-mid  { background: rgba(234, 179, 8, .30); }
.lv-high { background: rgba(249, 115, 22, .36); }
.lv-crit { background: rgba(239, 68, 68, .46); }
.dot.lv-low, .chip-dot.lv-low { background: var(--green); }
.dot.lv-mid, .chip-dot.lv-mid { background: var(--amber); }
.dot.lv-high, .chip-dot.lv-high { background: var(--orange); }
.dot.lv-crit, .chip-dot.lv-crit { background: var(--red); }

#scenario-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 999px;
  background: var(--panel); border: 1px solid #26344f;
  color: #dbe3f0; font: 600 13.5px 'Manrope', sans-serif;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.chip-btn:hover { border-color: var(--accent); }
.chip-btn.active { border-color: var(--accent); background: rgba(249, 115, 22, .14); }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; }

#matrix-result {
  margin-top: 20px; padding: 18px 20px; min-height: 88px;
  background: #101828; border: 1px solid #26344f; border-radius: 14px;
  font-size: 15px; line-height: 1.65;
}
.lvl { font-weight: 800; }
.lvl.lv-low { color: #7ee2a8; } .lvl.lv-mid { color: #ffd166; }
.lvl.lv-high { color: #ffab6b; } .lvl.lv-crit { color: #ff8080; }

/* ---------- Пирамида Бёрда ---------- */
.pyr-card h3 { font-size: 16px; margin-bottom: 16px; }
.pyr-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; margin: 10px auto;
  border-radius: 10px; font-weight: 700; color: #171207; font-size: 14px;
}
.pyr-row span { font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 19px; }
.pyr-1 { width: 46%; background: var(--red); color: #fff; }
.pyr-2 { width: 62%; background: var(--orange); }
.pyr-3 { width: 78%; background: var(--amber); }
.pyr-4 { width: 94%; background: #a3b118; }
.pyr-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* ---------- СИЗ ---------- */
.ppe-card .norm {
  display: inline-block; margin-top: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent-soft);
  background: rgba(249, 115, 22, .1); border: 1px solid rgba(249, 115, 22, .28);
  padding: 5px 11px; border-radius: 999px;
}

/* ---------- Организация ---------- */
.org-col h3 { font-size: 16px; margin: 0 0 14px; color: var(--accent-soft); }
.org-col li { display: flex; gap: 10px; margin: 11px 0; }
.org-col li .icon { color: var(--green); margin-top: 3px; }

/* ---------- Документы ---------- */
.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.docs li {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px;
}
.docs > li > .icon { color: var(--accent); margin-top: 3px; width: 20px; height: 20px; }
.docs strong { font-size: 15.5px; }
.docs p { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.docs .tag {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #9fb4d8; border: 1px solid #2c3c5c; background: rgba(22, 32, 52, .6);
  padding: 4px 11px; border-radius: 999px;
}
@media (max-width: 640px) { .docs li { flex-wrap: wrap; } .docs .tag { margin-left: 36px; } }

/* ---------- Чек-лист ---------- */
.progress-wrap { height: 10px; background: #162034; border-radius: 999px; overflow: hidden; margin: 0 0 10px; }
#progress-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--green));
  transition: width .3s;
}
#progress-text { font-size: 14px; margin: 0 0 20px; }
.check-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.check-list label {
  display: flex; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; cursor: pointer; transition: border-color .15s;
}
.check-list label:hover { border-color: #33507e; }
.check-list input { display: none; }
.check-list .box {
  width: 24px; height: 24px; min-width: 24px;
  border-radius: 7px; border: 2px solid #3a4a68;
  display: grid; place-items: center; color: transparent;
  transition: background .15s, border-color .15s;
}
.check-list .box .icon { width: 14px; height: 14px; stroke-width: 3.2; }
.check-list input:checked + .box { background: var(--green); border-color: var(--green); color: #08130b; }
.check-list input:checked ~ .txt { color: #93a1b8; }
.check-list .txt { font-size: 14.5px; }

/* ---------- Панель риска ---------- */
#panel {
  position: fixed; top: 88px; right: 20px; z-index: 90;
  width: min(432px, calc(100vw - 24px));
  max-height: calc(100vh - 110px); overflow: auto;
  background: rgba(13, 18, 29, .96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid #2c3c5c; border-radius: 20px; padding: 26px 26px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  transform: translateX(calc(100% + 48px));
  transition: transform .38s cubic-bezier(.22, .9, .3, 1);
}
#panel.open { transform: none; }
#panel-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #2c3c5c; background: #162034; color: #cdd6e4;
  font-size: 15px; cursor: pointer; transition: border-color .15s, color .15s;
}
#panel-close:hover { border-color: var(--accent); color: var(--accent-soft); }
#panel h3 { font-size: 20px; margin: 4px 0 14px; padding-right: 36px; }
#panel h4 {
  margin: 22px 0 8px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
#panel ul { list-style: none; margin: 0; padding: 0; }
#panel li { position: relative; padding-left: 18px; margin: 8px 0; font-size: 14.5px; line-height: 1.55; color: #cdd6e4; }
#panel li::before {
  content: ''; position: absolute; left: 0; top: 9px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
#panel-refs li::before { background: #6d84ad; }
.score-badge {
  display: inline-block; padding: 6px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 800;
}
.score-badge.lv-low { background: rgba(34, 197, 94, .12); color: #7ee2a8; }
.score-badge.lv-mid { background: rgba(234, 179, 8, .12); color: #ffd166; }
.score-badge.lv-high { background: rgba(249, 115, 22, .14); color: #ffab6b; }
.score-badge.lv-crit { background: rgba(239, 68, 68, .14); color: #ff8080; }

@media (max-width: 760px) {
  #panel {
    top: auto; bottom: 0; right: 0; left: 0;
    width: auto; max-height: 74vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(115%);
  }
  #panel.open { transform: none; }
}

/* ---------- Подсказка над маркером ---------- */
.tip {
  position: fixed; z-index: 95;
  transform: translate(-50%, -100%);
  background: rgba(10, 14, 22, .93);
  border: 1px solid #33466b; border-radius: 10px;
  color: var(--text); font: 600 13px 'Manrope', sans-serif;
  padding: 7px 12px; white-space: nowrap;
  pointer-events: none;
}

/* ---------- Футер ---------- */
footer { padding: 52px 0 68px; background: #0a0e15; border-top: 1px solid #1a2438; }
footer p { max-width: 920px; margin: 0; font-size: 14px; line-height: 1.65; }
footer .muted { font-size: 13px; margin-top: 12px; }

/* ---------- Прочее ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #24314e; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #2e3f63; }
