/* GLOBAL STYLES FOR ELEMENTS */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kdam Thmor Pro', monospace;
    background-image: linear-gradient(#24631b, #174211);
    color: #facc20;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Prevents the player selecting any ui element that is not a button */
:not(button) {
    user-select: none;
}

button {
    font-family: inherit;
    text-transform: uppercase;
    background-color: #facc20;
    color: #333333;
    padding: 5px 10px;
    border-radius: 10px;
    transition: .15s all ease-in-out;
    border: none;
}

/* Reverse the colors on hover */
button:hover {
    background-color: #333333;
    color: #facc20;
}

span {
    background-color: #24631b;
    color: white;
    font-size: 1.5em;
}

header{
    text-align: center;
    color: white;
}

p {
    color: white;
    margin: 15px 50px;
    text-align: center;
    line-height: 1.5;
}

ol {
    list-style-type: none;
}

li {
    margin: 5px 0;
    padding-left: 0;
}


/* LOGO */

#holder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#logo {
    text-align: center;
    width: 70%;
    height: auto;
    min-width: 320px;
    margin-bottom: 60px;
}

#logo img {
    width: 100%;
    max-width: 1200px;
    object-fit: contain;
}

#introduction {
    text-align: center;
    color: white;
    margin: 0 10px 30px 10px;
}


/* PROGRESS DISPLAY */
#progress-display {
    width: 100%;
    margin-bottom: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
}

#sheep-remaining, #sheep-remaining-text {
    font-weight: bolder;
    font-size: 2rem;
}

#progress-display button {
    color: black;
    background-color: white;
    padding: 0;
    font-size: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

#progress-display button:hover {
    color: white;
    background-color: black;
}

#instructions-top-button {
    left: 50px;
}

#settings-top-button {
   right: 50px;
}


/* GAME.HTML */

/* Page container which center aligns its children and prevents the game area
   from growing to the point where it overflows the vertical space */
#game-ui {
    margin: 0 auto;
    max-width: 450px;
    width: 100%;
    height: 100%;
    text-align: center;
}

#button-panel {
    text-align: center;
}

#button-panel a {
    font-size: clamp(16px, 4vw, 35px);
    margin: 0 5px;
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    background-color: #ffffff33;
    border-radius: 10px;
    border: 1px solid white;
}

#button-panel a:hover {
    color: #174211;
    background-color: #ffffff66;
}

/* Dims the gameplay area while end of level controls are displayed */
#dimmer-mask {
    pointer-events: none;
    opacity: 0.5;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    transition: opacity 1s ease;
}

#displays {
    padding-top: 40px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

#main-display {
    position: relative;
}

/* The main game canvas, where the game characters (dog and sheep) are displayed */
#game-area {
    left: 0;
    top: 0;
    width: 95%;
    height: auto;
    aspect-ratio: 4 / 5;
    background-color: green;
    box-sizing: border-box;
    position: relative;
}

/* This media query compresses the height of the game area canvas on mobile 
   devices with unusually short screen height */
@media screen and (max-height: 640px) {
    #displays {
        padding-top: 10px;
    }

    #game-area {
        width: 90%;
    }
}

/* End of level display styling */
#end-of-level-display {
    position: absolute;
    background-color: transparent;
    top: 0;
    margin-top: 100px;
    left: 0;
    right: 0;
    color: #facc20;
    font-size: 2rem;
    z-index: 5;
}

#end-level-message {
    text-align: center;
    text-shadow: 0 0 100px #917513;
}

/* These buttons are hidden at page load, and set to display by javascript when needed */
#action-replay-button, 
#try-again-button, 
#begin-again-button, 
#next-level-button, 
#game-complete-button {
    display: none;
}

#controls {
    width: 100%;
    box-sizing: border-box;
}

#time-display {
    width: 100%;
    text-align: center;
}
#time-remaining[value] {
    --color: #facc42; /* the progress color */
    --background: #333333; /* the background color */
  
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    width: 80%;
    height: 39px;
    margin: 10px auto 10px auto;
    border-radius: 20px;
    background: var(--background);
}

#time-remaining[value]::-webkit-progress-bar {
    border-radius: 20px;
    background: var(--background);
}

#time-remaining[value]::-webkit-progress-value {
    border-radius: 20px;
    background: var(--color);
}

#time-remaining[value]::-moz-progress-bar {
    border-radius: 20px;
    background: var(--color);
}

#play {
    display: none;
}

.fa-pause, .fa-play {
    font-size: 1.5rem;
}

/* Action Replay elements styling */
.replay-button {
    font-size: 1rem;
}

#action-replay-display {
    display: none;
}

#replay-banner {
    position: absolute;
    left: 20px;
    top: 10px;
    display: none;
}

#replay-time {
    position: absolute;
    font-family: monospace;
    font-weight: bolder;
    right: 35px;
    top: 20px;
    color: #facc20;
    background-color: transparent;
    display: none;
}


/* INSTRUCTIONS MODAL */

/* This modal class is used by both the settings and instructions displays */
.modal {
    display: none;
    background-image: linear-gradient(#24631b, #174211);
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

#instructions-holder {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 750px;
    margin: 30px auto;
    padding: 20px;
    max-width: 1000px;
    background-color: #00000022;
    border-radius: 20px;
}

#instructions-logo {
    max-height: 10vh;
}

/* Places the gameplay video and movement instructions side by side */
#columns {
    max-width: 100%;
    margin: 0 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
}

#movement-instructions {
    max-width: 100%;
    margin-left: 20px;
}

#instruction-video {
    max-width: 100%;
    height: auto;
    margin-right: 20px;
}

#close-instructions-button {
    position: absolute;
    top: 20px;
    right: 20px;
}


@media screen and (max-width: 768px) {
    p {
        font-size: 0.8rem;
        margin: 10px 30px;
    }

    ol, li {
        font-size: 0.7rem;
        padding-left: 0;
    }

    h1 {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 0.8rem;
    }
    
    h3 {
        font-size: 0.8rem;
    }

    #start-game {
        font-size: 1rem;
    }
}


/* SETTINGS MODAL */
#settings-modal {
    text-align: center;
    padding-top: 20px;
}

#settings {
    position: relative;
    margin: 30px auto;
    padding: 20px;
    max-width: 800px;
    background-color: #00000022;
    border-radius: 20px;
}

.slider-container {
    display: grid;
    grid-column-gap: 10px;
    grid-row-gap: 25px;
    grid-template-columns: 1fr 4fr 1fr;
    margin-top: 30px;
}

.slider-container img {
    width: 100%;
    height: 100%;
    padding: 25%;
    object-fit: contain;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
}

.settings-element {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.settings-slider {
    width: 100%;
    background-color: silver;
    color:#facc20;
    margin-top: 10px;
}

#close-settings-button {
    position: absolute;
    top: 20px;
    right: 20px;
}
