:root {
  --bg-body: #0f1115;
  --bg-card: #161b22;
  --bg-card-border: #30363d;
  --text-main: #c9d1d9;
  --text-header: #f0f6fc;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --warning-bg: rgba(210, 153, 34, 0.15);
  --warning-border: #d29922;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --container-pad-x: 36px;
  --container-pad-y: 36px;
  --page-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --page-exit-ms: 100ms;
  --page-enter-ms: 180ms;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html.page-from-nav .container {
  opacity: 0;
  transform: translateY(5px);
}

::selection {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent-hover);
}

body {
  background-color: var(--bg-body);
  background-image: radial-gradient(circle at 50% 0%, #1c212b 0%, var(--bg-body) 80%);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.6;
  padding: 20px;
  min-height: 100vh;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  align-self: stretch;
}

.sidebar-card {
  position: sticky;
  top: 20px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.75), rgba(22, 27, 34, 0.55));
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b949e;
  padding: 8px 10px 10px;
  -webkit-user-select: none;
  user-select: none;
}

.sidebar a {
  display: block;
  padding: 9px 10px 9px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-main);
  border: 1px solid transparent;
  overflow-wrap: anywhere;
  word-break: break-word;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.sidebar a:hover {
  color: var(--text-header);
  border-color: rgba(88, 166, 255, 0.35);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar a[aria-current="page"] {
  color: var(--text-header);
  border-color: transparent;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-indicator {
  position: absolute;
  width: 3px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.95);
  pointer-events: none;
  z-index: 1;
  will-change: top, height, opacity;
  transition: top 0.45s cubic-bezier(0.4, 0, 0.15, 1),
              height 0.3s cubic-bezier(0.4, 0, 0.15, 1),
              opacity 0.4s ease;
}

.container {
  flex: 1;
  min-width: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: var(--container-pad-y) var(--container-pad-x);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  position: relative;
}

.container.page-exit {
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity var(--page-exit-ms) var(--page-ease),
              transform var(--page-exit-ms) var(--page-ease);
  pointer-events: none;
}

.container.page-enter {
  animation: pageEnter var(--page-enter-ms) var(--page-ease) forwards;
}

.fade-in {
  animation: fadeIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

header {
  text-align: center;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--bg-card-border);
  padding-bottom: 18px;
  position: relative;
}

.header-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  column-gap: 10px;
  padding: 0;
}

.header-top .brand-name {
  margin-bottom: 0;
  grid-column: 2;
  justify-self: center;
}

.header-top .menu-toggle {
  grid-column: 1;
  justify-self: start;
  margin-left: 0;
}

/* If a browser extension/user stylesheet adds padding,
   this keeps the menu button aligned to content start. */
.header-top {
  justify-items: stretch;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  outline: none;
  user-select: none;
}

.menu-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.5);
}

.menu-toggle:focus-visible {
  border-color: rgba(88, 166, 255, 0.5);
}

.menu-icon {
  width: 18px;
  height: 12px;
  position: relative;
}

.menu-icon span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--text-header);
  opacity: 0.9;
}

.menu-icon span:nth-child(1) {
  top: 0;
}
.menu-icon span:nth-child(2) {
  top: 5px;
}
.menu-icon span:nth-child(3) {
  bottom: 0;
}

.brand-name {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
  display: block;
  text-shadow: 0 0 14px rgba(88, 166, 255, 0.4), 0 0 40px rgba(88, 166, 255, 0.12);
}

h1 {
  color: var(--text-header);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.doc-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.doc-meta span {
  white-space: nowrap;
}

.doc-meta .meta-right {
  margin-left: auto;
  text-align: right;
}

.header-actions {
  display: none;
}

.doc-tools {
  display: none;
}

.content h2 {
  color: var(--text-header);
  font-size: 1.4rem;
  margin-top: 26px;
  margin-bottom: 12px;
  border-left: 4px solid var(--accent);
  padding-left: 15px;
}

.content h3 {
  color: var(--text-header);
  font-size: 1.1rem;
  margin-top: 18px;
  margin-bottom: 10px;
}

.content p {
  margin-bottom: 12px;
  text-align: justify;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.content a:hover {
  color: var(--accent-hover);
  border-bottom-color: rgba(121, 192, 255, 0.7);
}

.content ul {
  list-style: none;
  margin: 10px 0 14px;
  padding-left: 20px;
}

.content li {
  margin-bottom: 8px;
  position: relative;
}

.content li::before {
  content: "•";
  color: var(--accent);
  font-weight: bold;
  position: absolute;
  left: -15px;
}

.note {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 10px;
  padding: 16px;
  margin: 18px 0;
}

.note-title {
  color: #e3b341;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.contacts {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--bg-card-border);
}

.contacts h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.contacts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 24px;
  align-items: baseline;
}

.contacts-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b949e;
  font-weight: 500;
}

.contacts-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: block;
  width: fit-content;
  border-bottom: 1px solid transparent;
  line-height: 1.2;
  word-break: break-all;
}

.contacts-link:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.contacts a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 140;
  will-change: transform, opacity;
  -webkit-user-select: none;
  user-select: none;
}

#backToTop.show {
  opacity: 1;
  pointer-events: auto;
}

#backToTop:hover {
  transform: scale(1.1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 150;
}

.menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

body.menu-open {
  overflow: hidden;
}

html.menu-open {
  overflow: hidden;
}

body.menu-open #backToTop {
  opacity: 0 !important;
  pointer-events: none !important;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.7);
  margin-bottom: 8px;
}

.sidebar-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-header);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
}

.sidebar-close:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.5);
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: min(360px, calc(100vw - 64px));
    z-index: 200;
    transform: translateX(-105%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-card {
    position: relative;
    top: 0;
    height: 100%;
    overflow: auto;
    animation: none;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .menu-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .menu-icon {
    width: 15px;
    height: 10px;
  }

  .menu-icon span:nth-child(2) {
    top: 4px;
  }
}

@media (max-width: 600px) {
  :root {
    --container-pad-x: 18px;
    --container-pad-y: 24px;
  }

  .doc-meta {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .doc-meta span {
    white-space: normal;
  }

  .doc-meta .meta-right {
    margin-left: 0;
    text-align: center;
  }

  body {
    padding: 10px;
  }

  .app {
    gap: 12px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .content h2 {
    font-size: 1.25rem;
    margin-top: 22px;
  }

  .content p {
    font-size: 0.95rem;
    text-align: left;
  }

  .contacts-grid {
    gap: 8px 15px;
  }

  #backToTop {
    width: 40px;
    height: 40px;
    bottom: 20px;
    right: 20px;
    font-size: 18px;
  }
}

@media (max-width: 400px) {
  .contacts-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .contacts-label {
    margin-top: 10px;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  html.page-from-nav .container {
    opacity: 1;
    transform: none;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
