/* =====================================================================
 * 📁 /maths/grandeurs_et_mesures/longueurs/fiches/fiches.css
 * ===================================================================== */

.lengths-preview-shell {
    border: 1px solid #d8dee5;
    border-radius: .5rem;
    background: #f4f6f8;
    overflow: hidden;
}

.lengths-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #d8dee5;
}

.lengths-preview-scroll {
    overflow-x: auto;
    padding: 1rem;
}

.lengths-a4-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 12mm 13mm 15mm;
    background: #fff;
    color: #1f2933;
    box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .12);
    font-family: Arial, sans-serif;
    font-size: 10.5pt;
    line-height: 1.35;
}

.lengths-empty-preview {
    min-height: 250mm;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.1rem;
}

.lg-sheet-header {
    display: grid;
    grid-template-columns: 28mm 1fr 28mm;
    align-items: center;
    padding-bottom: 3mm;
    border-bottom: 1px solid #adb5bd;
    margin-bottom: 3mm;
}

.lg-sheet-brand {
    font-weight: 800;
    font-size: 13pt;
}

.lg-sheet-title {
    text-align: center;
}

.lg-sheet-title h3 {
    margin: 0;
    font-size: 17pt;
    font-weight: 800;
}

.lg-sheet-title p {
    margin: 1mm 0 0;
    color: #6c757d;
    font-size: 9pt;
}

.lg-sheet-number {
    text-align: right;
    font-weight: 700;
    font-size: 9pt;
}

.lg-meta {
    display: flex;
    justify-content: space-between;
    gap: 12mm;
    margin-bottom: 4mm;
    font-size: 9.2pt;
}

.lg-section {
    margin-bottom: 4mm;
}

.lg-section-title {
    margin: 0 0 2mm;
    padding: 2mm 2.5mm;
    border-left: 4px solid #6c757d;
    background: #f1f3f5;
    font-weight: 800;
    font-size: 10.3pt;
}

.lg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.7mm 5mm;
}

.lg-item {
    min-width: 0;
    padding: 1.2mm 1.5mm;
    border: 1px solid #e2e6ea;
    border-radius: 3px;
    background: #fcfcfd;
}

.lg-item--wide {
    grid-column: 1 / -1;
}

.lg-q {
    display: inline;
}

.lg-answer-blank {
    display: inline-block;
    height: .95em;
    margin-left: .28em;
    vertical-align: baseline;
    border-bottom: 1px dotted #7c8793;
}

.lg-answer-blank--short {
    width: 12mm;
}

.lg-answer-blank--wide {
    width: 42mm;
}

.lg-answer-blank--problem {
    width: 24mm;
}

.lg-answer-blank--segment {
    width: 30mm;
}

.lg-problem {
    padding: 2mm 2.5mm;
    border: 1px solid #dfe4e8;
    border-radius: 4px;
    background: #fafbfc;
}

.lg-problem + .lg-problem {
    margin-top: 2mm;
}

.lg-segment-row {
    padding: 1.5mm 2mm;
    border: 1px solid #e2e6ea;
    border-radius: 4px;
}

.lg-segment-svg {
    display: block;
    width: 100mm;
    max-width: 100%;
    height: auto;
    margin: 1.5mm auto .8mm;
}

.lg-calibration {
    margin: 1mm 0 3mm;
    padding: 2mm;
    border: 1px solid #ffc107;
    background: #fff9e6;
    font-size: 8.6pt;
    text-align: center;
}

.lg-calibration svg {
    display: block;
    width: 70mm;
    height: auto;
    margin: 1mm auto 0;
}

.lg-footer {
    margin-top: 3mm;
    padding-top: 2mm;
    border-top: 1px solid #e0e4e8;
    display: flex;
    justify-content: space-between;
    color: #6c757d;
    font-size: 7.5pt;
}

@media (max-width: 991.98px) {
    .lengths-preview-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =====================================================================
 * Ajustements v3 - fiches enrichies, réponses propres et échelle métrique
 * ===================================================================== */

.lengths-a4-page {
    display: flex;
    flex-direction: column;
}

.lg-correct-inline {
    color: #198754;
    font-weight: 700;
}

.lg-footer {
    margin-top: auto;
}

/* Les fiches à 28 items exploitent davantage la page A4. */
.lengths-a4-page.type-units .lg-grid,
.lengths-a4-page.type-conversions .lg-grid {
    row-gap: 1.9mm;
}

.lengths-a4-page.type-units .lg-item,
.lengths-a4-page.type-conversions .lg-item {
    min-height: 12.2mm;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 1.7mm 1.8mm;
}

/* Comparaisons : davantage d'espace sans tasser les rangements. */
.lengths-a4-page.type-compare .lg-grid {
    row-gap: 2.6mm;
}

.lengths-a4-page.type-compare .lg-item {
    min-height: 11mm;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding-top: 1.8mm;
    padding-bottom: 1.8mm;
}

.lengths-a4-page.type-compare .lg-item--wide {
    min-height: 13mm;
}

/* Les problèmes disposent d'une vraie zone de travail visuelle. */
.lengths-a4-page.type-problems .lg-problem {
    min-height: 16.5mm;
    box-sizing: border-box;
    padding: 2.6mm 3mm;
}

.lengths-a4-page.type-problems .lg-problem + .lg-problem {
    margin-top: 2.4mm;
}

/* La fiche variée était déjà dense : on l'aère modérément. */
.lengths-a4-page.type-varied .lg-section {
    margin-bottom: 3.8mm;
}

/*
 * Fiche 4 - segments.
 * L'échelle horizontale reste strictement métrique (SVG large de 100 mm).
 * Seule la hauteur graphique est réduite pour garantir une page A4.
 */
.lengths-a4-page.type-segments .lg-section {
    margin-bottom: 1.6mm;
}

.lengths-a4-page.type-segments .lg-section-title {
    margin-bottom: 1mm;
    padding-top: 1.3mm;
    padding-bottom: 1.3mm;
}

.lengths-a4-page.type-segments .lg-grid {
    gap: .8mm 0;
}

.lengths-a4-page.type-segments .lg-grid > .lg-item {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.lengths-a4-page.type-segments .lg-segment-row {
    padding: .8mm 1.5mm .5mm;
}

.lg-segment-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4mm;
}

.lg-segment-answer {
    white-space: nowrap;
}

.lengths-a4-page.type-segments .lg-segment-svg {
    height: 9mm;
    margin: .4mm auto 0;
}

.lengths-a4-page.type-segments .lg-calibration {
    margin-bottom: 1.3mm;
    padding: 1.2mm 2mm;
}

.lengths-a4-page.type-segments .lg-calibration svg {
    margin-top: .4mm;
}
