@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;600&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  /* Palette de couleurs */
  --color-background: #212121;
  --color-text: #f5f5f5;
  --color-text-muted: #9e9e9e;
  --color-accent: #ffffff;
  --color-border: #424242;
  --color-accent-bg: rgba(255, 255, 255, 0.07);

  /* Couleur pour JS */
  --js-rain-color: #ffffff;

  /* Typographie */
  --font-serif: 'Lora', serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

body {
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-serif);
    line-height: 1.7;
}

#digital-rain-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
}

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

/* ---=== Structure principale ===--- */
.page-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

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

.logo {
    flex: 1 1 18rem;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
}

.logo img {
    flex-shrink: 0;
    height: 40px;
    width: auto;
    max-width: 120px;
    filter: sepia(1) saturate(2) brightness(0.8);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.main-nav a {
    color: var(--color-text-muted);
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-accent);
    background-color: var(--color-accent-bg);
}

/* ---=== Contenu Principal ===--- */
.breadcrumb {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    color: var(--color-text-muted);
}

.breadcrumb a {
    color: var(--color-text-muted);
}

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

.breadcrumb-separator {
    margin: 0 0.4rem;
}

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

.banner-image {
    width: 100%;
    display: block;
    filter: sepia(0.8);
}

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

/* ---=== Blocs de Catégories / Listes ===--- */
.category-block {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    overflow-wrap: anywhere;
}

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

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

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

.thread-entry {
    display: block;
    border-left: 2px solid var(--color-border);
    padding-left: 1rem;
}

.thread-entry:hover {
    border-left-color: var(--color-accent);
}

.thread-title {
    display: block;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

a.thread-entry:hover .thread-title,
a.thread-title:hover {
    color: var(--color-accent);
}

.thread-meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.thread-meta .author,
.thread-meta .author a {
    color: var(--color-text);
}

.thread-meta .author a:hover {
    color: var(--color-accent);
}

.author:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

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

.pagination-link {
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
}

.pagination-link.active {
    color: var(--color-text);
    background-color: var(--color-accent-bg);
}

.pagination:empty {
    display: none;
}

.pagination .page-link,
.pagination .current-page {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
}

.pagination .current-page {
    color: var(--color-text);
    background-color: var(--color-accent-bg);
}

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

.thread-header h1 {
    font-size: 2.2rem;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
}

.post-entry {
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0;
    display: flex;
    gap: 1.5rem;
}

.post-author-details {
    flex-shrink: 0;
    width: 180px;
    min-width: 0;
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
}

.post-author-details .author {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    display: block;
}

.post-author-details .post-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

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

.post-body p {
    margin-bottom: 1em;
}

.post-body img,
.post-body video {
    max-width: 100%;
    height: auto;
}

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

.post-body pre {
    white-space: pre-wrap;
}

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

.user-avatar {
    flex-shrink: 0;
    display: block;
    width: 100px;
    height: 100px;
    object-fit: cover;
    filter: sepia(0.8);
}

.user-details {
    min-width: 0;
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
}

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

/* Activité récente : balisage généré par Forum.php (format_thread_preview / format_comment_preview),
   présenté comme .thread-entry : filet à gauche, date en mono, titre, extrait du message. */
.activity-label {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin: 2.5rem 0 1rem;
}

.category-title + .activity-label,
.category-title + .activity-label:has(+ .activity-list:empty) + .activity-list + .activity-label {
    margin-top: 0;
}

.activity-label:has(+ .activity-list:empty),
.activity-list:empty,
.category-block:has(> .activity-list):not(:has(> .activity-list:not(:empty))) {
    display: none;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.activity-list > div {
    min-width: 0;
    border-left: 2px solid var(--color-border);
    padding-left: 1rem;
    overflow-wrap: anywhere;
    transition: border-color 0.2s ease;
}

.activity-list > div:hover {
    border-left-color: var(--color-accent);
}

.comment-thread-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.45;
}

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

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

.comment-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.activity-list .comment {
    margin-top: 0.5rem;
}

/* Médias et blocs longs des messages */
.comment img,
.comment video {
    max-width: 100%;
    height: auto;
}

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

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

/* ---=== Pages Login & Register ===--- */
.auth-container {
    max-width: 450px;
    margin: 5rem auto;
    text-align: center;
}

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

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

.form-group label {
    display: block;
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
}

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

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

.auth-button {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--color-border);
    background-color: transparent;
    color: var(--color-accent);
    cursor: pointer;
}

.auth-button:hover {
    background-color: var(--color-accent-bg);
}

.auth-switch {
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* ---=== Footer ===--- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
    margin-top: 4rem;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
}

.footer-links {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
}

.footer-links a {
    color: var(--color-text-muted);
}

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

.copyright {
    font-size: 0.85rem;
    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 ===--- */
/* Les règles .forum-item livrées en commentaire ne stylaient rien : fils en texte brut et avatars à
   leur taille d'origine. Même esprit que .thread-entry : filet à gauche, titre, puis ligne de méta. */
.forum-section {
    margin-bottom: 3rem;
}

.forum-section:has(> a > .forum-header):not(:has(.forum-item)) {
    display: none;
}

.forum-section > a {
    display: block;
    color: inherit;
}

.forum-section > a > .forum-header {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    overflow-wrap: anywhere;
}

.forum-section > a:hover > .forum-header {
    color: var(--color-accent);
}

.forum-item {
    position: relative;
    min-height: 44px;
    margin-bottom: 1.25rem;
    padding-left: calc(1rem + 40px + 0.9rem);
    border-left: 2px solid var(--color-border);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
    transition: border-color 0.2s ease;
}

.forum-item:last-child {
    margin-bottom: 0;
}

.forum-item:hover {
    border-left-color: var(--color-accent);
}

.forum-item .forum-avatar {
    position: absolute;
    top: 0.2rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.forum-subject {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

.forum-subject:hover {
    color: var(--color-accent);
}

.forum-author a {
    color: var(--color-text);
    font-weight: 600;
}

.forum-author a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.forum-messages {
    white-space: nowrap;
}

.forum-messages::before,
.forum-last-message::before {
    content: "//\00a0";
}

/* ---=== Mobile ===--- */
@media (max-width: 600px) {
    .page-container {
        padding: 2rem 1rem;
    }

    .site-header {
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }

    .logo {
        font-size: 1rem;
    }

    .banner-frame {
        padding: 0.25rem;
        margin-bottom: 2rem;
    }

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

    .forum-item {
        padding-left: calc(0.75rem + 32px + 0.75rem);
    }

    .forum-item .forum-avatar {
        left: 0.75rem;
        width: 32px;
        height: 32px;
    }

    .forum-subject {
        font-size: 1rem;
    }

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

    .post-entry {
        flex-direction: column;
        gap: 0.5rem;
    }

    .post-author-details {
        width: auto;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0 0.75rem;
    }

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

    .user-avatar {
        width: 88px;
        height: 88px;
    }

    .activity-label {
        margin-top: 2rem;
    }

    .activity-list > div {
        padding-left: 0.75rem;
    }

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