/* ============================================================
   LAYOUT — Navbar, Hero, Footer, Foulard, Back-to-top
   ============================================================ */

/* === FOULARD DÉCORATIF === */
.foulard-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.foulard-svg {
    width: 100%;
    height: 100%;
    filter: blur(65px);
}

.foulard-path {
    animation: floatFoulard 10s ease-in-out infinite;
}

@keyframes floatFoulard {
    0%,
    100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(20px, -60px);
    }
    66% {
        transform: translate(-20px, -40px);
    }
}

/* === HEADER / NAVBAR === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
    background-color: transparent;
    transition:
        background-color 0.35s ease,
        box-shadow 0.35s ease,
        backdrop-filter 0.35s ease;
}

/* État scrollé : fond blanc (ou dark en dark-mode) */
.header.scrolled {
    background-color: var(--bg-navbar);
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hero {
    padding-top: calc(var(--spacing-3xl) + 6rem); /* 5rem = hauteur approx navbar */
    padding-bottom: calc(var(--spacing-3xl)); /* compensation visuelle */
    background-color: transparent;
}

.primary-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Logo --- */
.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h2 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary);
}

.logo span {
    color: var(--secondary);
}

.logo-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    color: var(--primary);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
}

/* --- Logos selon le mode (dark par défaut = dark UI) --- */
.light-mode-logo {
    display: block;
}
.dark-mode-logo {
    display: none;
}

html.light-mode .light-mode-logo {
    display: none;
}
html.light-mode .dark-mode-logo {
    display: block;
}

/* --- Nav links --- */
.nav-links {
    display: flex;
    gap: 0.75rem;
    font-size: 1.1rem;
}

.nav-link {
    color: var(--text-dark);
    font-weight: var(--font-weight-medium);
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}
.nav-link:hover::after {
    width: 100%;
}

/* Bouton RDV spécial */
.nav-link[data-cal-link] {
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-semibold);
    box-shadow: 0 4px 15px rgba(255, 133, 133, 0.3);
    white-space: nowrap;
}

.nav-link[data-cal-link]:hover {
    background: linear-gradient(315deg, var(--primary), #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 133, 133, 0.4);
    color: white !important;
}

.nav-link[data-cal-link]::after {
    display: none;
}

/* --- Nav actions (theme / lang / linkedin) --- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-actions a,
.nav-actions button {
    color: var(--text-dark);
    font-size: var(--font-size-lg);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-actions a:hover,
.nav-actions button:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

#theme-toggle {
    position: relative;
    width: 24px;
    height: 24px;
}

#linkedin-icon,
#en-flag,
#fr-flag,
#dark-icon,
#light-icon {
    font-size: var(--font-size-xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Par défaut (dark mode = dark UI) : lune cachée, soleil visible */
#light-icon {
    display: block;
}
#dark-icon {
    display: none;
}
#fr-flag {
    display: none;
}

.light-mode #dark-icon {
    display: block;
}
.light-mode #light-icon {
    display: none;
}

/* --- Mobile nav toggle --- */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background-color: var(--primary);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
}

.mobile-nav-toggle .fa-xmark {
    display: none;
}
.mobile-nav-toggle[aria-expanded="true"] .fa-bars {
    display: none;
}
.mobile-nav-toggle[aria-expanded="true"] .fa-xmark {
    display: block;
}

/* === HERO === */
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--spacing-3xl);
}

.hero-text {
    flex: 1.2;
    min-width: 0;
}

.hero-content .hero-text {
    width: 100%;
}

.hero-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    color: var(--primary);
}

.hero-title-home {
    font-size: clamp(2.45rem, 4vw, 3.8rem);
    line-height: 1.02;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.hero-title-line {
    display: block;
}

.hero-title-line-main {
    font-size: 1em;
    white-space: nowrap;
}

.hero-title-line-sub {
    font-size: 0.44em;
    line-height: 1.05;
    margin-top: 0.15em;
    font-weight: var(--font-weight-semibold);
}

.hero-description {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xl);
    color: var(--text-dark);
    font-weight: var(--font-weight-semibold);
}

.hero-content .hero-description {
    text-align: center;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: var(--spacing-md);
}

.hero-content .hero-cta {
    justify-content: center;
    flex-wrap: wrap;
}

/* Animation pulse du bouton CTA */
.hero-cta .btn-primary {
    animation: pulse-button 2s both infinite;
    animation-delay: 3s;
}

@keyframes pulse-button {
    0%,
    100% {
        transform: scale3d(1, 1, 1);
    }
    50% {
        transform: scale3d(1.05, 1.05, 1.05);
    }
}

.hero-video {
    max-width: 600px;
    width: 80%;
    margin: 0 auto;
    border-radius: 30px;
    display: block;
    box-shadow: 0 5px 15px var(--primary);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    cursor: pointer;
}

.hero-video:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px var(--primary);
}
.hero-video:active {
    transform: translateY(-2px);
}

/* === PAGES LÉGALES === */
.legal-page {
    padding-top: calc(var(--spacing-3xl) + 5rem);
    padding-bottom: var(--spacing-3xl);
}

.legal-hero {
    margin-bottom: var(--spacing-2xl);
    text-align: center;
}

.legal-intro {
    max-width: 860px;
    margin: 0 auto;
    font-size: var(--font-size-lg);
    line-height: 1.8;
}

.legal-card {
    background: var(--bg-card-transparent);
    backdrop-filter: blur(4px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
}

.legal-card h2,
.legal-card h3 {
    color: var(--primary);
    margin-bottom: var(--spacing-md);
}

.legal-card p + p,
.legal-card p + ul,
.legal-card ul + p {
    margin-top: var(--spacing-md);
}

.legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--spacing-lg);
}

.legal-list {
    list-style: disc;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.75rem;
}

.legal-list li {
    color: var(--text-dark);
}

.legal-note {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.legal-foulard {
    z-index: -1;
}

/* === FOOTER === */
.footer {
    background-color: transparent;
    padding: var(--spacing-lg) 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    text-align: center;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.footer-tagline {
    font-size: 0.8rem;
    text-align: center;
}

.footer-logo img {
    border-radius: 50%;
    width: 50px;
    height: 50px;
}

.copyright {
    font-size: var(--font-size-lg);
}

.footer-social {
    display: flex;
    gap: var(--spacing-md);
}

.footer-social a {
    color: var(--text-dark);
    font-size: var(--font-size-2xl);
    transition: var(--transition);
}

.footer-social a:hover {
    color: var(--secondary);
    transform: translateY(-3px);
}

/* Dark mode footer fix */
html.light-mode .footer * {
    color: var(--text-dark);
}

/* === BACK TO TOP === */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    box-shadow: var(--box-shadow);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
#back-to-top:hover {
    background-color: var(--secondary);
    transform: translateY(-5px);
}

/* === SCROLL REVEAL === */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 1.3s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.3s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   RESPONSIVE — Layout
   ============================================================ */

/* Tablette intermédiaire : navbar compacte mais visible */
@media (min-width: 769px) and (max-width: 959px) {
    .logo h2 {
        font-size: 1.25rem;
    }
    .logo-subtitle {
        display: none;
    }
    .nav-links {
        gap: 0.5rem;
        font-size: 0.95rem;
    }
    .nav-actions {
        gap: var(--spacing-sm);
    }
    .nav-link[data-cal-link] {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 960px) and (max-width: 1026px) {
    .logo h2 {
        font-size: 1.15rem;
    }
    .logo-subtitle {
        display: none;
    }
    .nav-links {
        gap: 0.4rem;
        font-size: 0.95rem;
    }
    .nav-actions {
        gap: 0.5rem;
    }
    .nav-link[data-cal-link] {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 1027px) and (max-width: 1130px) {
    .logo h2 {
        font-size: 1.25rem;
    }
    .nav-links {
        gap: 0.7rem;
        font-size: 1rem;
    }
    .nav-link[data-cal-link] {
        padding: 0.6rem 1rem;
        font-size: 0.98rem;
    }
}

/* Hero tablette : centré avant le mobile */
@media (max-width: 992px) {
    .hero-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .hero-content {
        flex-direction: column;
    }

    .hero-text {
        width: 100%;
    }

    .hero-cta {
        justify-content: center;
    }
}

@media (max-width: 1280px) {
    .mobile-nav-toggle {
        display: flex;
    }
    .header {
        background-color: transparent !important;
        box-shadow: none !important;
    }
    .header.scrolled {
        background-color: var(--bg-light) !important;
        box-shadow: var(--box-shadow) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .primary-navigation {
        position: fixed;
        inset: 0;
        background-color: var(--bg-light);
        flex-direction: column;
        justify-content: start;
        align-items: flex-start;
        padding: 2rem;
        transform: translateX(100%);
        transition: none;
        z-index: 1000;
    }

    .primary-navigation.active {
        transform: none;
    }

    .logo {
        margin-top: var(--spacing-lg);
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-links {
        flex-direction: column;
        gap: var(--spacing-xl);
        margin-top: var(--spacing-3xl);
        width: 100%;
    }

    .nav-link {
        font-size: var(--font-size-xl);
        padding: var(--spacing-sm) 0;
        display: block;
        width: 100%;
    }

    .nav-actions {
        margin-top: var(--spacing-2xl);
        justify-content: flex-start;
        width: 100%;
    }
}

/* Mobile complet */
@media (max-width: 768px) {
    /* Navbar mobile : slide depuis la droite */

    .hero {
        padding-top: 6rem;
    }

    .hero-title-home {
        font-size: clamp(2.2rem, 9vw, 2.75rem);
        line-height: 1.05;
        width: 100%;
        max-width: 100%;
        padding: 0 0.5rem;
        text-wrap: balance;
    }

    .hero-title-line-main {
        white-space: normal;
    }

    .hero-title-line-sub {
        font-size: 0.52em;
        line-height: 1.08;
        margin-top: 0.1em;
    }

    .hero-description {
        font-size: 1rem;
        line-height: 1.55;
    }

    .hero-content .hero-cta .btn {
        width: min(100%, 320px);
    }

    /* Hero mobile */
    .hero-description {
        text-align: center;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .hero-cta .btn {
        width: 80%;
        text-align: center;
        padding: 1rem 1.5rem;
        font-size: var(--font-size-lg);
    }

    /* Footer mobile */
    .footer-top {
        flex-direction: column;
        gap: var(--spacing-lg);
    }
}

/* === UTILITAIRES RESPONSIVE === */
.desktop-only {
    display: initial;
}
.skills-grid.desktop-only {
    display: grid;
}
.projects-grid.desktop-only {
    display: grid;
}
.contact-links.desktop-only {
    display: flex;
}
.alsacard-cards.desktop-only {
    display: flex;
}

.mobile-carousel {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-carousel {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: none;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.5rem;
        padding: 0 1.5rem 1rem;
        gap: var(--spacing-md);
        cursor: grab;
    }

    .mobile-carousel.grabbing {
        cursor: grabbing;
        user-select: none;
    }

    .mobile-carousel::-webkit-scrollbar {
        display: none;
    }

    .mobile-carousel-item {
        flex: 0 0 100%;
        scroll-snap-align: center;
    }

    /* Tailles carousel mobile */
    .skills-carousel .skill-card {
        flex: 0 0 320px;
        margin-bottom: var(--spacing-md);
    }
    .projects-carousel .project-card {
        flex: 0 0 280px;
        height: 380px;
        padding-bottom: 10px;
    }
    .contact-carousel .contact-link {
        flex: 0 0 250px;
        margin-block: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .skills-carousel .skill-card {
        flex: 0 0 280px;
    }
    .projects-carousel .project-card {
        flex: 0 0 260px;
        height: 350px;
    }
    .contact-carousel .contact-link {
        flex: 0 0 280px;
        height: 150px;
    }
}
