/* ============================================================
   Prime-Block-Seite: Erklärung + interaktive Demo
   ============================================================ */

.pb-section {
    margin-top: 26px;
}

.pb-section h2 {
    font-size: 1.45em;
    margin-bottom: 12px;
    color: var(--ink);
    border-bottom: 3px solid var(--grad-a);
    display: inline-block;
    padding-bottom: 4px;
}

.pb-section p,
.pb-section li {
    line-height: 1.75;
    color: var(--ink);
    margin-bottom: 10px;
}

.pb-section ul,
.pb-section ol {
    padding-left: 24px;
    margin-bottom: 12px;
}

.pb-formula {
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-left: 4px solid var(--grad-a);
    border-radius: 8px;
    padding: 13px 17px;
    font-family: 'Cascadia Code', Consolas, monospace;
    font-size: 1.02em;
    margin: 14px 0;
    overflow-x: auto;
}

.pb-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.pb-step {
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s, box-shadow 0.18s;
}

.pb-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grad);
    opacity: 0.75;
}

.pb-step:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(102, 126, 234, 0.18);
}

.pb-step .step-ico {
    position: absolute;
    right: 13px;
    top: 9px;
    font-size: 2.3em;
    line-height: 1;
    opacity: 0.12;
    color: var(--grad-a);
    pointer-events: none;
}

.pb-step .num {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    background: var(--grad);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    margin-bottom: 9px;
}

.pb-step h3 {
    font-size: 1.02em;
    margin-bottom: 7px;
}

.pb-step p {
    font-size: 0.92em;
    color: var(--ink-soft);
    margin: 0;
}

code.inline {
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 6px;
    font-family: Consolas, monospace;
    font-size: 0.92em;
}

/* ---------- Demo ---------- */

.demo-panel {
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 14px;
}

.demo-toolbar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.demo-toolbar .form-group {
    min-width: 110px;
}

.demo-stats {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 0.92em;
    color: var(--ink-soft);
}

.demo-stats strong {
    color: var(--grad-a);
}

.demo-flex {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.block-canvas-wrap {
    text-align: center;
    flex: 0 0 auto;
    width: 400px;
    max-width: 100%;
}

.block-canvas-wrap canvas {
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(45, 42, 78, 0.18);
    background: var(--paper);
    cursor: crosshair;
}

/* Legenden-Farbfelder passend zum Theme */
.demo-legend .sw-multiple {
    background: #8d97ea;
}

.demo-legend .sw-prime {
    background: #ffffff;
}

html[data-theme="dark"] .demo-legend .sw-multiple {
    background: #4d4685;
}

html[data-theme="dark"] .demo-legend .sw-prime {
    background: #322e4e;
}

.block-canvas-caption {
    margin-top: 8px;
    font-size: 0.88em;
    color: var(--ink-soft);
    max-width: 400px;
    overflow-wrap: break-word;
}

.contributors {
    flex: 1;
    min-width: 280px;
}

.contributors h3 {
    font-size: 1em;
    margin-bottom: 9px;
}

.contrib-chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.contrib-chip {
    display: inline-block;
    border: 2px solid var(--line);
    border-left: 4px solid var(--chip-color, var(--grad-a));
    border-radius: 8px;
    background: var(--paper);
    padding: 6px 11px;
    font-size: 0.88em;
    font-weight: 600;
    color: var(--ink);
}

.contrib-hint {
    margin-top: 10px;
    font-size: 0.86em;
    color: var(--ink-soft);
}

.demo-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
    font-size: 0.87em;
    color: var(--ink-soft);
    justify-content: center;
}

.demo-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.demo-legend i {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ---------- Muster-Explorer ---------- */

.pattern-grid {
    display: flex;
    gap: 13px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.pattern-tile {
    text-align: center;
    transition: transform 0.15s;
}

.pattern-tile:hover {
    transform: translateY(-3px) scale(1.06);
}

.pattern-tile canvas {
    border-radius: 7px;
    box-shadow: 0 2px 9px rgba(45, 42, 78, 0.15);
    background: var(--paper);
}

.pattern-tile .cap {
    font-size: 0.8em;
    color: var(--ink-soft);
    margin-top: 4px;
    font-family: Consolas, monospace;
}

/* F-Folie: hervorgehoben, denn sie ist die besondere erste */
.pattern-tile.first-tile canvas {
    box-shadow: 0 0 0 2px var(--green), 0 2px 9px rgba(45, 42, 78, 0.15);
}

.pattern-tile.first-tile .cap {
    color: var(--green);
    font-weight: 700;
}

/* ---------- Downloads ---------- */

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.download-card {
    background: var(--paper-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.2);
    border-color: var(--grad-a);
}

.download-card .icon {
    font-size: 1.6em;
}

.download-card h3 {
    font-size: 1.02em;
}

.download-card p {
    font-size: 0.88em;
    color: var(--ink-soft);
    flex: 1;
    line-height: 1.55;
    margin: 0 0 6px 0;
}
