:root {
  --bg: #111;
  --fg: #eee;
  --accent: #61dafb;
  --muted: #999;
  --accent-dimmed: #3fb0d6;
  --font-main: system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    height: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--fg);
}

body {
  display: flex;
  flex-direction: column;
}

header {
  padding: .5rem;
  background: #000;
  text-align: center;
}

header a:hover,
header a:focus {
  box-shadow: 0 8px 4px -4px rgba(255, 102, 0, 0.85);
  border-radius: 2px;
  transition: box-shadow 0.3s ease;
}

header.no-nav {
  border-bottom: 1px solid #333;
}

header > div {
  margin: 0;
  font-size: 1.75rem;
  color: var(--accent);
  line-height: .86;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  font-weight: bold;
}

header > div a {
  line-height: 0;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.3rem;
}

/* Make nav a flex container for items */
nav {
  padding: 1rem;
  background: #111;
  text-align: center;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Navigation label stays full width */
nav .nav-label {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  display: block;
}

/* This wrapper keeps all menu items together and wraps */
nav .menu-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem; /* adds space between items */
}

nav span {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  line-height: 1.2;
}

nav span.active {
  background-color: #333;
  border-radius: 4px;
  padding: 3px 5px;
}

nav span::before {
  content: '📋';
  color: #3fb0d6;
  padding-right: 0.25rem;
  font-size: 1rem;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  padding-bottom: 1px;
}

nav a:hover,
nav a:focus {
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  padding-bottom: 0;
}

#nav-toggle {
  all: unset; /* removes default button styles */
  color: var(--muted); /* or use var(--accent) if you prefer */
}

/* hide by default on small screens (optional) */
@media (max-width: 600px) {
  nav {
    align-items: stretch;
  }
  
  nav .menu-items {
    justify-content: start;
    flex-direction: column;
    gap: .5rem;
  }
  
  nav .nav-label {
    margin-bottom: 0;
  }
  
  nav.open .nav-label {
    margin-bottom: 0.8rem;
  }

  nav span {
    display: none;
  }

  nav.open span {
    display: flex;
  }
  
  #nav-toggle {
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    margin-right: 0.4rem;
    border: 1px solid var(--muted);
    border-radius: 0.3rem;
    background-color: rgba(255, 255, 255, 0.03);
    transition: background 0.2s ease, border 0.2s ease;
    color: var(--accent-dimmed);
  }

  #nav-toggle:hover,
  #nav-toggle:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
  }
}

main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1; /* главное — это тянет всё доступное пространство */
}

.section {
  margin-bottom: 3rem;
}

footer {
  padding: 1rem;
  text-align: center;
  border-top: 1px solid #333;
  font-size: 0.875rem;
  color: var(--muted);
}

.article-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.article-list li {
  margin: 1.5rem 0;
}

.article-list li::after {
  display: block;
  content: '';
  clear: left;
}

.article-list h3 {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  border-left: 2px solid var(--accent);
  padding-left: 0.5rem;
  line-height: 1.2;
}

.article-list a {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 1px;
}

.article-list a:hover,
.article-list a:focus {
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0;
}

.article-list p {
  color: var(--muted);
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
}
.article-list img {
  float: left;
  margin: 0 10px 10px 0;
  width: 75px;
}

@media (max-width: 500px) {
  .article-list img {
    width: 50px;
  }
}

/* Article */

.article {
  margin-bottom: 3rem;
}

.article a {
  color: #57d0f0;
  text-decoration: none;
}
.article a:hover,
.article a:focus {
  text-decoration: underline;
}

.article ul,
.article ol {
  padding-left: 1.1rem;
  color: #d0e6f6;
}

.article pre,
.article code {
  color: #e6f7ff;
}

.article code {
  background-color: #2A2A2A;
  display: inline-block;
  padding: .1rem;
  font-size: 0.9rem;
  border-radius: 2px;
}

.article pre {
  background-color: #191919;
  padding: .9rem;
  margin: .8rem 0;
  border: 1px solid rgba(95,160,190,0.12);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: keep-all;
}

.article pre code {
  font-size: 0.92rem;
  background: transparent;
  border-radius: none;
}

.meta {
  display: inline-block;
  padding: .25rem .5rem;
  border-radius: 6px;
  background: rgba(90,150,180,0.06);
  color: #9fd8f5;
  font-size: 0.98rem;
  margin-top: .25rem;
}

.note {
  margin: .8rem 0;
  padding: .6rem .85rem;
  background: rgba(95,160,190,0.06);
  border-left: 3px solid rgba(97,218,251,0.12);
  color: #cfefff;
  border-radius: 6px;
  font-size: 0.95rem;
}

.m1rem-top {
  margin-top: 1rem;
}

.back {
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.back a {
  color: #4a90e2;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}

.back a:hover,
.back a:focus {
  color: #1e73be;
}

.back a::before {
  content: "←";
  font-size: 1.1em;
  line-height: 1;
}

.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1rem;
    justify-content: center;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #222;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
}

.pagination a:hover,
.pagination a:focus {
    background: #444;
    color: #fff;
}

.pagination .active {
    background: #555;
    color: #fff;
    font-weight: bold;
    cursor: default;
}

.pagination .ellipsis {
    border: none;
    background: none;
    color: #777;
    font-weight: bold;
}

.pagination .ellipsis:hover,
.pagination .ellipsis:focus {
    background: #333;
    color: #fff;
    border-radius: 50%;
}

.pagination .prev,
.pagination .next {
    font-weight: bold;
}

@media (max-width: 500px) {
    .pagination a,
    .pagination span {
        padding: 4px 8px;
        font-size: 12px;
    }
}

footer a {
  color: #ff9800;
  text-decoration: none;
}

footer a:hover,
footer a:focus {
  text-decoration: underline;
}