/* Animated Pie Charts */

@property --percentage{
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}
@property --delay{
    syntax: '<time>';
    inherits: true;
    initial-value: 0.5;
}
  .charts {
    display: flex;
    justify-content: space-around;
    /* gap: 60px; */
  }
  .pie-title {
    text-align: center;
    margin-bottom: 0px;
  }
  .pie {
    --percentage:0;
    --border-thickness:25px;
    --colour:#BDBEE0;
    --width:200px;
    
    width:var(--width);
    aspect-ratio:1;
    position:relative;
    display:inline-grid;
    margin:5px;
    place-content:center;
    font-size:25px;
    font-weight:bold;
    font-family:sans-serif;
  }
  .pie:before,
  .pie:after {
    content:"";
    position:absolute;
    border-radius:50%;
  }
  .pie:before {
    inset:0;
    background:
      radial-gradient(farthest-side,var(--colour) 98%,#0000) top/var(--border-thickness) var(--border-thickness) no-repeat,
      conic-gradient(var(--colour) calc(var(--percentage)*1%),#BDBEE0 0);
    -webkit-mask:radial-gradient(farthest-side,#0000 calc(99% - var(--border-thickness)),#000 calc(100% - var(--border-thickness)));
            mask:radial-gradient(farthest-side,#0000 calc(99% - var(--border-thickness)),#000 calc(100% - var(--border-thickness)));
  }
  .pie:after {
    inset:calc(50% - var(--border-thickness)/2);
    background:var(--colour);
    transform:rotate(calc(var(--percentage)*3.6deg)) translateY(calc(50% - var(--width)/2));
  }
  .pie img {
    width: 300px;
    position: absolute;
    bottom: -126px;
    left: -125px;
  }
  .pie img.lorry {
    bottom: -123px;
    left: -125px;
  }
  .animate {
    transition: --percentage 1s;
  }
  .no-round:before {
    background-size:0 0,auto;
  }
  .no-round:after {
    content:none;
  }
  

/* Number counters */
@property --percent {
    syntax: "<number>";
    initial-value: 0;
    inherits: false;
  }
  @property --temp {
    syntax: "<number>";
    initial-value: 0;
    inherits: false;
  }
  @property --v1 {
    syntax: "<integer>";
    initial-value: 0;
    inherits: false;
  }
  @property --v2 {
    syntax: "<integer>";
    initial-value: 0;
    inherits: false;
  }
  .percent-counter {
    padding: 2rem;
    transition: --percent 1s;
    --temp: calc(var(--percent) * 100);
    --v1: max(var(--temp) - 0.5, 0);
    --v2: max((var(--temp) - var(--v1)) * 10 - 0.5);
    counter-reset: v1 var(--v1) v2 var(--v2);
  }
  .percent-counter--decimal::before {
    content: counter(v1) "." counter(v2) "%";
    font-size: 50px;
    color: #112088;
    font-weight: 700;
  }
  .percent-counter--int::before {
    content: counter(v1) "%";
    font-size: 50px;
    color: #112088;
    font-weight: 700;
  }

  /* Mobile styling */
@media (max-width: 1023px) {
  .charts {
    flex-direction: column;
    align-items: center;
  }
  .pie {
    --width:400px;
    --border-thickness: 40px;
  }
  .pie-title {
    margin-top: 50px;
  }
  .pie img {
    width: 550px;
    position: absolute;
    top: 78px;
    left: -189px;
  }
  .pie img.lorry {
    width: 550px;
    position: absolute;
    top: 69px;
    left: -192px;
  }

  @media (max-width: 510px) {
    .pie {
      --width: 300px;
      --border-thickness: 40px;
    }
    .pie img {
      width: 350px;
      position: absolute;
      top: 71px;
      left: -90px;
    }
    .pie img.lorry {
      width: 350px;
      position: absolute;
      top: 62px;
      left: -92px;
    }
  
  }

}


