/* Modern aesthetic override for legacy algorithm docs/tutorial pages.
   These legacy pages are standalone HTML files under static/algorithms/*/...
   They use older CSS and markup, so we override key typography/layout bits here. */

:root {
  --doc-text: #1f2937;
  --doc-heading: #0f172a;
  --doc-link: #2563eb;
  --doc-accent: #3b82f6;
  --doc-muted: #6b7280;
  --doc-lead-bg: #f8fafc;
  --doc-lead-border: #e2e8f0;
}

:root {
  --doc-text: #1f2937;
  --doc-heading: #0f172a;
  --doc-link: #2563eb;
  --doc-accent: #3b82f6;
  --doc-muted: #6b7280;
  --doc-lead-bg: #f8fafc;
  --doc-lead-border: #e2e8f0;
}

body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--doc-text);
  line-height: 1.65;
  background: #ffffff;
}

/* Legacy standalone docs include their own top bar.
   Replace the dark legacy header with a light, modern-looking one. */
#topbar {
  background: var(--doc-lead-bg) !important;
  padding: 16px 16px 14px 16px !important;
  border: 1px solid var(--doc-lead-border) !important;
  border-radius: 10px !important;
  max-width: 980px !important;
  margin: 0 auto 18px auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

/* Show legacy header controls (they already contain the links we want). */
#home_panel {
  display: block !important;
  text-align: center;
  order: 3;
  margin-top: 8px;
}

#navbar_server {
  display: block !important;
  text-align: center;
  order: 2;
}

/* Make the header links match the modern palette and sizing. */
#navbar_server h3 {
  margin: 10px 0 0 0;
  font-weight: 500;
  color: var(--doc-heading);
}

#navbar_server h3 a {
  color: #1d4ed8 !important; /* dark blue */
  text-decoration: none !important;
}

#navbar_server h3 a:hover {
  color: #1e40af !important; /* darker blue hover */
  text-decoration: underline !important;
}

#home_panel a {
  color: #1d4ed8 !important; /* dark blue */
  text-decoration: none !important;
}

#home_panel a:hover {
  color: #1e40af !important; /* darker blue hover */
  text-decoration: underline !important;
}

#title_server {
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

/* Common doc containers used by the legacy static pages */
#welcome_docs,
#welcome_server {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 8px 32px 8px;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* Legacy topbar typography to match the modern dark header tone */
#title_server h1 {
  margin: 0;
  padding: 0;
  font-size: 2rem;
  color: var(--doc-heading);
  font-weight: 700;
}

#navbar_server h3 {
  color: var(--doc-heading) !important;
  font-weight: 500;
}

#navbar_server h3 a {
  color: #1d4ed8 !important; /* dark blue */
  text-decoration: none !important;
}

/* Titles / section headers inside the legacy right column */
#right_column h2,
#welcome_docs h2 {
  margin: 0 0 10px 0;
  color: var(--doc-heading);
  font-size: 2rem;
  font-weight: 600;
}

/* Make the main documentation area feel like a “lead box”. */
#right_column {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

#right_column h3,
#welcome_docs h3 {
  margin: 26px 0 8px 0;
  color: var(--doc-heading);
  font-size: 1.2rem;
  border-left: 4px solid var(--doc-accent);
  padding-left: 10px;
  font-weight: 600;
}

#right_column h4,
#welcome_docs h4 {
  margin: 28px 0 8px 0;
  color: var(--doc-heading);
  font-size: 1.2rem;
  border-left: 4px solid var(--doc-accent);
  padding-left: 10px;
  font-weight: 600;
}

#right_column p,
#welcome_docs p {
  margin: 10px 0;
  text-align: justify;
}

#right_column ul,
#right_column ol,
#welcome_docs ul,
#welcome_docs ol {
  padding-left: 40px;
}

#right_column li,
#welcome_docs li {
  margin: 6px 0;
}

#right_column a:not(.btn),
#welcome_docs a:not(.btn) {
  color: var(--doc-link) !important;
  text-decoration: none !important;
}

#right_column a:not(.btn):hover,
#welcome_docs a:not(.btn):hover {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
}

/* The legacy docs use a left/right table-of-contents (dl/dt). */
#right_column dl {
  margin: 8px 0 16px 0;
  padding-left: 0;
}

#right_column dl dt {
  margin: 6px 0;
  font-weight: 400;
}

/* Legacy image wrappers */
#docs_image2 img,
img.centered,
img.centerSmall {
  display: block;
  margin: 10px auto;
  max-width: 860px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Footer text tone */
#footer_docs,
#welcome_docs #footer_docs {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 8px 40px 8px;
  color: var(--doc-muted);
}

/* Ensure CSS variables are defined (legacy file had a `::root` typo). */
:root {
  --doc-text: #1f2937;
  --doc-heading: #0f172a;
  --doc-link: #2563eb;
  --doc-accent: #3b82f6;
  --doc-muted: #6b7280;
  --doc-lead-bg: #f8fafc;
  --doc-lead-border: #e2e8f0;
}

