html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

/* --- Navbar --- */
.nav-link {
    @apply px-4 py-2 rounded-md text-sm font-medium text-gray-700 hover:text-brand hover:bg-brand/5 transition-colors;
    position: relative;
}

.nav-link::after {
    content: '·';
    position: absolute;
    right: -0.35rem;
    top: 50%;
    transform: translateY(-50%);
    color: #d1d5db;
    font-size: 1.25rem;
    font-weight: bold;
    pointer-events: none;
}

.nav-link:last-of-type::after {
    display: none;
}

.mobile-nav-link {
    display: block;
    padding: 0.875rem 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    transition: color 0.15s, background-color 0.15s;
}

.mobile-nav-link:last-of-type {
    border-bottom: none;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    color: #2aa44a;
    background-color: rgba(42, 164, 74, 0.05);
}

.navbar-glass {
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease, box-shadow 0.3s ease;
}

img.svg-icon {
    filter: invert(42%) sepia(93%) saturate(401%) hue-rotate(96deg) brightness(89%) contrast(88%);
}

/* --- Scroll Animations (enhanced with blur reveal) --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    filter: blur(4px);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
    filter: blur(0);
}

/* Directional entrance variants */
.animate-on-scroll.from-left {
    transform: translateX(-60px);
}

.animate-on-scroll.from-right {
    transform: translateX(60px);
}

.animate-on-scroll.from-scale {
    transform: scale(0.8);
}

@media (max-width: 1023px) {
    .animate-on-scroll.from-left,
    .animate-on-scroll.from-right {
        transform: translateY(30px);
    }
}

/* --- Hero animated gradient background --- */
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* --- Hero floating cards --- */
@keyframes hero-float-1 {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-14px) rotate(-1deg); }
}

@keyframes hero-float-2 {
    0%, 100% { transform: translateY(0) rotate(1deg); }
    50% { transform: translateY(-18px) rotate(1deg); }
}

@keyframes hero-float-3 {
    0%, 100% { transform: translateY(0) rotate(-0.5deg); }
    50% { transform: translateY(-10px) rotate(-0.5deg); }
}

@keyframes hero-float-4 {
    0%, 100% { transform: translateY(0) rotate(0.5deg); }
    50% { transform: translateY(-12px) rotate(0.5deg); }
}

@keyframes hero-float-5 {
    0%, 100% { transform: translateY(0) rotate(-0.8deg); }
    50% { transform: translateY(-16px) rotate(-0.8deg); }
}

@keyframes hero-float-6 {
    0%, 100% { transform: translateY(0) rotate(0.3deg); }
    50% { transform: translateY(-11px) rotate(0.3deg); }
}

/* --- Hero Card Hover Bounce ---
   Uses `scale` property (independent from `transform`) so it composes
   with the float animation without conflict. Spring cubic-bezier for bounce. */
.hero-card {
    transition: scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    cursor: default;
}

.hero-card:hover {
    scale: 1.1;
    border-color: rgba(42, 164, 74, 0.25);
    box-shadow: 0 12px 40px rgba(42, 164, 74, 0.15);
}

/* Decorative blobs */
@keyframes blob-morph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 40% 60% 70% 30% / 50% 60% 30% 60%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    75% { border-radius: 50% 40% 50% 60% / 40% 50% 60% 50%; }
}

/* --- Wave dividers --- */
.wave-divider svg {
    display: block;
    width: 100%;
    height: 60px;
}

@media (min-width: 768px) {
    .wave-divider svg {
        height: 80px;
    }
}

/* --- Grain Overlay (premium noise texture) --- */
.grain-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- 3D Tilt Card (perspective follows mouse) --- */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
}

.tilt-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

/* --- Magnetic Button (follows cursor subtly) --- */
.magnetic-btn {
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Parallax Layer --- */
[data-parallax] {
    will-change: translate;
}

/* --- Reduced Motion (respect user preference) --- */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    [style*="hero-float"],
    [style*="blob-morph"] {
        animation: none !important;
    }

    .hero-card {
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    .tilt-card {
        transition: box-shadow 0.3s ease;
    }

    [data-parallax] {
        will-change: auto;
    }

    .blog-dialog-inner {
        animation: none;
    }
}

/* --- Blog Card Text Truncation --- */
.blog-card-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-text * {
    display: inline;
}

/* --- Blog Dialog --- */
.blog-dialog {
    padding: 0;
    border: none;
    border-radius: 1rem;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    overflow: visible;
}

.blog-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.blog-dialog[open] .blog-dialog-inner {
    animation: dialog-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.blog-dialog-inner {
    position: relative;
}
