/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
* {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Add accessible line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

/*
  11. Reset all button styles
*/

button {
  all: unset;
  cursor: pointer; /* Restore cursor for usability */
}

button:focus {
  outline: blue 1px auto; /* Add focus outline for accessibility */
}

@font-face {
  font-family: "Outfit";
  src: url("./assets/Outfit-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
}

:root {
  /*Color Swatches*/
  --color-light-blue: #31c3bd;
  --color-light-blue-hover: #65e9e4;
  --color-light-yellow: #f2b137;
  --color-light-yellow-hover: #ffc860;
  --color-dark-navy: #1a2a33;
  --color-semi-dark-navy: #1f3641;
  --color-silver: #a8bfc9;
  --color-silver-hover: #dbe8ed;
}

body {
  font-family: Outfit;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.05469rem;
  color: var(--color-silver, #a8bfc9);
  background: var(--color-dark-navy, #1a2a33);
}

.game-main {
  position: relative;
  padding: 0rem 1.5rem;
}

/* Font Styles */
.heading__large,
.heading__medium,
.heading__small,
.heading__xsmall {
  font-weight: 700;
  text-transform: uppercase;
}
.heading__large {
  font-size: 2.5rem;
  letter-spacing: 0.15625rem;
}
.heading__medium {
  font-size: 1.5rem;
  letter-spacing: 0.09375rem;
}
.heading__small {
  font-size: 1.25rem;
  letter-spacing: 0.07813rem;
}
.heading__xsmall {
  font-size: 1rem;
  letter-spacing: 0.0625rem;
}

/* Button Styles */

.button {
  color: var(--color-dark-navy, #1a2a33);
  display: inline-block;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.07813rem;
  text-transform: uppercase;
  padding-top: 1rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 1.5rem;
  border-radius: 0.9375rem;
  transition: background-color ease 0.3s;
}

.button.button__small {
  font-size: 1rem;
  border-radius: 0.625rem;
  letter-spacing: 0.0625rem;
  padding-top: 0.9rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 1.1rem;
}

.button.button__square {
  padding: 1rem;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.button svg {
  height: 1.25rem;
  width: 1.25rem;
}

.button.button__yellow {
  background-color: var(--color-light-yellow, #f2b137);
  box-shadow: 0 -8px 0 0 #cc8b13 inset;
}
.button.button__yellow.button__small {
  box-shadow: 0 -4px 0 0 #cc8b13 inset;
}

.button.button__blue {
  background-color: var(--color-light-blue, #31c3bd);
  box-shadow: 0 -8px 0 0 #118c87 inset;
}

.button.button__silver {
  background-color: var(--color-silver, #a8bfc9);
  box-shadow: 0 -8px 0 0 #6b8997 inset;
}

.button.button__silver.button__small {
  box-shadow: 0 -4px 0 0 #6b8997 inset;
}

@media (hover: hover) {
  .button.button__yellow:hover {
    background-color: var(--color-light-yellow-hover, #ffc860);
  }
  .button.button__blue:hover {
    background-color: var(--color-light-blue-hover, #65e9e4);
  }
  .button.button__silver:hover {
    background-color: var(--color-silver-hover, #dbe8ed);
  }
}

.game-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  row-gap: 2.5rem;
  margin: 0 auto;
  max-width: 28.75rem;
  height: 100svh;
}

.game-menu__options {
  border-radius: 0.9375rem;
  background-color: var(--color-semi-dark-navy);
  box-shadow: 0 -8px 0 0 #10212a inset;
  padding: 1.5rem 1.5rem 1.87rem 1.5rem;
  width: 100%;
  text-align: center;
}

.option-text {
  font-weight: 700;
  text-transform: uppercase;
}

.option-buttons {
  display: flex;
  padding: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
  background-color: var(--color-dark-navy);
  border-radius: 0.625rem;
}

.option-button {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0;
  border-radius: 0.625rem;
}

.option-button.is--active {
  background-color: var(--color-silver);
  color: var(--color-dark-navy);
  pointer-events: none;
}

@media (hover: hover) {
  .option-button:not(.is--active):hover {
    background-color: #21313b;
  }
}

.option-button__icon {
  width: 2rem;
  height: 2rem;
}

.game-menu__buttons {
  display: flex;
  flex-direction: column;
  row-gap: 1.25rem;
  width: 100%;
}

.option-help-text {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05469rem;
}

.game-board {
  height: 100svh;
  margin: 0 auto;
  max-width: 28.75rem;
  display: none;
  flex-direction: column;
  justify-content: center;
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  position: relative;
}

.game-logo {
  display: flex;
  column-gap: 0.5rem;
}

.game-logo__icon {
  max-width: 2rem;
  max-height: 2rem;
}

.turn-tracker {
  display: flex;
  align-items: center;
  column-gap: 0.8rem;
  padding: 0.81rem 1.85rem 1.1rem 1.85rem;
  background-color: var(--color-semi-dark-navy);
  box-shadow: 0 -4px 0 0 #10212a inset;
  border-radius: 0.625rem;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.turn-tracker__icon {
  display: none;
  width: 1.25rem;
  height: 1.25rem;
}

.turn-tracker__icon.is--active {
  display: block;
}

.turn-tracker__text {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}

/* Tic Tac Toe Square */
.squares-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.square {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background-color: var(--color-semi-dark-navy, #6b8997);
  box-shadow: 0 -8px 0 0 #10212a inset;
  border-radius: 0.9375rem;
  aspect-ratio: 1/1;
}

.square.is--selected-x,
.square.is--selected-o {
  pointer-events: none;
}

.square.is--selected-x .square__icon.square__icon--x,
.square.is--selected-o .square__icon.square__icon--o {
  display: block;
}

@media (hover: hover) {
  [data-current-player="x"]
    .square:hover
    .square__icon.square__icon--x-outline {
    display: block;
  }

  [data-current-player="o"]
    .square:hover
    .square__icon.square__icon--o-outline {
    display: block;
  }
}

.square__icon {
  display: none;
  width: 45%;
  height: 45%;
}

.score-board {
  display: flex;
  column-gap: 1.25rem;
}
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  padding: 0.8rem;
  border-radius: 0.9375rem;
}

.score-card--x {
  background-color: var(--color-light-blue);
  color: var(--color-dark-navy);
}

.score-card--ties {
  background-color: var(--color-silver);
  color: var(--color-dark-navy);
}

.score-card--o {
  background-color: var(--color-light-yellow);
  color: var(--color-dark-navy);
}

.score-card__title {
  font-size: 0.875rem;
  letter-spacing: 0.05469rem;
  text-transform: uppercase;
}

.game-overlay {
  width: 100%;
  height: 100svh;
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
}

.game-overlay__background {
  background: black;
  opacity: 50%;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.overlay__banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.8rem;
  position: relative;
  background-color: var(--color-dark-navy);
}

.overlay__text {
  letter-spacing: 0.0625rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.overlay__status-wrap {
  display: flex;
  align-items: center;
  column-gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.status__icon {
  height: 4rem;
  width: 4rem;
}

@media screen and (max-width: 30rem) {
  .button {
    font-size: 1rem;
  }

  .game-top {
    margin-bottom: 4rem;
  }

  .game-board {
    justify-content: start;
  }

  .square {
    border-radius: 0.625rem;
  }

  .heading__large {
    font-size: 1.5rem;
  }

  .overlay__status-wrap {
    column-gap: 0.75rem;
  }

  .status__icon {
    width: 1.875rem;
    height: 1.875rem;
  }

  .game-top {
    margin-top: 1.5rem;
  }
}
