// Dimensions de la boîte
box_length = 100; // Longueur
box_width = 70;  // Largeur
box_height = 50; // Hauteur
wall_thickness = 3; // Épaisseur des parois
slot_width = 40; // Largeur de l'ouverture
slot_height = 2; // Hauteur de l'ouverture

module sealed_box() {
    // Partie principale de la boîte (fermée en bas)
    difference() {
        cube([box_length, box_width, box_height], center = true);
        translate([-box_length/2 + wall_thickness, -box_width/2 + wall_thickness, -box_height/2 + wall_thickness])
            cube([box_length - 2*wall_thickness, box_width - 2*wall_thickness, box_height - wall_thickness], center = false);
    }
}

module lid_with_slot() {
    // Couvercle avec fente et texte
    difference() {
        // Couvercle
        translate([0, 0, box_height/2 + wall_thickness/2])
            cube([box_length, box_width, wall_thickness], center = true);
        // Fente pour glisser le mot
        translate([0, 0, box_height/2 + wall_thickness])
            cube([slot_width, slot_height, wall_thickness + 1], center = true);
    }
    // Texte sur le couvercle
    text_on_box("Ne pas ouvrir avant 10 ans", box_length, box_width, box_height);
}

module text_on_box(message, length, width, height) {
    text_size = 5; // Taille du texte
    linear_extrude(height = 30) {
        translate([0, 0, height/2 + wall_thickness + 1])
            text(message, size = text_size, valign = "center", halign = "center");
    }
}

// Assemblage final
sealed_box();
lid_with_slot();