/* ==========================================================================
   mama-blog.ru — базовые стили. Палитра «Персик и молоко».
   ========================================================================== */

/* ===================== Fonts ===================== */

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/onest-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/onest-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Токены: светлая тема */
:root,
[data-theme='light'] {
  --bg:           #FEF8F2;
  --bg-elev:      #FFFFFF;
  --text:         #2B2422;
  --text-muted:   #7A6B64;
  --accent:       #E08A76;
  --accent-soft:  #FBE1D6;
  --accent-ink:   #B15A47;
  --line:         #F0D9C9;
  --success:      #7DA982;
  --warning:      #D79B55;

  --shadow-sm: 0 1px 2px rgba(43, 36, 34, 0.06), 0 2px 8px rgba(43, 36, 34, 0.04);
  --shadow-md: 0 4px 16px rgba(43, 36, 34, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --container: 1100px;
  --container-narrow: 760px;

  --transition: 160ms ease;
}

/* Токены: тёмная тема (тёплая) */
[data-theme='dark'] {
  --bg:           #221B18;
  --bg-elev:      #2B221E;
  --text:         #F5E8DF;
  --text-muted:   #B59E91;
  --accent:       #F0A088;
  --accent-soft:  #3D2B23;
  --accent-ink:   #F5B59E;
  --line:         #3A2C25;
  --success:      #9BC79F;
  --warning:      #E5B479;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ===================== Reset / base ===================== */

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

html {
  font-family: Onest, 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 900px) {
  html { font-size: 19px; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background-color var(--transition), color var(--transition);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--transition);
}
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', 'PT Serif', Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

/* ===================== Layout ===================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
.container--narrow { max-width: var(--container-narrow); }

.accent { color: var(--accent-ink); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.main {
  flex: 1;
  padding-block: 24px;
}

/* ===================== Header ===================== */

.header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.1);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px;
}

.header__logo { display: inline-flex; line-height: 0; }
.header__logo img { height: 44px; width: auto; }

[data-theme='dark'] .header__logo img {
  filter: brightness(1.08) saturate(1.05);
}

.header__nav { display: flex; align-items: center; gap: 10px; }

/* ===================== Buttons ===================== */

.btn {
  appearance: none;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--accent-soft);
  color: var(--accent-ink);
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); }

.btn--icon {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn--icon:hover { background: var(--accent-soft); color: var(--accent-ink); }

.theme-toggle__icon { font-size: 18px; line-height: 1; }
.theme-toggle__icon--moon { display: none; }
[data-theme='dark'] .theme-toggle__icon--sun { display: none; }
[data-theme='dark'] .theme-toggle__icon--moon { display: inline; }

/* ===================== Hero ===================== */

.hero {
  padding-block: 32px 16px;
  max-width: var(--container-narrow);
}
.hero__title {
  margin-bottom: 16px;
}
.hero__lead {
  font-size: 1.08rem;
  color: var(--text);
  margin-bottom: 12px;
}
.hero__lead--muted { color: var(--text-muted); }

/* ===================== Sections ===================== */

.section-title {
  font-size: 1.4rem;
  margin-block: 24px 16px;
}

.feed__empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

/* ===================== Breadcrumbs ===================== */

.breadcrumbs { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 12px; }
.breadcrumbs__list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.breadcrumbs__list li + li::before {
  content: '›';
  margin-right: 6px;
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-ink); }
.breadcrumbs [aria-current='page'] span { color: var(--text); }

/* ===================== Feed (главная и страница тега) ===================== */

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

.article-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-soft);
}
.article-card__link {
  display: grid;
  grid-template-columns: 1fr;
  text-decoration: none;
  color: inherit;
}
@media (min-width: 700px) {
  .article-card__link { grid-template-columns: 220px 1fr; }
}
.article-card__cover img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/10; }
.article-card__body { padding: 18px 20px; }
.article-card__title {
  font-size: 1.25rem;
  margin: 0 0 8px;
}
.article-card__desc { color: var(--text-muted); margin: 0 0 10px; }
.article-card__meta { color: var(--text-muted); font-size: 0.88rem; margin: 0; display: flex; gap: 8px; }

/* ===================== Article ===================== */

.article { padding-block: 16px 32px; }

.article__header { margin-bottom: 18px; }
.article__title { margin-bottom: 14px; }

.article__meta {
  display: flex; flex-wrap: wrap; gap: 8px 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 12px;
}
.article__author { color: var(--text); font-weight: 500; }
.article__dot { color: var(--line); }
.article__modified em { font-style: normal; }

.article__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background-color var(--transition), color var(--transition);
}
.tag:hover { background: var(--accent); color: #fff; }
.tag::before { content: '#'; opacity: 0.6; margin-right: 1px; }

.article__cover { margin: 8px 0 24px; }
.article__cover img { border-radius: var(--radius-md); width: 100%; height: auto; }

/* Тело статьи: типография */
.article__body { font-size: 1.04rem; line-height: 1.7; }
.article__body p { margin: 0 0 1.1em; }
.article__body h2 { margin-top: 1.6em; }
.article__body h3 { margin-top: 1.3em; }
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.article__body li { margin-bottom: 0.4em; }
.article__body blockquote {
  margin: 1.4em 0;
  padding: 8px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}
.article__body code {
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.92em;
}
.article__body pre {
  background: var(--accent-soft);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.article__body a { word-break: break-word; }
.article__body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

.article-figure { margin: 1.6em 0; }
.article-figure img { border-radius: var(--radius-md); }
.article-figure__caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.heading-anchor { color: transparent; }
.article__body h2:hover .heading-anchor,
.article__body h3:hover .heading-anchor { color: var(--accent); margin-left: 6px; text-decoration: none; }

/* TOC */
.article-toc__list-wrap, .article__body > ol.article-toc__list-wrap {
  margin: 0 0 24px;
  padding: 16px 22px 16px 38px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.article-toc__list-wrap a { color: var(--text); text-decoration: none; }
.article-toc__list-wrap a:hover { color: var(--accent-ink); text-decoration: underline; }
.article-toc__list-wrap li { margin-bottom: 4px; }
.article-toc__list-wrap ol ol { padding-left: 18px; margin-top: 4px; }

/* Источники */
.article__sources {
  margin: 32px 0 8px;
  padding: 18px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.article__sources-title { font-size: 1.1rem; margin: 0 0 8px; }
.article__sources-list { padding-left: 1.3em; margin: 0; }
.article__sources-list li { margin-bottom: 4px; color: var(--text-muted); }
.article__sources-list a { color: var(--accent-ink); }

/* Сноски (footnote-плагин) */
.footnotes { font-size: 0.9rem; color: var(--text-muted); border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.footnotes ol { padding-left: 1.4em; }

/* Лайк статьи */
.article__like {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 0 12px;
}
.btn--like {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
.btn--like:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.btn--like[aria-pressed='true'] { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--like span:first-child { font-size: 1.1em; }
.article__like-hint { color: var(--text-muted); font-size: 0.9rem; }

/* Врезки */
.md-tip, .md-important, .md-warning {
  margin: 1.4em 0;
  padding: 14px 18px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.md-tip { background: rgba(125, 169, 130, 0.10); border-color: rgba(125, 169, 130, 0.35); }
.md-tip__title { color: var(--success); font-weight: 600; margin-bottom: 4px; }

.md-important { background: var(--accent-soft); border-color: var(--accent); }
.md-important__title { color: var(--accent-ink); font-weight: 600; margin-bottom: 4px; }

.md-warning { background: rgba(215, 155, 85, 0.12); border-color: rgba(215, 155, 85, 0.45); }
.md-warning__title { color: var(--warning); font-weight: 600; margin-bottom: 4px; }

.md-tip__body p:last-child,
.md-important__body p:last-child,
.md-warning__body p:last-child { margin-bottom: 0; }

/* Об авторе */
.author-bio {
  display: flex; gap: 16px; align-items: flex-start;
  margin: 28px 0;
  padding: 18px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.author-bio__avatar { flex: 0 0 auto; line-height: 0; }
.author-bio__avatar img { width: 72px; height: 72px; border-radius: 50%; }
.author-bio__name { margin: 0 0 6px; font-weight: 600; font-size: 1.05rem; }
.author-bio__name a { color: var(--text); text-decoration: none; }
.author-bio__name a:hover { color: var(--accent-ink); }
.author-bio__text { margin: 0; color: var(--text-muted); font-size: 0.97rem; }
.author-bio__text a { color: var(--accent-ink); white-space: nowrap; }

/* Читайте также */
.article__related { margin-top: 36px; }
.article__related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 700px) {
  .article__related-list { grid-template-columns: 1fr 1fr; }
}
.related-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.related-card__link { display: grid; grid-template-columns: 100px 1fr; text-decoration: none; color: inherit; gap: 0; }
.related-card__cover img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1/1; }
.related-card__body { padding: 12px 14px; }
.related-card__title { font-size: 1rem; margin: 0 0 6px; font-family: inherit; font-weight: 600; line-height: 1.3; }
.related-card__desc { font-size: 0.88rem; color: var(--text-muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Заглушка комментариев */
.article__comments { margin-top: 36px; }
.article__comments-placeholder {
  color: var(--text-muted);
  font-style: italic;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

/* ===================== Article CTA ===================== */

.article-cta {
  margin: 36px 0 24px;
  padding: 20px 22px;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.article-cta__text {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
}

.link-like {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-like:hover { color: var(--accent); }

/* ===================== Footer ===================== */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  padding-block: 28px;
  margin-top: 48px;
}
.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.footer__tagline { color: var(--text); margin: 0; }
.footer__nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer__nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer__nav a:hover { color: var(--accent-ink); }
.footer__copy { color: var(--text-muted); font-size: 0.9em; margin: 0; }

/* ===================== Accessibility ===================== */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
