/* ===================================================================
   Tagesposter (öffentliche Anzeige)
   Großformatiges, kindgerechtes Design für Beamer/Bildschirm und Druck.
   Design-Sprache wie die Tageswahl (style.css / daily-selection.css):
   Blau-Gradient, weiße Kacheln, große Emojis, Akzent #667eea.
   =================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html.poster-root,
html.poster-root body {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #6a82b8 0%, #8ba3c7 100%);
    background-attachment: fixed;
    color: #333;
}

html.poster-root body {
    min-height: 0;
    max-height: 100svh;
}

.poster {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: clamp(8px, 1.4vh, 24px) clamp(12px, 2.2vw, 32px);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* --------------------- Kopfbereich --------------------- */

.poster-header {
    flex: 0 0 auto;
    text-align: center;
    color: white;
    margin-bottom: clamp(4px, 1vh, 20px);
}

.poster-sun {
    font-size: clamp(1.6rem, 4.2vh, 3.4em);
    line-height: 1;
    margin-bottom: clamp(2px, 0.6vh, 6px);
}

.poster-title {
    font-size: clamp(1.45rem, 4.6vh, 3.2em);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin-bottom: clamp(4px, 1vh, 12px);
}

.poster-date {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: clamp(4px, 0.8vh, 10px) clamp(12px, 2vw, 30px);
    font-size: clamp(0.95rem, 2.2vh, 1.5em);
    font-weight: 600;
}

.poster-school {
    margin-top: clamp(4px, 0.8vh, 12px);
    font-size: clamp(0.9rem, 2vh, 1.3em);
    opacity: 0.95;
}

.poster-claim {
    flex: 0 0 auto;
    text-align: center;
    color: white;
    font-size: clamp(1rem, 2.4vh, 1.6em);
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin: clamp(4px, 1vh, 10px) 0 clamp(8px, 1.4vh, 26px) 0;
}

/* --------------------- Angebots-Kacheln --------------------- */

.poster main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.poster-grid {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr));
    align-content: stretch;
    justify-content: stretch;
    gap: clamp(6px, 1.2vh, 16px) clamp(6px, 1.2vw, 16px);
    overflow: hidden;
}

.poster-tile {
    position: relative;
    container-type: size;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(2px, 1.2cqh, 8px);
    background: white;
    border: 3px solid #e0e6f8;
    border-radius: clamp(10px, 2cqh, 20px);
    padding: clamp(6px, 3cqh, 16px) clamp(6px, 3cqw, 14px);
    text-align: center;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.poster-tile .tile-emoji {
    font-size: clamp(1.1rem, 16cqh, 2.4rem);
    line-height: 1;
    flex: 0 1 auto;
}

.poster-tile .tile-name {
    font-size: clamp(0.78rem, 8.5cqh, 1.15rem);
    font-weight: 700;
    color: #333;
    line-height: 1.25;
    overflow-wrap: anywhere;
    hyphens: auto;
    flex: 0 1 auto;
}

.poster-tile .tile-info {
    font-size: clamp(0.7rem, 6.5cqh, 1rem);
    color: #667eea;
    font-weight: 600;
    overflow-wrap: anywhere;
    flex: 0 1 auto;
}

.poster-tile .tile-detail {
    font-size: clamp(0.68rem, 6cqh, 0.95rem);
    color: #777;
    overflow-wrap: anywhere;
    flex: 0 1 auto;
}

.poster-tile .tile-spots {
    margin-top: auto;
    background: #f0f6ee;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: clamp(0.68rem, 6cqh, 0.95rem);
    color: #2e7d32;
    font-weight: 700;
    flex: 0 0 auto;
}

/* Volles Angebot: ausgegraut mit Badge */
.poster-tile.full {
    opacity: 0.6;
    background: #f2f2f2;
    border-color: #ddd;
}

.poster-tile.full .tile-full-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #ff7043;
    color: white;
    font-size: 1.05em;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 16px;
}

/* --------------------- Hinweis + Fußzeile --------------------- */

.poster-hint {
    flex: 0 0 auto;
    text-align: center;
    color: white;
    font-size: clamp(0.9rem, 2.2vh, 1.5em);
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin-top: clamp(6px, 1.2vh, 30px);
}

.poster-footer {
    flex: 0 0 auto;
    text-align: center;
    margin-top: auto;
    padding-top: clamp(4px, 1vh, 24px);
}

.poster-updated {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.75rem, 1.5vh, 1em);
}

.poster-footer .footer-image-tag {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.65rem, 1.2vh, 0.8em);
    font-family: ui-monospace, Consolas, monospace;
}

/* --------------------- Status-Seiten --------------------- */

.poster-status {
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: clamp(24px, 4vh, 60px) 30px;
    margin: clamp(12px, 2vh, 40px) auto;
    max-width: 700px;
}

.poster-status .status-emoji {
    font-size: 5em;
    line-height: 1;
    margin-bottom: 18px;
}

.poster-status .status-title {
    font-size: 2em;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.poster-status .status-text {
    font-size: 1.3em;
    color: #555;
}

/* --------------------- Kleinere Bildschirme --------------------- */

@media (max-width: 700px) {
    .poster {
        padding: 8px 10px;
    }
}

@media (max-height: 560px) {
    .poster-sun,
    .poster-school {
        display: none;
    }

    .poster-hint {
        display: none;
    }
}

/* Handy und Tablet: Seite darf nach unten scrollen, Kacheln bleiben groß. */
@media (max-width: 1199px) {
    html.poster-root {
        height: auto;
        min-height: 100svh;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: auto;
        -webkit-overflow-scrolling: touch;
    }

    html.poster-root body {
        height: auto;
        min-height: 100svh;
        max-height: none;
        overflow: visible;
    }

    .poster {
        height: auto;
        min-height: 100svh;
        overflow: visible;
        padding-bottom: calc(clamp(8px, 1.4vh, 24px) + env(safe-area-inset-bottom, 0px));
    }

    .poster main {
        flex: 1 1 auto;
        min-height: auto;
    }

    .poster-grid,
    .poster-grid[data-scrollable="1"] {
        flex: 0 1 auto;
        height: auto;
        overflow: visible;
        grid-template-rows: none;
        grid-auto-rows: auto;
    }

    .poster-tile {
        height: auto;
        min-height: 8rem;
        overflow: visible;
        container-type: inline-size;
        padding: 16px 14px;
        gap: 6px;
    }

    .poster-tile .tile-emoji {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
    }

    .poster-tile .tile-name {
        font-size: clamp(1rem, 4.2vw, 1.25rem);
    }

    .poster-tile .tile-info {
        font-size: clamp(0.85rem, 3.4vw, 1.05rem);
    }

    .poster-tile .tile-detail,
    .poster-tile .tile-spots {
        font-size: clamp(0.8rem, 3.2vw, 1rem);
    }

    .poster-tile.full .tile-full-badge {
        top: 10px;
        right: 10px;
        font-size: 0.85em;
        padding: 4px 10px;
    }

    .poster-sun,
    .poster-school,
    .poster-hint {
        display: block;
    }
}

/* --------------------- Druck --------------------- */

@media print {
    html.poster-root,
    html.poster-root body {
        height: auto;
        overflow: visible;
        position: static;
    }

    body {
        background: white;
        min-height: auto;
    }

    .poster {
        padding: 0;
        min-height: auto;
        height: auto;
        overflow: visible;
    }

    .poster-header,
    .poster-claim,
    .poster-hint {
        color: #333;
        text-shadow: none;
    }

    .poster-sun {
        display: none;
    }

    .poster-title {
        color: #4a5fb8;
    }

    .poster-date {
        background: none;
        border: 2px solid #4a5fb8;
        color: #4a5fb8;
    }

    .poster-claim {
        color: #555;
    }

    .poster-grid {
        gap: 14px;
        height: auto;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        grid-template-rows: none;
        grid-auto-rows: auto;
        overflow: visible;
    }

    .poster-tile {
        box-shadow: none;
        border-width: 2px;
        page-break-inside: avoid;
        break-inside: avoid;
        min-height: auto;
        padding: 20px 16px;
    }

    .poster-hint {
        color: #555;
    }

    /* Live-Infos sind auf Papier nicht sinnvoll */
    .poster-footer,
    .tile-spots {
        display: none;
    }
}
