@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  /* Palette de couleurs */
  --color-paper: #f0ebe5;
  --color-ink: #1a1a1a;
  --color-red: #d94f30;
  --color-yellow: #f2d43d;
  --color-blue: #305f8c;
  --color-border: #d3ccc3;
  --color-hover-bg: rgba(242, 212, 61, 0.2);
  /* Liens et pseudos posés sur le papier : le bleu, assombri ou éclairci seulement là où il n'atteint pas 4,5:1 */
  --color-link: #305f8c;

  /* Typographie & Autres (ces valeurs sont fixes) */
  --font-heading: 'Montserrat', sans-serif;
  --font-mono: 'Roboto Mono', monospace;
}

/* ---=== Initialisation & Styles Généraux ===--- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-mono);
    line-height: 1.6;
}

#geometry-background {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.1;
}

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

/* ---=== Structure principale ===--- */
.page-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--color-paper);
}

/* ---=== Header ===--- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--color-ink);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    line-height: 1.3;
    text-transform: uppercase;
    min-width: 0;
}

.logo span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.logo img {
    height: 35px;
    flex: none;
}

.main-nav {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-mono);
    font-weight: 500;
    text-transform: uppercase;
}

.nav-link.active {
    border-bottom: 2px solid var(--color-red);
}

.nav-link:hover {
    color: var(--color-link);
}

/* ---=== Contenu Principal ===--- */
.main-content {
    margin-top: 2rem;
}

.breadcrumb {
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    color: var(--color-ink);
}

.breadcrumb a {
    color: var(--color-link);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator,
.breadcrumb .breadcrumb-separator {
    margin: 0 0.75rem;
    color: var(--color-border);
}

.breadcrumb .current-page {
    font-weight: 700;
    color: var(--color-ink);
}

.banner-block {
    display: block;
    border: 2px solid var(--color-ink);
    padding: 0.5rem;
    margin-bottom: 3rem;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ---=== Sections de Catégories / Listes ===--- */
.category-section {
    border-top: 2px solid var(--color-ink);
    padding-top: 1.5rem;
    margin-bottom: 3rem;
}

.category-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-title a {
    min-width: 0;
    overflow-wrap: anywhere;
}

.category-title a:hover {
    color: var(--color-link);
}

.shape {
    display: inline-block;
    flex: none;
    width: 20px;
    height: 20px;
}

.shape.circle {
    background-color: var(--color-red);
    border-radius: 50%;
}

.shape.square {
    background-color: var(--color-blue);
}

.category-title[data-color="red"] a {
    color: var(--color-red);
}

.category-title[data-color="blue"] a {
    color: var(--color-link);
}

/* Le jaune est illisible en texte sur la plupart des papiers : il passe en soulignement */
.category-title[data-color="yellow"] a {
    color: var(--color-ink);
    border-bottom: 4px solid var(--color-yellow);
}

.thread-list {
    display: flex;
    flex-direction: column;
}

.thread-item {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.thread-item:first-of-type {
    border-top: 1px solid var(--color-border);
}

.thread-item:hover {
    background-color: var(--color-hover-bg);
}

.thread-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

a.thread-title:hover {
    color: var(--color-link);
}

.thread-meta {
    font-size: 0.85rem;
}

.thread-meta a {
    color: var(--color-link);
}

.thread-meta a:hover {
    text-decoration: underline;
}

.pagination {
    text-align: center;
    font-family: var(--font-mono);
    margin-top: 2rem;
}

/* Le moteur produit .page-link (liens) et .current-page (page en cours) */
.pagination-link,
.pagination .page-link,
.pagination .current-page {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0 0.15rem;
    font-weight: 700;
    border: 2px solid transparent;
}

.pagination-link:hover,
.pagination .page-link:hover {
    background-color: var(--color-hover-bg);
}

.pagination-link.active,
.pagination .current-page {
    border-color: var(--color-ink);
}


/* ---=== Page Thread ===--- */
.thread-header {
    margin-bottom: 2rem;
}

.thread-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    line-height: 1.3;
    text-transform: uppercase;
    overflow-wrap: anywhere;
    margin-bottom: 0.5rem;
}

.thread-header p {
    font-size: 0.9rem;
}

.thread-header p a {
    color: var(--color-link);
    font-weight: 500;
}

.comment-block {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    display: flex;
    gap: 1.5rem;
}

.comment-author {
    flex: 0 0 150px;
    min-width: 0;
    font-weight: 500;
}

.comment-author a {
    font-weight: 700;
    display: block;
    overflow-wrap: anywhere;
}

.comment-author span {
    font-size: 0.8rem;
}

.comment-body {
    flex-grow: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.comment-body p:not(:last-child) {
    margin-bottom: 1em;
}

.comment-body a {
    text-decoration: none;
    font-weight: bold;
    color: var(--color-link);
}

/* Médias des messages : sur le fil (.comment-body) comme sur le profil (.comment) */
.comment-body img,
.comment-body video,
.comment img,
.comment video {
    max-width: 100%;
    height: auto;
}

.comment-body iframe,
.comment iframe {
    display: block;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
    margin: 0.5rem 0;
}

.comment-body pre,
.comment pre {
    white-space: pre-wrap;
}

/* ---=== Page User ===--- */
.user-profile {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.user-avatar {
    flex: none;
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.user-details {
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.user-details p {
    margin-bottom: 0.5rem;
}

/* Derniers sujets et messages, balisage généré par Forum.php :
   div > h4.comment-thread-title + div.comment-date (+ div.comment) */
.thread-list > div:has(> .comment-thread-title) {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.thread-list > div:first-child:has(> .comment-thread-title) {
    border-top: 1px solid var(--color-border);
}

/* Titre toujours avant la date (le moteur l'inverse pour les sujets) */
.comment-thread-title {
    order: -1;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.comment-thread-title a:hover {
    color: var(--color-link);
}

.comment-date {
    font-size: 0.8rem;
    opacity: 0.75;
}

.thread-list .comment {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

/* Membre sans sujet ou sans message : pas de section vide */
.category-section:has(> .thread-list):not(:has(> .thread-list > div)) {
    display: none;
}

/* ---=== Pages Login & Register ===--- */
.auth-container {
    text-align: center;
    margin-top: 4rem;
}

.auth-form {
    border-top: 2px solid var(--color-ink);
    border-bottom: 2px solid var(--color-ink);
    padding: 2rem;
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    text-transform: uppercase;
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--color-ink);
    background: var(--color-paper);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-blue);
}

.auth-button {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-transform: uppercase;
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--color-ink);
    background: var(--color-yellow);
    cursor: pointer;
}

.auth-button:hover {
    background-color: var(--color-red);
    color: var(--color-paper);
}

.auth-switch {
    margin-top: 1rem;
}

.auth-switch a {
    color: var(--color-link);
}

/* ---=== Footer ===--- */
.site-footer {
    border-top: 2px solid var(--color-ink);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* .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). */
.forum-section {
    border-top: 2px solid var(--color-ink);
    padding-top: 1.5rem;
    margin-bottom: 3rem;
}
/* Catégorie sans aucun 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.5rem;
    text-transform: uppercase;
    margin: 0 0 1.5rem 0;
    color: var(--color-ink);
    overflow-wrap: anywhere;
}
.forum-section > a:hover > .forum-header {
    color: var(--color-link);
}
.forum-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    column-gap: 1rem;
    row-gap: 0.2rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}
.forum-item:last-child {
    border-bottom: none;
}
.forum-item:hover {
    background-color: var(--color-hover-bg);
}
.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.1rem;
    font-weight: 700;
    color: var(--color-ink);
    text-decoration: none;
    line-height: 1.4;
    min-width: 0;
    overflow-wrap: anywhere;
}
.forum-subject:hover {
    color: var(--color-link);
}
.forum-author {
    grid-column: 2;
    grid-row: 2;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-ink);
    min-width: 0;
    overflow-wrap: anywhere;
}
.forum-author a {
    color: var(--color-link);
    font-weight: 700;
    text-decoration: none;
}
.forum-author a:hover {
    text-decoration: underline;
}
.forum-messages {
    grid-column: 3;
    grid-row: 2;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-ink);
    white-space: nowrap;
    text-align: right;
}
.forum-last-message {
    grid-column: 2 / -1;
    grid-row: 3;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-ink);
    opacity: 0.75;
}

/* ---=== Mobile ===--- */
@media (max-width: 900px) {
    .logo {
        font-size: 1.5rem;
    }
}

@media (max-width: 640px) {
    .page-container {
        padding: 1.25rem 1rem;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .main-nav {
        gap: 0.4rem 1.25rem;
        font-size: 0.9rem;
    }

    .breadcrumb,
    .banner-block {
        margin-bottom: 1.5rem;
    }

    .main-content {
        margin-top: 1.5rem;
    }

    .category-title,
    .forum-section > a > .forum-header {
        font-size: 1.25rem;
    }

    .forum-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        column-gap: 0.75rem;
    }

    .forum-item .forum-avatar {
        width: 40px;
        height: 40px;
        align-self: start;
    }

    .forum-subject,
    .comment-thread-title {
        font-size: 1rem;
    }

    .thread-header h1 {
        font-size: 1.35rem;
    }

    .comment-block {
        flex-direction: column;
        gap: 0.5rem;
    }

    .comment-author {
        flex: none;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0 0.75rem;
    }

    .user-profile {
        flex-wrap: wrap;
        gap: 1rem;
    }
}
