/* LA LÉGENDE D'ALANDYS (shared/legend.js) — le film en 16:9 au centre de l'écran (bandes noires autour), le titre
   sous le médaillon, la voix du conte dans la bande du bas du film. Tailles en cqw : elles suivent la largeur du film,
   du téléphone au grand écran. Au-dessus du sanctuaire, sous « Tourne ton téléphone ». */

.screen.legend {
    padding: 0;
    background: #000;
    z-index: 200;
    overflow: hidden;
    align-items: center;
    animation: legend-in 0.6s ease both;
}

.screen.legend.leaving {
    animation: legend-out 0.6s ease both;
    pointer-events: none;
}

@keyframes legend-in { from { opacity: 0; } }
@keyframes legend-out { to { opacity: 0; } }

.legend-frame {
    position: relative;
    width: min(100vw, calc(100vh * 16 / 9));
    width: min(100vw, calc(100dvh * 16 / 9));
    aspect-ratio: 16 / 9;
    container-type: inline-size;
}

.legend-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #05070f;
    object-fit: cover;
}

.legend-title {
    position: absolute;
    left: 0;
    right: 0;
    top: 46.5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7cqw;
    color: #e6c26b;
    text-align: center;
    font-family: var(--serif);
    text-shadow: 0 0 2cqw rgba(230, 194, 107, 0.28);
    opacity: 0;
    pointer-events: none;
}

.legend-kicker {
    font-size: 2.6cqw;
    letter-spacing: 0.05em;
}

.legend-name {
    font-size: 5.2cqw;
    font-weight: 600;
    line-height: 1;
}

.legend-voice {
    position: absolute;
    left: 7%;
    right: 7%;
    top: 83.4%;
    bottom: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3cqw;
    color: #efe6cf;
    text-align: center;
    font-family: var(--serif);
    font-size: 2.15cqw;
    line-height: 1.32;
    text-shadow: 0 0.1cqw 0.7cqw rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.legend-line {
    opacity: 0;
}

.legend-line:empty {
    display: none;
}

/* Le navigateur refuse de lancer le son tout seul : un bouton pour démarrer */
.legend-start {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 1.1cqw 2.4cqw;
    border: 1px solid rgba(230, 194, 107, 0.7);
    border-radius: 999px;
    background: rgba(7, 10, 22, 0.78);
    color: #e6c26b;
    font: 600 max(15px, 1.6cqw)/1 var(--serif);
    cursor: pointer;
}

.legend-start:hover,
.legend-start:focus-visible {
    background: rgba(230, 194, 107, 0.16);
}

.legend-skip {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    padding: 8px 16px;
    border: 1px solid rgba(230, 194, 107, 0.4);
    border-radius: 999px;
    background: rgba(7, 10, 22, 0.6);
    color: #e6c26b;
    font: 600 14px/1 var(--font);
    letter-spacing: 0.02em;
    opacity: 0.72;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.legend-skip:hover,
.legend-skip:focus-visible {
    opacity: 1;
    background: rgba(230, 194, 107, 0.14);
}

/* Carnet : la Légende à revoir, en tête du carnet */
.codex-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid rgba(230, 194, 107, 0.32);
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(230, 194, 107, 0.1), rgba(230, 194, 107, 0.02));
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.codex-legend:hover,
.codex-legend:focus-visible {
    border-color: rgba(230, 194, 107, 0.7);
    background: linear-gradient(90deg, rgba(230, 194, 107, 0.18), rgba(230, 194, 107, 0.04));
}

.codex-legend-mark {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(230, 194, 107, 0.6);
    border-radius: 50%;
    color: #e6c26b;
    font-size: 13px;
}

.codex-legend-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.codex-legend-text b {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
    color: #e6c26b;
}

.codex-legend-text small {
    color: var(--muted, rgba(236, 230, 214, 0.65));
    font-size: 12px;
}

.legend-kicker[hidden] {
    display: none;
}

/* La pastille « Nouveau » de l'entrée du Carnet, tant que la Légende n'a pas été ouverte (hub.js, noteLegend) */
.codex-legend-new {
    margin-left: 8px;
    padding: 1px 7px;
    border: 1px solid rgba(230, 194, 107, 0.5);
    border-radius: 999px;
    background: rgba(230, 194, 107, 0.16);
    color: #f3dfa2;
    font-family: var(--sans, inherit);
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.04em;
    vertical-align: 2px;
}

/* Le dessin au-dessus du titre d'une fenêtre (shared/dialog.js, icon) : le cachet de la Légende proposée au retour */
.dialog-card .dialog-icon {
    display: flex;
    justify-content: center;
    margin: 0 0 6px;
}

.dialog-card .dialog-icon svg {
    width: 64px;
    height: 64px;
}

html.phone .dialog-card .dialog-icon svg {
    width: 44px;
    height: 44px;
}
