/**
 * 10 Jahre Kellerkompanie — Jubiläums-Banner der Startseite.
 *
 * Wird nur eingebunden, solange app.py `anniversary` auf True setzt.
 * Die zehn Leuchtspur-Bögen im Hintergrund stehen für die zehn Jahre und
 * werden beim Laden nacheinander abgefeuert.
 */

#anniversary {
    --anniv-ink: #0d0e0f;
    --anniv-olive: #7c8a63;
    --anniv-smoke: #98a09b;
    --anniv-tracer: #ffb066;
    --anniv-tracer-hot: #fff1e0;

    margin-bottom: 2.5rem;
}

/* index.css setzt `span { white-space: nowrap; overflow: hidden }` global —
   hier wieder aufheben, sonst werden Datenzeilen und Jahreszahlen geclippt. */
#anniversary span {
    overflow: visible;
    text-overflow: clip;
}

.anniv-frame {
    width: 100%;
    border-top: 1px solid var(--color-primary);
    border-bottom: 1px solid var(--color-primary);
    background-color: var(--anniv-ink);
}

/**
 * Bühne: Screenshot-Hintergrund, Leuchtspuren, Typo.
 */
.anniv-stage {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: clamp(20rem, 40vw, 31rem);
    padding: clamp(2rem, 5vw, 3.75rem) 1.25rem clamp(2.25rem, 5vw, 3.25rem);
    background-image:
        radial-gradient(120% 90% at 50% 118%, rgba(255, 87, 34, 0.34) 0%, rgba(13, 14, 15, 0) 62%),
        linear-gradient(180deg, rgba(13, 14, 15, 0.9) 0%, rgba(13, 14, 15, 0.7) 45%, rgba(13, 14, 15, 0.94) 100%),
        url("/static/images/banner-background.jpg");
    background-size: cover, cover, cover;
    background-position: center, center, center 30%;
}

.anniv-tracers {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Verglühte Bahn — bleibt stehen, damit die Zehnerreihe auch ohne
   Animation als Struktur lesbar ist. */
.anniv-trail {
    fill: none;
    stroke: rgba(255, 176, 102, 0.13);
    stroke-width: 1;
}

.anniv-shot {
    fill: none;
    stroke: var(--anniv-tracer-hot);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 70 1000;
    stroke-dashoffset: 1070;
    opacity: 0;
    filter: drop-shadow(0 0 5px rgba(255, 120, 40, 0.95));
    animation: anniv-tracer 12s linear infinite;
}

.anniv-shot:nth-child(1)  { animation-delay: 0.25s; }
.anniv-shot:nth-child(2)  { animation-delay: 0.55s; }
.anniv-shot:nth-child(3)  { animation-delay: 0.8s; }
.anniv-shot:nth-child(4)  { animation-delay: 1.15s; }
.anniv-shot:nth-child(5)  { animation-delay: 1.4s; }
.anniv-shot:nth-child(6)  { animation-delay: 1.75s; }
.anniv-shot:nth-child(7)  { animation-delay: 2s; }
.anniv-shot:nth-child(8)  { animation-delay: 2.35s; }
.anniv-shot:nth-child(9)  { animation-delay: 2.6s; }
.anniv-shot:nth-child(10) { animation-delay: 2.95s; }

@keyframes anniv-tracer {
    0%   { stroke-dashoffset: 1070; opacity: 0; }
    1%   { opacity: 1; }
    14%  { stroke-dashoffset: 0; opacity: 1; }
    17%  { stroke-dashoffset: 0; opacity: 0; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}

/**
 * Leuchtgranaten: Aufstieg, Zündung am Scheitelpunkt, brennendes Absinken.
 */
.anniv-mortar {
    fill: none;
    stroke: var(--anniv-tracer-hot);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 45 1000;
    stroke-dashoffset: 1045;
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(255, 120, 40, 0.95));
    animation: anniv-mortar-rise 12s linear infinite;
}

.anniv-mortar:nth-child(1) { animation-delay: 3s; }
.anniv-mortar:nth-child(2) { animation-delay: 3.8s; }
.anniv-mortar:nth-child(3) { animation-delay: 4.6s; }

@keyframes anniv-mortar-rise {
    0%    { stroke-dashoffset: 1045; opacity: 0; }
    1%    { opacity: 1; }
    12%   { stroke-dashoffset: 0; opacity: 1; }
    13.5% { stroke-dashoffset: 0; opacity: 0; }
    100%  { stroke-dashoffset: 0; opacity: 0; }
}

/* Zündverzögerung je Granate — gilt für Fackel und Zündblitz gleichermaßen. */
.anniv-flares > g:nth-child(1) * { animation-delay: 3s; }
.anniv-flares > g:nth-child(2) * { animation-delay: 3.8s; }
.anniv-flares > g:nth-child(3) * { animation-delay: 4.6s; }

.anniv-flare {
    opacity: 0;
    animation: anniv-flare-hang 12s linear infinite;
}

@keyframes anniv-flare-hang {
    0%    { opacity: 0; transform: translate(0px, -8px); }
    12%   { opacity: 0; transform: translate(0px, -8px); }
    13.5% { opacity: 1; transform: translate(0px, 0px); }
    40%   { opacity: 0.9; transform: translate(-12px, 70px); }
    68%   { opacity: 0; transform: translate(-22px, 150px); }
    100%  { opacity: 0; transform: translate(-22px, 150px); }
}

.anniv-flare-halo {
    fill: url(#anniv-halo);
}

.anniv-flare-inner {
    fill: url(#anniv-halo-hot);
    opacity: 0.5;
}

.anniv-flare-core {
    fill: #fff8ee;
    filter: drop-shadow(0 0 9px rgba(255, 150, 60, 1));
}

/* Rote und grüne Signalfackeln — Farbe gilt für Aufstiegsspur, Zündblitz
   und die brennende Fackel gemeinsam. */
.anniv-mortar--red {
    stroke: #ffd9d4;
    filter: drop-shadow(0 0 6px rgba(255, 45, 32, 0.95));
}

.anniv-mortar--green {
    stroke: #e2fff0;
    filter: drop-shadow(0 0 6px rgba(38, 178, 92, 0.95));
}

.anniv-signal--red .anniv-flare-halo { fill: url(#anniv-halo-red); }
.anniv-signal--red .anniv-flare-inner { fill: url(#anniv-halo-red-hot); }
.anniv-signal--red .anniv-flare-core {
    fill: #ffeeeb;
    filter: drop-shadow(0 0 9px rgba(255, 60, 45, 1));
}
.anniv-signal--red .anniv-airburst-flash { fill: url(#anniv-halo-red-hot); }
.anniv-signal--red .anniv-airburst-ring { stroke: #ff8375; }

.anniv-signal--green .anniv-flare-halo { fill: url(#anniv-halo-green); }
.anniv-signal--green .anniv-flare-inner { fill: url(#anniv-halo-green-hot); }
.anniv-signal--green .anniv-flare-core {
    fill: #edfff4;
    filter: drop-shadow(0 0 9px rgba(60, 220, 110, 1));
}
.anniv-signal--green .anniv-airburst-flash { fill: url(#anniv-halo-green-hot); }
.anniv-signal--green .anniv-airburst-ring { stroke: #7ceaa2; }

.anniv-airburst-flash {
    fill: url(#anniv-halo-hot);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: anniv-airburst-flash 12s linear infinite;
}

@keyframes anniv-airburst-flash {
    0%    { opacity: 0; transform: scale(0.2); }
    11.5% { opacity: 0; transform: scale(0.2); }
    13.5% { opacity: 1; transform: scale(1); }
    19%   { opacity: 0; transform: scale(1.7); }
    100%  { opacity: 0; transform: scale(1.7); }
}

.anniv-airburst-ring {
    fill: none;
    stroke: var(--anniv-tracer-hot);
    stroke-width: 2;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: anniv-airburst-ring 12s linear infinite;
}

@keyframes anniv-airburst-ring {
    0%    { opacity: 0; transform: scale(0.2); }
    12%   { opacity: 0; transform: scale(0.2); }
    13.5% { opacity: 0.85; transform: scale(0.6); }
    21%   { opacity: 0; transform: scale(3.6); }
    100%  { opacity: 0; transform: scale(3.6); }
}

/**
 * Einschläge am Boden.
 */
.anniv-blasts > g:nth-child(1) * { animation-delay: 1.2s; }
.anniv-blasts > g:nth-child(2) * { animation-delay: 5.9s; }
.anniv-blasts > g:nth-child(3) * { animation-delay: 8.6s; }

.anniv-blast-flash {
    fill: url(#anniv-halo-hot);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: anniv-blast-flash 12s linear infinite;
}

@keyframes anniv-blast-flash {
    0%    { opacity: 0; transform: scale(0.15); }
    1.2%  { opacity: 1; transform: scale(1); }
    7%    { opacity: 0; transform: scale(1.6); }
    100%  { opacity: 0; transform: scale(1.6); }
}

.anniv-blast-ring {
    fill: none;
    stroke: var(--anniv-tracer);
    stroke-width: 2;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: anniv-blast-ring 12s linear infinite;
}

@keyframes anniv-blast-ring {
    0%    { opacity: 0; transform: scale(0.2); }
    1%    { opacity: 0.9; transform: scale(0.6); }
    10%   { opacity: 0; transform: scale(4); }
    100%  { opacity: 0; transform: scale(4); }
}

.anniv-core {
    position: relative;
    z-index: 1;
    text-align: center;
}

.anniv-signet {
    display: block;
    width: clamp(3.25rem, 6vw, 4.5rem);
    height: auto;
    margin: 0 auto 1.25rem;
}

.anniv-title {
    margin: 0;
    font-family: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", sans-serif;
    font-weight: 800;
    font-size: clamp(2.3rem, 8.4vw, 6.2rem);
    line-height: 0.84;
    letter-spacing: 0.005em;
    text-transform: uppercase;
    color: var(--color-text-primary);
}

/* Die Konturzeile läuft größer, damit beide Zeilen auf gleiche Breite
   kommen — acht Zeichen oben, vierzehn unten. */
.anniv-title-lead {
    display: block;
    font-size: 1.92em;
    line-height: 0.86;
    color: var(--color-primary);
}

.anniv-title-name {
    display: block;
}

@supports (-webkit-text-stroke: 1px black) {
    .anniv-title-lead {
        color: transparent;
        -webkit-text-stroke: 2.5px var(--color-primary);
    }
}

.anniv-copy {
    max-width: 54ch;
    margin: 1.5rem auto 0;
    text-wrap: balance;
    font-size: 1.02rem;
    line-height: 1.6;
    color: #d7dad6;
}

.anniv-cta {
    display: inline-block;
    margin-top: 1.75rem;
    padding: 0.85rem 1.7rem;
    border: 1px solid var(--color-primary);
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-primary);
    background-color: rgba(13, 14, 15, 0.55);
    transition: background-color 0.18s ease, color 0.18s ease;
}

.anniv-cta:hover,
.anniv-cta:focus-visible {
    background-color: var(--color-primary);
    color: var(--anniv-ink);
}

.anniv-cta:focus-visible {
    outline: 2px solid var(--anniv-tracer);
    outline-offset: 3px;
}

/**
 * Jahresleiste: ein Strich pro Jahr, der letzte markiert das Jubiläum.
 */
.anniv-ruler {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.25rem;
    margin: 0;
    padding: 0.9rem 1.25rem 1rem;
    list-style: none;
    border-top: 1px solid rgba(124, 138, 99, 0.35);
    background-color: rgba(0, 0, 0, 0.35);
}

.anniv-year {
    flex: 1 1 0;
    text-align: center;
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    color: var(--anniv-smoke);
}

.anniv-year::before {
    content: "";
    display: block;
    width: 1px;
    height: 0.65rem;
    margin: 0 auto 0.5rem;
    background-color: rgba(124, 138, 99, 0.6);
}

.anniv-year--now {
    color: var(--color-primary);
}

.anniv-year--now::before {
    height: 1.1rem;
    margin-top: -0.45rem;
    background-color: var(--color-primary);
}

/**
 * Mobil: Zwischenjahre nur noch als Strich, damit die Leiste lesbar bleibt.
 */
@media only screen and (max-width: 700px) {
    .anniv-year span {
        display: none;
    }

    .anniv-year:first-child span,
    .anniv-year--now span {
        display: inline;
    }
}

/* ---------------------------------------------------------------
   Anzeigen in den Seitenrändern.

   Der Materialize-Container ist ab 993px nur 70% breit; die 15% links und
   rechts stehen leer. Genau dort sitzen die Anzeigen - und nur dann, wenn
   dort auch wirklich Platz ist.
   --------------------------------------------------------------- */

.flanke {
    display: none;
}

@media only screen and (min-width: 1280px) {
    .flanke {
        --flanke-breite: min(15rem, calc(15vw - 1.75rem));

        display: block;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: var(--flanke-breite);
        z-index: 500;
    }

    .flanke--links {
        left: calc(7.5vw - var(--flanke-breite) / 2);
    }

    .flanke--rechts {
        right: calc(7.5vw - var(--flanke-breite) / 2);
    }
}

.flanke-label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.58rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--color-text-disabled);
}

.flanke-knopf {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.flanke-knopf:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

.flanke-bild {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--color-border-dark);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

/**
 * Vollbildansicht einer Anzeige.
 */
.flanke-vollbild {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vh, 3rem);
    background-color: rgba(5, 6, 7, 0.94);
    cursor: zoom-out;
}

.flanke-vollbild img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9);
}

.flanke-vollbild-schliessen {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--color-border-medium);
    background-color: rgba(13, 14, 15, 0.85);
    color: var(--color-text-primary);
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
}

.flanke-vollbild-schliessen:hover,
.flanke-vollbild-schliessen:focus-visible {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Seite hinter der Vollbildansicht nicht mitscrollen lassen */
body.flanke-offen {
    overflow: hidden;
}

/* ---------------------------------------------------------------
   Ordensspange: ein Band je Dienstjahr auf einem Kartentisch.
   --------------------------------------------------------------- */

#ordensspange {
    margin-bottom: 2.5rem;
}

/* index.css setzt `span { white-space: nowrap; overflow: hidden }` global. */
#ordensspange span {
    overflow: visible;
    text-overflow: clip;
}

.spange-frame {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-top: 1px solid var(--color-primary);
    border-bottom: 1px solid var(--color-primary);
    padding: clamp(2.25rem, 4vw, 3.25rem) clamp(1rem, 3vw, 2.5rem);
    background-color: #0e1210;
    background-image:
        radial-gradient(125% 95% at 50% 42%, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, 0.78) 100%),
        repeating-linear-gradient(0deg, rgba(124, 138, 99, 0.09) 0 1px, transparent 1px 44px),
        repeating-linear-gradient(90deg, rgba(124, 138, 99, 0.09) 0 1px, transparent 1px 44px),
        repeating-linear-gradient(0deg, rgba(124, 138, 99, 0.19) 0 1px, transparent 1px 220px),
        repeating-linear-gradient(90deg, rgba(124, 138, 99, 0.19) 0 1px, transparent 1px 220px),
        linear-gradient(160deg, #141b17 0%, #0b0f0d 62%, #0e1210 100%);
}

.spange-contours {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.34;
    pointer-events: none;
}

.spange-contours path {
    fill: none;
    stroke: rgba(150, 168, 120, 0.3);
    stroke-width: 1;
}

.spange-defs {
    position: absolute;
}

.spange-frame > *:not(.spange-contours) {
    position: relative;
    z-index: 1;
}

.spange-head {
    text-align: center;
    margin-bottom: 2.75rem;
}

.spange-title {
    margin: 0;
    font-family: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", sans-serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    line-height: 0.9;
    text-transform: uppercase;
    color: var(--color-text-primary);
}

.spange-sub {
    margin: 1rem auto 0;
    font-size: 1.06rem;
    line-height: 1.55;
    color: #c9cdc8;
    text-wrap: balance;
}

.spange-rack {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem 1.15rem;
    max-width: 52rem;
    margin: 0 auto;
}

@media only screen and (max-width: 760px) {
    .spange-rack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 24rem;
    }
}

.spange-ribbon {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    text-align: center;
}

/* Einzeln gefasstes Band: dunkle Kante, heller Grat oben, Schlagschatten */
.spange-band {
    position: relative;
    display: block;
    aspect-ratio: 3.6 / 1;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 1px rgba(255, 255, 255, 0.12),
        0 3px 7px rgba(0, 0, 0, 0.75);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.spange-ribbon:hover .spange-band,
.spange-ribbon:focus-visible .spange-band,
.spange-ribbon.is-active .spange-band {
    transform: translateY(-3px);
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 1px rgba(255, 255, 255, 0.12),
        0 8px 15px rgba(0, 0, 0, 0.85);
}

.spange-ribbon:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

.spange-silk {
    position: absolute;
    inset: 0;
}

/* Ripsbindung: feine Rippen längs des Bandes */
.spange-silk::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
        rgba(0, 0, 0, 0.20) 0 1px,
        rgba(255, 255, 255, 0.10) 1px 2px);
}

/* Stofffall: dunkle Ober- und Unterkante, Glanz im oberen Drittel */
.spange-silk::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.34) 0%,
        rgba(255, 255, 255, 0.06) 12%,
        rgba(255, 255, 255, 0.14) 30%,
        rgba(255, 255, 255, 0.00) 58%,
        rgba(0, 0, 0, 0.18) 84%,
        rgba(0, 0, 0, 0.42) 100%);
}

.spange-device {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42%;
    height: 42%;
    transform: translate(-50%, -50%);
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.95));
}

.spange-year {
    display: block;
    margin-top: 0.6rem;
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: var(--color-text-muted);
    transition: color 0.16s ease;
}

.spange-ribbon:hover .spange-year,
.spange-ribbon.is-active .spange-year {
    color: var(--color-primary);
}

.spange-dossier {
    max-width: 52rem;
    margin: 2.75rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(124, 138, 99, 0.35);
    text-align: center;
    min-height: 6rem;
}

.spange-dossier-year {
    font-family: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", sans-serif;
    font-weight: 800;
    font-size: 2.6rem;
    line-height: 1;
    color: var(--color-primary);
}

.spange-dossier-label {
    margin-top: 0.7rem;
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--anniv-olive, #7c8a63);
}

.spange-dossier-theatres {
    margin-top: 0.4rem;
    font-size: 1.02rem;
    line-height: 1.5;
    color: #dfe2de;
}

.spange-hint {
    font-size: 0.92rem;
    color: var(--color-text-muted);
    padding-top: 1.4rem;
}

/* Das Jubiläums-Banner läuft bewusst auch bei `prefers-reduced-motion: reduce`.
   Windows meldet die Kennung schon dann, wenn unter Einstellungen >
   Barrierefreiheit > Visuelle Effekte die Animationseffekte aus sind - was
   viele für mehr Leistung abschalten. Die Feuerwerksbahnen wären damit für
   einen guten Teil der Gemeinschaft unsichtbar; der Monat ist zu kurz dafür. */

@media (prefers-reduced-motion: reduce) {
    .spange-band {
        transition: none;
    }

    .spange-ribbon:hover .spange-band,
    .spange-ribbon:focus-visible .spange-band,
    .spange-ribbon.is-active .spange-band {
        transform: none;
    }
}
