/**
 * Modale des offres d'emploi.
 * Les sélecteurs sont ceux attendus par /assets/js/jobs.js et par le
 * back-office : ne pas les renommer. Seul l'habillage change ici, pour
 * suivre la direction artistique du site. Les valeurs de repli permettent
 * à cette feuille de fonctionner même chargée sans home.css.
 */

.lg27-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2.5rem);
    background: rgba(12, 10, 8, 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
}

/* jobs.js ajoute .is-open dans le même tick que l'insertion : une
   transition ne démarrerait jamais, une animation si. */
.lg27-modal-backdrop.is-open {
    animation: lg27-veil-in 0.45s cubic-bezier(0.19, 1, 0.22, 1) both;
}

@keyframes lg27-veil-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lg27-modal-backdrop * {
    box-sizing: border-box;
}

.lg27-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 46rem;
    max-height: 88vh;
    overflow: hidden;
    background: var(--paper, #f7f4ee);
    color: var(--ink, #1d1d1b);
    border: 1px solid rgba(29, 29, 27, 0.14);
    box-shadow: 0 30px 80px rgba(12, 10, 8, 0.45);
    animation: lg27-modal-in 0.6s cubic-bezier(0.19, 1, 0.22, 1) both;
}

@keyframes lg27-modal-in {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.lg27-modal-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    padding: clamp(1.5rem, 4vw, 2.25rem) clamp(1.5rem, 4vw, 2.5rem) 1.25rem;
    border-bottom: 1px solid rgba(29, 29, 27, 0.14);
}

.lg27-modal h2 {
    margin: 0;
    font-family: var(--font-display, "Cormorant Garamond", serif);
    font-weight: 400;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1;
    letter-spacing: -0.01em;
}

.lg27-modal-close {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: none;
    border: none;
    font-family: var(--font-mono, monospace);
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink, #1d1d1b);
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.lg27-modal-close:hover,
.lg27-modal-close:focus-visible {
    opacity: 1;
}

#jobs-modal-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: clamp(1.25rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2.5rem) clamp(1.75rem, 4vw, 2.5rem);
}

.lg27-modal p {
    margin: 0;
    font-family: var(--font-sans, sans-serif);
    font-weight: 300;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: rgba(29, 29, 27, 0.7);
}

/* ── Liste des postes ── */

.lg27-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(29, 29, 27, 0.1);
    counter-reset: poste;
}

.lg27-list button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
    padding: 1.25rem 0;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(29, 29, 27, 0.1);
    font-family: var(--font-display, "Cormorant Garamond", serif);
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--ink, #1d1d1b);
    text-align: left;
    cursor: pointer;
    counter-increment: poste;
    position: relative;
    padding-left: 3.25rem;
    transition: color 0.4s cubic-bezier(0.19, 1, 0.22, 1),
                transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Numérotation des postes — le vocabulaire des étages du site. */
.lg27-list button::before {
    content: counter(poste, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 1.5rem;
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--gold, #a8865f);
}

/* transform plutôt que padding : pas de recalcul, pas de tremblement. */
.lg27-list button:hover,
.lg27-list button:focus-visible {
    color: var(--gold, #a8865f);
    transform: translateX(0.5rem);
}

.lg27-job-description {
    display: block;
    max-width: 68ch;
    font-family: var(--font-sans, sans-serif);
    font-style: normal;
    font-weight: 300;
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(29, 29, 27, 0.72);
}

/* ── Fiche de poste ── */

.lg27-pdf-frame {
    display: block;
    width: 100%;
    height: min(58vh, 34rem);
    margin: 1.25rem 0;
    border: 1px solid rgba(29, 29, 27, 0.14);
    background: var(--paper-warm, #efe9df);
}

.lg27-job-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.lg27-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    background: none;
    border: 1px solid rgba(29, 29, 27, 0.45);
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink, #1d1d1b);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.4s cubic-bezier(0.19, 1, 0.22, 1),
                color 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.lg27-button:hover,
.lg27-button:focus-visible {
    border-color: var(--gold, #a8865f);
    color: var(--gold, #a8865f);
}

/* ── Messages ── */

.lg27-message {
    font-family: var(--font-sans, sans-serif);
    font-size: 0.875rem;
}

.lg27-message.error {
    color: #8c3b2e;
}

.lg27-message.success {
    color: #4a6b45;
}

/* ── Formulaires (back-office) ── */

.lg27-form-grid {
    display: grid;
    gap: 1rem;
}

.lg27-form-grid label,
.lg27-form-grid strong {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(29, 29, 27, 0.72);
}

.lg27-form-grid input,
.lg27-form-grid textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--paper-warm, #efe9df);
    border: 1px solid rgba(29, 29, 27, 0.18);
    font-family: var(--font-sans, sans-serif);
    font-size: 0.9375rem;
    color: var(--ink, #1d1d1b);
}

.lg27-form-grid input:focus,
.lg27-form-grid textarea:focus {
    outline: none;
    border-color: var(--gold, #a8865f);
}

.lg27-modal form button {
    align-self: flex-start;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--ink, #1d1d1b);
    border: 1px solid var(--ink, #1d1d1b);
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--paper, #f7f4ee);
    cursor: pointer;
    transition: opacity 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.lg27-modal form button:hover,
.lg27-modal form button:focus-visible {
    opacity: 0.8;
}

@media (max-width: 992px) {
    .lg27-modal {
        max-height: 92vh;
    }

    .lg27-pdf-frame {
        height: min(52vh, 26rem);
    }

    .lg27-job-actions .lg27-button {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lg27-modal-backdrop,
    .lg27-modal,
    .lg27-list button,
    .lg27-button {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
