/**
 * ================================================
 * modal-storyline.css — het storyline-venster (intro van het verhaal)
 * ================================================
 *
 *   Het openingsvenster van een level en van de landingspagina: afbeelding met
 *   fade, hoofdstuk, titel, lore, premisse, taalkeuze en de spelknoppen.
 *
 *   Template: html/modal-storyline.html (#storyline-modal-template); gedrag in
 *   js/engine/StorylineModal.class.js (spel) en js/pages/LandingStoryline.class.js
 *   (landing).
 *
 *   Onderdelen:
 *     div.storyline-backdrop (.hidden / .visible) / div.storyline-modal
 *     div.storyline-image, div.storyline-image-fade        bovenste afbeelding
 *     .storyline-lang-select                               taalkeuze
 *     div.storyline-content                                tekstgebied: chapter,
 *                                                          title, subtitle, lore,
 *                                                          protagonist, premise
 *     div.storyline-footer                                 onderkant met
 *       button.storyline-play-btn (.active / .inactive)    de spelknop en
 *       button.storyline-help-btn                          de hulpknop
 *
 *   Op lage schermen (max-height 700px) staat een kleinere variant onderaan.
 */

div.storyline-backdrop
{
    position:        fixed;
    inset:           0;
    background:      rgba( 0, 0, 0, 0.72 );
    display:         flex;
    align-items:     center;
    justify-content: center;
    z-index:         200;
    pointer-events:  none;
    opacity:         0;
    transition:      opacity 0.6s ease;

    font-family: "Cormorant Garamond", serif;
}

div.storyline-backdrop.hidden
{
    display: none;
}

div.storyline-backdrop.visible
{
    opacity:        1;
    pointer-events: auto;
}

/**
 * ── Modal — nu áltijd (niet alleen bij orientation:landscape in modal.css)
 * begrensd op de viewport. Voorheen had .storyline-modal een vaste breedte
 * van 580px en géén max-height: in portrait-mode viel de modal (afbeelding
 * 180px + chapter + titel + subtitel + divider + 3 tekstblokken + knop)
 * makkelijk hoger uit dan het scherm. div.storyline-backdrop centreert met
 * flex + align-items:center, maar zonder max-height overflowt de modal
 * dan gelijk boven ЀN onder de viewport — bij een position:fixed-element
 * is dat overflowende deel nergens naartoe te scrollen, dus leek de modal
 * "verdwenen"/naar onderen gezakt. width:90vw + max-width:580px zorgt
 * voor dezelfde 580px op desktop (90vw > 580px pas vanaf ~644px breed),
 * max-height + overflow-y:auto zorgt dat 'ie op elk formaat, portrait of
 * landscape, binnen het scherm blijft en horizontaal + verticaal
 * gecentreerd blijft — nodig is 'ie dan zelf scrollbaar i.p.v. clipped.
 */
div.storyline-modal
{
    position:       relative;
    width:          90vw;
    max-width:      580px;
    max-height:     90vh;
    max-height:     90dvh;
    overflow-x:     hidden;
    overflow-y:     auto;
    -webkit-overflow-scrolling: touch;
    touch-action:   pan-y;
    overscroll-behavior: contain;
    background:     rgba( 10, 6, 2, 0.97 );
    border:         2px solid #7a5c3a;
    border-radius:  6px;
    box-shadow:     0 12px 48px rgba( 0, 0, 0, 0.9 );
    pointer-events: auto;
    font-family: inherit;
}

button.storyline-close
{
    position:       absolute;
    top:            8px;
    right:          10px;
    background:     rgba( 0, 0, 0, 0.55 );
    color:          #e8d5b0;
    border:         1px solid #7a5c3a;
    border-radius:  3px;
    font:           bold 15px Consolas, monospace;
    padding:        2px 10px;
    cursor:         default;
    letter-spacing: 0.05em;
    z-index:        1;   /* nodig: div.storyline-image erna heeft ook position:relative,
    zonder eigen z-index zou die er zonder dit overheen tekenen */
}

button.storyline-close:hover
{
    background: rgba( 80, 40, 10, 0.85 );
}

/** ── Sfeerbeeld bovenaan ─────────────────────────────────────── */

div.storyline-image
{
    position:   relative;
    width:      100%;
    height:     180px;
    overflow:   hidden;
    flex-shrink: 0;   /* voorkomt dat de afbeelding meekrimpt als de flex/scroll-berekening van storyline-modal daar per ongeluk aanleiding toe geeft */
}

div.storyline-image img
{
    width:      100%;
    height:     100%;
    object-fit: cover;
    object-position: center 40%;
    display:    block;
    -webkit-user-drag: none;   /* anders kan een swipe die op de foto begint door de browser als 'afbeelding slepen' opgevat worden i.p.v. scrollen */
    user-select: none;
}

/** Gradient fade van foto naar modal-achtergrond */
div.storyline-image-fade
{
    position:   absolute;
    inset:      0;
    background: linear-gradient(
        to bottom,
        rgba( 10, 6, 2, 0   ) 0%,
        rgba( 10, 6, 2, 0   ) 40%,
        rgba( 10, 6, 2, 0.7 ) 75%,
        rgba( 10, 6, 2, 0.97) 100%
        );
}


/** ── Lang-select ────────────────────────────────────────────── */

.storyline-lang-select
{
    position:      absolute;
    top:           12px;
    right:         12px;
    z-index:       2;
    appearance:    none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background:    rgba( 10, 6, 2, 0.9 ) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23e8d5b0' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;
    color:         #e8d5b0;
    border:        1px solid #7a5c3a;
    border-radius: 4px;
    padding:       5px 24px 5px 10px;
    font-family:   inherit;
    font-size:     0.82rem;
    cursor:        pointer;
}
.storyline-lang-select option
{
    background:#0a0602;
    color:#e8d5b0;
}

/** ── Tekst-gebied ────────────────────────────────────────────── */

div.storyline-content
{
    padding:    0 32px 8px;
    text-align: center;
}

p.storyline-chapter
{
    font-size:      1rem; /* 11px; */
    letter-spacing: 0.2em;
    color:          rgba( 122, 92, 58, 0.9 );
    text-transform: uppercase;
    margin:         0 0 4px;
}

h1.storyline-title
{
    font-size:      36px;
    font-weight:    bold;
    color:          rgba( 255, 215, 0, 1 );
    letter-spacing: 0.15em;
    margin:         0;
    text-shadow:    0 2px 12px rgba( 0, 0, 0, 0.8 );
}

p.storyline-subtitle
{
    font-size:      1rem; /* 11px; */
    color:          rgba( 200, 170, 110, 0.7 );
    letter-spacing: 0.12em;
    margin:         4px 0 0;
}

div.storyline-divider
{
    width:      60px;
    height:     1px;
    background: rgba( 122, 92, 58, 0.6 );
    margin:     16px auto;
}

p.storyline-lore
{
    font-size:   1.25rem;
    line-height: 1.6;
    color:       rgba( 232, 213, 176, 0.85 );
    margin:      0 0 14px;
    text-align:   justify;
}

p.storyline-protagonist
{
    font-size:   1rem; /* 11px; */
    line-height: 1.7;
    color:       rgba( 232, 213, 176, 0.85 );
    margin:      0 0 14px;
    text-align:  justify;
}

p.storyline-protagonist strong
{
    color:       rgba( 255, 215, 0, 1 );
    font-weight: bold;
}

p.storyline-premise
{
    font-size:    1.15rem;
    font-style:   italic;
    line-height:  1.6;
    color:        rgba( 180, 150, 90, 0.9 );

    margin:       0 0 20px;
    border-left:  2px solid rgba( 122, 92, 58, 0.5 );
    padding-left: 12px;
    text-align:   justify;
}

/**
 * ── Continuar-knop + sticky footer ─────────────────────────────
 * .storyline-footer is een APARTE wrapper rond de knop (zie de html/level*
 * -storyline.html-bestanden — de knop staat er niet meer los in
 * .storyline-content, maar erna, in zijn eigen div). Die wrapper krijgt
 * position:sticky; bottom:0 — omdat .storyline-modal de scrollende ouder
 * is (overflow-y:auto hierboven), blijft deze footer altijd onderin het
 * zichtbare deel van de modal "kleven", ook zonder dat je helemaal naar
 * beneden hoeft te scrollen. Geen JS nodig, puur CSS.
 * De knop zelf blijft z'n eigen pil-vormgeving houden — de wrapper zorgt
 * voor een ondoorzichtige achtergrond + fade zodat gescrolde tekst er
 * niet doorheen schemert terwijl de footer "zwevend" blijft staan.
 */
/**
 * Drie knoppen naast elkaar i.p.v. één — speler kan naar elk level
 * springen, niet alleen doorgaan met het huidige. flex-wrap zodat ze op
 * smalle schermen netjes doorlopen naar een tweede rij i.p.v. overflow.
 */
div.storyline-footer
{
    position:    sticky;
    bottom:      0;
    z-index:     1;
    padding:     16px 0 20px;
    display:     flex;
    justify-content: center;
    gap:         10px;
    flex-wrap:   wrap;
    background: linear-gradient(
        to bottom,
        rgba( 10, 6, 2, 0    ) 0%,
        rgba( 10, 6, 2, 0.85 ) 35%,
        rgba( 10, 6, 2, 0.97 ) 100%
        );
}

/** ── Basis — zelfde pil-vormgeving als de oude .storyline-close ────────── */
button.storyline-play-btn
{
    background:     rgba( 10, 6, 2, 0.97 );  /* ondoorzichtig — de knop kan over gescrolde tekst "zweven" */
    border:         1px solid #7a5c3a;
    border-radius:  3px;
    padding:        6px 20px;
    font-size:      1rem; /* 11px; */
    color:          #e8d5b0;
    cursor:         default;
    letter-spacing: 0.08em;
    transition:     background 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
}

button.storyline-play-btn:hover
{
    background: rgba( 122, 92, 58, 0.3 );
}

/** ── Actief — het level dat nu geladen is ───────────────────────────────── */
button.storyline-play-btn.active
{
    border-color: rgba( 255, 215, 0, 0.7 );
    color:        rgba( 255, 215, 0, 1 );
}

/**
 * ── Inactief — grayed-out maar NIET disabled: klik navigeert alsnog naar
 * dat level (skippen). Lagere opacity is genoeg contrast met .active,
 * geen aparte disabled-state nodig.
 */
button.storyline-play-btn.inactive
{
    opacity: 0.45;
}

button.storyline-play-btn.inactive:hover
{
    opacity: 0.75;
}

/**
 * ── Help ("?" + label "How to play") — los van de Play Level-knoppen, pil met
 * een rond vraagteken-icoon en de tekst ernaast, zodat duidelijk is waar de
 * knop voor dient. ──────────────────────────────────────────────────────── */

button.storyline-help-btn
{
    background:      rgba( 10, 6, 2, 0.97 );
    border:          1px solid #7a5c3a;
    border-radius:   16px;
    height:          32px;
    padding:         0 14px 0 4px;
    gap:             8px;
    font-size:       1rem;
    font-family:     inherit;
    letter-spacing:  0.06em;
    color:           rgba( 232, 213, 176, 0.85 );
    cursor:          default;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    transition:      background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

span.storyline-help-icon
{
    width:           24px;
    height:          24px;
    border:          1px solid #7a5c3a;
    border-radius:   50%;
    font-weight:     bold;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
}

button.storyline-help-btn:hover
{
    background:   rgba( 122, 92, 58, 0.3 );
    color:        rgba( 255, 215, 0, 1 );
    border-color: rgba( 255, 215, 0, 0.5 );
}

/**
 * ── Kleine schermen (portrait telefoons vooral) — wat minder ruimte voor
 * de sfeerfoto, zodat de teksteronder in het (nu scrollbare) beeld meer
 * ademruimte overhoudt voordat je hoeft te scrollen. Puur cosmetisch,
 * los van de fix hierboven — die werkt ook zonder dit blok.
 */
@media ( max-height: 700px )
{
    div.storyline-image
    {
        height: 120px;
    }
}
