/* =========================================================
   Demonstration - systeme CastorDev.
   La page se lit souvent au telephone, debout dans un atelier :
   un seul gros bouton, un tableau qui defile, rien d'autre.
   ========================================================= */

/* ---------- LA PROMESSE ---------- */
.demo-promesse {
    background: var(--paper);
    padding: 3.5rem 0 1rem;
}

.promesse-titre {
    font-size: clamp(2rem, 5.2vw, 3.5rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 1rem;
}

.promesse-texte {
    font-size: var(--text-lg);
    color: var(--ink-2);
    max-width: 52ch;
    margin: 0;
}

/* ---------- L'OUTIL ---------- */
.demo-outil {
    background: var(--paper);
    padding: 3rem 0 4.5rem;
}

.demo-form {
    display: grid;
    gap: 1rem;
    max-width: 46rem;
}

/* Champ natif cache mais toujours focalisable au clavier. */
.champ-cache {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.depot {
    display: block;
    border: var(--epaisseur-trait) dashed var(--trait);
    padding: 2rem 1.5rem;
    cursor: pointer;
    background: var(--paper);
    transition: var(--transition-fast);
}

.depot:hover,
.depot.survol {
    background: var(--paper-2);
    border-style: solid;
}

.champ-cache:focus-visible + .depot {
    outline: var(--epaisseur-trait) solid var(--focus);
    outline-offset: 2px;
}

.depot-titre {
    display: block;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .35rem;
}

.depot-detail {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .04em;
    color: var(--muted);
}

.depot-nom {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--ink);
    word-break: break-all;
}

.depot-nom:empty {
    display: none;
}

.demo-form .btn {
    justify-self: start;
}

.demo-form .btn:disabled {
    background: var(--paper-2);
    color: var(--muted);
    border-color: var(--rule);
    cursor: not-allowed;
}

/* Exemples fictifs : trois papiers a essayer en un clic.
   Ce qui se touche : contour de 2 px, angles droits, ventre au survol. */
.demo-exemples {
    max-width: 46rem;
    margin-top: 2rem;
}

.exemples-titre {
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 .75rem;
}

.exemples {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.exemple {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: .75rem;
    border: var(--epaisseur-trait) solid var(--trait);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
}

.exemple:hover {
    background: var(--ventre);
    color: var(--sur-ventre);
}

.exemple:focus-visible {
    outline: var(--epaisseur-trait) solid var(--focus);
    outline-offset: 2px;
}

.exemple:disabled {
    cursor: wait;
    background: var(--paper);
    color: var(--muted);
}

.exemple img {
    display: block;
    width: 100%;
    height: 9rem;
    object-fit: cover;
    object-position: top;
    border: 1px solid var(--filet);
    margin-bottom: .65rem;
}

.exemple-texte {
    display: flex;
    flex-direction: column;
}

.exemple-nom {
    font-weight: 600;
    line-height: 1.3;
}

.exemple-detail {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .04em;
    color: var(--muted);
    margin-top: .25rem;
}

.exemple:hover .exemple-detail {
    color: var(--sur-ventre);
}

.exemples-note {
    font-size: var(--text-sm);
    color: var(--muted);
    margin: .75rem 0 0;
}

/* Au telephone : une ligne par exemple, la vignette a gauche */
@media (max-width: 560px) {
    .exemples { grid-template-columns: 1fr; }

    .exemple {
        flex-direction: row;
        align-items: center;
        gap: .9rem;
        padding: .6rem;
    }

    .exemple img {
        flex: none;
        width: 4.5rem;
        height: 4.5rem;
        margin: 0;
    }
}

/* Un repere carre cercle du trait : vide = en cours,
   tasse = c'est fait, alerte = erreur. Toujours avec les mots. */
.demo-etat {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin: 1.25rem 0 0;
    min-height: 1.65em;
    color: var(--ink-2);
    max-width: 60ch;
}

.demo-etat::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border: var(--epaisseur-trait) solid var(--trait);
    background: var(--paper);
}

.demo-etat:empty::before {
    display: none;
}

.demo-etat.lu::before {
    background: var(--tasse);
}

.demo-etat.erreur {
    color: var(--alerte);
    font-weight: 500;
}

.demo-etat.erreur::before {
    background: var(--alerte);
    border-color: var(--alerte);
}

/* ---------- LE RESULTAT ---------- */
.demo-resultat {
    margin-top: 2.5rem;
    border-top: var(--epaisseur-trait) solid var(--trait);
    padding-top: 1.5rem;
}

.resultat-entete {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.5rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.resultat-entete #demoType {
    color: var(--ink);
}

.resultat-infos {
    display: grid;
    grid-template-columns: minmax(8rem, 14rem) 1fr;
    margin: 0 0 2rem;
    max-width: 52rem;
    border-top: 1px solid var(--rule);
}

.resultat-infos dt,
.resultat-infos dd {
    padding: .6rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: var(--text-sm);
}

.resultat-infos dt {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .03em;
    color: var(--muted);
    padding-right: 1rem;
}

.resultat-infos dd {
    color: var(--ink);
    margin: 0;
}

/* Le tableau defile a l'horizontale sur telephone, la page non. */
.tableau-defilant {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--ink);
    margin-bottom: 1.5rem;
}

.resultat-table {
    border-collapse: collapse;
    width: 100%;
    font-size: var(--text-sm);
}

.resultat-table th {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: .03em;
    text-align: left;
    color: var(--ink-2);
    padding: .65rem 1rem .65rem 0;
    border-bottom: 1px solid var(--ink);
    white-space: nowrap;
}

.resultat-table td {
    color: var(--ink);
    padding: .6rem 1rem .6rem 0;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
    min-width: 6rem;
}

.resultat-vide {
    color: var(--muted);
    font-size: var(--text-sm);
}

.resultat-doutes {
    margin: 0 0 2rem;
    max-width: 60ch;
}

.resultat-doutes h3 {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--ink);
    margin-bottom: .6rem;
}

.resultat-doutes ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.resultat-doutes li {
    color: var(--ink-2);
    font-size: var(--text-sm);
    padding: .25rem 0 .25rem 1.4rem;
}

.resultat-doutes li::before {
    content: "\2014";
    color: var(--brand);
    margin-left: -1.4rem;
    margin-right: .5rem;
}

.resultat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

/* ---------- CE QUI SE PASSE ---------- */
.demo-etapes {
    background: var(--paper);
    border-top: 1px solid var(--rule);
}

.demo-etapes h2,
.demo-limites h2 {
    max-width: 22ch;
    margin-bottom: 2.5rem;
}

.etapes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 3rem;
}

.etapes li {
    border-top: 1px solid var(--rule);
    padding: 1.5rem 0 1.75rem;
}

.etape-index {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: .04em;
    color: var(--ink-2);
    margin-bottom: .75rem;
}

.etapes p {
    margin: 0;
    color: var(--ink-2);
    max-width: 38ch;
}

.etapes-note {
    margin: 2rem 0 0;
    color: var(--muted);
    max-width: 64ch;
}

/* ---------- LES LIMITES ---------- */
.demo-limites {
    background: var(--paper);
    border-top: 1px solid var(--rule);
}

.limites {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 4rem;
}

.limite {
    border-top: 1px solid var(--rule);
    padding: 1.5rem 0 1.75rem;
}

.limite h3 {
    font-size: var(--text-lg);
    margin-bottom: .5rem;
}

.limite p {
    margin: 0;
    color: var(--muted);
    max-width: 46ch;
}

/* ---------- APPEL FINAL ---------- */
.cta-final {
    background: var(--paper);
    border-top: 1px solid var(--rule);
    padding-bottom: 6.5rem;
}

.cta-final h2 {
    max-width: 22ch;
    margin-bottom: 1rem;
}

.cta-final p {
    color: var(--muted);
    max-width: 58ch;
    margin-bottom: 2.25rem;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

/* ---------- MOBILE ---------- */
@media (max-width: 860px) {
    .etapes { grid-template-columns: 1fr; }
    .limites { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .demo-promesse { padding-top: 2.5rem; }
    .demo-outil { padding: 2rem 0 3rem; }
    .depot { padding: 1.75rem 1.25rem; }
    .demo-form .btn,
    .resultat-actions .btn,
    .cta-actions .btn { width: 100%; }
    .resultat-infos { grid-template-columns: 1fr; }
    .resultat-infos dt { border-bottom: 0; padding-bottom: 0; }
    .resultat-infos dd { padding-top: .15rem; }
    .cta-final { padding-bottom: 4rem; }
}
