/* Page intermédiaire — Outils wargame La Fabrique Miniature */

:root {
    --tools-bg: #f3efe6;
    --tools-card: rgba(255, 252, 245, 0.64);
    --tools-border: rgba(62, 49, 35, 0.15);
    --tools-text: #2f261d;
    --tools-muted: #756856;
    --tools-accent: #6f4d2e;
    --tools-accent-dark: #4b331f;
    --tools-danger: #9a342e;
    --tools-success: #376d42;
    --tools-shadow: 0 18px 45px rgba(47, 38, 29, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--tools-bg) !important;
}

body.tools-page {
    position: relative;
    isolation: isolate;
    margin: 0;
    min-height: 100vh;
    color: var(--tools-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--tools-bg) !important;
}

/* Neutralise toute ancienne couche qui aurait pu recouvrir le fond. */
body.tools-page::before,
body.tools-page::after {
    content: none !important;
    display: none !important;
}

/*
 * Vrai calque de background injecté par JS.
 * Comme ce n'est plus un pseudo-élément du body, il est beaucoup moins fragile.
 */
#lfm-bg-layer {
    position: fixed !important;
    inset: 0 !important;
    z-index: -1 !important;
    pointer-events: none !important;
    background-repeat: no-repeat !important;
    background-position: center bottom !important;
    background-size: cover !important;
    opacity: 1 !important;
}

/* Léger voile crème, mais il reste DANS le calque image, pas au-dessus du site. */

/*
 * VRAI voile séparé.
 * Là, on ne dépend plus d'un ::after sur le background.
 * Pour régler : change simplement 0.34 ci-dessous.
 */
#lfm-bg-veil {
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    pointer-events: none !important;
    background: rgba(243, 239, 230, 0.55) !important;
}

#lfm-bg-layer::after {
    content: none !important;
    display: none !important;
}

.tools-shell {
    position: relative;
    z-index: 1;
    width: min(880px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.tools-header {
    text-align: center;
    margin-bottom: 34px;
}

.tools-logo {
    display: block;
    width: min(360px, 84vw);
    max-height: 230px;
    object-fit: contain;
    margin: 0 auto 18px;
}

.admin-logo {
    width: min(260px, 74vw);
    max-height: 160px;
}

.tools-kicker {
    margin: 0 0 8px;
    color: var(--tools-accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tools-header h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.35rem);
    line-height: 1.05;
}

.tools-intro {
    max-width: 620px;
    margin: 14px auto 0;
    color: var(--tools-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.portal-section {
    margin: 0 auto 22px;
    padding: 10px;
    background: var(--tools-card);
    border: 1px solid var(--tools-border);
    border-radius: 18px;
    box-shadow: var(--tools-shadow);
    text-align: center;
    backdrop-filter: blur(1.5px);
}

/* Réduction légère des blocs centraux : environ 35 px de chaque côté. */
body.tools-page:not(.admin-page) .portal-section {
    max-width: 810px;
}


.portal-section + .portal-section {
    position: relative;
    margin-top: 42px;
}

.portal-section + .portal-section::before {
    content: "";
    position: absolute;
    top: -22px;
    left: 12%;
    right: 12%;
    height: 1px;
    background: rgba(62, 49, 35, 0.22);
}

.section-heading {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(62, 49, 35, 0.10);
    text-align: center;
}

.section-heading h2,
.portal-section > h2 {
    margin: 0 0 6px;
    color: var(--tools-accent-dark);
    font-size: 1.25rem;
}

.section-heading p,
.admin-help {
    margin: 0;
    color: var(--tools-muted);
    line-height: 1.5;
}

.compact-heading {
    margin-bottom: 18px;
}

.simple-link-list {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
}

.simple-link-list a {
    display: block;
    padding: 11px 0;
    color: var(--tools-text);
    font-weight: 650;
    text-decoration: none;
    border-bottom: 0;
}

.simple-link-list a::before {
    content: "→";
    margin-right: 10px;
    color: var(--tools-accent);
}

.simple-link-list a:hover,
.simple-link-list a:focus-visible,
.admin-shortcut a:hover,
.admin-shortcut a:focus-visible {
    color: var(--tools-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.project-list {
    display: grid;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
}

.project-item {
    padding: 0;
    border-bottom: 0;
}

.project-item h3 {
    margin: 0 0 5px;
    font-size: 1rem;
    color: var(--tools-accent-dark);
}

.project-item p {
    margin: 0;
    color: var(--tools-muted);
    line-height: 1.55;
}

.admin-shortcut {
    margin: 20px 0 0;
    text-align: center;
}

.admin-shortcut a {
    color: var(--tools-muted);
    font-size: 0.92rem;
    text-decoration: none;
}

.admin-shell {
    width: min(780px, calc(100% - 32px));
}

.admin-form {
    display: grid;
    gap: 10px;
}

.inline-form {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
}

.admin-form label {
    color: var(--tools-accent-dark);
    font-size: 0.88rem;
    font-weight: 750;
}

.admin-form input,
.admin-form textarea {
    width: 100%;
    padding: 11px 12px;
    color: var(--tools-text);
    background: rgba(255, 250, 240, 0.68);
    border: 1px solid var(--tools-border);
    border-radius: 10px;
    font: inherit;
}

.admin-form textarea {
    resize: vertical;
}

button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    padding: 10px 16px;
    color: #fffaf0;
    background: var(--tools-accent-dark);
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

button:hover,
button:focus-visible {
    background: var(--tools-accent);
}

button.danger {
    min-height: 34px;
    padding: 7px 10px;
    background: var(--tools-danger);
    font-size: 0.82rem;
}

.notice {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--tools-card);
    border: 1px solid var(--tools-border);
    font-weight: 650;
}

.notice.success {
    color: var(--tools-success);
}

.notice.error {
    color: var(--tools-danger);
}

.admin-list {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.admin-list-row {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 0;
}

.admin-list-row small {
    color: var(--tools-muted);
}

.logout-form {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

@media (max-width: 720px) {
    #lfm-bg-layer {
        background-size: cover !important;
        opacity: 1 !important;
    }

    .tools-shell,
    .admin-shell {
        width: min(100% - 22px, 880px);
        padding-top: 28px;
    }

    .portal-section {
        padding: 18px;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .admin-list-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
