/* ========== VARIABLES ========== */
:root {
    --sp-500: #C4311B;
    --sp-600: #A42618;
    --sp-light: #FEF4F2;
    --or-500: #C4892A;
    --ivoire: #F8F5EF;
    --encre: #18130F;
}

/* ========== BASE & RESETS ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection {
    background-color: var(--sp-500);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--ivoire);
}
::-webkit-scrollbar-thumb {
    background: #D4956E;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--sp-500);
}

/* ========== ANIMATIONS ========== */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(2deg); }
    66% { transform: translateY(10px) rotate(-1deg); }
}

@keyframes float-delayed {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(15px) rotate(-2deg); }
    66% { transform: translateY(-25px) rotate(1deg); }
}

@keyframes bounce-slow {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes scale-in {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-float {
    animation: float 8s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 10s ease-in-out infinite;
}

.animate-bounce-slow {
    animation: bounce-slow 2s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ========== NAVBAR ========== */
#navbar {
    background: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#navbar.scrolled {
    background: rgba(248, 245, 239, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(24, 19, 15, 0.08);
}

#navbar.scrolled .nav-link {
    color: #18130F;
}

#navbar.scrolled .nav-link:hover,
#navbar.scrolled .nav-link.active {
    color: var(--sp-500);
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: white;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, var(--sp-500), var(--or-500));
    border-radius: 1px;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ========== HERO ========== */
#hero {
    position: relative;
}

#hero::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--ivoire), transparent);
    z-index: 2;
}

/* ========== RECIPE CARDS ========== */
.recipe-card {
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-card:hover {
    transform: translateY(-8px);
}

/* ========== CATEGORY CARDS ========== */
.category-card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover {
    transform: translateY(-6px);
}

/* ========== RECIPE GRID CARD ========== */
.recipe-grid-card {
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-grid-card:hover {
    transform: translateY(-6px);
}

/* ========== BUTTONS ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--sp-500), var(--sp-600));
    color: white;
    padding: 12px 32px;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    box-shadow: 0 10px 40px rgba(196, 49, 27, 0.4);
    transform: translateY(-2px);
}

/* ========== TAGS ========== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tag:hover {
    transform: scale(1.05);
}

/* ========== FILTER CHIPS ========== */
.filter-chip {
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid #E5E2DC;
    background: white;
    color: #5C534A;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--sp-500);
    color: var(--sp-500);
    background: var(--sp-light);
}

.filter-chip.active {
    border-color: var(--sp-500);
    background: linear-gradient(135deg, var(--sp-500), var(--sp-600));
    color: white;
}

/* ========== RECIPE DETAIL ========== */
.ingredient-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.ingredient-item:hover {
    background: var(--sp-light);
}

.ingredient-item.checked {
    opacity: 0.5;
    text-decoration: line-through;
}

.ingredient-item .checkbox {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid #D1CBC4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ingredient-item.checked .checkbox {
    background: linear-gradient(135deg, var(--sp-500), var(--sp-600));
    border-color: var(--sp-500);
    color: white;
}

/* Step cards */
.step-card {
    position: relative;
    padding-left: 80px;
}

.step-card::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 56px;
    bottom: -32px;
    width: 2px;
    background: linear-gradient(to bottom, var(--or-500), transparent);
}

.step-card:last-child::before {
    display: none;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--sp-500), var(--sp-600));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(196, 49, 27, 0.3);
}

/* ========== TIMER ========== */
.timer-display {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* ========== COMMENTS ========== */
.comment-card {
    padding: 16px;
    border-radius: 16px;
    background: white;
    border: 1px solid #EDE9E3;
    transition: all 0.2s ease;
}

.comment-card:hover {
    border-color: var(--or-500);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* ========== SWIPER CUSTOMIZATION ========== */
.swiper {
    overflow: visible !important;
}

.swiper-slide {
    height: auto;
}

/* ========== LOADING SKELETON ========== */
.skeleton {
    background: linear-gradient(90deg, #F3F0EA, #E8E3DA, #F3F0EA);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ========== PAGE TRANSITIONS ========== */
.page-enter {
    animation: slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========== TOOLTIP ========== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 12px;
    background: var(--encre);
    color: white;
    font-size: 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

/* ========== RESPONSIVE HELPERS ========== */
@media (max-width: 640px) {
    .step-card {
        padding-left: 64px;
    }

    .step-number {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        border-radius: 12px;
    }

    .step-card::before {
        left: 21px;
        top: 44px;
    }
}

/* ========== PARALLAX SECTIONS ========== */
.parallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

@media (max-width: 768px) {
    .parallax-bg {
        background-attachment: scroll;
    }
}

/* ========== GLASSMORPHISM CARD ========== */
.glass-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
}

/* ========== IMAGE LOADING ========== */
img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

img[data-src] {
    opacity: 0;
}

/* ========== DIFFICULTY INDICATOR ========== */
.difficulty-dots {
    display: flex;
    gap: 4px;
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E5E2DC;
    transition: background 0.2s ease;
}

.difficulty-dot.active {
    background: var(--sp-500);
}

/* ========== PRINT STYLES ========== */
@media print {
    nav, footer, .no-print, .swiper, #communaute {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .recipe-hero {
        break-inside: avoid;
    }

    .step-card {
        break-inside: avoid;
    }
}

/* ========== STAR RATING (interactive) ========== */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 2px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    color: #D1CBC4;
    transition: color 0.15s ease;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #F59E0B;
}

/* ========== BACK TO TOP ========== */
#backToTop {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sp-500), var(--sp-600));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(196, 49, 27, 0.4);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 40;
    border: none;
}

#backToTop.visible {
    opacity: 1;
    transform: translateY(0);
}

#backToTop:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(196, 49, 27, 0.5);
}

/* ========== LINE CLAMP ========== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== REDUCED MOTION ========== */
@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;
    }
    .animate-float,
    .animate-float-delayed,
    .animate-bounce-slow,
    .animate-shimmer { animation: none; }
}

/* ── Colonnes de grille non incluses dans le CSS Tailwind compilé ── */
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (min-width: 640px) {
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
