/**
 * Doppelspalt-Experiment
 *
 * Identisch gepflegt in Blocksy-Child und im MVC
 * (tempteria-mvc/public/assets/css/tools/double-slit.css).
 * Aenderungen bitte immer in beide Dateien uebertragen.
 *
 * Der Schirm bleibt in beiden Themes dunkel — auf einen Leuchtschirm faellt
 * Licht, das ist keine Farbentscheidung, sondern der Gegenstand selbst.
 */

.dsx {
    --ds-accent: var(--theme-palette-color-1, var(--brand-blue, #2872fa));
    --ds-ink: var(--theme-headings-color, var(--ink, #1f1f1f));
    --ds-text: var(--theme-text-color, var(--muted, #5a5a5a));
    --ds-surface: var(--surface, #fff);
    --ds-surface-2: var(--surface-2, #f4f6fb);
    --ds-line: var(--border, #e5e7ea);
    --ds-screen: #0a0d16;
    --ds-radius: 16px;
    --ds-radius-sm: 10px;

    margin: 2.5rem 0;
    color: var(--ds-text);
    container-type: inline-size;
}

html[data-theme="dark"] .dsx {
    --ds-surface: var(--surface, #111a2e);
    --ds-surface-2: var(--surface-2, #162038);
    --ds-line: var(--border, #1e2942);
    --ds-ink: var(--ink, #e8ecf4);
    --ds-text: var(--muted, #9aa7bd);
}

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

.dsx__box {
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    padding: 1.4rem;
}

/* ------------------------------------------------------- Schirm und Aufbau */

.dsx__screen-wrap {
    position: relative;
    border-radius: var(--ds-radius-sm);
    overflow: hidden;
    background: var(--ds-screen);
    /* Der Schirm ist immer dunkel, auch im hellen Theme. */
    color: #e8ecf4;
}

.dsx__canvas {
    display: block;
    width: 100%;
    height: auto;
}

.dsx__curve {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.dsx__counter {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(232, 236, 244, 0.75);
}

.dsx__screen-label {
    position: absolute;
    bottom: 0.5rem;
    left: 0.8rem;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(232, 236, 244, 0.5);
}

.dsx__setup {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 0.8rem;
    background: var(--ds-surface-2);
    border-radius: var(--ds-radius-sm);
}

.dsx__setup-line {
    stroke: currentColor;
    stroke-width: 0.6;
    opacity: 0.35;
}

.dsx__setup-solid {
    fill: currentColor;
    opacity: 0.55;
}

.dsx__setup-label {
    fill: currentColor;
    font-size: 4.4px;
    opacity: 0.7;
}

.dsx__setup-beam {
    stroke: var(--ds-beam, #7fd2ff);
    stroke-width: 0.5;
    opacity: 0.5;
}

.dsx__setup-detector {
    fill: var(--danger, #d63637);
    opacity: 0;
    transition: opacity 0.25s;
}

.dsx.is-observed .dsx__setup-detector {
    opacity: 1;
}

/* ---------------------------------------------- Der Schalter, um den es geht */

.dsx__switch {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 1rem 0;
    padding: 0.9rem 1.1rem;
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dsx.is-observed .dsx__switch {
    border-color: var(--danger, #d63637);
    background: color-mix(in srgb, var(--danger, #d63637) 7%, transparent);
}

.dsx__switch input {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--danger, #d63637);
}

.dsx__switch-text {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.dsx__switch-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ds-ink);
}

.dsx__switch-note {
    font-size: 0.8rem;
    line-height: 1.45;
}

/* ------------------------------------------------------------------ Steuerung */

.dsx__controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.4rem;
    margin-bottom: 1rem;
}

@container (max-width: 560px) {
    .dsx__controls {
        grid-template-columns: minmax(0, 1fr);
    }
}

.dsx__field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}

.dsx__field-head label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ds-ink);
}

.dsx__value {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ds-text);
}

.dsx__range {
    width: 100%;
    margin: 0;
    accent-color: var(--ds-accent);
    cursor: pointer;
}

.dsx__range:focus-visible,
.dsx__button:focus-visible,
.dsx__switch input:focus-visible,
.dsx__check input:focus-visible {
    outline: 2px solid var(--ds-accent);
    outline-offset: 2px;
}

.dsx__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.dsx__button {
    padding: 0.65rem 1.1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: var(--ds-accent);
    border: 0;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: filter 0.15s;
}

.dsx__button:hover {
    filter: brightness(0.92);
}

.dsx__button--ghost {
    color: var(--ds-ink);
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-line);
}

.dsx__check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.dsx__check input {
    margin: 0;
    accent-color: var(--ds-accent);
    flex: none;
}

.dsx__hint {
    margin: 0.9rem 0 0;
    padding-top: 0.9rem;
    border-top: 1px solid var(--ds-line);
    font-size: 0.78rem;
    line-height: 1.5;
    opacity: 0.8;
}

.dsx__hint b {
    color: var(--ds-ink);
}

@media (prefers-reduced-motion: reduce) {
    .dsx *,
    .dsx *::before,
    .dsx *::after {
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================================
   Beitragsinhalt (.ds-prose)
   Gleiche Struktur wie bei den anderen Werkzeugen.
   ========================================================================= */

.ds-prose {
    --ds-accent: var(--theme-palette-color-1, var(--brand-blue, #2872fa));
    --ds-mark: var(--brand-yellow, #ffd800);
    --ds-ink: var(--theme-headings-color, var(--ink, #1f1f1f));
    --ds-text: var(--theme-text-color, var(--muted, #5a5a5a));
    --ds-surface-2: var(--surface-2, #f7f8fb);
    --ds-line: var(--border, #e5e7ea);
    --ds-soft: var(--soft-blue, #eaf1ff);

    max-width: none;
    color: var(--ds-text);
}

html[data-theme="dark"] .ds-prose {
    --ds-surface-2: var(--surface-2, #162038);
    --ds-line: var(--border, #1e2942);
    --ds-ink: var(--ink, #e8ecf4);
    --ds-text: var(--muted, #9aa7bd);
    --ds-soft: var(--soft-blue, #14213f);
}

.ds-prose p {
    margin: 0 0 16px;
    line-height: 1.72;
    color: var(--ds-text);
}

.ds-prose h3 {
    margin: 0 0 8px;
    font-size: 17px;
    color: var(--ds-ink);
}

.ds-prose b,
.ds-prose strong {
    color: var(--ds-ink);
}

.ds-prose .ds-callout {
    margin: 26px 0;
    padding: 18px 22px;
    background: var(--ds-soft);
    border-left: 4px solid var(--ds-accent);
    border-radius: 0 12px 12px 0;
}

.ds-prose .ds-table-wrap {
    overflow-x: auto;
    margin: 0 0 8px;
}

.ds-prose .ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.ds-prose .ds-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 12.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ds-text);
    border-bottom: 1px solid var(--ds-line);
}

.ds-prose .ds-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--ds-line);
    color: var(--ds-text);
}

.ds-prose .ds-table td:first-child {
    font-weight: 700;
    color: var(--ds-ink);
}

.ds-prose .ds-table tr:last-child td {
    border-bottom: 0;
}

.ds-prose .ds-table tr.is-marked td:first-child {
    box-shadow: inset 3px 0 0 var(--ds-mark);
    padding-left: 18px;
}

.ds-prose .ds-compare {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 24px 0 8px;
}

.ds-prose .ds-compare-card {
    padding: 22px;
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-line);
    border-radius: 15px;
}

.ds-prose .ds-compare-card p:last-child {
    margin: 0;
    font-size: 14.5px;
}

.ds-prose .ds-figure {
    margin-bottom: 12px !important;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--ds-accent) !important;
}

.ds-prose .ds-faq details {
    border-bottom: 1px solid var(--ds-line);
}

.ds-prose .ds-faq summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    font-weight: 700;
    color: var(--ds-ink);
    cursor: pointer;
    list-style: none;
}

.ds-prose .ds-faq summary::-webkit-details-marker {
    display: none;
}

.ds-prose .ds-faq summary::after {
    content: "+";
    flex: 0 0 auto;
    font-size: 22px;
    font-weight: 400;
    color: var(--ds-accent);
    transition: transform 0.2s;
}

.ds-prose .ds-faq details[open] summary::after {
    transform: rotate(45deg);
}

.ds-prose .ds-faq details p {
    margin: 0 0 18px;
    padding-right: 36px;
}

@media (prefers-reduced-motion: reduce) {
    .ds-prose .ds-faq summary::after {
        transition: none;
    }
}
