@import url("/css/fonts.css");

/* Доктор Лера — дизайн-система Carbon Health */

:root {
  /* цвет */
  --primary: #338272;
  --primary-deep: #26655a;      /* производный: hover и крупные заголовки */
  --on-primary: #ffffff;
  --background: #e6e8eb;
  --surface: #ffffff;
  --text: #19191b;
  --text-muted: #404042;
  --accent: #88690c;
  --border: #d3d7dc;            /* производный: видимая граница на фоне */

  /* красные флаги — не входят в исходную палитру, добавлены под медицинскую задачу */
  --alarm: #a8302a;
  --alarm-bg: #fbeceb;

  /* шкала отступов, база 8 */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 56px;
  --s7: 64px;
  --s8: 80px;
  --s9: 96px;
  --s10: 128px;

  /* радиусы */
  --r-sm: 2px;
  --r-md: 8px;
  --r-lg: 20px;
  --r-xl: 40px;
  --r-pill: 9999px;

  /* тени */
  --shadow-card: rgba(0, 0, 0, 0.25) 0 8px 16px 0;

  /* движение */
  --t-fast: 150ms;
  --t-base: 300ms;
  --ease: ease-in-out;

  /* шрифты */
  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--primary-deep);
  text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent);
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

.wrap { width: min(100% - var(--s5), 760px); margin-inline: auto; }
.wrap.narrow { width: min(100% - var(--s5), 640px); }

.skip {
  position: absolute; left: -9999px;
  background: var(--primary); color: var(--on-primary);
  padding: var(--s1) var(--s2); border-radius: 0 0 var(--r-md) 0;
}
.skip:focus { left: 0; top: 0; z-index: 20; }

/* шапка */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); padding-block: var(--s2); flex-wrap: wrap;
}
.logo {
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
  color: var(--primary-deep); text-decoration: none; letter-spacing: -0.01em;
}
.nav { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: 0.95rem; font-weight: 500; }
.nav a { text-decoration: none; color: var(--text-muted); }
.nav a:hover { color: var(--primary); }

/* типографика */
h1 {
  font-family: var(--font-display); font-weight: 700; line-height: 1.29;
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.5rem);
  letter-spacing: -0.02em; margin: var(--s3) 0 var(--s2);
  color: var(--text); text-wrap: balance;
}
h2 {
  font-family: var(--font-display); font-weight: 700; line-height: 1.2;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.65rem);
  letter-spacing: -0.015em; margin: var(--s6) 0 var(--s2);
  color: var(--text); text-wrap: balance;
}
h3 {
  font-family: var(--font-display); font-weight: 600; line-height: 1.35;
  font-size: 1.08rem; margin: var(--s4) 0 var(--s1);
}
p { margin: 0 0 var(--s2); }
.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 62ch; }

.byline {
  font-size: 0.9rem; color: var(--text-muted);
  background: var(--surface); border-radius: var(--r-md);
  padding: var(--s2) var(--s3); margin-bottom: var(--s5);
}

.breadcrumbs {
  font-size: 0.875rem; color: var(--text-muted);
  padding: var(--s3) 0 var(--s2);
}
/* следом обычно идёт h1 со своим отступом — не удваиваем */
.breadcrumbs + h1 { margin-top: 0; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs span { opacity: 0.5; margin-inline: 6px; }

.prose ul { padding-left: 1.15em; margin: 0 0 var(--s3); }
.prose li { margin-bottom: var(--s1); }
.prose li::marker { color: var(--primary); }
.prose > h2:first-child { margin-top: 0; }

/* оглавление */
.toc {
  background: var(--surface); border-radius: var(--r-lg);
  padding: var(--s3); margin: 0 0 var(--s6);
  box-shadow: var(--shadow-card);
}
.toc__title {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin: 0 0 var(--s1);
}
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: var(--s4); }
.toc li { margin-bottom: 6px; break-inside: avoid; font-size: 0.94rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* красные флаги */
.emergency {
  background: var(--alarm-bg);
  border-left: 4px solid var(--alarm);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  padding: var(--s3); margin: var(--s5) 0;
}
.emergency__label {
  font-family: var(--font-display); font-weight: 700; color: var(--alarm);
  margin: 0 0 var(--s1); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.emergency ul { margin-bottom: 0; }
.emergency li::marker { color: var(--alarm); }
.emergency--home {
  border-left: 0; border-radius: 0; margin: 0;
  padding-block: var(--s4); border-top: 4px solid var(--alarm);
}

/* таблицы */
.table-wrap {
  overflow-x: auto; margin: 0 0 var(--s3);
  background: var(--surface); border-radius: var(--r-md);
}
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: var(--s1) var(--s2); border-bottom: 1px solid var(--border); }
th { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* карточки */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.cards--grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cards a {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  background: var(--surface); border-radius: var(--r-lg);
  padding: var(--s3); text-decoration: none; color: inherit;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease);
}
.cards a:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.card__title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  color: var(--primary-deep); line-height: 1.3;
}
.card__desc { font-size: 0.92rem; color: var(--text-muted); line-height: 1.55; }

.related { margin-top: var(--s8); }

/* главная */
.hero { padding-block: var(--s8) var(--s5); }
.hero h1 { margin-top: 0; max-width: 18ch; }
.hero__lead { font-size: 1.15rem; color: var(--text-muted); max-width: 58ch; }
.hero__actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 12px var(--s3);
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--r-pill); text-decoration: none;
  font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  border: 0; cursor: pointer;
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:hover { background: var(--primary-deep); color: var(--on-primary); box-shadow: var(--shadow-card); }
.btn--ghost {
  background: var(--surface);
  color: var(--primary-deep);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}
.btn--ghost:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: var(--primary-deep);
  box-shadow: inset 0 0 0 1.5px var(--primary-deep);
}

.sections { margin-bottom: var(--s8); }

/* подвал */
.site-footer {
  margin-top: var(--s9); background: var(--surface);
  border-top: 1px solid var(--border); padding-block: var(--s5);
  font-size: 0.9rem; color: var(--text-muted);
}
.site-footer__disclaimer { max-width: 70ch; }
.site-footer__nav { display: flex; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.site-footer__copy { margin: 0; opacity: 0.75; }

article.article { padding-bottom: var(--s5); }

/* форма */
.form-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: var(--s4); box-shadow: var(--shadow-card);
  margin-bottom: var(--s5);
}
.field { margin-bottom: var(--s3); }
.field label {
  display: block; font-family: var(--font-display); font-weight: 600;
  font-size: 0.95rem; margin-bottom: 6px;
}
.field__hint { display: block; font-weight: 400; font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.field input[type="text"],
.field input[type="email"],
.field textarea {
  width: 100%; min-height: 44px; padding: 12px var(--s2);
  font-family: var(--font-body); font-size: 1rem; color: var(--text);
  background: var(--background); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease);
}
.field textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus { border-color: var(--primary); outline-offset: 0; }
.field--check { display: flex; gap: 12px; align-items: flex-start; }
.field--check input { width: 20px; height: 20px; margin-top: 3px; flex-shrink: 0; accent-color: var(--primary); }
.field--check label { font-weight: 400; font-family: var(--font-body); font-size: 0.9rem; line-height: 1.5; }
.field-error { color: var(--alarm); font-size: 0.88rem; margin-top: 6px; }
.hp { position: absolute; left: -9999px; }
.form-status { padding: var(--s2) var(--s3); border-radius: var(--r-md); margin-bottom: var(--s3); }
.form-status--error { background: var(--alarm-bg); color: var(--alarm); }

/* согласие на куки */
.cookie {
  position: fixed; inset-inline: var(--s2); bottom: var(--s2); z-index: 30;
  max-width: 620px; margin-inline: auto;
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: var(--s2) var(--s3);
  font-size: 0.92rem;
  animation: cookie-in var(--t-base) var(--ease);
}
.cookie p { margin: 0; flex: 1 1 260px; color: var(--text-muted); line-height: 1.5; }
.cookie__actions { flex-shrink: 0; }
.cookie .btn { font-size: 0.9rem; padding: 10px var(--s4); min-height: 40px; }

@keyframes cookie-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .cards a:hover { transform: none; }
}

@media (max-width: 560px) {
  .toc ul { columns: 1; }
  .site-header__inner { padding-block: 12px; }
  .nav { gap: var(--s2); font-size: 0.88rem; }
  .hero { padding-block: var(--s5) var(--s4); }
  .form-card { padding: var(--s3); }
}

@media print {
  .site-header, .site-footer, .toc, .related, .cookie { display: none; }
}

/* карточка врача */
.doctor {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--s5);
  align-items: start;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s4);
  margin-bottom: var(--s6);
  box-shadow: var(--shadow-card);
}
.doctor__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--r-md);
  display: block;
  background: var(--background);
}
.doctor__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 var(--s1);
  letter-spacing: -0.015em;
}
.doctor__role {
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 var(--s2);
}
.doctor__intro { color: var(--text-muted); margin: 0; }

/* пока фото не загружено */
.doctor--no-photo { grid-template-columns: 1fr; }

/* версия для главной: компактнее, с надзаголовком и кнопкой */
.doctor--home {
  grid-template-columns: 200px 1fr;
  margin-block: var(--s8);
}
.doctor--home .doctor__photo { max-width: 200px; }
.doctor--home .doctor__name { margin-top: 0; font-size: 1.35rem; }
.doctor--home .doctor__intro { margin-bottom: var(--s3); }
.doctor--home p:last-child { margin-bottom: 0; }
.doctor__kicker {
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin: 0 0 var(--s1);
}

@media (max-width: 620px) {
  .doctor, .doctor--home {
    grid-template-columns: 1fr;
    gap: var(--s3);
    padding: var(--s3);
  }
  .doctor__photo, .doctor--home .doctor__photo { max-width: 220px; }
  .doctor--home { margin-block: var(--s6); }
}
