:root {
    --gamebackground: #F7F4E8;
    /* --cell-light: #f0e1c6;
    --cell-light-shadow: #e0cba3; */
    --cell-light: #F2E2C4;
    --cell-light-shadow: #EAD09F;

    --cell-light-highlight: #8bc4d9;
    --cell-light-highlight-shadow: #3ea3c2;

    /* --cell-dark: #EDDAB7; */
    --cell-dark: #EED7AF;
    /* --cell-dark-shadow: #d7c29b; */
    --cell-dark-shadow: #E7C78F;

    --cell-dark-highlight: #4a99ce;
    --cell-dark-highlight-shadow: #2695bd;

    --cell-capture: 12, 167, 131;
    --cell-capture-shadow: #099268;

    --shadow-color: 39deg 34% 42%;

    /* font styles */
    --display-type: 'Redaction', serif;
    --copy-type: system-ui, sans-serif;




    --textColor: #392e25;
    --menuBackground: #193540;
    --menuSkrimColor: #101F26f0;
    --menuTextColor: #E4D7AA;
}


@font-face {
  font-family: 'Redaction';
  src: url('./assets/fonts/Redaction-Regular.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Redaction';
  src: url('./assets/fonts/Redaction-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: auto;
}

html {
    background: var(--gamebackground);
    color: var(--textColor);
    overflow-x: hidden;
    height: 100%;
}
header.navigation {
  display: flex;
  align-items: center;
  gap: .5rem;
  position: absolute;
  top: 1rem;
  right: 2rem;
} 

.no_overflow {
  overflow: hidden;
}

body {
	background-color: var(--gamebackground);
	position: relative;
    display: flex;
	flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    height: 100%;
    width: 100%;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
#game_board, #shadow_board {
	display: grid;
	grid-template-columns: repeat(var(--grid_columns), 80px);
	grid-template-rows: repeat(var(--grid_rows), 70px);
	margin: 10dvh auto;
	width: min-content;
	max-width: 80dvw;
  grid-column: 1;
  grid-row: 1;
}
#game_board {
  z-index: 1;
}
#shadow_board {
  position: relative;
  mix-blend-mode: darken;
  opacity: 0;
}
.dropShadow {
  position: relative;
  pointer-events: none;
  transform: scaleX(-1);
}
.dropShadow::after {
    position: absolute;
    width: 140%;
    height: 400%;
    background: linear-gradient(140deg, #d8caa4 0%, #F7F4E8 70%, transparent 100%);
    content: '';
    right: 0;
    top: 0;
    bottom: 0;
    left: 0;
    transform-origin: 0 0;
    transform: rotateZ(45deg) translateX(3px) translateY(2px);
    filter: blur(5px);
}

main {
  display: grid;
}


.buttonGroup {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}



.chess_cell {
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	opacity: 0;
	will-change: transform;
  }
  
  .chess_cell[data-material="blank"]::after {
    box-shadow: none !important;
    background: none !important;
  }



  .chess_cell:nth-child(even) {
	background: var(--cell-light);
	box-shadow: 0px 10px 0px var(--cell-light-shadow);
  }

  .chess_cell:nth-child(odd) {
	background: var(--cell-dark);
	box-shadow: 0px 10px 0px var(--cell-dark-shadow);
  }

  .chess_cell[data-y="1"]:nth-child(even), .chess_cell[data-y="3"]:nth-child(even),
  .chess_cell[data-y="5"]:nth-child(even), .chess_cell[data-y="7"]:nth-child(even){
    background: var(--cell-dark);
	  box-shadow: 0px 10px 0px var(--cell-dark-shadow);
  }
  .chess_cell[data-y="1"]:nth-child(odd), .chess_cell[data-y="3"]:nth-child(odd),
  .chess_cell[data-y="5"]:nth-child(odd), .chess_cell[data-y="7"]:nth-child(odd){
    background: var(--cell-light);
	  box-shadow: 0px 10px 0px var(--cell-light-shadow);
  }
  /* check for odd column game_board and change the cell color */
  #game_board[data-columns="3"] .chess_cell[data-y="1"]:nth-child(even),
  #game_board[data-columns="3"] .chess_cell[data-y="3"]:nth-child(even),
  #game_board[data-columns="3"] .chess_cell[data-y="5"]:nth-child(even),
  #game_board[data-columns="3"] .chess_cell[data-y="7"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="1"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="3"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="5"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="7"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="1"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="3"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="5"]:nth-child(even),
  #game_board[data-columns="5"] .chess_cell[data-y="7"]:nth-child(even) {
    background: var(--cell-light);
	  box-shadow: 0px 10px 0px var(--cell-light-shadow);
  }
  #game_board[data-columns="3"] .chess_cell[data-y="1"]:nth-child(odd),
  #game_board[data-columns="3"] .chess_cell[data-y="3"]:nth-child(odd),
  #game_board[data-columns="3"] .chess_cell[data-y="5"]:nth-child(odd),
  #game_board[data-columns="3"] .chess_cell[data-y="7"]:nth-child(odd),
  #game_board[data-columns="5"] .chess_cell[data-y="1"]:nth-child(odd),
  #game_board[data-columns="5"] .chess_cell[data-y="3"]:nth-child(odd),
  #game_board[data-columns="5"] .chess_cell[data-y="5"]:nth-child(odd),
  #game_board[data-columns="5"] .chess_cell[data-y="7"]:nth-child(odd),
  #game_board[data-columns="7"] .chess_cell[data-y="1"]:nth-child(odd),
  #game_board[data-columns="7"] .chess_cell[data-y="3"]:nth-child(odd),
  #game_board[data-columns="7"] .chess_cell[data-y="5"]:nth-child(odd),
  #game_board[data-columns="7"] .chess_cell[data-y="7"]:nth-child(odd) {
    background: var(--cell-dark);
	  box-shadow: 0px 10px 0px var(--cell-dark-shadow);
  }


  .chess_cell[data-state="highlight"]::before {
    content: "";
    width: 70%;
    height: 70%;
    position: absolute;
    transform: translateY(5px);
    background: rgba(var(--cell-capture), .4);
    /* border: 1px solid rgba(0, 0, 0, .10); */
    border-radius: 3px;
    animation: scaleUp 2s ease-in-out infinite alternate;
  }

.chess_cell[data-material="blank"] {
	background: transparent !important;
	box-shadow: none !important;
}
.chess_cell[data-state="selected"], .chess_cell[data-state="capture"] {
	background-color: rgba(var(--cell-capture), 1) !important;
	box-shadow: 0px 10px 0px var(--cell-capture-shadow) !important;
	color: var(--cell-light);
	position: relative;
}
.chess_cell[data-state="selected"]:before {
	background-image: url("./assets/material/selectionRing.svg");
  background-color: rgba(255, 255, 255, .2);
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	content: "";
	width: 80%;
	height: 80%;
	position: absolute;
	animation: scaleUp 2s ease-in-out infinite alternate;
}


.chess_piece {
	pointer-events: none;
	opacity: 0;
	transform: translateY(-3rem);
  	height: 110%;
  	width: 110%;
	background-position: center center;
	background-size: contain;
	background-repeat: no-repeat;
}


.chess_cell[data-material="king"] .chess_piece {
	background: url("./assets/material/kings-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
}
.chess_cell[data-material="queen"] .chess_piece {
	background: url("./assets/material/queen-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
}
.chess_cell[data-material="bishop"] .chess_piece {
	background: url("./assets/material/bishop-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
}
.chess_cell[data-material="knight"] .chess_piece {
	background: url("./assets/material/knight-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
}
.chess_cell[data-material="rook"] .chess_piece {
	background: url("./assets/material/rook-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
}
.chess_cell[data-material="pawn"] .chess_piece {
	background: url("./assets/material/pawn-black.svg");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
} 



h1, h1#levelName {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--display-type);
  margin-bottom: 0;
  letter-spacing: 1px;
}


#levelText {
  font-family: var(--display-type);
    font-size: 16px;
    max-width: 325px;
    text-align: center;
    line-height: 1.75;
    transition: all ease 250ms;
}

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.buttonRow {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

button { 
    cursor: pointer;
    border: 0;
    background-color: var(--cell-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
}

a.button {
  display: inline-block;
  margin: 4rem auto;
  text-decoration: none;
  padding: 1rem 2rem;
  max-width: 350px;
  font-size: initial;
  font-family: var(--display-type);
  letter-spacing: 1px;
  font-weight: 600;
  background: var(--menuSkrimColor);
  color: var(--gamebackground) !important;
  border: 2px solid var(--gamebackground);
  outline: 3px solid var(--menuSkrimColor);
  cursor: pointer;
}

.ghost {
  background: transparent;
}
.buttonRound {
  display: flex;
  /* align-items: center; */
  justify-content: center;
  background: var(--textColor);
  border-radius: 50%;
  height: 48px;
  width: 48px;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
  transform-origin: center;
}
.buttonRound small {
  position: absolute;
  font-family: var(--display-type);
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 16px;
  bottom: -2rem;
  color: var(--textColor);
  transform: translatey(.5rem);
  opacity: 0;
  transition: all .2s ease;
}
.buttonRound:hover small {
  position: absolute;
  opacity: .9;
  font-size: 16px;
  color: var(--textColor);
  transform: translatey(0);
}
.buttonRound svg {
  transition: transform .2s ease;
  transform-origin: center;
}
.buttonRound:hover {
  transform: scale(1.05);
  filter: brightness(1.5) hue-rotate(60deg);

}
.buttonRound:active {
  transform: scale(.95);
}
#undo:active svg {
  transform: translateX(-3px);
}
#restart:active svg {
  transform: rotate(-30deg);
}

button svg {
  padding: 0;
}

.version_number {
  text-align: center;
}
.version_number p {
  margin-bottom: .5rem;
}
small {
  color: var(--gamebackground);
  font-style: var(--copy-type);
}





/* settings modal */

#menu {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  width: 100%;
  background: var(--menuSkrimColor);
  /* backdrop-filter: blur(4px); */
  opacity: 0;
  visibility: hidden;
  transition: all ease-in-out 500ms;
  z-index: 10;
}

#menu.showMenu {
  visibility: visible;
  opacity: 1;
  backdrop-filter: blur(4px);
}
#menu.showMenu #settingsMenu {
  opacity: 1;
  transform: translateY(0);
}
#menu.showMenu #settingsMenu #closeMenu {
  opacity: 1;
}

#closeButton {
  position: fixed;
  top: 40px;
  left: 20px;
  z-index: 10;
  height: 40px;
  width: 40px;
  transform: rotate(45deg);
  background: var(--menuSkrimColor);
  border: 2px solid var(--gamebackground);
  outline: 3px solid var(--menuSkrimColor);
  transition-delay: 200ms;
  transition: opacity ease 150ms;
  display: flex;
  align-items: center;
  justify-content: center;
}
#closeButton:before {
  background: var(--cell-dark);
  /* filter: url(#turbulence); */
}
#closeButton:active {
  animation: diamondBounce 0.4s linear forwards 0.2s;
}

.menuTitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  color: var(--cell-dark);
}
.menuTitle:has(h1) {
  color: var(--textColor);
  margin-bottom: 0;
}
.menuTitle svg {
  width: 24px;
}
.menuTitle h2, h1 {
  font-size: 24px;
}

#settingsMenu{
  color: var(--cell-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 4rem;
  position: relative;
  box-sizing: border-box;
  width: 80dvw;
  max-width: 300px;
  height: fit-content;
  background: transparent;
  border: 0;
  font-size: 20px;
  opacity: 0;
  transform: translateY(100px);
  transition-delay: 50ms;
  transition: all ease-in-out 300ms;
}
#closeMenu {
  position: absolute;
  bottom: -64px;
  z-index: 10;
  height: 40px;
  width: 40px;
  transform: rotate(45deg);
  background: var(--menuTextColor);
  border: 2px solid var(--menuSkrimColor);
  outline: 3px solid var(--menuTextColor);
  opacity: 0;
  transition-delay: 200ms;
  transition: opacity ease 150ms;
}
#closeMenu:before {
  background: var(--cell-dark);
  /* filter: url(#turbulence); */
}
#closeMenu:active {
  animation: diamondBounce 0.4s linear forwards 0.2s;
}

#settingMenu > div {
  z-index: 10;
}
#saveFile, #deleteSave, a.menubutton {
  height: 40px;
  width: 100%;
  font-size: initial;
  font-family: initial;
  font-weight: 600;
  color: var(--menuBackground);
  border: 2px solid var(--menuBackground);
  outline: 3px solid var(--cell-dark);
}
a.menubutton {
  background: var(--cell-dark);
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}
#settingsMenu>div{
  padding: .5rem;
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  z-index: 10;
  
}

#settingsMenu:before{
  content: '';
  position: absolute;
  left: 1rem;
  top: 1rem;
  bottom: 1rem;
  right: 1rem;
  background: var(--menuBackground);
  /* filter: url(#turbulence); */
}

#settingsMenu:after{
  content: '';
  position: absolute;
  z-index: 1;
  left: 0;
  top:0;
  bottom:0;
  right:0;
  background: transparent;
  /* filter: url(#turbulence); */
  border: 2rem solid #eee;
    border-image: url("./assets/ui/boxFrame.svg") 24;
}
button#settings {
  padding: 0;
}

.subMenu {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  font-family: var(--display-type);
}
.menuItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menuItem p {
  margin: 0;
}


.hide {
  display: none;
  visibility: hidden;
  opacity: 0;
  transition: all 300ms ease-in-out;
}



/* checkbox */

.checkbox {
  --background: var(--menuSkrimColor);
  --border: var(--cell-dark);
  --border-hover: #BBC1E1;
  --border-active: var(--cell-dark);
  --tick: var(--menuBackground);
  position: relative;
}
.checkbox input, .checkbox svg {
  width: 21px;
  height: 21px;
  display: block;
}
.checkbox input {
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
  outline: none;
  background: var(--background);
  border: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 2px;
  transition: box-shadow 0.3s;
  box-shadow: inset 0 0 0 var(--s, 1px) var(--b, var(--border));
  transform: rotate(45deg);
}
.checkbox input:hover {
  --s: 2px;
  --b: var(--border-hover);
}
.checkbox input:checked {
  --b: var(--border-active);
}
.checkbox svg {
  pointer-events: none;
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: var(--stroke, var(--border-active));
  position: absolute;
  top: 0;
  left: 0;
  width: 21px;
  height: 21px;
  transform: scale(var(--scale, 1)) translateZ(0);
}
.checkbox.path input:checked {
  --s: 2px;
  transition-delay: 0.4s;
}
.checkbox.path input:checked + svg {
  --a: 16.1 86.12;
  --o: 102.22;
}
.checkbox.path svg {
  stroke-dasharray: var(--a, 86.12);
  stroke-dashoffset: var(--o, 86.12);
  transition: stroke-dasharray 0.6s, stroke-dashoffset 0.6s;
}
.checkbox.bounce {
  --stroke: var(--tick);
}
.checkbox.bounce input:checked {
  --s: 11px;
}
.checkbox.bounce input:checked + svg {
  animation: bounce 0.4s linear forwards 0.2s;
}
.checkbox.bounce svg {
  --scale: 0;
}

@keyframes scaleUp {
	0% {
		transform: scale(1)
	}
	100% {
		transform: scale(1.09);
	}
}
@keyframes bounce {
  50% {
    transform: scale(1.2);
  }
  75% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes diamondBounce {
  50% {
    transform: scale(1.2) rotate(45deg);
  }
  75% {
    transform: scale(0.9) rotate(45deg);
  }
  100% {
    transform: scale(1) rotate(45deg);
  }
}
.no_flex {
  display: block;
}

.article {
  margin: auto;
  margin-top: 3rem;
  padding: 4rem;
  max-width: 75ch;
}

.article a {
  color: var(--cell-capture-shadow);
  font-weight: 600;
}
.article h1, .article h2 {
  margin-top: 3rem;
}
.article p{
  font-size: 1.1rem;
  font-family: var(--copy-type);
  margin-bottom: 0;
  line-height: 1.5;
  opacity: .85;
}
.article p + p {
  margin-top: 0.75rem;
}

@media (max-width: 400px) {
	#game_board, #shadow_board {
		grid-template-columns: repeat(var(--grid_columns), 16dvw);
		grid-template-rows: repeat(var(--grid_rows), 14dvw);
		margin: 10dvh 0,
	}
}

@media only screen 
  and (max-device-height: 414px) 
  and (orientation: landscape) { 
  header.navigation {
    flex-direction: column;
  }
  body {
    align-items: center;
  }
  #controls {
    width: 100%;
  }
  #controls, #game_board, #shadow_board {
    margin: 3dvh;
  }
  #levelText {
    margin: 0;
    width: 100%;
    max-width: 600px;
  }
  .gameBody {
    gap: .5rem;
    align-items: start;
    justify-content: start;
    height: 100dvh;
  }
  h1#levelName {
    font-size: 32px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .buttonRound:hover {
    filter: none;
  }
  .buttonRound:hover small {
    position: absolute;
    opacity: 0;
    font-size: 16px;
    color: var(--textColor);
    transform: none;
  }
}