/* ------------------------------------------------ */
/* Variables et mode sombre                         */

:root {
    --bg: #ffffff;
    --surface: #f5f5f5;
    --text: #202020;
    --accent: #005bbb;
    --border: #d1d5db;
    --error: #c53030;
    --warning: #d69e2e;
    --success: #2f855a;
}


@media (prefers-color-scheme: dark) {

    :root {
        --bg: #121212;
        --surface: #1d1d1d;
        --text: #f2f2f2;
        --accent: #60a5fa;
        --border: #374151;
    }

}


/* ------------------------------------------------ */
/* Corps                                            */

html {
    height: 100%;
}


body {
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    margin: 0;

    background: var(--bg);
    color: var(--text);

    font-family: system-ui, sans-serif;
}


.error-card {

    display: block;

    padding: 1.5rem;

    margin-bottom: 1rem;

    background: var(--surface);

    border: 2px solid var(--error);
    border-left: 12px solid var(--error);

    border-radius: 8px;

    color: inherit;
    text-decoration: none;
}

.error-card h2 {

    margin-top: 0;
    margin-bottom: .75rem;
}

.error-card p {

    margin: .25rem 0;
}


/* ------------------------------------------------ */
/* Largeur du contenu                               */

main {
    flex: 1;

    max-width: 1200px;
    width: 100%;

    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
}


/* ------------------------------------------------ */
/* Sections                                         */

h2 {

    margin-top: 2rem;
    padding-bottom: .3rem;

    /* border-bottom: 1px solid var(--border); */
}

h2[id],
h3[id] {
    scroll-margin-top: 80px;
}

/* ------------------------------------------------ */
/* Navigation                                       */

.main-nav {
    display: flex;
    margin-left: auto;
    gap: 1.5rem;
    padding: 1rem 2rem;
    /* border-bottom: 1px solid var(--border); */
    background: var(--surface);
}

.main-nav a {

    position: relative;

    color: inherit;

    text-decoration: none;

    transition:
    color 0.2s ease;
}


.main-nav a::after {

    content: "";

    position: absolute;

    left: 0;
    bottom: -6px;

    width: 100%;
    height: 2px;

    background: var(--accent);

    transform: scaleX(0);

    transform-origin: center;

    transition:
    transform 0.2s ease;
}

.main-nav a:hover {
    text-decoration: none;
    color: var(--accent);
}

.main-nav a:hover::after {

    transform: scaleX(1);
}


.main-nav a.active {

    color: var(--accent);
}

.main-nav a.active::after {

    transform: scaleX(1);
}

.menu-toggle {

    display: none;

    margin-left: auto;

    border: none;
    background: none;

    font-size: 2rem;

    cursor: pointer;

    color: var(--text);
}


/* ------------------------------------------------ */
/* Header and footer                                */

.site-header {
    position: sticky;
    top: 0;

    z-index: 1000;

    display: flex;
    align-items: center;

    padding: 1rem 2rem;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}

.site-title {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 600;
}

.site-title:hover {
    text-decoration: none;
}


footer {
    gap: 1.5rem;
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}


/* ------------------------------------------------ */
/* Liens                                            */

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

a:hover {
    text-decoration: none;
}



/* ------------------------------------------------ */
/* Portail de cartes                                */


.portal-card {

    display: block;

    padding: 1.5rem;

    margin-bottom: 1rem;

    background: var(--surface);

    border: 1px solid var(--border);

    border-left: 6px solid var(--accent);

    color: inherit;
    text-decoration: none;

    transition:
    border-left-width 0.15s ease,
    background 0.15s ease;
}

.portal-card:hover {

    text-decoration: none;
    border-left-width: 12px;
}

.portal-card h2 {

    margin-top: 0;
    margin-bottom: .75rem;
}

.portal-card p {

    margin: .25rem 0;
}

.portal-grid {

    display: grid;

    grid-template-columns:
    repeat(auto-fit, minmax(320px, 1fr));

    gap: 1rem;
}



/* ------------------------------------------------ */
/* Ressources                                       */

.resource-grid {

    display: grid;

    grid-template-columns:
    repeat(auto-fit, minmax(250px, 1fr));

    gap: .75rem;
}

.resource-card {

    padding: .75rem;

    border: 1px solid var(--border);

    border-left: 4px solid var(--accent);

    background: var(--surface);

    border-radius: 8px;

    display: flex;

    flex-direction: column;

}

.resource-title {

    display: flex;

    align-items: flex-start;

    gap: .5rem;

    font-size: .9rem;
}

.resource-code {

    font-weight: 700;

    flex-shrink: 0;

    min-width: 1.3rem;
}


.resource-name {

    font-weight: 400;
}

.resource-links {

    display: flex;

    justify-content: center;

    gap: 0.4rem;

    flex-wrap: wrap;

    margin-top: auto;
    margin-bottom: auto;

    padding-top: .75rem;
}


.resource-links a {

    padding: .15rem .5rem;

    border: 1px solid var(--border);

    border-radius: 999px;

    text-decoration: none;

    font-size: .85rem;

    color: inherit;
}


.resource-links a:hover {

    border-color: var(--accent);

    color: var(--accent);
}


/* ------------------------------------------------ */
/* Media                                            */

@media (max-width: 768px) {

    .menu-toggle {
        display: block;
    }

    .main-nav {

        display: none;

        position: absolute;

        top: 70px;
        left: 0;
        right: 0;

        flex-direction: column;

        background: var(--surface);

        border-top: 1px solid var(--border);

        padding: 1rem;
    }

    .main-nav.open {
        display: flex;
    }

}
