/* ---- Appendix lettering --------------------------------------- */

/* Bikeshed does not auto-assign letters to appendix sections in this config.
   CSS counters handle A. / A.1 / A.1.1 labelling for all heading levels.
   appendix-toc.js fills .secno in the TOC with the same letter sequence. */

body { counter-reset: ech-appendix; }

section.appendix {
  counter-increment: ech-appendix;
  counter-reset: ech-a1 ech-a2;
}

section.appendix > h2 .secno { display: none; }
section.appendix > h2 > .content::before {
  content: counter(ech-appendix, upper-alpha) ". ";
  font-weight: inherit;
}

section.appendix > h3 { counter-increment: ech-a1; }
section.appendix > h3 .secno { display: none; }
section.appendix > h3 > .content::before {
  content: counter(ech-appendix, upper-alpha) "." counter(ech-a1) " ";
}

section.appendix > h4 { counter-increment: ech-a2; }
section.appendix > h4 .secno { display: none; }
section.appendix > h4 > .content::before {
  content: counter(ech-appendix, upper-alpha) "." counter(ech-a1) "." counter(ech-a2) " ";
}
/* ---- Copy-to-clipboard button --------------------------------- */

/* Hide bikeshed's built-in copy button globally (we use our custom one instead) */
button.copy-to-clipboard,
button[data-i18n="clipboard.button"] {
  display: none !important;
}

/* Injected by copy-code.js into .example and .note containing a <pre> */
.ech-copy-btn {
  position: absolute;
  top: 0;
  right: 2.5em;
  bottom: auto;
  left: auto;
  width: 2.5em;
  height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
  color: inherit;
  z-index: 10;
}

.ech-copy-btn:hover {
  opacity: 1;
}

/* Keep self-links visible alongside the copy button */
.example > a.self-link,
.note > a.self-link { opacity: 1; z-index: 5; }

/* Fix line number display: make them inline with code, not in separate column */
.line-no {
  font-family: monospace;
  font-size: inherit;
  display: inline !important;
  float: none !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 0.5em 0 0 !important;
  border: none !important;
  color: rgba(0, 0, 0, 0.7);
  position: static !important;
  background: none !important;
}

/* For highlighted line numbers, maintain inline display */
.highlight-line .line-no {
  display: inline !important;
  padding: 0 0.5em 0 0 !important;
}

/* Ensure code content displays correctly */
.line, .highlight-line {
  display: inline;
}

/* Ensure code stays monospace and same size on hover */
code, pre, .highlight-line, .line {
  font-family: Menlo, Consolas, 'DejaVu Sans Mono', Monaco, monospace !important;
}

/* Prevent code hover effects from changing display */
pre:hover .line-no {
  display: inline !important;
  padding: 0 0.5em 0 0 !important;
}
/* ---- Bikeshed auto-generated References suppression ----------- */

/* Bikeshed appends a duplicate "References" section at the end of the body.
   references.js moves the DL content into our custom section. */
h2[id^="references"]:not([id="references"]) { display: none; }
#toc li:has(> a[href^="#references"]:not([href="#references"])) { display: none; }
/* ---- Metadata table ------------------------------------------- */

table.ech-doc-metadata th {
  padding-right: 1.5em;
  white-space: nowrap;
}

/* ---- Content tables ------------------------------------------- */

/* Styled like .note / .example: same border: .5em / padding: .5em proportions.
   Use <figure class=table> + <figcaption> for Bikeshed auto-numbering. */
figure.table {
  border: 0.5em;
  border-left-style: solid;
  border-color: #5596e6;
  padding: 0.5em;
  background: #f5f7fc;
  overflow-x: auto;
  box-sizing: border-box;
}

figure.table table {
  width: 100%;
  background: transparent;
  border-collapse: collapse;
}

figure.table td,
figure.table th { padding: 0.25em 0.5em; text-align: left; vertical-align: top; }

table td, table th { text-align: left; vertical-align: top; }

/* ---- German figure / table labels ----------------------------- */

/* !important needed: Bikeshed injects its "Figure N." rule via a <style>
   block that appears after our <link rel=stylesheet>. */
figcaption:not(.no-marker)::before {
  content: "Abbildung " counter(figure) " – " !important;
  font-weight: bold !important;
}
figure.table figcaption:not(.no-marker)::before {
  content: "Tabelle " counter(table) " – " !important;
  font-weight: bold !important;
}
figure.table figcaption { font-weight: normal; padding-top: 0.4em; font-size: 0.9em; }

/* ---- Document-specific overrides ------------------------------ */

section:has(> h2#changelog) table { width: 100%; border-collapse: collapse; }
section:has(> h2#changelog) th,
section:has(> h2#changelog) td { border: 1px solid #ccc; padding: 6px 8px; }
/* ---- TOC heading localisation --------------------------------- */

/* Bikeshed hardcodes "Table of Contents" — hide it, show German via ::after */
#toc > h2 { font-size: 0; }
#toc > h2::after {
  content: "Inhaltsverzeichnis";
  display: block;
  font-size: 1rem;
}

/* Empty secno spans on no-num entries create a gap — suppress them */
.toc .secno:empty { display: none; }

/* Suppress Bikeshed's "UNOFFICIAL PROPOSAL DRAFT" watermark */
:root { --unofficial-watermark: none; }
