:root {
  --bg: #f4efe8;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fff9f2;
  --text: #221d1a;
  --muted: #6c625a;
  --line: rgba(75, 59, 52, 0.12);
  --accent: #d9683f;
  --accent-dark: #b84f2f;
  --teal: #176d67;
  --shadow: 0 18px 42px rgba(68, 42, 24, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --container: 1220px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 104, 63, 0.18), transparent 24%),
    radial-gradient(circle at 100% 24%, rgba(23, 109, 103, 0.14), transparent 24%),
    linear-gradient(180deg, #f7f1ea 0%, #f0e7dc 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.blog-shell {
  width: min(calc(100% - 2rem), var(--container));
  margin: 0 auto;
  padding-bottom: 3rem;
}

.blog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.blog-header::before {
  content: "";
  position: absolute;
  inset: 0 -1rem;
  background: rgba(247, 241, 234, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(80, 61, 51, 0.08);
  border-radius: 0 0 20px 20px;
  z-index: -1;
}

.blog-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.blog-brand__mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #f29356);
  color: #fffaf4;
  font-weight: 800;
}

.blog-brand__text {
  display: grid;
  gap: 0.14rem;
}

.blog-brand__text strong {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 1rem;
}

.blog-brand__text small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.blog-nav,
.blog-header__actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.blog-nav a {
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
}

.blog-nav a:hover,
.blog-nav a:focus-visible {
  background: rgba(255, 250, 244, 0.84);
  color: var(--text);
}

.accent-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.78rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.accent-button:hover,
.ghost-button:hover,
.accent-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-1px);
}

.accent-button {
  background: linear-gradient(135deg, var(--accent), #ef8351);
  color: #fffaf5;
  box-shadow: 0 16px 28px rgba(217, 104, 63, 0.22);
}

.ghost-button {
  border: 1px solid rgba(80, 61, 51, 0.12);
  background: rgba(255, 252, 247, 0.76);
  color: var(--text);
}

.accent-button--full {
  width: 100%;
}

.blog-main,
.admin-main {
  padding-top: 1.2rem;
}

.blog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 1.5rem;
  align-items: start;
}

.blog-hero__content,
.blog-hero__aside,
.filters,
.posts-section,
.article-view,
.auth-card,
.editor-card,
.posts-sidebar,
.admin-warning {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.blog-hero__content,
.filters,
.posts-section,
.article-view {
  padding: 1.8rem;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--teal);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
}

.blog-hero h1,
.section-caption h2,
.admin-topbar h2,
.auth-card h1,
.editor-card h3,
.posts-sidebar h3 {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1;
  letter-spacing: -0.04em;
}

.blog-hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  max-width: 10ch;
}

.blog-hero__lead,
.section-caption p:last-child,
.post-card p,
.featured-card p,
.article-card,
.auth-card p,
.admin-warning,
.form-hint {
  color: var(--muted);
  line-height: 1.7;
}

.blog-hero__lead {
  max-width: 40rem;
  margin: 1.2rem 0 0;
  font-size: 1.04rem;
}

.blog-hero__aside {
  padding: 1rem;
}

.featured-card {
  display: grid;
  gap: 1rem;
}

.featured-card__meta,
.post-card__meta,
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.featured-card__tag,
.post-card__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  background: rgba(23, 109, 103, 0.1);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.featured-card h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.3rem);
}

.featured-card__button,
.post-card__button,
.admin-post__button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--teal);
  font-weight: 700;
}

.section-caption {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.3rem;
}

.section-caption h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.78);
  border: 1px solid rgba(80, 61, 51, 0.1);
  color: var(--muted);
  font-weight: 700;
}

.chip.is-active {
  background: linear-gradient(135deg, var(--accent), #f08a57);
  color: #fffaf5;
  box-shadow: 0 12px 22px rgba(217, 104, 63, 0.18);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.post-card {
  display: grid;
  gap: 1rem;
  padding: 1.4rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid rgba(80, 61, 51, 0.1);
}

.post-card h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.18;
}

.article-card {
  min-height: 280px;
  padding: 1.6rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid rgba(80, 61, 51, 0.1);
}

.article-card h3 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.08;
}

.article-card__body {
  display: grid;
  gap: 1rem;
  margin-top: 1.4rem;
}

.article-card__body p {
  margin: 0;
}

.article-card__body h2,
.article-card__body h3,
.article-card__body h4 {
  margin: 0.4rem 0 -0.2rem;
  line-height: 1.25;
  color: var(--text);
}

.article-card__body h2 { font-size: clamp(1.4rem, 2vw, 1.8rem); }
.article-card__body h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
.article-card__body h4 { font-size: 1.1rem; }

.article-card__body ul,
.article-card__body ol {
  margin: 0;
  padding-left: 1.3rem;
  display: grid;
  gap: 0.35rem;
}

.article-card__body blockquote {
  margin: 0;
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(255, 232, 210, 0.45);
  border-radius: 0 12px 12px 0;
  color: rgba(44, 28, 13, 0.88);
  font-style: italic;
}

.article-card__body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-card__body a:hover,
.article-card__body a:focus-visible {
  text-decoration: none;
}

.article-card__body code {
  background: rgba(44, 28, 13, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  font-family: "Courier New", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.article-card__body pre {
  margin: 0;
  background: rgba(44, 28, 13, 0.07);
  padding: 0.9rem 1rem;
  border-radius: 12px;
  overflow-x: auto;
  font-family: "Courier New", Menlo, Consolas, monospace;
  font-size: 0.92em;
  line-height: 1.5;
}

.article-card__body hr {
  border: 0;
  height: 1px;
  background: rgba(80, 61, 51, 0.15);
  margin: 0.4rem 0;
}

.admin-main {
  display: grid;
  gap: 1rem;
}

.admin-auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 8rem);
}

.auth-card {
  width: min(100%, 580px);
  padding: 2rem;
}

.auth-form,
.editor-form {
  display: grid;
  gap: 1rem;
}

.auth-form label,
.editor-form label {
  display: grid;
  gap: 0.5rem;
}

.auth-form span,
.editor-form span {
  font-weight: 700;
}

.auth-form input,
.editor-form input,
.editor-form textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(80, 61, 51, 0.14);
  background: rgba(255, 251, 246, 0.98);
  padding: 0.92rem 1rem;
  color: var(--text);
}

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

.editor-switches {
  display: grid;
  gap: 0.8rem;
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 248, 241, 0.8);
  border: 1px solid rgba(80, 61, 51, 0.1);
}

.switch input {
  width: 1.1rem;
  height: 1.1rem;
}

.editor-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* ============ HTML-редактор ============ */
.editor-content {
  display: grid;
  gap: 0.5rem;
}

.editor-content__label {
  font-weight: 700;
}

.html-editor {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(80, 61, 51, 0.14);
  background: rgba(255, 251, 246, 0.98);
  overflow: hidden;
}

.html-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.6rem;
  background: rgba(255, 245, 233, 0.92);
  border-bottom: 1px solid rgba(80, 61, 51, 0.1);
}

.html-editor__btn {
  appearance: none;
  border: 1px solid rgba(80, 61, 51, 0.12);
  background: #fff;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.html-editor__btn:hover,
.html-editor__btn:focus-visible {
  background: rgba(255, 232, 210, 0.8);
  border-color: rgba(80, 61, 51, 0.22);
  outline: none;
  transform: translateY(-1px);
}

.html-editor__btn.is-active,
.html-editor__btn--mode.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.html-editor__btn--mode {
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
}

.html-editor__sep {
  width: 1px;
  height: 20px;
  background: rgba(80, 61, 51, 0.15);
  margin: 0 0.2rem;
}

.html-editor__spacer {
  flex: 1 1 auto;
}

.html-editor__area {
  min-height: 260px;
  max-height: 560px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  outline: none;
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
}

.html-editor__area:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(237, 125, 49, 0.35);
}

.html-editor__area.is-empty::before {
  content: attr(data-placeholder);
  color: rgba(80, 61, 51, 0.45);
  pointer-events: none;
  display: block;
}

.html-editor__area h2,
.html-editor__area h3,
.html-editor__area h4 {
  margin: 1.1em 0 0.5em;
  line-height: 1.25;
}

.html-editor__area h2 { font-size: 1.4rem; }
.html-editor__area h3 { font-size: 1.2rem; }
.html-editor__area h4 { font-size: 1.05rem; }

.html-editor__area p {
  margin: 0 0 0.9em;
}

.html-editor__area ul,
.html-editor__area ol {
  padding-left: 1.4em;
  margin: 0 0 0.9em;
}

.html-editor__area li {
  margin-bottom: 0.3em;
}

.html-editor__area blockquote {
  margin: 0.4em 0 0.9em;
  padding: 0.5em 0.9em;
  border-left: 3px solid var(--accent);
  background: rgba(255, 232, 210, 0.45);
  border-radius: 0 10px 10px 0;
  color: rgba(44, 28, 13, 0.85);
}

.html-editor__area a {
  color: var(--accent);
  text-decoration: underline;
}

.html-editor__area code {
  background: rgba(44, 28, 13, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 0.92em;
}

.html-editor__area pre {
  background: rgba(44, 28, 13, 0.07);
  padding: 0.8em 1em;
  border-radius: 10px;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.html-editor__source {
  min-height: 260px;
  max-height: 560px;
  width: 100%;
  padding: 1rem 1.1rem;
  border: none;
  outline: none;
  font-family: "Courier New", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: #fdf8f2;
  color: var(--text);
  resize: vertical;
  line-height: 1.55;
}

.html-editor__source:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(237, 125, 49, 0.35);
}
/* ============ /HTML-редактор ============ */

.admin-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-topbar__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-warning {
  padding: 1rem 1.2rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 1rem;
}

.editor-card,
.posts-sidebar {
  padding: 1.5rem;
}

.posts-sidebar {
  align-self: start;
}

.admin-posts {
  display: grid;
  gap: 0.8rem;
}

.admin-post {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid rgba(80, 61, 51, 0.1);
}

.admin-post h4 {
  margin: 0;
  font-size: 1rem;
}

.admin-post__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.admin-post__button {
  min-height: auto;
  padding: 0;
  background: none;
  border: 0;
}

.admin-post__button.is-danger {
  color: #b74d37;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill.is-published {
  background: rgba(23, 109, 103, 0.12);
  color: var(--teal);
}

.status-pill.is-draft {
  background: rgba(217, 104, 63, 0.12);
  color: var(--accent-dark);
}

@media (max-width: 1100px) {
  .blog-hero,
  .admin-layout,
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .blog-header {
    position: static;
    flex-wrap: wrap;
  }

  .blog-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .blog-nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 720px) {
  .blog-shell {
    width: min(calc(100% - 1.1rem), var(--container));
  }

  .blog-hero__content,
  .filters,
  .posts-section,
  .article-view,
  .auth-card,
  .editor-card,
  .posts-sidebar {
    padding: 1.2rem;
  }

  .blog-hero h1 {
    font-size: clamp(2rem, 10vw, 3rem);
    max-width: 100%;
  }

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

  .blog-header__actions,
  .editor-actions,
  .admin-topbar,
  .admin-topbar__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
