/* ============================================================
   Document Gate — front (section documents fermée + modale)
   Réutilise les tokens du thème (--primary, --r-lg, --sh-3…)
   avec valeurs de repli si le module tourne hors thème Vectori.
   ============================================================ */

.dg-section__note {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
    padding: .5rem .85rem;
    font-size: .85rem;
    color: var(--muted, #4B5563);
    background: var(--surface-2, #F9FAFB);
    border: 1px solid var(--line, #E5E7EB);
    border-radius: var(--r-pill, 999px);
}
.dg-section__note svg { flex: 0 0 auto; color: var(--primary, #0F00E6); }

/* Les boutons-document reprennent l'apparence de .doc-item (thème). */
.doc-list .dg-trigger {
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}
.dg-trigger--all { cursor: pointer; }

/* ---------- Modale ---------- */
.dg-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.dg-modal[hidden] { display: none; }

.dg-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    backdrop-filter: blur(2px);
    animation: dg-fade .2s ease;
}

.dg-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: var(--surface, #fff);
    border-radius: var(--r-lg, 18px);
    box-shadow: var(--sh-3, 0 24px 48px -20px rgba(17,24,39,.18));
    animation: dg-pop .22s cubic-bezier(.4, 0, .2, 1);
}

@keyframes dg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dg-pop {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.dg-modal__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--r-pill, 999px);
    background: var(--surface-2, #F3F4F6);
    color: var(--ink, #111827);
    cursor: pointer;
    transition: background var(--t-fast, 150ms ease);
}
.dg-modal__close:hover { background: var(--line, #E5E7EB); }
.dg-modal__close svg { width: 18px; height: 18px; }

.dg-modal__body { padding: 2rem 1.75rem 1.75rem; }

.dg-modal__title {
    margin: 0 0 .35rem;
    font-size: 1.4rem;
    line-height: 1.2;
    color: var(--ink, #111827);
}
.dg-modal__intro {
    margin: 0 0 1.25rem;
    color: var(--muted, #4B5563);
    font-size: .95rem;
}

.dg-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
}
@media (max-width: 520px) { .dg-form__row { grid-template-columns: 1fr; } }

.dg-field { margin-bottom: .9rem; }
.dg-field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink-2, #1F2937);
}
.dg-field input[type="text"],
.dg-field input[type="email"],
.dg-field input[type="tel"] {
    width: 100%;
    padding: .7rem .85rem;
    font-size: .95rem;
    color: var(--ink, #111827);
    background: var(--surface, #fff);
    border: 1px solid var(--line-2, #D1D5DB);
    border-radius: var(--r-sm, 8px);
    transition: border-color var(--t-fast, 150ms ease), box-shadow var(--t-fast, 150ms ease);
}
.dg-field input:focus {
    outline: none;
    border-color: var(--primary, #0F00E6);
    box-shadow: 0 0 0 3px rgba(15, 0, 230, .12);
}
.dg-field input[aria-invalid="true"] {
    border-color: #d63638;
    box-shadow: 0 0 0 3px rgba(214, 54, 56, .12);
}
.dg-field__error {
    display: block;
    margin-top: .3rem;
    font-size: .8rem;
    color: #d63638;
}

.dg-field--consent { margin-top: .35rem; }
.dg-field--consent label {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    font-weight: 400;
    font-size: .85rem;
    color: var(--muted, #4B5563);
    cursor: pointer;
}
.dg-field--consent input { margin-top: .15rem; flex: 0 0 auto; }
.dg-field--consent a { color: var(--primary, #0F00E6); }

/* Honeypot : invisible pour les humains, présent pour les bots. */
.dg-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.dg-form__error {
    margin: .25rem 0 1rem;
    padding: .6rem .8rem;
    font-size: .85rem;
    color: #8a1f21;
    background: #fcf0f1;
    border: 1px solid #f3c0c2;
    border-radius: var(--r-sm, 8px);
}

.dg-form__submit { width: 100%; justify-content: center; margin-top: .5rem; }
.dg-form__submit[disabled] { opacity: .65; cursor: progress; }

/* ---------- Écran de succès ---------- */
.dg-success { text-align: center; padding: 1rem 0 .5rem; }
.dg-success__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    color: #fff;
    background: #1a7f37;
    border-radius: var(--r-pill, 999px);
}
.dg-success__icon svg { width: 30px; height: 30px; }
.dg-success h3 { margin: 0 0 .5rem; font-size: 1.25rem; color: var(--ink, #111827); }
.dg-success__text { margin: 0 auto 1.25rem; max-width: 36ch; color: var(--muted, #4B5563); }

/* Verrou du scroll page quand la modale est ouverte. */
body.dg-modal-open { overflow: hidden; }
