/* Theme: Slate — charcoal sidebar, warm cream content, teal accent */
:root {
  /* Sidebar — neutral charcoal, not blue */
  --c-topbar-bg:     #1A1D23;
  --c-side-bg:       #22262E;
  --c-side-border:   #363B44;
  --c-side-section:  #8A8F9A;
  --c-side-link:     #FFFFFF;

  /* Accent — warm teal */
  --c-accent:        #2CB67D;
  --c-accent-text:   #0E1012;

  /* Content headings — dark charcoal, warm tones */
  --c-h1:            #1E2328;
  --c-h1-border:     #D0D4DA;
  --c-h2:            #2E3640;
  --c-h2-border:     #DDE0E5;
  --c-h3:            #505A68;

  /* Content area — warm off-white */
  --c-bg:            #FAFAF8;
  --c-text:          #2A2E35;

  /* Tables */
  --c-th-bg:         #E4E6EA;
  --c-th-text:       #505A68;
  --c-td-border:     #D5D8DE;
  --c-tr-alt:        #F3F4F2;
  --c-tr-hover:      #E8EAE6;

  /* Code */
  --c-code-bg:       #EDEEE8;
  --c-code-text:     #2E3640;
  --c-pre-bg:        #EAECE8;
  --c-pre-text:      #1E2328;

  /* Callout */
  --c-callout-bg:    rgba(44,182,125,0.06);
  --c-callout-border:rgba(44,182,125,0.2);

  /* Footer */
  --c-foot-text:     #8A8F9A;
}
/* ================================================================
   Documentation — Base Structural CSS
   spec-base.css  |  Version 3.1  |  2026-03-20

   All colors come from CSS custom properties defined in theme files.
   NEVER edit colors here — edit in doc/styles/themes/<theme>.css
   ================================================================ */

/* --- Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* ================================================================
   TOP BAR  (top.htm)

   DESIGN RULE: top bar and sidebar title strip use the SAME background
   color (--c-topbar-bg = --c-side-title-bg) so they read as one
   continuous dark panel on the left. The sidebar body is slightly
   lighter (--c-side-bg). There is NO gradient on the top bar.
   ================================================================ */
body.gem-topbar {
  background: var(--c-topbar-bg);
  border-bottom: 1px solid var(--c-side-border);
  overflow: visible;
  min-height: 56px;
  margin: 0;
  padding: 0;
}

.gem-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;           /* allow 2nd row on narrow windows */
  min-height: 56px;
  padding: 4px 14px;
  gap: 4px 8px;
}

.gem-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* GEM logo badge — accent color, matches h1 + sidebar active border */
.gem-header-logo {
  background: var(--c-accent);
  color: var(--c-accent-text);
  font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 2.5px;
  padding: 3px 8px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  line-height: 1;
  flex-shrink: 0;
}

/* Version pill */
.gem-header-version {
  color: rgba(255,255,255,0.75);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  white-space: nowrap;
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
}

/* Section title */
.gem-header-title {
  color: #FFFFFF;
  font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Horizontal nav — styled like sidebar links (not buttons) */
.gem-header-nav {
  display: flex;
  flex-wrap: wrap;           /* nav links wrap to 2nd row on narrow windows */
  gap: 0;
  flex: 1;
  justify-content: center;
}

.gem-header-nav a {
  color: #FFFFFF;
  text-decoration: none;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.gem-header-nav a:hover {
  color: #FFFFFF;
  background: rgba(255,255,255,0.12);
  border-bottom-color: var(--c-accent);
  text-decoration: none;
}

.gem-header-copyright {
  color: rgba(255,255,255,0.65);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 11.5px;
  flex-shrink: 0;
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,0.2);
}


/* ================================================================
   SIDEBAR  (toc.htm)

   DESIGN RULE: sidebar links have a 3px transparent left border
   that becomes --c-accent on hover — the same accent color as
   the GEM badge and the h1 heading color.
   ================================================================ */
body.gem-sidebar {
  background: var(--c-side-bg);
  color: var(--c-side-link);
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 13px;
  margin: 0;
  padding: 0 0 24px 0;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  border-right: 1px solid var(--c-side-border);
}

body.gem-sidebar::-webkit-scrollbar       { width: 5px; }
body.gem-sidebar::-webkit-scrollbar-track { background: var(--c-side-bg); }
body.gem-sidebar::-webkit-scrollbar-thumb { background: var(--c-side-border); border-radius: 3px; }
body.gem-sidebar::-webkit-scrollbar-thumb:hover { background: var(--c-accent); }

/* Title strip — same dark as top bar, forms visual unity */
.gem-toc-title {
  color: #FFFFFF;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 14px 9px 14px;
  background: var(--c-topbar-bg);
  border-bottom: 1px solid var(--c-side-border);
  margin-bottom: 4px;
  letter-spacing: 0.1px;
}

/* Section group labels — tiny muted uppercase (StoredProcs / ezdocs style) */
.gem-toc-section {
  color: var(--c-side-section);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 14px 3px 14px;
  margin-top: 2px;
}

/* Navigation links — 3px left border accent on hover (conquer style) */
body.gem-sidebar a {
  color: var(--c-side-link);
  text-decoration: none;
  display: block;
  padding: 4px 12px 4px 17px;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  line-height: 1.55;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
body.gem-sidebar a:hover {
  background: rgba(255,255,255,0.05);
  color: #FFFFFF;
  border-left-color: var(--c-accent);
  text-decoration: none;
}

/* ================================================================
   CONTENT PAGES  (readme.htm and other content files)

   Light background for readability. Standard blue underlined links
   — hyperlinks in content should look like hyperlinks.
   ================================================================ */
body:not(.gem-topbar):not(.gem-sidebar) {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
  padding: 20px 32px 40px 32px;
}
body.gem-content {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
  padding: 20px 32px 40px 32px;
}

/* ================================================================
   FONT NORMALISATION — override legacy <font face="..."> elements
   and <body TEXT=...> attributes that appear throughout the old HTML.
   The !important is intentional: inline presentation attributes in
   pre-HTML5 content cannot otherwise be overridden by an external sheet.
   code/pre/tt are excluded so monospace blocks keep their fonts.
   ================================================================ */
body:not(.gem-topbar):not(.gem-sidebar) font,
body:not(.gem-topbar):not(.gem-sidebar) basefont {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif !important;
  color: inherit !important;
}

/* ================================================================
   HEADINGS — multiple colors for visual hierarchy.
   h1 uses the theme accent. h2/h3 are progressively lighter shades.
   On light background these must all be dark enough to read (≥4.5:1).
   ================================================================ */
h1 {
  font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--c-h1);
  border-bottom: 2px solid var(--c-h1-border);
  padding-bottom: 5px;
  margin: 24px 0 14px 0;
}
h2 {
  font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--c-h2);
  border-bottom: 1px solid var(--c-h2-border);
  padding-bottom: 3px;
  margin: 22px 0 10px 0;
}
h3 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--c-h3);
  margin: 18px 0 6px 0;
  padding: 0;
  font-style: normal;
}
h4 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-h3);
  margin: 14px 0 4px 0;
  font-style: normal;
  text-decoration: none;
  text-transform: none;
}
h5 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-h3);
  margin: 12px 0 3px 0;
}
h6 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-h3);
  margin: 10px 0 2px 0;
}

/* ================================================================
   CRITICAL FIX: h1/h2/h3 inside old bgcolor=#0066cc section banners
   must render as light text — the normal heading color is too dark.
   ================================================================ */
table[bgcolor="#0066cc"] h1,
table[bgcolor="#0066cc"] h2,
table[bgcolor="#0066cc"] h3,
table[bgcolor="#0066CC"] h1,
table[bgcolor="#0066CC"] h2,
table[bgcolor="#0066CC"] h3 {
  color: #FFFFFF !important;
  border: none !important;
  padding: 4px 0 !important;
  margin: 4px 0 !important;
}
table[bgcolor="#0066cc"] font,
table[bgcolor="#0066CC"] font {
  color: rgba(255,255,255,0.9) !important;
}

/* Restyle legacy blue section-divider tables — match sidebar shade (slightly lighter than topbar) */
table[bgcolor="#0066cc"],
table[bgcolor="#0066CC"] {
  background: var(--c-side-bg) !important;
  border: 1px solid var(--c-side-border) !important;
  border-radius: 4px;
  width: 100% !important;
  margin: 20px 0 12px 0 !important;
}
table[bgcolor="#0066cc"] td,
table[bgcolor="#0066CC"] td {
  background: transparent !important;
  border: none !important;
  color: #FFFFFF !important;
  padding: 10px 16px !important;
  text-align: center;
}

/* ================================================================
   LINKS IN CONTENT — standard blue underlined (web convention).
   Dark backgrounds (sidebar, header) handle their own link styles.
   ================================================================ */
a:link    { color: #1565C0; text-decoration: underline; }
a:visited { color: #1565C0; text-decoration: underline; }
a:hover   { color: #0D3B8E; text-decoration: underline; }

/* Links inside legacy blue-bg section banners */
table[bgcolor="#0066cc"] a,
table[bgcolor="#0066CC"] a {
  color: rgba(255,255,255,0.88) !important;
  text-decoration: underline !important;
}
table[bgcolor="#0066cc"] a:hover,
table[bgcolor="#0066CC"] a:hover {
  color: #FFFFFF !important;
}

/* ================================================================
   TABLES
   ================================================================ */
table {
  border-collapse: collapse;
  width: auto;
  margin: 10px 0 14px 0;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 13.5px;
}
th {
  background: var(--c-th-bg);
  color: var(--c-th-text);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 14px;
  text-align: left;
  border-bottom: 2px solid var(--c-side-border);
}
td {
  padding: 6px 14px;
  border-bottom: 1px solid var(--c-td-border);
  vertical-align: top;
  background: #FFFFFF;
}
tr:nth-child(even) td { background: var(--c-tr-alt); }
tr:hover td           { background: var(--c-tr-hover); }

/* MLPTable classes (kept for compatibility) */
table.MLPTable { border: 1px solid var(--c-td-border); border-collapse: collapse; }
.MLPTableHeaderCells {
  background: var(--c-th-bg) !important; color: var(--c-th-text) !important;
  padding: 7px 14px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--c-td-border); vertical-align: top;
}
.MLPTableCells {
  padding: 6px 14px; font-size: 13px;
  border: 1px solid var(--c-td-border); background: #FFFFFF; vertical-align: top;
}

/* ================================================================
   CODE
   ================================================================ */
code {
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  background: var(--c-code-bg);
  color: var(--c-code-text);
  border: 1px solid var(--c-td-border);
  padding: 1px 5px;
  border-radius: 3px;
}
pre {
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  background: var(--c-pre-bg);
  color: var(--c-pre-text);
  border: 1px solid var(--c-side-border);
  border-radius: 4px;
  padding: 14px 18px;
  overflow-x: auto;
  margin: 12px 0;
  line-height: 1.5;
}
pre code {
  background: none; border: none; padding: 0;
  color: inherit; font-size: inherit;
}

/* ================================================================
   CALLOUT BOXES  (like conquer .callout / markdown blockquotes)
   ================================================================ */
.gem-note, blockquote {
  background: var(--c-callout-bg);
  border: 1px solid var(--c-callout-border);
  border-left: 4px solid var(--c-accent);
  border-radius: 0 4px 4px 0;
  padding: 11px 16px;
  margin: 14px 0;
  font-size: 13.5px;
}
blockquote p { margin: 0; }

/* ================================================================
   LISTS, HR, P
   ================================================================ */
ul, ol  { margin: 5px 0 10px 0; padding-left: 24px; }
li      { margin: 3px 0; line-height: 1.6; }
hr      { border: none; border-top: 1px solid var(--c-td-border); margin: 16px 0; }
p       { margin: 0 0 9px 0; }

/* ================================================================
   PAGE FOOTER (injected by build script)
   ================================================================ */
.gem-page-footer {
  margin-top: 36px;
  padding-top: 10px;
  border-top: 1px solid var(--c-td-border);
  color: var(--c-foot-text);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.6;
}

/* ================================================================
   LEGACY MSO CLASS OVERRIDES (Word-generated content)
   ================================================================ */
p.MsoNormal,li.MsoNormal,div.MsoNormal {
  margin: 0 0 5px 0; font-size: 13.5px;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}
p.MsoBodyText,li.MsoBodyText,div.MsoBodyText,
p.MsoBodyText2,li.MsoBodyText2,div.MsoBodyText2,
p.MsoBodyText3,li.MsoBodyText3,div.MsoBodyText3 {
  font-size: 13.5px; font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  margin: 0 0 6px 0;
}
p.MsoTitle,li.MsoTitle,div.MsoTitle {
  font-size: 22px; font-weight: 700; color: var(--c-h1);
  margin: 0 0 14px 0; font-family: 'Segoe UI', 'Trebuchet MS', Arial, sans-serif;
}
p.MsoSubtitle,li.MsoSubtitle,div.MsoSubtitle {
  font-size: 11px; color: var(--c-h3); text-transform: uppercase;
  letter-spacing: 1.2px; margin: 0 0 14px 0;
}
p.MsoListBullet,li.MsoListBullet,div.MsoListBullet,
p.MsoListBullet2,li.MsoListBullet2,div.MsoListBullet2 {
  font-size: 13.5px; font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}
p.BodyTextSource,li.BodyTextSource,div.BodyTextSource {
  font-family: 'Cascadia Code','Consolas','Courier New',monospace;
  font-size: 12px; background: var(--c-code-bg);
  color: var(--c-code-text); padding: 1px 5px; border-radius: 2px;
}
p.NoteText,li.NoteText,div.NoteText,
p.NoteTextIndent,li.NoteTextIndent,div.NoteTextIndent,
p.NoteTextIndent2,li.NoteTextIndent2,div.NoteTextIndent2 {
  font-style: italic; color: var(--c-h3); font-size: 13px;
}
p.TableHeaderText,li.TableHeaderText,div.TableHeaderText {
  font-weight: 700; font-size: 12.5px; color: var(--c-th-text);
}
p.TableText,li.TableText,div.TableText { font-size: 13px; }
p.SourceText,li.SourceText,div.SourceText {
  font-family: 'Cascadia Code','Consolas','Courier New',monospace;
  font-size: 12px; color: var(--c-pre-text);
}

/* Utility classes (kept from original) */
.menuheader { color: var(--c-accent); font-weight: bold; }
.linkheader  { font-weight: bold; color: var(--c-h2); padding: 8px 0 6px 0; }
.nonlink     { font-weight: bold; }
.padthis     { padding-left: 20px; }
td.indent    { padding-left: 20px; }
.center      { text-align: center; }
.invisible   { display: none; }

/* ================================================================
   SINGLE-PAGE LAYOUT (modern single-file projects — no frameset)

   USAGE: body class="gem-page" — sidebar + content on same page.
   Use .gem-sidebar-panel for the left nav, .gem-content-panel for main.
   .gem-toc-title / .gem-toc-section / .gem-toc-subtitle work inside both
   frameset (body.gem-sidebar) and single-page (.gem-sidebar-panel) layouts.
   ================================================================ */
body.gem-page {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
}

.gem-sidebar-panel {
  width: 240px;
  min-width: 240px;
  background: var(--c-side-bg);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--c-side-border);
  flex-shrink: 0;
  padding-bottom: 24px;
}

.gem-sidebar-panel::-webkit-scrollbar       { width: 5px; }
.gem-sidebar-panel::-webkit-scrollbar-track { background: var(--c-side-bg); }
.gem-sidebar-panel::-webkit-scrollbar-thumb { background: var(--c-side-border); border-radius: 3px; }
.gem-sidebar-panel::-webkit-scrollbar-thumb:hover { background: var(--c-accent); }

/* Version / subtitle strip below the title */
.gem-toc-subtitle {
  color: var(--c-side-section);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 10.5px;
  padding: 5px 14px 8px;
  border-bottom: 1px solid var(--c-side-border);
}

/* Nav links inside single-page sidebar — same rules as body.gem-sidebar a */
.gem-sidebar-panel a:link,
.gem-sidebar-panel a:visited {
  color: var(--c-side-link);
  text-decoration: none;
}
.gem-sidebar-panel a {
  color: var(--c-side-link);
  text-decoration: none;
  display: block;
  padding: 4px 12px 4px 17px;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  line-height: 1.55;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.gem-sidebar-panel a:hover {
  background: rgba(255,255,255,0.05);
  color: #FFFFFF;
  border-left-color: var(--c-accent);
  text-decoration: none;
}

.gem-content-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 32px 40px 32px;
  max-width: 900px;
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  body.gem-topbar  { display: none !important; }
  body.gem-sidebar { display: none !important; }
  body:not(.gem-topbar):not(.gem-sidebar) {
    padding: 0; background: white; color: black;
  }
  h1 { color: black; border-bottom: 1px solid #999; }
  h2 { color: #333; border-bottom: 1px solid #ccc; }
  h3, h4, h5, h6 { color: #444; }
  table  { border: 1px solid #999; }
  th     { background: #eee !important; color: black !important; border: 1px solid #999; }
  td     { border: 1px solid #ccc; background: white !important; }
  a      { color: #1a5ca8; text-decoration: underline; }
  pre    { background: #f5f5f5; color: black; border: 1px solid #ccc; }
  code   { background: #f0f0f0; color: black; border: 1px solid #ddd; }
  .gem-page-footer { color: #666; border-top: 1px solid #ccc; }
  table[bgcolor="#0066cc"], table[bgcolor="#0066CC"] {
    background: #eee !important; border: 1px solid #999 !important;
  }
  table[bgcolor="#0066cc"] td, table[bgcolor="#0066CC"] td,
  table[bgcolor="#0066cc"] h1, table[bgcolor="#0066CC"] h1 {
    color: black !important; border: none !important;
  }
}
