:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --header: #ffffff;
  --header-text: #111827;
  --blue: #0b2f55;
  --blue-2: #0f4c81;
  --blue-3: #2563eb;
  --danger: #b42318;
  --shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  --bg: #050b14;
  --bg-soft: #071426;
  --panel: #0b1829;
  --text: #f8fafc;
  --muted: #9aa8bc;
  --line: rgba(226, 232, 240, 0.13);
  --header: rgba(5, 11, 20, 0.94);
  --header-text: #f8fafc;
  --blue: #071d38;
  --blue-2: #0f4c81;
  --blue-3: #60a5fa;
  --danger: #ff8a80;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Arial, sans-serif;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 16% 0%, rgba(96, 165, 250, 0.08), transparent 360px),
    linear-gradient(180deg, #050b14, #071426);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.topbar,
.editor-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 72px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header);
  color: var(--header-text);
  border-bottom: 1px solid var(--line);
}

.menu-title {
  font-weight: 800;
  text-decoration: none;
  color: var(--header-text);
}

.nav,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  text-decoration: none;
  color: var(--header-text);
  padding: 10px 12px;
  border-radius: 10px;
}

.nav a:hover {
  background: rgba(37, 99, 235, 0.08);
}

html[data-theme="dark"] .nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle,
.ghost-btn,
.publish-btn,
.login-card button {
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: var(--panel);
  color: var(--text);
}

.theme-toggle {
  width: 42px;
  height: 42px;
}

.ghost-btn,
.publish-btn {
  padding: 11px 16px;
}

.publish-btn,
.login-card button[type="submit"] {
  border-color: transparent;
  color: #fff;
  background: var(--blue-2);
}

.home-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 20px 34px;
  min-height: 430px;
  display: grid;
  grid-template-columns: 1fr 360px;
  align-items: center;
  gap: 60px;
}

.hero-title {
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-title div {
  font: inherit;
  color: var(--text);
}

.floating-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.floating-logo {
  width: min(320px, 70vw);
  height: auto;
  background: transparent;
  filter: drop-shadow(0 22px 28px rgba(15, 23, 42, 0.16));
  animation: logoFloat 4.8s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(-10px);
  }
  50% {
    transform: translateY(14px);
  }
}

.leaders-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 70px;
}

.leaders-section h1 {
  margin: 0 0 24px;
  font-size: clamp(28px, 3.8vw, 42px);
  letter-spacing: -0.03em;
}

.leaders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.leader-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 22px;
  align-items: center;
}

.leader-card img {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: 18px;
}

.leader-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.18;
}

.leader-card p {
  margin: 0;
  color: var(--muted);
}

.leader-links {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.leader-links a,
.footer a {
  color: var(--blue-3);
  text-decoration: none;
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 46px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.articles-page {
  width: 100%;
  padding: 42px max(20px, calc((100vw - 1180px) / 2)) 80px;
}

.articles-heading h1 {
  margin: 0 0 28px;
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -0.05em;
}

.article-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 0;
  padding: clamp(28px, 5vw, 64px);
  margin-bottom: 46px;
}

.article-card header {
  margin-bottom: 34px;
}

.article-card h1 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.article-card address {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-style: normal;
}

.article-content,
.story-editor {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  line-height: 1.66;
}

.article-content p,
.story-editor p {
  margin: 0 0 20px;
}

.article-content h2,
.story-editor h2 {
  font-size: 34px;
  line-height: 1.18;
  margin: 36px 0 15px;
}

.article-content h3,
.story-editor h3 {
  font-size: 26px;
  line-height: 1.25;
  margin: 30px 0 13px;
}

.article-content blockquote,
.story-editor blockquote {
  margin: 26px 0;
  padding: 8px 0 8px 22px;
  border-left: 4px solid var(--line);
  color: var(--muted);
  font-style: italic;
}

.article-content figure,
.story-editor figure {
  margin: 30px auto;
  width: min(680px, 100%);
}

.article-content img,
.story-editor img {
  width: 100%;
  max-width: 680px;
  display: block;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.article-content figcaption,
.story-editor figcaption {
  min-height: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 36px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-soft);
}

html[data-theme="dark"] .login-body {
  background:
    radial-gradient(circle at 16% 0%, rgba(96, 165, 250, 0.08), transparent 360px),
    linear-gradient(180deg, #050b14, #071426);
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.login-theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
}

.login-logo-img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  margin-bottom: 16px;
}

.login-card h1 {
  margin: 0 0 18px;
}

.login-card label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 13px 16px;
}

.login-error {
  color: var(--danger);
  margin-bottom: 14px;
}

.editor-shell {
  min-height: 100vh;
}

.editor-main {
  width: 100%;
  padding: 48px max(20px, calc((100vw - 1180px) / 2)) 100px;
  position: relative;
}

.editor-paper {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 64px);
}

.title-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.055em;
  margin-bottom: 12px;
}

.title-input::placeholder,
.story-editor:empty::before {
  color: color-mix(in srgb, var(--muted) 58%, transparent);
}

.meta-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  margin-bottom: 34px;
  font-size: 17px;
}

.meta-edit-row input {
  width: 112px;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  background: transparent;
  color: var(--muted);
  padding: 2px 0;
}

.story-editor {
  min-height: 520px;
  outline: none;
}

.story-editor:empty::before {
  content: attr(data-placeholder);
  pointer-events: none;
}

.floating-toolbar {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px;
  border-radius: 12px;
  background: #071426;
  box-shadow: 0 20px 50px rgba(0,0,0,.34);
  border: 1px solid rgba(255,255,255,.12);
}

.floating-toolbar button {
  width: 36px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.floating-toolbar button:hover {
  background: rgba(255,255,255,.12);
}

.floating-toolbar span {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: rgba(255,255,255,.18);
}

.image-plus {
  position: fixed;
  left: max(16px, calc((100vw - 1240px) / 2));
  top: 210px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--blue-3);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .topbar,
  .editor-topbar {
    padding: 0 14px;
  }

  .editor-nav {
    display: none;
  }

  .home-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 32px;
  }

  .hero-title {
    font-size: clamp(28px, 8vw, 42px);
  }

  .floating-logo-wrap {
    justify-content: flex-start;
  }

  .floating-logo {
    width: min(260px, 70vw);
  }

  .leaders-grid {
    grid-template-columns: 1fr;
  }

  .leader-card {
    grid-template-columns: 110px 1fr;
  }

  .leader-card img {
    width: 110px;
    height: 110px;
  }

  .articles-page,
  .editor-main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .article-card,
  .editor-paper {
    padding: 24px 18px;
  }

  .article-content,
  .story-editor {
    font-size: 19px;
  }

  .image-plus {
    top: auto;
    bottom: 22px;
    left: 16px;
  }
}


.floating-toolbar button.active {
  background: rgba(255,255,255,.22);
}


/* Постоянная нижняя панель редактора */
.floating-toolbar.toolbar-bottom {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: 24px !important;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
}

.floating-toolbar.toolbar-bottom[hidden] {
  display: flex !important;
}

.floating-toolbar button.active {
  background: rgba(255,255,255,.24);
}


.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 34px 0 10px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .18s ease, opacity .18s ease;
}

.page-btn:hover {
  transform: translateY(-2px);
}

.page-btn.disabled {
  opacity: .38;
  pointer-events: none;
}

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