/* begin license *
 *
 * Small browser games on swl and swindl
 *
 * All rights reserved.
 *
 * Copyright (C) 2026 moatley moatley@lost-monkeys.net
 *
 * This file is part of "Games"
 *
 * end license */

/* Shared by the games' pages, and the index page: the games as big tiles. */
body.games-index {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, var(--games-glow, #fffdf8), var(--games-bg, #f3f1ec) 70%) var(--games-bg, #f3f1ec) no-repeat;
    color: var(--games-text, #2a2a33);
}
:root[data-theme="dark"] { --games-bg: #161a24; --games-glow: #232a3b; --games-text: #eceef4; }
.games-home { max-width: 60rem; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 1rem 2rem; box-sizing: border-box; }
.games-hero { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1.25rem; }
.games-hero h1 { margin: 0; font-size: 2rem; }
.games-hero p { margin: .25rem 0 0; opacity: .7; }
.games-mascot { width: 6.5rem; height: auto; flex: 0 0 auto; }

.games-tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 1rem;
}
.games-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    padding: .9rem;
    border-radius: 1.25rem;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(155deg, var(--tile-a), var(--tile-b));
    box-shadow: 0 6px 16px -6px var(--tile-b), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.games-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 22px -8px var(--tile-b), inset 0 1px 0 rgba(255, 255, 255, .25); }
.games-tile:active { transform: scale(.97); }
.games-tile:focus-visible { outline: 3px solid var(--games-text, #2a2a33); outline-offset: 3px; }
.games-tile-art {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1.35;
    margin-bottom: .6rem;
    border-radius: .9rem;
    background: rgba(255, 255, 255, .14);
}
.games-icon { width: 62%; height: auto; max-height: 86%; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .18)); }
.games-icon-mascot { width: 64%; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.games-tile-name { font-size: 1.2rem; font-weight: 800; letter-spacing: .01em; }
.games-tile-text { margin-top: .2rem; font-size: .8rem; line-height: 1.3; opacity: .88; }
@media (max-width: 30rem) {
    .games-tiles { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .games-tile-text { display: none; }
    .games-mascot { width: 5rem; }
}
@media (prefers-reduced-motion: reduce) { .games-tile { transition: none; } }

.games-tile-triangles { --tile-a: #7b6cf6; --tile-b: #4b3fc4; }
.games-tile-merge { --tile-a: #ffb35c; --tile-b: #e2702a; }
.games-tile-mines { --tile-a: #6f86a8; --tile-b: #3f5274; }
.games-tile-lights { --tile-a: #3c3f6e; --tile-b: #1d1f3f; }
.games-tile-swap { --tile-a: #ff7aa2; --tile-b: #cf3f72; }
.games-tile-sudoku { --tile-a: #4cc3d9; --tile-b: #1f8aa6; }
.games-tile-equations { --tile-a: #5cc98b; --tile-b: #24935a; }
.games-tile-jump { --tile-a: #8fd16a; --tile-b: #3f8f3a; }
.games-tile-pictures { --tile-a: #f0b44c; --tile-b: #c27c1c; }
.games-tile-solitaire { --tile-a: #2fa36b; --tile-b: #176b44; }
.games-tile-pyramid { --tile-a: #e2a33a; --tile-b: #a8641a; }
.games-tile-higher { --tile-a: #e8505b; --tile-b: #a8243a; }
.games-tile-guess { --tile-a: #5a8dee; --tile-b: #2f5bc0; }
.games-tile-search { --tile-a: #b07ce8; --tile-b: #7444b8; }
.games-tile-letters { --tile-a: #f08a5d; --tile-b: #c4502e; }
.games-tile-flight { --tile-a: #4fb3ff; --tile-b: #2a5fd0; }

/* A game's start page (start.j2): in the colours of its tile on the index page. */
body.games-start-page { margin: 0; background: var(--games-bg, #f3f1ec); }
.games-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    padding: max(.75rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
    color: #fff;
    text-align: center;
    background: linear-gradient(165deg, var(--tile-a), var(--tile-b));
}
.games-start-top { align-self: stretch; display: flex; }
.games-start-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-size: 1.2rem;
    text-decoration: none;
}
.games-start-art {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(60vw, 15rem);
    aspect-ratio: 1;
    margin-top: 1vh;
    border-radius: 2rem;
    background: rgba(255, 255, 255, .14);
}
.games-start-art .games-icon { width: 72%; max-height: 80%; }
.games-start-name { margin: 1.25rem 0 .35rem; font-size: 2.2rem; font-weight: 800; }
.games-start-text { max-width: 24rem; margin: 0 0 1.25rem; opacity: .9; line-height: 1.4; }
.games-start-modes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    max-width: 26rem;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
}
.games-start-modes legend {
    width: 100%;
    margin-bottom: .5rem;
    padding: 0;
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .8;
}
.games-start-mode input { position: absolute; opacity: 0; pointer-events: none; }
.games-start-mode span {
    display: inline-block;
    padding: .55rem 1.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-weight: 700;
    cursor: pointer;
    transition: background-color .12s, color .12s;
}
.games-start-mode input:checked + span { background: #fff; color: var(--tile-b); }
.games-start-mode input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }
.games-start-play {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: auto;
    padding: .9rem 3rem;
    border-radius: 999px;
    background: #fff;
    color: var(--tile-b);
    font-size: 1.3rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .35);
    transition: transform .12s;
}
.games-start-play:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { .games-start-play, .games-start-mode span { transition: none; } }

/* The language menu on the index page (language.j2): a flag, a menu with the others. */
.games-hero-text { flex: 1 1 auto; min-width: 0; }
.games-hero { position: relative; }
.games-language { position: relative; align-self: flex-start; z-index: 15; flex: 0 0 auto; }
.games-language > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .6rem;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(127, 127, 127, .12);
}
.games-language > summary::-webkit-details-marker { display: none; }
.games-language > summary .bi { font-size: .7rem; opacity: .7; }
.games-flag { width: 1.5rem; height: 1rem; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); display: block; }
:root[data-theme="dark"] { --games-menu-bg: #2a3142; --games-menu-text: #eceef4; }
.games-language-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .35rem);
    margin: 0;
    padding: .35rem;
    list-style: none;
    border-radius: .75rem;
    background: var(--games-menu-bg, #fff);
    color: var(--games-menu-text, #2a2a33);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.games-language-menu button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .45rem .75rem;
    border: 0;
    border-radius: .5rem;
    background: none;
    color: inherit;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}
.games-language-menu button:hover { background: rgba(127, 127, 127, .15); }
.games-language-menu button[aria-current] { font-weight: 700; }
