:root {
  --font-heading: "Playfair Display", serif;
  --font-body: "Lato", sans-serif;
  --color-background: #3B322C;
  --color-surface: #4C423A;
  --color-text-primary: #D7CFC6;
  --color-text-secondary: #A79C93;
  --color-accent: #A98158;
  --color-border: #5D524A;
  --banner-brightness: 0.4;
  --color-hero-text: #D7CFC6;
  /* Liens dans les messages : l'accent, ajusté quand il est illisible sur le fond */
  --color-link: #B89775;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-size: 16px;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

a {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-accent);
}

/* --- HEADER --- */
.main-header {
    background-color: var(--color-surface);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.header-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem 2rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.logo-image {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2.5rem;
}

.nav-link {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text-secondary);
    position: relative;
    padding-bottom: 5px;
    white-space: nowrap;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-accent);
    transition: width 0.3s ease;
}
.nav-link:hover::after {
    width: 100%;
}

/* --- HERO SECTION --- */
.hero {
    position: relative;
    text-align: center;
    padding: 5rem 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-background-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(var(--banner-brightness)); /* Correction ici */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}
.hero h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    text-wrap: balance;
    overflow-wrap: break-word;
    margin-bottom: 0.5rem;
    color: var(--color-hero-text); /* Correction ici */
}
.hero p {
    font-size: 1.2rem;
    color: var(--color-hero-text); /* Correction ici */
    opacity: 0.9;
}

/* --- CONTENU DU FORUM --- */
.forum-content{
    margin-top: 50px;
}
.forum-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.forum-content > .forum-header + .thread-list {
    margin-top: 2rem;
}
.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
}

.button {
    display: inline-block;
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    font-weight: 700;
    transition: all 0.2s ease;
}
.button:hover {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-background);
}

/* --- LISTE DES DISCUSSIONS --- */
.thread-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.thread-main {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.thread-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
}
.thread-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}
.thread-title a:hover {
    color: var(--color-accent);
}
.thread-meta {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.thread-meta a {
    color: var(--color-text-secondary);
    font-weight: 700;
}
.thread-stats, .thread-activity {
    flex-shrink: 0;
    width: 120px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.thread-stats strong {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--color-text-primary);
    margin-right: 0.5rem;
}
.thread-activity a {
    font-weight: 700;
}
.thread-activity time {
    display: block;
    font-size: 0.85rem;
}

/* --- FOOTER DÉTAILLÉ --- */
.main-footer {
    background-color: var(--color-surface);
    margin-top: 4rem;
    padding-top: 3rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    padding-bottom: 3rem;
}
.footer-column {
    min-width: 0;
}
.footer-column h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--color-text-primary);
}
.footer-column .logo {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}
.footer-column p {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.footer-column ul {
    list-style: none;
    padding: 0;
}
.footer-column ul li {
    margin-bottom: 0.5rem;
}
.footer-column ul a {
    color: var(--color-text-secondary);
}
.footer-bottom {
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* --- ÉLÉMENTS COMMUNS AUX PAGES --- */
.breadcrumb {
    padding: 2rem 0 1rem 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}
.breadcrumb a {
    color: var(--color-text-secondary);
}
.breadcrumb-separator {
    margin: 0 0.4rem;
}
.page-title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    line-height: 1.25;
    text-wrap: balance;
    overflow-wrap: anywhere;
    margin-bottom: 2rem;
}

/* --- PAGE CATÉGORIES --- */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: 1rem;
    transition: background-color 0.2s, border-color 0.2s;
}
.category-item:hover {
    background-color: var(--color-surface);
    border-color: var(--color-accent);
}
.category-details h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
}
.category-details p {
    color: var(--color-text-secondary);
}

/* --- PAGE THREAD --- */
.post-stream {
    margin-top: 2rem;
}
.post-card {
    display: flex;
    gap: 1.5rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--color-border);
}
.post-author {
    flex-shrink: 0;
    width: 150px;
}
.post-author > a:first-child {
    display: block;
    width: fit-content;
}
.author-avatar {
    display: block;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
}
.author-name {
    display: block;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.author-meta {
    display: block;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.post-content {
    flex: 1;
    min-width: 0;
    padding-top: 0.5rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.post-content img,
.post-content video,
.post-content iframe {
    max-width: 100%;
}
.post-content img,
.post-content iframe {
    height: auto;
}
.post-content iframe {
    aspect-ratio: 16 / 9;
}
.post-content pre {
    white-space: pre-wrap;
}
.post-content a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.post-content a:hover {
    text-decoration: none;
}

/* --- PAGE PROFIL --- */
.profile-header {
    text-align: center;
    padding: 3rem 0;
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}
.profile-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.profile-header p {
    color: var(--color-text-secondary);
}
/* Activité récente, balisage généré par Forum.php : <div> par sujet (date + h4) ou message
   (h4 + date + .comment). Le titre est remonté en tête de chaque entrée. */
.profile-activity > div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.profile-activity > div:last-child {
    border-bottom: none;
}
.comment-thread-title {
    order: -1;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.comment-thread-title a:hover {
    color: var(--color-accent);
}
.comment-date {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}
.comment {
    margin-top: 0.5rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.comment img,
.comment video,
.comment iframe {
    max-width: 100%;
}
.comment img,
.comment iframe {
    height: auto;
}
.comment iframe {
    aspect-ratio: 16 / 9;
}
.comment pre {
    white-space: pre-wrap;
}
.comment a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.comment a:hover {
    text-decoration: none;
}

/* --- PAGINATION & FORMULAIRES --- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
/* Une seule page : rien à paginer */
.pagination:not(:has(.page-link)) {
    display: none;
}
.page-link,
.pagination .current-page {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    border-radius: 4px;
}
/* Page courante (<span class="current-page"> généré par Forum.php) */
.pagination .current-page {
    border-color: var(--color-accent);
    color: var(--color-text-primary);
    font-weight: 700;
}
.page-link:hover, .page-link.active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-background);
}
.form-container {
    max-width: 500px;
    margin: 3rem auto;
    padding: 2.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}
.form-container h1 {
    font-family: var(--font-heading);
    text-align: center;
    margin-bottom: 2rem;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-size: 1rem;
    border-radius: 4px;
}
.form-button {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-background);
}
.form-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.form-switch a {
    color: var(--color-accent);
    font-weight: 700;
}

/* .forum-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 3fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 16px;
    align-items: center;
    padding: 16px;
}

.forum-item:first-of-type {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.forum-item:last-of-type {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    margin-bottom: 0;
}
.forum-item:only-of-type {
    border-radius: 8px;
} */

.forum-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
}

/* .forum-subject {
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.4;
}
.forum-subject:hover {
    text-decoration: underline;
}

.forum-author,
.forum-messages,
.forum-last-message {
    font-size: 0.9rem;
}

.forum-author a {
    font-weight: 600;
    text-decoration: none;
}
.forum-author a:hover {
    text-decoration: underline;
}

.forum-messages {
    text-align: center;
}

.forum-last-message {
    text-align: right;
    white-space: nowrap;
} */

/* ---=== Balisage généré par Forum.php : .forum-section > a > h2.forum-header + .forum-item ===--- */
/* Ajouté le 2026-10-09 : les règles .forum-item livrées en commentaire ne stylaient rien, les fils
   s'affichaient en texte brut. Disposition empilée : avatar à gauche, sujet, puis auteur /
   messages / dernier message en dessous (cf. docs/forums_generation.md §7).
   Le sélecteur « .forum-section > a > .forum-header » prime sur la règle .forum-header en flex
   (header de home.html) qui sinon s'applique au <h2> généré. */
.forum-section {
    margin-bottom: 3rem;
}
/* Catégorie sans fil : masquée */
.forum-section:has(> a > .forum-header):not(:has(.forum-item)) {
    display: none;
}
.forum-section > a {
    display: block;
    text-decoration: none;
    color: inherit;
}
.forum-section > a > .forum-header {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin: 0 0 0.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
}
.forum-section > a:hover > .forum-header {
    color: var(--color-accent);
}
.forum-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    column-gap: 1.5rem;
    row-gap: 0.2rem;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
}
.forum-item:last-child {
    border-bottom: none;
}
.forum-item .forum-avatar {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.forum-subject {
    grid-column: 2 / -1;
    grid-row: 1;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    text-decoration: none;
    line-height: 1.4;
    min-width: 0;
    overflow-wrap: anywhere;
}
.forum-subject:hover {
    color: var(--color-accent);
}
.forum-author {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    min-width: 0;
    overflow-wrap: anywhere;
}
.forum-author a {
    color: var(--color-text-secondary);
    font-weight: 700;
    text-decoration: none;
}
.forum-author a:hover {
    color: var(--color-accent);
}
.forum-messages {
    grid-column: 3;
    grid-row: 2;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    text-align: right;
}
.forum-last-message {
    grid-column: 2 / -1;
    grid-row: 3;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* ---=== Mobile ===--- */
@media (max-width: 900px) {
    .footer-column:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    .hero {
        padding: 4rem 0;
    }
    .hero h1 {
        font-size: 2.6rem;
    }
    .page-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 1.25rem;
    }
    .main-header {
        padding: 1rem 0;
    }
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .logo {
        font-size: 1.4rem;
    }
    .main-nav {
        column-gap: 1.5rem;
    }
    .hero {
        padding: 3rem 0;
    }
    .hero h1 {
        font-size: 2.1rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .forum-content {
        margin-top: 2rem;
    }
    .section-title,
    .forum-section > a > .forum-header {
        font-size: 1.5rem;
    }
    .forum-item {
        column-gap: 1rem;
        padding: 1rem 0;
    }
    .forum-subject {
        font-size: 1.05rem;
    }
    .page-title {
        font-size: 1.7rem;
        margin-bottom: 1.25rem;
    }
    .breadcrumb {
        padding-top: 1.25rem;
    }
    .post-stream {
        margin-top: 1rem;
    }
    .post-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem 0;
    }
    .post-author {
        width: auto;
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr);
        column-gap: 0.75rem;
        align-items: center;
    }
    .post-author > a:first-child {
        grid-row: 1 / span 2;
    }
    .author-avatar {
        width: 48px;
        height: 48px;
        margin-bottom: 0;
    }
    .author-name,
    .author-meta {
        grid-column: 2;
    }
    .post-content {
        padding-top: 0;
    }
    .profile-header {
        padding: 2rem 0 1rem;
    }
    .profile-avatar {
        width: 96px;
        height: 96px;
    }
    .profile-header h1 {
        font-size: 2rem;
    }
    .profile-activity > div {
        padding: 1.25rem 0;
    }
    .comment-thread-title {
        font-size: 1.05rem;
    }
    .main-footer {
        margin-top: 3rem;
        padding-top: 2rem;
    }
    .footer-grid {
        gap: 1.5rem;
        padding-bottom: 2rem;
    }
    .footer-column .logo {
        font-size: 1.5rem;
    }
}
