:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #111827;
  --muted: #94a3b8;
  --text: #e2e8f0;
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --border: #1f2937;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Manrope", "Inter", system-ui, -apple-system, sans-serif;
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(168, 85, 247, 0.1), transparent 35%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-2);
}

.container {
  width: min(1100px, 90vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.75);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
  color: #fff;
  transition: color 0.2s ease;
}

.brand:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow);
}

.nav-toggle-icon {
  display: inline-block;
  width: 100%;
  text-align: center;
  font-size: 16px;
  line-height: 1;
  color: #0b1224;
  font-weight: 800;
}

.nav a {
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav a:hover {
  background: rgba(56, 189, 248, 0.1);
}

.nav .cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav .cta,
.nav .all-posts-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.nav .cta:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  transform: translateY(-1px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hero {
  padding: 8px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 10px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
}

h2 {
  margin: 6px 0;
}

.lede {
  color: var(--muted);
  max-width: 620px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding-bottom: 32px;
}

.card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow);
}

.card h2 a {
  color: #fff;
}

.card h2 a:hover {
  color: var(--accent);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 6px;
}

.excerpt {
  color: var(--muted);
  line-height: 1.5;
}

.intro {
  color: #e2e8f0;
  font-weight: 600;
}

.intro-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #e2e8f0;
  margin: 4px 0 16px;
  font-weight: 400;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--accent);
}

.inline-link:hover {
  color: var(--accent);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 24px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.page-btn:visited {
  color: #0b1224;
}

.page-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.page-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1224;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.page-btn.disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
  color: #0b1224;
}

.page-info {
  color: var(--muted);
  font-weight: 700;
}

.article {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px 0 32px;
  box-shadow: var(--shadow);
}

.article h1 {
  margin: 6px 0 12px;
}

.article-body {
  line-height: 1.7;
  color: #e2e8f0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  margin: 12px 0;
}

.article-body figure.md-image {
  margin: 16px 0;
  text-align: center;
}

.article-body figure.md-image img {
  margin: 0 auto;
}

.article-body figure.md-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 24px;
}

.article-body h1::before,
.article-body h2::before,
.article-body h3::before,
.article-body h4::before,
.article-body h5::before,
.article-body h6::before {
  content: "# ";
  display: inline-block;
  background: linear-gradient(135deg, #38bdf8 15%, #60a5fa 50%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.article-body code {
  background: #0b1224;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.article-body pre {
  background: #0b1224;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
}

.back-link {
  margin-top: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 32px;
}

.admin-grid.single-col {
  grid-template-columns: 1fr;
}

.content-card textarea {
  min-height: 240px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 12px;
}

input,
textarea {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1224;
  color: #e5e7eb;
  font-size: 1rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
  overflow-y: hidden;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b1224;
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease;
}

button.primary:hover {
  transform: translateY(-1px);
}

.secondary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b1224;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.button-row .primary,
.button-row .secondary {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 800;
  min-height: 44px;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.form-card .hint {
  color: var(--muted);
  min-height: 20px;
  margin: 6px 0 0;
}

.form-card .hint.error {
  color: #fca5a5;
}

.slug-preview {
  margin: 0 0 12px;
}

.slug-preview code {
  background: #0b1224;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: #e2e8f0;
}

.preview-card {
  min-height: 300px;
}

.preview-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.preview-modal-content {
  position: relative;
  background: #0b1224;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  width: min(900px, 90vw);
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.preview-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-body {
  background: transparent;
}

.upload-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}

.upload-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

.upload-label input {
  padding: 8px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.post-list .post-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.title-link {
  color: #fff;
  transition: color 0.2s ease;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

.title-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.title-link strong {
  color: inherit;
  font-weight: inherit;
}

.title-link:hover strong {
  color: var(--accent);
}

.list-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.12);
  color: var(--text);
}

.icon-link.publish {
  color: #fff;
}

.icon-link.publish:hover {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent);
}

.edit-icon {
  font-size: 16px;
  line-height: 1;
}

.icon-link.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--text);
}

.icon-link.danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: var(--text);
}

.danger.filled {
  background: transparent;
  border: 1px solid #f43f5e;
  color: #f43f5e;
  font-weight: 800;
}

.danger.filled:hover {
  background: rgba(244, 63, 94, 0.15);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.telegram-link {
  color: var(--text);
  display: inline-flex;
  align-items: center;
}

.telegram-link:hover {
  color: var(--accent);
}

.social-link {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
}

.social-link:hover {
  color: var(--accent);
}

.footer-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text);
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-top: 10px;
    position: absolute;
    top: 100%;
    left: 0;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    width: 100%;
    padding: 10px 12px;
    text-align: center;
  }

  .nav .cta {
    text-align: center;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (min-width: 641px) {
  .nav-toggle {
    display: none !important;
  }
}
