/* ---------------------------------------------------------
   style.css - Design custom (sans Bootstrap) pour l'accueil
   Les pages liste.php / episodes.php utilisent encore Bootstrap
   pour le moment ; ces classes leur restent compatibles.
   --------------------------------------------------------- */

:root {
    --bg: #12141a;
    --surface: #1a1d24;
    --surface-hover: #20232c;
    --border: #262a33;
    --text: #e8eaed;
    --text-muted: #8a8f9c;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    margin: 0;
}

/* ---------- Header / Navigation ---------- */

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.brand span {
    color: var(--text-muted);
    font-weight: 500;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.main-nav-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.main-nav-link.is-active {
    background: var(--surface);
    color: var(--text);
}

/* ---------- Layout général ---------- */

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 18px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------- Hero ---------- */

.hero {
    text-align: center;
    padding: 20px 0 56px;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 12px;
}

.hero-figure {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 700;
    margin: 0;
    line-height: 1;
    background: linear-gradient(180deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-label {
    color: var(--text-muted);
    margin: 8px 0 0;
    font-size: 1rem;
}

/* ---------- Barre de composition (signature) ---------- */

.composition {
    margin-bottom: 56px;
}

.comp-bar {
    display: flex;
    width: 100%;
    height: 14px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.comp-segment {
    height: 100%;
    transition: width 0.6s ease;
}

.comp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 16px;
}

.comp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.comp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comp-legend-label {
    color: var(--text);
}

.comp-legend-pct {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ---------- Cartes catégories ---------- */

.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.cat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent, var(--border));
    background: var(--surface-hover);
}

.cat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.cat-card-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.cat-card-pct {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent, var(--text-muted));
}

.cat-card-count {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.cat-card-track {
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.cat-card-fill {
    height: 100%;
    background: var(--accent, var(--text-muted));
    border-radius: 999px;
}

/* ---------------------------------------------------------
   liste.php - Barre de recherche, fiches, toggle grille/liste
   --------------------------------------------------------- */

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.list-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.list-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.view-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.view-btn:hover {
    color: var(--text);
}

.view-btn.is-active {
    background: var(--surface-hover);
    color: var(--accent, var(--text));
}

/* Barre de recherche */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.search-input {
    flex: 1;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent, var(--text-muted));
}

.search-btn {
    background: var(--accent, #5b8def);
    color: #0d0e12;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.search-clear {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0 8px;
}

.search-clear:hover {
    color: var(--text);
}

.empty-state {
    color: var(--text-muted);
    padding: 40px 0;
    text-align: center;
}

/* Grille de fiches */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.item-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent, var(--border));
}

.item-poster {
    aspect-ratio: 2 / 3;
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent, #5b8def) 35%, var(--surface)), var(--surface));
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-initial {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--accent, var(--text));
    opacity: 0.85;
}

.item-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    /* Limite le titre à 2 lignes proprement */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-action {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent, var(--text-muted));
}

/* Vue liste : fiches en lignes horizontales */
.item-grid.is-list {
    grid-template-columns: 1fr;
    max-width: 640px;
}

.item-grid.is-list .item-card {
    flex-direction: row;
    align-items: center;
}

.item-grid.is-list .item-poster {
    width: 56px;
    height: 56px;
    aspect-ratio: unset;
    flex-shrink: 0;
}

.item-grid.is-list .item-initial {
    font-size: 1.3rem;
}

.item-grid.is-list .item-info {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    padding: 10px 16px;
}

.item-grid.is-list .item-name {
    -webkit-line-clamp: 1;
}

/* ---------------------------------------------------------
   episodes.php - Fiche détail, liens d'info, inventaire épisodes
   --------------------------------------------------------- */

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 24px;
}

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

.fiche-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.fiche-poster {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent, #5b8def) 35%, var(--surface)), var(--surface));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fiche-poster .item-initial {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent, var(--text));
}

.fiche-title {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.info-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.info-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 999px;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.info-link:hover {
    border-color: var(--accent, var(--text-muted));
    color: var(--text);
}

.count-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.episode-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
}

.episode-badge {
    font-family: var(--font-mono);
    color: var(--accent, var(--text-muted));
    flex-shrink: 0;
    min-width: 60px;
}

.episode-file {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.file-name {
    font-weight: 500;
}

.file-meta {
    font-family: var(--font-mono);
    color: var(--accent, var(--text-muted));
    font-size: 0.8rem;
    text-transform: uppercase;
}

.file-path {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    word-break: break-all;
}

.season-block {
    margin-bottom: 32px;
}