/* ===========================================================
   Guidelines for Semantic Models in the IoP — Documentation Site
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --paper: #F5F6F3;
  --surface: #FFFFFF;
  --surface-2: #EEF0EC;
  --ink: #14181C;
  --ink-soft: #565F68;
  --ink-faint: #8A929B;
  --border: #DDE1DD;
  --border-strong: #C7CCC6;

  --accent: #1B5E6B;
  --accent-strong: #0E3D46;
  --accent-soft: #E4EEEC;
  --accent-contrast: #FFFFFF;

  --gold: #93691F;
  --gold-soft: #F6EEDC;
  --indigo: #3D4C8C;
  --indigo-soft: #E9EBF6;

  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 14px;

  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --sidebar-w: 302px;
  --content-max: 740px;
  --body-scale: 1;
  --prose-width: 68ch;

  color-scheme: light;
}

html.dark{
  --paper: #14171A;
  --surface: #1B1F23;
  --surface-2: #22262B;
  --ink: #ECEEF0;
  --ink-soft: #ABB2B9;
  --ink-faint: #767F87;
  --border: #2B3035;
  --border-strong: #383E44;

  --accent: #59B4A6;
  --accent-strong: #7FCBBE;
  --accent-soft: #1D3330;
  --accent-contrast: #08201C;

  --gold: #D9B45E;
  --gold-soft: #2E2717;
  --indigo: #9AA6E0;
  --indigo-soft: #22263F;

  color-scheme: dark;
}

html.width-narrow{ --content-max: 600px; --prose-width: 54ch; }
html.width-normal{ --content-max: 740px; --prose-width: 68ch; }
html.width-wide{ --content-max: 920px; --prose-width: 88ch; }
html.text-small{ --body-scale: 0.9; }
html.text-normal{ --body-scale: 1; }
html.text-large{ --body-scale: 1.15; }

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

/* view transitions (page swap animation) */
@media (prefers-reduced-motion: no-preference){
  ::view-transition-old(root){
    animation: page-out 140ms cubic-bezier(0.4,0,1,1) both;
  }
  ::view-transition-new(root){
    animation: page-in 180ms cubic-bezier(0,0,0.2,1) both;
  }
}
@keyframes page-out{
  to{ opacity: 0; transform: translateY(-6px); }
}
@keyframes page-in{
  from{ opacity: 0; transform: translateY(6px); }
}


html{ scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a{ color: var(--accent); text-decoration-thickness: 1px; }
a:hover{ color: var(--accent-strong); }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button{ font-family: inherit; }

/* ---------------- progress bar ---------------- */
#progress-bar{
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 200;
  transition: width 80ms linear;
}
#page-progress{
  position: fixed;
  top: 3px; left: 0;
  height: 2px;
  width: 0%;
  background: var(--gold);
  z-index: 199;
  opacity: 0.7;
  transition: width 60ms linear;
}

/* ---------------- top bar (mobile) ---------------- */
#topbar{
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
#topbar .brand{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  width: 38px; height: 38px;
  border-radius: var(--radius-s);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn:hover{ background: var(--surface-2); }
.icon-btn svg{ width: 18px; height: 18px; }

/* ---------------- layout shell ---------------- */
#app{
  display: flex;
  min-height: 100vh;
}

/* ---------------- sidebar ---------------- */
#sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header{
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.sidebar-header:hover .kicker{ color: var(--accent-strong); }
.sidebar-header .kicker{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0 0 6px;
}
.sidebar-header h1{
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.28;
  font-weight: 600;
  margin: 0 0 4px;
}
.sidebar-header .subtitle{
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}

.sidebar-controls{
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

#search-box{
  position: relative;
  flex: 1;
}
#search-input{
  width: 100%;
  padding: 9px 40px 9px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  font-family: var(--font-ui);
}
#search-input:focus{ border-color: var(--accent); }
#search-box svg{
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink-faint);
  pointer-events: none;
}
.kbd-hint{
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--surface);
  pointer-events: none;
}
#search-count{
  font-size: 11px;
  color: var(--ink-faint);
  padding: 6px 4px 0;
}
.toc-empty{
  margin: 10px 4px 0;
  padding: 14px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-m);
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.toc-empty strong{ color: var(--ink); }

#theme-toggle{ flex-shrink: 0; }

/* display settings popover (width / text size) */
#display-settings{ position: relative; flex-shrink: 0; }
#display-settings-panel{
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  padding: 14px;
  z-index: 120;
}
#display-settings-panel.show{ display: block; }
.settings-group{ margin-bottom: 12px; }
.settings-group:last-child{ margin-bottom: 0; }
.settings-label{
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin: 0 0 7px;
}
.settings-options{
  display: flex;
  gap: 6px;
}
.settings-opt{
  flex: 1;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 0;
  border-radius: var(--radius-s);
  cursor: pointer;
  text-align: center;
}
.settings-opt:hover{ border-color: var(--accent); }
.settings-opt.active{ background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.settings-options[data-setting="text"] .settings-opt:nth-child(1){ font-size: 11px; }
.settings-options[data-setting="text"] .settings-opt:nth-child(2){ font-size: 14px; }
.settings-options[data-setting="text"] .settings-opt:nth-child(3){ font-size: 17px; }

nav#toc{
  overflow-y: auto;
  flex: 1;
  padding: 10px 10px 30px;
}
nav#toc::-webkit-scrollbar{ width: 8px; }
nav#toc::-webkit-scrollbar-thumb{ background: var(--border-strong); border-radius: 4px; }

.toc-group{ margin-bottom: 2px; }

.toc-link{
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-s);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.35;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.toc-link .num{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-right: 7px;
}
.toc-link:hover{ background: var(--surface-2); color: var(--ink); }
.toc-link.level-1{ font-weight: 600; color: var(--ink); margin-top: 10px; }
.toc-link.level-2{ padding-left: 22px; }
.toc-link.level-3{ padding-left: 34px; font-size: 12.8px; }
.toc-link.active{
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-left-color: var(--accent);
  font-weight: 600;
}
.toc-link mark{
  background: var(--gold-soft);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.toc-link.hidden{ display: none !important; }
.toc-link.toc-home{
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.toc-link.toc-graph{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent-strong);
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.toc-link.toc-graph svg{ width: 15px; height: 15px; flex-shrink: 0; }
.toc-link.toc-graph:hover{ background: var(--accent-soft); }

.sidebar-footer{
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.sidebar-footer a{ color: var(--ink-soft); }

/* ---------------- overlay (mobile sidebar) ---------------- */
#overlay{
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,12,14,0.45);
  z-index: 149;
}
#overlay.show{ display: block; }

/* ---------------- main content ---------------- */
#main{
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 56px 32px 140px;
}

#content{
  width: 100%;
  max-width: var(--content-max);
}

.doc-header{
  margin-bottom: 44px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.doc-header .kicker{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 14px;
}
.doc-header h1{
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1.12;
  font-weight: 600;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.doc-header .lede{
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 0 20px;
}
.doc-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 13px;
  color: var(--ink-faint);
}
.doc-meta strong{ color: var(--ink-soft); font-weight: 600; }

.start-reading{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  border-radius: var(--radius-m);
}
.start-reading:hover{ background: var(--accent-strong); color: var(--accent-contrast); }
.start-reading span{ transition: transform 150ms ease; }
.start-reading:hover span{ transform: translateX(3px); }

.graph-cta{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  margin-left: 12px;
  padding: 11px 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius-m);
}
.graph-cta:hover{ border-color: var(--accent); background: var(--accent-soft); }
.graph-cta svg{ width: 16px; height: 16px; flex-shrink: 0; }

.doc-cards-label{
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin: 34px 0 12px;
}

.doc-cards{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 0;
}
.doc-card{
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px 16px 15px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.doc-card:hover{ border-color: var(--accent); }
.doc-card .n{ font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.doc-card h3{ font-size: 14.5px; margin: 6px 0 4px; font-weight: 600; }
.doc-card p{ font-size: 12.5px; color: var(--ink-soft); margin: 0; line-height: 1.4; }

/* page (single-section view) */
.page{
  scroll-margin-top: 24px;
}
.breadcrumb{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.breadcrumb a{ color: var(--ink-faint); text-decoration: none; }
.breadcrumb a:hover{ color: var(--accent); }
.breadcrumb .sep{ margin: 0 7px; color: var(--border-strong); }

.page-title{
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 30px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.25;
  scroll-margin-top: 24px;
}
.page-title .num{
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
  font-size: 23px;
}
.page-title:hover .anchor-link{ opacity: 1; }

/* page toolbar: copy link / copy as markdown */
.page-toolbar{
  display: flex;
  gap: 8px;
  margin: -14px 0 26px;
}
.toolbar-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
}
.toolbar-btn:hover{ border-color: var(--accent); color: var(--accent-strong); }
.toolbar-btn svg{ width: 13px; height: 13px; }

/* feedback widget */
.feedback{
  margin-top: 40px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.feedback-q{
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
}
.feedback-btns{ display: flex; gap: 8px; }
.fb-btn{
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
}
.fb-btn:hover{ border-color: var(--accent); }
.fb-btn.selected{ background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.fb-btn:disabled{ cursor: default; opacity: 0.6; }
.feedback-thanks{
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--accent-strong);
  margin: 0;
}

/* toast */
#toast{
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 20px;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
html.dark #toast{ background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-strong); }
#toast.show{ opacity: 1; transform: translateX(-50%) translateY(0); }

/* command palette */
#cmdk-overlay{
  display: none;
  position: fixed; inset: 0;
  background: rgba(8,10,12,0.5);
  z-index: 350;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
#cmdk-overlay.show{ display: flex; }
#cmdk-box{
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border-radius: var(--radius-l);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
}
#cmdk-input-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
#cmdk-input-row svg{ width: 16px; height: 16px; color: var(--ink-faint); flex-shrink: 0; }
#cmdk-input{
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
}
#cmdk-results{
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-item{
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  cursor: pointer;
}
.cmdk-item .cmdk-title{
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.cmdk-item .cmdk-num{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  margin-right: 6px;
}
.cmdk-item .cmdk-crumb{
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}
.cmdk-item .cmdk-snippet{
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-top: 4px;
}
.cmdk-item .cmdk-snippet mark{
  background: var(--gold-soft);
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 600;
}
.cmdk-item.active{ background: var(--accent-soft); }
.cmdk-empty{
  padding: 24px 12px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  font-family: var(--font-ui);
}

.child-index{ margin: 4px 0 20px; }

/* ---------------- ontology graph explorer ---------------- */
.graph-page .page-title{ margin-bottom: 14px; }

/* workflow progress tracker */
.progress-page .page-title{ margin-bottom: 14px; }
.progress-summary{
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 18px;
}
.progress-bar-track{
  flex: 1;
  height: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar-fill{
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 300ms ease;
}
.progress-summary-text{
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.progress-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-row{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}
.progress-row.is-done{ background: var(--accent-soft); border-color: var(--accent); }
.progress-checkbox{
  position: relative;
  width: 20px; height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.progress-checkbox input{
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.progress-checkbox input:disabled{ cursor: default; }
.progress-check-mark{
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--paper);
}
.progress-checkbox input:checked ~ .progress-check-mark{
  background: var(--accent);
  border-color: var(--accent);
}
.progress-checkbox input:checked ~ .progress-check-mark::after{
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.progress-row-body{
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.progress-num{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
}
.progress-title{
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink);
}
.progress-badge{
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.progress-badge.is-done{ background: var(--accent); color: var(--accent-contrast); }
.progress-badge.is-pending{ background: var(--surface-2); color: var(--ink-faint); }
.progress-link{
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.progress-link:hover{ text-decoration: underline; }

@media (max-width: 700px){
  .progress-row{ flex-wrap: wrap; }
  .progress-row-body{ flex-basis: 100%; order: 1; }
  .progress-link{ order: 2; }
}
.graph-intro{
  font-family: var(--font-ui) !important;
  font-size: 14.5px !important;
  color: var(--ink-soft);
  max-width: 72ch;
  line-height: 1.55;
  margin: 0 0 22px !important;
}
.graph-tabs{
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.graph-tab{
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 4px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.graph-tab:hover{ color: var(--ink); }
.graph-tab.active{ color: var(--accent-strong); border-bottom-color: var(--accent); }
.graph-filter-input{
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-size: 12.5px;
  font-family: var(--font-ui);
  width: 160px;
}
.legend-dot.domain-dot{ background: var(--gold); }
.gi-abbr{ font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); font-weight: 400; }
.graph-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.graph-legend{
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.legend-item{ display: flex; align-items: center; gap: 7px; }
.legend-dot{
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.legend-line{ width: 22px; height: 0; border-top: 2px solid var(--ink-faint); display: inline-block; }
.legend-line.hierarchy-line{ border-top-style: dashed; }
.legend-line.property-line{ border-top-style: solid; border-color: var(--accent); }
.graph-controls{ display: flex; align-items: center; gap: 8px; }
.graph-controls .icon-btn{ width: 34px; height: 34px; }
.graph-controls .icon-btn svg{ width: 15px; height: 15px; }

#graph-canvas-wrap{
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
}
#graph-loading{
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0;
}
#graph-svg{
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#graph-svg:active{ cursor: grabbing; }

.node-circle{
  fill: var(--accent);
  stroke: var(--accent-strong);
  stroke-width: 1.5px;
  transition: opacity 150ms ease;
}
.node-label{
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  fill: var(--accent-contrast);
  pointer-events: none;
  transition: opacity 150ms ease;
}
.node-group.dim .node-circle{ opacity: 0.18; }
.node-group.dim .node-label{ opacity: 0.18; }

.link-line{
  stroke: var(--ink-faint);
  stroke-width: 1.4px;
  fill: none;
  transition: opacity 150ms ease;
}
.link-line.hierarchy{ stroke-dasharray: 3 3; }
.link-line.property{ stroke: var(--accent); stroke-width: 1.6px; }
.graph-arrowhead{ fill: var(--ink-faint); }
.link-group.property .graph-arrowhead{ fill: var(--accent); }
.link-hitbox{ cursor: pointer; }

/* landscape (bipartite) graph */
.domain-circle{
  fill: var(--gold);
  stroke: var(--gold);
  stroke-width: 1.5px;
  filter: brightness(0.85);
}
.ontology-circle{
  fill: var(--accent);
  stroke: var(--accent-strong);
  stroke-width: 1px;
}
.node-label.small-label{
  font-size: 8px;
  fill: var(--ink-soft);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 2.5px;
}
.landscape-link{
  stroke: var(--ink-faint);
  stroke-width: 1px;
  stroke-opacity: 0.3;
  transition: opacity 150ms ease, stroke-opacity 150ms ease;
}
.landscape-link.dim{ stroke-opacity: 0.05; }
.node-group.domain-node .node-label{ pointer-events: none; }
.link-label{
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-soft);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
  transition: opacity 150ms ease;
}
.link-group.dim .link-line{ opacity: 0.12; }
.link-group.dim .link-label{ opacity: 0.12; }

.graph-infocard{
  position: absolute;
  bottom: 16px;
  left: 16px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  padding: 14px 16px;
}
.gi-type{
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 4px;
}
.gi-name{
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}
.gi-detail{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.gi-link{
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}
.gi-link:hover{ text-decoration: underline; }

@media (max-width: 860px){
  #graph-canvas-wrap{ height: 50vh; min-height: 320px; }
  .graph-legend{ flex-wrap: wrap; gap: 10px; row-gap: 6px; }
}
.child-index-label{
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.child-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.child-card{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.child-card:hover{ border-color: var(--accent); }
.child-num{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.child-title{
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14.5px;
}
.child-preview{
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.empty-note{
  color: var(--ink-faint);
  font-style: italic;
}

.section{
  margin-bottom: 0;
}

@keyframes flashHighlight{
  0%{ background: var(--gold-soft); }
  100%{ background: transparent; }
}
.flash-highlight{
  animation: flashHighlight 1.6s ease;
  border-radius: var(--radius-m);
}

.page-tag{
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: auto;
  white-space: nowrap;
}

.section p{

  font-family: var(--font-display);
  font-size: calc(17px * var(--body-scale));
  line-height: 1.68;
  color: var(--ink);
  margin: 0 0 18px;
  max-width: var(--prose-width);
}

.section ul, .section ol{
  font-family: var(--font-display);
  font-size: calc(16.5px * var(--body-scale));
  line-height: 1.62;
  margin: 0 0 20px;
  padding-left: 26px;
  max-width: var(--prose-width);
}
.section li{ margin-bottom: 9px; }
.section ol.alpha{ list-style-type: lower-alpha; }

.section-heading:hover .anchor-link{ opacity: 1; }
.anchor-link{
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-faint);
  text-decoration: none;
  margin-left: 2px;
}

/* concept highlight */
.concept{
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  line-height: 1.5;
  color: var(--accent-strong);
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin: 4px 0 24px;
}

/* callouts */
.callout{
  border-radius: var(--radius-m);
  padding: 16px 18px;
  margin: 4px 0 22px;
  font-size: 15px;
  line-height: 1.6;
  font-family: var(--font-ui);
  max-width: var(--prose-width);
  border: 1px solid transparent;
}
.callout .callout-label{
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  font-weight: 600;
}
.callout.remark{ background: var(--indigo-soft); }
.callout.remark .callout-label{ color: var(--indigo); }
.callout.note{ background: var(--gold-soft); }
.callout.note .callout-label{ color: var(--gold); }
.callout.example{ background: var(--accent-soft); }
.callout.example .callout-label{ color: var(--accent-strong); }
.callout.hint{
  background: transparent;
  border: 1px dashed var(--border-strong);
  padding: 12px 16px;
  font-size: 14px;
}
.callout.hint .callout-label{ color: var(--ink-faint); }

/* figure / table blocks */
.fig-block{
  margin: 8px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
  max-width: 560px;
}
.fig-block .fig-frame{
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  padding: 18px;
}
.fig-block img{
  display: block;
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: transform 200ms ease;
}
.fig-block:hover img{ transform: scale(1.015); }
.fig-block.fig-group{ max-width: 720px; }
.fig-group-imgs{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.fig-group-imgs .fig-frame{ padding: 14px; }
.fig-subcaption{
  font-family: var(--font-ui) !important;
  font-size: 12px !important;
  color: var(--ink-faint);
  text-align: center;
  margin: 6px 0 10px !important;
  max-width: none !important;
}
.fig-caption{
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.fig-num{
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
  white-space: nowrap;
}
.inline-img-wrap{
  margin: 10px 0 24px;
  text-align: center;
}
.inline-img{
  max-width: 380px;
  width: 100%;
  height: auto;
  border-radius: var(--radius-s);
}
.concept-img{
  display: block;
  max-width: 300px;
  margin: 12px 0 0;
  border-radius: var(--radius-s);
}

/* data tables (from real LaTeX tabular content) */
.datatable-wrap{
  margin: 8px 0 26px;
}
.table-caption{
  font-family: var(--font-ui) !important;
  font-size: 13.5px !important;
  color: var(--ink-soft) !important;
  margin: 0 0 8px !important;
  max-width: none !important;
}
.datatable-scroll{ overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-m); }
.datatable{
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 13.5px;
}
.datatable th, .datatable td{
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.datatable thead th{
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.datatable tbody tr:last-child td{ border-bottom: none; }
.datatable tbody tr:hover{ background: var(--surface-2); }

.reslist-wrap{ margin: 8px 0 26px; }
.reslist{
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  max-width: var(--prose-width);
}
.reslist li{
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.reslist li:last-child{ border-bottom: none; }
.reslist li:hover{ background: var(--surface-2); }

/* abbreviations */
.abbrev-list{ margin: 0 0 20px; max-width: var(--prose-width); }

/* citation / how-to-cite block */
.citation-block{
  margin: 8px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
  max-width: 72ch;
}
.citation-tabs{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.citation-label{
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.citation-copy{ margin: 0; }
.citation-pre{
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
.citation-pre code{ font-family: inherit; background: none; padding: 0; }
.citation-plain-label{
  font-family: var(--font-ui) !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint) !important;
  margin: 14px 16px 4px !important;
  max-width: none !important;
}
.citation-plain{
  font-family: var(--font-ui) !important;
  font-size: 13px !important;
  color: var(--ink-soft) !important;
  line-height: 1.55;
  margin: 0 16px 16px !important;
  max-width: none !important;
}

/* fillable templates (Section 6) */
/* project switcher (multi-ontology support for Section 6 templates) */
.proj-bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--accent-soft);
}
.proj-bar-left{ display: flex; align-items: center; gap: 8px; }
.proj-label{
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}
#proj-select{
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  padding: 5px 10px;
  max-width: 200px;
}
.proj-bar-actions{ display: flex; gap: 6px; }
.proj-btn{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 16px;
  cursor: pointer;
}
.proj-btn:hover{ border-color: var(--accent); color: var(--accent-strong); }
.proj-btn-danger:hover{ border-color: #c0392b; color: #c0392b; }
.proj-btn-ttl{
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.proj-btn-ttl:hover{ background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-contrast); }

.tmpl-wrap{
  margin: 12px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
  max-width: none;
}
.tmpl-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tmpl-hint{
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.tmpl-actions{ display: flex; gap: 8px; flex-wrap: wrap; }
.tmpl-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}
.tmpl-btn svg{ width: 13px; height: 13px; flex-shrink: 0; }
.tmpl-btn:hover{ border-color: var(--accent); color: var(--accent-strong); }
.tmpl-btn-ghost{ color: #b04632; border-color: #d9998866; background: #c0392b0d; }
.tmpl-btn-ghost:hover{ border-color: #c0392b; color: #c0392b; background: #c0392b1a; }

.tmpl-table-scroll{ overflow-x: auto; }
.tmpl-table{
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
}
.tmpl-table th{
  text-align: left;
  padding: 9px 10px;
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.tmpl-table td{
  border-bottom: 1px solid var(--border);
  padding: 4px;
  min-width: 140px;
}
.tmpl-table input[type="text"]{
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 8px;
  border-radius: var(--radius-s);
}
.tmpl-table input[type="text"]:hover{ background: var(--surface-2); }
.tmpl-table input[type="text"]:focus{ background: var(--paper); border-color: var(--accent); outline: none; }
.tmpl-th-remove{ width: 34px; }
.tmpl-row-remove{ min-width: auto; text-align: center; }
.tmpl-row-remove button{
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.tmpl-row-remove button:hover{ color: #c0392b; background: var(--surface-2); }
.tmpl-add-row{
  display: block;
  width: 100%;
  border: none;
  border-top: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
}
.tmpl-add-row:hover{ background: var(--accent-soft); }

.tmpl-form{ padding: 4px 16px 16px; }
.tmpl-field{ margin-top: 14px; }
.tmpl-field-label{
  display: block;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}
.tmpl-field textarea{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 9px 11px;
  resize: vertical;
}
.tmpl-field textarea:focus{ border-color: var(--accent); outline: none; }

@media (max-width: 860px){
  .tmpl-toolbar{ flex-direction: column; align-items: flex-start; }
}

.tmpl-table select{
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 6px;
  border-radius: var(--radius-s);
  cursor: pointer;
}
.tmpl-table select:hover{ background: var(--surface-2); }
.tmpl-table select:focus{ background: var(--paper); border-color: var(--accent); outline: none; }

.tmpl-legend{
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.tmpl-legend summary{
  cursor: pointer;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-strong);
  list-style: none;
}
.tmpl-legend summary::-webkit-details-marker{ display: none; }
.tmpl-legend summary::before{ content: '▸ '; }
.tmpl-legend[open] summary::before{ content: '▾ '; }
.tmpl-legend-list{
  margin: 0;
  padding: 0 16px 14px;
}
.tmpl-legend-list dt{
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  margin-top: 10px;
}
.tmpl-legend-list dd{
  margin: 2px 0 0;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.tmpl-resources-label{
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  margin: 14px 16px 4px;
}
.tmpl-resources{
  margin: 0 0 12px;
  padding: 0 16px;
  list-style: disc;
}
.tmpl-resources li{ font-size: 12.5px; margin-bottom: 3px; }
.tmpl-resources a{ color: var(--accent-strong); }

.tmpl-group-header{
  font-family: var(--font-ui) !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  margin: 22px 16px 0 !important;
  max-width: none !important;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.tmpl-field.tmpl-field-indent{
  margin-left: 16px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
.tmpl-optional{
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
}
.tmpl-field-hint{
  font-family: var(--font-ui) !important;
  font-size: 11.5px !important;
  color: var(--ink-faint) !important;
  margin: 0 0 5px !important;
  max-width: none !important;
  font-style: italic;
}
.abbrev-row{
  display: grid;
  grid-template-columns: minmax(110px, max-content) 1fr;
  gap: 10px 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.abbrev-row dt{
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-strong);
}
.abbrev-row dd{ margin: 0; color: var(--ink-soft); }

/* inline: acronyms, citations, cross-refs, code chips */
abbr.acro, abbr.acro-full{
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-faint);
  cursor: help;
}
a.cite{
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--accent);
  text-decoration: none;
  margin: 0 1px;
}
a.cite:hover{ text-decoration: underline; }
a.xref{ text-decoration: none; border-bottom: 1px dotted var(--accent); }
.xref-broken{ color: var(--ink-faint); }
.section code{
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.section .chip{
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 1px 7px;
  border-radius: 5px;
}
.section .chip code{ background: none; padding: 0; }
sup.footnote-marker{
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  cursor: help;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 2px;
  text-transform: uppercase;
}
.ref-link{ text-decoration: none; margin-left: 4px; }

/* ---------------- ontology comparison matrix ---------------- */
.mtx-wrap{
  margin: 8px 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
}
.mtx-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.mtx-search{
  position: relative;
  width: 240px;
  max-width: 100%;
}
.mtx-search svg{
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; color: var(--ink-faint);
}
.mtx-search-input{
  width: 100%;
  padding: 7px 10px 7px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: var(--font-ui);
}
.mtx-hint{
  font-size: 11.5px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
}
.mtx-match-count{ font-family: var(--font-mono); color: var(--accent); }

.mtx-scroll{ overflow-x: auto; max-height: 560px; overflow-y: auto; }
.mtx-table{
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 12.5px;
  white-space: nowrap;
}
.mtx-table thead th{
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-strong);
  font-weight: 600;
  text-align: center;
}
.mtx-rowhead-h{
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  text-align: left !important;
  padding-left: 14px !important;
  min-width: 160px;
}
.mtx-col-btn{
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
}
.mtx-col-btn:hover{ background: var(--accent-soft); color: var(--accent-strong); }
.mtx-col-btn.active{ background: var(--accent); color: var(--accent-contrast); }

.mtx-table tbody tr:nth-child(even){ background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.mtx-table td, .mtx-table th{ border-bottom: 1px solid var(--border); }
.mtx-rowhead{
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  text-align: left;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 12.5px;
  border-right: 1px solid var(--border);
}
.mtx-table tbody tr:nth-child(even) .mtx-rowhead{ background: var(--surface-2); }
.mtx-cell{ text-align: center; padding: 7px 4px; width: 34px; }
.mtx-dot{
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.mtx-type, .mtx-refcell{ padding: 7px 10px; text-align: center; }
.mtx-pill{
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.mtx-pill.o{ background: var(--accent-soft); color: var(--accent-strong); }
.mtx-pill.sm{ background: var(--gold-soft); color: var(--gold); }
.mtx-ref{
  font-family: var(--font-mono);
  font-size: 11px;
  margin-right: 3px;
}
.mtx-caption{
  font-family: var(--font-ui) !important;
  font-size: 12px !important;
  color: var(--ink-faint);
  padding: 10px 14px !important;
  margin: 0 !important;
  max-width: none !important;
  border-top: 1px solid var(--border);
}
.mtx-viewsource{
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: var(--font-ui);
}


.reflist{
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  max-width: calc(var(--prose-width) + 4ch);
}
.reflist li{
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.reflist .ref-num{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  padding-top: 1px;
}

/* prev/next nav */
.pagenav{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pagenav a{
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
}
.pagenav a:hover{ border-color: var(--accent); }
.pagenav .dir{
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pagenav .ttl{ font-size: 14.5px; font-weight: 600; margin-top: 3px; }
.pagenav .next{ text-align: right; grid-column: 2; }

/* back to top */
#back-to-top{
  position: fixed;
  right: 26px;
  bottom: 88px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 90;
}
#back-to-top.show{ opacity: 1; pointer-events: auto; }
#back-to-top svg{ width: 18px; height: 18px; }

/* ---------------- ask this guide (chat widget) ---------------- */
#ask-fab{
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  z-index: 210;
  transition: transform 150ms ease;
}
#ask-fab:hover{ transform: scale(1.06); }
#ask-fab svg{ width: 21px; height: 21px; }
#ask-fab.open{ display: none; }

#ask-panel{
  display: none;
  flex-direction: column;
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 480px;
  max-height: calc(100vh - 60px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  z-index: 211;
  overflow: hidden;
}
#ask-panel.show{ display: flex; }
.ask-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ask-title{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  margin: 0 0 2px;
  color: var(--ink);
}
.ask-subtitle{
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-faint);
  margin: 0;
  line-height: 1.4;
}
#ask-close{
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
#ask-close svg{ width: 16px; height: 16px; }
#ask-close:hover{ color: var(--ink); }

#ask-messages{
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ask-msg{
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
}
.ask-msg-bot{
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--ink);
  border-bottom-left-radius: 3px;
}
.ask-msg-user{
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom-right-radius: 3px;
}
.ask-msg-bot mark{
  background: var(--gold-soft);
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}
.ask-answer-link{
  display: inline-block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
}
.ask-answer-link:hover{ text-decoration: underline; }
.ask-source{
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}

#ask-form{
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
#ask-input{
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 15px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
}
#ask-input:focus{ border-color: var(--accent); }
#ask-send{
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
#ask-send svg{ width: 16px; height: 16px; }

@media (max-width: 480px){
  #ask-panel{
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: calc(100vh - 90px);
  }
  #ask-fab{ right: 16px; bottom: 16px; }
  #back-to-top{ right: 16px; bottom: 76px; }
}

/* lightbox */
#lightbox{
  display: none;
  position: fixed; inset: 0;
  background: rgba(8,10,12,0.86);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
#lightbox.show{ display: flex; }
#lightbox img{
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#lightbox-close{
  position: absolute;
  top: 22px; right: 26px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* empty search state */
#no-results{
  display: none;
  padding: 60px 10px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}
#no-results.show{ display: block; }

/* ---------------- responsive ---------------- */
@media (max-width: 980px){
  .doc-cards{ grid-template-columns: 1fr; }
}

@media (max-width: 860px){
  #topbar{ display: flex; }
  #sidebar{
    position: fixed;
    z-index: 150;
    left: -320px;
    top: 0;
    transition: left 200ms ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }
  #sidebar.open{ left: 0; }
  .graph-cta{ margin-left: 0; margin-top: 10px; display: flex; }
  #main{ padding: 30px 18px 100px; }
  .doc-header h1{ font-size: 30px; }
  .doc-header .lede{ font-size: 16px; }
  .page-title{ font-size: 24px; }
  .page-title .num{ font-size: 18px; }
  .section p, .section ul, .section ol{ font-size: 16px; }
  .pagenav{ grid-template-columns: 1fr; }
  .pagenav .next{ grid-column: 1; text-align: left; }
  .kbd-hint{ display: none; }
  .feedback{ flex-direction: column; align-items: flex-start; }
}

/* print */
@media print{
  #sidebar, #topbar, #back-to-top, #progress-bar, .pagenav{ display: none !important; }
  #main{ padding: 0; }
  #app{ display: block; }
}
