/* style.css */
/* --- Color Palette Variables --- */
:root {
    --primary-color: #1C352D; /* Dark Green */
    --secondary-color: #A6B28B; /* Sage Green */
    --accent-color: #F5C9B0; /* Peach */
    --background-light: #F9F6F3; /* Off-White */
    --text-dark: #333; /* Default dark text */
    --box-border: #d3d6da; /* Default gray border */

    /* Variables for the theme-toggle button */
    --icon-fill: currentColor;
    --icon-fill-hover: #1C352D; /* Dark Green for the icon hover state */
}

/* --- Theme-based Colors with data-attribute --- */
body[data-theme='light'] {
    background-color: var(--background-light);
    color: var(--primary-color);
}

body[data-theme='light'] #app-container {
    background-color: rgba(255, 255, 255, 0.5); 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body[data-theme='light'] h1 {
    color: var(--primary-color);
}

body[data-theme='light'] .button {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

body[data-theme='light'] .button:hover {
    background-color: #929d7c;
}

body[data-theme='light'] .button_2 {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

body[data-theme='light'] .button_2:hover {
    background-color: #554f44;
}

body[data-theme='light'] .box {
    border-color: var(--box-border);
}

body[data-theme='light'] .key {
    background-color: var(--box-border);
    color: var(--text-dark);
}

body[data-theme='light'] .key:hover {
    background-color: #c0c3c6;
}

body[data-theme='light'] .hint {
    color: #777;
}

/* --- Dark Mode Colors --- */
body[data-theme='dark'] {
    background-color: var(--primary-color);
    color: var(--background-light);
}

body[data-theme='dark'] #app-container {
    background-color: rgba(40, 40, 40, 0.5); 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

body[data-theme='dark'] h1 {
    color: var(--accent-color);
}

body[data-theme='dark'] p, body[data-theme='dark'] .hint {
    color: var(--background-light);
}

body[data-theme='dark'] .button {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

body[data-theme='dark'] .button:hover {
    background-color: #929d7c;
}

body[data-theme='dark'] .button_2 {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

body[data-theme='dark'] .button_2:hover {
    background-color: #554f44;
}

body[data-theme='dark'] .box {
    border-color: #5d665f;
}

body[data-theme='dark'] .key {
    background-color: #435149;
    color: var(--background-light);
}

body[data-theme='dark'] .key:hover {
    background-color: #55665d;
}

/* --- Shared Game Styles (non-theme specific) --- */
/* style.css */

/* --- Add the background to the main body element --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    transition: background-color 0.5s, color 0.5s;

    /* Add these lines for the universal background */
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden; /* Prevents scrollbars */
}

/* --- This pseudo-element creates the dim/blur effect over the background --- */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Adjust opacity for dimming */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: -1; /* Places the overlay behind the content */
}

/* You can now DELETE the old 'body.game-over' and 'body.game-over::before' 
  rules from the end of your stylesheet, as they are no longer needed. 
*/


#app-container {
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    animation: fadeIn 0.8s ease-in-out;
    transition: background-color 0.5s, box-shadow 0.5s;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    width: 80%;
    margin-top: 20px;
}

.button:active {
    transform: scale(0.98);
}

.button_2 {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    width: 80%;
    margin-top: 20px;
}

.button_2:active {
    transform: scale(0.98);
}

.hint {
    font-style: italic;
    font-size: 0.9em;
}

/* --- Game Grid Styles --- */
#game-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-gap: 8px;
    padding: 10px 0;
}

.row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-gap: 8px;
    height: 60px;
}

.box {
    width: 100%;
    height: 100%;
    border: 2px solid;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.3s, border-color 0.3s;
}

.box.correct {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--primary-color);
}

.box.present {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-color);
}

.box.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: white;
}

/* --- Keyboard Styles --- */
#keyboard {
    margin-top: 20px;
}

.key-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.key {
    border: none;
    border-radius: 4px;
    padding: 12px 8px;
    margin: 0 4px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    flex-grow: 1;
    transition: background-color 0.3s, color 0.3s;
}

/* #backspace-key, #enter-key {
    padding: 12px 18px;
    font-size: 0.8em;
    font-weight: bold;
} */

.key.correct {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.key.present {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.key.absent {
    background-color: #787c7e;
    color: white;
}

/* --- Theme Toggle Button from web.dev --- */
@import "https://unpkg.com/open-props/easings.min.css";

.theme-switch-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-toggle {
    --size: 2rem;
    background: none;
    border: none;
    padding: 0;
    inline-size: var(--size);
    block-size: var(--size);
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline-offset: 5px;
}

.sun-and-moon > :is(.moon, .sun, .sun-beams) {
    transform-origin: center;
}

.sun-and-moon > :is(.moon, .sun) {
    fill: currentColor;
}

.theme-toggle:is(:hover, :focus-visible) > .sun-and-moon > :is(.moon, .sun) {
    fill: var(--icon-fill-hover);
}

.sun-and-moon > .sun-beams {
    stroke: currentColor;
    stroke-width: 2px;
}

.theme-toggle:is(:hover, :focus-visible) .sun-and-moon > .sun-beams {
    stroke: var(--icon-fill-hover);
}

/* Dark theme specific styles for the icon */
[data-theme="dark"] .sun-and-moon > .sun {
    transform: scale(1.75);
}

[data-theme="dark"] .sun-and-moon > .sun-beams {
    opacity: 0;
}

[data-theme="dark"] .sun-and-moon > .moon > circle {
    transform: translateX(-7px);
}

@supports (cx: 1) {
    [data-theme="dark"] .sun-and-moon > .moon > circle {
        cx: 17;
        transform: translateX(0);
    }
}

/* Animations */
@media (prefers-reduced-motion: no-preference) {
    .sun-and-moon > .sun {
        transition: transform .5s var(--ease-elastic-3);
    }
    .sun-and-moon > .sun-beams {
        transition: transform .5s var(--ease-elastic-4), opacity .5s var(--ease-3);
    }
    .sun-and-moon .moon > circle {
        transition: transform .25s var(--ease-out-5);
    }

    @supports (cx: 1) {
        .sun-and-moon .moon > circle {
            transition: cx .25s var(--ease-out-5);
        }
    }

    [data-theme="dark"] .sun-and-moon > .sun {
        transition-timing-function: var(--ease-3);
        transition-duration: .25s;
    }

    [data-theme="dark"] .sun-and-moon > .sun-beams {
        transition-duration: .15s;
        transform: rotateZ(-25deg);
    }

    [data-theme="dark"] .sun-and-moon > .moon > circle {
        transition-duration: .5s;
        transition-delay: .25s;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}