/* =========================================================
   НТТЭК PKI — shared stylesheet
   Supports: light / dark (data-theme="dark" on <html>)
   ========================================================= */

/* ---- Tokens ---- */
:root {
  --bg:          #ffffff;
  --bg-subtle:   #f8f9fa;
  --border:      #e0e0e0;
  --text:        #1a1a1a;
  --text-muted:  #616161;
  --link:        #1a56db;
  --link-hover:  #1341b0;
  --accent:      #1a4fa0;
  --code-bg:     #f3f4f6;
  --notice-bg:   #fffbeb;
  --notice-border: #fbbf24;
  --notice-text: #78350f;
  --badge-bg:    #e5e7eb;
  --badge-text:  #374151;
  --shadow:      0 1px 3px rgba(0,0,0,.08);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --radius: 6px;
  --max-w:  860px;
}

[data-theme="dark"] {
  --bg:          #121212;
  --bg-subtle:   #1e1e1e;
  --border:      #2e2e2e;
  --text:        #e8e8e8;
  --text-muted:  #9e9e9e;
  --link:        #7aadff;
  --link-hover:  #a3c4ff;
  --accent:      #5b8dee;
  --code-bg:     #1e1e1e;
  --notice-bg:   #2a1f00;
  --notice-border:#ca8a04;
  --notice-text: #fde68a;
  --badge-bg:    #2e2e2e;
  --badge-text:  #d4d4d4;
  --shadow:      0 1px 3px rgba(0,0,0,.4);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background .2s, color .2s;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; color: var(--link-hover); }
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Layout ---- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background .2s, border-color .2s;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo:hover { text-decoration: none; color: var(--text); }

.header-logo img {
  height: 28px;
  width: auto;
}

/* логотип не инвертируется — цвет сохраняется в обеих темах */

.header-logo-name {
  font-size: .9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-sep {
  color: var(--border);
  font-size: 1.1rem;
  user-select: none;
  flex-shrink: 0;
}

.header-page {
  font-size: .875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-spacer { flex: 1; }

/* ---- Theme toggle ---- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Show correct icon — используем .theme-toggle .icon-* для перекрытия svg { display: block } */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Hero ---- */
.hero {
  padding: 64px 0 52px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 44px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.btn-filled {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-filled:hover { filter: brightness(1.1); color: #fff; }

.btn-outlined {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}
.btn-outlined:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

/* ---- Notice ---- */
.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .875rem;
  color: var(--notice-text);
  line-height: 1.55;
  margin-bottom: 8px;
}

/* ---- Content sections ---- */
.section {
  padding: 36px 0;
  border-top: 1px solid var(--border);
}

.section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 20px;
}

/* ---- Definition table ---- */
.def-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
}

.def-table tr { border-bottom: 1px solid var(--border); }
.def-table tr:last-child { border-bottom: none; }

.def-table td {
  padding: 10px 0;
  vertical-align: top;
  line-height: 1.5;
}

.def-table td:first-child {
  width: 42%;
  font-weight: 500;
  color: var(--text);
  padding-right: 20px;
  white-space: nowrap;
}

.def-table td:last-child {
  color: var(--text-muted);
  word-break: break-all;
}

/* ---- Extensions list ---- */
.ext-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.ext-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9375rem;
  align-items: baseline;
}

.ext-item:last-child { border-bottom: none; }

.ext-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ext-desc { color: var(--text-muted); line-height: 1.5; }

/* ---- Badge ---- */
.badge {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--badge-bg);
  color: var(--badge-text);
  vertical-align: middle;
  white-space: nowrap;
}

.badge-crit {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .badge-crit {
  background: #3b0f0f;
  color: #fca5a5;
}

/* ---- Code / pre ---- */
code {
  font-family: var(--font-mono);
  font-size: .8125rem;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text);
}

pre {
  font-family: var(--font-mono);
  font-size: .8125rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  margin-top: 10px;
  color: var(--text);
}

/* ---- Copy button ---- */
.pre-wrapper {
  position: relative;
  margin-top: 10px;
}

.pre-wrapper pre {
  margin-top: 0;
  padding-right: 40px;
}

.copy-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}

.pre-wrapper:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.copy-btn.copied {
  color: #16a34a;
  opacity: 1;
}

/* ---- Install grid ---- */
.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 8px;
}

.install-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .2s;
}

.install-card:hover { border-color: var(--text-muted); }

.install-card h3 {
  font-size: .9375rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.install-card p {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  margin-top: 56px;
  transition: border-color .2s;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: .8125rem;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--link); text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero { padding: 44px 0 36px; }

  .header-page { display: none; }
  .header-sep  { display: none; }

  .def-table td:first-child {
    width: 38%;
    white-space: normal;
    font-size: .875rem;
  }

  .def-table td:last-child {
    font-size: .875rem;
  }

  .ext-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
