@motorway-width-z5:               0.5;
@trunk-width-z5:                  0.4;

@motorway-width-z7:               0.8;
@trunk-width-z7:                  0.6;

@motorway-width-z8:               1;
@trunk-width-z8:                  1;
@primary-width-z8:                1;

@motorway-width-z9:               1.4;
@trunk-width-z9:                  1.4;
@primary-width-z9:                1.4;
@secondary-width-z9:              1;

@motorway-width-z10:              1.9;
@trunk-width-z10:                 1.9;
@primary-width-z10:               1.8;
@secondary-width-z10:             1;

@motorway-width-z11:              2.0;
@trunk-width-z11:                 1.9;
@primary-width-z11:               1.8;
@secondary-width-z11:             1;

@motorway-width-z12:              3.5;
@motorway-link-width-z12:         1.5;
@trunk-width-z12:                 3.5;
@primary-width-z12:               3.5;
@secondary-width-z12:             3.5;
@tertiary-width-z12:              2.5;

@motorway-width-z13:              6;
@motorway-link-width-z13:         4;
@trunk-width-z13:                 6;
@primary-width-z13:               5;
@secondary-width-z13:             5;
@tertiary-width-z13:              4;
@residential-width-z13:           2.5;
@living-street-width-z13:         2;
@pedestrian-width-z13:            2;
@bridleway-width-z13:             0.3;
@footway-width-z13:               0.7;
@cycleway-width-z13:              0.7;
@path-width-z13:                  0.2;
@steps-width-z13:                 0.7;

@secondary-width-z14:             5;
@tertiary-width-z14:              5;
@residential-width-z14:           3;
@living-street-width-z14:         3;
@pedestrian-width-z14:            3;
@road-width-z14:                  2;
@service-width-z14:               2;

@motorway-width-z15:             10;
@motorway-link-width-z15:         7.8;
@trunk-width-z15:                10;
@primary-width-z15:              10;
@secondary-width-z15:             9;
@tertiary-width-z15:              9;
@residential-width-z15:           5;
@living-street-width-z15:         5;
@pedestrian-width-z15:            5;
@bridleway-width-z15:             1.2;
@footway-width-z15:               1;
@cycleway-width-z15:              0.9;
@path-width-z15:                  0.5;
@track-width-z15:                 1.5;
@track-grade1-width-z15:          2;
@steps-width-z15:                 3;

@secondary-width-z16:            10;
@tertiary-width-z16:             10;
@residential-width-z16:           6;
@living-street-width-z16:         6;
@pedestrian-width-z16:            6;
@road-width-z16:                  3.5;
@service-width-z16:               3.5;
@minor-service-width-z16:         2;
@footway-width-z16:               1.3;
@cycleway-width-z16:              0.9;

@motorway-width-z17:             18;
@motorway-link-width-z17:        12;
@trunk-width-z17:                18;
@primary-width-z17:              18;
@secondary-width-z17:            18;
@tertiary-width-z17:             18;
@residential-width-z17:          12;
@living-street-width-z17:        12;
@pedestrian-width-z17:           12;
@road-width-z17:                  7;
@service-width-z17:               7;
@minor-service-width-z17:         3.5;

@motorway-width-z18:             21;
@motorway-link-width-z18:        13;
@trunk-width-z18:                21;
@primary-width-z18:              21;
@secondary-width-z18:            21;
@tertiary-width-z18:             21;
@residential-width-z18:          13;
@living-street-width-z18:        13;
@pedestrian-width-z18:           13;
@road-width-z18:                  8.5;
@service-width-z18:               8.5;
@minor-service-width-z18:         4.75;

@motorway-width-z19:             27;
@motorway-link-width-z19:        16;
@trunk-width-z19:                27;
@primary-width-z19:              27;
@secondary-width-z19:            27;
@tertiary-width-z19:             27;
@residential-width-z19:          17;
@living-street-width-z19:        17;
@pedestrian-width-z19:           17;
@road-width-z19:                 11;
@service-width-z19:              11;
@minor-service-width-z19:         5.5;

@footway-width-z18:               1.3;
@cycleway-width-z18:              1;

@footway-width-z19:               1.6;
@cycleway-width-z19:              1.3;


@major-casing-width-z11:          0.3;

@casing-width-z12:                0.1;
@secondary-casing-width-z12:      0.3;
@major-casing-width-z12:          0.5;

@casing-width-z13:                0.5;
@residential-casing-width-z13:    0.5;
@secondary-casing-width-z13:      0.35;
@major-casing-width-z13:          0.5;

@casing-width-z14:                0.55;
@secondary-casing-width-z14:      0.35;
@major-casing-width-z14:          0.6;

@casing-width-z15:                0.6;
@secondary-casing-width-z15:      0.7;
@major-casing-width-z15:          0.7;

@casing-width-z16:                0.6;
@secondary-casing-width-z16:      0.7;
@major-casing-width-z16:          0.7;

@casing-width-z17:                0.8;
@secondary-casing-width-z17:      1;
@major-casing-width-z17:          1;

@casing-width-z18:                0.8;
@secondary-casing-width-z18:      1;
@major-casing-width-z18:          1;

@casing-width-z19:                0.8;
@secondary-casing-width-z19:      1;
@major-casing-width-z19:          1;

@bridge-casing-width-z12:         0.1;
@major-bridge-casing-width-z12:   0.5;
@bridge-casing-width-z13:         0.5;
@major-bridge-casing-width-z13:   0.5;
@bridge-casing-width-z14:         0.5;
@major-bridge-casing-width-z14:   0.6;
@bridge-casing-width-z15:         0.75;
@major-bridge-casing-width-z15:   0.75;
@bridge-casing-width-z16:         0.75;
@major-bridge-casing-width-z16:   0.75;
@bridge-casing-width-z17:         0.8;
@major-bridge-casing-width-z17:   1;
@bridge-casing-width-z18:         0.8;
@major-bridge-casing-width-z18:   1;
@bridge-casing-width-z19:         0.8;
@major-bridge-casing-width-z19:   1;

@paths-background-width:          1;
@paths-bridge-casing-width:       0.5;
@paths-tunnel-casing-width:       1;

@path-dashing-z15: 2,3;
@tracktype-bad-dashing-z15: 9,6;
@tracktype-missing-dashing-z15: @tracktype-bad-dashing-z15;

@shield-size: 9;
@shield-size-z16: 10;
@shield-size-z18: 11;
@shield-spacing: 760;
@shield-min-distance: 70;
@shield-font: @book-fonts;
@shield-clip: false;


#tunnels::casing[tunnel=1],
#bridges::casing[bridge=1],
#streets-casing-low::casing,
#streets-casing::casing[bridge!=1][tunnel!=1] {
  [zoom = 9][kind = 'secondary'] {
    line-color: @halo-color-for-minor-road;
    line-width: 2.2;
    line-opacity: 0.4;
    line-join: round;
    //Missing line-cap: round; is intentional. It would cause rendering glow multiple times in some places - what as result of partial transparency would cause differences in rendering
    //Also, bridges - including bridge casings - are rendered on top of roads. Enabling line-cap: round would result in glow from bridges rendered on top of road around bridges.
  }
  [zoom = 10][kind = 'secondary'],
  [zoom = 11][kind = 'secondary'] {
    line-color: @halo-color-for-minor-road;
    line-width: 2.7;
    line-opacity: 0.4;
    line-join: round;
    //Missing line-cap: round; is intentional. It would cause rendering glow multiple times in some places - what as result of partial transparency would cause differences in rendering
    //Also, bridges - including bridge casings - are rendered on top of roads. Enabling line-cap: round would result in glow from bridges rendered on top of road around bridges.
  }
  [zoom = 10][kind = 'tertiary'],
  [zoom = 11][kind = 'tertiary'],
  [zoom = 12][kind = 'unclassified'] {
    line-color: @halo-color-for-minor-road;
    line-width: 2.2;
    line-opacity: 0.3;
    line-join: round;
    //Missing line-cap: round; is intentional. It would cause rendering glow multiple times in some places - what as result of partial transparency would cause differences in rendering
    //Also, bridges - including bridge casings are rendered on top of roads. Enabling line-cap: round would result in glow from bridges rendered on top of road around bridges.
  }

  [zoom >= 12] {
    [kind = 'motorway'] {
      line-width: @motorway-width-z12;
      [zoom >= 13] { line-width: @motorway-width-z13; }
      [zoom >= 15] { line-width: @motorway-width-z15; }
      [zoom >= 17] { line-width: @motorway-width-z17; }
      [zoom >= 18] { line-width: @motorway-width-z18; }
      [zoom >= 19] { line-width: @motorway-width-z19; }
      /* Boolean fields are returned as numeric fields by the OGR input plugin. */
      [link = 1] {
        line-width: @motorway-link-width-z12;
        [zoom >= 13] { line-width: @motorway-link-width-z13; }
        [zoom >= 15] { line-width: @motorway-link-width-z15; }
        [zoom >= 17] { line-width: @motorway-link-width-z17; }
        [zoom >= 18] { line-width: @motorway-link-width-z18; }
        [zoom >= 19] { line-width: @motorway-link-width-z19; }
      }
      line-color: @motorway-low-zoom-casing;
      line-join: round;
      line-cap: round;
      [zoom >= 13] {
        line-color: @motorway-casing;
      }
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        line-cap: butt;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }
  }

  [kind = 'trunk'] {
    [zoom >= 12] {
      line-color: @trunk-low-zoom-casing;
      [zoom >= 13] {
        line-color: @trunk-casing;
      }
      line-cap: butt;
      line-width: @trunk-width-z12;
      [zoom >= 13] { line-width: @trunk-width-z13; }
      [zoom >= 15] { line-width: @trunk-width-z15; }
      [zoom >= 17] { line-width: @trunk-width-z17; }
      [zoom >= 18] { line-width: @trunk-width-z18; }
      [zoom >= 19] { line-width: @trunk-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        line-join: round;
        line-cap: butt;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }
  }

  [kind = 'primary'] {
    [zoom >= 12] {
      line-color: @primary-low-zoom-casing;
      [zoom >= 13] {
        line-color: @primary-casing;
      }
      line-width: @primary-width-z12;
      [zoom >= 13] { line-width: @primary-width-z13; }
      [zoom >= 15] { line-width: @primary-width-z15; }
      [zoom >= 17] { line-width: @primary-width-z17; }
      [zoom >= 18] { line-width: @primary-width-z18; }
      [zoom >= 19] { line-width: @primary-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        line-cap: butt;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }
  }

  [kind = 'secondary'] {
    [zoom >= 12] {
      line-color: @secondary-low-zoom-casing;
      [zoom >= 13] {
        line-color: @secondary-casing;
      }
      line-width: @secondary-width-z12;
      [zoom >= 13] { line-width: @secondary-width-z13; }
      [zoom >= 14] { line-width: @secondary-width-z14; }
      [zoom >= 15] { line-width: @secondary-width-z15; }
      [zoom >= 16] { line-width: @secondary-width-z16; }
      [zoom >= 17] { line-width: @secondary-width-z17; }
      [zoom >= 18] { line-width: @secondary-width-z18; }
      [zoom >= 19] { line-width: @secondary-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        [zoom >= 13] {
          line-color: @bridge-casing;
          line-cap: butt;
        }
      }
    }
  }

  [kind = 'tertiary'] {
    [zoom >= 12] {
      line-color: @tertiary-casing;
      line-width: @tertiary-width-z12;
      [zoom >= 13] { line-width: @tertiary-width-z13; }
      [zoom >= 14] { line-width: @tertiary-width-z14; }
      [zoom >= 15] { line-width: @tertiary-width-z15; }
      [zoom >= 16] { line-width: @tertiary-width-z16; }
      [zoom >= 17] { line-width: @tertiary-width-z17; }
      [zoom >= 18] { line-width: @tertiary-width-z18; }
      [zoom >= 19] { line-width: @tertiary-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        [zoom >= 14] {
          line-color: @bridge-casing;
          line-join: round;
          line-cap: butt;
        }
      }
    }
  }

  [kind = 'residential'],
  [kind = 'unclassified'] {
    [zoom >= 13] {
      line-color: @residential-casing;
      line-width: @residential-width-z13;
      [zoom >= 14] { line-width: @residential-width-z14; }
      [zoom >= 15] { line-width: @residential-width-z15; }
      [zoom >= 16] { line-width: @residential-width-z16; }
      [zoom >= 17] { line-width: @residential-width-z17; }
      [zoom >= 18] { line-width: @residential-width-z18; }
      [zoom >= 19] { line-width: @residential-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        [zoom >= 14] {
          line-color: @bridge-casing;
          line-cap: butt;
        }
      }
    }
  }


  /* SERVICE CASTING, ROAD CASING */
  [kind = 'road'][zoom >= 16],
  [kind = 'busway'][zoom >= 16],
  [kind = 'bus_guideway'][zoom >= 16],
  [kind = 'service'][zoom >= 16] {
    line-color: @service-casing;
    line-join: round;
    line-cap: round;
    line-width: @service-width-z16;
    [zoom >= 17] { line-width: @service-width-z17; }
    [zoom >= 18] { line-width: @service-width-z18; }
    [zoom >= 19] { line-width: @service-width-z19; }
    #tunnels {
      line-dasharray: 4,2;
      line-cap: butt;
    }
    #bridges {
      line-color: @bridge-casing;
      line-cap: butt;
      }
    }

  [kind = 'pedestrian'] {
    [zoom >= 13] {
      line-color: @pedestrian-casing;
      line-width: @pedestrian-width-z13;
      [zoom >= 14] { line-width: @pedestrian-width-z14; }
      [zoom >= 15] { line-width: @pedestrian-width-z15; }
      [zoom >= 16] { line-width: @pedestrian-width-z16; }
      [zoom >= 17] { line-width: @pedestrian-width-z17; }
      [zoom >= 18] { line-width: @pedestrian-width-z18; }
      [zoom >= 19] { line-width: @pedestrian-width-z19; }
      line-join: round;
      line-cap: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        [zoom >= 14] {
          line-color: @bridge-casing;
          line-cap: butt;
        }
      }
    }
  }

  [kind = 'living_street'] {
    [zoom >= 13] {
      line-color: @living-street-casing;
      line-width: @living-street-width-z13;
      [zoom >= 14] { line-width: @living-street-width-z14; }
      [zoom >= 15] { line-width: @living-street-width-z15; }
      [zoom >= 16] { line-width: @living-street-width-z16; }
      [zoom >= 17] { line-width: @living-street-width-z17; }
      [zoom >= 18] { line-width: @living-street-width-z18; }
      [zoom >= 19] { line-width: @living-street-width-z19; }
      line-cap: butt;
      line-join: round;
      #tunnels {
        line-dasharray: 4,2;
        line-cap: butt;
      }
      #bridges {
        [zoom >= 14] {
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }
  }

  [kind = 'steps'],
  [kind = 'bridleway'],
  [kind = 'footway'],
  [kind = 'cycleway'],
  [kind = 'path'] {
    #bridges {
      [zoom >= 15] {
        line-width: @cycleway-width-z13 + 2 * (@paths-background-width + @paths-bridge-casing-width);
        [zoom >= 15] { line-width: @cycleway-width-z15 + 2 * (@paths-background-width + @paths-bridge-casing-width); }
        [zoom >= 16] { line-width: @cycleway-width-z16 + 2 * (@paths-background-width + @paths-bridge-casing-width); }
        [zoom >= 18] { line-width: @cycleway-width-z18 + 2 * (@paths-background-width + @paths-bridge-casing-width); }
        [zoom >= 19] { line-width: @cycleway-width-z19 + 2 * (@paths-background-width + @paths-bridge-casing-width); }
        line-color: @bridge-casing;
        line-join: round;
      }
    }
    #tunnels {
      [zoom >= 15] {
        line-width: @cycleway-width-z13 + 2 * (@paths-background-width + @paths-tunnel-casing-width);
        [zoom >= 15] { line-width: @cycleway-width-z15 + 2 * (@paths-background-width + @paths-tunnel-casing-width); }
        [zoom >= 16] { line-width: @cycleway-width-z16 + 2 * (@paths-background-width + @paths-tunnel-casing-width); }
        [zoom >= 18] { line-width: @cycleway-width-z18 + 2 * (@paths-background-width + @paths-tunnel-casing-width); }
        [zoom >= 19] { line-width: @cycleway-width-z19 + 2 * (@paths-background-width + @paths-tunnel-casing-width); }
        line-color: @tunnel-casing;
        line-dasharray: 4,2;
        line-cap: butt;
      }
    }
  }

  [kind = 'track'] {
    #bridges {
      [zoom >= 15] {
        line-color: @bridge-casing;
        line-join: round;
        line-width: @track-width-z15 + 2 * (@paths-background-width + @paths-bridge-casing-width);
        [tracktype = 'grade1'] {
          line-width: @track-grade1-width-z15 + 2 * (@paths-background-width + @paths-bridge-casing-width);
        }
      }
    }
    #tunnels {
      [zoom >= 15] {
        line-color: @tunnel-casing;
        line-dasharray: 4,2;
        line-cap: butt;
        line-width: @track-width-z15 + 2 * (@paths-background-width + @paths-tunnel-casing-width);
      }
    }
  }
}

#tunnels[tunnel = 1]::bridges_and_tunnels_casing,
#bridges[bridge = 1]::bridges_and_tunnels_casing {
  [kind = 'steps'],
  [kind = 'bridleway'],
  [kind = 'footway'],
  [kind = 'cycleway'],
  [kind = 'path'] {
    #bridges {
      [zoom >= 15] {
        line-width: @cycleway-width-z15 + 2 * (@paths-background-width);
        [zoom >= 16] { line-width: @cycleway-width-z16 + 2 * (@paths-background-width); }
        [zoom >= 18] { line-width: @cycleway-width-z18 + 2 * (@paths-background-width); }
        [zoom >= 19] { line-width: @cycleway-width-z19 + 2 * (@paths-background-width); }
        line-color: @path-casing;
        line-join: round;
      }
    }
    #tunnels {
      [zoom >= 15] {
        line-width: @cycleway-width-z15 + 2 * (@paths-background-width);
        [zoom >= 16] { line-width: @cycleway-width-z16 + 2 * (@paths-background-width); }
        [zoom >= 18] { line-width: @cycleway-width-z18 + 2 * (@paths-background-width); }
        [zoom >= 19] { line-width: @cycleway-width-z19 + 2 * (@paths-background-width); }
        line-color: @path-casing;
        line-dasharray: 4,2;
        line-cap: butt;
      }
    }
  }

  [kind = 'track'] {
    #bridges {
      [zoom >= 15] {
        line-color: @track-casing;
        line-join: round;
        line-width: @track-width-z15 + 2 * (@paths-background-width);
        [tracktype = 'grade1'] {
          line-width: @track-grade1-width-z15 + 2 * (@paths-background-width);
        }
      }
    }
    #tunnels {
      [zoom >= 15] {
        line-color: @track-casing;
        line-dasharray: 4,2;
        line-cap: butt;
        line-width: @track-width-z15 + 2 * (@paths-background-width);
      }
    }
  }
}

#tunnels::fill[tunnel = 1],
#bridges::fill[bridge = 1],
#streets-fill-low::fill,
#streets-fill::fill[bridge != 1][tunnel != 1] {
  [kind = 'motorway'] {
    [zoom >= 5][zoom < 12][link != 1] {
      [zoom >= 5][zoom < 6] {
        line-color: lighten(@motorway-low-zoom, 20%);
        line-width: @motorway-width-z5;
      }
      [zoom >= 6][zoom < 7] {
        line-color: lighten(@motorway-low-zoom, 10%);
        line-width: @motorway-width-z5;
      }
      [zoom >= 7] {
        line-color: @motorway-low-zoom;
        line-width: @motorway-width-z7;
      }
      [zoom >= 8] {
        line-width: @motorway-width-z8;
      }
      [zoom >= 9] {
        line-width: @motorway-width-z9;
      }
      [zoom >= 10] {
        line-width: @motorway-width-z10;
      }
      [zoom >= 11] {
        line-width: @motorway-width-z11;
      }
    }
    [zoom >= 12] {
      line-color: @motorway-fill;
      line-width: @motorway-width-z12 - 2 * @major-casing-width-z12;
      [zoom >= 13] { line-width: @motorway-width-z13 - 2 * @major-casing-width-z13; }
      [zoom >= 15] { line-width: @motorway-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 17] { line-width: @motorway-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @motorway-width-z18 - 2 * @major-casing-width-z18; }
      [zoom >= 19] { line-width: @motorway-width-z19 - 2 * @major-casing-width-z19; }
      [link = 1] {
        line-width: @motorway-link-width-z12 - 2 * @casing-width-z12;
        [zoom >= 13] { line-width: @motorway-link-width-z13 - 2 * @casing-width-z13; }
        [zoom >= 15] { line-width: @motorway-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 17] { line-width: @motorway-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @motorway-link-width-z18 - 2 * @casing-width-z18; }
        [zoom >= 19] { line-width: @motorway-link-width-z19 - 2 * @casing-width-z19; }
      }
      #tunnels {
        line-color: @motorway-tunnel-fill;
      }
      #bridges {
        line-width: @motorway-width-z12 - 2 * @major-bridge-casing-width-z12;
        [zoom >= 13] { line-width: @motorway-width-z13 - 2 * @major-bridge-casing-width-z13; }
        [zoom >= 15] { line-width: @motorway-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 17] { line-width: @motorway-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @motorway-width-z18 - 2 * @major-bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @motorway-width-z19 - 2 * @major-bridge-casing-width-z19; }
        [link = 1] {
          line-width: @motorway-link-width-z12 - 2 * @bridge-casing-width-z12;
          [zoom >= 13] { line-width: @motorway-link-width-z13 - 2 * @bridge-casing-width-z13; }
          [zoom >= 15] { line-width: @motorway-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 17] { line-width: @motorway-link-width-z17 - 2 * @bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @motorway-link-width-z18 - 2 * @bridge-casing-width-z18; }
          [zoom >= 19] { line-width: @motorway-link-width-z19 - 2 * @bridge-casing-width-z19; }
        }
      }
      line-cap: round;
      line-join: round;
    }
  }

  [kind = 'trunk'] {
    [zoom >= 6] {
      line-width: @trunk-width-z5;
      line-color: @trunk-low-zoom;
    }
    [zoom >= 7] { line-width: @trunk-width-z7; }
    [zoom >= 8] { line-width: @trunk-width-z8; }
    [zoom >= 9] { line-width: @trunk-width-z9; }
    [zoom >= 10] { line-width: @trunk-width-z10; }
    [zoom >= 11] { line-width: @trunk-width-z11; }
    [zoom >= 12] {
      line-color: @trunk-fill;
      line-width: @trunk-width-z12 - 2 * @major-casing-width-z12;
      [zoom >= 13] { line-width: @trunk-width-z13 - 2 * @major-casing-width-z13; }
      [zoom >= 15] { line-width: @trunk-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 17] { line-width: @trunk-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @trunk-width-z18 - 2 * @major-casing-width-z18; }
      [zoom >= 19] { line-width: @trunk-width-z19 - 2 * @major-casing-width-z19; }
      #tunnels {
        line-color: @trunk-tunnel-fill;
      }
      #bridges {
        line-width: @trunk-width-z12 - 2 * @major-bridge-casing-width-z12;
        [zoom >= 13] { line-width: @trunk-width-z13 - 2 * @major-bridge-casing-width-z13; }
        [zoom >= 15] { line-width: @trunk-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 17] { line-width: @trunk-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @trunk-width-z18 - 2 * @major-bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @trunk-width-z19 - 2 * @major-bridge-casing-width-z19; }
      }
      line-cap: round;
      line-join: round;
    }
  }

  [kind = 'primary'] {
    [zoom >= 8] {
      line-width: @primary-width-z8;
      line-color: @primary-low-zoom;
    }
    [zoom >= 9] { line-width: @primary-width-z9; }
    [zoom >= 10] { line-width: @primary-width-z10; }
    [zoom >= 11] { line-width: @primary-width-z11; }
    [zoom >= 12] {
      line-color: @primary-fill;
      line-width: @primary-width-z12 - 2 * @major-casing-width-z12;
      [zoom >= 13] { line-width: @primary-width-z13 - 2 * @major-casing-width-z13; }
      [zoom >= 15] { line-width: @primary-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 17] { line-width: @primary-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @primary-width-z18 - 2 * @major-casing-width-z18; }
      [zoom >= 19] { line-width: @primary-width-z19 - 2 * @major-casing-width-z19; }
      #tunnels {
        line-color: @primary-tunnel-fill;
      }
      #bridges {
        line-width: @primary-width-z12 - 2 * @major-bridge-casing-width-z12;
        [zoom >= 13] { line-width: @primary-width-z13 - 2 * @major-bridge-casing-width-z13; }
        [zoom >= 15] { line-width: @primary-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 17] { line-width: @primary-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @primary-width-z18 - 2 * @major-bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @primary-width-z19 - 2 * @major-bridge-casing-width-z19; }
      }
      line-cap: round;
      line-join: round;
    }
  }

  [kind = 'secondary'] {
    [zoom >= 9] {
      line-color: @secondary-low-zoom; // @unimportant-road;
      line-width: @secondary-width-z9;
    }
    [zoom >=10] {
      line-color: @secondary-low-zoom; // @unimportant-road;
      line-width: @secondary-width-z10;
    }
    [zoom >= 11] { line-width: @secondary-width-z11; }
    [zoom >= 12] { 
      line-color: @secondary-fill;
      line-width: @secondary-width-z12 - 2 * @secondary-casing-width-z12;
      line-cap: round;
      line-join: round;
      [zoom >= 13] {
        [zoom >= 13] { line-width: @secondary-width-z13 - 2 * @secondary-casing-width-z13; }
        [zoom >= 14] { line-width: @secondary-width-z14 - 2 * @secondary-casing-width-z14; }
        [zoom >= 15] { line-width: @secondary-width-z15 - 2 * @secondary-casing-width-z15; }
        [zoom >= 16] { line-width: @secondary-width-z16 - 2 * @secondary-casing-width-z16; }
        [zoom >= 17] { line-width: @secondary-width-z17 - 2 * @secondary-casing-width-z17; }
        [zoom >= 18] { line-width: @secondary-width-z18 - 2 * @secondary-casing-width-z18; }
        [zoom >= 19] { line-width: @secondary-width-z19 - 2 * @secondary-casing-width-z19; }
        #tunnels {
          line-color: @secondary-tunnel-fill;
        }
        #bridges {
          line-width: @secondary-width-z12 - 2 * @bridge-casing-width-z12;
          [zoom >= 13] { line-width: @secondary-width-z13 - 2 * @major-bridge-casing-width-z13; }
          [zoom >= 14] { line-width: @secondary-width-z14 - 2 * @major-bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @secondary-width-z15 - 2 * @major-bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @secondary-width-z16 - 2 * @major-bridge-casing-width-z16; }
          [zoom >= 17] { line-width: @secondary-width-z17 - 2 * @major-bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @secondary-width-z18 - 2 * @major-bridge-casing-width-z18; }
          [zoom >= 19] { line-width: @secondary-width-z19 - 2 * @major-bridge-casing-width-z19; }
        }
      }
    }
  }

  [kind = 'tertiary'] {
    [zoom >= 10] {
      line-color: @unimportant-road;
      line-width: 0.55;
    }
    [zoom >= 12] {
      line-color: @tertiary-fill;
      line-width: @tertiary-width-z12 - 2 * @casing-width-z12;
      [zoom >= 13] { line-width: @tertiary-width-z13 - 2 * @casing-width-z13; }
      [zoom >= 14] { line-width: @tertiary-width-z14 - 2 * @casing-width-z14; }
      [zoom >= 15] { line-width: @tertiary-width-z15 - 2 * @casing-width-z15; }
      [zoom >= 16] { line-width: @tertiary-width-z16 - 2 * @casing-width-z16; }
      [zoom >= 17] { line-width: @tertiary-width-z17 - 2 * @casing-width-z17; }
      [zoom >= 18] { line-width: @tertiary-width-z18 - 2 * @casing-width-z18; }
      [zoom >= 19] { line-width: @tertiary-width-z19 - 2 * @casing-width-z19; }
      #tunnels {
        line-color: @tertiary-tunnel-fill;
      }
      #bridges {
        line-width: @tertiary-width-z12 - 2 * @bridge-casing-width-z12;
        [zoom >= 13] { line-width: @tertiary-width-z13 - 2 * @bridge-casing-width-z13; }
        [zoom >= 14] { line-width: @tertiary-width-z14 - 2 * @bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @tertiary-width-z15 - 2 * @bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @tertiary-width-z16 - 2 * @bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @tertiary-width-z17 - 2 * @bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @tertiary-width-z18 - 2 * @bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @tertiary-width-z19 - 2 * @bridge-casing-width-z19; }
      }
      line-cap: round;
      line-join: round;
    }
  }

  [kind = 'residential'],
  [kind = 'unclassified'] {
    [zoom = 12] {
      line-color: @unimportant-road;
      line-width: 0.4;
    }
    [zoom >= 13] {
      line-width: @residential-width-z13 - 2 * @residential-casing-width-z13;
      [zoom >= 14] { line-width: @residential-width-z14 - 2 * @casing-width-z14; }
      [zoom >= 15] { line-width: @residential-width-z15 - 2 * @casing-width-z15; }
      [zoom >= 16] { line-width: @residential-width-z16 - 2 * @casing-width-z16; }
      [zoom >= 17] { line-width: @residential-width-z17 - 2 * @casing-width-z17; }
      [zoom >= 18] { line-width: @residential-width-z18 - 2 * @casing-width-z18; }
      [zoom >= 19] { line-width: @residential-width-z19 - 2 * @casing-width-z19; }
      line-color: @residential-fill;
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        line-width: @residential-width-z13 - 2 * @bridge-casing-width-z13;
        [zoom >= 14] { line-width: @residential-width-z14 - 2 * @bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @residential-width-z15 - 2 * @bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @residential-width-z16 - 2 * @bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @residential-width-z17 - 2 * @bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @residential-width-z18 - 2 * @bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @residential-width-z19 - 2 * @bridge-casing-width-z19; }
      }
      line-cap: round;
      line-join: round;
    }
  }

  [kind = 'living_street'] {
    [zoom >= 13] {
      line-width: @living-street-width-z13 - 2 * @casing-width-z13;
      [zoom >= 14] { line-width: @living-street-width-z14 - 2 * @casing-width-z14; }
      [zoom >= 15] { line-width: @living-street-width-z15 - 2 * @casing-width-z15; }
      [zoom >= 16] { line-width: @living-street-width-z16 - 2 * @casing-width-z16; }
      [zoom >= 17] { line-width: @living-street-width-z17 - 2 * @casing-width-z17; }
      [zoom >= 18] { line-width: @living-street-width-z18 - 2 * @casing-width-z18; }
      [zoom >= 19] { line-width: @living-street-width-z19 - 2 * @casing-width-z19; }
      line-color: @living-street-fill;
      #tunnels {
        line-color: @living-street-tunnel-fill;
      }
      #bridges {
        line-width: @living-street-width-z13 - 2 * @casing-width-z13;
        [zoom >= 14] { line-width: @living-street-width-z14 - 2 * @bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @living-street-width-z15 - 2 * @bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @living-street-width-z16 - 2 * @bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @living-street-width-z17 - 2 * @bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @living-street-width-z18 - 2 * @bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @living-street-width-z19 - 2 * @bridge-casing-width-z19; }
      }
      line-join: round;
      line-cap: round;
    }
  }


  /* SERVICE FILL, ROAD FILL */
  [kind = 'road'][zoom >= 15],
  [kind = 'busway'][zoom >= 15],
  [kind = 'bus_guideway'][zoom >= 15],
  [kind = 'service'][service != 'driveway'][zoom >= 15 ],
  [kind = 'service'][zoom >= 16 ] {
    line-color: @service-fill;
    line-cap: round;
    line-width: @service-width-z14 - 0.5 * @casing-width-z14;

    [zoom >= 16] { line-width: @service-width-z16 - 2 * @casing-width-z16; }
    [zoom >= 17] { line-width: @service-width-z17 - 2 * @casing-width-z17; }
    [zoom >= 18] { line-width: @service-width-z18 - 2 * @casing-width-z18; }
    [zoom >= 19] { line-width: @service-width-z19 - 2 * @casing-width-z19; }

      #bridges {
      line-width: @service-width-z14 - 2 * @bridge-casing-width-z14;
      [zoom >= 16] { line-width: @service-width-z16 - 2 * @bridge-casing-width-z16; }
      [zoom >= 17] { line-width: @service-width-z17 - 2 * @bridge-casing-width-z17; }
      [zoom >= 18] { line-width: @service-width-z18 - 2 * @bridge-casing-width-z18; }
      [zoom >= 19] { line-width: @service-width-z19 - 2 * @bridge-casing-width-z19; }
      }
  }




  [kind = 'pedestrian'] {
    [zoom >= 13] {
      line-width: @living-street-width-z13 - 2 * @casing-width-z13;
      [zoom >= 14] { line-width: @pedestrian-width-z14 - 2 * @casing-width-z14; }
      [zoom >= 15] { line-width: @pedestrian-width-z15 - 2 * @casing-width-z15; }
      [zoom >= 16] { line-width: @pedestrian-width-z16 - 2 * @casing-width-z16; }
      [zoom >= 17] { line-width: @pedestrian-width-z17 - 2 * @casing-width-z17; }
      [zoom >= 18] { line-width: @pedestrian-width-z18 - 2 * @casing-width-z18; }
      [zoom >= 19] { line-width: @pedestrian-width-z19 - 2 * @casing-width-z19; }
      line-color: @pedestrian-fill;
      #bridges {
        line-width: @pedestrian-width-z13 - 2 * @casing-width-z13;
        [zoom >= 14] { line-width: @pedestrian-width-z14 - 2 * @bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @pedestrian-width-z15 - 2 * @bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @pedestrian-width-z16 - 2 * @bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @pedestrian-width-z17 - 2 * @bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @pedestrian-width-z18 - 2 * @bridge-casing-width-z18; }
        [zoom >= 19] { line-width: @pedestrian-width-z19 - 2 * @bridge-casing-width-z19; }
      }
      line-join: round;
      line-cap: round;
    }
  }

  [kind = 'raceway'] {
    [zoom >= 12] {
      line-color: @raceway-fill;
      line-width: 1.2;
      line-join: round;
      line-cap: round;
    }
    [zoom >= 13] { line-width: 2; }
    [zoom >= 14] { line-width: 3; }
    [zoom >= 15] { line-width: 6; }
    [zoom >= 18] { line-width: 8; }
    [zoom >= 19] { line-width: 12; }
    [zoom >= 20] { line-width: 24; }
  }

  [kind = 'platform'] {
    [zoom >= 16] {
      line-join: round;
      line-width: 6;
      line-color: @platform-color;
      line-cap: round;
      b/line-width: 4;
      b/line-color: @platform-fill-color;
      b/line-cap: round;
      b/line-join: round;
    }
  }

  [kind = 'steps'],
  [kind = 'bridleway'],
  [kind = 'footway'],
  [kind = 'cycleway'],
  [kind = 'path']{
    [zoom >= 15] {
      line-color: @bridleway-fill;
      line-dasharray: @path-dashing-z15;
      line-join: round;
      line-cap: butt;
      line-width: @bridleway-width-z15;
      #tunnels {
        line-join: round;
        line-cap: butt;
      }
    }
  }


  [kind = 'track'] {
    [zoom >= 15] {
      /* The white casing that you mainly see against forests and other dark kinds */
      /*background/line-opacity: 0.4;
      background/line-color: @track-casing;
      background/line-join: round;
      background/line-cap: round;
      background/line-width: @track-width-z15 + 2 * @paths-background-width;*/

      /* Set the properties of the dark colour inside */
      line/line-color: @track-fill;
      line/line-cap: butt;
      line/line-join: round;
      line/line-opacity: 1.0;
      line/line-clip: false;
      line/line-width: @track-width-z15;

      [tracktype = 'grade1'] {
        line/line-width: @track-grade1-width-z15;
      }
      [tracktype = 'grade2'],
      [tracktype = 'grade3'],
      [tracktype = 'grade4'],
      [tracktype = 'grade5'] {
        line/line-dasharray: @tracktype-bad-dashing-z15;
      }
      [tracktype = null] {
        line/line-dasharray: @tracktype-missing-dashing-z15;
      }
    }
  }

   
  [kind = 'runway'] {
    [zoom >= 11] {
      line-color: @runway-fill;
      line-width: 2;
      [zoom >= 12] { line-width: 4; }
      [zoom >= 13] { line-width: 6; }
      [zoom >= 14] { line-width: 12; }
      [zoom >= 15] { line-width: 18; }
      [zoom >= 16] { line-width: 24; }
    }
  }

  [kind = 'taxiway'] {
    [zoom >= 13] {
      line-color: @taxiway-fill;
      line-width: 1;
      [zoom >= 13] { line-width: 2; }
      [zoom >= 14] { line-width: 4; }
      [zoom >= 15] { line-width: 6; }
      [zoom >= 16] { line-width: 8; }
    }
  }

  [kind = 'rail'][zoom >= 9][zoom < 14][service = null],
  [kind = 'rail'][zoom >= 9][zoom < 14][service = ''],
  [kind = 'rail'][zoom >= 14],
  [kind = 'narrow_gauge'][zoom >= 10],
  [kind = 'subway'][zoom >= 12],
  [kind = 'light_rail'][zoom >= 12],
  [kind = 'tram'][zoom >= 13],
  [kind = 'funicular'][zoom >= 14] {
    line-color: @rail-fill;
    [zoom <= 15][service != null][service != ''][service != 'crossover'] {
      line-color: lighten(@rail-fill, 20%);
    }
    line-width: 1;
    [zoom >= 9] { line-width: 0.8; }
    [zoom >= 12] { line-width: 0.9; }
    line-join: round;
    #tunnels {
      line-dasharray: 8,8;
    }
  }
}

#streets-polygon-casing {
  [zoom >= 14][kind = 'pedestrian'] {
    line-width: 1;
    line-color: @pedestrian-casing;
  }
  [zoom >= 16][kind = 'service'] {
    line-color: @service-casing;
    line-width: 1;
  }
}

#streets-polygon-fill {
  [zoom >= 14][kind = 'pedestrian'] {
    polygon-fill: @pedestrian-fill;
  }
  [zoom >= 16][kind = 'service'] {
    polygon-fill: @service-fill;
  }
  [zoom >= 11][kind = 'runway'] {
    polygon-fill: @runway-fill;
  }
  [zoom >= 13][kind = 'taxiway'] {
    polygon-fill: @taxiway-fill;
  }
}

#street_labels_points[kind = 'motorway_junction'] {
  [zoom >= 12] {
    text-name: "[ref]";
    text-size: 10;
    text-fill: @junction-text-color;
    text-min-distance: 2;
    text-face-name: @oblique-fonts;
    text-halo-radius: @standard-halo-radius;
    text-halo-fill: @junction-halo-fill;
    text-wrap-character: ";";
    text-wrap-width: 2; // effectively break after every wrap character
    text-line-spacing: -1.5; // -0.15 em
    text-clip: false;
    [zoom >= 14] {
      ["name" != null]["ref" = null] {
        text-name: "[name]";
      }
      ["name" != null]["ref" != null] {
        text-name: [name] + "\n" + [ref];
      }
    }
    [zoom >= 15] {
      text-size: 11;
      text-line-spacing: -1.65; // -0.15 em
    }
  }
}


#street_labels[name != null][name != ''] {
  [kind = 'motorway'],
  [kind = 'trunk'],
  [kind = 'primary'] {
    [zoom >= 13] {
      text-name: "[name]";
      text-size: 8;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-face-name: @book-fonts;
      [tunnel != 1] {
        text-halo-radius: @standard-halo-radius;
        [kind = 'motorway'] { text-halo-fill: @motorway-fill; }
        [kind = 'trunk'] { text-halo-fill: @trunk-fill; }
        [kind = 'primary'] { text-halo-fill: @primary-fill; }
      }
    }
    [zoom >= 14] {
      text-size: 9;
    }
    [zoom >= 15] {
      text-size: 10;
    }
    [zoom >= 17] {
      text-size: 11;
    }
    [zoom >= 19] {
      text-size: 12;
    }
  }
  [kind = 'secondary'] {
    [zoom >= 13] {
      text-name: "[name]";
      text-size: 8;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-face-name: @book-fonts;
      text-halo-radius: @standard-halo-radius;
      text-halo-fill: @secondary-fill;
    }
    [zoom >= 14] {
      text-size: 9;
    }
    [zoom >= 15] {
      text-size: 10;
    }
    [zoom >= 17] {
      text-size: 11;
    }
    [zoom >= 19] {
      text-size: 12;
    }
  }
  [kind = 'tertiary'] {
    [zoom >= 15] {
      text-name: "[name]";
      text-size: 9;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-face-name: @book-fonts;
      text-halo-radius: @standard-halo-radius;
      text-halo-fill: @tertiary-fill;
    }
    [zoom >= 17] {
      text-size: 11;
    }
    [zoom >= 19] {
      text-size: 12;
    }
  }

  [kind = 'residential'],
  [kind = 'unclassified'],
  [kind = 'road'] {
    [zoom >= 15] {
      text-name: "[name]";
      text-size: 8;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-halo-radius: @standard-halo-radius;
      text-halo-fill: @residential-fill;
      text-face-name: @book-fonts;
    }
    [zoom >= 16] {
      text-size: 9;
    }
    [zoom >= 17] {
      text-size: 11;
      text-spacing: 400;
    }
    [zoom >= 19] {
      text-size: 12;
      text-spacing: 400;
    }
  }

  [kind = 'raceway'],
  [kind = 'busway'],
  [kind = 'bus_guideway'],
  [kind = 'service'] {
    [zoom >= 16] {
      text-name: "[name]";
      text-size: 9;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-halo-radius: @standard-halo-radius;
      [kind = 'raceway'] {
        text-halo-fill: @raceway-fill;
      }
      [kind = 'service'],
      [kind = 'bus_guideway'],
      [kind = 'busway'] {
        text-halo-fill: @service-fill;
      }
      text-face-name: @book-fonts;
    }
    [zoom >= 17] {
      text-size: 11;
    }
  }

  [kind = 'living_street'],
  [kind = 'pedestrian'] {
    [zoom >= 15] {
      text-name: "[name]";
      text-size: 8;
      text-fill: #222;
      text-spacing: 300;
      text-clip: false;
      text-placement: line;
      text-halo-radius: @standard-halo-radius;
      [kind = 'living_street'] { text-halo-fill: @living-street-fill; }
      [kind = 'pedestrian'] { text-halo-fill: @pedestrian-fill; }
      text-face-name: @book-fonts;
    }
    [zoom >= 16] {
      text-size: 9;
    }
    [zoom >= 17] {
      text-size: 11;
    }
    [zoom >= 19] {
      text-size: 12;
    }
  }
}


#streets_shields[ref != null][ref != ''] {
  /* More shields can be found in gf_basic_*_shields.mss */
  [kind = 'unclassified'],
  [kind = 'residential'] {
    [zoom >= 15] {
      text-name: "[ref]";
      text-size: 8;

      [zoom >= 16] {
        text-size: 9;
      }
      [zoom >= 18] {
        text-size: 10;
      }

      text-fill: #000;
      text-face-name: @book-fonts;
      text-min-distance: 40;
      text-halo-radius: 2;
      text-halo-fill: @standard-halo-fill;
      text-spacing: 760;
      text-clip: false;
    }
  }

  [kind = 'runway'],
  [kind = 'taxiway'] {
    [zoom >= 15] {
      text-name: "[ref]";
      text-size: 10;
      text-fill: #333;
      text-spacing: 750;
      text-clip: false;
      text-placement: line;
      text-min-distance: 18;
      text-face-name: @book-fonts;
      text-halo-radius: @standard-halo-radius;
      text-halo-fill: @standard-halo-fill;
    }
  }
}


