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

:root {
    --bg-main: #12002b;
    --bg-card: #ffffff;
    --accent: #8f5cff;
    --text-main: #1f1f1f;
    --text-muted: #6b6b6b;
    --border-soft: rgba(0,0,0,0.06);
    
    --text-base: 1.1rem;
    --text-sm: 0.95rem;
    --text-xs: 0.85rem;
    --text-lg: 1.25rem;
}

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

body {
    font-family: 'Libre Baskerville', serif;
    font-size: var(--text-base);
    background: radial-gradient(circle at top, #2a0a5e, var(--bg-main));
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.7;
}

/* HEADER */
header {
    padding: 32px 20px 16px;
    text-align: center;
}

.logo {
    font-family: 'Georgia', serif;
    font-size: 2.2rem;
    letter-spacing: 2px;
    color: white;
    text-decoration: none;
}

/* HERO */
.hero {
    text-align: center;
    padding: 24px 20px 20px;
}

.hero h1 {
    font-size: 2.4rem;
    margin-bottom: 10px;
    color: white;
    word-wrap: break-word;
}

.hero p {
    font-size: var(--text-base);
    color: #d7ccff;
}

/* CARD */
.card {
    max-width: 760px;
    margin: 30px auto 50px;
    background: var(--bg-card);
    border-radius: 18px;
    padding: 48px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}

/* STORY LIST */
.story-list a {
    display: block;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: var(--text-main);
}

.story-list a:last-child {
    border-bottom: none;
}

.story-title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.story-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* STORY PAGE */
.story-content {
    line-height: 1.85;
    font-size: var(--text-lg);
}

.story-content p {
    margin-bottom: 1.5em;
}

.story-content h2 {
    font-size: 1.6rem;
    margin: 2em 0 1em;
}

.story-content h3 {
    font-size: 1.4rem;
    margin: 1.8em 0 0.8em;
}

.story-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.5em 0;
    padding: 0.5em 1.2em;
    background: #f8f6ff;
    font-style: italic;
}

.back-link {
    display: inline-block;
    margin-bottom: 32px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #f3efff;
    color: #5a32b6;
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
}

.back-link:hover {
    background: #e6ddff;
}

/* INTERNAL LINKS */
.internal-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
}

.internal-link:hover {
    color: #5a32b6;
    border-bottom-color: #5a32b6;
}

/* ENTITY PAGE */
.entity-type {
    text-align: center;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #d7ccff;
    margin-bottom: 8px;
}

.entity-content {
    font-size: var(--text-base);
    line-height: 1.8;
}

.entity-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 20px;
    background: #f8f6ff;
    border-radius: 12px;
    margin-bottom: 24px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Permet le word-wrap dans les grilles */
}

.meta-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.meta-value {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-main);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.entity-body p {
    margin-bottom: 1.4em;
}

.entity-body h2 {
    font-size: 1.4rem;
    margin: 2em 0 0.8em;
}

.entity-body h3 {
    font-size: 1.2rem;
    margin: 1.6em 0 0.6em;
}

/* RELATED STORIES */
.related-stories {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-soft);
}

.related-stories h3 {
    font-size: var(--text-base);
    margin-bottom: 16px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f6ff;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-size: var(--text-sm);
    gap: 12px;
}

.related-item:hover {
    background: #ebe6ff;
}

.related-title {
    font-weight: 600;
}

.related-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* STORY NAVIGATION */
.story-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-soft);
}

.story-nav-link {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #f8f6ff;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    max-width: 48%;
    min-width: 0;
}

.story-nav-link:hover {
    background: #ebe6ff;
}

.story-nav-link--next {
    text-align: right;
    margin-left: auto;
}

.nav-direction {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nav-title {
    font-size: var(--text-sm);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-nav-placeholder {
    flex: 1;
}

/* CONTACT FORM */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    font-family: 'Libre Baskerville', serif;
    font-size: var(--text-base);
    padding: 14px 16px;
    border: 2px solid #e8e4f0;
    border-radius: 10px;
    background: white;
    color: var(--text-main);
}

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

.form-input::placeholder,
.form-textarea::placeholder {
    color: #a9a0b8;
}

.form-textarea {
    resize: vertical;
    min-height: 140px;
}

.btn {
    font-family: 'Libre Baskerville', serif;
    font-size: var(--text-base);
    font-weight: 600;
    padding: 16px 28px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.btn--primary {
    background: var(--accent);
    color: white;
}

.btn--primary:hover {
    background: #7a47e6;
}

.btn--full {
    width: 100%;
}

/* ALERTS */
.alert {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: var(--text-sm);
}

.alert--success {
    background: #e8f5e9;
    color: #2e7d32;
}

.alert--error {
    background: #ffebee;
    color: #c62828;
}

.alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: var(--text-sm);
}

.alert--success .alert-icon {
    background: #4caf50;
    color: white;
}

.alert--error .alert-icon {
    background: #e53935;
    color: white;
}

.alert-content strong {
    display: block;
    margin-bottom: 4px;
}

.alert-content p {
    margin: 0;
}

/* 404 PAGE */
.text-center {
    text-align: center;
}

.error-illustration {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-message {
    font-size: var(--text-base);
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* FOOTER */
footer {
    text-align: center;
    padding: 40px 20px;
    color: #cfc3ff;
    font-size: var(--text-sm);
}

footer a {
    color: #cfc3ff;
    text-decoration: none;
}

footer a:hover {
    color: white;
}

.footer-links {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-separator {
    color: #8a7cb8;
}

/* ============================================
   RESPONSIVE - TABLET (768px et moins)
============================================ */
@media (max-width: 768px) {
    :root {
        --text-base: 1rem;
        --text-sm: 0.9rem;
        --text-xs: 0.8rem;
        --text-lg: 1.1rem;
    }
    
    header {
        padding: 24px 16px 12px;
    }
    
    .logo {
        font-size: 1.8rem;
    }
    
    .hero {
        padding: 16px 16px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .card {
        margin: 20px 16px 40px;
        padding: 32px 24px;
        border-radius: 14px;
    }
    
    .story-nav {
        flex-direction: column;
        gap: 12px;
    }
    
    .story-nav-link {
        max-width: 100%;
    }
    
    .story-nav-link--next {
        text-align: left;
    }
    
    .entity-meta-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 16px;
    }
    
    .meta-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .meta-value {
        line-height: 1.4;
        word-break: break-word;
    }
    
    .related-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .related-meta {
        white-space: normal;
    }
}

/* ============================================
   RESPONSIVE - MOBILE (480px et moins)
============================================ */
@media (max-width: 480px) {
    :root {
        --text-base: 0.95rem;
        --text-sm: 0.85rem;
        --text-xs: 0.75rem;
        --text-lg: 1.05rem;
    }
    
    header {
        padding: 20px 12px 10px;
    }
    
    .logo {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .hero {
        padding: 12px 12px 16px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero p {
        font-size: var(--text-sm);
    }
    
    .card {
        margin: 12px 10px 30px;
        padding: 24px 18px;
        border-radius: 12px;
    }
    
    .back-link {
        padding: 8px 14px;
        margin-bottom: 24px;
        font-size: var(--text-xs);
    }
    
    .story-list a {
        padding: 14px 0;
    }
    
    .story-title {
        font-size: var(--text-base);
    }
    
    .story-content {
        font-size: var(--text-base);
        line-height: 1.75;
    }
    
    .story-content p {
        margin-bottom: 1.3em;
    }
    
    .entity-meta-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }
    
    .meta-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .meta-value {
        text-align: left;
        word-break: break-word;
        line-height: 1.35;
    }
    
    .story-nav-link {
        padding: 14px;
    }
    
    .form-input,
    .form-textarea {
        padding: 12px 14px;
        font-size: var(--text-sm);
    }
    
    .btn {
        padding: 14px 20px;
        font-size: var(--text-sm);
    }
    
    .alert {
        padding: 16px;
        gap: 12px;
    }
    
    footer {
        padding: 30px 16px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-separator {
        display: none;
    }
}

/* ============================================
   RESPONSIVE - TRÈS PETIT ÉCRAN (320px et moins)
============================================ */
@media (max-width: 320px) {
    .logo {
        font-size: 1.3rem;
    }
    
    .hero h1 {
        font-size: 1.3rem;
    }
    
    .card {
        margin: 10px 8px 24px;
        padding: 20px 14px;
    }
}
