/**********/
/* Colors */
/**********/

html {
    --fgcolor: black;
    --bgcolor: white;
    --bgcolor2: #fafafa;
    --accent: rebeccapurple;
}

@media (prefers-color-scheme: dark) {
    html {
        --fgcolor: white;
        --bgcolor: black;
        --bgcolor2: #1f1f1f;
        --accent: pink;
    }
}

body,
dialog {
    color: var(--fgcolor);
    background-color: var(--bgcolor);
}

a {
    color: var(--fgcolor);
    text-decoration-color: var(--accent);
}

a:focus,
a:visited,
a:hover {
    color: var(--accent);
}

blockquote {
    border-left: 1px solid var(--accent);
    background-color: var(--bgcolor2);
}


/**********/
/* Layout */
/**********/

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
        sans-serif;
    font-size: 16px;
}

body.landing {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}



.hidden { display: none }

header { display: none; }
footer {
    position: fixed;
    width: 100%;
    left: 0;
    bottom: 0.5em;
    padding-right: 0.5em;
    text-align: right;
}

main { padding-bottom: 1em }

pre,
code {
    font-family: "IBM Plex Mono", monospace;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

main {
    display: flex;
    flex-direction: column;
}

.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2em;
    margin: 0.5em 0;
    font-size: 0.9em;
    color: var(--fgcolor);
}

.stats .movecount,
.stats .elapsed {
    padding: 0.25em 0.5em;
    background-color: var(--bgcolor2);
    border-radius: 0.25em;
    font-family: "IBM Plex Mono", monospace;
}

.top {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-evenly;
}

.cells {
    display: flex;
    justify-content: space-evenly;
}

.cell,
.actions,
.foundation,
.cascade {
    width: 10vw;
    border: 1px solid transparent;
    margin: 1px;
}

.cell,
.actions,
.foundation {
    min-height: 11vmax;

    display: flex;
    justify-content: center;
    align-items: center;
}

.cell { background-color: rgba(128,255,128,0.3) }
.foundation { background-color: rgba(128,128,128,0.3) }

.empty.cascade {
    border-color: rgba(128,255,128,0.3);
    margin-top: 1px;
}

.empty.foundation::before {
   content: "A";
   font-size: 8vw;
   opacity: 0.7;
}

main.picked .empty.cascade,
main.picked .empty.cell,
main.picked .card {
    cursor: crosshair;
}

.card {
    width: 10vw;
    height: 10vmax;
    border: 1px solid white;
    border-radius: 0.5em;
    text-align: center;
    font-size: xx-large;
    background-color: white;
    cursor: grab;
}

.cascade        { margin-top:  3vmax }
.cascade .card  { margin-top: -3vmax }

.cascade .card:focus {
    cursor: grabbing;
}

.cascade .card { box-shadow: 0px 3px 8px black }
.card:first-child { box-shadow: 0px 1px 2px black }

.card.picked {
    border-color: var(--accent);
    box-shadow: 0 0px 16px var(--accent);
}

.actions {
    text-align: center;
    color: var(--fgcolor);
    background-color: var(--bgcolor2);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

.actions button {
    width: 100%;
    font-size: smaller;
    padding: 0.5em;
}

.foundations {
    display: flex;
    justify-content: space-evenly;
}

.cascades {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    justify-content: space-evenly;
}

.cascade {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
}

.card .Hearts,
.card .Diamonds {
    color: red;
}

.card .Spades,
.card .Clubs {
    color: black;
}

.winner {
    color: var(--accent);
    background-color: var(--bgcolor);

    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.winner span {
    background: linear-gradient(to left, violet, indigo, blue, green, yellow, orange, red);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(1px 1px 1px var(--fgcolor));

    font-size: xx-large;
    font-style: italic;
}

dialog.game button {
    display: block;
    margin: 1em auto;
    width: 100%;
}

dialog.game button.close {
    margin-top: 2em;
}

.game-id {
    word-wrap: break-word;
    font-family: monospace;
}


/* CSS */
button {
  appearance: none;
  background-color: #FAFBFC;
  border: 1px solid rgba(27, 31, 35, 0.15);
  border-radius: 6px;
  box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 1px 0 inset;
  box-sizing: border-box;
  color: #24292E;
  cursor: pointer;
  display: inline-block;
  font-weight: 500;
  line-height: 20px;
  list-style: none;
  padding: 6px 16px;
  position: relative;
  transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  vertical-align: middle;
  white-space: nowrap;
  word-wrap: break-word;
}

button:hover {
  background-color: #F3F4F6;
  text-decoration: none;
  transition-duration: 0.1s;
}

button:disabled {
  background-color: #FAFBFC;
  border-color: rgba(27, 31, 35, 0.15);
  color: #959DA5;
  cursor: not-allowed;
}

button:active {
  background-color: #EDEFF2;
  box-shadow: rgba(225, 228, 232, 0.2) 0 1px 0 inset;
  transition: none 0s;
}

button:focus {
  outline: 1px transparent;
}

button:before {
  display: none;
}

button:-webkit-details-marker {
  display: none;
}

button.lost {
    border-color: var(--accent);
    background-color: var(--accent);
    color: var(--bgcolor);
}

a#net {
    text-decoration: none;
}

@media screen and (min-width: 1024px) {
    .cascade        { margin-top:  5vmax }
    .cascade .card  { margin-top: -5vmax }
}

@media screen and (max-width: 575px) {

    .actions {
        flex-direction: row;
        min-height: unset;
        height: auto;
        order: 2;
        width: auto;
    }
    .actions button {
        width: 20vw;
    }

    .card { font-size: 1em; height: 9.5vmax; }
    .card .suit { display: block; }
    .card .rank { font-size: larger; display: block; }
}
