/*
Theme Name: PlantMap
Theme URI: https://plantmap.ru
Author: PlantMap
Description: Тема блога PlantMap — Мой сад. Botanical-editorial: Alegreya для заголовков, тёплая зелёная палитра.
Version: 1.0.0
*/

/* Шрифты приложения лежат на том же домене — грузим их напрямую, без внешних CDN. */
@font-face {
  font-family: "Alegreya";
  src: url("/fonts/Alegreya-Variable.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/Manrope-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/Manrope-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Токены взяты из .landingPage в apps/web/src/index.css — блог и приложение
   должны читаться как один продукт. */
:root {
  --primary: #1c8a4c;
  --primary-dark: #156b3a;
  --primary-light: #2eb274;
  --warm-yellow: #d9a441;
  --soft-pink: #e7eee1;
  --pink-400: #156b3a;
  --clay: #c2683d;
  --gray-900: #16231b;
  --gray-600: #5e6b5c;
  --gray-500: #6b7a68;
  --gray-400: #94a191;
  --gray-100: #e6decb;
  --paper: #f9f7f1;

  /* Утилиты Tailwind в assets/chrome.css ссылаются на эти переменные —
     переопределяем их здесь, чтобы не пересобирать чужой билд. style.css
     подключается ПОСЛЕ chrome.css (см. functions.php), поэтому перебивает. */
  --color-primary: #1c8a4c;
  --color-primary-dark: #156b3a;
  --color-soft-pink: #e7eee1;
  --color-warm-yellow: #d9a441;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--gray-900);
  background: #fff;
  line-height: 1.6;
}
/* Заголовки — Alegreya, как в приложении (--font-display). */
h1, h2, h3, h4 { font-family: "Alegreya", Georgia, "Times New Roman", serif; }
a { text-decoration: none; color: inherit; }
/* Purple + hover-underline applies ONLY to article-body links (.pm-content).
   Header/footer/cards must inherit their own (Tailwind) colors like the React site —
   a global `a{color}`/`a:hover{underline}` made footer links purple and underlined the
   whole article card on hover. */
.pm-content a { color: var(--primary); }
.pm-content a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.pm-container { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }

/* Header */
.pm-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(249, 247, 241, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-100);
}
.pm-header-inner {
  max-width: 64rem; margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.pm-brand { display: flex; align-items: center; gap: .5rem; }
.pm-brand img { height: 2.5rem; }
.pm-brand-name {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 900; font-size: 20px; letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--primary), var(--pink-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pm-nav { display: flex; align-items: center; gap: 1.25rem; }
.pm-nav a { font-size: .875rem; font-weight: 600; color: var(--gray-600); }
.pm-cta-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border-radius: .75rem; padding: .85rem 1.6rem;
  background: var(--primary);
  color: #fff !important; font-size: .9375rem; font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(28,138,76,.22); text-decoration: none !important;
}
.pm-cta-btn:hover { background: var(--primary-dark); }
.pm-accent-stripe { height: 3px; width: 100%;
  background: linear-gradient(to right, var(--primary), var(--soft-pink), var(--warm-yellow)); }
@media (max-width: 640px) { .pm-nav a:not(.pm-cta-btn) { display: none; } }

/* Article */
.pm-article { max-width: 48rem; margin: 0 auto; padding: 3rem 1rem; }
.pm-article-meta { display: flex; gap: .75rem; font-size: .75rem; color: var(--gray-400); margin-bottom: 1rem; align-items: center; }
.pm-badge { border-radius: 9999px; background: #f1f6ee; color: var(--primary); font-weight: 500; padding: .125rem .5rem; }
.pm-article h1 { font-size: 2.25rem; font-weight: 800; line-height: 1.15; margin: 0 0 1.5rem; }
.pm-hero { width: 100%; max-height: 400px; object-fit: cover; border-radius: 1rem; margin-bottom: 2rem; }
.pm-toc { border: 1px solid var(--gray-100); background: rgba(249,250,251,.5); border-radius: 1rem; padding: 1.25rem; margin-bottom: 2.5rem; }
.pm-toc h2 { font-size: .875rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin: 0 0 .75rem; }
.pm-toc ol { margin: 0; padding-left: 1.25rem; }
.pm-toc a { color: var(--gray-600); font-size: .875rem; }
.pm-content h2 { font-size: 1.5rem; font-weight: 700; margin: 3rem 0 1.25rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100); }
.pm-content h3 { font-size: 1.125rem; font-weight: 600; margin: 2rem 0 .75rem; }
.pm-content p, .pm-content li { color: var(--gray-600); }
.pm-content img { border-radius: .75rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin: 1.5rem 0; }
.pm-content table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.pm-content th { background: var(--paper); text-align: left; padding: .75rem; }
.pm-content td { padding: .75rem; border-top: 1px solid var(--gray-100); }
.pm-content details { margin: .75rem 0; }
.pm-content summary { font-weight: 600; cursor: pointer; }

/* Related */
.pm-related { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--gray-100); }
.pm-related h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; }
.pm-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pm-grid { grid-template-columns: repeat(3, 1fr); } }
.pm-card { overflow: hidden; border: 1px solid var(--gray-100); border-radius: 1rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.pm-card img { height: 9rem; width: 100%; object-fit: cover; }
.pm-card-body { padding: 1rem; }
.pm-card-cat { font-size: .75rem; color: var(--primary); font-weight: 500; }
.pm-card h4 { font-size: .875rem; font-weight: 700; margin: .25rem 0 0; }
.pm-card h2, .pm-card h4 { color: var(--gray-900); transition: color .15s; }
.pm-card:hover h2, .pm-card:hover h4 { color: var(--primary); }

/* Archive */
.pm-archive { max-width: 56rem; margin: 0 auto; padding: 4rem 1rem; }
.pm-archive-title { text-align: center; font-size: 1.875rem; font-weight: 700; margin-bottom: .75rem; }
.pm-archive-sub { text-align: center; color: var(--gray-500); margin-bottom: 3rem; }
.pm-archive .pm-main > .pm-grid { grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .pm-archive .pm-main > .pm-grid { grid-template-columns: repeat(2, 1fr); } }
.pm-archive .pm-card img { height: 11rem; }
.pm-archive .pm-card-body { padding: 1.5rem; }
.pm-archive .pm-card h2 { font-size: 1.125rem; font-weight: 700; margin: .5rem 0; }
.pm-archive .pm-card p { font-size: .875rem; color: var(--gray-500); margin: 0; }

/* Pagination (archive) — pill buttons matching brand */
.pagination { margin-top: 3rem; }
.pagination .screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.pagination .nav-links {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem;
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.625rem; height: 2.625rem; padding: 0 .625rem;
  border-radius: 12px; border: 1px solid var(--gray-100); background: #fff;
  color: var(--gray-600); font-size: .95rem; font-weight: 600; line-height: 1;
  transition: background-color .15s, border-color .15s, color .15s;
}
.pagination a.page-numbers:hover { background: #f1f6ee; border-color: #dfe9d8; color: var(--primary); }
.pagination .page-numbers.current {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 6px 12px -3px rgba(139, 92, 246, .35);
}
.pagination .page-numbers.prev,
.pagination .page-numbers.next { font-size: 1.375rem; color: var(--gray-500); }
.pagination .page-numbers.dots { border-color: transparent; background: transparent; color: var(--gray-400); }

/* Footer */
.pm-footer { border-top: 1px solid var(--gray-100); background: var(--paper); padding: 2.5rem 1rem; }
.pm-footer-inner { max-width: 64rem; margin: 0 auto; }
.pm-footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; margin-bottom: 2rem; }
@media (min-width: 768px) { .pm-footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .pm-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.pm-footer-logo { font-family: "Alegreya", Georgia, serif; font-size: 1.125rem; font-weight: 700; color: var(--gray-900); display: inline-block; margin-bottom: .5rem; }
.pm-footer-tagline { font-weight: 600; color: var(--primary-dark); margin: 0 0 .35rem; font-size: .95rem; }
.pm-footer-desc { font-size: .875rem; color: var(--gray-600); margin: 0; line-height: 1.55; }
.pm-footer-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); margin: 0 0 .75rem; }
.pm-footer-nav a { display: block; color: var(--gray-600); font-size: .875rem; padding: .125rem 0; }
.pm-footer-nav a:hover { color: var(--primary); }
.pm-footer-bottom { border-top: 1px solid var(--gray-100); padding-top: 1.5rem; font-size: .75rem; color: var(--gray-400); }
.pm-footer-bottom p { margin: 0; }

/* CTA в статье: блок ведёт на money-страницу распознавания, формы здесь нет */
.pm-cta { margin: 2.5rem 0; border-radius: 1rem; border: 1px solid #dfe9d8;
  background: linear-gradient(180deg, #f4f8f1, #fff); padding: 2rem 1.5rem; }
.pm-cta h3 { text-align: center; font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
.pm-cta .pm-cta-sub { text-align: center; font-size: .875rem; color: var(--gray-500); margin: 0 0 1.5rem; }
.pm-cta-note { text-align: center; font-size: .75rem; color: var(--gray-400); margin: 0; }

/* ===== Редизайн блога: гибрид-раскладка ===== */
.pm-archive { max-width: 72rem; }
.pm-layout { display: grid; grid-template-columns: 232px 1fr; gap: 2rem; align-items: start; text-align: left; }
.pm-main { min-width: 0; }

/* Сайдбар */
.pm-side { position: sticky; top: 82px; }
.pm-side-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-400); margin: 0 0 .75rem .5rem; font-weight: 700; }
.pm-rub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pm-rub a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 12px; color: var(--gray-600); font-size: 14px; font-weight: 600; }
.pm-rub a:hover { background: #F7F5FF; }
.pm-rub a.on { background: linear-gradient(90deg, rgba(28,138,76,.12), rgba(217,164,65,.10)); color: var(--primary-dark); }
.pm-ico { width: 34px; height: 34px; flex: none; border-radius: 10px; background: #f1f6ee; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.pm-ico svg { width: 19px; height: 19px; }
.pm-rub a.on .pm-ico { background: #fff; color: var(--pink-400); }
.pm-rub-name { flex: 1; }
.pm-cnt { font-size: 12px; font-weight: 700; color: var(--gray-400); background: #F2F0F9; border-radius: 999px; padding: 2px 8px; min-width: 26px; text-align: center; }
.pm-rub a.on .pm-cnt { color: var(--primary-dark); background: #fff; }
.pm-newpin { margin-top: 1rem; padding: 1rem; border-radius: 14px; background: linear-gradient(135deg, #f1f6ee, #fbf7ec); border: 1px solid #dfe9d8; }
.pm-newpin b { display: block; font-size: 13.5px; margin-bottom: .2rem; }
.pm-newpin span { font-size: 12.5px; color: var(--gray-500); line-height: 1.5; display: block; margin-bottom: .6rem; }
.pm-newpin .pm-cta-btn { font-size: 12.5px; padding: .5rem 1rem; }

/* Мобильные чипсы (скрыты на десктопе) */
.pm-chips { display: none; }

/* Блок «Главное» */
.pm-feat { display: grid; grid-template-columns: 1.35fr 1fr; border: 1px solid var(--gray-100); border-radius: 20px; overflow: hidden; margin-bottom: 1.6rem; background: #fff; }
.pm-feat-main { position: relative; min-height: 280px; display: flex; flex-direction: column; justify-content: flex-end; color: #fff; padding: 1.4rem; }
.pm-feat-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pm-feat-img.pm-ph { background: linear-gradient(135deg, #156b3a, #2eb274); }
.pm-feat-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(12,40,24,.78), rgba(12,40,24,.12) 55%, transparent); }
.pm-feat-main > .pm-eyebrow, .pm-feat-main > .pm-feat-title, .pm-feat-main > .pm-feat-sub { position: relative; }
.pm-eyebrow { display: inline-flex; align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--warm-yellow); color: #5B3B00; padding: 4px 10px; border-radius: 999px; margin-bottom: .7rem; }
.pm-feat-title { font-size: 24px; line-height: 1.18; font-weight: 800; margin: 0 0 .5rem; max-width: 22ch; }
.pm-feat-sub { margin: 0; font-size: 13.5px; color: rgba(255,255,255,.86); max-width: 40ch; }
.pm-feat-list { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; }
.pm-feat-list-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); font-weight: 700; margin: 0 0 .4rem; }
.pm-feat-list a { display: block; color: var(--gray-900); font-size: 14.5px; font-weight: 700; line-height: 1.32; padding: .75rem 0; border-bottom: 1px solid #F2F0F9; }
.pm-feat-list a:last-child { border-bottom: 0; }
.pm-feat-list a span { display: block; font-size: 12px; font-weight: 600; color: var(--primary); margin-top: .3rem; }
.pm-feat-list a:hover { color: var(--primary-dark); }

/* Секции + карточки */
.pm-sec-h { margin: 0 0 .9rem; }
.pm-sec-h h3 { font-size: 18px; font-weight: 800; margin: 0; }
.pm-archive .pm-main > .pm-grid { grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
/* Соотношение карточки = формат наших обложек 1200×630 (40:21), чтобы object-fit:cover
   заполнял без обрезки (16:9 срезал верх/низ иллюстраций с персонажами).
   height:auto !important — перебиваем легаси `.pm-archive .pm-card img{height:11rem}`
   (выше по специфичности), иначе фикс.высота 176px ломает соотношение и режет. */
.pm-card-img { aspect-ratio: 40 / 21; width: 100%; object-fit: cover; height: auto !important; }
.pm-card-meta { margin-top: auto; font-size: 12px; color: var(--gray-400); font-weight: 600; display: flex; gap: .5rem; align-items: center; padding-top: .5rem; }
.pm-dotm { width: 3px; height: 3px; border-radius: 50%; background: var(--gray-400); }
.pm-crumbs { display: flex; gap: .4rem; font-size: 13px; color: var(--gray-400); margin-bottom: 1rem; }
.pm-crumbs a { color: var(--primary); font-weight: 600; }
.pm-article--in-layout { max-width: 44rem; margin: 0; padding: 0; }

/* Адаптив: сайдбар → чипсы */
@media (max-width: 860px) {
  .pm-layout { grid-template-columns: 1fr; }
  .pm-side { display: none; }
  .pm-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; }
  .pm-chips a { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--gray-100); font-size: 13px; font-weight: 600; color: var(--gray-600); white-space: nowrap; background: #fff; }
  .pm-chips a.on { background: linear-gradient(90deg, var(--primary), var(--pink-400)); color: #fff; border-color: transparent; }
}
@media (max-width: 640px) {
  .pm-feat { grid-template-columns: 1fr; }
  .pm-archive .pm-main > .pm-grid { grid-template-columns: 1fr; }
}
/* ── Контент-блоки статей (Фаза 2 «Перо») ──────────────────────────────── */

/* «Коротко о главном» — ключевые тезисы вперёд, сразу под заголовком */
.pm-content .pm-key-points { margin: 0 0 2rem; border-radius: 1rem; border: 1px solid #dfe9d8;
  background: linear-gradient(to bottom right, #f1f6ee, #fff); padding: 1.25rem 1.5rem; }
.pm-content .pm-key-points-title { display: block; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--primary); font-weight: 700; margin-bottom: .6rem; }
.pm-content .pm-key-points ul { margin: 0; padding-left: 1.1rem; }
.pm-content .pm-key-points li { color: var(--gray-900); margin: .35rem 0; }

/* Callout — выделение главного по тексту */
.pm-content .pm-callout { margin: 1.75rem 0; border-left: 4px solid var(--primary);
  background: #f1f6ee; border-radius: .5rem; padding: 1rem 1.25rem; color: var(--gray-900); }
.pm-content .pm-callout strong { color: var(--primary-dark); }

/* Стат-блоки — цифры/факты крупно */
.pm-content .pm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem; margin: 1.75rem 0; }
.pm-content .pm-stat { border-radius: .75rem; border: 1px solid var(--gray-100); background: #fff;
  padding: 1rem; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.pm-content .pm-stat-num { display: block; font-size: 1.75rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.pm-content .pm-stat-label { display: block; font-size: .8rem; color: var(--gray-500); margin-top: .35rem; }

/* Иллюстрации к разделам */
.pm-content figure { margin: 1.75rem 0; }
.pm-content figure img { margin: 0; width: 100%; }
.pm-content figcaption { font-size: .8rem; color: var(--gray-400); text-align: center; margin-top: .5rem; }

/* Таблицы — зебра + отступы (базовые border/collapse уже выше) */
.pm-content table { margin: 1.75rem 0; }
.pm-content tbody tr:nth-child(even) { background: #FCFCFD; }

/* ── Шапка блога ─────────────────────────────────────────────────── */
.pm-header { position: sticky; top: 0; z-index: 40; background: rgba(249, 247, 241, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--gray-100); }
.pm-header-inner { max-width: 64rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.pm-header-brand { display: flex; align-items: baseline; gap: .4rem; }
.pm-header-logo-img { height: 34px; width: auto; display: block; }
@media (max-width: 560px) { .pm-header-logo-img { height: 28px; } }
.pm-header-nav { display: flex; align-items: center; gap: 1rem; }
.pm-header-link { font-size: .9rem; color: var(--gray-600); }
.pm-header-link:hover { color: var(--primary); }
@media (max-width: 560px) { .pm-header-link { display: none; } }
.pm-header-cta { display: inline-block; border-radius: 999px; background: var(--primary); color: #fff; font-size: .875rem; font-weight: 600; padding: .55rem 1.1rem; }
.pm-header-cta:hover { background: var(--primary-dark); }

/* ── CTA в статье ────────────────────────────────────────────────── */
.pm-cta-action { text-align: center; margin: 0; }
.pm-cta-btn { display: inline-block; border-radius: .75rem; background: var(--primary); color: #fff; font-weight: 600; padding: .85rem 1.6rem; }
.pm-cta-btn:hover { background: var(--primary-dark); }

/* ── Интро раздела: по ширине ведущей карточки «Главного» ──────────── */
.pm-archive-cat { padding-top: 2.5rem; }
.pm-cat-hero {
  border: 1px solid var(--gray-100); border-radius: 20px;
  background: linear-gradient(135deg, #f4f8f1 0%, #fbfaf5 55%, #fff 100%);
  padding: 1.75rem 1.9rem; margin-bottom: 1.6rem;
}
.pm-cat-hero-eyebrow {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--primary); margin-bottom: .35rem;
}
.pm-cat-hero h1 {
  font-size: 2.15rem; line-height: 1.12; font-weight: 700;
  margin: 0 0 .55rem; color: var(--gray-900); letter-spacing: -.01em;
}
.pm-cat-hero p { margin: 0; color: var(--gray-600); font-size: 1rem; line-height: 1.6; max-width: 62ch; }
.pm-cat-hero-meta { margin-top: .75rem !important; font-size: .8125rem; color: var(--gray-400); }
@media (max-width: 640px) {
  .pm-cat-hero { padding: 1.25rem; }
  .pm-cat-hero h1 { font-size: 1.6rem; }
  .pm-cat-hero p { font-size: .95rem; }
}
