/* ────────────────────────────────────────────────────────────────
   CSS Custom Properties — OPC UA brand palette (from theme.ts)
   ──────────────────────────────────────────────────────────────── */
:root {
  --opc-mid:        #196096;   /* primary.main  */
  --opc-dark:       #084A79;   /* primary.dark  */
  --opc-light:      #E8EFF4;   /* primary.light */
  --opc-grey:       #D7D9DA;   /* lightGrey     */
  --opc-link:       #448FD1;   /* darkText      */
  --opc-link-hover: #01579b;
  --opc-white:      #FFFFFF;
  --opc-text:       #0d1b2a;   /* near-black with blue undertone */
  --opc-muted:      #4a607a;
  --opc-paper:      #F7F9FB;   /* warm off-white for content area */
  --opc-surface:    #EEF4F8;   /* slightly deeper tint for insets */
  --font-body:   Roboto, Helvetica, Arial, sans-serif;
  --font-ui:     Roboto, Helvetica, Arial, sans-serif;
  --font-mono:   'Consolas', 'Cascadia Code', monospace;

  --header-h:    52px;
  --toc-w:       300px;
  --content-max: 820px;
  --radius:      2px;

  --shadow-sm:   0 1px 3px rgba(8,74,121,.12), 0 1px 2px rgba(8,74,121,.08);
  --shadow-md:   0 4px 12px rgba(8,74,121,.15), 0 2px 4px rgba(8,74,121,.10);
  --transition:  160ms cubic-bezier(.4,0,.2,1);
}

/* ────────────────────────────────────────────────────────────────
   Reset & Base
   ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  height: 100%; margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--opc-text);
  background: var(--opc-paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--opc-link); text-decoration: none; }
a:hover { color: var(--opc-link-hover); text-decoration: underline; text-underline-offset: 2px; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.5em; margin: 0 0 1em; }
li { margin-bottom: .25em; }
strong { font-weight: 600; }

/* ────────────────────────────────────────────────────────────────
   Site Header
   ──────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  background: linear-gradient(100deg, var(--opc-mid) 0%, var(--opc-dark) 100%);
  box-shadow: 0 2px 8px rgba(8,74,121,.35);
  display: flex; align-items: stretch;
}
.site-header-inner {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; padding: 0 1.25rem;
}
.site-logo {
  display: block;
  height: 32px; width: auto;
  flex-shrink: 0;
}
.site-header-spec {
  font-family: var(--font-ui);
  font-weight: 400; font-size: .875rem;
  color: rgba(232,239,244,.8);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-search {
  margin-left: auto;
  display: flex; gap: 0;
  flex-shrink: 0;
}
.header-search input {
  width: 200px;
  padding: .3rem .7rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--opc-white);
  font-family: var(--font-ui);
  font-size: .825rem;
  letter-spacing: .01em;
  outline: none;
  transition: background var(--transition), border-color var(--transition);
}
.header-search input::placeholder { color: rgba(255,255,255,.45); }
.header-search input:focus {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.55);
}
.header-search button {
  padding: .3rem .8rem;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--opc-white);
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition);
}
.header-search button:hover { background: rgba(255,255,255,.28); }
.header-report {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(232,239,244,.85);
  transition: color var(--transition);
}
.header-search + .header-report { margin-left: .5rem; }
.header-report:hover { color: var(--opc-white); }

/* ────────────────────────────────────────────────────────────────
   Two-Column Spec Layout
   ──────────────────────────────────────────────────────────────── */
.spec-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* ── ToC Pane ── */
.toc-pane {
  width: var(--toc-w);
  min-width: var(--toc-w);
  overflow-y: auto; overflow-x: hidden;
  background: var(--opc-light);
  border-right: 2px solid var(--opc-dark);
  display: flex; flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--opc-mid) var(--opc-grey);
}
.toc-pane::-webkit-scrollbar { width: 5px; }
.toc-pane::-webkit-scrollbar-track { background: var(--opc-grey); }
.toc-pane::-webkit-scrollbar-thumb { background: var(--opc-mid); }

.version-badge {
  padding: .55rem 1rem .45rem;
  background: var(--opc-dark);
  color: rgba(232,239,244,.9);
  font-family: var(--font-ui);
  font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
a.version-badge:hover {
  background: var(--opc-mid);
  color: #fff;
  text-decoration: none;
}

/* ── Content Pane ── */
.content-pane {
  flex: 1; overflow-y: auto;
  background: var(--opc-paper);
  padding: 0.5rem 2.5rem 4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--opc-mid) #dde5eb;
}
.content-pane::-webkit-scrollbar { width: 6px; }
.content-pane::-webkit-scrollbar-track { background: #dde5eb; }
.content-pane::-webkit-scrollbar-thumb { background: var(--opc-mid); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.content-pane > * { animation: fadeIn .2s ease-out both; }
.content-pane > :first-child,
.full-document > :first-child { margin-top: 0; }

/* ────────────────────────────────────────────────────────────────
   ToC Tree
   ──────────────────────────────────────────────────────────────── */
.toc-list,
.toc-list ul { list-style: none; margin: 0; padding: 0; }
.toc-list { padding: .4rem 0; }
.toc-list li { margin: 0; }

.toc-list a {
  display: flex; align-items: baseline; gap: .45rem;
  padding: .28rem .75rem .28rem .9rem;
  font-family: var(--font-ui);
  font-size: .875rem; font-weight: 400;
  line-height: 1.4;
  color: var(--opc-dark);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  overflow: hidden;
}
.toc-list a:hover {
  background: rgba(25,96,150,.1);
  border-left-color: var(--opc-mid);
  color: var(--opc-dark);
  text-decoration: none;
}
.toc-list a.active {
  background: rgba(8,74,121,.12);
  border-left-color: var(--opc-dark);
  color: var(--opc-dark);
  font-weight: 600;
}
/* Section number chip inside ToC */
.toc-list a .toc-num {
  font-size: .75rem; font-weight: 700;
  color: var(--opc-mid);
  min-width: 2.4rem;
  flex-shrink: 0;
  letter-spacing: .01em;
}
.toc-list a .toc-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc-list a.active .toc-title { white-space: normal; }

/* Depth indentation — font size stays constant; indentation conveys hierarchy */
.toc-list ul { border-top: none; }
.toc-list ul a        { padding-left: 1.6rem; }
.toc-list ul ul a     { padding-left: 2.3rem; }
.toc-list ul ul ul a  { padding-left: 3rem; }

/* ── Hamburger toggle (hidden on desktop, shown on mobile) ── */
.toc-toggle {
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
  width: 36px; height: 36px;
  flex-shrink: 0;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
}
.toc-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--opc-white);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}
body.toc-open .toc-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.toc-open .toc-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
body.toc-open .toc-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Backdrop — dims content behind the open drawer */
.toc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── Mobile: slide-in ToC drawer ─────────────────────────────── */
@media (max-width: 768px) {
  .toc-toggle { display: flex; }

  /* Pane slides in from the left as a fixed overlay */
  .toc-pane {
    position: fixed;
    top: var(--header-h); left: 0; bottom: 0;
    width: min(var(--toc-w), 85vw);
    height: calc(100dvh - var(--header-h));
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }

  body.toc-open .toc-pane     { transform: translateX(0); }
  body.toc-open .toc-backdrop { display: block; }

  /* Content fills the full viewport width on mobile */
  .content-pane { padding: 1.25rem 1rem 3rem; }
}

/* ────────────────────────────────────────────────────────────────
   Content Typography
   ──────────────────────────────────────────────────────────────── */

/* Section headings */
.content-pane h1,
.content-pane h2,
.content-pane h3,
.content-pane h4,
.content-pane h5,
.content-pane h6 {
  font-family: var(--font-body);
  margin: 1.6em 0 .5em;
  line-height: 1.3;
  font-weight: 600;
}
.content-pane h1 { font-size: 1.75rem; margin-top: 0; letter-spacing: -.01em; }
.content-pane h2 {
  font-size: 1.3rem;
  padding-bottom: .35rem;
  border-bottom: 1.5px solid var(--opc-grey);
}
.content-pane h3 { font-size: 1.1rem; }
.content-pane h4 { font-size: 1rem; }
.content-pane h5, .content-pane h6 { font-size: .95rem; }

/* Section number — styled as a catalog reference label */
.sec-number {
  font-family: var(--font-body);
  font-weight: 700; font-size: 1em;
  color: inherit;
  margin-right: .4em;
  white-space: nowrap;
}

/* ────────────────────────────────────────────────────────────────
   Notes & Examples
   ──────────────────────────────────────────────────────────────── */
aside.note,
aside.non-normative-note,
aside.example,
aside.non-normative-example {
  position: relative;
  margin: 1.4em 0;
  padding: .85rem 1.1rem .85rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
aside.note,
aside.non-normative-note {
  background: #EFF4FA;
  border-left: 4px solid var(--opc-mid);
}
aside.example,
aside.non-normative-example {
  background: #EFF8F2;
  border-left: 4px solid #2e8b57;
}
.label {
  font-family: var(--font-ui);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--opc-dark);
  margin-right: .6em;
}
aside.example .label,
aside.non-normative-example .label { color: #1a5e34; }

/* ────────────────────────────────────────────────────────────────
   Code & Pre
   ──────────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: .825em;
  background: var(--opc-surface);
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
  padding: .1em .35em;
  color: var(--opc-dark);
}
pre {
  background: #eef2f5;
  border-radius: var(--radius);
  border: 1px solid #cdd6de;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.2em 0;
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: #a0b4c4 #eef2f5;
}
pre::-webkit-scrollbar { height: 5px; }
pre::-webkit-scrollbar-track { background: #eef2f5; }
pre::-webkit-scrollbar-thumb { background: #a0b4c4; }
pre code {
  font-family: var(--font-mono);
  font-size: .85rem; line-height: 1.65;
  background: none; border: none; padding: 0;
  color: #0d1b2a;
}

/* ────────────────────────────────────────────────────────────────
   Tables
   ──────────────────────────────────────────────────────────────── */
.content-pane table {
  width: 100%; border-collapse: collapse;
  margin: 1.2em 0;
  font-size: .9rem;
  border: 1px solid var(--opc-grey);
  box-shadow: var(--shadow-sm);
}
.content-pane th {
  background: var(--opc-dark);
  color: var(--opc-white);
  font-family: var(--font-ui);
  font-weight: 600; font-size: .8rem;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .5rem .75rem;
  text-align: left;
  border: 1px solid rgba(255,255,255,.15);
}
.content-pane td {
  padding: .4rem .75rem;
  border: 1px solid var(--opc-grey);
  vertical-align: top;
}
.content-pane tbody tr:nth-child(even) td { background: var(--opc-surface); }
.content-pane tbody tr:hover td {
  background: rgba(25,96,150,.06);
  transition: background var(--transition);
}
.content-pane [style*="text-align:center"],
.content-pane td[align="center"] { text-align: center; }

/* ────────────────────────────────────────────────────────────────
   Figures
   ──────────────────────────────────────────────────────────────── */
.content-pane figure {
  text-align: center;
  margin: 1.8em 0;
  padding: 1rem;
  background: var(--opc-surface);
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
}
.content-pane figure img { max-width: 100%; height: auto; }
.content-pane figcaption {
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 600;
  letter-spacing: .03em;
  color: var(--opc-muted);
  margin-top: .6rem;
  text-align: center;
}
.content-pane figure.table-wrap {
  text-align: left; padding: 0;
  background: none; border: none;
}
.content-pane figure.table-wrap figcaption {
  text-align: left;
  margin-bottom: .4rem;
  color: var(--opc-dark);
  font-size: .82rem;
}

/* ────────────────────────────────────────────────────────────────
   Inline Elements
   ──────────────────────────────────────────────────────────────── */
.smallcaps { font-variant: small-caps; letter-spacing: .03em; }
.std-ref {
  font-style: italic;
  color: var(--opc-muted);
}
em[data-term] {
  cursor: pointer;
  font-style: italic;
  border-bottom: 1px dashed var(--opc-link);
  color: inherit;
}
em[data-term]:hover { color: var(--opc-link); }

a.xref {
  color: var(--opc-link);
  border-bottom: 1px solid rgba(68,143,209,.35);
  padding-bottom: .05em;
}
a.xref:hover { color: var(--opc-link-hover); border-bottom-color: var(--opc-link-hover); text-decoration: none; }
a.xref-broken {
  color: #b91c1c;
  border-bottom: 1px solid #b91c1c;
  text-decoration: none;
  opacity: .7;
}
a.ext-link { color: var(--opc-link); }
a.ext-link::after {
  content: '\2197';
  font-size: .7em; vertical-align: .15em;
  margin-left: .2em;
  color: var(--opc-muted);
}

/* Normative reference list */
.ref-list { margin: 1em 0; }
.ref-entry { margin-bottom: 1em; }
.ref-citation { }
.ref-link { padding-left: 2em; }
a.int-link { color: var(--opc-link); }

/* Definition list (terms & definitions sections) */
dl { margin: 1em 0; }
dt {
  font-weight: 600; color: var(--opc-dark);
  margin-top: .75em;
}
dd { margin: .2em 0 0 1.5em; }

/* ────────────────────────────────────────────────────────────────
   Non-spec pages (index, search, terms — no ToC layout)
   ──────────────────────────────────────────────────────────────── */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}
.page-container h1 {
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 1.75rem; font-weight: 600;
  color: var(--opc-dark);
  margin: 0 0 1.5rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--opc-mid);
}

/* ── Spec Filter ── */
.spec-filter {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.25rem;
}
.spec-filter-input {
  flex: 1; max-width: 420px;
  padding: .45rem .8rem;
  font-family: var(--font-ui); font-size: .9rem;
  border: 1.5px solid var(--opc-grey);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--opc-white);
  color: var(--opc-text);
}
.spec-filter-input:focus {
  border-color: var(--opc-mid);
  box-shadow: 0 0 0 3px rgba(25,96,150,.15);
}
.spec-filter-count {
  font-size: .8rem; color: var(--opc-muted);
  white-space: nowrap;
}
.spec-no-results {
  padding: 1.5rem 0; color: var(--opc-muted); font-style: italic;
}

/* ── Spec Index List ── */
.spec-list { list-style: none; padding: 0; margin: 0; }
.spec-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--opc-grey);
  transition: background var(--transition);
}
.spec-list li:first-child { border-top: 1px solid var(--opc-grey); }
.spec-list li:hover { background: var(--opc-light); }
.spec-id {
  font-family: var(--font-ui);
  font-weight: 700; font-size: 1rem;
  color: var(--opc-dark);
  letter-spacing: .01em;
  text-decoration: none;
}
.spec-id:hover { color: var(--opc-mid); text-decoration: none; }
.spec-title {
  font-size: 1rem;
  color: var(--opc-muted);
}
.version-tag {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--opc-muted);
  white-space: nowrap;
}

/* ── Search Results ── */
.search-results,
.term-occurrences { list-style: none; padding: 0; margin: 0; }
.search-results li,
.term-occurrences li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--opc-grey);
}
.result-title {
  display: flex; align-items: baseline; gap: .5rem;
  margin-bottom: .25rem;
}
.result-number {
  font-family: var(--font-ui);
  font-size: 1rem; font-weight: 700;
  color: var(--opc-mid);
  flex-shrink: 0;
  letter-spacing: .02em;
}
.result-title a {
  font-weight: 600; font-size: 1rem;
  color: var(--opc-dark);
  text-decoration: none;
}
.result-title a:hover { color: var(--opc-mid); text-decoration: underline; text-underline-offset: 2px; }
.result-spec {
  font-size: .75rem;
  font-weight: 600;
  color: var(--opc-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .15rem;
}
.result-snippet {
  font-size: .875rem;
  color: var(--opc-muted);
  line-height: 1.55;
}
.result-snippet b {
  font-weight: 700;
  color: var(--opc-dark);
  background: rgba(68,143,209,.15);
  border-radius: 2px;
  padding: 0 .15em;
}

/* ── Per-spec Intro landing page ── */
.intro-header { margin-bottom: 1.5rem; }
.intro-id {
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--opc-mid);
  margin-bottom: .25rem;
}
.intro-header h1 {
  font-family: var(--font-body);
  font-size: 1.85rem; font-weight: 600;
  color: var(--opc-dark);
  margin: 0 0 .25rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--opc-mid);
}
.intro-version-banner {
  margin-top: 1rem;
  padding: .55rem .9rem;
  background: var(--opc-light);
  border-left: 3px solid var(--opc-mid);
  border-radius: 2px;
  color: var(--opc-text);
  font-size: .9rem;
}

.intro-meta { margin: 1.25rem 0 1.5rem; }
.intro-license { margin: 0 0 1.5rem; font-size: .9rem; color: var(--opc-mid); }
.meta-table {
  width: 100%; border-collapse: collapse;
  background: var(--opc-paper);
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
  overflow: hidden;
}
.meta-table th, .meta-table td {
  padding: .55rem .85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--opc-grey);
}
.meta-table tr:last-child th, .meta-table tr:last-child td { border-bottom: none; }
.meta-table th {
  width: 11rem;
  font-family: var(--font-ui);
  font-size: .75rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--opc-mid);
  background: var(--opc-surface);
}
.copyright-statement {
  margin-top: .35rem;
  font-size: .85rem;
  color: var(--opc-muted);
  line-height: 1.5;
}

.intro-actions {
  display: flex; flex-wrap: wrap; gap: .65rem;
  margin: 1.25rem 0 2rem;
}
.intro-cta {
  display: inline-block;
  padding: .55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 700; line-height: 1.25;
  letter-spacing: .04em;
  background: var(--opc-mid);
  color: var(--opc-white);
  border: 1.5px solid var(--opc-mid);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.intro-cta:hover {
  background: var(--opc-dark);
  border-color: var(--opc-dark);
  color: var(--opc-white);
  text-decoration: none;
}
.intro-cta-secondary {
  background: var(--opc-white);
  color: var(--opc-mid);
}
.intro-cta-secondary:hover {
  background: var(--opc-light);
  border-color: var(--opc-mid);
  color: var(--opc-dark);
}

.intro-download { position: relative; display: inline-block; }
.intro-download-btn {
  cursor: pointer;
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 700; line-height: 1.25;
  letter-spacing: .04em;
  padding: .55rem 1.1rem;
  background: var(--opc-white);
  color: var(--opc-mid);
  border: 1.5px solid var(--opc-mid);
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.intro-download-btn:hover,
.intro-download[open] .intro-download-btn {
  background: var(--opc-light);
  border-color: var(--opc-mid);
  color: var(--opc-dark);
}
.intro-download-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 320px;
  background: var(--opc-white);
  border: 1.5px solid var(--opc-mid);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
  overflow: hidden;
}
.intro-download-menu.open { display: block; }
.intro-download-item {
  display: block;
  padding: .55rem .9rem;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 600;
  color: var(--opc-dark);
  text-decoration: none;
  transition: background var(--transition);
}
.intro-download-item:hover {
  background: var(--opc-light);
  color: var(--opc-dark);
  text-decoration: none;
}

/* Licence confirmation shown before a download starts. */
.licence-dialog {
  width: min(34rem, calc(100vw - 2rem));
  padding: 1.25rem 1.4rem 1.1rem;
  background: var(--opc-white);
  color: var(--opc-text);
  border: 1.5px solid var(--opc-mid);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}
.licence-dialog::backdrop { background: rgba(0,0,0,.42); }
.licence-dialog-title {
  font-family: var(--font-body);
  font-size: 1.2rem; font-weight: 600;
  color: var(--opc-dark);
  margin: 0 0 .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--opc-grey);
}
.licence-dialog-body { font-size: .9rem; color: var(--opc-mid); }
.licence-dialog-body p { margin: 0 0 .6rem; }
.licence-dialog-body p:last-child { margin-bottom: 0; }
.licence-dialog-actions {
  display: flex; justify-content: flex-end; gap: .65rem;
  margin-top: 1.25rem;
}
.licence-dialog-actions .intro-cta { cursor: pointer; }

.intro-section { margin: 2rem 0; }
.intro-section h2 {
  font-family: var(--font-body);
  font-size: 1.2rem; font-weight: 600;
  color: var(--opc-dark);
  margin: 0 0 .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--opc-grey);
}
.intro-table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.intro-table thead th {
  text-align: left;
  padding: .45rem .75rem;
  font-family: var(--font-ui);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--opc-mid);
  background: var(--opc-surface);
  border-bottom: 1.5px solid var(--opc-grey);
}
.intro-table tbody td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--opc-grey);
  vertical-align: top;
}
.intro-table tbody tr.is-current td { background: var(--opc-light); }
.intro-table code {
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: .85rem;
  color: var(--opc-text);
  background: var(--opc-surface);
  padding: 0 .35em;
  border-radius: 3px;
  word-break: break-all;
}
.current-tag, .primary-tag {
  display: inline-block;
  margin-left: .5rem;
  padding: 0 .55rem;
  font-family: var(--font-ui);
  font-size: .65rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  border-radius: 999px;
  vertical-align: 1px;
}
.current-tag { color: var(--opc-white); background: var(--opc-mid); }
.primary-tag { color: var(--opc-dark); background: var(--opc-grey); }

.ns-download-btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .75rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .3rem .8rem;
  background: var(--opc-white);
  color: var(--opc-mid);
  border: 1.5px solid var(--opc-grey);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.ns-download-btn:hover {
  background: var(--opc-mid);
  border-color: var(--opc-mid);
  color: var(--opc-white);
}

.intro-link-list { list-style: none; padding: 0; margin: 0; }
.intro-link-list li {
  padding: .4rem 0;
  border-bottom: 1px solid var(--opc-grey);
  font-family: var(--font-ui);
  font-size: .9rem;
}
.intro-link-list li:last-child { border-bottom: none; }

/* ── Search tabs (Term / NodeId·BrowseName / CU / Google) ── */
.search-tabs {
  display: flex; flex-wrap: wrap;
  gap: 0;
  margin: .5rem 0 1.25rem;
  border-bottom: 1.5px solid var(--opc-grey);
}
.search-tab {
  padding: .55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 600;
  letter-spacing: .03em;
  color: var(--opc-muted);
  text-decoration: none;
  border: 1.5px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: -1.5px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.search-tab:hover {
  color: var(--opc-dark);
  background: var(--opc-light);
  text-decoration: none;
}
.search-tab.is-active {
  color: var(--opc-dark);
  background: var(--opc-paper);
  border-color: var(--opc-grey);
  border-bottom-color: var(--opc-paper);
}

/* ── Scope chips (this spec / core / all) ── */
.search-scope {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem;
  margin: -.75rem 0 1.5rem;
  font-size: .85rem;
}
.search-scope-label {
  color: var(--opc-muted);
  font-family: var(--font-ui);
  font-size: .75rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  margin-right: .25rem;
}
.scope-chip {
  padding: .25rem .7rem;
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 600;
  color: var(--opc-mid);
  background: var(--opc-white);
  border: 1.5px solid var(--opc-grey);
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.scope-chip:hover {
  background: var(--opc-light);
  border-color: var(--opc-mid);
  color: var(--opc-dark);
  text-decoration: none;
}
.scope-chip.is-active {
  background: var(--opc-mid);
  border-color: var(--opc-mid);
  color: var(--opc-white);
}
.search-scope-back {
  margin-left: auto;
  color: var(--opc-muted);
  font-size: .85rem;
}

/* ── Result metadata (NodeId, BrowseName, CU rows) ── */
.result-meta {
  font-size: .8rem;
  color: var(--opc-muted);
  display: flex; flex-wrap: wrap;
  align-items: baseline; gap: .35rem;
  margin-top: .25rem;
}
.result-meta .meta-label {
  font-family: var(--font-ui);
  font-size: .7rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--opc-mid);
}
.result-meta code {
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: .85rem;
  color: var(--opc-text);
  background: var(--opc-surface);
  padding: 0 .35em;
  border-radius: 3px;
}
.result-meta .meta-sep { color: var(--opc-grey); }

/* ── Search empty state / count line ── */
.search-empty {
  color: var(--opc-muted);
  margin: 1rem 0 .25rem;
}
.search-count {
  color: var(--opc-muted);
  margin-bottom: 1.25rem;
}

/* ── Google tab launch button ── */
.google-button {
  display: inline-block;
  padding: .55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 700;
  letter-spacing: .04em;
  background: var(--opc-mid);
  color: var(--opc-white);
  border: 1.5px solid var(--opc-mid);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.google-button:hover {
  background: var(--opc-dark);
  border-color: var(--opc-dark);
  color: var(--opc-white);
  text-decoration: none;
}

/* Search form */
.search-form {
  display: flex; gap: 0;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.search-form input {
  flex: 1;
  padding: .6rem .9rem;
  border: 1.5px solid var(--opc-grey);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--opc-text);
  background: var(--opc-white);
  outline: none;
  transition: border-color var(--transition);
}
.search-form input:focus { border-color: var(--opc-mid); }
.search-form button {
  padding: .6rem 1.2rem;
  background: var(--opc-mid);
  color: var(--opc-white);
  border: 1.5px solid var(--opc-mid);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-ui);
  font-size: .85rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition);
}
.search-form button:hover { background: var(--opc-dark); border-color: var(--opc-dark); }

/* ── Download links ── */
.download-links { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.2rem 0; }
.download-links a {
  font-family: var(--font-ui);
  font-size: .8rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--opc-surface);
  color: var(--opc-dark);
  border: 1.5px solid var(--opc-grey);
  padding: .35rem .9rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.download-links a:hover {
  background: var(--opc-mid);
  border-color: var(--opc-mid);
  color: var(--opc-white);
  text-decoration: none;
}

/* ── Error page ── */
.error-page { text-align: center; padding: 5rem 1rem; }
.error-page h1 { font-size: 4rem; color: var(--opc-dark); margin-bottom: .5rem; }
.error-page p { color: var(--opc-muted); font-size: 1.1rem; }

/* ── In-page find bar ── */
.find-bar {
  position: fixed;
  top: calc(var(--header-h) + 6px);
  right: 12px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .5rem;
  background: var(--opc-white);
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.find-bar[hidden] { display: none; }
.find-bar input {
  width: 220px;
  padding: .28rem .6rem;
  border: 1.5px solid var(--opc-grey);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: .875rem;
  color: var(--opc-text);
  background: var(--opc-white);
  outline: none;
  transition: border-color var(--transition);
}
.find-bar input:focus { border-color: var(--opc-mid); }
.find-count {
  font-size: .78rem;
  color: var(--opc-muted);
  white-space: nowrap;
  min-width: 6ch;
  text-align: right;
}
.find-btn {
  background: none;
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
  color: var(--opc-dark);
  font-size: .85rem;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background var(--transition), border-color var(--transition);
}
.find-btn:hover { background: var(--opc-light); border-color: var(--opc-mid); }
.find-close-btn { margin-left: .15rem; }

/* Text match highlights */
mark {
  background: rgba(255,213,0,.4);
  color: inherit;
  border-radius: 2px;
  padding: 0 .05em;
}
mark.find-current {
  background: rgba(255,140,0,.65);
  outline: 2px solid rgba(220,110,0,.75);
  outline-offset: 1px;
}

/* A ToC entry holding a find match: titles are normally clipped to one line, which
   would hide a highlight sitting past the ellipsis — wrap it while the find bar is open. */
.toc-list a.find-hit .toc-title {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

/* Search fallback suggestions */
.search-fallbacks { margin-top: 1.25rem; color: var(--opc-muted); }
.search-fallbacks ul { margin: .4rem 0 0 1.5rem; }
.search-fallbacks li { margin-bottom: .3rem; }
kbd {
  font-family: var(--font-mono);
  font-size: .78rem;
  background: var(--opc-surface);
  border: 1px solid var(--opc-grey);
  border-radius: var(--radius);
  padding: .1em .4em;
  color: var(--opc-dark);
}

/* ────────────────────────────────────────────────────────────────
   Google CSE overrides — results-only, matched to site theme
   ──────────────────────────────────────────────────────────────── */
.gsc-control-cse {
  font-family: var(--font-body) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}
/* Result container */
.gsc-webResult.gsc-result {
  border-top: 1px solid var(--opc-grey) !important;
  border-bottom: none !important;
  padding: 1rem 0 !important;
  background: transparent !important;
  margin: 0 !important;
}
.gsc-results .gsc-cursor-box { border-top: 1px solid var(--opc-grey) !important; }
/* Title link */
.gs-title, .gs-title * {
  font-family: var(--font-body) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--opc-link) !important;
  text-decoration: none !important;
}
.gs-title:hover, .gs-title:hover * {
  color: var(--opc-link-hover) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
}
/* Snippet */
.gs-snippet {
  font-family: var(--font-body) !important;
  font-size: .875rem !important;
  line-height: 1.55 !important;
  color: var(--opc-muted) !important;
}
.gs-snippet b { color: var(--opc-dark) !important; font-weight: 700 !important; }
/* Visible URL */
.gsc-url-top, .gs-visibleUrl, .gs-visibleUrl-short {
  font-family: var(--font-body) !important;
  font-size: .75rem !important;
  color: var(--opc-muted) !important;
}
/* Result count / info line */
.gsc-result-info {
  font-family: var(--font-body) !important;
  font-size: .8rem !important;
  color: var(--opc-muted) !important;
  padding-left: 0 !important;
  margin-bottom: .75rem !important;
}
/* No-results message */
.gs-no-results-result .gs-snippet, .gs-error-result .gs-snippet {
  font-family: var(--font-body) !important;
  font-size: .875rem !important;
  color: var(--opc-muted) !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}
/* Pagination */
.gsc-cursor-box { margin: 1rem 0 !important; }
.gsc-cursor-page {
  font-family: var(--font-body) !important;
  font-size: .875rem !important;
  color: var(--opc-link) !important;
}
.gsc-cursor-current-page {
  color: var(--opc-dark) !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}
/* Hide thumbnail images (keeps layout clean) */
.gsc-table-cell-thumbnail { display: none !important; }
.gsc-table-result { width: 100% !important; }
/* Hide "Find more on Google" footer */
.gcsc-find-more-on-google-root,
.gcsc-find-more-on-google,
.gcsc-branding { display: none !important; }
/* Remove default CSE border/background on the inner control */
.gsc-search-box, .gsc-input { display: none !important; }
.gsc-above-wrapper-area { border-bottom: none !important; padding-bottom: 0 !important; }
