/* ---------------- */

/* Custom properties */

/* ---------------- */

:root {
    /* Colors */
    --clr-white: 0 100% 100%;
    --clr-white-progress: 215 0% 97%;
    --clr-black: 0 0% 0%;
    --clr-grey-50: 220 38% 97%;
    --clr-grey-5001: 219 13% 44%; 
    --clr-grey-5002: 219 13% 44%;
    --clr-blue-50: 225 100% 96%;
    --clr-blue-100: 220 50% 95%;
    --clr-blue-300: 216 47% 78%;
    --clr-blue-500: 223 100% 59%;
    --clr-blue-850: 215 27% 32%;
    --clr-blue-900: 216 25% 25%;
    --clr-blue-950: 214 24% 23%;
    --clr-green-100: 151 88% 94%;
    --clr-green-500: 151 68% 52%;
    --clr-purple-100: 278 100% 95%;
    --clr-purple-600: 277 91% 56%;
    --clr-orange-50: 27 100% 96%;
    --clr-orange-400: 22 100% 60%;
    --clr-red-500: 0 82% 63%;
    --clr-slate-700: 200 24% 40%;
    
     /* font-sizes */
    --fs-144: 5.5rem; /* 88 */
    --fs-64: 2.2rem; /* 40 */
    --fs-36: 1.25rem; /* 20 */
    --fs-28: clamp(0.8rem, 5vw, 1.125rem); /* 18 */
    --fs-24: 1rem; /* 16 */
    --fs-20: 0.875rem; /* 14 */
    
    
    /* font-families */
    --ff-rubik: "Rubik", sans-serif;
    
    /* font-style */
    --fst-italic: italic;
    
    /* font-weights */
    --fw-300: 300;
    --fw-400: 400;
    --fw-500: 500;
    
    /* line-heights */
    --lh-1: 1;
    --lh-12: 1.2;
    --lh-15: 1.5;
    
}


@media (width >= 35em) {
    :root{
        --fs-144: 9rem;
        --fs-64: 3rem;
        --fs-36: 1.75rem;
        --fs-28: 1.5rem;
        --fs-24: 1.25rem;
        --fs-20: 1rem;
    }
}

@media (width >= 45em) {
    :root{
        --fs-144: 9rem;
        --fs-64: 4rem;
        --fs-36: clamp(1.75rem, 4vw, 2.25rem);
        --fs-28: clamp(1rem, 2vw, 1.75rem);
        --fs-24: 1.5rem;
        --fs-20: 1.25rem;
    }
}

/* -------------------------- */

/* Reset in a external file */

/* -------------------------- */

/* ---------------- */

/* Utility classes */

/* ---------------- */

.flex {
    display: flex;
    flex-wrap: wrap;     
    gap: var(--gap, 1rem);
}

.grid {
    display: grid;
    gap: var(--gap, 1rem);
}

.container {
    padding-inline: clamp(0.4em, 2vw, 2em);
    margin-inline: auto;
    max-width: 90rem;
}

/* AI allow children to shrink instead of forcing overflow */
.container > *,
.flex > * ,
.grid > * {
    min-width: 0; /* allow shrinking inside flex/grid containers */
}

/* AI Ensure images and svgs don't exceed their container */
img, svg, picture, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* AI Constrain large controls (buttons etc.) not to overflow parent */
button,
input,
select,
textarea {
    max-width: 100%;
}

/* adding spacing */
.flow > *:where(:not(:first-child)) {  
    margin-top: var(--flow-space, 1.5rem);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
  
.skip-to-content {
    position: absolute;
    background-color: white;
    color: black;
    padding: .5em 1em;
    margin-inline: auto;
    z-index: 1900;
    transform: translateY(-100%);
    transition: transform 250ms ease-in-out;
}
  
.skip-to-content:focus {
    transform: translateY(0);
}

.darkMode {
    --clr-grey-50: 216 25% 25%; /* main */
    --clr-white: 215 27% 32%; /* buttons */
    --clr-blue-900: 0 100% 100%; /* title & buttons text */
    --clr-grey-5001: 216 47% 78%; /* under title & above title text */
    --clr-grey-5002: 0 100% 100%; /* moon & sun */
    --clr-red-500: 220 38% 97%; /* Error note */
    --clr-white-progress: 217 23% 28%;  /* progress bar */
}
  
 /* Colors */
.bg-white {background-color: hsl(var(--clr-white));}
.bg-black {background-color: hsl(var(--clr-black));}
.bg-grey-50 {background-color: hsl(var(--clr-grey-50));}
.bg-grey-5001 {background-color: hsl(var(--clr-grey-5002));}
.bg-grey-5002 {background-color: hsl(var(--clr-grey-5001));}
.bg-blue-50 {background-color: hsl(var(--clr-blue-50));}
.bg-blue-100 {background-color: hsl(var(--clr-blue-100));}
.bg-blue-300 {background-color: hsl(var(--clr-blue-300));}
.bg-blue-500 {background-color: hsl(var(--clr-blue-500));}
.bg-blue-850 {background-color: hsl(var(--clr-blue-850));}
.bg-blue-900 {background-color: hsl(var(--clr-blue-900));}
.bg-blue-950 {background-color: hsl(var(--clr-blue-950));}
.bg-green-100 {background-color: hsl(var(--clr-green-100));}
.bg-green-500 {background-color: hsl(var(--clr-green-500));}
.bg-purple-100 {background-color: hsl(var(--clr-purple-100));}
.bg-purple-600 {background-color: hsl(var(--clr-purple-600));}
.bg-orange-50 {background-color: hsl(var(--clr-orange-50));}
.bg-orange-400 {background-color: hsl(var(--clr-orange-400));}
.bg-red-500 {background-color: hsl(var(--clr-red-500));}

 

.text-blue-900 {color: hsl(var(--clr-blue-900));}
.text-blue-850 {color: hsl(var(--clr-blue-850));}
.text-blue-300 {color: hsl(var(--clr-blue-300));}
.text-grey-5001 {color: hsl(var(--clr-grey-5001));}
.text-grey-5002 {color: hsl(var(--clr-grey-5002));}
.text-red-500 {color: hsl(var(--clr-red-500));}
.text-slate-700 {color: hsl(var(--clr-slate-700));}
.text-white {color: hsl(var(--clr-white));}

/* typography */
.fst-italic { font-style: var(--fst-italic);}

.lh-1 { line-height: var(--lh-1);}
.lh-12 { line-height: var(--lh-12);}
.lh-15 { line-height: var(--lh-15);}

.fw-300 { font-weight: var(--fw-300);} /* light */
.fw-400 { font-weight: var(--fw-400);} /* regular */
.fw-500 { font-weight: var(--fw-500);} /* medium */

.fs-144 { font-size: var(--fs-144);}
.fs-64 { font-size: var(--fs-64);}
.fs-36 { font-size: var(--fs-36);}
.fs-28 { font-size: var(--fs-28);}
.fs-24 { font-size: var(--fs-24);}
.fs-20 { font-size: var(--fs-20);}

.upperCase { text-transform: uppercase;}

.capitalise { text-transform: capitalize;}

body {
    font-family: var(--ff-rubik);
    font-size: var(--fs-28);
    font-weight: var(--fw-400);
    color: hsl(var(--clr-blue-900));
    line-height: var(--lh-15);
    background-color: hsl(var(--clr-white));
}

/* ------------------------------------ */

/* Components                           */

/* ------------------------------------ */
     
.progress__bar-container {
    width: 100%;
    justify-self: center;
    padding-inline: 0;
    margin-inline: 0;
}
            
.progress__bar {
    padding-left: 0.4rem;
    align-items: center;
    height: 1rem;
    background-color: hsl(var(--clr-white-progress));
}

.progress {
    height: 0.5rem;
}
            
.error > p {
    font-size: clamp( 1rem, 5vw, 1.125rem);
}
            
.option {
    --gap: clamp(1rem, 3.5vw, 2rem);
}

.option__tag {
    color: hsl(var(--clr-black));
    background-color: hsl(220deg 38% 97%);
}                 
            
.score__container {
    justify-self: center;
}


.score__intro {
    background-color: transparent;
}

.score__data {
    width: 100%;
    padding: 2rem;
    --gap: 1rem;
    border-radius: 0.75rem;
    box-shadow: 
        0 16px 40px 0 hsl(220deg 29% 66% / 14%);
}

.logo {
    justify-content: center;
}
               
.score__value {
    --gap: 1rem;
    justify-items: center;
}
        
/* ----------------------------------- */

/* Page specific background          */

/* --------------------------------- */
.container {
    background-image: url("./assets/images/pattern-background-mobile-light.svg");
    background-position: left top;
    background-repeat: no-repeat;
    background-size: cover;

    /* The background images use background-size: cover; — cover can crop but does not force overflow. */
}

.darkMode.container {
    background-image: url("./assets/images/pattern-background-mobile-dark.svg");
}

@media (width >= 35rem) {
    .container {
        background-image: url("./assets/images/pattern-background-tablet-light.svg");
        background-position: left top;
        background-repeat: no-repeat;
        background-size: contain;
    }
    
    .darkMode.container {
        background-image: url("./assets/images/pattern-background-tablet-dark.svg");
    }
}

@media (width >= 45rem) {
    .container {
        background-image: url("./assets/images/pattern-background-desktop-light.svg");
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
    }
    
    .darkMode.container {
        background-image: url("./assets/images/pattern-background-desktop-dark.svg");
    }
}

.darkMode .attribution > * {
    color: white;
}

/* ------------------------------------ */

/* Layout                               */

/* ------------------------------------ */

/* When to keep overflow-x: hidden
   If you use it, understand it hides the symptom (scrollbar) not the cause. 
   Use it as a final cosmetic fallback only after fixing the real causes above. */

/* body {
    overflow-x: hidden;
} */

.container { 
    min-width: 18rem;
    padding-inline: 1.5rem;
    --gap: 0;
    align-content: start;
}
              
.container > * {
    min-width: 0;
}

/* ------------------------ */

/* header                   */

/* ------------------------ */
.header { 
    align-content: center;
    justify-items: space-evenly;
    padding-block: 1rem;
    --gap: auto;
    max-height: 5rem;
} 

/* LOGO */
.logo {
    display: none;
    max-width: 100%;
    align-items: center;
    --gap: clamp(1rem, 3.5vw, 2rem);
}

.logo__img {
    width: clamp(2.5rem, 5vw, 3.5rem);
    aspect-ratio: 1;
    border-radius: 0.5rem;
    place-content: center;
    align-self: center;
    justify-items: center;
}

/* LIGHT/DARK MODE BUTTON */
.mode__switch {
    place-self: end;
    align-self: center;
    justify-content: center;
    padding: 0.25rem; 
    gap: 0.3rem;
    margin-left: auto;  /* Its let's to place element to the end/right */
}

.sun, .moon {
    width: clamp(1.2rem, 2.5vw, 1.8rem); 
}

/* Toggle button with all states */

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    min-width: 2.5rem;
    aspect-ratio: 2/1;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider container */
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    width: 2rem;
    aspect-ratio: 2/1.2;
    transition: 0.4s;
}

/* Oval slider */
.slider::before {
    position: absolute;
    content: "";
    top: 15%;
    bottom: 15%;
    min-width: 0.7rem;
    aspect-ratio: 1;
    background-color: white;
    transition: 0.4s;
}

/* Rounding sliders */
.slider.round {
    top: 3%;
    bottom: 3%;
    place-self: center;
    padding: 0.25rem;
    border-radius: 2.125rem; 
    background-color: hsl(var(--clr-purple-600));
}


input:checked + .slider::before {
    transform: translateX(0.7rem);
}

.slider.round::before {
    border-radius: 50%;
}

.slider__dark::before {
    left: 50%;
}

/* --------------------------- */

/* Accessibility: Focus styles  */

/* --------------------------- */

/* Visible focus for keyboard users */
button:focus-visible, button:hover {
    outline: 3px solid hsl(var(--clr-purple-600));
    outline-offset: 3px;
    border-radius: 0.5rem;
}

/* When the hidden checkbox receives focus, show ring on the visible slider */
.switch input:focus-visible + .slider {
    box-shadow: 0 0 0 4px rgb(66 133 244 / 15%);
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ------------------------ */

/* main - start menu        */

/* ------------------------ */
.main__container { 
    padding-top: 2rem;
    justify-items: center !important;
}

.start__intro {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notice {
    padding-block: 1rem 2.5rem; 
}

/* Button with icon */
.subjects {
    --gap: 1rem;
    width: 100%;
}

.subject__button {
    width: 100%;
    place-items: center start;
    justify-self: center;
    --gap: clamp(1rem, 3vw, 2rem);
    padding: 1rem;
}

.lightShadow {
    box-shadow: 
        0 16px 40px 0 hsl(220deg 29% 66% / 14%);
}

.darkShadow {
    box-shadow: 
        0 16px 40px 0 hsl(216deg 25% 25% / 60%);
}

.subject__icon {
    width: 3.5rem;
    aspect-ratio: 1;
    place-content: center center;
    border-radius: 0.5rem;
}

/* ----------------------- */

/* main - question         */

/* ----------------------- */

.question__container {
    gap: 1rem;
    width: 100%;
}

.visi { display: flex;}

.open {
    display: grid;
}

.closed {
    display: none;
}

.question__intro {
    justify-content: start;
    width: 100%;
}

.options {
    width: 100%;
    --gap: 1rem;
    background-color: transparent;
}

.question__intro > :first-child {
    padding-bottom: 1rem;
}

.question__intro > :last-child {
    padding-top: 1.5rem;
}

/* Progress bar */
.progress__bar-container {
    background-color: transparent;
    justify-content: center;
}

.progress__bar {
    border-radius: 999px;
    overflow: hidden;
}

.progress {
    background-color: hsl(var(--clr-purple-600));
    border-radius: 999px;
    transition: width 0.3s;
}

.options {
    padding-top: 2.5rem;
}

/* answer option */
.answer__option {
    justify-self: end;
    gap: 1rem;
}

.option {
    place-items: center start;
    margin-left: 0 !important;
    padding: 1rem;
}

.light {
    box-shadow: 
        0 16px 40px 0 hsl(220deg 29% 66% / 14%);
}

.dark {
    box-shadow: 
        0 16px 40px 0 hsl(216deg 25% 25% / 60%);
}

.question__container > * {
    width: 100%;
}

/* ------------------------- */

/* score menu */

/* ------------------------- */
.score__container {
    --gap: 2.5rem;
    justify-self: stretch;
    justify-content: stretch;
}


.score__container {
    background-color: transparent;
}

.score__intro,
.score__wrapper {
    width: 100%;
}

.score__wrapper {
    --gap: 1rem;
}

.score__container .submit__button {
    width: 100%;
    margin-inline: auto;
}

.attribution {
    justify-self: center;
}


/* Wrong answer notification */
.error {
    --gap: 0.2rem;
    padding-top: 0.5rem;
    place-self: center;
    display: none;
}

.error > * {
    align-self: center;
}

.error img {
    width: 1.875rem;
    aspect-ratio: 1;
}

/* Button submit */
button {
    cursor: pointer;
    border: none;
    border-radius: 0.75rem;    
}

.submit__button {
    padding: 1rem;
    color: hsl(0deg 100% 100%);
    box-shadow: 
        0 16px 40px 0 hsl(220deg 29% 66% / 14%);
}

.submit__button.active {
    background:
        linear-gradient(hsl(0deg 0% 100% / 50%)), hsl(var(--clr-purple-600));
}

.option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
}

.option.hover {
    border: 3px solid hsl(var(--clr-purple-600));
}

.option.correct__answer {
    border: 3px solid hsl(var(--clr-green-500));
}

.option.incorrect__answer {
    border: 3px solid hsl(0deg 82% 63%);
}

.options .option { 
    justify-content: start;
}

/* It let's put icon on the right side of button element
It is very usefull code */
.correct__icon {
    display: none;
}

.incorrect__icon {
    display: none;
}

.show {
    display: block;
}

.hide {
    display: none;
}

.correct__icon, .incorrect__icon {
    margin-left: auto;
    width: clamp(1.5rem, 2vw, 2rem);
}

.option__tag {
    width: clamp(2.5rem, 4vw, 3.5rem ); 
    aspect-ratio: 1;
    border-radius: 0.5rem;
    place-content: center center;
    background-color: hsl(220deg 38% 97%);
}

.option__text {
    text-align: left;
}

.result {
    text-align: left;
}

@media (width >= 35rem) {
   .main__container {
       padding-top: 3rem;
       width: 80vw;
   }
   
   button {
       border-radius: 1.5rem;
   }

   /* ------------------------ */

   /* main- start menu         */

   /* ------------------------ */
   .container {
        padding-inline: 4rem;
    }
    
    .notice {
        padding-block: 1rem 4rem;
    }
    
    .subjects { 
        width: 100%;
        --gap: 1.5rem;
    }
    
    /* -------------------------- */

    /* main - question            */

    /* -------------------------- */
    .question__intro > :first-child {
        padding-bottom: 1.5rem;
    }
    
    .question__intro > :last-child {
        padding-top: 2.5rem;
    }
    
    button {
        width: 100%;
    }
    
    .options {
        --gap: 1.5rem;
        justify-items: center;
    }
    
    .options > :last-child {
        --flow-space: 2rem;
    }
    
    .submit__button {
        padding: 2rem;
    }
    
    .error {
        padding: 0;
    }
    
    /* -------------------- */

    /* main - score         */

    /* -------------------- */
    .score__container {
        --gap: 4rem;
    }
    
    .score__wrapper {
        --gap: 2rem;
    }
    
    .score__data {
        padding: 3rem;
        --gap: 2.5rem;
        border-radius: 1.5rem;
    }         
}
        
@media (width >= 45rem) {
    /* ------------------------- */

    /* main - start menu         */

    /* ------------------------- */
     .container {
        padding-inline: clamp(3rem, 5vw, 8.75rem);
    }

     .header {
        padding: 0;
        padding-block: clamp(3rem, 4vw, 6rem);
        width: 100%;
    }

    .main__container {
        grid-template-columns: 1fr 1fr;
        --gap: clamp(1rem, 5vw, 8rem);
        padding-top: 1rem;
        width: 100%;
    }

    .question__container { 
        gap: clamp(1rem, 7vw, 10rem); 
    }
    
    .mode__switch {
        align-self: center;
    }
    
    .notice {
        padding-block: 3rem 0;
    }
    
    .subjects {
        justify-items: center;
        --gap: 1rem;
        width: 100%;
    }
    
    .subject__button {
        padding: 1.5rem;
    }
    
    /* ------------------------- */

    /* main - question           */

    /* ------------------------- */    
    .question__intro {
        display: flex;
        flex-direction: column;
        max-height: inherit;
        gap: 1.5rem;
    }
    
    .question__intro > *:not(.progress__bar-container) {
        padding-bottom: 0;
    }
    
    .progress__bar-container {
        margin-top: auto;
        height: 7rem;
    }
    
    .question__intro > :last-child {
        padding: 0;
    }
    
    .options {
        --gap: 1rem;
        justify-items: end;
        padding-top: 0;
    }
    
    .option {
        padding: 1.25rem;
    }
                          
    /* ------------------- */

    /* main - score        */

    /* ------------------- */
    .score__wrapper {
        --gap: 2rem
    }
    
    .score__data {
        padding: 3rem;
    }
}