:root {
    --background-color: #fdfdfd; /* plus doux que blanc pur */
    --border: 2px solid #333; /* un peu plus fin pour modernité */
    --primary-color: #1e90ff; /* accent color */
    --font-family: 'JetBrains Mono', monospace;
    --radius: 16px;
    --gap: 16px;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--background-color);
}

/* Global elements */
* {
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    height: auto;
    width: 100%;
    border-bottom: var(--border);
    font-weight: bold;
    font-size: 28px;
    background-color: #fff;
    position: sticky;
    top: 0;
    text-align: center;
    word-break: break-word;
    z-index: 100;
}

header h1, header {
    font-size: clamp(18px, 4vw, 28px);
}

/* Research section */
#research {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: var(--gap);
    gap: var(--gap);
    border-bottom: var(--border);
    background-color: #fafafa;
}

#research > input[type="text"] {
    flex: 1 1 300px; /* responsive width */
    max-width: 600px;
    min-width: 200px;
    padding: 12px 16px;
    font-size: 20px;
    border: var(--border);
    border-radius: var(--radius);
}

#research > input[type="submit"] {
    padding: 12px 24px;
    font-size: 20px;
    border: var(--border);
    border-radius: var(--radius);
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    flex: 0 0 auto;
}

#research > input[type="submit"]:hover {
    background-color: #0f71d0;
}

/* Grid view */
#grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--gap);
    padding: var(--gap);
    border-bottom: var(--border);
}

.grid-item {
    border: var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow-wrap: break-word;
    word-break: break-all;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

/* Footer */
footer {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background-color: #fff;
    border-top: var(--border);
}

/* Responsive tweaks */
@media (max-width: 768px) {
    header {
        font-size: 24px;
    }
    #research > input[type="text"] {
        font-size: 18px;
    }
    #research > input[type="submit"] {
        font-size: 18px;
    }
    footer {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    #grid-view {
        grid-template-columns: 1fr;
    }
    .grid-item {
        aspect-ratio: auto;
        width: 100%;
    }
}
