/* =========================================
   TIME CAPSULE 4.0
   PREMIUM FUTURISTIC DESIGN
   ========================================= */


/* =========================================
   1. VARIABLES ET COULEURS
   ========================================= */

:root {

    --background: #070b17;
    --surface: #101827;
    --surface-light: #182235;

    --text: #f4f7ff;
    --text-secondary: #94a3b8;

    --primary: #8b5cf6;
    --secondary: #06b6d4;

    --border: rgba(255, 255, 255, 0.09);

    --radius: 22px;

    --shadow:
        0 18px 50px rgba(0, 0, 0, 0.25);

    --transition:
        all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);

}

body > h2 {
    text-align: center;
}

/* =========================================
   2. RESET
   ========================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {

    margin: 0;
    padding: 40px 5% 100px;

    min-height: 100vh;

    font-family:
        "Segoe UI",
        Inter,
        system-ui,
        sans-serif;

    color: var(--text);

    background: var(--background);

    overflow-x: hidden;

}


/* =========================================
   3. ARRIÈRE-PLAN FUTURISTE
   ========================================= */

/*
   Plusieurs dégradés créent des halos
   lumineux sans utiliser d'images.
*/

body {

    background-image:

        radial-gradient(
            ellipse at 15% 5%,
            rgba(139, 92, 246, 0.16),
            transparent 35%
        ),

        radial-gradient(
            ellipse at 85% 25%,
            rgba(6, 182, 212, 0.12),
            transparent 35%
        ),

        radial-gradient(
            ellipse at 50% 95%,
            rgba(59, 130, 246, 0.10),
            transparent 40%
        ),

        linear-gradient(
            180deg,
            #080d1b,
            #080e1c 50%,
            #050914
        );

    background-attachment: fixed;

}


/* Petits points lumineux décoratifs */

body::before {

    content: "";

    position: fixed;

    inset: 0;

    pointer-events: none;

    z-index: -1;

    opacity: 0.35;

    background-image:
        radial-gradient(
            rgba(255,255,255,0.35) 0.6px,
            transparent 0.6px
        );

    background-size: 45px 45px;

}


/* =========================================
   4. TITRES PRINCIPAUX
   ========================================= */

h1 {

    text-align: center;

    font-size: clamp(
        42px,
        6vw,
        76px
    );

    font-weight: 800;

    letter-spacing: -3px;

    margin: 35px 0 15px;

    line-height: 1.1;

    background: linear-gradient(
        120deg,
        #ffffff 15%,
        #b4a2ff 50%,
        #67e8f9 85%
    );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;

}


/* Sous-titres */

body > p {

    color: var(--text-secondary);

    text-align: center;

    font-size: 17px;

    line-height: 1.7;

}


/* =========================================
   5. CHAMP DE DATE
   ========================================= */

input[type="date"] {

    display: block;

    width: min(100%, 360px);

    margin: 30px auto 18px;

    padding: 18px 22px;

    font-size: 16px;
    font-family: inherit;

    color: white;

    background:
        rgba(255, 255, 255, 0.055);

    border:
        1px solid rgba(255,255,255,0.16);

    border-radius: 16px;

    outline: none;

    transition: var(--transition);

    box-shadow:
        0 10px 35px rgba(0,0,0,0.12);

}


/* Effet lorsque l'utilisateur clique */

input[type="date"]:focus {

    border-color: var(--primary);

    box-shadow:

        0 0 0 4px rgba(
            139, 92, 246, 0.12
        ),

        0 10px 30px rgba(
            139, 92, 246, 0.12
        );

    background:
        rgba(255,255,255,0.09);

}


/* Icône calendrier */

input[type="date"]::-webkit-calendar-picker-indicator {

    cursor: pointer;

    filter: invert(1);

    opacity: 0.8;

}


/* =========================================
   6. BOUTON PRINCIPAL
   ========================================= */

#bouton {

    display: block;

    margin: 0 auto 65px;

    padding: 18px 42px;

    border: none;

    border-radius: 15px;

    color: white;

    font-family: inherit;

    font-size: 16px;

    font-weight: 700;

    letter-spacing: 0.3px;

    cursor: pointer;

    background: linear-gradient(
        135deg,
        #8b5cf6,
        #6366f1,
        #2563eb
    );

    box-shadow:

        0 10px 30px rgba(
            99, 102, 241, 0.3
        ),

        inset 0 1px 0 rgba(
            255,255,255,0.25
        );

    transition: var(--transition);

}


/* Animation du bouton */

#bouton:hover {

    transform: translateY(-4px);

    box-shadow:

        0 18px 45px rgba(
            99, 102, 241, 0.45
        );

    filter: brightness(1.1);

}

#bouton:active {

    transform: scale(0.97);

}

#bouton:focus-visible {

    outline: 3px solid #67e8f9;

    outline-offset: 4px;

}


/* =========================================
   7. CONTENEUR PRINCIPAL
   ========================================= */

#results {

    max-width: 1500px;

    margin: 0 auto;

    position: relative;

}


/* Petite étiquette au-dessus du titre */

#results::before {

    content: "✦ EXPLORE THE PAST ✦";

    display: block;

    width: fit-content;

    margin: 0 auto 24px;

    padding: 9px 20px;

    border-radius: 100px;

    font-size: 11px;

    font-weight: 800;

    letter-spacing: 3px;

    color: #c4b5fd;

    background:
        rgba(139,92,246,0.11);

    border:
        1px solid rgba(
            139,92,246,0.25
        );

}

/* L'étiquette n'apparaît que si les
   résultats contiennent une capsule. */

#results:empty::before {
    display: none;
}


/* Titre de la capsule */

#results > h2 {

    font-size: clamp(
        30px,
        4vw,
        52px
    );

    font-weight: 800;

    text-align: center;

    letter-spacing: -1.5px;

    margin-bottom: 15px;

    background: linear-gradient(
        90deg,
        white,
        #c4b5fd,
        #67e8f9
    );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;

}


/* Texte sous la date */

.intro {

    text-align: center;

    font-size: 17px;

    color: var(--text-secondary);

    margin-bottom: 55px;

    line-height: 1.7;

}


/* =========================================
   8. GRILLE DES 17 RUBRIQUES
   ========================================= */

/*
   Une grille de 12 colonnes permet
   plusieurs tailles de cartes.

   4 colonnes = carte normale
   8 colonnes = grande carte
*/

.capsule-grid {

    display: grid;

    grid-template-columns:
        repeat(12, minmax(0, 1fr));

    gap: 24px;

    align-items: stretch;

}


/* =========================================
   9. DESIGN DES CARTES
   ========================================= */

.capsule-card {

    --accent: #8b5cf6;

    grid-column: span 4;

    min-width: 0;

    position: relative;

    overflow: hidden;

    padding: 28px;

    border-radius: var(--radius);

    background: linear-gradient(

        145deg,

        rgba(30, 41, 59, 0.90),

        rgba(12, 19, 35, 0.95)

    );

    border:
        1px solid var(--border);

    box-shadow: var(--shadow);

    backdrop-filter: blur(18px);

    -webkit-backdrop-filter: blur(18px);

    transition: var(--transition);

    animation:
        cardAppear 0.65s ease both;

}


/* Petite ligne lumineuse en haut */

.capsule-card::before {

    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 3px;

    background: linear-gradient(

        90deg,

        transparent,

        var(--accent),

        transparent

    );

    opacity: 0.8;

}


/* Halo lumineux dans le coin */

.capsule-card::after {

    content: "";

    position: absolute;

    width: 180px;
    height: 180px;

    right: -95px;
    top: -95px;

    border-radius: 50%;

    background: var(--accent);

    opacity: 0.055;

    filter: blur(45px);

    pointer-events: none;

}


/* Animation au survol */

.capsule-card:hover {

    transform: translateY(-7px);

    border-color:
        color-mix(
            in srgb,
            var(--accent) 45%,
            transparent
        );

    box-shadow:

        0 25px 60px rgba(
            0,0,0,0.35
        ),

        0 0 30px color-mix(
            in srgb,
            var(--accent) 10%,
            transparent
        );

}


/* =========================================
   10. COULEURS PAR CATÉGORIE
   ========================================= */

/* Actualités : violet */

#tc-news {
    --accent: #a78bfa;
}

/* Histoire : orange */

#tc-events {
    --accent: #fb923c;
}

/* Naissances : rose */

#tc-births {
    --accent: #f472b6;
}

/* Décès : gris bleu */

#tc-deaths {
    --accent: #94a3b8;
}

/* Films : rouge */

#tc-movies {
    --accent: #fb7185;
}

/* Séries : violet */

#tc-tv {
    --accent: #c084fc;
}

/* Musique : vert */

#tc-music {
    --accent: #4ade80;
}

/* Livres : ambre */

#tc-books {
    --accent: #fbbf24;
}

/* Jeux vidéo : bleu électrique */

#tc-games {
    --accent: #38bdf8;
}

/* NASA : violet spatial */

#tc-nasa {
    --accent: #818cf8;
}

/* Météo : cyan */

#tc-weather {
    --accent: #22d3ee;
}

/* Population : vert turquoise */

#tc-population {
    --accent: #2dd4bf;
}

/* Économie : vert */

#tc-economy {
    --accent: #a3e635;
}

/* Taux de change : or */

#tc-currency {
    --accent: #facc15;
}

/* Sport : orange */

#tc-sports {
    --accent: #f97316;
}

/* Science : bleu */

#tc-science {
    --accent: #60a5fa;
}

/* Technologie : violet */

#tc-tech {
    --accent: #a78bfa;
}


/* =========================================
   11. CARTES PLUS GRANDES
   ========================================= */

/*
   Les sections les plus visuelles
   occupent davantage d'espace.
*/

/* Actualités */

#tc-news {

    grid-column: span 8;

    background: linear-gradient(
        145deg,
        #201938,
        #111827
    );

}


/* NASA */

#tc-nasa {

    grid-column: span 8;

    background: linear-gradient(
        145deg,
        #181b40,
        #0c1225
    );

}


/* Films */

#tc-movies {

    grid-column: span 8;

    background: linear-gradient(
        145deg,
        #2a1929,
        #111827
    );

}


/* =========================================
   12. TITRES DES CARTES
   ========================================= */

.capsule-card h3 {

    position: relative;

    z-index: 1;

    display: flex;

    align-items: center;

    gap: 10px;

    margin: 0 0 25px;

    padding-bottom: 18px;

    border-bottom:
        1px solid rgba(
            255,255,255,0.08
        );

    font-size: 19px;

    font-weight: 750;

    letter-spacing: -0.4px;

    color: white;

}


/* Titres plus visibles au survol */

.capsule-card:hover h3 {

    color: var(--accent);

}


/* =========================================
   13. TEXTE DES CARTES
   ========================================= */

.capsule-card p {

    color: #cbd5e1;

    font-size: 14px;

    line-height: 1.8;

    margin: 0 0 15px;

}

.capsule-card strong {

    color: white;

    font-weight: 700;

}

.capsule-card small {

    display: block;

    margin-top: 20px;

    font-size: 12px;

    line-height: 1.7;

    color: #8492a9;

}


/* =========================================
   14. LISTES PLUS ÉLÉGANTES
   ========================================= */

.capsule-card ul,
.capsule-card ol {

    list-style: none;

    margin: 0;

    padding: 0;

    display: flex;

    flex-direction: column;

    gap: 12px;

}


/* Chaque élément devient une mini-carte */

.capsule-card li {

    position: relative;

    padding: 15px 17px 15px 23px;

    border-radius: 12px;

    background:
        rgba(255,255,255,0.035);

    border:
        1px solid rgba(
            255,255,255,0.045
        );

    font-size: 13px;

    line-height: 1.7;

    color: #d1d9e6;

    transition: var(--transition);

}


/* Petite barre colorée */

.capsule-card li::before {

    content: "";

    position: absolute;

    top: 14px;
    bottom: 14px;
    left: 0;

    width: 3px;

    border-radius: 3px;

    background: var(--accent);

}


/* Animation des éléments */

.capsule-card li:hover {

    background:
        rgba(255,255,255,0.075);

    transform: translateX(4px);

}


/* =========================================
   15. FILMS, LIVRES ET SÉRIES
   ========================================= */

.capsule-media {

    display: flex;

    align-items: center;

    gap: 18px;

    margin-bottom: 15px;

    padding: 14px;

    border-radius: 14px;

    background:
        rgba(255,255,255,0.035);

    border:
        1px solid rgba(
            255,255,255,0.05
        );

    transition: var(--transition);

}

.capsule-media:hover {

    background:
        rgba(255,255,255,0.07);

    transform: translateX(5px);

}


/* Affiches de films */

.capsule-media img {

    width: 85px;

    height: 125px;

    flex-shrink: 0;

    object-fit: cover;

    border-radius: 10px;

    box-shadow:
        0 8px 25px rgba(
            0,0,0,0.4
        );

}


/* Texte à côté de l'affiche */

.capsule-media p {

    margin: 0;

    font-size: 14px;

    line-height: 1.8;

}


/* =========================================
   16. NASA : GRANDE IMAGE
   ========================================= */

#tc-nasa .capsule-large {

    display: block;

    width: 100%;

    max-height: 450px;

    object-fit: contain;

    border-radius: 16px;

    margin: 22px 0;

    background: #050816;

    box-shadow:

        0 15px 40px rgba(
            0,0,0,0.35
        );

}


/* =========================================
   17. LIENS
   ========================================= */

.capsule-card a {

    display: inline-flex;

    align-items: center;

    gap: 8px;

    margin-top: 8px;

    color: var(--accent);

    font-size: 13px;

    font-weight: 700;

    text-decoration: none;

    transition: var(--transition);

}

.capsule-card a:hover {

    color: white;

    text-decoration: underline;

}


/* =========================================
   18. ANIMATION DE CHARGEMENT
   ========================================= */

.chargement {

    position: relative;

    overflow: hidden;

    padding: 20px;

    border-radius: 12px;

    color: #94a3b8;

    background: linear-gradient(

        90deg,

        rgba(255,255,255,0.03) 25%,

        rgba(255,255,255,0.09) 50%,

        rgba(255,255,255,0.03) 75%

    );

    background-size: 200% 100%;

    animation:
        shimmer 1.7s infinite linear;

}


/* Animation du chargement */

@keyframes shimmer {

    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }

}


/* =========================================
   19. ANIMATION D'APPARITION
   ========================================= */

@keyframes cardAppear {

    from {

        opacity: 0;

        transform: translateY(25px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}


/* Apparition progressive des cartes */

.capsule-card:nth-child(1) {
    animation-delay: 0.05s;
}

.capsule-card:nth-child(2) {
    animation-delay: 0.10s;
}

.capsule-card:nth-child(3) {
    animation-delay: 0.15s;
}

.capsule-card:nth-child(4) {
    animation-delay: 0.20s;
}

.capsule-card:nth-child(5) {
    animation-delay: 0.25s;
}

.capsule-card:nth-child(6) {
    animation-delay: 0.30s;
}

.capsule-card:nth-child(7) {
    animation-delay: 0.35s;
}


/* =========================================
   20. TABLETTES
   ========================================= */

@media (max-width: 1100px) {

    .capsule-grid {

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 20px;

    }


    .capsule-card {

        grid-column: span 1;

    }


    /* Grandes cartes */

    #tc-news,
    #tc-movies,
    #tc-nasa {

        grid-column: span 2;

    }

}


/* =========================================
   21. TÉLÉPHONES
   ========================================= */

@media (max-width: 700px) {

    body {

        padding:
            25px 16px 60px;

    }


    h1 {

        font-size: 40px;

        letter-spacing: -1.5px;

    }


    #results > h2 {

        font-size: 30px;

    }


    .capsule-grid {

        grid-template-columns: 1fr;

        gap: 18px;

    }


    /* Toutes les cartes sur une colonne */

    .capsule-card,
    #tc-news,
    #tc-movies,
    #tc-nasa {

        grid-column: 1 / -1;

    }


    .capsule-card {

        padding: 22px;

        border-radius: 18px;

    }


    #bouton {

        width: min(100%, 360px);

        padding: 18px;

    }


    .capsule-card h3 {

        font-size: 18px;

    }


    .capsule-media img {

        width: 70px;

        height: 105px;

    }

}


/* =========================================
   22. ACCESSIBILITÉ
   ========================================= */

/*
   Désactive les animations pour les
   utilisateurs ayant demandé une
   réduction des mouvements.
*/

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;

        scroll-behavior: auto !important;

    }

}


/* =========================================
   FIN DU CSS
   ========================================= */