/* Turbo progress bar */
.turbo-progress-bar {
    height: 3px;
    background-color: #6366f1;
    box-shadow: 0 0 10px #6366f1;
}

/* Smooth page transitions with Turbo */
main {
    animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#skeleton-overlay {
    animation: fadeIn 0.15s ease-in;
}

/* Animation du spinner de chargement */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Notifications system */
#notificationContainer > div {
    /* Largeur maximale : 1/3 de l'espace principal (sans les sidebars 80px + 240px = 320px) */
    max-width: calc((100vw - 320px) / 3);
    /* Permettre le retour à la ligne intelligent */
    word-break: break-word;
    hyphens: auto;
    /* Largeur automatique selon le contenu, mais limitée par max-width */
    width: auto;
    min-width: 200px;
}

@media (max-width: 1024px) {
    #notificationContainer > div {
        /* Sur petits écrans, prendre plus d'espace */
        max-width: calc(50vw - 2rem);
    }
}

@media (max-width: 640px) {
    #notificationContainer > div {
        /* Sur très petits écrans, prendre presque toute la largeur */
        max-width: calc(100vw - 2rem);
    }
}

/* Custom scrollbar styles for dark theme */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #4B5563 #1F2937;
}

/* WebKit browsers (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: #1F2937;
}

*::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 6px;
    border: 2px solid #1F2937;
}

*::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

*::-webkit-scrollbar-thumb:active {
    background: #9CA3AF;
}

/* Specific scrollbar for sidebar */
aside::-webkit-scrollbar {
    width: 8px;
}

aside::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
    border: 1px solid #111827;
}

aside::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

/* ========== Portfolio Animations ========== */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Scroll reveal animations */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for grids */
.reveal-stagger-1 { transition-delay: 0.1s; }
.reveal-stagger-2 { transition-delay: 0.2s; }
.reveal-stagger-3 { transition-delay: 0.3s; }
.reveal-stagger-4 { transition-delay: 0.4s; }
.reveal-stagger-5 { transition-delay: 0.5s; }
.reveal-stagger-6 { transition-delay: 0.6s; }

/* Project card expansion */
.project-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.project-expandable.expanded {
    max-height: 2000px;
}

/* Chevron icon rotation */
.chevron-icon {
    transition: transform 0.3s ease;
}

.chevron-icon.rotated {
    transform: rotate(180deg);
}

/* Typing animation — dark cursor on light bg */
.typing-text {
    border-right: 3px solid #1a1a1a;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* Scroll down indicator */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Project cards */
.project-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.10);
    border-color: #fbd5aa;
}

/* Ring progress indicator */
.project-ring-progress {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: none;
    transform-origin: 50% 50%;
}

.project-card.is-hovered .project-ring-progress {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.5s linear;
}

/* Close button ring */
.close-ring-progress {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: none;
    transform-origin: 50% 50%;
}

.close-btn.is-hovered .close-ring-progress {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.5s linear;
}

/* Project modal */
#project-modal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#project-modal.is-open {
    opacity: 1;
    visibility: visible;
}

#project-modal .modal-panel {
    transform: translateY(24px) scale(0.98);
    transition: transform 0.25s ease;
}

#project-modal.is-open .modal-panel {
    transform: translateY(0) scale(1);
}

/* Gradient text utility */
.gradient-text {
    background: linear-gradient(to right, #fb923c, #ec4899, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav links — light theme */
.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, #fb923c, #ec4899);
    transition: width 0.3s ease;
}

.nav-link.active {
    color: #111827;
    font-weight: 500;
}

.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: #111827;
}

/* ========== Page Loader ========== */

#page-loader {
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#page-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loader-bar {
    width: 0%;
    animation: loader-progress 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loader-progress {
    0%   { width: 0%; }
    50%  { width: 60%; }
    80%  { width: 85%; }
    100% { width: 100%; }
}

#loader-name {
    opacity: 0;
    transform: translateY(16px);
    animation: loader-name-in 0.7s ease 0.2s forwards;
}

#loader-label {
    opacity: 0;
    animation: loader-label-in 0.5s ease 0.1s forwards;
}

@keyframes loader-name-in {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loader-label-in {
    to { opacity: 1; }
}

/* Hero blob decoration */
.hero-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(80px);
}

/* Scrollbar — light theme for portfolio */
.portfolio-page * {
    scrollbar-color: #d1d5db #f3f4f6;
}

.portfolio-page *::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.portfolio-page *::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border: 2px solid #f3f4f6;
}

.portfolio-page *::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
