/* ===========================================
   Klens Website - Index Page Custom Styles
   =========================================== */
:root {
    /* HD Watercolor Texture Pattern (Data URI for portability) */
    --brush-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cdefs%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='6' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 0.5 0 0 0 0 0.31 0 0 0 -1 1'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='100' height='100' filter='url(%23f)' opacity='0.4'/%3E%3C/svg%3E");
}

body {
    background-color: #ffffff;
    color: #111827;
    overflow-x: hidden;
}

/* Nav Links */
.nav-link {
    position: relative;
    display: inline-block;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #22222D;
    transition: width 0.3s ease;
}

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

.nav-link.active {
    color: #22222D;
}

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

/* Reveal Animations */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
}

/* Parallax & Animations */
.parallax-section {
    overflow: hidden;
}

/* Smooth scrolling (Lenis) */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

/* Utility Classes */
.gradient-text {
    background: linear-gradient(90deg, #111827, #4b5563);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Core 3D Setup */
.book-container {
    position: relative;
    width: 340px;
    height: 460px;
    perspective: 1500px;
    cursor: pointer;
}

/* The Inside Page - sits static at the bottom */
.book-inside {
    position: absolute;
    inset: 0;
    background: #ffffff;
    border-radius: 4px 16px 16px 4px;
    border: 1px solid #e5e7eb;
    box-shadow: 10px 20px 40px rgba(24, 22, 6, 0.16);
    z-index: 1;
}

/* The Cover Wrapper - Handles the rotation */
.book-cover {
    position: absolute;
    inset: 0;
    z-index: 2;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left center;
}

.cover-front,
.cover-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 4px 16px 16px 4px;
}

.cover-front {
    z-index: 2;
    box-shadow: 5px 5px 20px rgba(24, 22, 6, 0.16);
}

.cover-back {
    transform: rotateY(180deg);
    border: 1px solid #e5e7eb;
    background: #fdfdfd;
}

/* Hover Action */
.book-container:hover .book-cover {
    transform: rotateY(-140deg);
}

/* Refined Drop Shadow on the whole container */
.book-container::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 10px;
    right: 10px;
    height: 40px;
    background: rgba(0, 0, 0, 0.03);
    filter: blur(20px);
    border-radius: 100%;
    transition: all 0.6s ease;
}

.book-container:hover::after {
    filter: blur(30px);
    background: rgba(0, 0, 0, 0.06);
}

/* Add a "spine" shadow for realism */
.cover-front::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent);
}

/* Handwriting animation */


.handwriting-highlight {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    z-index: 1;
}

.handwriting-highlight svg {
    position: absolute;
    left: -20%;
    top: -28%;
    width: 130%;
    height: 140%;
    pointer-events: none;
    z-index: -1;
    overflow: visible;
}

.handwriting-highlight .brush-stroke {
    fill: none;
    stroke: #FF9988;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;

    /* Integrated Filter from the HTML */
    filter: url(#brush-texture);
    opacity: 0.85;

    /* Animation Logic - REVERSED */
    stroke-dasharray: 600;
    stroke-dashoffset: -600;
    /* Start from end to reverse direction */
    animation: brushAnimationReverse 1.5s cubic-bezier(0.45, 0, 0.55, 1) forwards;
    animation-delay: 0.8s;
}

@keyframes brushAnimationReverse {
    to {
        stroke-dashoffset: 0;
    }
}