/* ========================================
   STYLES POUR LES CARTES DE POÈMES
   Composant réutilisable utilisé sur :
   - Page d'accueil (home/index.html.twig)
   - Page auteur (author/show.html.twig)
   - Page tous les poèmes (poem/all.html.twig)
   ======================================== */

/* --- Élément de liste (poem-item) --- */
.poem-item {
    list-style: none;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.poem-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.poem-item.hidden {
    display: none;
}

/* Effet domino : délais progressifs pour chaque poème */
.poem-item:nth-child(1) { transition-delay: 0.1s; }
.poem-item:nth-child(2) { transition-delay: 0.2s; }
.poem-item:nth-child(3) { transition-delay: 0.3s; }
.poem-item:nth-child(4) { transition-delay: 0.4s; }
.poem-item:nth-child(5) { transition-delay: 0.5s; }
.poem-item:nth-child(6) { transition-delay: 0.6s; }
.poem-item:nth-child(7) { transition-delay: 0.7s; }
.poem-item:nth-child(8) { transition-delay: 0.8s; }
.poem-item:nth-child(9) { transition-delay: 0.9s; }
.poem-item:nth-child(10) { transition-delay: 1s; }

@media (prefers-reduced-motion: reduce) {
    .poem-item {
        transform: none;
        transition: opacity 0.3s ease;
        transition-delay: 0s !important;
    }
    .poem-item.visible {
        transform: none;
    }
}

/* --- Lien/Carte de poème (poem-link) --- */
.poem-link {
    display: block;
    position: relative;
    padding: 1.5rem 1.75rem;
    background: rgba(250, 247, 242, 0.5);
    border: 1px solid rgba(224, 214, 202, 0.35);
    border-radius: 8px;
    /* Ombre extrêmement diffuse */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    /* Texte sélectionnable */
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Mode nuit : fond sombre */
html:not(.day-mode) .poem-link {
    background: var(--bg-night);
    border-color: rgba(224, 214, 202, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html:not(.day-mode) .poem-link::before {
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(231, 231, 231, 0.015) 2px,
        rgba(231, 231, 231, 0.015) 4px
    );
}

/* Contenu de la carte (au-dessus de l'effet papier) */
.poem-link > * {
    position: relative;
    z-index: 1;
}

/* Hover : surélévation légère avec ombre très légère */
.poem-link:hover {
    background: rgba(245, 240, 232, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

html:not(.day-mode) .poem-link:hover {
    background: rgba(20, 23, 28, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* --- Titre du poème (ancrage visuel) --- */
.poem-link-title {
    display: block;
    font-family: 'Crimson Pro', 'Lora', 'Georgia', serif;
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    /* Pas de guillemets, jamais en capitales */
    text-transform: none;
    letter-spacing: normal;
}

html:not(.day-mode) .poem-link-title {
    color: var(--text-night);
}

.poem-link-title:hover {
    text-decoration: none;
    color: inherit;
}

/* --- Auteur (signature discrète) --- */
.poem-link-author {
    font-family: 'Crimson Pro', 'Lora', 'Georgia', serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.poem-link-author-name {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

/* Hover très léger : soulignement fin */
.poem-link-author-name:hover {
    border-bottom-color: var(--text-secondary);
}

/* --- Extrait (cœur émotionnel) --- */
.poem-link-summary {
    font-family: 'Lora', 'Georgia', serif;
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    /* 2 lignes max avec coupe franche (pas de "...") */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Interlignage confortable */
    max-height: calc(1.7em * 2);
}

/* --- Métadonnées (vers_count, form) - optionnel --- */
.poem-link-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-placeholder);
    font-style: italic;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.poem-meta-item {
    font-style: italic;
}

/* --- Année (repère silencieux en bas) --- */
.poem-link-year {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.75rem;
    color: var(--text-placeholder);
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 0.5rem;
    /* Placée en bas, alignée à gauche */
    text-align: left;
    opacity: 0.7;
}

/* --- Tags (optionnel) --- */
.poem-link-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.poem-tag {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-button);
    font-family: 'Lora', serif;
    display: inline-block;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    background: rgba(231, 231, 231, 0.02);
}

.poem-tag-not-clickable {
    cursor: default;
    pointer-events: none;
}

html.day-mode .poem-tag {
    background: rgba(26, 26, 26, 0.02);
}

.poem-tag:hover {
    color: var(--text-primary);
    border-color: var(--border-button);
    background: rgba(231, 231, 231, 0.04);
}

html.day-mode .poem-tag:hover {
    background: var(--bg-button-hover);
}

/* Structure interne : ordre strict */
.poem-link {
    display: flex;
    flex-direction: column;
}

/* S'assurer que la date est toujours en bas */
.poem-link-year {
    margin-top: auto;
}

/* Accessibilité : contraste WCAG AA vérifié pour tous les éléments */

/* Responsive : ajustements pour petits écrans */
@media (max-width: 768px) {
    .poem-link {
        padding: 1.25rem 1.5rem;
    }
    
    .poem-link-title {
        font-size: 1rem;
    }
    
    .poem-link-author {
        font-size: 0.85rem;
    }
    
    .poem-link-summary {
        font-size: 0.9rem;
    }
}
