/*
 * SPDX-FileCopyrightText: 2025 Alexandre Gomes Gaigalas <alganet@gmail.com>
 *
 * SPDX-License-Identifier: ISC
 */

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #666666;
    --canvas-bg: #f5f5f5;
}

body {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

h1 {
    margin-bottom: 30px;
    color: #000;
    font-weight: 300;
    letter-spacing: 1px;
    text-align: center;
    letter-spacing: -0.05em;
}

canvas {
    background-color: var(--canvas-bg);
    border: 1px solid #e0e0e0;
    max-width: 100%;
}

.controls {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
}

button {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 24px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    text-wrap: nowrap;
}

button:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

button:active {
    background-color: #e0e0e0;
}

#status {
    font-family: monospace;
    color: #666;
    font-size: 14px;
}

.legend {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    font-size: 0.8em;
    color: #333;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    align-items: center;
    text-wrap: nowrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
}

.color-picker {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.color-picker:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.color-picker:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.legend-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 5px;
}

.reset-colors-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.reset-colors-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

.reset-colors-btn:active {
    background-color: #ddd;
    transform: translateY(1px);
}

.regenerate-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.regenerate-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

.regenerate-btn:active {
    background-color: #ddd;
    transform: translateY(1px);
}

.toggle-btn {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.toggle-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

.toggle-btn.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.toggle-btn.active:hover {
    background-color: #444;
    border-color: #444;
}

.toggle-btn:active {
    transform: translateY(1px);
}

.toolbar-status {
    font-family: monospace;
    color: #666;
    font-size: 0.85em;
    min-width: 50px;
    text-align: center;
    vertical-align: middle;
}

/* Styles for the index page */
.experiment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
    width: 100%;
}

.experiment-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 30px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.experiment-card:hover {
    background: #fff;
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.experiment-card h2 {
    margin: 0 0 15px 0;
    font-weight: 400;
    font-size: 24px;
    text-align: center;
    letter-spacing: -0.05em;
}

.experiment-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
}

.home p {
    margin: 0 auto;
}

@media (max-width: 768px) {


    .experiment-grid {
        grid-template-columns: 1fr;
    }

    .experiment-card {
        margin: 0 auto;
        width: 100%;
    }

    h1 {
        margin: 10px auto;
    }

    .container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
    }

    .experiment-card {
        width: 80%;
    }

    .legend {
        gap: 8px;
        padding: 12px 15px;
        font-size: 0.75em;
        justify-content: center;
        max-width: 100vw;
    }

    .legend-item {
        gap: 4px;
        font-size: 0.75em;
    }

    .color-picker {
        width: 18px;
        height: 18px;
    }

    .regenerate-btn,
    .toggle-btn,
    .reset-colors-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .toolbar-status {
        min-width: 40px;
        font-size: 0.8em;
    }

    #fitToggle {
        display: none;
    }
}

@media (max-width: 600px) {
    .legend {
        gap: 6px;
        padding: 10px 12px;
        font-size: 0.8em;
        flex-wrap: wrap;
    }

    .legend-item {
        gap: 3px;
    }

    /* Hide text labels on very small screens, show only color pickers */
    .legend-item {
        font-size: 0;
    }

    .color-picker {
        width: 16px;
        height: 16px;
    }

    .regenerate-btn,
    .toggle-btn,
    .reset-colors-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }

    .toolbar-status {
        min-width: 35px;
        font-size: 0.75em;
    }

    .legend-divider {
        height: 1px;
        width: 1px;
        background: rgba(0, 0, 0, 0.1);
        margin: 0 5px;
        flex-basis: 100%;
    }
}

@media (max-width: 400px) {
    .legend {
        gap: 4px;
        padding: 8px 10px;
    }

    .color-picker {
        width: 14px;
        height: 14px;
    }

    .regenerate-btn,
    .toggle-btn,
    .reset-colors-btn {
        padding: 4px 8px;
        font-size: 0.7em;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .legend-divider {
        flex-basis: 100%;
    }
}