/*
 * Vintage Audio Laser — géométrie commune Flarum
 * Indépendant des thèmes.
 */

/* Nom du forum à côté du logo — desktop uniquement */
@media (min-width: 992px) {
    .Header-title a {
        display: flex;
        align-items: center;
        gap: 12px;
        white-space: nowrap;
        text-decoration: none !important;
    }

    .Header-title a:hover,
    .Header-title a:focus {
        text-decoration: none !important;
    }

    .Header-title a::after {
        content: "vintage-audio-laser.fr";
        font-size: 20px;
        font-weight: 600;
        line-height: 1;
        color: inherit;
    }
}

/* -------------------------
   Tags parents sans discussion : cartes des sous-forums
   ------------------------- */

.val-child-forums {
    margin: 18px 0 28px;
}

.val-child-forums-title {
    margin: 0 0 16px;
    color: var(--heading-color);
    font-size: 22px;
    font-weight: 650;
    line-height: 1.25;
}

.val-child-forums-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.val-child-forum-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 84px;
    flex-direction: column;
    justify-content: center;
    padding: 14px 42px 14px 18px;

    border: 1px solid var(--control-bg);
    border-radius: 8px;
    background: var(--body-bg);
    color: var(--text-color);
    text-decoration: none !important;

    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.val-child-forum-card::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--val-child-color, var(--primary-color));
}

.val-child-forum-card:hover,
.val-child-forum-card:focus {
    background: var(--control-bg);
    color: var(--text-color);
    text-decoration: none !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    outline: 0;
}

.val-child-forum-name {
    color: var(--heading-color);
    font-size: 16px;
    font-weight: 650;
    line-height: 1.3;
}

.val-child-forum-description {
    margin-top: 5px;
    color: var(--muted-color);
    font-size: 13px;
    line-height: 1.4;
}

.val-child-forum-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    color: var(--muted-color);
    font-size: 25px;
    font-weight: 300;
    line-height: 1;
    transform: translateY(-52%);
}

@media (max-width: 767px) {
    .val-child-forums {
        margin: 14px 10px 28px;
    }

    .val-child-forums-title {
        font-size: 20px;
    }

    .val-child-forums-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .val-child-forum-card {
        min-height: 72px;
        padding: 12px 40px 12px 16px;
    }
}

/* Badges utilisateur : même disposition à droite de l’avatar sur mobile */
@media (max-width: 767.98px) {
    .PostUser-badges {
        position: absolute;
        top: -12px;
        left: 28px;
        width: 22px;
        height: 36px;
    }

    .PostUser-badges > li {
        position: absolute;
        right: 0;
        margin: 0 !important;
        z-index: 2;
    }

    .PostUser-badges > li:nth-child(1) { top: -2px; }
    .PostUser-badges > li:nth-child(2) { top: 11px; }
    .PostUser-badges > li:nth-child(3) { top: 24px; }

    /* Réserver la place des badges sans déplacer l'avatar.
       La marge appartient seulement au texte du pseudo ;
       sa largeur supplémentaire repousse aussi naturellement la date. */
    .PostUser-name .username {
        margin-left: 24px;
    }
}

/* =========================
   Footer VAL
   ========================= */

.val-forum-footer {
    max-width: 1100px;
    margin: 42px auto 18px;
    padding: 16px 20px 0;

    border-top: 1px solid var(--control-bg);

    color: var(--muted-color);
    font-size: 13px;
    text-align: center;
}

.val-forum-footer-main {
    margin-bottom: 7px;
}

.val-forum-footer a {
    color: var(--link-color);
    font-weight: 500;
    text-decoration: none;
}

.val-forum-footer a:hover,
.val-forum-footer a:focus {
    text-decoration: none;
    opacity: .8;
}

.val-forum-footer-sep {
    margin: 0 8px;
}

.val-forum-footer-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 18px;

    font-size: 12px;
}

@media (max-width: 767px) {
    .val-forum-footer {
        margin-top: 10px;
        padding: 14px 12px 0;
    }

    .val-forum-footer-main .val-forum-footer-label {
        display: none;
    }

    .val-forum-footer-main .val-forum-footer-sep {
        display: inline;
        margin: 0 6px;
    }

    .val-forum-footer-stats {
        gap: 5px 12px;
    }
}

@media (min-width: 768px) {

    .PostUser-badges {
        position: relative;
        width: 64px;
        height: 64px;
        margin-left: calc(5px - var(--avatar-column-width));
        margin-top: -3px;
        float: left;
    }

    .PostUser-badges > li {
        position: absolute;
        right: -5px;
        margin: 0 !important;
        z-index: 2;
    }

    .PostUser-badges > li:nth-child(1) {
        top: -3px;
    }

    .PostUser-badges > li:nth-child(2) {
        top: 19px;
    }

    .PostUser-badges > li:nth-child(3) {
        top: 41px;
    }

    .PostUser-badges > li:nth-child(n+4) {
        display: none;
    }
}

@media (max-width: 767px) {

    /* La liste reprend des marges normales */
    .TagTiles {
        margin: 0;
        gap: 12px;
        overflow: visible;
    }

    /* Plus de hauteur fixe de 200 px */
    .TagTiles > li {
        height: auto;
        min-height: 0;
        min-width: 0 !important;
        border: 1px solid var(--control-bg);
        border-radius: 8px;
        overflow: hidden;
    }

    /* Carte plus compacte */
    .TagTile-info {
        padding: 16px;
        gap: 12px;
        overflow: hidden;
        min-width: 0;
    }

    .TagTile-name {
        font-size: 18px;
        line-height: 1.25;
    }

    .TagTile-description {
        font-size: 14px;
        line-height: 1.45;
    }

    /*
     * Sous-étiquettes :
     * chaque lien devient une vraie cible tactile.
     */
    .TagTile-children {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        min-width: 0;
        font-size: 14px;
        font-weight: 600;
    }

    .TagTile-children a {
        display: flex;
        align-items: center;
        min-width: 0;
        min-height: 44px;
        margin: 0 !important;
        padding: 7px 10px;
        box-sizing: border-box;
        border-radius: 6px;
        background: var(--control-bg);
        text-decoration: none !important;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    /*
     * Les cartes comportant beaucoup de sous-étiquettes
     * passent automatiquement en 2 colonnes.
     * Typiquement : "Petits forums".
     */
    .TagTile-children:has(a:nth-child(8)) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .TagTile-children:has(a:nth-child(8)) a {
        font-size: 13px;
    }

    /* Le dernier sujet prend moins de place */
    .TagTile-lastPostedDiscussion {
        height: auto;
        min-height: 40px;
        margin: 0 16px;
        padding: 9px 0;
    }
}

@media (min-width: 768px) {

    .TagTile-info {
        padding: 20px 22px 16px;
        gap: 12px;
    }

    .TagTile-name {
        margin-bottom: 2px;
        font-size: 19px;
        line-height: 1.25;
    }

    .TagTile-description {
        margin-bottom: 4px;
        line-height: 1.45;
    }

    .TagTile-children {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px 8px;
        margin-top: 3px;
    }

    .TagTile-children a {
        display: flex;
        align-items: center;
        min-height: 30px;
        margin: 0 !important;
        padding: 4px 8px;
        border-radius: 5px;
        background: rgba(255, 255, 255, .14);
        line-height: 1.25;
        text-decoration: none !important;
    }

    .TagTile-lastPostedDiscussion {
        margin: 4px 22px 0;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, .18);
    }
}

@media (max-width: 767px) {

    .TagsPage .TagTiles {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}


/* =========================================================
   PAGE ÉTIQUETTES — GRILLE COMMUNE À TOUS LES THÈMES
   ========================================================= */

.TagsPage .TagTiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    border: 0;
    overflow: visible;
}

.TagsPage .TagTile {
    width: auto !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
}

.TagsPage .TagTile-children,
.TagsPage .TagTile-info,
.TagsPage .TagTile-lastPostedDiscussion {
    border-top: 0 !important;
}

.TagsPage .TagTile-children {
    margin-top: 12px;
    padding-top: 0;
}

@media (max-width: 1000px) {
    .TagsPage .TagTiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .TagsPage .TagTiles {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* =========================================================
   PAGE ÉTIQUETTES — HAUTEUR MAXIMALE DES CARTES (PC UNIQUEMENT)
   ========================================================= */
@media (min-width: 768px) {
    /* Spécificité volontairement suffisante pour remplacer les anciennes
       règles de thème qui forçaient overflow: visible !important. */
    html[data-theme] body .TagsPage .TagTile-info {
        height: auto !important;
        min-height: 0 !important;
        max-height: 450px;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}
@media (max-width: 767.98px) {
    .val-forum-footer-main a:last-child {
        display: inline-block;
        white-space: nowrap;
    }
}


.val-forum-footer-copyright {
    margin-top: 7px;
    color: var(--muted-color);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 767px) {
    .val-forum-footer-copyright {
        margin-top: 5px;
        font-size: 10.5px;
    }
}
