/**
* Wordfind.js 0.0.1
* (c) 2012 Bill, BunKat LLC.
* Wordfind is freely distributable under the MIT license.
* For all details and documentation:
*     http://github.com/bunkat/wordfind
*
* Layout adjusted for this site so the grid fits its frame (see MODIFICATIONS.txt).
*/

:root {
  --n: 10;
  --cell: min(3.5rem, calc((100vw - 2rem) / var(--n)));
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: #f6f4ef;
  color: #222;
}

body {
  font: 1em Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

#main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
}

#side {
  width: 100%;
  max-width: 30rem;
}

#theme {
  margin: 0;
  font-weight: bold;
  color: #555;
}

#credit {
  font-size: 0.75rem;
  color: #666;
  margin: 0.5rem 0 0;
}

/**
* Styles for the puzzle
*/
#puzzle {
  display: inline-block;
  border: 1px solid #333;
  background: white;
  padding: 0.5rem;
  touch-action: none;
}

#puzzle > div { /* rows */
  display: flex;
}

/* style for each square in the puzzle */
.puzzleSquare {
  height: var(--cell);
  width: var(--cell);
  padding: 0;
  text-transform: uppercase;
  background-color: white;
  color: #222;
  border: 0;
  font: calc(var(--cell) * 0.6) sans-serif;
  cursor: pointer;
}

@media only screen and (min-width: 600px) {
  :root {
    --cell: min(3.5rem, calc((100vh - 2.5rem) / var(--n)), calc((100vw - 19rem) / var(--n)));
  }
  #main {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }
  #side {
    width: 16rem;
  }
}

button::-moz-focus-inner {
  border: 0;
}

/* indicates when a square has been selected */
#puzzle .selected {
  background-color: orange;
}

/* indicates that the square is part of a word that has been found */
#puzzle .found {
  background-color: blue;
  color: white;
}

#puzzle .solved {
  background-color: purple;
  color: white;
}

/* indicates that all words have been found */
#puzzle .complete {
  background-color: green;
}

/**
* Styles for the word list
*/
#words {
  padding: 0.5rem 0;
  margin: 0;
  list-style-type: none;
  column-count: 2;
  column-gap: 0.75rem;
}

#words li {
  padding: 2px 0;
  font: 1em sans-serif;
}

#words input.word {
  width: 100%;
  text-transform: uppercase;
  background: transparent;
}

/* indicates that the word has been found */
.wordFound {
  text-decoration: line-through;
  color: gray;
}

/**
* Styles for the controls
*/
#controls {
  padding: 0;
  margin: 0;
  border: none;
}
input {
  border: none;
  border-bottom: 1px solid #ccc;
  font-size: 1em;
}
#controls button, #add-word {
  font-size: 0.95em;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
#controls button {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
}

#result-message {
  font-size: 1.1em;
  font-weight: bold;
  margin: 0.5rem 0 0;
  min-height: 1.3em;
}
