@motorway-fill:                 #e892a2;
@trunk-fill:                    #f9b29c;
@primary-fill:                  #fcd6a4;
@secondary-fill:                #f7fabf;

@base-color: #555555;

@motorway-fill:                 #555555;
@trunk-fill:                    #555555;
@primary-fill:                  #555555;
@secondary-fill:                #555555;
@tertiary-fill:                 #555555;
@unclassified-fill:             #555555;
@residential-fill:              #555555;
@service-fill:                  #555555;
@track-fill:                    #555555;
@pedestrian-fill:               #555555;
@footway-fill:                  #555555;
@steps-fill:                    @footway-fill;

@motorway-casing:               #dc2a67;
@trunk-casing:                  #c84e2f;
@primary-casing:                #a06b00;
@secondary-casing:              #707d05;

@motorway-casing:               #ffffff;
@trunk-casing:                  #ffffff;
@primary-casing:                #ffffff;
@secondary-casing:              #ffffff;
@tertiary-casing:               #ffffff;
@unclassified-casing:           #ffffff;
@residential-casing:            #ffffff;
@service-casing:                #ffffff;
@track-casing:                  #ffffff;
@footway-casing:                #ffffff;
@steps-casing:                  #ffffff;

@tunnel-casing: #202020;
@bridge-casing: #000000;

@motorway-tunnel-fill: lighten(@motorway-fill, 10%);
@trunk-tunnel-fill: lighten(@trunk-fill, 10%);
@primary-tunnel-fill: lighten(@primary-fill, 10%);
@secondary-tunnel-fill: lighten(@secondary-fill, 5%);
@tertiary-tunnel-fill: lighten(@tertiary-fill, 5%);
@residential-tunnel-fill: darken(@residential-fill, 5%);


@motorway-width-z14:            6;
@motorway-link-width-z14:       4;
@trunk-width-z14:               6;
@trunk-link-width-z14:          4;
@primary-width-z14:             5;
@primary-link-width-z14:        4;
@secondary-width-z14:           5;
@secondary-link-width-z14:      4;
@tertiary-width-z14:            4;
@tertiary-link-width-z14:       3;
@unclassified-width-z14:        2.5;
@residential-width-z14:         2.5;
@service-width-z14:             2;
@track-width-z14:               1.5;
@footway-width-z14: 1.0;
@steps-width-z14: 1.0;

@motorway-width-z15:            10;
@motorway-link-width-z15:       7.8;
@trunk-width-z15:               10;
@trunk-link-width-z15:          7.8;
@primary-width-z15:             10;
@primary-link-width-z15:        7.8;
@secondary-width-z15:           9;
@secondary-link-width-z15:      7;
@tertiary-width-z15:            9;
@tertiary-link-width-z15:       7;
@unclassified-width-z15:        5;
@residential-width-z15:         5;
@service-width-z15:             3;
@track-width-z15:               2.5;
@footway-width-z15: 2;
@steps-width-z15: 3;

@motorway-width-z16:            14;
@motorway-link-width-z16:       10;
@trunk-width-z16:               14;
@trunk-link-width-z16:          10;
@primary-width-z16:             14;
@primary-link-width-z16:        10;
@secondary-width-z16:           10;
@secondary-link-width-z16:      10;
@tertiary-width-z16:            10;
@tertiary-link-width-z16:       10;
@unclassified-width-z16:        8;
@residential-width-z16:         6;
@service-width-z16:             3.5;
@track-width-z16:               3;
@footway-width-z16: 2;
@steps-width-z16: 3;

@motorway-width-z17:            18;
@motorway-link-width-z17:       12;
@trunk-width-z17:               18;
@trunk-link-width-z17:          12;
@primary-width-z17:             18;
@primary-link-width-z17:        12;
@secondary-width-z17:           18;
@secondary-link-width-z17:      12;
@tertiary-width-z17:            18;
@tertiary-link-width-z17:       12;
@unclassified-width-z17:        12;
@residential-width-z17:         12;
@service-width-z17:             7;
@track-width-z17:               3;
@footway-width-z17: 2;
@steps-width-z17: 3;

@motorway-width-z18:            21;
@motorway-link-width-z18:       13;
@trunk-width-z18:               21;
@trunk-link-width-z18:          13;
@primary-width-z18:             21;
@primary-link-width-z18:        13;
@secondary-width-z18:           21;
@secondary-link-width-z18:      13;
@tertiary-width-z18:            21;
@tertiary-link-width-z18:       13;
@unclassified-width-z18:        13;
@residential-width-z18:         13;
@service-width-z18:             8.5;
@track-width-z18:               4;
@footway-width-z18: 2;
@steps-width-z18: 3;

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

@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;




@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;



// railway
// @railway-rail-dark-fill:        #707070;
// @railway-rail-tunnel-fill:      #787878;
// @railway-dark-fill:             #6E6E6E;
@railway-dark-fill:             darken(@base-color, 15%);
@railway-medium-fill:           #707070;
@railway-light-fill:            #AAAAAA;

@railway-rail-width-z14:        8;
@railway-narrow-width-z14:      6;
@railway-tram-z14:              3.5;

@railway-rail-width-z15:        8;
@railway-narrow-width-z15:      6;
@railway-tram-z15:              3.5;

@railway-rail-width-z16:        8;
@railway-narrow-width-z16:      6;
@railway-tram-z16:              3.5;

@railway-rail-width-z17:        8;
@railway-narrow-width-z17:      6;
@railway-tram-z17:              3.5;

@railway-rail-width-z18:        8;
@railway-narrow-width-z18:      6;
@railway-tram-z18:              3.5;


#roads-casing, #bridges, #tunnels {
  ::casing {
    [feature = 'highway_motorway'] {
      [zoom >= 14] { line-width: @motorway-width-z14; }
      [zoom >= 15] { line-width: @motorway-width-z15; }
      [zoom >= 16] { line-width: @motorway-width-z16; }
      [zoom >= 17] { line-width: @motorway-width-z17; }
      [zoom >= 18] { line-width: @motorway-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @motorway-link-width-z14; }
        [zoom >= 15] { line-width: @motorway-link-width-z15; }
        [zoom >= 16] { line-width: @motorway-link-width-z16; }
        [zoom >= 17] { line-width: @motorway-link-width-z17; }
        [zoom >= 18] { line-width: @motorway-link-width-z18; }
      }

      line-color: @motorway-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-color: @tunnel-casing;
        line-dasharray: 4,2;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_trunk'] {
      [zoom >= 14] { line-width: @trunk-width-z14; }
      [zoom >= 15] { line-width: @trunk-width-z15; }
      [zoom >= 16] { line-width: @trunk-width-z16; }
      [zoom >= 17] { line-width: @trunk-width-z17; }
      [zoom >= 18] { line-width: @trunk-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @trunk-link-width-z14; }
        [zoom >= 15] { line-width: @trunk-link-width-z15; }
        [zoom >= 16] { line-width: @trunk-link-width-z16; }
        [zoom >= 17] { line-width: @trunk-link-width-z17; }
        [zoom >= 18] { line-width: @trunk-link-width-z18; }
      }
      line-color: @trunk-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_primary'] {
      [zoom >= 14] { line-width: @primary-width-z14; }
      [zoom >= 15] { line-width: @primary-width-z15; }
      [zoom >= 16] { line-width: @primary-width-z16; }
      [zoom >= 17] { line-width: @primary-width-z17; }
      [zoom >= 18] { line-width: @primary-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @primary-link-width-z14; }
        [zoom >= 15] { line-width: @primary-link-width-z15; }
        [zoom >= 16] { line-width: @primary-link-width-z16; }
        [zoom >= 17] { line-width: @primary-link-width-z17; }
        [zoom >= 18] { line-width: @primary-link-width-z18; }
      }
      line-color: @primary-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_secondary'] {
      [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; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @secondary-link-width-z14; }
        [zoom >= 15] { line-width: @secondary-link-width-z15; }
        [zoom >= 16] { line-width: @secondary-link-width-z16; }
        [zoom >= 17] { line-width: @secondary-link-width-z17; }
        [zoom >= 18] { line-width: @secondary-link-width-z18; }
      }
      line-color: @secondary-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_tertiary'] {
      [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; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @tertiary-link-width-z14; }
        [zoom >= 15] { line-width: @tertiary-link-width-z15; }
        [zoom >= 16] { line-width: @tertiary-link-width-z16; }
        [zoom >= 17] { line-width: @tertiary-link-width-z17; }
        [zoom >= 18] { line-width: @tertiary-link-width-z18; }
      }
      line-color: @tertiary-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_residential'] {
      [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; }

      line-color: @residential-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
        line-color: @tunnel-casing;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_pedestrian'] {
      [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; }

      line-color: @residential-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
        line-color: @tunnel-casing;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_living_street'] {
      [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; }

      line-color: @residential-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
        line-color: @tunnel-casing;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }

    [feature = 'highway_unclassified'] {
      [zoom >= 14] { line-width: @unclassified-width-z14; }
      [zoom >= 15] { line-width: @unclassified-width-z15; }
      [zoom >= 16] { line-width: @unclassified-width-z16; }
      [zoom >= 17] { line-width: @unclassified-width-z17; }
      [zoom >= 18] { line-width: @unclassified-width-z18; }

      line-color: @unclassified-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
        line-color: @tunnel-casing;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }
 
    [feature = 'highway_service'] {
      [zoom >= 14] { line-width: @service-width-z14; }
      [zoom >= 15] { line-width: @service-width-z15; }
      [zoom >= 16] { line-width: @service-width-z16; }
      [zoom >= 17] { line-width: @service-width-z17; }
      [zoom >= 18] { line-width: @service-width-z18; }

      line-color: @service-casing;
      #roads-casing {
        line-join: round;
        line-cap: round;
      }

      #tunnels {
        line-dasharray: 4,2;
        line-color: @tunnel-casing;
      }
      #bridges {
        line-join: round;
        [zoom >= 13] { line-color: @bridge-casing; }
      }
    }


    [feature = 'highway_steps'] {
      #bridges {
        [zoom >= 15] {
          line-width: @steps-width-z14 + 2 * (@paths-background-width + @paths-bridge-casing-width);
          [zoom >= 15] { line-width: @steps-width-z15 + 2 * (@paths-background-width + @paths-bridge-casing-width); }
          line-color: @bridge-casing;
          line-join: round;
        }
      }
      #tunnels {
        [zoom >= 15] {
          line-width: @steps-width-z14 + 2 * (@paths-background-width + @paths-tunnel-casing-width);
          [zoom >= 15] { line-width: @steps-width-z15 + 2 * (@paths-background-width + @paths-tunnel-casing-width); }
          line-color: @tunnel-casing;
          line-dasharray: 4,2;
        }
      }
    }

    [feature = 'highway_footway'],
    [feature = 'highway_path'][bicycle != 'designated'] {
      #bridges {
          [zoom >= 14] { line-width: @footway-width-z14 + 2 * @paths-bridge-casing-width; }
          [zoom >= 15] { line-width: @footway-width-z15 + 2 * @paths-bridge-casing-width; }
          [zoom >= 16] { line-width: @footway-width-z16 + 2 * @paths-bridge-casing-width; }
          [zoom >= 18] { line-width: @footway-width-z18 + 2 * @paths-bridge-casing-width; }
          
          line-color: @bridge-casing;
          line-join: round;
      }
      #tunnels {
          [zoom >= 14] { line-width: @footway-width-z14 + 2 * @paths-tunnel-casing-width; }
          [zoom >= 15] { line-width: @footway-width-z15 + 2 * @paths-tunnel-casing-width; }
          [zoom >= 16] { line-width: @footway-width-z16 + 2 * @paths-tunnel-casing-width; }
          [zoom >= 18] { line-width: @footway-width-z18 + 2 * @paths-tunnel-casing-width; }
          
          line-color: @tunnel-casing;
          line-dasharray: 4,2;
      }
    }

    [feature = 'railway_tram'],
    [feature = 'railway_tram-service'][zoom >= 15] {
      #bridges {
        [zoom >= 13] {
          line-width: 4;
          [zoom >= 15] {
            line-width: 5;
          }
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }

    [feature = 'railway_subway'],
    [feature = 'railway_construction']['construction' = 'subway'] {
      #bridges {
        [zoom >= 14] {
          line-width: 5.5;
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }

    [feature = 'railway_light_rail'],
    [feature = 'railway_funicular'],
    [feature = 'railway_narrow_gauge'] {
      #bridges {
        [zoom >= 14] {
          line-width: 5.5;
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }

    [feature = 'railway_rail'],
    [feature = 'railway_preserved'],
    [feature = 'railway_monorail'][zoom >= 14] {
      #bridges {
        [zoom >= 13] {
          line-width: 6.5;
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }

    [feature = 'railway_INT-spur-siding-yard'] {
      #bridges {
        [zoom >= 13] {
          line-width: 5.7;
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }

    [feature = 'railway_disused'][zoom >= 15],
    [feature = 'railway_construction']['construction' != 'subway'],
    [feature = 'railway_miniature'][zoom >= 15],
    [feature = 'railway_INT-preserved-ssy'][zoom >= 14] {
      #bridges {
        [zoom >= 13] {
          line-width: 6;
          line-color: @bridge-casing;
          line-join: round;
        }
      }
    }
  }
}


#roads-fill, #bridges, #tunnels {
  ::fill {
    [feature = 'highway_motorway'] {
      line-color: @motorway-fill;

      [zoom >= 14] { line-width: @motorway-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @motorway-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @motorway-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @motorway-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @motorway-width-z18 - 2 * @major-casing-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @motorway-link-width-z14 - 2 * @casing-width-z14; }
        [zoom >= 15] { line-width: @motorway-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 16] { line-width: @motorway-link-width-z16 - 2 * @casing-width-z16; }
        [zoom >= 17] { line-width: @motorway-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @motorway-link-width-z18 - 2 * @casing-width-z18; }
      }
      #tunnels {
        line-color: @motorway-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @motorway-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @motorway-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @motorway-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [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; }
        [link = 'yes'] {
          [zoom >= 14] { line-width: @motorway-link-width-z14 - 2 * @bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @motorway-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @motorway-link-width-z16 - 2 * @bridge-casing-width-z16; }
          [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; }
        }
      }
      line-cap: round;
      line-join: round;
    }
    
    [feature = 'highway_trunk'] {
      line-color: @trunk-fill;

      [zoom >= 14] { line-width: @trunk-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @trunk-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @trunk-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @trunk-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @trunk-width-z18 - 2 * @major-casing-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @trunk-link-width-z14 - 2 * @casing-width-z14; }
        [zoom >= 15] { line-width: @trunk-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 16] { line-width: @trunk-link-width-z16 - 2 * @casing-width-z16; }
        [zoom >= 17] { line-width: @trunk-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @trunk-link-width-z18 - 2 * @casing-width-z18; }
      }
      #tunnels {
        line-color: @trunk-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @trunk-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @trunk-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @trunk-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [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; }
        [link = 'yes'] {
          [zoom >= 14] { line-width: @trunk-link-width-z14 - 2 * @bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @trunk-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @trunk-link-width-z16 - 2 * @bridge-casing-width-z16; }
          [zoom >= 17] { line-width: @trunk-link-width-z17 - 2 * @bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @trunk-link-width-z18 - 2 * @bridge-casing-width-z18; }
        }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_primary'] {
      line-color: @primary-fill;

      [zoom >= 14] { line-width: @primary-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @primary-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @primary-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @primary-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @primary-width-z18 - 2 * @major-casing-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @primary-link-width-z14 - 2 * @casing-width-z14; }
        [zoom >= 15] { line-width: @primary-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 16] { line-width: @primary-link-width-z16 - 2 * @casing-width-z16; }
        [zoom >= 17] { line-width: @primary-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @primary-link-width-z18 - 2 * @casing-width-z18; }
      }
      #tunnels {
        line-color: @primary-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @primary-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @primary-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @primary-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [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; }
        [link = 'yes'] {
          [zoom >= 14] { line-width: @primary-link-width-z14 - 2 * @bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @primary-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @primary-link-width-z16 - 2 * @bridge-casing-width-z16; }
          [zoom >= 17] { line-width: @primary-link-width-z17 - 2 * @bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @primary-link-width-z18 - 2 * @bridge-casing-width-z18; }
        }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_secondary'] {
      line-color: @secondary-fill;

      [zoom >= 14] { line-width: @secondary-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @secondary-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @secondary-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @secondary-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @secondary-width-z18 - 2 * @major-casing-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @secondary-link-width-z14 - 2 * @casing-width-z14; }
        [zoom >= 15] { line-width: @secondary-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 16] { line-width: @secondary-link-width-z16 - 2 * @casing-width-z16; }
        [zoom >= 17] { line-width: @secondary-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @secondary-link-width-z18 - 2 * @casing-width-z18; }
      }
      #tunnels {
        line-color: @secondary-tunnel-fill;
      }
      #bridges {
        [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; }
        [link = 'yes'] {
          [zoom >= 14] { line-width: @secondary-link-width-z14 - 2 * @bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @secondary-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @secondary-link-width-z16 - 2 * @bridge-casing-width-z16; }
          [zoom >= 17] { line-width: @secondary-link-width-z17 - 2 * @bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @secondary-link-width-z18 - 2 * @bridge-casing-width-z18; }
        }
      }
      line-cap: round;
      line-join: round;
    }


    [feature = 'highway_tertiary'] {
      line-color: @tertiary-fill;

      [zoom >= 14] { line-width: @tertiary-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @tertiary-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @tertiary-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @tertiary-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @tertiary-width-z18 - 2 * @major-casing-width-z18; }
      [link = 'yes'] {
        [zoom >= 14] { line-width: @tertiary-link-width-z14 - 2 * @casing-width-z14; }
        [zoom >= 15] { line-width: @tertiary-link-width-z15 - 2 * @casing-width-z15; }
        [zoom >= 16] { line-width: @tertiary-link-width-z16 - 2 * @casing-width-z16; }
        [zoom >= 17] { line-width: @tertiary-link-width-z17 - 2 * @casing-width-z17; }
        [zoom >= 18] { line-width: @tertiary-link-width-z18 - 2 * @casing-width-z18; }
      }
      #tunnels {
        line-color: @tertiary-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @tertiary-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @tertiary-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @tertiary-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @tertiary-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @tertiary-width-z18 - 2 * @major-bridge-casing-width-z18; }
        [link = 'yes'] {
          [zoom >= 14] { line-width: @tertiary-link-width-z14 - 2 * @bridge-casing-width-z14; }
          [zoom >= 15] { line-width: @tertiary-link-width-z15 - 2 * @bridge-casing-width-z15; }
          [zoom >= 16] { line-width: @tertiary-link-width-z16 - 2 * @bridge-casing-width-z16; }
          [zoom >= 17] { line-width: @tertiary-link-width-z17 - 2 * @bridge-casing-width-z17; }
          [zoom >= 18] { line-width: @tertiary-link-width-z18 - 2 * @bridge-casing-width-z18; }
        }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_residential'] {
      line-color: @residential-fill;

      [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-casing-width-z18; }
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-bridge-casing-width-z18; }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_living_street'] {
      line-color: @residential-fill;

      [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-casing-width-z18; }
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-bridge-casing-width-z18; }
      }
      line-cap: round;
      line-join: round;
    }


    [feature = 'highway_track'] {
      /* Set the properties of the brown inside */
      line/line-color: @track-fill;
      //line/line-dasharray: 5,4,2,4;
      line/line-cap: round;
      line/line-join: round;
      line/line-opacity: 0.8;
      line/line-clip:false;

      [zoom >= 14] {
        line/line-width: @track-width-z14 - 2 * @paths-background-width; 
      }
      [zoom >= 15] {
        line/line-width: @track-width-z15 - 2 * @paths-background-width; 
      }
      [zoom >= 16] {
        line/line-width: @track-width-z16 - 2 * @paths-background-width; 
      }
      [zoom >= 17] {
        line/line-width: @track-width-z17 - 2 * @paths-background-width; 
      }
      [zoom >= 18] {
        line/line-width: @track-width-z18 - 2 * @paths-background-width; 
      }
    }

    /*
    [feature = 'highway_track'] {
      #bridges {
        [zoom >= 14] {
          line-color: @bridge-casing;
          line-join: round;
          line-width: @track-width-z14 + 2 * (@paths-background-width + @paths-bridge-casing-width);
        }
        [zoom >= 15] {
          line-color: @bridge-casing;
          line-join: round;
          line-width: @track-width-z15 + 2 * (@paths-background-width + @paths-bridge-casing-width);
        }
      }
      #tunnels {
        [zoom >= 14] {
          line-color: @tunnel-casing;
          line-dasharray: 4,2;
          line-width: @track-width-z14 + 2 * (@paths-background-width + @paths-tunnel-casing-width);
          [zoom >= 15]{
            line-width: @track-width-z15 + 2 * (@paths-background-width + @paths-tunnel-casing-width);
          }
        }
      }
    }
    */

    [feature = 'highway_pedestrian'] {
      line-color: @pedestrian-fill;

      [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-casing-width-z18; }
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @residential-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @residential-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @residential-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @residential-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @residential-width-z18 - 2 * @major-bridge-casing-width-z18; }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_unclassified'] {
      line-color: @unclassified-fill;

      [zoom >= 14] { line-width: @unclassified-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @unclassified-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @unclassified-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @unclassified-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @unclassified-width-z18 - 2 * @major-casing-width-z18; }
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @unclassified-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @unclassified-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @unclassified-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @unclassified-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @unclassified-width-z18 - 2 * @major-bridge-casing-width-z18; }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_service'] {
      line-color: @service-fill;

      [zoom >= 14] { line-width: @service-width-z14 - 2 * @major-casing-width-z14; }
      [zoom >= 15] { line-width: @service-width-z15 - 2 * @major-casing-width-z15; }
      [zoom >= 16] { line-width: @service-width-z16 - 2 * @major-casing-width-z16; }
      [zoom >= 17] { line-width: @service-width-z17 - 2 * @major-casing-width-z17; }
      [zoom >= 18] { line-width: @service-width-z18 - 2 * @major-casing-width-z18; }
      #tunnels {
        line-color: @residential-tunnel-fill;
      }
      #bridges {
        [zoom >= 14] { line-width: @service-width-z14 - 2 * @major-bridge-casing-width-z14; }
        [zoom >= 15] { line-width: @service-width-z15 - 2 * @major-bridge-casing-width-z15; }
        [zoom >= 16] { line-width: @service-width-z16 - 2 * @major-bridge-casing-width-z16; }
        [zoom >= 17] { line-width: @service-width-z17 - 2 * @major-bridge-casing-width-z17; }
        [zoom >= 18] { line-width: @service-width-z18 - 2 * @major-bridge-casing-width-z18; }
      }
      line-cap: round;
      line-join: round;
    }

    [feature = 'highway_steps'] {
      background/line-color: @steps-casing;
      background/line-cap: round;
      background/line-join: round;

      background/line-opacity: 0.4;

      line/line-color: @steps-fill;
      line/line-dasharray: 2,1;
      
      [zoom >= 14] { 
        line/line-width:  @steps-width-z14; 
        background/line-width: @steps-width-z14 + 2 * @paths-background-width;
      
      }
      [zoom >= 15] { 
        line/line-width:  @steps-width-z15; 
        background/line-width: @steps-width-z15 + 2 * @paths-background-width;
      }
    }

    [feature = 'highway_footway'],
    [feature = 'highway_path'][bicycle != 'designated'] {
      line/line-color: @footway-fill;
      line/line-dasharray: 1,3;
      line/line-join: round;
      line/line-cap: round;
      /*
      background/line-color: @footway-casing;
      background/line-cap: round;
      background/line-join: round;
      background/line-opacity: 0.5;
      [zoom >= 14] {
        line/line-width: @footway-width-z14;
        background/line-width: @footway-width-z14 + 2 * @paths-background-width;
      }
      [zoom >= 15] {
        line/line-width: @footway-width-z15;
        background/line-width: @footway-width-z15 + 2 * @paths-background-width;
      }
      [zoom >= 16] {
        line/line-width: @footway-width-z16;
        background/line-width: @footway-width-z16 + 2 * @paths-background-width;
      }
      [zoom >= 17] {
        line/line-width: @footway-width-z17;
        background/line-width: @footway-width-z17 + 2 * @paths-background-width;
      }
      [zoom >= 18] {
        line/line-width: @footway-width-z18;
        background/line-width: @footway-width-z18 + 2 * @paths-background-width;
      }
      */
    }

    /*
    [feature = 'railway_rail'],
    [feature = 'railway_INT-spur-siding-yard'] {
        #roads-fill, #bridges {
          dark/line-join: round;
          light/line-color: white;
          light/line-join: round;

          [feature = 'railway_rail'] {
            dark/line-color: @railway-dark-fill;
            
            [zoom >= 14] {
              dark/line-width: 6;
              light/line-width: 4;
              light/line-dasharray: 0,10,10,2;
            }
          }

          [feature = 'railway_INT-spur-siding-yard'] {
            dark/line-color: @railway-light-fill;
            [zoom >= 14] {
              dark/line-width: 6;
              light/line-width: 2;
              light/line-dasharray: 0,16,16,4;
            }
            
          }
        }

        #tunnels {
          line-color: #787878;
          line-width: 2.8;
          line-dasharray: 6,4;
          line-clip: false;
          [feature = 'railway_INT-spur-siding-yard'] {
            line-color: #aaa;
            line-width: 1.9;
            line-dasharray: 3,3;
            [zoom >= 18] {
            line-width: 2.7;
            }
          }
          [feature = 'railway_rail'][zoom >= 18] {
            line-dasharray: 8,6;
            line-width: 3.8;
          }
        }
    }
    */

    [feature = 'railway_light_rail'],
    [feature = 'railway_funicular'] {
        [zoom >= 14] { 
          line-color: @railway-dark-fill;
          line-width: 2;  
        }
        #tunnels {
          line-dasharray: 5,3;
        }
    }

    [feature = 'railway_miniature'] {
      [zoom >= 15] {
        line/line-width: 1.2;
        line/line-color: #999;
        dashes/line-width: 3;
        dashes/line-color: #999;
        dashes/line-dasharray: 1,10;
      }
    }

    [feature = 'railway_tram'],
    [feature = 'railway_tram-service'][zoom >= 15] {
      [zoom >= 12] {
        line-color: @railway-dark-fill;
        line-width: 0.75;
        [zoom >= 14] {
          line-width: 1;
        }
        [zoom >= 15] {
          line-width: 1.5;
          [feature = 'railway_tram-service'] {
            line-width: 0.5;
          }
        }
        [zoom >= 17] {
          line-width: 2;
          [feature = 'railway_tram-service'] {
            line-width: 1;
          }
        }
        [zoom >= 18] {
          [feature = 'railway_tram-service'] {
            line-width: 1.5;
          }
        }
        [zoom >= 19] {
          [feature = 'railway_tram-service'] {
            line-width: 2;
          }
        }
        #tunnels {
          line-dasharray: 5,3;
        }
      }
    }

    [feature = 'railway_subway'] {
      [zoom >= 12] {
        line-width: 2;
        line-color: @railway-dark-fill;
        #tunnels {
          line-dasharray: 5,3;
        }
      }
      #bridges {
        [zoom >= 14] {
          line-width: 2;
          line-color: @railway-dark-fill;
        }
      }
    }

    [feature = 'railway_preserved'] {
      [zoom >= 12] {
        dark/line-width: 1.5;
        dark/line-color: #aaa;
        dark/line-join: round;
        [zoom >= 13] {
          dark/line-width: 3;
          dark/line-color: #999999;
          light/line-width: 1;
          light/line-color: white;
          light/line-dasharray: 0,1,8,1;
          light/line-join: round;
        }
      }
    }

    [feature = 'railway_INT-preserved-ssy'] {
      [zoom >= 12] {
        dark/line-width: 1;
        dark/line-color: #aaa;
        dark/line-join: round;
        [zoom >= 13] {
          dark/line-width: 2;
          dark/line-color: #999999;
          light/line-width: 0.8;
          light/line-color: white;
          light/line-dasharray: 0,1,8,1;
          light/line-join: round;
        }
      }
    }

    [feature = 'railway_monorail'] {
      [zoom >= 14] {
        background/line-width: 4;
        background/line-color: #fff;
        background/line-opacity: 0.5;
        background/line-cap: round;
        background/line-join: round;
        line/line-width: 3;
        line/line-color: @railway-dark-fill;
        line/line-dasharray: 2,3;
        line/line-cap: round;
        line/line-join: round;
      }
    }

    [feature = 'railway_construction'] {
      [zoom >= 13] {
        line-color: grey;
        line-width: 2;
        line-dasharray: 2,4;
        line-join: round;
        [zoom >= 14] {
          line-dasharray: 2,3;
        }
        [zoom >= 15] {
          line-width: 3;
          line-dasharray: 3,3;
        }
      }
    }

    [feature = 'railway_disused'] {
      [zoom >= 15] {
        line-color: @railway-light-fill;
        line-width: 2;
        line-dasharray: 2,4;
        line-join: round;
      }
    }
  }

  ::line {
    [feature = 'railway_rail'],
    [feature = 'railway_INT-spur-siding-yard'] {
      #roads-fill, #bridges {
        line-width: 4;
        [feature = 'railway_rail'] {
          line-color: @railway-dark-fill;
        }
        [feature = 'railway_INT-spur-siding-yard'] {
          line-color: @railway-light-fill;
        }
      }
      #tunnels {
        line-width: 4;
        line-dasharray: 0, 12, 12, 2;
        [feature = 'railway_rail'] {
          line-color: @railway-medium-fill;
        }
        [feature = 'railway_INT-spur-siding-yard'] {
          line-color: @railway-light-fill;
        }
      }
    }

    [feature = 'railway_narrow_gauge'] {
      #roads-fill, #bridges {
        line-width: 3;
          line-color: @railway-dark-fill;
      }
      #tunnels {
        line-width: 3;
        line-dasharray: 0, 12, 12, 2;
        line-color: @railway-medium-fill;
      }
    }
  }

  ::dash {
    [feature = 'railway_rail'],
    [feature = 'railway_INT-spur-siding-yard'] {
      #roads-fill, #bridges {
        line-color: #fff;
        line-width: 1.5;
        line-dasharray: 0, 12, 12, 2;
      }
      #tunnels {

      }
    }
    [feature = 'railway_narrow_gauge'] {
      #roads-fill, #bridges {
        line-color: #fff;
        line-width: 1;
        line-dasharray: 0, 12, 12, 2;
      }
      #tunnels {

      }
    }
  }
}


#highway-area-casing {
  [feature = 'highway_residential'],
  [feature = 'highway_unclassified'],
  [feature = 'highway_service'] {
    [zoom >= 14] {
      line-color: #999;
      line-width: 1;
    }
  }

  [feature = 'highway_pedestrian'],
  [feature = 'highway_footway'],
  [feature = 'highway_cycleway'],
  [feature = 'highway_path'] {
    [zoom >= 15] {
      line-color: grey;
      line-width: 1;
    }
  }

  [feature = 'highway_track'][zoom >= 15] {
    line-color: @track-fill;
    line-width: 1;
    line-dasharray: 5,4,2,4;
    line-cap: round;
    line-join: round;
  }
}

#highway-area-fill {
  [feature = 'highway_living_street'][zoom >= 14] {
    polygon-fill: @pedestrian-fill;
  }

  [feature = 'highway_residential'],
  [feature = 'highway_unclassified'],
  [feature = 'highway_service'] {
    [zoom >= 14] {
      polygon-fill: #fff;
    }
  }

  [feature = 'highway_pedestrian'],
  [feature = 'highway_footway'],
  [feature = 'highway_cycleway'],
  [feature = 'highway_path'] {
    [zoom >= 15] {
      polygon-fill: @pedestrian-fill;
    }
  }

  [feature = 'highway_track'][zoom >= 15] {
    polygon-fill: #cdbea0;
  }

  [feature = 'aeroway_runway'][zoom >= 11] {
    polygon-fill: @pedestrian-fill;
  }

  [feature = 'aeroway_taxiway'][zoom >= 13] {
    polygon-fill: @pedestrian-fill;
  }

  [feature = 'aeroway_helipad'][zoom >= 16] {
    polygon-fill: @pedestrian-fill;
  }
}
