/* ============================================================
   Журнал доктора Овсепяна — прототип v0.3
   Стилистика: Хабр (точная палитра, типографика PT Sans)
   ============================================================ */

/* ---------- PT Sans (локально, не Google CDN) ---------- */
/* cyrillic-ext */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-sans-400-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F,
    U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-sans-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-sans-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-sans-400-latin.woff2") format("woff2");
  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+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext bold */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-sans-700-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F,
    U+FE2E-FE2F;
}
/* cyrillic bold */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-sans-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext bold */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-sans-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin bold */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-sans-700-latin.woff2") format("woff2");
  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+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #333333;
  background: #f4f5f6;
}

a {
  color: #4d87b5;
  text-decoration: none;
}

a:hover {
  color: #3d74d8;
  text-decoration: underline;
}

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

/* ---------- Header (sticky, как у Хабра) ---------- */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e7e7e7;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.logo__small {
  font-size: 13px;
  font-weight: 400;
  color: #788188;
  margin-left: 6px;
}

.logo:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 22px;
  flex: 1;
}

.nav a {
  color: #333333;
  font-size: 14px;
  font-weight: 400;
}

.nav a:hover {
  color: #4d87b5;
  text-decoration: none;
}

.nav__current {
  color: #1a1a1a !important;
  font-weight: 700 !important;
  position: relative;
}

.nav__current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -16px;
  height: 2px;
  background: #4d87b5;
}

.header-cta {
  background: #4d87b5;
  color: #fff;
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.header-cta:hover {
  background: #3d74d8;
  text-decoration: none;
  color: #fff;
}

/* ---------- Main grid ---------- */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: grid;
  grid-template-columns: minmax(0, 680px) 280px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1000px) {
  .main {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

/* ---------- Author avatar (img-based) ---------- */
.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #c0c4c8;
  object-fit: cover;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.author-avatar--lg {
  width: 48px;
  height: 48px;
}

.author-avatar--md {
  width: 40px;
  height: 40px;
}

/* ---------- Article card (на главной) ---------- */
.article-card {
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

.article-card:hover {
  border-color: #c4c4c4;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #788188;
  margin-bottom: 10px;
}

.author-name {
  color: #1a1a1a;
  font-weight: 500;
}

.author-name a {
  color: inherit;
}

.dot {
  color: #c4c4c4;
}

.article-card__title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a1a;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.article-card__title a {
  color: inherit;
}

.article-card__title a:hover {
  color: #4d87b5;
  text-decoration: none;
}

.article-card__lead {
  font-size: 15px;
  color: #555;
  margin: 0 0 14px;
  line-height: 1.55;
}

.article-card__footer {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #788188;
}

.article-card__footer .stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.article-card--upcoming {
  opacity: 0.55;
}

.article-card--upcoming .article-card__title a {
  cursor: default;
  pointer-events: none;
}

.upcoming-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  background: #fff1c2;
  color: #6b5a00;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Page title (на главной) ---------- */
.page-intro {
  margin-bottom: 20px;
}

.page-intro h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.page-intro p {
  margin: 0;
  font-size: 15px;
  color: #555;
  line-height: 1.55;
}

/* ---------- Таб-фильтры (Хабр-стайл) ---------- */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e7e7e7;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #788188;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.15s;
}

.filter-tab:hover {
  background: #f4f5f6;
  color: #1a1a1a;
  text-decoration: none;
}

.filter-tab.is-active {
  background: #1a1a1a;
  color: #fff;
}

.filter-tab.is-active:hover {
  background: #000;
  color: #fff;
}

/* ---------- Серия автора ---------- */
.author-series {
  margin-bottom: 36px;
}

.author-series__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e7e7e7;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.author-series__header .author-avatar--lg {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.author-series__name {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.author-series__meta {
  font-size: 13px;
  color: #788188;
  margin-bottom: 6px;
}

.author-series__meta .author-role {
  color: #1a1a1a;
  font-weight: 500;
}

.author-series__meta a {
  color: #4d87b5;
}

.author-series__topic {
  font-size: 13px;
  color: #555;
  font-style: italic;
}

.author-series .article-card {
  border-radius: 0;
  border-top: none;
  margin-bottom: 0;
}

.author-series .article-card:not(:last-of-type) {
  border-bottom: none;
}

.author-series .article-card:last-child {
  border-radius: 0 0 4px 4px;
  margin-bottom: 0;
}

/* Тонкий divider между статьями одной серии */
.author-series .article-card + .article-card {
  position: relative;
}

.author-series .article-card + .article-card::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 0;
  height: 1px;
  background: #f1f3f5;
}

/* ---------- Теги статьи (Хабр-стайл хабы) ---------- */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 14px;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  background: #f4f5f6;
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  white-space: nowrap;
}

a.tag:hover {
  background: #e7e7e7;
  color: #1a1a1a;
  text-decoration: none;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 70px;
}

.sidebar__card {
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.sidebar__card h3 {
  font-size: 12px;
  font-weight: 600;
  color: #788188;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
}

.author-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.author-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}

.author-list li:not(:last-child) {
  border-bottom: 1px solid #f1f3f5;
}

.author-list__name {
  font-weight: 500;
  color: #1a1a1a;
  display: block;
  line-height: 1.3;
}

.author-list__role {
  color: #788188;
  font-size: 12px;
}

.subscribe-card p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.subscribe-card input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 6px;
  font-family: inherit;
}

.subscribe-card input[type="email"]:focus {
  outline: none;
  border-color: #4d87b5;
}

.subscribe-card button {
  width: 100%;
  padding: 8px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.subscribe-card button:hover {
  background: #000;
}

/* ============================================================
   СТРАНИЦА СТАТЬИ
   ============================================================ */

.article {
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  padding: 32px 40px 24px;
}

@media (max-width: 700px) {
  .article {
    padding: 20px 16px;
  }
}

.article__header {
  margin-bottom: 20px;
}

.article__title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.22;
  color: #1a1a1a;
  margin: 0 0 16px;
  letter-spacing: -0.015em;
}

.article__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #788188;
}

.article__meta .author-name-line {
  font-size: 14px;
  color: #1a1a1a;
}

.article__meta-secondary {
  font-size: 12px;
  color: #788188;
  margin-top: 2px;
}

.article__cover {
  margin: 0 -40px 24px;
  background: #f4f5f6;
  width: calc(100% + 80px);
  max-height: 460px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid #e7e7e7;
  border-top: 1px solid #e7e7e7;
}

.article__cover-caption {
  margin: -12px -40px 24px;
  padding: 8px 40px 0;
  font-size: 12px;
  color: #788188;
  font-style: italic;
  text-align: center;
}

@media (max-width: 700px) {
  .article__cover {
    margin: 0 -16px 20px;
    width: calc(100% + 32px);
    max-height: 280px;
  }
  .article__cover-caption {
    margin: -12px -16px 20px;
    padding: 8px 16px 0;
  }
}

.article__lead {
  font-size: 17px;
  line-height: 1.55;
  color: #1a1a1a;
  margin-bottom: 24px;
  font-weight: 400;
}

.article__body h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 32px 0 14px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.article__body h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 24px 0 10px;
}

.article__body p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
}

.article__body ul,
.article__body ol {
  padding-left: 22px;
  margin: 0 0 14px;
}

.article__body ul li,
.article__body ol li {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.6;
}

.article__body strong {
  font-weight: 600;
  color: #1a1a1a;
}

.article__body mark {
  background: #fff1c2;
  padding: 0 2px;
  border-radius: 2px;
}

/* Цитата-блок в стиле Хабра */
.article__body blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 3px solid #4d87b5;
  background: #f4f4f4;
  border-radius: 0 4px 4px 0;
  color: #555;
}

.article__body blockquote p {
  margin: 0;
  font-size: 15px;
  font-style: italic;
}

.article__body blockquote p + p {
  margin-top: 8px;
}

/* Таблица плана лечения */
.article__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14px;
}

.article__body table th,
.article__body table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid #e7e7e7;
}

.article__body table th {
  background: #f4f5f6;
  font-weight: 600;
  color: #1a1a1a;
  font-size: 13px;
  border-bottom: 1px solid #d4d4d4;
}

.article__body table tr:last-child td {
  font-weight: 600;
  background: #f9f9f9;
  border-bottom: 1px solid #1a1a1a;
  border-top: 1px solid #1a1a1a;
}

.article__body table td:last-child,
.article__body table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Конверсионная плашка */
.cta-box {
  margin: 32px 0 20px;
  padding: 22px 26px;
  background: #f0f5fa;
  border: 1px solid #c5d6e8;
  border-radius: 4px;
}

.cta-box h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #1a1a1a;
}

.cta-box p {
  margin: 0 0 14px;
  font-size: 15px;
  color: #555;
  line-height: 1.55;
}

.cta-box a.button {
  display: inline-block;
  padding: 10px 20px;
  background: #4d87b5;
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
}

.cta-box a.button:hover {
  background: #3d74d8;
  text-decoration: none;
}

/* Статистика статьи (без голосовалки — она требует серверного бэка) */
.article-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 24px 0 20px;
  padding: 12px 0;
  border-top: 1px solid #e7e7e7;
  border-bottom: 1px solid #e7e7e7;
  font-size: 13px;
  color: #788188;
}

.rating-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Вторичная кнопка CTA (WhatsApp) */
.button-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: #fff;
  color: #4d87b5;
  border: 1px solid #4d87b5;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}

.button-secondary:hover {
  background: #f0f5fa;
  text-decoration: none;
  color: #3d74d8;
}

/* Комментарии — секция */
.comments {
  margin: 32px 0;
}

.comments__header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e7e7e7;
}

.comments__header h2 {
  font-size: 18px !important;
  font-weight: 700;
  margin: 0 !important;
  color: #1a1a1a;
}

.comments__count {
  font-size: 14px;
  color: #788188;
}

/* Форма нового комментария */
.comment-form {
  margin-bottom: 24px;
  padding: 14px;
  background: #f9f9f9;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
}

.comment-form__row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-form input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.5;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: #4d87b5;
}

.comment-form__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #788188;
}

.comment-form button {
  padding: 8px 18px;
  background: #4d87b5;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.comment-form button:hover {
  background: #3d74d8;
}

.comment-form button:disabled {
  background: #c4c4c4;
  cursor: not-allowed;
}

/* Один комментарий */
.comment {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f3f5;
}

.comment:last-child {
  border-bottom: none;
}

.comment--new {
  background: #fff8e1;
  margin: 0 -8px;
  padding: 12px 8px;
  border-radius: 4px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comment__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #c0c4c8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.comment__body {
  flex: 1;
  min-width: 0;
}

.comment__meta {
  font-size: 12px;
  color: #788188;
  margin-bottom: 3px;
}

.comment__author {
  color: #1a1a1a;
  font-weight: 500;
}

.comment__text {
  font-size: 14px;
  line-height: 1.55;
  color: #333;
  margin: 0;
  word-wrap: break-word;
}

.comment__quote {
  border-left: 3px solid #c0c4c8;
  padding: 3px 10px;
  margin: 5px 0 6px;
  color: #788188;
  font-size: 13px;
  font-style: italic;
}

/* Связанные статьи */
.related {
  margin: 32px 0 20px;
}

.related h2 {
  font-size: 18px !important;
  font-weight: 700;
  margin: 0 0 14px !important;
  color: #1a1a1a;
  padding-bottom: 10px;
  border-bottom: 1px solid #e7e7e7;
}

.related__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .related__grid {
    grid-template-columns: 1fr;
  }
}

.related__card {
  display: block;
  padding: 14px;
  background: #f9f9f9;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.related__card:hover {
  background: #fff;
  border-color: #c4c4c4;
  text-decoration: none;
}

.related__card .author-avatar {
  width: 22px;
  height: 22px;
}

.related__author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #788188;
  margin-bottom: 7px;
}

.related__title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.35;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #fff;
  border-top: 1px solid #e7e7e7;
  padding: 24px 0;
  margin-top: 32px;
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 12px;
  color: #788188;
}

.site-footer a {
  color: #788188;
  margin-right: 14px;
}

.site-footer a:hover {
  color: #1a1a1a;
}

.site-footer__legal {
  max-width: 480px;
  line-height: 1.5;
}
