/* ==========================================================================
   Backstein (Content Block dddiy_brick, im Website-Baukasten gepflegt,
   Content\SiteBrick): ein Band ueber die ganze Breite.

   Stapeln: Backsteine sitzen ohne Abstand aufeinander. Die Kante ist ein
   ::before (oben) bzw. ::after (unten) in der Farbe des Steins, das aus dem
   Stein heraus in den Nachbarn ragt - eine Zickzack-Kante oben beisst also
   in den Baustein darueber. Kante unten liegt eine Ebene hoeher, sonst
   deckte der naechste Stein sie zu.

   Farben aus den Tokens von festival.css (--fest-*), mit Fallback. Muster
   in der Schriftfarbe des Steins, leise; Absperrband in der Gegenfarbe.
   Laufband nur ohne prefers-reduced-motion, sonst steht der Satz einmal.
   ========================================================================== */

.festival-theme > .frame.frame-type-dddiy_brick,
.festival-theme > .frame.frame-type-dddiy_brick:first-child {
    position: relative;
    z-index: 1;
    /* !important: festival.css begrenzt Rahmen ohne .container auf
       1320px, mit hoeherer Spezifitaet (:not(:has(...)) zaehlt mit) - der
       Stein blieb dadurch im Inhaltsbereich stecken, auch bei "ganze
       Breite". Boxed regelt .brick--width-boxed am Stein selbst. */
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
    /* festival.css gibt Rahmen ohne .container seitlich Rand - ein Stein
       ohne Schriftzug geht trotzdem von Kante zu Kante. Oben und unten
       ohne !important: "Abstand" im Aussehen soll weiter greifen. */
    padding-block: 0;
    padding-inline: 0 !important;
    /* Schiefe Steine sind breiter als die Seite - seitlich kappen, oben
       und unten muessen die Kanten heraus. */
    overflow-x: clip;
}

.festival-theme > .frame.frame-type-dddiy_brick:has(> .brick:is(.brick--edge-bottom, .brick--edge-both)) {
    z-index: 2;
}

.brick {
    --brick-bg: var(--fest-primary, #e3480f);
    --brick-ink: var(--fest-on-primary, #fff);
    --brick-alt: var(--fest-secondary, #f2c94c);
    --brick-mark: color-mix(in srgb, var(--brick-ink) 16%, transparent);
    --brick-edge: 14px;
    --brick-ratio: 1.5;
    --brick-display: var(--fest-font-display, var(--brand-font-display, "Anton", "Oswald", "Arial Narrow", sans-serif));
    position: relative;
    display: grid;
    place-items: center;
    min-height: 3.5rem;
    padding-block: 0.6rem;
    color: var(--brick-ink);
    background: var(--brick-bg);
    text-align: center;
}

/* --- Farbe --------------------------------------------------------------- */

.brick--color-secondary {
    --brick-bg: var(--fest-secondary, #f2c94c);
    --brick-ink: var(--fest-on-secondary, #14181f);
    --brick-alt: var(--fest-primary, #e3480f);
}

.brick--color-dark {
    --brick-bg: var(--fest-dunkel, #14181f);
    --brick-ink: #fff;
    --brick-alt: var(--fest-secondary, #f2c94c);
}

.brick--color-soft {
    --brick-bg: var(--fest-flaeche-leise, #f5f6f8);
    --brick-ink: var(--fest-ink, #14181f);
    --brick-alt: var(--fest-primary, #e3480f);
}

.brick--color-paper {
    --brick-bg: var(--fest-flaeche, #fff);
    --brick-ink: var(--fest-ink, #14181f);
    --brick-alt: var(--fest-primary, #e3480f);
}

/* --- Hoehe --------------------------------------------------------------- */

.brick--height-thin {
    --brick-edge: 8px;
    min-height: 14px;
    padding-block: 0;
}

.brick--height-block {
    --brick-edge: 22px;
    min-height: clamp(9rem, 22vw, 15rem);
    padding-block: var(--fest-space-m, 2rem);
}

.brick--height-area {
    --brick-edge: 32px;
    min-height: 45vh;
    min-height: 45svh;
    padding-block: var(--fest-space-l, 3rem);
}

/* --- Kante --------------------------------------------------------------- */

.brick::before,
.brick::after {
    content: none;
    position: absolute;
    left: 0;
    width: 100%;
    height: var(--brick-edge);
    background: var(--brick-bg);
    -webkit-mask: var(--brick-mask) 0 100% / calc(var(--brick-edge) * var(--brick-ratio)) 100% repeat-x;
    mask: var(--brick-mask) 0 100% / calc(var(--brick-edge) * var(--brick-ratio)) 100% repeat-x;
    pointer-events: none;
}

.brick:not(.brick--shape-straight, .brick--shape-):is(.brick--edge-top, .brick--edge-both)::before {
    content: "";
    bottom: calc(100% - 1px);
}

.brick:not(.brick--shape-straight, .brick--shape-):is(.brick--edge-bottom, .brick--edge-both)::after {
    content: "";
    top: calc(100% - 1px);
    transform: scaleY(-1);
}

/* Kacheln 24/96/120/32 breit, 16 hoch, unten gefuellt - --brick-ratio ist
   Breite durch Hoehe. */
.brick--shape-zigzag {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='16' viewBox='0 0 24 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16V14L12 1 24 14V16Z'/%3E%3C/svg%3E");
    --brick-ratio: 1.5;
}

.brick--shape-wave {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='16' viewBox='0 0 96 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9Q24 0 48 9T96 9V16H0Z'/%3E%3C/svg%3E");
    --brick-ratio: 6;
}

.brick--shape-torn {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='16' viewBox='0 0 120 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16V9L7 5 13 10 19 4 27 8 33 3 41 9 48 6 55 11 62 5 70 8 77 2 85 9 92 6 99 10 106 4 113 8 120 9V16Z'/%3E%3C/svg%3E");
    --brick-ratio: 7.5;
}

.brick--shape-castle {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16' viewBox='0 0 32 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16V1H16V8H32V16Z'/%3E%3C/svg%3E");
    --brick-ratio: 2;
}

/* Bogen und Schraeg: eine Form ueber die ganze Breite, doppelt so hoch. */
.brick:is(.brick--shape-arc, .brick--shape-slant)::before,
.brick:is(.brick--shape-arc, .brick--shape-slant)::after {
    height: calc(var(--brick-edge) * 2);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.brick--shape-arc {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='16' viewBox='0 0 100 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16Q50 -14 100 16Z'/%3E%3C/svg%3E");
}

.brick--shape-slant {
    --brick-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='16' viewBox='0 0 100 16' preserveAspectRatio='none'%3E%3Cpath d='M0 16L100 0V16Z'/%3E%3C/svg%3E");
}

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

.brick__pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.brick--pattern-bricks .brick__pattern {
    background: var(--brick-mark);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='28' viewBox='0 0 56 28'%3E%3Cpath d='M0 0h56v2H0zM0 14h56v2H0zM0 0h2v14H0zM28 14h2v14h-2z'/%3E%3C/svg%3E") 0 0 / 56px 28px repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='28' viewBox='0 0 56 28'%3E%3Cpath d='M0 0h56v2H0zM0 14h56v2H0zM0 0h2v14H0zM28 14h2v14h-2z'/%3E%3C/svg%3E") 0 0 / 56px 28px repeat;
}

.brick--pattern-stripes .brick__pattern {
    background: repeating-linear-gradient(-45deg, var(--brick-alt) 0 14px, transparent 14px 28px);
}

.brick--pattern-dots .brick__pattern {
    background: radial-gradient(circle, var(--brick-mark) 2.5px, transparent 3px) 0 0 / 18px 18px;
}

.brick--pattern-grid .brick__pattern {
    background:
        linear-gradient(var(--brick-mark) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(90deg, var(--brick-mark) 1px, transparent 1px) 0 0 / 28px 28px;
}

.brick--pattern-grain .brick__pattern {
    opacity: 0.35;
    mix-blend-mode: overlay;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -0.3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px 160px;
}

/* --- Breite -------------------------------------------------------------- */

/* Boxed: so breit wie der Inhalt (Bootstrap-Container), sonst wie bisher
   ueber die ganze Breite. */
.brick--width-boxed {
    width: min(100% - 2rem, var(--fest-container, 1320px));
    margin-inline: auto;
}

.brick--width-boxed.brick--tilt-left,
.brick--width-boxed.brick--tilt-right {
    width: min(104% - 2rem, calc(var(--fest-container, 1320px) * 1.02));
    margin-inline: auto;
}

/* --- Neigung ------------------------------------------------------------- */

.brick--tilt-left,
.brick--tilt-right {
    width: 104%;
    margin-inline: -2%;
}

.brick--tilt-left { transform: rotate(-1.6deg); }
.brick--tilt-right { transform: rotate(1.6deg); }

/* --- Schriftzug ---------------------------------------------------------- */

.brick__text,
.brick__run {
    position: relative;
    margin: 0;
    font-family: var(--brick-display);
    font-size: clamp(1.25rem, 3vw, 1.9rem);
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.brick--height-thin :is(.brick__text, .brick__run) { font-size: 0.85rem; letter-spacing: 0.08em; }
.brick--height-block :is(.brick__text, .brick__run) { font-size: clamp(2rem, 6vw, 4.5rem); }
.brick--height-area :is(.brick__text, .brick__run) { font-size: clamp(2.75rem, 10vw, 7.5rem); }

/* Auf Muster steht die Schrift auf einem Streifen in der Farbe des Steins. */
.brick:not(.brick--pattern-none, .brick--pattern-) :is(.brick__text > span, .brick__half > span) {
    padding: 0.05em 0.35em;
    background: var(--brick-bg);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.brick__run {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.brick__track {
    display: flex;
    width: max-content;
    animation: brick-run 40s linear infinite;
}

.brick__run:hover .brick__track {
    animation-play-state: paused;
}

.brick__half {
    display: flex;
    flex-shrink: 0;
    align-items: center;
}

.brick__half > span {
    padding-inline: 0.5em;
}

/* Wiederholungen: der Text kommt aus data-text (kein Seitentext), jedes
   Stueck endet mit einem Stern in der Gegenfarbe. */
.brick__copy::before {
    content: attr(data-text);
}

.brick__half > span::after {
    content: "✶";
    margin-left: 1em;
    color: var(--brick-alt);
}

.brick--color-soft .brick__half > span::after,
.brick--color-paper .brick__half > span::after {
    color: var(--fest-primary-ink, var(--brick-alt));
}

@keyframes brick-run {
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .brick__track {
        width: auto;
        justify-content: center;
        animation: none;
    }

    .brick__half + .brick__half,
    .brick__half > :not(:first-child) {
        display: none;
    }
}
