// Test - only blue layer from main template
name = "Bennett";
oval_width = 96;
oval_height = 30;
blue_thickness = 1;
white_thickness = 1.5;
base_text_size = 13;

name_length = len(name);
text_size = name_length <= 3 ? 18 :
            name_length <= 5 ? 13 :
            name_length <= 8 ? 11 :
            11;

border_width = 2;
hole_diameter = 4;
hole_clearance = 4;

total_width = oval_width + border_width*2;
total_height = oval_height + border_width*2;
hole_x = -(total_width/2) + (hole_diameter/2) + hole_clearance;

module oval(width, height, depth) {
    scale([width/2, height/2, 1])
        cylinder(h=depth, r=1, $fn=100);
}

module bold_text() {
    for (x = [-0.3, 0, 0.3]) {
        for (y = [-0.3, 0, 0.3]) {
            translate([x, y, 0])
                linear_extrude(height=blue_thickness + 0.1)
                    text(name,
                         size=text_size,
                         font="Fordscript",
                         halign="center",
                         valign="center");
        }
    }
}

// Blue layer only
color("RoyalBlue")
difference() {
    oval(total_width, total_height, blue_thickness);

    // Cut out the border ring channel
    translate([0, 0, -0.05])
        difference() {
            oval(total_width, total_height, blue_thickness + 0.1);
            oval(oval_width, oval_height, blue_thickness + 0.2);
        }

    // Cut out text channels
    translate([0, 0, -0.05])
        bold_text();

    // Cut out hole
    translate([hole_x, 0, -0.05])
        cylinder(h=blue_thickness + 0.1, d=hole_diameter, $fn=50);
}
