/* client/css/public.css
 * Стили публичного сайта. Импортируется в каждой public/*.html через
 * <link rel="stylesheet" href="/css/main.css"> + <link rel="stylesheet" href="/css/public.css">
 * Использует переменные из main.css (:root).
 */

/* ── Navigation ─────────────────────────────────────────────── */
.pub-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.pub-nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
  text-decoration: none;
  margin-right: 24px;
  white-space: nowrap;
}

.pub-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.pub-nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.pub-nav-links a:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.pub-nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.pub-nav-cta {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  white-space: nowrap;
}

.pub-nav-cta:hover {
  background: var(--primary);
  color: var(--primary-fg);
}

/* ── Page container ──────────────────────────────────────────── */
.pub-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Hero block ──────────────────────────────────────────────── */
.pub-hero {
  text-align: center;
  padding: 56px 24px 40px;
}

.pub-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--fg);
  margin: 0 0 12px;
  line-height: 1.2;
}

.pub-hero p {
  font-size: 1.05rem;
  color: var(--fg-2);
  margin: 0 0 28px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Feature cards (home page) ────────────────────────────────── */
.pub-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.pub-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pub-feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

.pub-feature-card .icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.pub-feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.pub-feature-card p {
  font-size: 0.85rem;
  color: var(--fg-2);
  margin: 0;
  line-height: 1.5;
}

/* ── Program cards ────────────────────────────────────────────── */
.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.pub-program-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--fg);
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pub-program-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

.pub-program-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.pub-program-card .meta {
  font-size: 12px;
  color: var(--fg-2);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.pub-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}
.pub-badge.edu { background: #dbeafe; color: #1d4ed8; }
.pub-badge.ptype { background: #ede9fe; color: #6d28d9; }

.pub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 0 0 20px;
}
.pub-filters select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--fg);
}
.pub-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 12px;
}
.pub-seg button {
  padding: 6px 12px;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.pub-seg button:first-child { border-left: none; }
.pub-seg button.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ── Document cards ───────────────────────────────────────────── */
.pub-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-2);
  margin: 32px 0 12px;
}

.pub-doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 10px;
  text-decoration: none;
  display: block;
  color: var(--fg);
  transition: border-color 0.15s;
}

.pub-doc-card:hover {
  border-color: var(--primary);
}

.pub-doc-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.pub-doc-card .summary {
  font-size: 13px;
  color: var(--fg-2);
  margin: 0 0 6px;
}

.pub-doc-card .date {
  font-size: 11px;
  color: var(--fg-2);
}

.pub-cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

.pub-cat-badge.law {
  background: var(--primary-soft);
  color: #1d4ed8;
}

.pub-cat-badge.explanation {
  background: #dcfce7;
  color: #166534;
}

/* ── Program teaser page ─────────────────────────────────────── */
.pub-program-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  padding: 20px 24px 16px;
  border-bottom: none;
}

.pub-program-header .eyebrow {
  font-size: 11px;
  color: var(--fg-2);
  margin-bottom: 4px;
}

.pub-program-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.pub-module {
  border: 1px solid var(--border);
  border-top: none;
}

.pub-module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--surface);
}

.pub-module-header.open {
  background: #f0fdf4;
}

.pub-module-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.pub-module-label.open { color: #16a34a; }
.pub-module-label.locked { color: var(--fg-2); }

.pub-module-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.pub-module-body {
  padding: 12px 24px 14px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.7;
  border-top: 1px solid var(--border);
}

.pub-module-locked {
  border: 1px solid var(--border);
  border-top: none;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}

/* ── CTA block ────────────────────────────────────────────────── */
.pub-cta {
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  padding: 24px;
  text-align: center;
  background: var(--surface-2);
}

.pub-cta p {
  font-size: 14px;
  color: var(--fg-2);
  margin: 0 0 14px;
}

.pub-cta .cta-btn {
  display: inline-block;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.pub-cta .cta-secondary {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-2);
}

.pub-cta .cta-secondary a {
  color: var(--primary);
}

/* ── Document body content ────────────────────────────────────── */
.pub-doc-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 32px;
  margin-top: 20px;
  line-height: 1.75;
  font-size: 15px;
}

.pub-doc-body h1, .pub-doc-body h2, .pub-doc-body h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.pub-doc-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.55;
}

.pub-doc-body th,
.pub-doc-body td {
  border: 1px solid var(--border);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}

.pub-doc-body th {
  background: var(--bg-2, rgba(0, 0, 0, 0.03));
  font-weight: 700;
}

.pub-doc-body table caption {
  caption-side: top;
  text-align: left;
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 6px;
}

/* Кнопка скачивания образца (напр., форма МТО для ЕПГУ) */
.pub-doc-body .btn-download {
  display: inline-block;
  margin: 8px 0;
  padding: 11px 20px;
  background: linear-gradient(200deg, var(--pub-cta-from) 14%, var(--pub-cta-to) 86%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  transition: filter .15s ease;
}
.pub-doc-body .btn-download:hover { filter: brightness(.96); }

/* ── Subscribe page ───────────────────────────────────────────── */
.pub-subscribe-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 16px;
}

.pub-subscribe-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.pub-subscribe-section ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
  color: var(--fg-2);
  font-size: 14px;
}

/* ── Loading / error states ────────────────────────────────────── */
.pub-loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-2);
  font-size: 14px;
}

.pub-error {
  text-align: center;
  padding: 48px 24px;
  color: #dc2626;
  font-size: 14px;
}

/* =============================================================================
   РОСМЕДОБР brand restyle (public site only)
   Appended last so equal-specificity rules override the defaults above.
   Reference: www.rosmedobr.ru — deep-blue nav #005b9e, orange-gradient pill CTA,
   teal links #1190b7, light bg #f4f8f9, slate text #323c47. System font kept.
   ============================================================================= */
:root {
  --pub-blue:       #005b9e;
  --pub-blue-dark:  #003f70;
  --pub-blue-soft:  #e6f0f7;
  --pub-teal:       #1190b7;
  --pub-cta-from:   #fc6a03;
  --pub-cta-to:     #ffa420;
  --pub-bg:         #f4f8f9;
  --pub-text:       #323c47;
  --pub-text-2:     #5b6775;
  --pub-magenta:    #a3268a;
}

body { background: var(--pub-bg); color: var(--pub-text); }
a { color: var(--pub-teal); }

/* ── Nav → РОСМЕДОБР deep-blue band ──────────────────────────── */
.pub-nav {
  background: var(--pub-blue);
  border-bottom: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  height: 56px;
}
.pub-nav-brand { color: #fff; font-size: 16px; letter-spacing: .2px; }
.pub-nav-brand:hover { color: #fff; text-decoration: none; }
.pub-nav-links a {
  color: rgba(255, 255, 255, .82);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
}
.pub-nav-links a:hover { background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
.pub-nav-links a.active { color: #fff; background: rgba(255, 255, 255, .18); }

/* ── Orange-gradient pill — the РОСМЕДОБР signature CTA ──────── */
.pub-nav-cta,
.pub-cta .cta-btn {
  background: linear-gradient(200deg, var(--pub-cta-from) 14%, var(--pub-cta-to) 86%);
  color: #fff;
  border: 0;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  box-shadow: 0 3px 12px rgba(252, 106, 3, .28);
  transition: filter .15s, box-shadow .15s, transform .04s;
}
.pub-nav-cta { padding: 8px 20px; font-size: 12px; }
.pub-cta .cta-btn { padding: 12px 28px; font-size: 13px; }
.pub-nav-cta:hover,
.pub-cta .cta-btn:hover { filter: brightness(1.05); color: #fff; text-decoration: none; box-shadow: 0 5px 16px rgba(252, 106, 3, .36); }
.pub-nav-cta:active, .pub-cta .cta-btn:active { transform: translateY(1px); }
.pub-cta .cta-secondary a { color: var(--pub-teal); }

/* ── Hero ────────────────────────────────────────────────────── */
.pub-hero h1 { color: var(--pub-text); }
.pub-hero p { color: var(--pub-text-2); }
.pub-hero p strong { color: var(--pub-blue); }

/* ── Feature / program / doc cards ───────────────────────────── */
.pub-feature-card .icon {
  width: 52px;
  height: 52px;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pub-blue-soft);
  border-radius: 50%;
  margin-bottom: 14px;
}
.pub-feature-card:hover,
.pub-program-card:hover { border-color: var(--pub-blue); box-shadow: 0 4px 16px rgba(0, 91, 158, .10); }
.pub-doc-card:hover { border-color: var(--pub-blue); }
.pub-feature-card h3, .pub-program-card h3 { color: var(--pub-text); }

/* ── Badges / filters / segmented ────────────────────────────── */
.pub-badge { background: var(--pub-blue-soft); color: var(--pub-blue); }
.pub-badge.edu { background: var(--pub-blue-soft); color: var(--pub-blue); }
.pub-badge.ptype { background: #fdeede; color: #b45309; }
.pub-cat-badge.law { background: var(--pub-blue-soft); color: var(--pub-blue); }
.pub-seg button.active { background: var(--pub-blue); color: #fff; }
.pub-filters select:focus { outline: 0; border-color: var(--pub-blue); box-shadow: 0 0 0 3px rgba(0, 91, 158, .15); }

/* ── Section titles + doc body ───────────────────────────────── */
.pub-section-title { color: var(--pub-blue); }
.pub-doc-body th { background: var(--pub-blue-soft); color: var(--pub-blue); }
.pub-doc-body a { color: var(--pub-teal); }
.pub-program-header h1 { color: var(--pub-text); }

/* ── Footer ──────────────────────────────────────────────────── */
.pub-footer {
  background: var(--pub-blue-dark);
  color: rgba(255, 255, 255, .82);
  margin-top: 56px;
}
.pub-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  font-size: 13px;
  line-height: 1.5;
}
.pub-footer-brand { font-weight: 600; color: #fff; }
.pub-footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pub-footer-links a {
  color: #fff;
  opacity: .82;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: 12px;
}
.pub-footer-links a:hover { opacity: 1; text-decoration: underline; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pub-nav { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 4px 8px; }
  .pub-nav-links { order: 3; flex-basis: 100%; }
  .pub-footer-inner { flex-direction: column; align-items: flex-start; }
}
