/*
 * Styles for the legacy static pages (the desktop apps' HTML help in /help, and the policy pages),
 * so they match the Angular site: the same colors, light/dark themes, type, toolbar and margins.
 * The pages get this stylesheet, the toolbar and the footer from scripts/tidy-legacy-pages.py.
 * The theme class on <html> is set by a small inline script that reads the same localStorage key
 * ('isDarkMode') as the main site, so the visitor's choice carries over.
 */

:root,
.light-mode {
  --primary-color: #2d7d9f;
  --primary-color-tint: rgba(45, 125, 159, 0.22);
  --site-bg: #fafafa;
  --site-fg: #16232e;
  --site-muted: #5d6b78;
  --site-surface: #ffffff;
  --site-surface-alt: #f2f5f7;
  --site-line: rgba(22, 35, 46, 0.12);
  --site-toolbar: rgba(250, 250, 250, 0.86);
  color-scheme: light;
}

.dark-mode {
  --primary-color: #6cc5ec;
  --primary-color-tint: rgba(108, 197, 236, 0.22);
  --site-bg: #303030;
  --site-fg: #e7eef4;
  --site-muted: #a3b1bd;
  --site-surface: rgba(255, 255, 255, 0.04);
  --site-surface-alt: rgba(255, 255, 255, 0.07);
  --site-line: rgba(255, 255, 255, 0.14);
  --site-toolbar: rgba(38, 38, 38, 0.86);
  color-scheme: dark;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- toolbar, as on the main site ---------------- */

.legacy-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 32px;
  background: var(--site-toolbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--site-line);
}

.legacy-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--primary-color);
  font-family: "Segoe WPC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 26px;
  white-space: nowrap;
}

.legacy-brand img {
  height: 44px;
  width: auto;
  transition: transform 0.9s cubic-bezier(0.22, 0.68, 0.32, 1);
}

.legacy-brand:hover img {
  transform: rotate(120deg);
}

.legacy-back {
  font-size: 15px;
  font-weight: 500;
  color: var(--site-muted);
  text-decoration: none;
  white-space: nowrap;
}

.legacy-back:hover {
  color: var(--primary-color);
}

/* ---------------- content ---------------- */

.legacy-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 32px 72px 32px;
}

.legacy-page h1,
.legacy-page h2,
.legacy-page h3 {
  color: var(--site-fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.legacy-page h1 {
  font-size: 38px;
  margin: 8px 0 20px 0;
}

.legacy-page h2 {
  font-size: 26px;
  margin: 44px 0 14px 0;
}

.legacy-page h3 {
  font-size: 20px;
  margin: 30px 0 10px 0;
}

/* The old pages underline their headings and set sizes with <font size>; let the headings speak */
.legacy-page h1 u,
.legacy-page h2 u,
.legacy-page h3 u,
.legacy-page p > b > font > u,
.legacy-page p > b > u {
  text-decoration: none;
}

.legacy-page font[size] {
  font-size: inherit;
}

.legacy-page p {
  margin: 0 0 14px 0;
}

.legacy-page a {
  color: var(--primary-color);
  text-underline-offset: 3px;
}

.legacy-page ul,
.legacy-page ol {
  padding-left: 24px;
}

.legacy-page li {
  margin-bottom: 6px;
}

.legacy-page li::marker {
  color: var(--primary-color);
}

.legacy-page hr {
  border: 0;
  border-top: 1px solid var(--site-line);
  margin: 24px 0;
}

.legacy-page img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Figures and screenshots (anything bigger than an icon) get a frame */
.legacy-page img:not([width="32"]):not([width="16"]) {
  border-radius: 8px;
  border: 1px solid var(--site-line);
  margin: 6px 0;
}

.legacy-page table {
  border-collapse: collapse;
  background: var(--site-surface);
  border: 1px solid var(--site-line);
  border-radius: 8px;
  margin: 8px 0 18px 0;
}

.legacy-page td,
.legacy-page th {
  border: 1px solid var(--site-line);
  padding: 6px 12px;
}

/* ---------------- footer ---------------- */

.legacy-footer {
  border-top: 1px solid var(--site-line);
  padding: 22px 32px;
  font-size: 14px;
  color: var(--site-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.legacy-footer a {
  color: var(--site-muted);
  text-decoration: none;
}

.legacy-footer a:hover {
  color: var(--primary-color);
}

/* ---------------- small screens ---------------- */

@media (max-width: 600px) {
  .legacy-bar {
    padding: 0 14px;
  }

  .legacy-brand {
    font-size: 18px;
    gap: 10px;
  }

  .legacy-brand img {
    height: 34px;
  }

  .legacy-page {
    padding: 28px 18px 56px 18px;
  }

  .legacy-page h1 {
    font-size: 30px;
  }
}

@media (max-width: 420px) {
  .legacy-brand span {
    display: none;
  }
}
