/* ============================================================
   Séance à la carte — feuille de style du catalogue de films
   Template d'export tinyMediaManager (movie list)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Archivo:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap');

:root {
    --paper:        #f3f3f0;   /* fond papier, gris chaud neutre        */
    --card:         #ffffff;   /* fiches                                */
    --ink:          #17171a;   /* texte principal                       */
    --muted:        #6e6e68;   /* texte secondaire                      */
    --hairline:     #e4e3dd;   /* filets, bordures                      */
    --accent:       #1f3a5f;   /* bleu-nuit « ticket »                  */
    --accent-soft:  #e8edf3;   /* fond des puces                        */
    --star:         #b9822b;   /* étoile de note                        */

    --f-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --f-body:    'Archivo', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --f-mono:    'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--f-body);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 44px 32px 64px;
}

/* --- En-tête / programme ------------------------------------ */

.programme {
    border-bottom: 1.5px solid var(--ink);
    padding-bottom: 22px;
    margin-bottom: 34px;
}

.programme__mark {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.programme__title {
    font-family: var(--f-display);
    font-optical-sizing: auto;
    font-weight: 500;
    font-size: 46px;
    line-height: 1.02;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
}

.programme__note {
    margin: 0;
    max-width: 46ch;
    color: var(--muted);
    font-size: 13.5px;
}

/* --- Grille de fiches --------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    display: flex;
    background: var(--card);
    border: 1px solid var(--hairline);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(23, 23, 26, 0.04);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
    box-shadow: 0 6px 20px rgba(23, 23, 26, 0.10);
    transform: translateY(-2px);
}

.card__poster {
    flex-shrink: 0;
    width: 120px;
    align-self: stretch;
    min-height: 180px;
    object-fit: cover;
    background: var(--hairline);
    display: block;
}

.card__body {
    flex: 1;
    min-width: 0;
    padding: 13px 15px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* ligne du haut : n° + case à cocher / puces */

.card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card__id {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tick {
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--ink);
    border-radius: 3px;
    flex-shrink: 0;
}

.cat-no {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.chips {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.chip {
    font-family: var(--f-mono);
    font-size: 10.5px;
    letter-spacing: 0.02em;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

.card__title {
    font-family: var(--f-display);
    font-optical-sizing: auto;
    font-weight: 500;
    font-size: 18.5px;
    line-height: 1.14;
    letter-spacing: -0.005em;
    margin: 1px 0 0;
}

.rating {
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating .star { color: var(--star); }

.genres {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.cast {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plot {
    margin: 2px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Impression / export PDF -------------------------------- */

@page {
    size: A4;
    margin: 13mm;
}

@media print {
    :root { --paper: #ffffff; }

    body { font-size: 10.5px; }

    .page { max-width: none; margin: 0; padding: 0; }

    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        transform: none;
    }

    /* force l'impression des couleurs (puces, accent, case) */
    .card, .chip, .tick, .card__spine, .programme {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card__poster { width: 96px; min-height: 144px; }
    .card__title  { font-size: 15px; }
    .plot { -webkit-line-clamp: 4; }
}

@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
    .card:hover { transform: none; }
}

/* --- Petits écrans ------------------------------------------ */

@media (max-width: 520px) {
    .page { padding: 30px 18px 44px; }
    .programme__title { font-size: 34px; }
    .grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Sélection interactive (écran)
   ============================================================ */

.card { cursor: pointer; }

.card.is-selected {
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    background: #fbfcfe;
}

.tick { position: relative; transition: background 0.12s ease, border-color 0.12s ease; }

.tick::after {
    content: '';
    position: absolute;
    left: 4.5px; top: 1px;
    width: 4px; height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.card.is-selected .tick { background: var(--accent); border-color: var(--accent); }
.card.is-selected .tick::after { opacity: 1; }

/* barre flottante de sélection */

.selbar {
    position: fixed;
    left: 50%; bottom: 24px;
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--ink);
    color: #fff;
    padding: 11px 12px 11px 20px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(23, 23, 26, 0.25);
    font-size: 13.5px;
}
.selbar[hidden] { display: none; }

.selbar__count strong { font-family: var(--f-mono); }
.selbar__actions { display: flex; gap: 8px; }

.btn {
    font-family: var(--f-body);
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 999px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #28497a; }
.btn--ghost {
    background: transparent;
    color: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.10); }

/* fenêtre liste */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(23, 23, 26, 0.45);
    padding: 20px;
}
.modal[hidden] { display: none; }

.modal__box {
    background: var(--card);
    color: var(--ink);
    width: min(560px, 100%);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--hairline);
}
.modal__title {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 20px;
    margin: 0;
}
.modal__close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}
.modal__close:hover { color: var(--ink); }

.modal__text {
    flex: 1;
    margin: 0;
    border: none;
    resize: none;
    padding: 16px 20px;
    font-family: var(--f-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--paper);
    min-height: 180px;
    outline: none;
}
.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--hairline);
}
.modal__foot .btn--ghost {
    color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--hairline);
}
.modal__foot .btn--ghost:hover { background: var(--accent-soft); }

@media print {
    .selbar, .modal { display: none !important; }
    .card { cursor: auto; }
}
