/* Carte d'une offre : style COMMUN à la page des annonces (view/) et à l'aperçu du formulaire de dépôt (add/).
   Le HTML de la carte est construit par shared/carte.js. Pour changer l'apparence d'une offre, modifier ce fichier :
   la page des annonces et l'aperçu suivent ensemble. Style repris de la page « entreprises » de l'AFIG
   (https://afig-asso.github.io/entreprises/). Les couleurs des types d'offres sont dans shared/types.json. */

/* Palette AFIG : changer le thème = changer ces variables */
:root {
    --afig-50:  #f4fae3;
    --afig-100: #ecf6cf;
    --afig-200: #d6ee8f;
    --afig:     #a2d026;   /* vert AFIG : bandeau */
    --afig-600: #6f8f12;
    --afig-700: #56720c;
    --afig-800: #3e5307;
    --ink:      #1d2a00;   /* texte sur vert AFIG */

    --text:   #1f2328;
    --text-2: #3a4046;
    --muted:  #5b6168;
    --line:   #e6e9e2;
    --line-2: #cfd4cb;

    --radius: 12px;
    --radius-band: 16px;
    --shadow-sm: 0 1px 2px rgba(29, 42, 0, 0.08);
    --shadow-md: 0 6px 20px rgba(29, 42, 0, 0.10);
    --ease: 140ms ease;
    --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Liste : une ligne par offre ---------- */
.liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.offre {
    display: grid;
    grid-template-columns: minmax(9rem, 11rem) minmax(0, 1fr) auto;
    gap: 0.4rem 2rem;
    align-items: start;
    padding: 1.05rem 1rem 1.1rem;
    border-bottom: 1px solid var(--line);
    transition: background-color var(--ease), box-shadow var(--ease);
}
.offre:hover, .offre:focus-within { background: var(--afig-50); box-shadow: inset 3px 0 0 var(--afig); }

.offre-tete { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }

/* Étiquette du type : la couleur vient de shared/types.json (variable --c posée par script.js) */
.badge {
    display: inline-flex; align-items: center; min-height: 26px; padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem; font-weight: 700; line-height: 1.2;
    color: color-mix(in srgb, var(--c, var(--muted)) 62%, black);
    background: color-mix(in srgb, var(--c, var(--muted)) 14%, white);
    border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 35%, white);
}
.date { font-size: 0.82rem; color: var(--muted); }

.offre-corps { min-width: 0; }
.titre { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.005em; line-height: 1.3; overflow-wrap: anywhere; }
.titre a { display: inline-block; padding: 2px 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--afig); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.titre a:hover { text-decoration-color: var(--afig-600); }
.qui { margin-top: 0.15rem; font-size: 0.92rem; color: var(--text-2); overflow-wrap: anywhere; }
.qui .lieu { color: var(--muted); }
.commentaire { margin-top: 0.35rem; font-size: 0.84rem; color: var(--muted); max-width: 90ch; overflow-wrap: anywhere; }

.offre-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; white-space: nowrap; }
.lien-externe {
    display: inline-flex; align-items: center; min-height: 34px; padding: 0 0.8rem;
    border: 1.5px solid var(--afig-700); border-radius: 8px; background: white; color: var(--afig-800);
    font-size: 0.8rem; font-weight: 700;
    transition: background-color var(--ease), color var(--ease);
}
.lien-externe:hover { background: var(--afig-800); border-color: var(--afig-800); color: white; text-decoration: none; }
.edition-icones { display: flex; gap: 0.7rem; }
.icon { width: 16px; height: 16px; }

/* Pages sans remise à zéro des marges (formulaire de dépôt) : :where() garde une spécificité nulle, les marges ci-dessus l'emportent */
:where(.offre h3, .offre p) { margin: 0; }

/* Champ manquant dans l'aperçu du formulaire */
.offre .missing { color: #c00; font-weight: 700; }

@media (max-width: 760px) {
    .offre { grid-template-columns: 1fr; gap: 0.5rem; padding: 0.9rem 0.5rem; }
    .offre-tete { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.7rem; }
    .offre-actions { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .offre, .lien-externe { transition: none; }
}
