/* --- 1. CSS Scroll Snap Setup --- */

/* * We set the snap-type on the root <html> element.
 * 'y mandatory' forces the browser to always snap to a section.
 * 'scroll-behavior: smooth' is already in your example, but it's
 * the 'scroll-snap-type' that does the real work.
 */
html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;

    /*
     * CRITICAL: This tells the browser to offset the snap-point
     * by 50px (the height of your sticky header).
     * This prevents the header from covering the section title.
     */
    scroll-padding-top: 50px;
}

/* * All direct children of <main> (your <section> tags) and the 
 * <footer> are designated as snap points.
 */
main > section,
.site-footer {
    scroll-snap-align: start;
}

/* --- 2. Full-Screen Section & Layout Fixes --- */

/* * This makes all sections 100vh (full viewport height)
 * We also add flexbox to help center content.
 */
main > section {
    min-height: 100vh;
    height: 100vh; /* Enforce 100vh for reliable snapping */
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box; /* Include padding in height */
}

/* * Your original .section-padding might be too large and cause
 * overflow. We override it to be more flexible.
 * We also handle the sticky header offset.
 */
main > section.section-padding {
    padding-top: 80px;  /* 50px header + 30px breathing room */
    padding-bottom: 30px;
    height: auto; /* Allow content to define height */
    min-height: 100vh; /* Ensure it's *at least* 100vh */
}

/* * On sections that could have MANY items (like FAQ or Comparison),
 * we must make the *inner container* scrollable, not the section.
 * This keeps the 100vh snap behavior intact.
 */
#faq .container,
#comparison .container {
    overflow-y: auto;
    /* 'overscroll-behavior' prevents the main page from scrolling
       when you reach the end of this inner container. */
    overscroll-behavior: contain;
    /* We add padding here instead of on the section */
    padding-top: 80px; 
    padding-bottom: 30px;
}

/* * Since we're adding padding to the container,
 * we must remove it from the section itself.
 */
#faq,
#comparison {
    padding-top: 0;
    padding-bottom: 0;
    justify-content: flex-start; /* Align container to top */
}

/* Fix hero padding for new 100vh context */
.hero-section {
    padding-top: 50px; /* Account for header */
}

/* * Your original 'comparison-header' was sticky, which
 * doesn't work well inside a snapping parent.
 * We change it to 'relative'.
 */
.comparison-header {
    position: relative;
    top: 0;
}


/* --- 3. Animation & Micro-interactions --- */

/* * This is the base state for all animated elements.
 * They are hidden and moved down.
 */
.fp-anim {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 0.1s, transform 0.6s ease-out 0.1s;
}

/* * This is the "visible" state, triggered by the
 * IntersectionObserver adding the '.is-visible' class.
 */
.fp-anim.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* * These delay classes create the sleek "stagger" effect
 * so elements animate in one after another.
 */
.fp-anim.is-visible.delay-1 { transition-delay: 0.2s; }
.fp-anim.is-visible.delay-2 { transition-delay: 0.4s; }
.fp-anim.is-visible.delay-3 { transition-delay: 0.6s; }
.fp-anim.is-visible.delay-4 { transition-delay: 0.8s; }

/* * This re-uses your existing 'problem-reveal' logic.
 * The JS adds '.is-revealed' to the parent section.
 */
#problem #solution-side {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}
#problem #problem-side {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

#problem.is-revealed #problem-side {
    opacity: 0;
    transform: translateX(-30px);
}
#problem.is-revealed #solution-side {
    opacity: 1;
    transform: translateX(0);
}
/* --- 4. CTA Button Pulse (UI/UX Optimization) --- */
/* This subtle scaling animation draws the user's eye 
  to the most important button on the page.
*/
.cta-pulse {
    animation: pulse-scale 2.5s infinite ease-in-out;
}

@keyframes pulse-scale {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
    }
}

/* We pause the animation on hover and let your
  existing :hover styles take over.
*/
.cta-pulse:hover {
    animation-play-state: paused;
    /* This will now use the .btn-primary:hover styles from style.css */
    transform: translateY(-2px); 
}

/* --- 5. Side Navigation Dots --- */

#fp-nav {
    position: fixed;
    z-index: 100;
    top: 50%;
    right: 17px;
    transform: translateY(-50%);
}

#fp-nav ul {
    list-style: none;
}

#fp-nav ul li {
    width: 20px;
    height: 20px;
    margin: 7px 0;
    position: relative;
}

#fp-nav ul li a {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#fp-nav ul li a span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    background: var(--neutral-dark);
    opacity: 0.4;
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

/* Active & Hover States */
#fp-nav ul li a.active span,
#fp-nav ul li:hover a span {
    background: var(--primary-color);
    opacity: 1;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
}

/* Tooltips */
#fp-nav ul li a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#fp-nav ul li:hover a[data-tooltip]::after {
    opacity: 1;
    visibility: visible;
}

/* --- 6. Full-Page iFrame Form --- */

/*
 * This overrides the default .section-padding 
 * so the iFrame can be truly full-screen, edge-to-edge.
*/
#gabung {
    padding: 0;
}

/*
 * This makes the iFrame fill the entire section,
 * turning it into the "page" itself.
 * Our existing `scroll-padding-top: 50px` on the <html>
 * will automatically make this align perfectly under the header.
*/
#gabung iframe {
    width: 100%;
    height: 100vh;
    border: none;
    display: block; /* Removes any default inline/bottom margin */
}