/* ========================================================================== */
/* Normalization */
/* ========================================================================== */

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

body {
  line-height: 1.5; /* Accessibile line height */
  -webkit-font-smoothing: antialiased; /* Improve text rendering on macOS */
}

p, 
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word; /* Avoid interfere with layout (e.g. scrollbar) */
}

input, button {
  font: inherit;
}

/* ========================================================================== */
/* Main styling starts here */
/* ========================================================================== */


html {
  height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;

  --major-btn-height: 3rem;
  --primary-gap-size: 1.5rem;
  --grid-size: min(40vw, 25rem); /* allows grid enlarging until 40vw exceeds 25rem (via expanding the viewport width OR zooming in) */
  --grid-gap-size: min(1.5vw, 1rem); /* allows grid enlarging until 1.5vw exceeds 1rem (via expanding the viewport width OR zooming in) */

  --palette-dark-gray: #636363; 
  --palette-light-gray: #E2E8F0; 
}

body {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr 5fr;
}

/* ========================================================================== */


header {
  padding: var(--primary-gap-size);
  display: grid;
  grid-template-rows: repeat(2, min-content);
  gap: 40px;
  justify-items: center;

  background-color: brown;
  background-image: url(assets/header-background.jpg);
  background-position: center;
  background-size: cover;

  color: white;
}

h1 {
  font-size: 2rem;
  text-shadow: 1px 1px 40px white; 
  text-align: center;
}

.major-btn {
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 1.15rem;
  color: white;

  width: 100%; /* ensures both Play & Restart buttons are the same size */
  min-width: max-content; /* prevent text reflows on smaller windows */
  height: var(--major-btn-height);
  padding: 8px 16px;
  border: none;
  border-radius: calc(var(--major-btn-height) / 2);
  box-shadow: 3px 3px 10px var(--palette-light-gray);
  -webkit-box-shadow: 3px 3px 10px var(--palette-light-gray);
  background-color: #FFA30F;
}
.major-btn:hover {
  filter: saturate(250%);
}
.major-btn:active {
  outline: 2px solid white;
  outline-offset: 3px;
  filter: revert;
}

#restart-game {
  display: none;
}

/* ========================================================================== */

dialog {
  margin: auto;
  position: relative;
  border: none;
  padding: 40px;
  min-width: 25%;
  border-radius: 20px;
  box-shadow: 0px 2px 11px -3px var(--palette-dark-gray);
  -webkit-box-shadow: 0px 2px 11px -3px var(--palette-dark-gray);
}
::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

dialog form {
  display: grid;
  gap: var(--primary-gap-size);
}

input {
  margin: 0 12px;
  height: 2rem;
  padding: 8px;
  border: 1px solid var(--palette-dark-gray);
  font-size: 1rem;
  letter-spacing: 1px;
}
input[type=text]:focus {
  outline: 1px solid black;
}

.dialog-btns-container {
  display: flex;
  gap: var(--primary-gap-size);
  justify-content: center;
}

.dialog-btns-container button {
  cursor: pointer;
  display: inline-block;
  width: 40%;
  background-color: #FFA30F;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 0;
}
.dialog-btns-container button:hover {
  filter: saturate(250%);
}
.dialog-btns-container button:active {
  outline: 2px solid var(--palette-dark-gray);
  outline-offset: 2px;
  filter: revert;
}

#results-dialog article {
  display: grid;
  gap: var(--primary-gap-size);
}

/* ========================================================================== */
#main-container {
  background-image: url(assets/main-background.jpg); 
  background-size: cover;
  display: flex;
  justify-content: center;
}

main {
  padding: var(--primary-gap-size);
  height: 100%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--primary-gap-size);
  
  color: white;
}

#ttt-grid {
  padding: var(--grid-gap-size);
  border-radius: var(--grid-gap-size);

  display: grid;
  width: var(--grid-size);
  height: var(--grid-size);
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: var(--grid-gap-size);

  color: black;
  background: black;
}

.ttt-cell {
  background-color: white;
}
.ttt-cell:hover {
  background-color: var(--palette-light-gray);
}

.ttt-cell svg {
  display: block; /* Remove the slight bottom margin on inline elements */
}

.notif-text {
  height: 3.4rem; 
  width: var(--grid-size);
  border-radius: 4px;
  padding: 8px;
  font-size: 1.35rem;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;

  display: flex;
  align-items: center;
}