/*
 * Custom styles for every theme. Colors come from the theme variables
 * (--r-main-color, --r-background-color, --r-link-color, --r-heading-color),
 * so the theme switch in the menu changes them. js/theme.js sets
 * html.theme-dark on dark themes.
 *
 * Mixed colors: --c-muted (secondary text), --c-line (thin lines),
 * --c-tint (light accent background).
 */
:root {
    --c-muted: color-mix(in srgb, var(--r-main-color) 65%, var(--r-background-color));
    --c-line: color-mix(in srgb, var(--r-main-color) 22%, var(--r-background-color));
    --c-tint: color-mix(in srgb, var(--r-link-color) 8%, var(--r-background-color));
    --c-tint-strong: color-mix(in srgb, var(--r-link-color) 16%, var(--r-background-color));
    /* Text on the white QR cards: always dark, also on dark themes */
    --c-card-text: #1a1a1a;
}

/* AD IT Systems logo in the lower-right corner, on every theme */
body:after {
    content: url(../assets/adit_logo.svg);
    position: fixed;
    bottom: 1.0em;
    right: 7.5em;
    /* Scale the logo down while keeping it anchored to the corner */
    transform: scale(0.2);
    transform-origin: bottom right;
}
/* Dark themes: white logo */
html.theme-dark body:after {
    filter: brightness(0) invert(1);
}

/* Overview and help overlays have a light background */
.r-overlay {
    color: #000 !important;
}

/*
 * Compact tables: smaller type, wrapping, no horizontal overflow, grid
 * lines and zebra rows in theme colors.
 */
.reveal table {
    font-size: 0.9em;
    line-height: 1.25;
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    margin-left: auto;
    margin-right: auto;
}
.reveal table th,
.reveal table td {
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    border: 1px solid var(--c-line);
}
.reveal table thead th {
    font-weight: 600;
    background-color: var(--c-tint-strong);
}
.reveal table tbody tr:nth-child(even) {
    background-color: var(--c-tint);
}

/* Diagrams on dark themes: a light panel, so the dark text stays readable */
html.theme-dark .reveal section img[src^="assets/images/"],
html.theme-dark .reveal section svg.steps {
    background: #fff;
    border-radius: 12px;
}

.reveal h1 {
    font-size: 1.4em; /* smaller than default ~2.6em */
}

.reveal h2 {
    font-size: 1.3em; /* smaller than default ~2.2em */
}

.reveal h3 {
    font-size: 1.2em; /* smaller than default ~1.8em */
}

/* Keep line-height comfortable on dense slides */
.reveal h1, .reveal h2, .reveal h3 {
    line-height: 1.15;
}

/* Hide elements on the title slide */
.reveal section#title-slide .title,
.reveal section#title-slide .author,
.reveal section#title-slide .institute,
.reveal section#title-slide .date {
    display: none !important;
}

/* Tables: add a clear middle divider between columns */
.reveal table {
    border-collapse: separate;
    border-spacing: 0;
}

.reveal table th,
.reveal table td {
    padding: 0.3em 0.6em;
}

/* Middle divider for second column */
.reveal table thead th:nth-child(2),
.reveal table tbody td:nth-child(2) {
    border-left: 3px solid var(--c-line);
}

/* Make sure alignment visuals remain tidy on dark/light backgrounds */
.reveal table thead th {
    vertical-align: middle;
}

/* Figures: make captions much smaller and images use maximum width */
.reveal figure > figcaption {
    font-size: 0.55em; /* much smaller caption text */
    line-height: 1.2;
    color: var(--c-muted);
    margin-top: 0.25em;
}

/* Ensure images that have captions (rendered as <figure>) use full width */
.reveal figure img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Fallback: any images inside slides should not exceed slide width */
.reveal section img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Make long code blocks scroll instead of overflowing the slide */
.reveal pre {
    max-height: 60vh;
    overflow: auto;
}

/* Footnotes: reduce sizes for references and note text */
/* Smaller in-text footnote reference numbers */
.reveal a.footnote-ref,
.reveal sup.footnote-ref {
    font-size: 0.6em;
    line-height: 1;
}

/* Inline per-slide footnotes (if present) */
.reveal .slide-footnotes {
    font-size: 0.3em; /* ~30% of base text size */
    line-height: 1.25;
    color: var(--c-muted);
    margin-top: 0.75em;
    padding-top: 0.5em;
    border-top: 1px solid var(--c-line);
}

.reveal .footnotes ol {
    margin: 0;
    padding-left: 0.2em;
}

.reveal .footnotes li {
    margin: 0.2em 0;
    font-size: 0.6em;
}

/* If Pandoc renders a dedicated footnotes slide, make it smaller too */
.reveal section.footnotes {
    font-size: 0.2em;
}
.reveal .mermaid {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    background: white !important;
}

.reveal .mermaid svg {
    margin: 0 auto !important;
    display: block !important;
    max-height: 440px !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* Asciinema: PDF and export pages show the poster frame without the play button */
html.asciinema-static .reveal .asciinema .ap-overlay-start {
    display: none;
}

/* Demo link with QR code: only in PDF and export view, in the empty
   lower-right corner of the terminal. Codes: demos/make-qr.py */
.reveal .demo-link {
    display: none;
}
html.asciinema-static .reveal .demo-link {
    display: flex;
    align-items: center;
    gap: 0.6em;
    position: absolute;
    right: 128px;
    bottom: 18px;
    padding: 6px 12px 6px 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    font-size: 0.36em;
    line-height: 1.3;
    text-align: left;
    z-index: 10;
    color: var(--c-card-text);
}
html.asciinema-static .reveal .demo-link img {
    width: 92px !important;
    height: 92px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    border: 0;
    box-shadow: none;
}
html.asciinema-static .reveal .demo-link a {
    font-weight: bold;
    color: var(--c-card-text);
}

/* Smaller code font on one slide: <!-- .slide: class="code-small" --> */
.reveal section.code-small pre code {
    font-size: 0.75em;
}

/* The title image has its own branding: no AD logo on it */
body.title-slide:after {
    display: none;
}

/* Smaller table, narrow label column, no hyphenation: <!-- .slide: class="table-wide" --> */
.reveal section.table-wide table {
  font-size: 0.6em;
}
.reveal section.table-wide table th,
.reveal section.table-wide table td {
  hyphens: none;
}
.reveal section.table-wide table th:first-child,
.reveal section.table-wide table td:first-child {
  width: 20%;
}

/* Icon cards: <div class="cards"><div><span class="icon">…</span>Text</div>…</div> */
.reveal .cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6em;
  width: 80%;
  margin: 0 auto;
}
.reveal .cards > div {
  background: var(--c-tint);
  border: 2px solid var(--c-line);
  border-radius: 0.4em;
  padding: 0.4em;
  font-weight: 600;
}
.reveal .cards .icon {
  display: block;
  font-size: 2em;
}

/* Mermaid measures labels outside the slide; slide CSS can make the text
   slightly wider. Do not clip it. */
.reveal .mermaid foreignObject {
    overflow: visible;
}

/* Mermaid renders inside a code block. Remove the code block height limit
   and scroll bars; the SVG max-height above sets the size. */
.reveal pre.code-wrapper:has(> code.mermaid),
.reveal pre code.mermaid {
    max-height: none;
    overflow: visible;
}

/* Second line in a card, e.g. the fix for a pitfall on "Erfahrungen". */
.reveal .cards .fix {
  display: block;
  font-weight: 400;
  font-size: 0.8em;
}

/* Core message on the last slide. */
.reveal p.message {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--r-heading-color);
  margin: 0.8em auto;
  max-width: 85%;
}

/* Compact cards with two lines each: <div class="cards compact">. */
.reveal .cards.compact {
  width: 90%;
  font-size: 0.75em;
}
.reveal .cards.compact .icon {
  font-size: 1.4em;
}

/* Title slide: QR code to the deck in the empty upper-left area.
   The slide is 960x700 and centered: the empty section starts at y=350,
   so top -250px is y=100. That is inside the title image also in 4:3. */
.reveal section .title-qr {
    position: absolute;
    top: -250px;
    left: 0;
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 10px 16px 10px 10px;
    background: #fff;
    border-radius: 10px;
    font-size: 0.5em;
    line-height: 1.3;
    text-align: left;
}
.reveal section .title-qr img {
    width: 160px !important;
    height: 160px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    border: 0;
    box-shadow: none;
}
.reveal section .title-qr a {
    font-weight: bold;
    color: var(--c-card-text);
}

/* Row of QR codes below the text: <div class="qr-row"> */
.reveal .qr-row {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 0.8em;
}
.reveal .qr-row a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 8px 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    font-size: 0.45em;
    font-weight: bold;
    color: var(--c-card-text);
}
.reveal .qr-row img {
    width: 150px !important;
    height: 150px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    border: 0;
    box-shadow: none;
}

/* komponenten.svg: each area ("bereich") shows big in the middle at its own step,
   then moves to its place (--x, --y) and fades. When the group "total" shows, all
   areas show at full opacity again. */
.reveal svg.steps .fragment.bereich {
    transform-box: view-box;
    transform-origin: var(--x) var(--y);
    transition: opacity 0.4s ease, transform 0.7s ease;
}
.reveal svg.steps .fragment.bereich:not(.visible),
.reveal svg.steps .fragment.bereich.current-fragment {
    transform: translate(calc(600px - var(--x)), calc(255px - var(--y))) scale(1.5);
}
.reveal svg.steps .fragment.fade-in-then-semi-out.visible:not(.current-fragment) {
    opacity: 0.2;
}
.reveal svg.steps .bereich .backdrop {
    opacity: 0;
    transition: opacity 0.4s ease;
}
.reveal svg.steps .fragment.bereich.current-fragment .backdrop {
    opacity: 1;
}
.reveal svg.steps:has(.total.visible) .fragment.fade-in-then-semi-out.visible {
    opacity: 1;
}
/* Print view (no fragments): hide the per-step names */
.reveal svg.steps g.running:not(.fragment) {
    display: none;
}
