/* CSS for Tic-Tac-Toe game, loaded after skeleton boilerplate files 'normalize.css'
    and 'skeleton-mod.css' */

:root {
    --play-btn-play: green;
    --play-btn-reset: black;
    --player-color-1: blue;
    --player-color-2: red;
    --selected-text: white;
}
@font-face {
    font-family: 'bungee-regular';
    src: url('bungee-regular-webfont.woff2') format('woff2'),
         url('bungee-regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}


/* Basic layout -------------------------------------------------------------*/
/* centers everything up */
main {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}
/* 'Tic-Tac-Toe' header */
h1 {
    font-family: 'bungee-regular', sans-serif;
    font-size: 4rem;
    letter-spacing: normal;   /* override skeleton */
    line-height: 1.1;
    margin-bottom: .3rem;
}
/* Colors for 'X Wins!' and 'O Wins!' */
.header .X {
    color: var(--player-color-1);
}
.header .O {
    color: var(--player-color-2);
}

/* Controls -------------------------- */
p {
    margin: 0;   /* override skeleton */
}
.player-name {
    font-size: 3rem;
    margin-bottom: .05rem;
}
.memo {
    margin-top: 0;
    font-size: 2rem;
    margin-bottom: .1rem;
}
.control-con .controls:first-of-type .player-name {  /* just player 1's name */
    color: var(--player-color-1);
}
.control-con .controls:last-of-type .player-name {  /* just player 2's name */
    color: var(--player-color-2);
}

/* Buttons ------------------- */
button {
    text-transform: none ;  /* undoes skeleton uppercase transform */
    margin-bottom: .7rem;   /* override skeleton */
    font-size: 1.8rem;
    border: 2px solid black;
}
/* overrides skeleton's hover/focus border color change */
button:hover, button:focus {
    border: 2px solid black;
}
/* gets rid of 'hand' cursor when disabled or selected */
button[disabled], button[value="selected"] {
    cursor: default;
}

/* Play Game button ------ */
#play-btn, #play-btn:hover {   /* using id for the play button b/c there's just one */
    font-size: 2.3rem;
    height: 44px;
    padding: 0 50px;
    color: var(--play-btn-play);
    border-color: var(--play-btn-play);
}
/* use 'reset' color during game */
#play-btn[value="game-in-progress"], #play-btn:hover[value="game-in-progress"] {
    color: var(--play-btn-reset);
    border-color: var(--play-btn-reset);
}

/* player 1's buttons */
.control-con .controls:first-of-type button {
    color: var(--player-color-1);
}

/* player 2's buttons */
.control-con .controls:last-of-type button {
    color: var(--player-color-2);
}

/* player 1's buttons - colors when selected */
.control-con .controls:first-of-type button[value="selected"] {
    color: var(--selected-text);
    background-color: var(--player-color-1);
    border-color: var(--player-color-1);
}

/* player 2's buttons - colors when selected */
.control-con .controls:last-of-type button[value="selected"] {
    color: var(--selected-text);
    background-color: var(--player-color-2);
    border-color: var(--player-color-2);
}

/* Type of player buttons ---- */
.type-btn, .type-btn:hover {
    height: 40px;
    width: 140px;
    padding: 0;     /* undoes skeleton padding */
}

/* gets rid of "whitespace-only-text-node" between type of player buttons */
.two-buttons-con {
    display: flex;
    justify-content: center;
}

/* both "Human" buttons */
.two-buttons-con .type-btn:first-of-type {
    border-radius: 4px 0px 0px 4px;
}

/* both "Computer" buttons */
.two-buttons-con .type-btn:last-of-type {
    border-radius: 0px 4px 4px 0px;
}

/* Drunk mode status buttons --- */
.drunk-btn, .drunk-btn:hover {
    font-size: 1.5rem;
    height: 30px;
    width: 190px;
    padding: 0;             /* undoes skeleton padding */
    line-height: normal;    /* undoes skeleton line-height */
}

.drunk-btn[value="not-applicable"] {      /* hides drunk mode button when it's a human player */
    visibility: hidden;
}

.drunk-btn[value="selected"] {  /* restores 'hand' cursor for drunk mode buttons even when selected */
    cursor: pointer;
}
.drunk-btn[disabled] {      /* ...and then gets rid of it again when selected but also disabled */
    cursor: default;
}


/* Board -------------------------------------------------*/
.board-img-and-grid-con {   /* container for other two containers - for absolute positioning stuff */
    margin-top: 10px;
    position: relative;     /* creates new positioning context to contain 'absolute' child elements */
    min-width: 300px;       /* keeps board from shrinking more than X's and O's */
}

.board-img-con {        /* absolute positioning to overlay board image on same space as grid */
    position: absolute;
    left: 0;            /* left and right = 0 (top/bottom default is auto) basically sets image size to 100% for absolute positioning */
    right: 0;
    z-index: -1;        /* moves board graphic to bottom so board spaces are clickable */
}

.board-grid-con {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    column-gap: 3%;      /* gaps set to overlay grid onto board image */
    row-gap: 1.7%;
}

img {   
    width: 100%;    /* sets 'space' images to match width of div */
}

/* Responsive layout (larger than phone) ------------------------------------
    makes header bigger */
@media (min-width: 400px) {
    h1 {
        font-size: 5rem;
    }

}

/* Responsive layout (larger than "phablet") ------------------------------------
    makes header bigger, puts buttons in flexboxes, and adds whitespace on sides
    of board */
@media (min-width: 550px) {
    h1 {
        font-size: 7rem;
    }
    .control-con {
        display: flex;
        justify-content: space-around;
    }
    .control-con > * {
        flex: 1;
    }
    .board-img-and-grid-con {
        margin-left: 15%;
        margin-right: 15%;
    }
}

/* even bigger ---------------------------------------------------------------- */
/* Keeps making 'Tic-Tac-Toe' header bigger */
@media (min-width: 600px) {
    h1 {
        font-size: 8rem;
    }
}
@media (min-width: 700px) {
    h1 {
        font-size: 9rem;
    }
}
@media (min-width: 730px) {
    h1 {
        font-size: 10rem;
    }
}
@media (min-width: 780px) {
    h1 {
        font-size: 11rem;
    }
}