% Carbon Footprint Function
function Y = uq_Ex08_BermBreakwater_carbon(X)
    % Input design variables
    B = X(:,1);
    hb = X(:,2);
    Ns = X(:,3);
    hf = X(:,4);

    % Fixed variables
    dd = 16.3;
    h = hb + dd;
    Hsd = 5.03;
    ro_sd = 2.45;
    ro_wd = 1.025;
    Dnd = (Hsd / ((ro_sd/ro_wd) - 1) * Ns);
    hc = 2 * Dnd;
    u = 0.8 * Dnd;
    C = 17.8;
    alpha_s = 33.7;
    alpha_l = 33.7;
    Cw = 4 * Dnd;
    Bc = 12.2;

    % Volume calculations (same as cost function)
    Varmor = B .* h + (hc .* (hf + C) ./ sind(alpha_s)) + hc .* Cw + ...
             (hc.^2 / 2) .* (1 ./ tand(alpha_s) + 1 ./ tand(45));
    Vfilter = Bc .* hf + (C .* u + hf .* u) .* (1 ./ sind(alpha_s) + 1 ./ sind(alpha_l)) - ...
              0.5 .* hf.^2 .* (1 ./ tand(alpha_s) + 1 ./ tand(alpha_l));
    Vcore = (C^2 / 2) .* (1 ./ tand(alpha_s) + 1 ./ tand(alpha_l)) + C .* Bc;

    % Carbon footprint (kg CO2/m^3): assumed coefficients
    Carbon_Armor = 200; % kg CO2/m^3 for armor (e.g., rock)
    Carbon_Filter = 150; % kg CO2/m^3 for filter material
    Carbon_Core = 100; % kg CO2/m^3 for core material

    Y = Carbon_Armor * Varmor + Carbon_Filter * Vfilter + Carbon_Core * Vcore;
end