/* Positron Warm Glass V3 — HelpNDoc 10 presentation layer
   Visual language translated from Positron Pixel Foundry MainWindow.xaml.
   Warm burgundy/taupe glass, cream text, champagne accents, restrained sheen.
   Loaded after hnd.css so HelpNDoc/project formatting remains available. */

:root {
  --lm-accent: #ffd9b9;
  --lm-text: #fff7ee;
  --lm-text-strong: #fffaf5;
  --lm-muted: #dcc9ba;
  --lm-edge: rgba(243, 228, 213, .50);       /* XAML GlassEdge #80F3E4D5 */
  --lm-edge-soft: rgba(243, 228, 213, .24);
  --lm-hover: rgba(156, 127, 108, .69);      /* XAML GlassHover #B09C7F6C */
  --lm-field: rgba(72, 48, 48, .65);         /* XAML GlassField #A5483030 */
  --lm-deep: #362426;                         /* XAML WindowBrush */
  --lm-deeper: #291a1c;
  --lm-highlight: #93725e;
  --lm-tooltip: rgba(88, 66, 59, .98);
  --lm-panel-top: rgba(138, 121, 108, .86);  /* GlassPanel */
  --lm-panel-mid: rgba(113, 91, 81, .84);
  --lm-panel-bottom: rgba(94, 69, 64, .84);
  --lm-surface-top: rgba(142, 115, 100, .81);/* GlassSurface */
  --lm-surface-bottom: rgba(76, 40, 43, .83);
  --lm-output-top: rgba(128, 107, 93, .88);
  --lm-output-bottom: rgba(89, 64, 58, .88);
  --lm-preview-top: rgba(117, 106, 97, .79);
  --lm-preview-bottom: rgba(68, 57, 54, .81);
  --lm-sheen-top: rgba(255,255,255,.22);      /* GlassSheen */
  --lm-sheen-mid: rgba(255,255,255,.07);
  --lm-shadow: 0 10px 30px rgba(37, 18, 20, .24);
  --lm-shadow-small: 0 5px 16px rgba(37, 18, 20, .20);
  --lm-radius: 10px;
  --lm-control-radius: 7px;
  --lm-blur: 16px;
  color-scheme: dark;
}

/* Optional light appearance keeps the same warm material language. */
html[data-theme="light"] {
  --lm-text: #3d2929;
  --lm-text-strong: #2f2021;
  --lm-muted: #735d55;
  --lm-edge: rgba(112, 80, 68, .34);
  --lm-edge-soft: rgba(112, 80, 68, .18);
  --lm-hover: rgba(255, 241, 224, .70);
  --lm-field: rgba(255, 245, 235, .66);
  --lm-deep: #ead7c7;
  --lm-deeper: #dcc3b0;
  --lm-highlight: #c5a183;
  --lm-tooltip: rgba(92, 67, 58, .98);
  --lm-panel-top: rgba(255, 245, 235, .76);
  --lm-panel-mid: rgba(239, 220, 205, .72);
  --lm-panel-bottom: rgba(218, 191, 172, .70);
  --lm-surface-top: rgba(255, 247, 239, .82);
  --lm-surface-bottom: rgba(220, 192, 176, .72);
  --lm-output-top: rgba(255, 249, 242, .82);
  --lm-output-bottom: rgba(224, 202, 187, .76);
  --lm-preview-top: rgba(250, 241, 233, .80);
  --lm-preview-bottom: rgba(215, 194, 181, .74);
  --lm-shadow: 0 10px 28px rgba(86, 57, 48, .15);
  --lm-shadow-small: 0 4px 14px rgba(86, 57, 48, .12);
  color-scheme: light;
}

html, body { min-height: 100%; }
html { background: var(--lm-deep); }

body {
  position: relative;
  margin: 0;
  color: var(--lm-text);
  font-family: "Segoe UI", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 18%),
    linear-gradient(101deg, #542e30 0%, #86665a 55%, #baa58e 100%);
  background-attachment: fixed;
}

html[data-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(255,255,255,.34), transparent 20%),
    linear-gradient(101deg, #f3e5d8 0%, #dbc2b1 56%, #c9ab92 100%);
}

/* Very subtle frosted reflection, matching the WPF sheen rather than neon glow. */
body:before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(255,255,255,.10), transparent 35%),
    radial-gradient(ellipse at 92% 100%, rgba(54,36,38,.14), transparent 38%);
}

::selection { background: var(--lm-highlight); color: #fff; }

/* ---------- Shared warm-glass material ---------- */
#topic_header,
#topic_content,
#topic_footer,
body.lm-toc #tabs,
#popupMenu {
  border: 1px solid var(--lm-edge-soft);
  background:
    linear-gradient(180deg, var(--lm-sheen-top) 0, var(--lm-sheen-mid) 18%, rgba(255,255,255,0) 52%),
    linear-gradient(180deg, var(--lm-panel-top) 0%, var(--lm-panel-mid) 35%, var(--lm-panel-bottom) 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), var(--lm-shadow);
  backdrop-filter: blur(var(--lm-blur)) saturate(112%);
  -webkit-backdrop-filter: blur(var(--lm-blur)) saturate(112%);
}

/* ---------- Topic header ---------- */
#topic_header {
  box-sizing: border-box;
  width: calc(100% - 16px);
  margin: 8px 8px 0;
  padding: 13px 16px 12px;
  position: sticky;
  top: 8px;
  z-index: 20;
  border-radius: var(--lm-radius);
}

#topic_header #topic_header_content {
  float: none;
  padding-right: 142px;
}

#topic_header #topic_header_nav {
  float: none;
  position: absolute;
  right: 13px;
  top: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#topic_header h1,
#topic_header #topic_header_text {
  margin: 0;
  color: var(--lm-text-strong);
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(20px, 1.65vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-shadow: 0 1px 0 rgba(54,36,38,.22);
}

#topic_breadcrumb {
  margin-top: 6px;
  color: var(--lm-muted);
  font-size: 12px;
}
#topic_breadcrumb a { color: var(--lm-muted) !important; text-decoration: none; }
#topic_breadcrumb a:hover { color: var(--lm-accent) !important; }

#topic_header_nav a,
.lm-theme-toggle,
.lm-toc-theme-toggle {
  box-sizing: border-box;
  border: 1px solid var(--lm-edge);
  color: var(--lm-text);
  background:
    linear-gradient(180deg, var(--lm-sheen-top), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, var(--lm-surface-top), var(--lm-surface-bottom));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), var(--lm-shadow-small);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, opacity .12s ease, transform .12s ease;
}

#topic_header_nav a,
.lm-theme-toggle {
  width: 33px;
  height: 33px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#topic_header_nav a:hover,
.lm-theme-toggle:hover,
.lm-toc-theme-toggle:hover {
  border-color: var(--lm-accent);
  background:
    linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0) 56%),
    var(--lm-hover);
  transform: translateY(-1px);
}

#topic_header_nav a:active,
.lm-theme-toggle:active,
.lm-toc-theme-toggle:active { opacity: .72; transform: translateY(0); }

#topic_header_nav img {
  margin: 0 !important;
  width: 15px;
  height: 15px;
  opacity: .90;
  filter: sepia(.65) saturate(.45) brightness(1.75);
}
html[data-theme="light"] #topic_header_nav img { filter: sepia(.45) saturate(.6) brightness(.60); }
.lm-theme-toggle { font-size: 16px; line-height: 1; }

/* ---------- Main topic pane: deliberately full-width and left-aligned ---------- */
#topic_content {
  box-sizing: border-box;
  width: calc(100% - 16px) !important;
  max-width: none !important;
  margin: 8px 8px 14px !important;
  padding: 10px 20px 24px !important;
  border-radius: var(--lm-radius);
  min-height: calc(100vh - 150px);
  line-height: 1.22;
}

#topic_content > :first-child { margin-top: 0 !important; }
#topic_content > :last-child { margin-bottom: 0 !important; }

#topic_content h1,
#topic_content h2,
#topic_content h3,
#topic_content h4,
#topic_content h5,
#topic_content h6 {
  color: var(--lm-text-strong);
  font-family: "Segoe UI", sans-serif;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -.01em;
  margin: .92em 0 .32em;
}
#topic_content h1 { font-size: 1.9rem; }
#topic_content h2 {
  font-size: 1.46rem;
  padding-bottom: .34em;
  border-bottom: 1px solid var(--lm-edge-soft);
  color: var(--lm-accent);
}
#topic_content h3 { font-size: 1.20rem; color: #ffe5cf; }
html[data-theme="light"] #topic_content h3 { color: #654438; }
#topic_content h4 { font-size: 1.06rem; }

/* Keep HelpNDoc-authored content close to the compactness of the classic template. */
#topic_content p { margin: 0 0 .14em; }
#topic_content p + p { margin-top: 0; }
#topic_content p + ul,
#topic_content p + ol { margin-top: .10em; }
#topic_content ul + p,
#topic_content ol + p { margin-top: .12em; }
#topic_content ul,
#topic_content ol { margin: .16em 0 .32em 1.48em; }
#topic_content li { margin: 0; }

/* Topic links: typography is normalized at runtime by modern.js so that
   HelpNDoc-generated rvtsXX hyperlink styles cannot change the surrounding
   font family or size. CSS here only provides the requested emphasis. */
#topic_content a {
  color: inherit !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px;
}
#topic_content a:hover {
  color: inherit !important;
  opacity: .82;
  text-decoration: underline !important;
}

#topic_content strong,
#topic_content b { color: var(--lm-text-strong); font-weight: 650; }

#topic_content img {
  max-width: 100%;
  height: auto;
  border-radius: 7px;
  border: 1px solid var(--lm-edge-soft);
  box-shadow: var(--lm-shadow-small);
}

/* Tables intentionally fill the content pane where HelpNDoc permits it. */
#topic_content table {
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: .55em 0 .78em;
  overflow: hidden;
  border: 1px solid var(--lm-edge-soft);
  border-radius: 8px;
  background: rgba(72, 48, 48, .36);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
html[data-theme="light"] #topic_content table { background: rgba(255,245,235,.44); }

#topic_content th,
#topic_content td {
  padding: 8px 10px;
  border-right: 1px solid var(--lm-edge-soft);
  border-bottom: 1px solid var(--lm-edge-soft);
  vertical-align: top;
}
#topic_content th {
  background: rgba(156, 114, 90, .36);
  color: var(--lm-text-strong);
  font-weight: 600;
  text-align: left;
}
#topic_content tr:hover td { background: rgba(255,255,255,.035); }
#topic_content tr:last-child > * { border-bottom: 0; }
#topic_content tr > *:last-child { border-right: 0; }

#topic_content code,
#topic_content kbd,
#topic_content samp,
#topic_content pre {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}
#topic_content :not(pre) > code {
  padding: .12em .36em;
  border: 1px solid var(--lm-edge-soft);
  border-radius: 5px;
  background: var(--lm-field);
  color: #ffe4ca;
}
html[data-theme="light"] #topic_content :not(pre) > code { color: #5b3931; }

#topic_content pre {
  overflow: auto;
  margin: .55em 0 .72em;
  padding: 14px 16px;
  border: 1px solid var(--lm-edge-soft);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), transparent 25%),
    linear-gradient(180deg, rgba(72,48,48,.88), rgba(54,36,38,.94));
  color: #fff1e4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
  tab-size: 4;
}
html[data-theme="light"] #topic_content pre {
  background: linear-gradient(180deg, rgba(255,248,241,.92), rgba(230,211,198,.92));
  color: #3d2929;
}
#topic_content pre code { color: inherit; background: transparent; border: 0; padding: 0; }

#topic_content blockquote {
  margin: .55em 0 .72em;
  padding: 10px 14px;
  border: 1px solid var(--lm-edge-soft);
  border-left: 3px solid var(--lm-accent);
  border-radius: 7px;
  background: rgba(72,48,48,.32);
  color: var(--lm-text);
}
html[data-theme="light"] #topic_content blockquote { background: rgba(255,245,235,.42); }

#topic_content hr {
  border: 0;
  border-top: 1px solid var(--lm-edge-soft);
  margin: 1.8em 0;
}

/* ---------- Footer ---------- */
#topic_footer {
  box-sizing: border-box;
  width: calc(100% - 16px) !important;
  max-width: none !important;
  margin: 0 8px 8px !important;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--lm-muted);
  font-size: 12px;
}
#topic_footer a { color: var(--lm-accent) !important; }

.highlight {
  background: rgba(255, 217, 185, .28);
  color: #fff9f2;
  border: 1px solid rgba(255, 217, 185, .34);
  border-radius: 4px;
  padding: 0 2px;
}
html[data-theme="light"] .highlight { color: #4b302c; }

/* ---------- TOC / Index / Search frame ---------- */
body.lm-toc {
  overflow: hidden;
  padding: 6px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 20%),
    linear-gradient(150deg, #542e30 0%, #75544d 52%, #947b69 100%);
}
html[data-theme="light"] body.lm-toc {
  background:
    linear-gradient(180deg, rgba(255,255,255,.34), transparent 20%),
    linear-gradient(150deg, #f3e5d8 0%, #dbc2b1 55%, #c9ab92 100%);
}

body.lm-toc #tabs {
  position: relative;
  height: calc(100vh - 12px);
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 10px;
}

body.lm-toc #tabs .ui-tabs-nav {
  box-sizing: border-box;
  height: 50px;
  padding: 8px 8px 0;
  border: 0;
  border-bottom: 1px solid var(--lm-edge-soft);
  background: rgba(54, 36, 38, .22) !important;
  white-space: nowrap;
}
body.lm-toc #tabs .ui-tabs-nav li {
  margin: 0 3px 0 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px 7px 0 0;
}
body.lm-toc #tabs .ui-tabs-nav li a {
  color: var(--lm-muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 9px;
  text-shadow: none;
}
body.lm-toc #tabs .ui-tabs-nav li.ui-tabs-selected,
body.lm-toc #tabs .ui-tabs-nav li.ui-state-active {
  border-color: var(--lm-edge-soft);
  border-bottom-color: transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,.13), transparent 70%),
    rgba(72,48,48,.34);
}
body.lm-toc #tabs .ui-tabs-nav li.ui-tabs-selected a,
body.lm-toc #tabs .ui-tabs-nav li.ui-state-active a { color: var(--lm-accent); }

body.lm-toc #tabs .ui-tabs-panel {
  top: 50px;
  padding: 10px 8px 48px;
  background: transparent;
}

body.lm-toc ul.dynatree-container {
  background: transparent;
  color: var(--lm-text);
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.55em;
  border: 0;
}
body.lm-toc span.dynatree-node { display: block; min-height: 25px; }
body.lm-toc span.dynatree-node a {
  color: var(--lm-text);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 2px 5px;
  margin-left: 1px;
  text-decoration: none;
  text-shadow: none;
}
body.lm-toc span.dynatree-node a:hover {
  border-color: var(--lm-edge-soft);
  background: var(--lm-hover);
  color: var(--lm-text-strong);
}
body.lm-toc span.dynatree-active a,
body.lm-toc span.dynatree-focused a {
  border-color: var(--lm-accent) !important;
  background: rgba(147,114,94,.62) !important;
  color: #fffaf5 !important;
  font-weight: 600;
}
html[data-theme="light"] body.lm-toc span.dynatree-active a,
html[data-theme="light"] body.lm-toc span.dynatree-focused a { color: #3d2929 !important; }

body.lm-toc span.dynatree-icon,
body.lm-toc span.dynatree-expander { opacity: .86; }
html:not([data-theme="light"]) body.lm-toc span.dynatree-icon,
html:not([data-theme="light"]) body.lm-toc span.dynatree-expander {
  filter: sepia(.68) saturate(.52) brightness(1.48);
}

body.lm-toc #tab-search form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 3px 1px 2px;
}
body.lm-toc #tab-search label {
  grid-column: 1 / -1;
  color: var(--lm-muted);
  font-size: 12px;
  font-weight: 600;
}
body.lm-toc #search_value {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--lm-edge);
  border-radius: 6px;
  background: var(--lm-field);
  color: var(--lm-text-strong);
  padding: 7px 9px;
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
body.lm-toc #search_value:hover { border-color: rgba(255,240,219,.75); }
body.lm-toc #search_value:focus { border-color: var(--lm-accent); }

body.lm-toc #tab-search input[type="submit"] {
  border: 1px solid var(--lm-edge);
  border-radius: 7px;
  background:
    linear-gradient(180deg, var(--lm-sheen-top), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, var(--lm-surface-top), var(--lm-surface-bottom));
  color: var(--lm-text);
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
body.lm-toc #tab-search input[type="submit"]:hover { border-color: var(--lm-accent); }
body.lm-toc #search_results { padding-top: 11px; color: var(--lm-muted); }
body.lm-toc #search_results a { color: var(--lm-text); }
body.lm-toc #search_results a:hover { color: var(--lm-accent); }

#popupMenu {
  border-radius: 8px;
  padding: 6px;
}
#popupMenu a {
  color: var(--lm-text);
  border-radius: 5px;
  padding: 4px 7px;
  margin: 1px;
}
#popupMenu a:hover { background: var(--lm-hover); color: var(--lm-text-strong); text-decoration: none; }
.close-button { color: var(--lm-muted); }

.lm-toc-theme-toggle {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
  width: 33px;
  height: 33px;
  border-radius: 8px;
}

/* Warm, compact scrollbars. */
* { scrollbar-width: thin; scrollbar-color: rgba(196,168,140,.72) rgba(54,36,38,.18); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: rgba(54,36,38,.16); }
*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(196,168,140,.68);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255,217,185,.82); background-clip: padding-box; }

@media (max-width: 760px) {
  #topic_header {
    position: relative;
    top: 0;
    width: calc(100% - 10px);
    margin: 5px 5px 0;
    padding: 12px 12px 11px;
  }
  #topic_header #topic_header_content { padding-right: 0; }
  #topic_header #topic_header_nav { position: static; margin-top: 10px; justify-content: flex-end; }
  #topic_content {
    width: calc(100% - 10px) !important;
    margin: 5px 5px 8px !important;
    padding: 14px 13px 24px !important;
  }
  #topic_footer {
    width: calc(100% - 10px) !important;
    margin: 0 5px 5px !important;
  }
}

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body:before { display: none !important; }
  #topic_header,
  #topic_content,
  #topic_footer {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    backdrop-filter: none !important;
  }
  #topic_header { position: static; padding: 12px 0 !important; }
  #topic_header_nav, .lm-theme-toggle, .lm-toc-theme-toggle { display: none !important; }
  #topic_content { min-height: 0; padding: 16px 0 !important; }
  #topic_content, #topic_content * { color: #000 !important; }
}
