/* ======================================================================
   index.css — Modern, warm, family-oriented styling for the home page.
   Loaded AFTER main.css so its rules win on equal specificity.
   Scoped where possible to .index-page to avoid leaking onto other pages.
   ====================================================================== */

.index-page {
    --warm-cream:       #FDFAF6;
    --warm-cream-soft:  #F5EDE0;
    --warm-tan:         #D9B98C;
    --warm-terracotta:  #C77B5C;
    --warm-brown:       #5A3E2B;
    --warm-text:        #3A2E27;
    --warm-muted:       #7B6A5C;
    --warm-line:        rgba(90, 62, 43, 0.22);
}

/* ── Page background — single warm cream tone ────────────────────────── */
body.index-page {
    /* #7 preview: a very faint paper grain over the cream, for an heirloom feel.
       SVG fractal-noise tile at low opacity (allowed by CSP img-src data:). */
    background-color: var(--warm-cream);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    color: var(--warm-text);
}

/* ── Login spinner — full-screen overlay shown after "Se connecter" while
   process_login.php runs, so the wait isn't a blank page. ─────────────── */
.login__overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(58, 46, 39, 0.92);
    color: var(--warm-cream);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 20px;
}

.login__spinner {
    width: 46px;
    height: 46px;
    border: 4px solid rgba(253, 250, 246, 0.25);
    border-top-color: var(--warm-terracotta);
    border-radius: 50%;
    animation: loginSpin 0.8s linear infinite;
}

@keyframes loginSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .login__spinner { animation: none; }
}

/* ── Page wrapper — wider, more breathing room ────────────────────────── */
.index-page .page {
    max-width: 1120px;
    padding: 12px 28px 0;
}

/* ── Masthead title — elegant warm serif ──────────────────────────────── */
.index-page .masthead {
    position: relative;
    /* Push the whole masthead (incl. its absolutely-positioned GESTION /
       profile / logout controls) down so it clears the fixed FR/EN toggle
       (top:14, ~28px tall) — a gap below the toggle instead of overlapping it. */
    margin-top: 26px;
    padding-top: 12px;
}

/* The FR/EN toggle sits at the top-right of the page and flows WITH the masthead
   (scrolls away with it) rather than staying pinned to the viewport corner —
   main.css makes it position:fixed, which felt detached/static on this page.
   `absolute` anchors it to the document top; the `right` calc lines its right
   edge up with the masthead content (page is max-width 1120 + 28px side padding),
   falling back to 18px once the viewport is narrow enough to fill the width. */
.index-page .lang-toggle {
    position: absolute;
    right: max(18px, calc((100% - 1120px) / 2 + 28px));
}

.index-page .masthead__title.masthead__title--index {
    clear: both;
    width: 100%;
    text-align: center;
    /* #6 preview: the family name as a script "signature". Alex Brush has a
       small x-height, so it needs a larger size + a little more line-height than
       the serif it replaces. */
    font-family: var(--font-script);
    font-style: normal;
    font-weight: 400;
    font-size: 68px;
    line-height: 1.05;
    letter-spacing: 0.01em;
    color: var(--warm-brown);
    margin-top: 24px;
    margin-bottom: 2px;
}

.index-page .masthead__sub-title-part1 {
    clear: both;
    width: 100%;
    text-align: center;
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 300;
    font-size: 12.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--warm-muted);
    margin-top: 10px;
}

.index-page .masthead__sub-title-part2 {
    clear: both;
    width: 100%;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    letter-spacing: 0.02em;
    color: var(--warm-brown);
    margin-top: 8px;
    margin-bottom: 0;
}

.index-page .masthead__sub-title-part2::after {
    content: '';
    display: block;
    width: 88px;
    height: 1px;
    background: var(--warm-tan);
    margin: 22px auto 0;
}

/* ── Top-right account controls — pill buttons ────────────────────────── */
.index-page .masthead__connect,
.index-page .masthead__disconnect,
.index-page .masthead__profil,
.index-page .masthead__profil1 {
    background: transparent;
    border: 1px solid var(--warm-line);
    border-radius: 999px;
    padding: 6px 16px;
    margin-top: 2px;
    margin-left: 8px;
    width: auto;
    min-width: 110px;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-brown);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.index-page .masthead__connect:hover,
.index-page .masthead__disconnect:hover,
.index-page .masthead__profil:hover,
.index-page .masthead__profil1:hover {
    background: var(--warm-terracotta);
    border-color: var(--warm-terracotta);
    color: #fff;
}

.index-page .masthead__form-disconnect {
    float: none;
    position: absolute;
    top: 10px;
    right: 0;
    margin: 0;
    padding: 0;
}

.index-page .masthead__form-profil {
    float: none;
    position: absolute;
    top: 10px;
    right: 130px;
    margin: 0;
    padding: 0;
}

.index-page .masthead__profil,
.index-page .masthead__profil1 {
    text-align: left;
    padding-left: 16px;
    margin-right: 0;
}

/* ── Management dropdown — modern chip ────────────────────────────────── */
.index-page .masthead__dropdown {
    width: auto;
}

.index-page .masthead__dropbtn {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-brown);
    padding: 6px 14px;
    /* Align with the absolutely-positioned Déconnexion / Votre profil pills:
       those sit at top:10px + 2px button margin + 1px border ≈ box-top 12px.
       Gestion is in normal flow under the masthead's 12px padding-top, so a
       1px margin lands its (border-less) box on the same row centre. */
    margin-top: 1px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.2s ease;
    cursor: pointer;
}

.index-page .masthead__dropdown:hover .masthead__dropbtn,
.index-page .masthead__dropdown:focus-within .masthead__dropbtn {
    background-color: var(--warm-cream-soft);
}

.index-page .masthead__dropdown:hover .masthead__dropdown-content,
.index-page .masthead__dropdown:focus-within .masthead__dropdown-content {
    display: block;
}

.index-page .masthead__dropdown-content {
    background: #fff;
    border: 1px solid var(--warm-line);
    border-radius: 8px;
    box-shadow: 0 16px 32px -12px rgba(90, 62, 43, 0.25);
    padding: 6px 0;
    margin-top: 0;
}

.index-page .masthead__dropdown-content .masthead__item {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--warm-text);
    padding: 8px 18px;
    background: transparent;
}

.index-page .masthead__dropdown-content .masthead__item:hover {
    background: var(--warm-cream-soft);
    color: var(--warm-terracotta);
}

/* Nested "Gestion des accès" sub-menu — was display:none with no trigger, so its
   items (membres / permissions / rôles …) were unreachable. Reveal them when the
   access dropdown is hovered or focused. */
.index-page .masthead__access-dropdown {
    position: relative;
}

.index-page .masthead__access-dropdown:hover .masthead__dropdown-container,
.index-page .masthead__access-dropdown:focus-within .masthead__dropdown-container {
    display: block;
}

/* ── Main navigation — minimal underline rail ─────────────────────────── */
.index-page .c-nav-main {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 12.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-align: center;
    color: var(--warm-text);
    margin: 26px 0 18px;
    padding: 16px 0;
    border-top: 1px solid var(--warm-line);
    border-bottom: 1px solid var(--warm-line);
    cursor: default;
}

.index-page .c-nav-main__item {
    margin: 0 2px;
}

.index-page .c-nav-main__link {
    font-size: 12.5px;
    padding: 6px 14px;
    color: var(--warm-text);
    transition: color 0.2s ease;
}

.index-page .c-nav-main__link:hover {
    color: var(--warm-terracotta);
}

/* ── Main / hero — full-width, centered ───────────────────────────────── */
.index-page main[role="main"] {
    display: block;
    max-width: 1120px;
    margin: 0 auto;
    padding: 8px 28px 72px;
}

.index-page .home {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 12px 0 0;
}

.index-page .home > .home__img {
    display: block;
    width: 100%;
    max-width: 940px;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow:
        0 30px 60px -22px rgba(90, 62, 43, 0.40),
        0 14px 28px -18px rgba(199, 123, 92, 0.25);
    filter: sepia(0.09);
}

.index-page .home__photo {
    margin-top: 36px;
    width: 100%;
}

/* ── Welcome card — replaces the sidebar copy ─────────────────────────── */
.index-page .home__intro {
    max-width: 640px;
    margin: 56px auto 0;
    padding: 36px 32px 28px;
    background: var(--warm-cream-soft);
    border-radius: 10px;
    text-align: center;
    position: relative;
    box-shadow: 0 12px 28px -20px rgba(90, 62, 43, 0.30);
}

.index-page .home__intro::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 1px;
    background: var(--warm-tan);
}

.index-page .home__intro-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.55;
    color: var(--warm-brown);
    margin: 0;
}

.index-page .home__intro-signature {
    display: block;
    max-width: 180px;
    height: auto;
    margin: 18px auto 0;
    opacity: 0.85;
    mix-blend-mode: multiply;
}

/* ── Login forms — viewport-centered modal card ───────────────────────── */
.index-page .login__login-form,
.index-page .login__register-form,
.index-page .login__code-form,
.index-page .login__send-email-message,
.index-page .login__reset-email {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    width: min(440px, 92vw);
    height: auto;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--warm-line);
    border-radius: 12px;
    padding: 24px 22px;
    box-shadow:
        0 30px 60px -20px rgba(90, 62, 43, 0.35),
        0 12px 24px -16px rgba(90, 62, 43, 0.20);
}

.index-page .login__input {
    font-family: var(--font-sans);
}

.index-page .login__button {
    background: var(--warm-brown);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 20px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
}

.index-page .login__button:hover {
    background: var(--warm-terracotta);
}

/* Breathing room between "Se connecter" and "Mot de passe oublié". */
.index-page .login__button--pwd {
    margin-top: 12px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .index-page .masthead__title.masthead__title--index {
        font-size: 54px;
    }
    .index-page .masthead__sub-title-part2 {
        font-size: 24px;
    }
    .index-page main[role="main"] {
        padding: 8px 18px 56px;
    }
}

@media (max-width: 640px) {
    .index-page .page {
        padding: 8px 16px 0;
    }
    .index-page .masthead__title.masthead__title--index {
        font-size: 42px;
        margin-top: 18px;
    }
    .index-page .masthead__sub-title-part2 {
        font-size: 20px;
    }
    .index-page .c-nav-main {
        font-size: 11.5px;
        letter-spacing: 0.12em;
        padding: 12px 0;
    }
    .index-page .c-nav-main__item {
        display: inline-block;
        margin: 2px 0;
    }
    .index-page .c-nav-main__link {
        padding: 4px 8px;
        font-size: 11.5px;
    }
    .index-page .home__intro {
        padding: 28px 20px 22px;
        margin-top: 40px;
    }
    .index-page .home__intro-text {
        font-size: 17px;
    }
    .index-page .masthead__connect,
    .index-page .masthead__disconnect,
    .index-page .masthead__profil,
    .index-page .masthead__profil1,
    .index-page .masthead__dropbtn {
        min-width: 0;
        font-size: 10.5px;
        padding: 5px 12px;
    }
}

/* "No account yet? Write to …" note under the login form (self-registration is
   retired; this points would-be members at the admin). */
.index-page .login__contact {
    margin: 16px auto 0;
    max-width: 320px;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--warm-muted);
}
.index-page .login__contact-link {
    color: var(--warm-text);
    text-decoration: underline;
    white-space: nowrap;
}