/* =====================
   Variables
===================== */
:root {
    --max-width: 1100px;
    --aside-width: 220px;

    --clr-primary: #2563eb;
    --clr-secondary: #7c3aed;
    --clr-bg: #f8fafc;
    --clr-surface: #ffffff;
    --clr-muted: #64748b;
    --clr-border: #e5e7eb;

    --radius: 6px;
    --space: 0.75rem;
    --font: system-ui, sans-serif;
}

/* =====================
   Reset
===================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* =====================
   Base
===================== */
body {
    font-family: var(--font);
    background-color: var(--clr-bg);
    color: #0f172a;
    line-height: 1.6;
}

a {
    color: var(--clr-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

summary {
    cursor: pointer;
}

textarea {
    resize: none;
    height: 200px;
}

/* =====================
   Typographie
===================== */
h1 { font-size: 2rem; }
h3 { font-size: 1.1rem; color: var(--clr-primary); }
h5 { font-size: 0.9rem; color: var(--clr-muted); }

/* =====================
   Layout Grid
===================== */
body {
    display: grid;
    grid-template-rows: auto 1fr auto;
}

header,
footer {
    background: linear-gradient(
        135deg,
        var(--clr-primary),
        var(--clr-secondary)
    );
    color: white;
}

header {
    padding: var(--space);
}

footer {
    padding: 0.5rem;
    font-size: 0.8rem;
    text-align: center;
}

/* =====================
   Main Grid
===================== */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space);
    max-width: var(--max-width);
    margin: auto;
    padding: var(--space);
}

aside,
article {
    background-color: var(--clr-surface);
    border-radius: var(--radius);
    padding: var(--space);
}

/* =====================
   Aside
===================== */
aside ul {
    list-style: none;
    display: grid;
    gap: 0.4rem;
}

aside li,
aside details a {
    background-color: var(--clr-bg);
    padding: 0.4rem;
    font-size: 0.75rem;
    text-align: center;
    border-radius: var(--radius);
}

/* =====================
   Article
===================== */
article {
    min-height: 70vh;
}

/* =====================
   Formulaires
===================== */
fieldset {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    padding: var(--space);
    max-width: 500px;
    margin: auto;
    background-color: var(--clr-surface);
}

fieldset label,
fieldset input,
fieldset select,
fieldset textarea {
    width: 100%;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

fieldset button {
    padding: 0.4rem;
    background-color: var(--clr-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

fieldset button:hover {
    opacity: 0.9;
}

legend {
    font-size: 0.75rem;
    color: var(--clr-muted);
}

/* =====================
   Table
===================== */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--clr-surface);
}

th,
td {
    padding: 0.4rem;
    border-bottom: 1px solid var(--clr-border);
    text-align: center;
}

th {
    background-color: var(--clr-bg);
    font-size: 0.8rem;
}

/* =====================
   Messages
===================== */
.msg-erreur {
    background-color: #fee2e2;
    color: #991b1b;
    padding: var(--space);
    border-radius: var(--radius);
}

.msg-succes {
    background-color: #dcfce7;
    color: #166534;
    padding: var(--space);
    border-radius: var(--radius);
}

.msg-info {
    background-color: #dbeafe;
    color: #1e40af;
    padding: var(--space);
    border-radius: var(--radius);
}

/* =====================
   Utilitaires
===================== */
.code {
    font-size: 0.7rem;
    color: var(--clr-muted);
    font-family: monospace;
}

.info {
    cursor: help;
}

/* =====================
   Desktop
===================== */
@media (min-width: 900px) {
    main {
        grid-template-columns: var(--aside-width) 1fr;
        align-items: start;
    }
}
