/* Emoji bullet points */
@counter-style emojis {
    system: cyclic;

    symbols: 😄 😀 😊 🙂 🤔 🙃;
    suffix: " ";
}


/* Animations   */
@keyframes flipIn {
    0% {
        opacity: 0;
        transform: perspective(30cm) translateZ(0) rotateX(80deg);
    }

    50% {
        opacity: 1;
        transform: perspective(30cm) translateZ(0) rotateX(-30deg);
    }

    75% {
        transform: perspective(30cm) translateZ(0) rotateX(20deg);
    }

    90% {
        transform: perspective(30cm) translateZ(0) rotateX(10deg);
    }

    100% {
        opacity: 1;
        transform: perspective(30cm) translateZ(0) rotateX(0deg);
    }
}

@font-face {
    font-family: 'NataSans';
    src: url('/static/fonts/NataSans.ttf');
    font-display: swap;
}

@font-face {
    font-family: 'Fredoka';
    src: url('/static/fonts/Fredoka-VariableFont_wdth,wght.ttf');
    font-display: swap;
}


/* Root colours */
:root {
    --background: snow;
    --background-alt: white;
    --text: #1b1b1b;
    --accent-light: coral;
    --accent-dark: tomato;
    --low-contrast: rgb(179, 179, 179);
    --glow-color: rgba(255, 204, 112, 0.6);
    --glow-border: #ffcc70;
    --card-background: papayawhip;
    --card-text: black;
    --disabled: lightgray;
}

/* Body text */
body {
    font-family: 'NataSans', 'sans-serif';
    font-display: swap;
    font-size: larger;
    margin: 1em;
    color: var(--text);
    background-color: var(--background);
}

/* Linci ID number */
#linci_id {
    color: var(--low-contrast);
    font-size: 20px;
    font-weight: 300;
}

/* Main header alignment */
.header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: min(3em, 5%);
}

a.plain-link {
    color: var(--text);
    text-decoration: none;
}

/* Link colour */
a:not(.plain-link) {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

/* Footer */
#footer {
    margin-top: 0.5em;
    display: flex;
    gap: 0.5em;
    justify-content: center;
    align-items: center;
}

/* Content width (computer) */
.container {
    width: 100%;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* Button row alignment and gaps */
#main .button-row {
    display: flex;
    justify-content: center;
    align-items: center;
    grid-auto-flow: column;
    gap: 0.3em;
    text-wrap: nowrap;
}

/* Icon header row */
.icons {
    display: grid;
    grid-auto-flow: column;
    gap: 1rem;
    justify-content: end;
}

/* Body content header style */
h1 {
    margin: 0;
    font-family: 'Fredoka', 'serif';
}

/* Input box alignment */
#guess_form {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 30px;
    border-radius: 2px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Input box */
#guess_form>input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 12px 20px;
    font-family: 'NataSans', 'sans-serif';
    border-radius: 20px;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    border: 2px solid var(--glow-border);
    background-color: var(--background-alt);
    color: var(--text);
    box-sizing: border-box;
    /* Ensures padding/border are included in width */
}

input:focus,
select:focus,
textarea:focus,
button:focus,
dialog:focus {
    border-color: var(--glow-border);
    box-shadow: 0 0 8px var(--glow-color);
    /* Adds glow effect */
}

/* Input alignment */
#inputs {
    display: grid;
    gap: 0.5em;
}

/* Clue list style */
#clue_list {
    list-style: emojis;
    margin-bottom: 2rem;
}

/* Adds margin to clue list */
#clue_list li {
    margin-bottom: 1rem;
}

/* Show previous guesses */
#prev_guesses {
    width: 100%;
    min-width: 350px;
    border-collapse: collapse;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: auto;
    font-weight: 200;
    font-size: smaller;
    text-align: center;
}

/* Table for guesses style */
#prev_guesses th,
#prev_guesses td {
    padding: 0.5em 1em;
    /* Adds space inside cells */
    text-align: left;
}

/* Buttons */
button {
    background: var(--accent-light);
    color: var(--background);
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    font-family: 'NataSans', 'sans-serif';
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
}

/* Changes button colour on hover */
button:hover {
    background: var(--accent-dark);
    color: var(--background);
    transform: scale(1.05) rotate(-1deg);
}

/* Changes disabled button to grey */
button:disabled {
    cursor: default;
    pointer-events: none;
    background: var(--disabled);
}

/* Disabled button light grey hover */
button:disabled:hover {
    background: var(--disabled);
}

/* Pop-up style */
dialog {
    border-radius: 0.5em;
    line-height: 1;
    border: none;
    max-width: min(max(480px, 40vw), 100% - 4em);
    background-color: var(--background-alt);
    color: var(--text);
}

/* Pop-up animation */
dialog[open] {
    animation: fadein 0.125s ease-out forwards;
}

/* Icon cursor turn to pointer on hover */
.icons>i {
    cursor: pointer;
}

/* Icon changes colour on hover */
i:hover {
    color: var(--accent-dark);
}

/* [X] animation */
@keyframes fadein {
    0% {
        transform: translateY(-15px);
        opacity: 0;
    }

    100% {
        transform: none;
        opacity: 1;
    }
}

/* [X] animation */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dialog header style */
dialog h1 {
    margin: 0;
    font-size: larger;
    font-weight: 550;
    text-decoration: underline;
}

/* Makes mistakes red and bold */
.mistake {
    text-decoration: underline;
    font-weight: bold;
    color: var(--accent-dark);
}

/* Sets bold weight for strong elements */
strong {
    font-weight: 600;
}

/* Tooltip style */
.tooltip {
    position: absolute;
    background-color: var(--background-alt);
    color: var(--text);
    border: none;
    border-radius: 5px;
    padding: 0.3em;
    font-size: small;
    text-wrap: nowrap;
    left: 0;
    top: calc(100% - 0.1em);
    font-weight: normal;
    z-index: 2;
}

/* Clue position */
.clue {
    position: relative;
}

/* Clue card style */
.card {
    font-family: 'Courier New', 'Courier', 'monospace';
    font-weight: bold;
    background: var(--card-background);
    padding: 7px 7px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 5px;
    animation: flipIn 1s;
    transform-origin: top left;
    display: inline-block;
    will-change: transform, opacity;
    color: var(--card-text);
    box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px;
}

/* Tooltips style */
.show-tooltips .clue .card {
    text-decoration: underline;
    text-decoration-style: dotted;
    cursor: pointer;
}

/* Hide elements */
.d-none {
    display: none;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 2em;
    height: 1em;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--disabled);
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 0.75em;
    width: 0.75em;
    left: 0.125em;
    bottom: 0.125em;
    background-color: var(--background);
    -webkit-transition: .4s;
    transition: .4s;
}


#language_switch+.slider:before {
    background-image: url("/static/flags/en.png");
    background-size: contain;
}

#language_switch:checked+.slider:before {
    background-image: url("/static/flags/cy.png");
    background-size: contain;
}

input:checked+.slider {
    background-color: var(--accent-light);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--glow-border);
}

input:checked+.slider:before {
    -webkit-transform: translateX(1em);
    -ms-transform: translateX(1em);
    transform: translateX(1em);
}

/* Rounded sliders */
.slider.round {
    border-radius: 1rem;
}

.slider.round:before {
    border-radius: 50%;
}

/* Feedback form */
.dialog-button-row {
    display: grid;
    justify-items: right;
}

/* Feedback form textbox */
#feedback>textarea {
    border: 1px solid var(--glow-border);
    resize: none;
    width: 80%;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: var(--background-alt);
    color: var(--text)
}

/* Feedback form textarea focus */
#feedback>textarea:focus {
    outline: none !important;
}

/* Stats chart */
#history_chart {
    transform: scale(80%);
}

#history_chart>text {
    text-anchor: middle;
    dominant-baseline: middle;
    font-weight: 300;
}

#history_chart rect {
    fill: var(--accent-light);
    rx: 5px;
    ry: 5px;
}

#stats_modal text {
    fill: var(--text);
}

#stats_modal p {
    font-size: small;
    text-align: center;
}

#stats-table {
    margin-top: 1em;
}

/* Stats table font and padding */
#stats-table td {
    max-width: 80px;
    font-size: smaller;
    font-weight: 600;
    text-align: center;
    font-family: 'NataSans', 'sans-serif';
    padding: 0.3em;
}

/* About page alignment */
#faq {
    display: grid;
    gap: 1em;
    font-size: smaller;
}

/* About page header */
#faq h1 {
    font-weight: bold;
    text-decoration: underline;
    text-align: center;
    margin: 0;
}

/* About page sub-header */
#faq h2 {
    margin: 0;
    font-size: medium;
}

/* Disclaimer text */
.disclaimer {
    font-size: small;
    text-align: center;
}

.center {
    display: grid;
    justify-items: center;
    align-content: center;
}

/* Responsive design */
@media screen and (max-width: 500px) {

    #guess_form {
        flex-flow: wrap;
    }

    .button-row {
        flex-direction: row-reverse;
    }

    #logo {
        display: none;
    }

    .header {
        margin-top: 0;
    }
}

/* Dark mode */
.dark-mode {
    --background: #1b1b1b;
    --text: #d7dadc;
    --accent-light: paleturquoise;
    --background-alt: color-mix(in oklab, var(--background), var(--accent-light) 4%);
    --accent-dark: lightseagreen;
    --card-background: mintcream;
    --card-text: black;
    --glow-color: paleturquoise;
    --glow-border: lightseagreen;
    --disabled: #404040;
}

.dark-mode input:focus,
.dark-mode select:focus,
.dark-mode textarea:focus,
.dark-mode button:focus,
.dark-mode dialog:focus {
    box-shadow: 0 0 8px rgba(56, 215, 233, 0.6);
    /* Adds glow effect */
}