/* Styles de base et Reset */
* {
    box-sizing: border-box; /* Empêche les marges de déborder de la largeur de l'écran */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #fff;
    color: #333;
}

/* 
 * LA CLASSE MAGIQUE POUR RECENTRER ET LIMITER LA LARGEUR
 * max-width limite la largeur sur PC.
 * margin: 0 auto centre le bloc.
 * padding garantit l'espace fixe sur les bords (sur mobile notamment).
 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 100px;
    width: 100%;
}

.text-center {
    text-align: center;
}

/* Header */
.main-header {
    background-color: #fff;
    padding: 60px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo {
    max-height: 156px;
}

/* Sous en-tête (Hero) */
.hero-section {
    background-color: #eef2f5;
    padding: 60px 0;
}

.hero-wrapper {
    display: flex;
    align-items: flex-start; /* aligne le texte en haut du container */
    justify-content: space-between; /* texte à gauche, image poussée à droite */
    gap: 20px; /* moins d'espace quand la fenêtre est large */
    position: relative;
    overflow: hidden; /* évite que des éléments (image) débordent horizontalement */
}

/* Texte du hero */
.hero-text {
    /* donner plus d'espace horizontal au texte pour éviter des retours ligne trop serrés */
    flex: 0 0 52%;
    max-width: 52%;
    min-width: 320px; /* Empêche la colonne texte d'être trop étroite */
    text-align: left;
    align-self: flex-start;
    z-index: 2;
}

/* Titres et paragraphes du hero */
.hero-text h1 {
    font-size: 2rem;
    line-height: 1.15;
    margin: 0 0 0.8rem 0;
}
.hero-text p {
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.hero-image {
    flex: 0 0 auto;
    margin-left: auto; /* pousse la colonne image vers la droite */
    display: flex;
    justify-content: flex-end; /* place l'image à l'extrémité droite de la colonne */
    align-items: flex-start;
    flex-basis: 35%;
    max-width: 320px;
    min-width: 220px;
}

.hero-image img {
    display: block;
    width: auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Widgets Applications */
.apps-section {
    padding: 50px 0;
}

.apps-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
}

.app-widget {
    /* fond légèrement plus foncé que le body pour contraste */
    background-color: #eef2f5; /* body: #f9f9f9, widget: légèrement foncé */
    padding: 30px;
    border-radius: 34px;
    width: 100%;
    max-width: 1000px; /* largeur max du widget */
    box-shadow: 0px 4px 8px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: stretch;
    position: relative;
    min-height: 260px; /* hauteur minimum pour que le carrousel soit visible */
}

.app-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.app-icon {
    width: 72px;
    height: 72px;
    border-radius: 12px;
}

.app-header h2 {
    margin: 0;
}

.store-links img {
    height: 64px; /* icônes plus grandes */
    margin-right: 10px;
    transition: transform 180ms ease;
}

.store-links img:hover {
    transform: scale(1.03);
}

/* Layout interne du widget : gauche = contenu, droite = carrousel */
.app-left {
    flex: 0 0 60%;
    max-width: 60%;
    position: relative;
    padding-right: 10px;
    /* laisser de l'espace en bas pour les boutons store (évite le chevauchement sur résolutions intermédiaires) */
    --store-links-height: 72px;
    padding-bottom: calc(var(--store-links-height) + 16px);
}

.app-right {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-right: 16px;
}

.app-gallery {
    display: flex;
    gap: 15px;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
}

.app-gallery img {
    flex: 0 0 100%; /* chaque image occupe toute la largeur de la colonne droite */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    scroll-snap-align: center;
}

/* Carousel styles */
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: pan-y; /* permet au JS de gérer le swipe horizontal, laisse le scroll vertical natif */
    border-radius: 12px; /* arrondi du carousel */
    overflow: hidden; /* masque le débordement pour respecter le border-radius */
}

/* --- Règles forcées pour garantir le gradient, le border-radius et l'affichage des contrôles --- */
.carousel {
    border-radius: 12px !important;
    overflow: hidden !important;
}

.carousel .carousel-button,
.carousel .carousel-dots {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 180ms ease, visibility 180ms ease !important;
    pointer-events: none !important;
}

.carousel:hover .carousel-button,
.carousel:focus-within .carousel-button,
.carousel:hover .carousel-dots,
.carousel:focus-within .carousel-dots {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.carousel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    background: linear-gradient( 0deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.51) 12.5%, rgba(0, 0, 0, 0.42) 25%, rgba(0, 0, 0, 0.31) 37.5%, rgba(0, 0, 0, 0.20) 50%, rgba(0, 0, 0, 0.11) 62.5%, rgba(0, 0, 0, 0.04) 75%, rgba(0, 0, 0, 0) 100% );
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease !important;
    z-index: 1 !important;
}

.carousel:hover::after,
.carousel:focus-within::after {
    opacity: 1 !important;
}

/* Afficher les contrôles sur les périphériques tactiles (pas de hover) */
@media (hover: none), (pointer: coarse) {
    .carousel .carousel-button,
    .carousel .carousel-dots {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    .carousel::after {
        opacity: 1 !important;
    }
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 400ms ease;
}

.slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none; /* empêche le drag natif de l'image */
    user-drag: none;
    user-select: none;
    pointer-events: none; /* laisse passer les clics vers les boutons et le container pour swipe */
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    font-size: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 110 !important;
    pointer-events: auto;
}

.carousel-button.prev { left: 12px; }
.carousel-button.next { right: 12px; }

/* Arrow images inside buttons */
.carousel-button .carousel-arrow {
    width: 24px;
    height: auto;
    display: block;
    pointer-events: none; /* let button receive clicks */
}
.carousel-button.prev .carousel-arrow {
    transform: rotate(180deg);
}

@media (hover: none), (pointer: coarse) {
    .carousel .carousel-button .carousel-arrow {
        width: 32px !important;
    }
}

.carousel-button:focus { outline: 2px solid #fff; }

.carousel-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 12px;
    display: flex;
    gap: 8px;
    z-index: 120 !important;
}

.carousel-dots button {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.6);
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
}

.carousel-dots button.active {
    background: #fff;
}

/* store-links */
.app-left .store-links {
    position: absolute;
    left: 0; /* aligné à gauche du widget */
    transform: none;
    bottom: 10px;
    display: flex;
    gap: 24px;
    padding-left: 8px; /* petit décalage du bord */
    align-items: center;
}

/* Footer */
.main-footer {
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 40px 0;
}

.main-footer a {
    color: #4da6ff;
    text-decoration: none;
}

/* Icônes réseaux sociaux dans le footer */
.social-icons {
    margin-top: 8px;
}
.social-icons a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.social-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
}

/* style utilitaire pour fond / bouton dans le footer */
.footer-back {
    display: inline-flex; /* make the whole button a flex container */
    align-items: center;  /* center children vertically */
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #f3f3f3 100%);
    color: inherit;
    padding: 8px 14px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08), inset 0 2px 6px rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.06);
    height: 44px; /* fixed height to ensure vertical centering */
    line-height: 1;
}

.footer-back img {
    vertical-align: middle;
    transform: rotate(180deg);
}

/* footer-back specific adjustments */
.footer-back {
    height: 48px;
    margin-top: 28px; /* espace avec le texte au-dessus */
}

.footer-back .footer-back-icon {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    vertical-align: middle;
    display: inline-block;
}

/* Style the link inside the footer-back to center content vertically,
   remove text-decoration and set color to black. */
.footer-back > a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #000;
    font-weight: 700; /* mettre le texte en gras */
}

/* Force arrow image to appear black (works for PNG/SVG) and disable pointer events */
.footer-back .footer-back-icon {
    filter: brightness(0) saturate(100%);
    pointer-events: none;
    display: inline-block;
    height: 20px;
    width: auto;
}

/* Remove hover decoration / transform for footer-back to keep it static */
.footer-back:hover,
.footer-back:focus {
    transform: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08), inset 0 2px 6px rgba(255,255,255,0.6);
}

/* Coloration de l'icône Bluesky au hover */
:root{
    --bluesky: #1fb6ff;
}

.social-icons a{
    padding: 6px 8px;
    border-radius: 8px;
    transition: background-color 180ms ease;
}

.social-icons .social-icon{
    filter: grayscale(1) brightness(0.9);
    transition: filter 200ms ease, transform 150ms ease;
    display: inline-block;
}

.social-icons a:hover{
    background-color: rgba(31,182,255,0.2);
}

.social-icons a:hover .social-icon{
    /* tenter une teinte bleue via filtre - fonctionne mieux sur icônes monochromes */
    filter: grayscale(0) sepia(0.3) saturate(6) hue-rotate(185deg) brightness(1);
    transform: translateY(-2px);
}

.coffee-banner img {
    height: 50px;
    margin-bottom: 15px;
}

/* Footer : espacement uniforme entre les éléments du bas */
.main-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px; /* espace uniforme entre les éléments listés */
    min-height: 30px; /* laisse de la place pour pousser le copyright en bas */
}

.main-footer .coffee-banner,
.main-footer .social-contact {
    width: 100%;
    max-width: 1200px;
    margin-top: 0; /* garder coffee-banner/social-contact groupés en haut */
    flex-wrap: wrap;
}

.main-footer .social-contact,
.main-footer .legal-links {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.main-footer .legal-links {
    margin-top: 32px; /* espace important au-dessus des liens légaux */
    margin-bottom: -8px;
}

.main-footer .copyright {
    margin-bottom: -16px; 
}

.main-footer .social-contact p {
    margin: 0;
}

.legal-links a {
    font-size: 0.8em;
    color: #aaa;
    text-decoration: none;
}

.coffee-banner img:hover {
    transform: scale(1.03);
}

.copyright {
    font-size: 0.8em;
    color: #aaa;
}

/* =========================================================
   RESPONSIVE DESIGN (Mobiles et petites tablettes)
   ========================================================= */
@media (max-width: 800px) {
    /* La section Hero s'empile au lieu d'être côte à côte */
    .hero-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .hero-section {
        padding: 40px 0;
    }

    .hero-text {
        max-width: 100%;
        flex: 1 1 auto;
        text-align: left;
        padding: 0 10px;
    }

    /* Ne pas afficher l'image du hero sur petits écrans */
    .hero-image {
        display: none !important;
    }

    /* Fix overflow on small screens: allow text column to shrink and reduce container padding */
    .hero-text { min-width: 0 !important; }
    .container { padding: 0 8px !important; }
    /* Prevent accidental horizontal scroll caused by elements slightly wider than viewport */
    html, body { overflow-x: hidden; }

    /* Make widgets occupy most of the viewport width on small screens
       Remove heavy centering and ensure full-width card look */
    .apps-container {
        align-items: stretch; /* let children stretch to container width */
        padding: 0; /* avoid extra inset inside apps container */
        width: 100%;
    }

    .app-widget {
        max-width: calc(100% - 32px);
        width: 100%;
        margin: 0px 16px; /* remove auto centering gaps */
        padding: 18px; /* slightly smaller padding on mobile */
    }

    /* Ensure inner columns stack neatly and take full width */
    .app-left, .app-right {
        max-width: 100%;
        flex: 1 1 100%;
        padding-right: 0;
    }

    .hero-image img {
        width: 80%;
        max-width: 360px;
        min-width: 160px;
        height: auto;
        object-fit: contain;
    }

    /* Les widgets s'adaptent mieux aux petits écrans */
    .app-widget {
        padding: 20px;
        flex-direction: column;
        min-height: auto;
    }

    .app-left {
        max-width: 100%;
        flex: 1 1 auto;
        padding-right: 0;
        /* Retirer le padding-bottom ajouté en version desktop pour éviter un espace vide sous les badges */
        padding-bottom: 0 !important;
    }

    /* Ne pas afficher le carousel sur mobile (responsive) */
    .app-right {
        display: none !important;
    }

    /* Sur mobile le carrousel devient horizontal plein écran mais les vignettes sont centrées */
    .app-gallery {
        height: auto;
        padding: 0;
        gap: 12px;
    }

    .app-gallery img {
        flex: 0 0 80%;
        max-width: 80%;
        height: auto;
        margin: 0 auto;
    }

    /* store-links : deviennent statiques et centrées sous le contenu */
    .app-left .store-links {
        position: static;
        transform: none;
        margin-top: 18px;
        justify-content: center;
    }
}