/* ============================================
   Википедия-стиль — Московский центр научной психологии и EMDR
   ============================================ */

:root {
  --wiki-bg: #f6f6f6;
  --wiki-white: #ffffff;
  --wiki-border: #a2a9b1;
  --wiki-link: #0645ad;
  --wiki-link-visited: #0b0080;
  --wiki-link-red: #ba0000;
  --wiki-text: #202122;
  --wiki-light-bg: #f8f9fa;
  --wiki-infobox-bg: #f8f9fa;
  --wiki-heading-border: #a2a9b1;
  --wiki-accent: #cee0f2;
  --wiki-table-header: #eaecf0;
  --wiki-green: #2B7A78;
  --wiki-green-dark: #1F5F5D;
}

body {
  background: var(--wiki-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Liberation Sans', 'Helvetica Neue', sans-serif;
  color: var(--wiki-text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ===== WIKI PAGE WRAPPER ===== */
.wiki-page {
  background: var(--wiki-white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  min-height: 100vh;
}

@media (min-width: 1200px) {
  .wiki-page {
    max-width: 1100px;
    margin: 0 auto;
  }
}

.wiki-content {
  padding: 1.5rem 2rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}

/* ===== WIKI TABS ===== */
.wiki-tabs {
  display: flex;
  gap: 0;
  font-size: 0.8rem;
  padding: 0 1.5rem;
  background: #f8f9fa;
  border-bottom: 1px solid var(--wiki-border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.wiki-tab {
  padding: 0.5rem 1rem;
  color: var(--wiki-link);
  white-space: nowrap;
  cursor: default;
  position: relative;
  bottom: -1px;
  text-decoration: none;
  flex-shrink: 0;
}

.wiki-tab.active {
  background: #fff;
  border: 1px solid var(--wiki-border);
  border-bottom: 1px solid #fff;
  color: #000;
  font-weight: 700;
}

.wiki-tab:not(.active) {
  background: #eaecf0;
  border: 1px solid var(--wiki-border);
  border-bottom: 1px solid var(--wiki-border);
}

/* ===== WIKI HEADINGS ===== */
.wiki-content h1 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 1.8rem;
  font-weight: 400;
  border-bottom: 1px solid var(--wiki-heading-border);
  padding-bottom: 0.3rem;
  margin: 0 0 1rem;
  color: #000;
  line-height: 1.3;
}

.wiki-content h2 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 1.5rem;
  font-weight: 400;
  border-bottom: 1px solid var(--wiki-heading-border);
  padding-bottom: 0.17rem;
  margin: 1.8rem 0 0.75rem;
  color: #000;
}

.wiki-content h3 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.4rem 0 0.5rem;
  color: #000;
}

.wiki-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.2rem 0 0.4rem;
}

.wiki-content p {
  margin: 0.5rem 0 1rem;
  font-size: 0.9375rem;
}

.wiki-content ul, .wiki-content ol {
  margin: 0.3rem 0 1rem 1.6rem;
  padding: 0;
  font-size: 0.9375rem;
}

.wiki-content li {
  margin-bottom: 0.25rem;
}

.wiki-content a {
  color: var(--wiki-link);
  text-decoration: none;
}
.wiki-content a:hover {
  text-decoration: underline;
}
.wiki-content a:visited {
  color: var(--wiki-link-visited);
}

/* ===== HATNOTE ===== */
.wiki-hatnote {
  font-style: italic;
  padding: 0.3rem 1.5rem;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.3rem;
}

/* ===== INFOBOX ===== */
.wiki-infobox {
  float: right;
  width: 270px;
  background: var(--wiki-infobox-bg);
  border: 1px solid var(--wiki-border);
  padding: 0.5em;
  margin: 0.5rem 0 1.5rem 1.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
  clear: right;
}

.wiki-infobox .infobox-title {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.3em 0;
  background: var(--wiki-accent);
  margin: -0.5em -0.5em 0.5em;
}

.wiki-infobox .infobox-image {
  text-align: center;
  padding: 0.5em 0;
}

.wiki-infobox .infobox-image img {
  max-width: 100%;
  height: auto;
}

.wiki-infobox table {
  width: 100%;
}

.wiki-infobox th {
  text-align: left;
  vertical-align: top;
  padding: 0.2em 0.4em;
  font-weight: 400;
  color: #555;
  width: 40%;
  white-space: nowrap;
}

.wiki-infobox td {
  vertical-align: top;
  padding: 0.2em 0.4em;
}

/* ===== TABLE OF CONTENTS ===== */
.wiki-toc {
  background: var(--wiki-light-bg);
  border: 1px solid var(--wiki-border);
  font-size: 0.85rem;
  padding: 0.5em 1em;
  margin: 1rem 0 1.5rem;
  display: inline-block;
  min-width: 280px;
}

.wiki-toc .toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.3em;
}

.wiki-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-toc > ul {
  margin-left: 0;
}

.wiki-toc ul ul {
  margin-left: 1.5em;
}

.wiki-toc .toc-number {
  color: #555;
}

/* ===== QUOTE BOX ===== */
.wiki-quote {
  background: var(--wiki-light-bg);
  border-left: 4px solid var(--wiki-accent);
  padding: 0.75rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

/* ===== WIKI TABLE ===== */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.wiki-table th {
  background: var(--wiki-table-header);
  text-align: left;
  padding: 0.4em 0.6em;
  border: 1px solid var(--wiki-border);
  font-weight: 700;
}

.wiki-table td {
  padding: 0.4em 0.6em;
  border: 1px solid var(--wiki-border);
  vertical-align: top;
}

.wiki-table tr:nth-child(even) td {
  background: #f8f9fa;
}

/* ===== REFERENCES ===== */
.wiki-references {
  font-size: 0.85rem;
  column-count: 2;
  column-gap: 2rem;
}

.wiki-references ol {
  margin: 0.3rem 0 1rem 1.6rem !important;
}

.wiki-references li {
  margin-bottom: 0.4rem;
}

/* ===== NAVBOX ===== */
.wiki-navbox {
  border: 1px solid var(--wiki-border);
  font-size: 0.85rem;
  margin: 2rem 0 1rem;
  clear: both;
}

.wiki-navbox .navbox-title {
  background: var(--wiki-accent);
  text-align: center;
  padding: 0.3rem;
  font-weight: 700;
}

.wiki-navbox .navbox-body {
  padding: 0.5rem 1rem;
}

/* ===== CATEGORIES ===== */
.wiki-categories {
  background: var(--wiki-light-bg);
  border: 1px solid var(--wiki-border);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

/* ===== AMBASSADOR BOX ===== */
.wiki-ambox {
  display: flex;
  background: #fef6e7;
  border: 1px solid #fc3;
  padding: 0.5rem 1rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
  align-items: flex-start;
  gap: 0.5rem;
}

.wiki-ambox.ambox-green {
  background: #f0faf0;
  border-color: #a3d3a3;
}

/* ===== SIDEBAR NAV ===== */
.wiki-sidebar {
  float: left;
  width: 170px;
  font-size: 0.8rem;
  padding: 1rem 0.75rem;
  margin-right: 2rem;
  display: none;
}

@media (min-width: 992px) {
  .wiki-sidebar {
    display: block;
  }
}

.wiki-sidebar .sidebar-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.wiki-sidebar .sidebar-logo img {
  max-width: 135px;
}

.wiki-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-sidebar li {
  padding: 0.3rem 0;
}

.wiki-sidebar a {
  color: var(--wiki-link);
  text-decoration: none;
}

.wiki-sidebar a:hover {
  text-decoration: underline;
}

.wiki-sidebar .sidebar-section {
  font-weight: 700;
  color: #555;
  margin-top: 0.8rem;
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== MAIN WITH SIDEBAR ===== */
.wiki-main {
  overflow: hidden;
}

/* ===== WIKI BUTTONS ===== */
.wiki-btn {
  display: inline-block;
  background: #f8f9fa;
  border: 1px solid var(--wiki-border);
  color: var(--wiki-link);
  font-weight: 700;
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s;
}
.wiki-btn:hover {
  background: #fff;
  text-decoration: none;
  color: var(--wiki-link);
}

.wiki-btn-primary {
  background: var(--wiki-green);
  border-color: var(--wiki-green-dark);
  color: #fff;
}
.wiki-btn-primary:hover {
  background: var(--wiki-green-dark);
  color: #fff;
}

/* ===== WIKI FORM ===== */
.wiki-form .form-control {
  border: 1px solid var(--wiki-border);
  border-radius: 2px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: #fff;
  transition: border-color 0.15s;
}
.wiki-form .form-control:focus {
  border-color: #36c;
  box-shadow: 0 0 0 1px #36c;
  outline: none;
}
.wiki-form label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #000;
  margin-bottom: 0.25rem;
}

/* ===== WIKI FOOTER ===== */
.wiki-footer {
  border-top: 1px solid var(--wiki-border);
  padding: 1.5rem 2rem;
  font-size: 0.75rem;
  color: #555;
  max-width: 960px;
  margin: 0 auto;
}

.wiki-footer a {
  color: var(--wiki-link);
}

.wiki-footer ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.wiki-footer li {
  margin-bottom: 0.25rem;
}

/* ===== TOAST ===== */
.custom-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #202122;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 2px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  animation: slideUp 0.4s ease, fadeOut 0.4s ease 3.5s forwards;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .wiki-infobox {
    float: none;
    width: 100%;
    margin: 1rem 0;
  }

  .wiki-references {
    column-count: 1;
  }

  .wiki-content {
    padding: 1rem;
  }

  .wiki-footer ul {
    flex-direction: column;
    gap: 0.25rem;
  }
}

html { scroll-behavior: smooth; }
/* ============================================
   ТЕМА «ЭНЦИКЛОПЕДИЯ» — Центр научной психологии и EMDR
   Поверх вики-базы: тёплый научный стиль
   ============================================ */

:root {
  --encyclopedia-bg: #faf8f5;
  --encyclopedia-white: #fffefb;
  --encyclopedia-accent: #1a5c5a;
  --encyclopedia-accent-light: #e8f4f3;
  --encyclopedia-link: #1a6b68;
  --encyclopedia-link-hover: #0f4543;
  --encyclopedia-heading: #1e3332;
  --encyclopedia-border: #d8d3cb;
  --encyclopedia-toc-bg: #f5f2ec;
  --encyclopedia-ambox-bg: #fef9f0;
  --encyclopedia-ambox-border: #e8c876;
  --encyclopedia-ambox-green-bg: #f2f8f6;
  --encyclopedia-ambox-green-border: #8cc9b8;
  --encyclopedia-navbox-title: #dce8e7;
  --encyclopedia-infobox-title: #dce8e7;
  --encyclopedia-table-stripe: #f8f6f2;
  --encyclopedia-footer-text: #6b6560;
}

/* ===== BODY OVERRIDE ===== */
body {
  background: var(--encyclopedia-bg);
  overflow-x: hidden;
}

/* ===== WIKI PAGE — тёплый оттенок + защита от горизонтального скролла ===== */
.wiki-page {
  background: var(--encyclopedia-white);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow-x: hidden;
}

/* ===== TABS — энциклопедический стиль ===== */
.wiki-tabs {
  background: #f0ede7;
  border-bottom: 1px solid var(--encyclopedia-border);
  padding: 0 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  overscroll-behavior-x: contain;
}

/* Скрываем полосу прокрутки в WebKit-браузерах, но сохраняем функциональность */
.wiki-tabs::-webkit-scrollbar {
  height: 4px;
}
.wiki-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.wiki-tabs::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.wiki-tab {
  padding: 0.5rem 1.2rem;
  font-size: 0.82rem;
  color: #555;
  font-weight: 500;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  white-space: nowrap;
}

.wiki-tab.active {
  background: var(--encyclopedia-white);
  border: 1px solid var(--encyclopedia-border);
  border-bottom: 1px solid var(--encyclopedia-white);
  color: var(--encyclopedia-heading);
  font-weight: 700;
}

.wiki-tab:not(.active) {
  background: #e8e4dc;
  border: 1px solid var(--encyclopedia-border);
  border-bottom: 1px solid var(--encyclopedia-border);
  color: var(--encyclopedia-link);
}
.wiki-tab:not(.active):hover {
  background: #f0ede7;
  text-decoration: none;
  color: var(--encyclopedia-link-hover);
}

/* ===== HEADINGS — Linux Libertine + тёплый оттенок ===== */
.wiki-content h1 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 2rem;
  font-weight: 400;
  border-bottom: 1px solid var(--encyclopedia-border);
  padding-bottom: 0.35rem;
  margin: 0.25rem 0 1rem;
  color: var(--encyclopedia-heading);
  letter-spacing: -0.3px;
}

.wiki-content h2 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 1.55rem;
  font-weight: 400;
  border-bottom: 1px solid var(--encyclopedia-border);
  padding-bottom: 0.18rem;
  margin: 2rem 0 0.75rem;
  color: var(--encyclopedia-heading);
}

.wiki-content h3 {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--encyclopedia-heading);
}

/* ===== LINKS — тёплый бирюзовый ===== */
.wiki-content a {
  color: var(--encyclopedia-link);
}
.wiki-content a:hover {
  color: var(--encyclopedia-link-hover);
}
.wiki-content a:visited {
  color: #4a7c79;
}

/* ===== HATNOTE ===== */
.wiki-hatnote {
  font-style: italic;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  color: #777;
  margin-bottom: 0.5rem;
}

/* ===== INFOBOX — энциклопедический ===== */
.wiki-infobox {
  float: right;
  width: 275px;
  background: #fdfcf9;
  border: 1px solid var(--encyclopedia-border);
  padding: 0.5em;
  margin: 0.5rem 0 1.5rem 1.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
  clear: right;
  border-radius: 3px;
}

.wiki-infobox .infobox-title {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.35em 0;
  background: var(--encyclopedia-infobox-title);
  margin: -0.5em -0.5em 0.5em;
  color: var(--encyclopedia-heading);
  letter-spacing: 0.3px;
}

.wiki-infobox .infobox-image {
  text-align: center;
  padding: 0.5em 0;
}

.wiki-infobox .infobox-image img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

.wiki-infobox table {
  width: 100%;
}

.wiki-infobox th {
  text-align: left;
  vertical-align: top;
  padding: 0.2em 0.4em;
  font-weight: 400;
  color: #888;
  width: 40%;
  white-space: nowrap;
}

.wiki-infobox td {
  vertical-align: top;
  padding: 0.2em 0.4em;
  color: #333;
}

/* ===== TOC — тёплый ===== */
.wiki-toc {
  background: var(--encyclopedia-toc-bg);
  border: 1px solid var(--encyclopedia-border);
  font-size: 0.875rem;
  padding: 0.6em 1.2em;
  margin: 1.2rem 0 1.5rem;
  display: inline-block;
  min-width: 280px;
  border-radius: 2px;
}

.wiki-toc .toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.4em;
  color: var(--encyclopedia-heading);
  font-size: 0.95rem;
}

/* ===== QUOTE BOX ===== */
.wiki-quote {
  background: var(--encyclopedia-toc-bg);
  border-left: 4px solid var(--encyclopedia-accent);
  padding: 0.85rem 1.35rem;
  margin: 1.2rem 0;
  font-size: 0.9rem;
  border-radius: 0 3px 3px 0;
}

/* ===== WIKI TABLE ===== */
.wiki-table th {
  background: #eeebe4;
  padding: 0.5em 0.7em;
  border: 1px solid var(--encyclopedia-border);
  font-weight: 700;
  color: var(--encyclopedia-heading);
}

.wiki-table td {
  padding: 0.5em 0.7em;
  border: 1px solid var(--encyclopedia-border);
  vertical-align: top;
}

.wiki-table tr:nth-child(even) td {
  background: var(--encyclopedia-table-stripe);
}

/* ===== AMBOX ===== */
.wiki-ambox {
  display: flex;
  background: var(--encyclopedia-ambox-bg);
  border: 1px solid var(--encyclopedia-ambox-border);
  padding: 0.6rem 1.1rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
  align-items: flex-start;
  gap: 0.6rem;
  border-radius: 3px;
}

.wiki-ambox.ambox-green {
  background: var(--encyclopedia-ambox-green-bg);
  border-color: var(--encyclopedia-ambox-green-border);
}

/* ===== NAVBOX ===== */
.wiki-navbox {
  border: 1px solid var(--encyclopedia-border);
  font-size: 0.85rem;
  margin: 2rem 0 1rem;
  clear: both;
  border-radius: 2px;
}

.wiki-navbox .navbox-title {
  background: var(--encyclopedia-navbox-title);
  text-align: center;
  padding: 0.35rem;
  font-weight: 700;
  color: var(--encyclopedia-heading);
}

/* ===== CATEGORIES ===== */
.wiki-categories {
  background: var(--encyclopedia-toc-bg);
  border: 1px solid var(--encyclopedia-border);
  padding: 0.6rem 1.1rem;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  border-radius: 2px;
}

/* ===== BUTTONS ===== */
.wiki-btn {
  display: inline-block;
  background: #f5f2ec;
  border: 1px solid var(--encyclopedia-border);
  color: var(--encyclopedia-link);
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s;
  border-radius: 3px;
}
.wiki-btn:hover {
  background: #fff;
  text-decoration: none;
  color: var(--encyclopedia-link-hover);
  border-color: var(--encyclopedia-accent);
}

.wiki-btn-primary {
  background: var(--encyclopedia-accent);
  border-color: var(--encyclopedia-accent);
  color: #fff;
}
.wiki-btn-primary:hover {
  background: #144e4c;
  color: #fff;
}

/* ===== FORM ===== */
.wiki-form .form-control {
  border: 1px solid var(--encyclopedia-border);
  border-radius: 3px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  background: #fffefb;
  transition: border-color 0.15s;
}
.wiki-form .form-control:focus {
  border-color: var(--encyclopedia-accent);
  box-shadow: 0 0 0 2px rgba(26,92,90,0.1);
  outline: none;
}
.wiki-form label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--encyclopedia-heading);
  margin-bottom: 0.3rem;
}

/* ===== FOOTER ===== */
.wiki-footer {
  border-top: 1px solid var(--encyclopedia-border);
  padding: 1.5rem 2rem;
  font-size: 0.78rem;
  color: var(--encyclopedia-footer-text);
  max-width: 960px;
  margin: 0 auto;
}

.wiki-footer a {
  color: var(--encyclopedia-link);
}

/* ===== TOAST ===== */
.custom-toast {
  background: var(--encyclopedia-heading);
  border-radius: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .wiki-infobox {
    float: none;
    width: 100%;
    margin: 1rem 0;
  }
  .wiki-references {
    column-count: 1;
  }
  .wiki-content {
    padding: 1rem;
  }
  .wiki-footer ul {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (min-width: 1200px) {
  .wiki-page {
    max-width: 1120px;
    margin: 0 auto;
  }
}

/* ===== History Timeline ===== */
.history-timeline .timeline-dot {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.history-timeline .timeline-dot:hover {
  transform: scale(1.4);
  box-shadow: 0 0 0 4px rgba(6, 69, 173, 0.3);
}
@media (max-width: 768px) {
  .history-timeline {
    padding-left: 1.5rem;
  }
  .history-timeline .timeline-dot {
    left: -1.65rem;
  }
}
html { scroll-behavior: smooth; }