/* rem and em don not depend on html font size in media queries, Instead 1rem = 1em = 16px
rem: root font size
em:current font size
*/

/* *************only screen******* */

/* **************************** */
/* Below 1344px (Smaller Desktops) */
/* **************************** */

@media (min-width: 1200px) {
  body {
    max-width: 120rem;
    margin: 0 auto;
  }
  .canvas__div {
    padding: 20px;
  }

  .observation {
    transform: scale(0.8);
  }

  .stuck-at-selector {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: row;
    grid-gap: 0.5rem;
    right: 35px;
    bottom: -25px;
    padding: 4px;
  }
  .div1,
  .div2 {
    display: flex;
    justify-content: center; /* Center the image horizontally */
    align-items: center; /* Center the image vertically */
    position: relative;
  }

  /* #truthTable {
    transform: scale(1.7);
  } */
}

/* **************************** */
/* Below 1200px (Lanscape Tablets) */
/* **************************** */

@media (max-width: 75em) {
  .title-div h1 {
    font-size: 2.5rem;
  }
  .task-title {
    font-size: 2rem;
  }
  .tool-menu {
    font-size: 2rem;
    gap: 2rem;
  }
  .icons {
    width: 3rem;
    height: 3rem;
  }
  .ctrl-icons {
    width: 3rem;
    height: 3rem;
  }

  .tool-list span {
    font-size: 1.2rem;
  }
  .canvas {
    display: block;
  }
  .div__control img {
    width: 3rem;
    height: 2.8rem;
  }
  .div1,
  .div2 {
    display: flex;
    justify-content: center; /* Center the image horizontally */
    align-items: center; /* Center the image vertically */
    position: relative;
  }

  .canvas__div {
    padding: 30px;
  }
  .practice {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
  }

  #truthTable {
    transform: scale(2);
  }
}

/* **************************** */
/* Below 944px ( Tablets) */
/* **************************** */

@media (max-width: 59em) {
  body {
    width: 100%;
    margin: 0;
  }
  .tool-link:link,
  .tool-link:visited {
    gap: 0.5rem;
    font-size: 1.4rem;
    flex-direction: column;
  }

  .title-div h1 {
    font-size: 2rem;
  }
  .sidebar {
    position: fixed;
    padding: 0;
    bottom: 0;
    left: 0;
    flex-direction: row;
    width: 100%;
    backdrop-filter: blur(10rem);
    z-index: 101;
    justify-content: space-evenly;
    border-radius: 0;
    scroll-behavior: auto;
    margin: 0;
  }
  .main {
    grid-column: 1/-1;
  }
  .tool-menu {
    list-style: none;
    display: flex;
    flex-direction: row;
    gap: 4rem;
    width: 100%;
    font-size: 2.4rem;
    justify-content: space-evenly;
    padding: 1rem;
  }
  #image_container {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.85);
    margin-left: -525px;
  }

  .canvas {
    display: block;
  }
  .main-section {
    grid-template-columns: 1fr;
  }
  .canvas__div {
    /* grid-template-columns: 1fr; */
    padding: 85px;
  }
  .canvas {
    display: block;
    border: none;
  }
  .footer {
    margin-bottom: 78px;
  }

  .grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #truthTable {
    transform: scale(1.6);
  }
}

/* **************************** */
/* Below 820px (Smaller Tablets) */
/* **************************** */
@media (max-width: 48em) {
  .main-section {
    grid-template-columns: 1fr;
  }

  .canvas__div {
    padding: 80px;
  }
  .canvas {
    display: block;
    border: none;
  }
  .tool-list span {
    font-size: 1.6rem;
  }

  .footer {
    margin-bottom: 78px;
  }

  .grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stuck-at-selector {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: row;
    grid-gap: 0.5rem;
    bottom: -10px;
    padding: 4px;
  }
}

/* **************************** */
/* Below 704px (Smaller Tablets) */
/* **************************** */
@media (max-width: 44em) {
  .canvas__div {
    padding: 30px;
  }
  .stuck-at-selector {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: row;
    grid-gap: 0.5rem;
    bottom: -80px;
    padding: 4px;
  }

  .img-div {
    flex-direction: column;
  }
  .title-div {
    gap: 0rem;
    text-align: center;
  }
  .round {
    width: 0.6rem;
    height: 0.6rem;
  }
  .logo-div {
    width: 6.5rem;
  }
  .main__task-div:nth-child(4) {
    margin-bottom: 6rem;
  }

  .cross-img {
    width: 60%;
  }
  .canvas {
    display: block;
    border: none;
  }
  .footer {
    /* margin-bottom: 78px; */
  }

  /* Ensure div1 and div2 are positioned without overlapping */
  .div1,
  .div2 {
    width: 100%; /* Full width of container */
    position: relative; /* Position relative for internal absolute elements */
    padding: 15px; /* Add padding to prevent overlap */
    /* Add spacing between divs */
    box-sizing: border-box; /* Ensures padding doesn’t add to width */
  }
  .div1 {
    margin-bottom: 80px; /* Only .div1 will have the larger margin */
    /* background-color: red; */
  }

  .div2 {
    /* margin-bottom: 20px;  */
  }

  #switchA,
  #switchB,
  #switchC,
  #switchD {
    transform: scale(0.9); /* Scale down the switches slightly */
    left: 2%;
  }
  #switchA {
    top: 19%;
  }

  #switchC {
    top: 60%;
  }

  #switchD {
    top: 74%;
  }

  .truth-table {
    position: relative;
    left: 0px;
    transform: scale(1.2);
  }
  .truth-th,
  .truth-td {
    border: 1px solid #000;
    padding: 5px; /* Reduced padding for smaller cells */
    font-size: 12px; /* Smaller font size for compact table */
    line-height: 0.5; /* Reduced line height to compress the row height */
    height: 10px; /* Reduced height of the rows */
  }
  /* #truthTable {
    transform: scale(2);
    margin-left: -20px;
  } */

  .grid-container .bulb {
    position: absolute;
    top: 25.5%;
    left: 85.5%;
    width: 10%;
    height: auto;
    transform: rotate(-90deg);
  }

  .grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .practice {
    margin-bottom: 60px;
  }

  #inputy {
    top: 34%;
    left: -3%;
  }

  #switchz {
    top: 62%;
    left: -3%;
  }

  #inputz {
    top: 62%;
    left: -3%;
  }

  #switchp {
    top: 80%;
    left: -3%;
  }

  #inputp {
    top: 80%;
    left: -3%;
  }
  .grid-container .switch1-txt,
  .grid-container .switch2-txt,
  .grid-container .switch3-txt,
  .grid-container .switch4-txt {
    position: absolute;
    width: 9%; /* Adjust size for responsiveness */
    height: auto;
    cursor: pointer;
  }

  #switchx {
    position: absolute;
    top: -8%;
    left: 1%;
  }

  #inputx {
    position: absolute;
    top: -8%;
    left: 1%;
  }

  #switchy {
    top: 24%;
    left: 1%;
  }

  #inputy {
    top: 24%;
    left: 1%;
  }

  #switchz {
    top: 71%;
    left: 1%;
  }

  #inputz {
    top: 71%;
    left: 1%;
  }

  #switchp {
    top: 99%;
    left: 1%;
  }

  #inputp {
    top: 99%;
    left: 1%;
  }

  #faultx {
    position: absolute;
    width: 70px;
    top: -19%;
    left: 0%;
  }

  #faulty {
    position: absolute;
    width: 70px;
    top: 15%;
    left: 0%;
  }

  #faultz {
    position: absolute;
    width: 70px;
    top: 55%;
    left: 0%;
  }

  #faultp {
    position: absolute;
    width: 70px;
    top: 85%;
    left: 0%;
  }

  #faultxor1 {
    position: absolute;
    width: 70px;
    top: 6%;
    left: 36%;
  }

  #faultxor2 {
    position: absolute;
    width: 70px;
    top: 97%;
    left: 36%;
  }

  #faultc {
    position: absolute;
    width: 70px;
    top: 37%;
    left: 75%;
  }

  .grid-container img {
    width: 100%;
    height: 170%;
  }

  .grid-container #outputC {
    left: 97%;
  }

  .grid-container .switch1-txt {
    top: -7%;
    left: -4%;
  }
  .grid-container .switch2-txt {
    top: 24%;
    left: -4%;
  }
  .grid-container .switch3-txt {
    top: 72%;
    left: -4%;
  }
  .grid-container .switch4-txt {
    top: 102%;
    left: -4%;
  }
  #output {
    margin-top: 5px;
  }
}

/* **************************** */
/* Below 540px (Smaller Tablets) */
/* **************************** */
@media (max-width: 34em) {
  .canvas__div {
    grid-template-columns: 1fr;
  }
  .div1,
  .div2 {
    width: 100%; /* Full width of container */
    position: relative; /* Position relative for internal absolute elements */
    padding: 15px; /* Add padding to prevent overlap */
    /* Add spacing between divs */
    box-sizing: border-box; /* Ensures padding doesn’t add to width */
  }
  .div1 {
    margin-bottom: 60px; /* Only .div1 will have the larger margin */
  }

  .div2 {
    /* margin-bottom: 20px;  */
  }
  .grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stuck-at-selector {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: row;
    grid-gap: 0.5rem;
    bottom: -40px;
    padding: 4px;
  }

  .title-div h1 {
    font-size: 1.6rem;
  }

  .logo-div {
    width: 4.5rem;
  }
  .div__control {
    gap: 2rem;
  }
  .ctrl-icons {
    width: 2.5rem;
    height: 2.5rem;
  }
  .tool-menu {
    gap: 1.5rem;
  }
  .tool-list span {
    font-size: 1.2rem;
  }
  .task-title {
    font-size: 1.7rem;
  }
  canvas {
    width: 100%;
  }
  label,
  select,
  input,
  p {
    display: inline-block;
    font-size: 1.5rem;
  }
  .main {
    gap: 0.5rem;
  }
  .main-section {
    gap: 0.5rem;
  }
  .sidebar {
    border-radius: 0;
  }
  .canvas {
    display: block;
    border: none;
  }
  .div__control img {
    width: 2.7rem;
    height: 2.5rem;
  }
  .tooltip {
    font-size: 1rem;
  }
  .footer {
    margin-bottom: 78px;
  }

  .practice {
    margin: 0;
    padding: 0;
  }
  .model {
    margin: 60px;
  }

  .grid-container .bulb {
    position: absolute;
    top: 26%;
    left: 85%;
    width: 10%;
    height: auto;
    transform: rotate(-90deg);
  }

  #switchx {
    position: absolute;
    top: -3%;
    left: 4%;
  }

  #inputx {
    position: absolute;
    top: -3%;
    left: 4%;
  }

  #switchy {
    top: 30%;
    left: 4%;
  }

  #inputy {
    top: 30%;
    left: 4%;
  }

  #switchz {
    top: 68%;
    left: 4%;
  }

  #inputz {
    top: 68%;
    left: 4%;
  }

  #switchp {
    top: 97%;
    left: 4%;
  }

  #inputp {
    top: 97%;
    left: 4%;
  }

  #truthTable {
    transform: scale(1.8);
  }
  .grid-container .switch1-txt {
    top: -4%;
    left: -3%;
  }
  .grid-container .switch2-txt {
    top: 28%;
    left: -3%;
  }
  .grid-container .switch3-txt {
    top: 65%;
    left: -3%;
  }
  .grid-container .switch4-txt {
    top: 94%;
    left: -3%;
  }
  .truth-table {
    transform: scale(1.1);
  }
}

@media (max-width: 30em) {
  .div1,
  .div2 {
    width: 100%; /* Full width of container */
    position: relative; /* Position relative for internal absolute elements */
    padding: 15px; /* Add padding to prevent overlap */
    /* Add spacing between divs */
    box-sizing: border-box; /* Ensures padding doesn’t add to width */
  }
  .div1 {
    margin-bottom: 60px;
  }

  .div2 {
    /* margin-bottom: 20px;  */
  }

  #faultx {
    position: absolute;
    top: -19%;
    left: -3%;
  }

  #faulty {
    position: absolute;
    top: 15%;
    left: -3%;
  }

  #faultz {
    position: absolute;
    top: 54%;
    left: -3%;
  }

  #faultp {
    position: absolute;
    top: 83%;
    left: -3%;
  }

  #faultxor1 {
    position: absolute;
    top: 3%;
    left: 38%;
  }

  #faultxor2 {
    position: absolute;
    top: 97%;
    left: 38%;
  }

  #faultc {
    position: absolute;
    top: 33%;
    left: 74%;
  }
  #switchx {
    position: absolute;
    top: 0%;
    left: 1%;
  }

  #inputx {
    position: absolute;
    top: 0%;
    left: 1%;
  }

  #switchy {
    top: 31%;
    left: 2%;
  }

  #inputy {
    top: 31%;
    left: 2%;
  }

  #switchz {
    top: 70%;
    left: 1%;
  }

  #inputz {
    top: 70%;
    left: 1%;
  }

  #switchp {
    top: 97%;
    left: 1%;
  }

  #inputp {
    top: 97%;
    left: 1%;
  }
  .truth-table {
    transform: scale(1);
  }
}

@media (max-width: 27em) {
  .sidebar {
    position: fixed;
    padding: 0;
    bottom: 0;
    left: 0;
    flex-direction: row;
    width: 100%;
    backdrop-filter: blur(10rem);
    z-index: 101;
    justify-content: space-evenly;
    border-radius: 0;
    scroll-behavior: auto;
  }
  .tool-menu {
    list-style: none;
    display: flex;
    flex-direction: row;
    gap: 3rem;
    width: 100%;
    font-size: 2.4rem;
    justify-content: space-evenly;
    padding: 1rem;
  }
  .canvas__div {
    min-height: calc(100vh - 7 * 5.6rem);
    overflow: hidden;
    margin: 0;
    padding: 0rem;
  }
  .apparatus-screen {
    grid-template-columns: 1fr;
  }
  .practice {
    margin: 0;
    padding: 0;
  }
  .quiz-div {
    padding: 0.5rem;
    width: 100%;
  }
  .answers {
    grid-template-columns: 1fr;
  }
  .practice-step-no {
    width: 3rem;
    height: 3rem;
  }
  .btn-next,
  .btn-reset,
  .btn-top {
    width: 3rem;
    height: 3rem;
  }
  .footer {
    margin-bottom: 78px;
  }

  .canvas__div {
    grid-template-columns: 1fr;
    padding: 40px;
  }

  .grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .div1,
  .div2 {
    width: 100%; /* Full width of container */
    position: relative; /* Position relative for internal absolute elements */
    padding: 15px; /* Add padding to prevent overlap */
    /* Add spacing between divs */
    box-sizing: border-box; /* Ensures padding doesn’t add to width */
  }
  .div1 {
    margin-bottom: 60px; /* Only .div1 will have the larger margin */
  }

  .div2 {
    /* margin-bottom: 20px;  */
  }

  .grid-container .bulb {
    position: absolute;
    top: 27%;
    left: 83%;
    width: 10%;
    height: auto;
    transform: rotate(-90deg);
  }

  #faultx {
    position: absolute;
    width: 55px;
    top: -19%;
    left: -8%;
    font-size: 11px;
  }

  #faulty {
    position: absolute;
    width: 55px;
    top: 16%;
    left: -8%;
    font-size: 11px;
  }

  #faultz {
    position: absolute;
    width: 55px;
    font-size: 11px;
    top: 54%;
    left: -8%;
  }

  #faultp {
    position: absolute;
    width: 55px;
    font-size: 11px;
    top: 84%;
    left: -8%;
  }

  #faultxor1 {
    position: absolute;
    width: 55px;
    font-size: 11px;
    top: 1%;
    left: 37%;
  }

  #faultxor2 {
    position: absolute;
    width: 55px;
    font-size: 11px;
    left: 37%;
  }

  #faultc {
    position: absolute;
    width: 55px;
    font-size: 11px;
    top: 24%;
    left: 72%;
  }
  #switchx {
    position: absolute;
    top: 0%;
    left: 1%;
  }

  #inputx {
    position: absolute;
    top: 0%;
    left: 1%;
  }

  #switchy {
    top: 31%;
    left: 2%;
  }

  #inputy {
    top: 31%;
    left: 2%;
  }

  #switchz {
    top: 70%;
    left: 1%;
  }

  #inputz {
    top: 70%;
    left: 1%;
  }

  #switchp {
    top: 97%;
    left: 1%;
  }

  #inputp {
    top: 97%;
    left: 1%;
  }
}
/* 
  
  - Font sizes (px)
  10 / 12 / 14 / 16 / 18 / 20 / 24 / 30 / 36 / 44 / 52 / 62 / 74 / 86 / 98
  
  - Spacing system (px)
  2 / 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 80 / 96 / 128
  
   */
