/* ==========================================================================
   ROIDGUIDE — Authentic Wikipedia Reference Encyclopedia Stylesheet
   Pure Wikipedia Vector Theme (Clean, Academic, Minimalist)
   ========================================================================== */

:root {
  /* Classic Wikipedia Color Palette */
  --wiki-bg: #ffffff;
  --wiki-canvas: #f6f6f6;
  --wiki-content-bg: #ffffff;
  --wiki-sidebar-bg: #f8f9fa;
  --wiki-subtle-bg: #f8f9fa;
  
  --wiki-border: #a2a9b1;
  --wiki-border-light: #c8ccd1;
  --wiki-border-hairline: #eaecf0;
  
  --wiki-text-main: #202122;
  --wiki-text-muted: #54595d;
  
  --wiki-link: #0645ad;
  --wiki-link-visited: #0b0080;
  --wiki-link-hover: #3366cc;
  --wiki-link-red: #ba0000;
  
  --wiki-header-bg: #eaecf0;
  --wiki-infobox-bg: #f8f9fa;
  --wiki-ambox-orange: #f28500;
  --wiki-ambox-blue: #36c;
  
  --font-serif: "Linux Libertine", "Georgia", "Times New Roman", Times, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Lato", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Menlo", "Consolas", "Courier New", monospace;
  
  --sidebar-width: 260px;
}

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

body {
  background-color: var(--wiki-canvas);
  color: var(--wiki-text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Hyperlinks */
a {
  color: var(--wiki-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:visited {
  color: var(--wiki-link-visited);
}

/* ==========================================================================
   Header Bar (Classic Wikipedia Vector Navigation)
   ========================================================================== */
.wiki-header {
  background: #ffffff;
  border-bottom: 1px solid var(--wiki-border);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.wiki-brand {
  display: flex;
  align-items: center;
}

.wiki-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.wiki-brand-link:hover {
  text-decoration: none;
}

.wiki-brand-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.wiki-brand-link:hover .wiki-brand-icon {
  transform: rotate(3deg);
}

.wiki-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.wiki-wordmark {
  font-family: 'Linux Libertine', Georgia, 'Times New Roman', serif;
  font-size: 21px;
  font-weight: 700;
  color: #111111;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wiki-tagline {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 9.5px;
  color: #54595d;
  letter-spacing: 0.03em;
  text-transform: none;
  margin-top: 2px;
  font-style: italic;
  font-weight: 400;
}

.wiki-header-center {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.wiki-tab {
  display: inline-block;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--wiki-link);
  background: #f8f9fa;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
  border-radius: 2px 2px 0 0;
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.wiki-tab:hover {
  background: #ffffff;
  text-decoration: none;
  color: var(--wiki-link-hover);
}
.wiki-tab.active {
  background: #ffffff;
  color: #202122;
  font-weight: 600;
  border-color: var(--wiki-border);
  border-bottom: 1px solid #ffffff;
  position: relative;
  z-index: 2;
}

/* ==========================================================================
   Wikipedia Search Bar & Autocomplete Dropdown
   ========================================================================== */
.wiki-search-wrap {
  position: relative;
  width: 380px;
  max-width: 100%;
}

.wiki-search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #72777d;
  border-radius: 2px;
  height: 34px;
  width: 100%;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wiki-search-box:focus-within {
  border-color: #3366cc;
  box-shadow: inset 0 0 0 1px #3366cc, 0 0 0 2px rgba(51, 102, 204, 0.15);
}

.wiki-search-icon-svg {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 10px;
  flex-shrink: 0;
  transition: fill 0.15s ease;
}
.wiki-search-box:focus-within .wiki-search-icon-svg {
  fill: #3366cc;
}

.wiki-search-input {
  border: none;
  background: transparent;
  padding: 6px 6px 6px 0;
  font-size: 13.5px;
  color: #202122;
  flex: 1;
  min-width: 0;
  outline: none;
  font-family: inherit;
}
.wiki-search-input::placeholder {
  color: #72777d;
  font-size: 12.5px;
}

.wiki-search-shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #72777d;
  background: #f8f9fa;
  border: 1px solid #c8ccd1;
  border-radius: 3px;
  padding: 1px 6px;
  margin-right: 6px;
  line-height: 1.2;
  user-select: none;
  pointer-events: none;
  flex-shrink: 0;
}
.wiki-search-box:focus-within .wiki-search-shortcut {
  display: none;
}

.wiki-search-clear {
  background: transparent;
  border: none;
  color: #72777d;
  cursor: pointer;
  padding: 4px;
  margin-right: 4px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background-color 0.12s, color 0.12s;
}
.wiki-search-clear:hover {
  background-color: #eaecf0;
  color: #ba0000;
}

.wiki-search-btn {
  background: #f8f9fa;
  border: none;
  border-left: 1px solid #c8ccd1;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #202122;
  height: 100%;
  cursor: pointer;
  border-radius: 0 2px 2px 0;
  transition: background-color 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wiki-search-btn:hover {
  background: #eaecf0;
  color: #000000;
}
.wiki-search-btn:active {
  background: #dadde3;
}

/* Dropdown Menu (Wikipedia Vector Autocomplete Style) */
.wiki-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 480px;
  max-width: calc(100vw - 28px);
  background: #ffffff;
  border: 1px solid #a2a9b1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  max-height: 480px;
  overflow-y: auto;
  z-index: 4000;
  animation: searchDropdownFade 0.12s ease-out;
}
@keyframes searchDropdownFade {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-dropdown-section {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #54595d;
  background: #f8f9fa;
  padding: 7px 12px;
  border-top: 1px solid var(--wiki-border-hairline);
  letter-spacing: 0.05em;
}
.search-dropdown-section:first-child {
  border-top: none;
}
.search-dropdown-section .section-icon {
  font-size: 12px;
  line-height: 1;
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-decoration: none;
  color: #202122;
  border-bottom: 1px solid var(--wiki-border-hairline);
  cursor: pointer;
  transition: background-color 0.1s, border-left 0.1s;
  border-left: 3px solid transparent;
}
.search-dropdown-item:last-child {
  border-bottom: none;
}
.search-dropdown-item:hover,
.search-dropdown-item.keyboard-active {
  background-color: #f0f4f8;
  text-decoration: none;
  border-left-color: #3366cc;
}

.search-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #e0f2fe;
  color: #0369a1;
}
.search-item-icon svg {
  width: 16px;
  height: 16px;
}
.search-item-icon.icon-term {
  background: #fef3c7;
  color: #92400e;
}
.search-item-icon.icon-quick {
  background: #f3f4f6;
  color: #4b5563;
}

.search-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.search-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0645ad;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-title strong {
  color: #0b0080;
  background-color: #e8f0fe;
  padding: 0 2px;
  border-radius: 2px;
}
.search-dropdown-item:hover .search-item-title,
.search-dropdown-item.keyboard-active .search-item-title {
  color: #3366cc;
}

.search-item-sub {
  font-size: 11.5px;
  color: #54595d;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.search-item-badge {
  font-size: 9.5px;
  font-weight: 600;
  background: #f0f4f8;
  color: #0369a1;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid #bae6fd;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}
.search-item-badge.badge-term {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.search-item-badge.badge-quick {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

.search-dropdown-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #ffffff;
  border-top: 1px solid var(--wiki-border-light);
  color: #0645ad;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.1s;
}
.search-dropdown-action:hover {
  background: #eaecf0;
  color: #3366cc;
  text-decoration: none;
}

.search-dropdown-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: #54595d;
  line-height: 1.4;
}
.search-dropdown-empty strong {
  color: #202122;
}

.search-dropdown-footer {
  padding: 7px 12px;
  background: #f8f9fa;
  border-top: 1px solid var(--wiki-border-light);
  font-size: 11px;
  color: #72777d;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-dropdown-footer kbd {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 4px;
  background: #ffffff;
  border: 1px solid #c8ccd1;
  border-radius: 2px;
  color: #54595d;
}

/* ==========================================================================
   2-Column Layout (Sidebar + Wikipedia Content Pane)
   ========================================================================== */
.wiki-container {
  display: flex;
  max-width: 1560px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
  background: #ffffff;
  border-left: 1px solid var(--wiki-border-light);
  border-right: 1px solid var(--wiki-border-light);
}

/* Left Sidebar Navigation */
.wiki-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--wiki-sidebar-bg);
  border-right: 1px solid var(--wiki-border-light);
  padding: 16px 14px;
  height: calc(100vh - 52px);
  position: sticky;
  top: 52px;
  overflow-y: auto;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--wiki-text-muted);
  letter-spacing: 0.5px;
  margin-top: 14px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--wiki-border-light);
}
.sidebar-heading:first-child {
  margin-top: 0;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}

.sidebar-list li {
  margin-bottom: 2px;
}

.sidebar-link {
  display: block;
  padding: 3px 6px;
  font-size: 12.5px;
  color: var(--wiki-link);
  border-radius: 2px;
}
.sidebar-link:hover {
  background-color: #eaecf0;
  text-decoration: underline;
}
.sidebar-link.active {
  font-weight: bold;
  color: #000000;
  background-color: #eaecf0;
}

/* Main Content Pane */
.wiki-main {
  flex: 1;
  padding: 24px 36px;
  background: #ffffff;
  min-width: 0;
}

/* ==========================================================================
   Standard Wikipedia Typography & Section Headers
   ========================================================================== */
h1.firstHeading {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.25;
  color: #000000;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--wiki-border);
}

#siteSub {
  font-size: 12px;
  color: var(--wiki-text-muted);
  margin-bottom: 16px;
}

h2.wiki-h2 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 400;
  color: #000000;
  margin-top: 28px;
  margin-bottom: 12px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--wiki-border);
}

h3.wiki-h3 {
  font-size: 15px;
  font-weight: bold;
  color: #000000;
  margin-top: 18px;
  margin-bottom: 8px;
}

p.wiki-lead {
  font-size: 14.5px;
  line-height: 1.7;
  margin-bottom: 14px;
  color: #202122;
}

p {
  margin-bottom: 12px;
  line-height: 1.65;
}

/* ==========================================================================
   Wikipedia Article Message Box (.ambox)
   ========================================================================== */
.ambox {
  border: 1px solid var(--wiki-border);
  border-left: 10px solid var(--wiki-ambox-orange);
  background-color: #fbfbfb;
  margin: 16px 0;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 13px;
}
.ambox-notice {
  border-left-color: var(--wiki-ambox-blue);
}
.ambox-icon {
  font-size: 22px;
  line-height: 1;
}
.ambox-text h4 {
  font-size: 13.5px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #111111;
}

/* ==========================================================================
   Wikipedia Table of Contents (.toc)
   ========================================================================== */
.toc {
  background-color: var(--wiki-subtle-bg);
  border: 1px solid var(--wiki-border);
  padding: 10px 16px;
  font-size: 13px;
  display: table;
  margin: 16px 0 20px 0;
  min-width: 240px;
}
.toctitle {
  text-align: center;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--wiki-border-light);
}
.toc ol {
  padding-left: 18px;
  margin: 0;
}
.toc li {
  margin: 4px 0;
}

/* ==========================================================================
   Wikipedia Floating Infobox (.infobox)
   ========================================================================== */
.infobox {
  float: right;
  clear: right;
  margin: 0 0 16px 20px;
  width: 320px;
  background-color: var(--wiki-infobox-bg);
  border: 1px solid var(--wiki-border);
  padding: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.infobox-header {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  background-color: var(--wiki-header-bg);
  padding: 6px;
  border: 1px solid var(--wiki-border-light);
  margin-bottom: 6px;
}

.infobox-radar-wrap {
  width: 100%;
  height: 220px;
  position: relative;
  background: #ffffff;
  border: 1px solid var(--wiki-border-light);
  margin-bottom: 6px;
  padding: 4px;
}

.infobox-table {
  width: 100%;
  border-collapse: collapse;
}
.infobox-table th {
  text-align: left;
  vertical-align: top;
  padding: 4px 6px;
  font-weight: bold;
  width: 42%;
  border-bottom: 1px solid var(--wiki-border-hairline);
  color: #333333;
}
.infobox-table td {
  padding: 4px 6px;
  vertical-align: top;
  border-bottom: 1px solid var(--wiki-border-hairline);
}

/* ==========================================================================
   Wikipedia Standard Tables (.wikitable)
   ========================================================================== */
.wikitable {
  background-color: #ffffff;
  border: 1px solid var(--wiki-border);
  border-collapse: collapse;
  margin: 16px 0;
  width: 100%;
  font-size: 13px;
}

.wikitable th {
  background-color: var(--wiki-header-bg);
  border: 1px solid var(--wiki-border);
  padding: 6px 10px;
  font-weight: bold;
  text-align: left;
}

.wikitable td {
  border: 1px solid var(--wiki-border);
  padding: 6px 10px;
}

.wikitable tr:nth-child(even) {
  background-color: var(--wiki-subtle-bg);
}

/* Callout Box */
.wiki-callout {
  background: #f8f9fa;
  border: 1px solid var(--wiki-border-light);
  border-left: 4px solid #36c;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 13px;
}
.wiki-callout.warning {
  border-left-color: var(--wiki-ambox-orange);
  background: #fffdfa;
}

/* ==========================================================================
   Space-Efficient Horizontal Family Tree Container
   ========================================================================== */
.horizontal-tree-container {
  width: 100%;
  min-height: 480px;
  height: auto;
  border: 1px solid var(--wiki-border);
  background: #ffffff;
  position: relative;
  margin: 16px 0;
  overflow-x: auto;
}

/* ==========================================================================
   Compound Comparator
   ========================================================================== */
.comparator-panel {
  background: #ffffff;
  border: 1px solid var(--wiki-border);
  padding: 18px;
  margin: 16px 0;
}

.comparator-selectors {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid var(--wiki-border-light);
}

.comparator-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--wiki-border);
  font-size: 13px;
  background: #ffffff;
}

.comparator-chart-wrap {
  width: 100%;
  height: 360px;
  position: relative;
  margin: 20px 0;
  background: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .wiki-container {
    flex-direction: column;
  }
  .wiki-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--wiki-border-light);
  }
  .infobox {
    float: none;
    width: 100%;
    margin: 16px 0;
  }
}

@media (max-width: 768px) {
  .wiki-header {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  .wiki-header-center {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .wiki-search-wrap {
    order: 2;
    width: 100%;
    max-width: 100%;
  }
  .wiki-search-dropdown {
    width: 100%;
    max-width: 100%;
    right: 0;
    left: 0;
  }
  .wiki-main {
    padding: 16px 14px 40px;
  }
}

/* ==========================================================================
   Wikipedia-Style Hovercard / Preview Popover
   ========================================================================== */
.wiki-preview-popover {
  position: absolute;
  z-index: 2500;
  background: #ffffff;
  border: 1px solid var(--wiki-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  width: 320px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #202122;
  display: none;
  pointer-events: auto;
}

.wiki-preview-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--wiki-border-hairline);
  padding-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wiki-preview-badge {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  background: #eaecf0;
  color: #333333;
  padding: 1px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wiki-preview-desc {
  margin: 6px 0 8px 0;
  color: #333333;
}

.wiki-preview-footer {
  font-size: 11px;
  border-top: 1px solid var(--wiki-border-hairline);
  padding-top: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wiki-preview-footer a {
  font-weight: 700;
}

/* Term and Compound Inline Links */
.wiki-term-link {
  color: #0645ad;
  border-bottom: 1px dotted #72777d;
  text-decoration: none;
}
.wiki-term-link:hover {
  text-decoration: none;
  border-bottom-style: solid;
  color: #3366cc;
}

.wiki-compound-link {
  color: #0645ad;
  text-decoration: none;
}
.wiki-compound-link:hover {
  text-decoration: underline;
  color: #3366cc;
}

/* ==========================================================================
   Glossary Page & Index Styles
   ========================================================================== */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.glossary-card {
  background: #ffffff;
  border: 1px solid var(--wiki-border);
  padding: 14px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.glossary-card:hover {
  border-color: #72777d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.glossary-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--wiki-border-hairline);
  padding-bottom: 4px;
}

.glossary-card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #0645ad;
  text-decoration: none;
}
.glossary-card-title:hover {
  text-decoration: underline;
}

.glossary-card-desc {
  font-size: 12.5px;
  color: #333333;
  margin-bottom: 10px;
  line-height: 1.5;
}

.glossary-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.glossary-pill {
  font-size: 10px;
  background: #f0f4f8;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 2px;
  text-decoration: none;
  border: 1px solid #bae6fd;
}
.glossary-pill:hover {
  background: #e0f2fe;
  text-decoration: none;
}

