/* ---- 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 --------------------------------- */

/* Injected by copy-code.js into .example and .note containing a <pre> */
.ech-copy-btn {
  position: absolute;
  top: 0;
  right: calc(3.5rem - 26px);
  width: calc(3.5rem - 26px);
  height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 0;
  opacity: 1;
  transition: opacity 0.2s;
  color: inherit;
}

/* Keep self-links visible alongside the copy button */
.example > a.self-link,
.note > a.self-link { opacity: 1; }
/* ---- 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; }
