/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    overflow: hidden; /* Prevent scrolling while loading */
}

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #D90916; /* Requested background color */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 30px;
    animation: logoFadeIn 1.5s ease-out forwards;
    filter: drop-shadow(0px 8px 16px rgba(0, 0, 0, 0.2));
}

/* Fade in animation for the logo */
@keyframes logoFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}



/* Hide preloader class */
.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* Main Content Styles */
#main-content {
    display: none; /* Initially hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fefefe; /* Clean white background matching video */
    overflow: hidden;
}

/* Navbar */
.navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    padding: 20px 8%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    z-index: 100;
}

.nav-logo img {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: #D90916;
    border-bottom: 2px solid #D90916;
    padding-bottom: 5px;
}

.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #333;
    transition: all 0.3s ease-in-out;
}

body.state-0 .navbar,
body.state-1 .navbar, 
body.state-2 .navbar,
body.state-3 .navbar,
body.state-4 .navbar,
body.state-5 .navbar,
body.state-6 .navbar,
body.state-7 .navbar,
body.state-8 .navbar,
body.state-9 .navbar,
body.state-10 .navbar,
body.state-11 .navbar,
body.state-12 .navbar,
body.state-13 .navbar {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Container */
.hero-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Video Wrapper */
.hero-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(0);
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 2;
    overflow: hidden;
}

body.state-1 .hero-video-wrapper {
    top: 50%;
    left: 50%;
    width: 45%;
    height: 25.31vw; /* 45vw width * 9/16 aspect ratio = 25.31vw height. This allows smooth height animation! */
    transform: translateY(-50%);
    border-radius: 0;
    box-shadow: none;
}

body.state-2 .hero-video-wrapper,
body.state-3 .hero-video-wrapper,
body.state-4 .hero-video-wrapper,
body.state-5 .hero-video-wrapper,
body.state-6 .hero-video-wrapper,
body.state-7 .hero-video-wrapper,
body.state-8 .hero-video-wrapper,
body.state-9 .hero-video-wrapper,
body.state-10 .hero-video-wrapper,
body.state-11 .hero-video-wrapper,
body.state-12 .hero-video-wrapper {
    top: 50%;
    left: 50%;
    width: 45%;
    height: 25.31vw;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.95);
    border-radius: 0;
    box-shadow: none;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Prevents cutting by ensuring the whole video fits inside the screen */
    transition: object-fit 0.5s ease;
}

/* Video background styling */

/* Hero Text */
.hero-text {
    position: absolute;
    top: 55%;
    left: 8%;
    width: 40%;
    transform: translateY(-50%) translateX(-50px);
    opacity: 0;
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
}

body.state-1 .hero-text {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0.3s;
}

body.state-2 .hero-text,
body.state-3 .hero-text,
body.state-4 .hero-text,
body.state-5 .hero-text,
body.state-6 .hero-text,
body.state-7 .hero-text,
body.state-8 .hero-text,
body.state-9 .hero-text,
body.state-10 .hero-text,
body.state-11 .hero-text {
    opacity: 0;
    transform: translateY(-50%) translateX(-50px);
    transition-delay: 0s;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: #111;
    margin-bottom: 20px;
}

.hero-text h1 .highlight {
    color: #D90916;
}

.hero-text p {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 30px;
}

.btn-read-more {
    display: inline-block;
    padding: 15px 35px;
    background-color: #D90916;
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 30px;
    transition: background-color 0.3s;
}

.btn-read-more:hover {
    background-color: #b00712;
}



/* Show main content */
body.content-visible {
    overflow-x: hidden;
    overflow-y: auto; /* Restore scrolling */
    height: 1350vh; /* Extra height to allow scrolling for all states */
}

body.content-visible #main-content {
    display: block;
    animation: fadeIn 1s ease-out forwards;
}

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

/* State 2 & 3 Content Styles */
.state-2-content {
    position: absolute;
    top: 25vh; /* Align text block */
    left: 0;
    width: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

body.state-2 .state-2-content,
body.state-3 .state-2-content {
    pointer-events: auto;
}

.mask-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

body.state-2 .mask-container,
body.state-3 .mask-container {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

body.state-4 .mask-container,
body.state-5 .mask-container,
body.state-6 .mask-container,
body.state-7 .mask-container,
body.state-8 .mask-container,
body.state-9 .mask-container,
body.state-10 .mask-container,
body.state-11 .mask-container {
    opacity: 0;
    transform: translateY(-50vh); /* Move out of screen */
    transition-delay: 0s;
}

.yanoplast-mask {
    font-size: 12vw; /* Responsive huge text */
    font-weight: 900;
    letter-spacing: -4px;
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    text-transform: uppercase;
    line-height: 1;
    color: #D90916; /* Brand red from loader */
}

.state-2-text {
    margin-top: 0vh; /* Reduced from 10vh to fix the gap */
    text-align: center;
    max-width: 800px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

body.state-3 .state-2-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

body.state-4 .state-2-text {
    opacity: 1;
    transform: translateY(-35vh); /* Compensated for the 10vh margin change to keep State 4 exactly the same */
    transition-delay: 0s;
}

body.state-5 .state-2-text,
body.state-6 .state-2-text,
body.state-7 .state-2-text,
body.state-8 .state-2-text,
body.state-9 .state-2-text,
body.state-10 .state-2-text,
body.state-11 .state-2-text {
    opacity: 0;
    transform: translateY(-80vh); /* Move completely off-screen */
    transition-delay: 0s;
}

.state-2-text h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #111;
    margin-bottom: 20px;
}

.state-2-text p {
    font-size: 1.1rem;
    color: #444;
    font-weight: 600;
    line-height: 1.6;
}

/* State 4 Card Styles */
.state-4-card {
    position: absolute;
    top: 18vh; /* Top edge will sit at 37vh in the viewport */
    left: 50%;
    transform: translateX(-50%) translateY(15vh); /* Start slightly lower */
    width: 80%;
    max-width: 1000px;
    height: 45vh; /* Responsive height */
    min-height: 350px;
    max-height: 420px;
    background-image: url('assets/card_bg.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    opacity: 0;
    transition: all 0.8s ease;
    overflow: hidden;
    pointer-events: none;
}

body.state-4 .state-4-card {
    opacity: 1;
    transform: translateX(-50%) translateY(0); /* Slide up into perfect fit */
    transition-delay: 0.3s;
    pointer-events: auto;
}

body.state-5 .state-4-card,
body.state-6 .state-4-card,
body.state-7 .state-4-card,
body.state-8 .state-4-card,
body.state-9 .state-4-card,
body.state-10 .state-4-card,
body.state-11 .state-4-card {
    opacity: 0;
    transform: translateX(-50%) translateY(-35vh); /* Move up and fade out */
    transition-delay: 0s;
    pointer-events: none;
}

.card-content {
    background: linear-gradient(to right, rgba(253,253,253,0.95) 45%, rgba(253,253,253,0) 100%);
    width: 100%;
    height: 100%;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.card-content h3 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #111;
    margin-bottom: 20px;
    line-height: 1.2;
}

.card-content p {
    font-size: 1.1rem;
    color: #444;
    line-height: 1.6;
    max-width: 450px;
    margin-bottom: 30px;
    text-align: left;
}

.btn-learn-more {
    display: inline-flex;
    align-items: center;
    padding: 14px 30px;
    background-color: #D90916;
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 6px;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.btn-learn-more:hover {
    background-color: #b00712;
}

/* State 5 Split Cards */
.state-5-container {
    position: absolute;
    top: -10vh; /* Viewport position: 25vh (parent) - 10vh = 15vh. Gives plenty of room on top. */
    left: 50%;
    transform: translateX(-50%) translateY(30vh);
    width: 90%;
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap; /* Enable wrapping for a 2x2 grid */
    justify-content: space-between;
    gap: 20px; /* Reduced gap to save vertical space */
    opacity: 0;
    transition: all 0.8s ease;
    pointer-events: none;
}

body.state-5 .state-5-container {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.3s;
    pointer-events: auto;
}

body.state-6 .state-5-container,
body.state-7 .state-5-container,
body.state-8 .state-5-container,
body.state-9 .state-5-container,
body.state-10 .state-5-container,
body.state-11 .state-5-container {
    opacity: 0;
    transform: translateX(-50%) translateY(-35vh);
    transition-delay: 0s;
    pointer-events: none;
}

.split-card {
    flex: 0 0 calc(50% - 10px); /* Take exactly half width minus half the new 20px gap */
    height: 38vh; /* Shorter to fit 2 rows safely inside the viewport */
    min-height: 250px; /* Lower minimum to prevent overflow on small screens */
    max-height: 350px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    overflow: hidden;
}

.split-card.custom-solutions {
    background-image: url('assets/card11.png');
}

.split-card.sustainable-approach {
    background-image: url('assets/card2.png');
}

.split-card.advanced-manufacturing {
    background-image: url('assets/products.png');
}

.split-card.global-distribution {
    background-image: url('assets/Quality.png');
}

.card-content-split {
    background: linear-gradient(to right, rgba(253,253,253,0.95) 45%, rgba(253,253,253,0.3) 100%);
    width: 100%;
    height: 100%;
    padding: 30px 40px; /* Reduced padding to fit smaller card */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.card-content-split h3 {
    font-size: 1.6rem; /* Scaled down heading */
    font-weight: 800;
    color: #111;
    margin-bottom: 15px;
    line-height: 1.2;
}

.card-content-split p {
    font-size: 0.95rem; /* Scaled down text */
    color: #444;
    line-height: 1.5;
    max-width: 65%; /* Reduced from 85% to constrain text width */
}

/* State 6 Content */
.state-6-content {
    position: absolute;
    top: 25vh; /* Parent starts at 25vh. 25vh + 25vh = 50vh (exact middle of screen) */
    left: 50%;
    transform: translateX(-50%) translateY(calc(-50% + 30px));
    width: 90%;
    max-width: 1000px;
    text-align: center;
    opacity: 0;
    transition: all 0.8s ease;
    pointer-events: none;
}

body.state-6 .state-6-content {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%);
    transition-delay: 0.3s;
    pointer-events: auto;
}

.state-6-content .subtitle {
    color: #D90916;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.state-6-content h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #111;
    line-height: 1.25;
    margin-bottom: 25px;
}

.state-6-content .description {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.btn-solid-red {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #D90916;
    color: white;
    padding: 15px 35px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-solid-red:hover {
    background-color: #b00712;
}

body.state-7 .state-6-content,
body.state-8 .state-6-content,
body.state-9 .state-6-content,
body.state-10 .state-6-content,
body.state-11 .state-6-content {
    opacity: 0;
    transform: translateX(-50%) translateY(-50vh);
    transition-delay: 0s;
    pointer-events: none;
}

/* State 7 Content */
.state-7-content {
    position: absolute;
    top: -25vh; /* Reset back to top of viewport */
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden; /* Prevent horizontal scroll from red curve */
}

/* State 7 Text Block */
.state-7-text {
    position: absolute;
    top: 50%;
    left: 8%;
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.8s ease;
    pointer-events: none;
    z-index: 10;
}

body.state-7 .state-7-text {
    opacity: 1;
    transform: translateY(-50%);
    transition-delay: 0.3s;
    pointer-events: auto;
}

.state-7-text h2 {
    font-size: 3.5rem;
    font-weight: 800;
    color: #111;
    line-height: 1.1;
    margin-bottom: 30px;
}

/* State 7 Graphic Block */
.state-7-graphic {
    position: absolute;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100vh;
    transform: translateX(50px);
    opacity: 0;
    transition: all 0.8s ease;
}

body.state-7 .state-7-graphic {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.4s;
    pointer-events: auto;
}

.red-curve {
    position: absolute;
    top: -40vh;
    right: -45vw;
    width: 80vw;
    height: 170vh;
    box-sizing: border-box;
    background-color: transparent; /* Make it hollow */
    border-radius: 50%;
    border: 10vw solid #D90916; /* Thick red stroke */
    box-shadow: -5px 0 60px rgba(217, 9, 22, 0.6); /* Red outer glow */
    z-index: 1;
}

.prod-item {
    position: absolute;
    z-index: 2;
}

.prod-item:hover {
    z-index: 10; /* Bring to front on hover */
}

.prod-img {
    width: 100%;
    display: block;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.prod-item:hover .prod-img {
    transform: scale(1.08); /* Hover animation */
}

.prod-details {
    position: absolute;
    top: 50%;
    right: 110%; /* Placed to the left of the image */
    transform: translateY(-50%) translateX(20px);
    width: 220px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    pointer-events: none; /* Ignore mouse over the card itself */
    border-left: 4px solid #D90916;
}

.prod-item:hover .prod-details {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.prod-details h4 {
    color: #111;
    font-size: 1.1rem;
    margin-bottom: 6px;
    font-weight: 800;
}

.prod-details p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

/* Positioning images along the curve */
.prod-1 {
    top: 12vh;
    right: 21vw;
    width: 22vw;
    max-width: 200px;
}

.prod-2 {
    top: 32vh;
    right: 23vw;
    width: 20vw;
    max-width: 200px;
}

.prod-3 {
    top: 54vh;
    right: 22vw;
    width: 18vw;
    max-width: 200px;
    z-index: 4; /* Places pallet boxes IN FRONT of colored rolls */
}

.prod-4 {
    bottom: 1vh;
    right: 17vw;
    width: 22vw;
    max-width: 200px;
    z-index: 3; /* Placed BEHIND the pallet boxes */
}

/* Slide out state 7 */
body.state-8 .state-7-text,
body.state-9 .state-7-text,
body.state-10 .state-7-text,
body.state-11 .state-7-text {
    opacity: 0;
    transform: translateY(-50%) translateX(100vw);
    transition-delay: 0s;
    pointer-events: none;
}
body.state-8 .state-7-graphic,
body.state-9 .state-7-graphic,
body.state-10 .state-7-graphic,
body.state-11 .state-7-graphic {
    opacity: 0;
    transform: translateX(-100vw);
    transition-delay: 0s;
    pointer-events: none;
}

/* State 8 Content */
.state-8-content {
    position: absolute;
    top: -25vh;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden; /* Prevent horizontal scroll from red curve */
}

/* State 8 Text Block */
.state-8-text {
    position: absolute;
    top: 50%;
    right: 8%; /* Placed on the right side */
    transform: translateY(-50%) translateX(100vw); /* starts far right */
    opacity: 0;
    text-align: right;
    transition: all 0.8s ease;
    pointer-events: none;
    z-index: 10;
}

body.state-8 .state-8-text {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0.3s;
    pointer-events: auto;
}

.state-8-text h2 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #111;
    line-height: 1.2;
    margin-bottom: 30px;
}

.state-8-text h2 .highlight {
    color: #D90916;
}

/* State 8 Graphic Block */
.state-8-graphic {
    position: absolute;
    top: 0;
    left: 0;
    width: 50vw;
    height: 100vh;
    transform: translateX(-100vw); /* starts far left */
    opacity: 0;
    transition: all 0.8s ease;
}

body.state-8 .state-8-graphic {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.4s;
    pointer-events: auto;
}

.red-curve-left {
    position: absolute;
    top: -40vh;
    left: -50vw; /* Center on left side */
    width: 80vw;
    height: 170vh;
    box-sizing: border-box;
    background-color: transparent;
    border-radius: 50%;
    border: 10vw solid #D90916;
    box-shadow: 5px 0 60px rgba(217, 9, 22, 0.6); /* Glow on the right side */
    z-index: 1;
}

.blend-multiply {
    mix-blend-mode: multiply; /* Multiplies subject with red, makes white background transparent */
}

/* Details card placed on the right of the image */
.prod-details-right {
    left: 110%; /* Place to the right of image */
    right: auto;
    transform: translateY(-50%) translateX(-20px);
    border-left: none;
    border-right: 4px solid #D90916;
    text-align: right;
}

.prod-item:hover .prod-details-right {
    transform: translateY(-50%) translateX(0);
}

/* Positioning State 8 images along the left curve */
.prod-s8-1 {
    top: 12vh;
    left: 17vw;
    width: 28vw;
    max-width: 180px;
}

.prod-s8-2 {
    top: 34vh;
    left: 19vw;
    width: 22vw;
    max-width: 180px;
}

.prod-s8-3 {
    top: 57vh;
    left: 17vw;
    width: 24vw;
    max-width: 180px;
    z-index: 4;
}

.prod-s8-4 {
    bottom: 1vh;
    left: 11vw;
    width: 26vw;
    max-width: 180px;
    z-index: 3;
}

/* Slide out state 8 */
body.state-9 .state-8-text,
body.state-10 .state-8-text,
body.state-11 .state-8-text {
    opacity: 0;
    transform: translateY(-50%) translateX(-100vw);
    transition-delay: 0s;
    pointer-events: none;
}
body.state-9 .state-8-graphic,
body.state-10 .state-8-graphic,
body.state-11 .state-8-graphic {
    opacity: 0;
    transform: translateX(100vw);
    transition-delay: 0s;
    pointer-events: none;
}

/* State 9 Content */
.state-9-content {
    position: absolute;
    top: -25vh;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

/* State 9 Text Block on Left */
.state-9-text {
    position: absolute;
    top: 50%;
    left: 8%;
    width: 40vw;
    transform: translateY(-50%) translateX(-100vw); /* starts far left */
    opacity: 0;
    transition: all 0.8s ease;
    pointer-events: none;
    z-index: 10;
}

body.state-9 .state-9-text,
body.state-10 .state-9-text {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0.3s;
    pointer-events: auto;
}

body.state-11 .state-9-text {
    opacity: 0;
    transform: translateY(-50%) translateX(-100vw);
    transition-delay: 0s;
    pointer-events: none;
}

.state-9-text .red-subtitle {
    color: #D90916;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.state-9-text h2 {
    font-size: 3.5rem;
    font-weight: 800;
    color: #111;
    line-height: 1.1;
    margin-bottom: 30px;
}

.state-9-text p {
    font-size: 1.1rem;
    color: #111;
    line-height: 1.6;
    font-weight: 600;
    max-width: 90%;
    margin-bottom: 0;
}

/* State 9 Graphic Block on Right */
.state-9-graphic {
    position: absolute;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100vh;
    transform: translateX(100vw); /* starts far right */
    opacity: 0;
    transition: all 0.8s ease;
}

body.state-9 .state-9-graphic,
body.state-10 .state-9-graphic,
body.state-11 .state-9-graphic {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.4s;
    pointer-events: auto;
}

.red-curve-bottom-right {
    position: absolute;
    bottom: -30vh;
    right: -35vw; /* Curve centered on bottom right edge */
    width: 80vw;
    height: 140vh;
    box-sizing: border-box;
    background-color: transparent;
    border-radius: 50%;
    border: 10vw solid #D90916;
    box-shadow: -10px -10px 60px rgba(217, 9, 22, 0.5); /* Glow top-left */
    z-index: 1;
    transition: opacity 0.5s ease;
}

/* Hide the red curve in state 11 (Layer Details section) */
body.state-11 .red-curve-bottom-right {
    opacity: 0;
    pointer-events: none;
}

.layers-container {
    position: absolute;
    top: 25vh;
    right: 15vw;
    width: 35vw;
    max-width: 550px;
    height: 60vh;
    z-index: 2;
    transition: all 0.5s ease;
}


.layer-img {
    position: absolute;
    width: 70%; /* Reduced width to allow room for shifting */
    height: auto;
    max-height: 70%;
    object-fit: contain;
    transition: all 0.5s ease;
}


/* Offset the layers slightly so they form a single thick sheet when combined at the center */
.layer-1 { bottom: 42%; left: 0%; z-index: 5; }
.layer-2 { bottom: 43%; left: 0%; z-index: 4; }
.layer-3 { bottom: 40%; left: 0%; z-index: 3; }
.layer-4 { bottom: 37%; left: 0%; z-index: 2; }
.layer-5 { bottom: 34%; left: 0%; z-index: 1; }

/* In state 10, expand from the center without gaps */
body.state-10 .layer-1 {
    bottom: 90%;
    left: 0%;
}

body.state-10 .layer-2 {
    bottom: 70%;
    left: 0%;
}

body.state-10 .layer-3 {
    bottom: 45%;
    left: 0%;
}

body.state-10 .layer-4 {
    bottom: 20%;
    left: 0%;
}

body.state-10 .layer-5 {
    bottom: -5%;
    left: 0%;
}

/* In state 11, move container to center and keep layers expanded */
body.state-11 .layers-container {
    right: 50vw;
    transform: translateX(50%);
}

body.state-11 .layer-1 { bottom: 90%; left: 0%; }
body.state-11 .layer-2 { bottom: 70%; left: 0%; }
body.state-11 .layer-3 { bottom: 45%; left: 0%; }
body.state-11 .layer-4 { bottom: 20%; left: 0%; }
body.state-11 .layer-5 { bottom: -5%; left: 0%; }

/* Layer Details styling for state 11 */
.layer-detail {
    position: absolute;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: all 0.8s ease;
    width: 250px;
    z-index: 10;
    pointer-events: none;
}

body.state-11 .layer-detail {
    opacity: 1;
}

.layer-detail.left {
    right: 100%; /* Relative to the left edge of layers */
    justify-content: flex-end;
}

.layer-detail.right {
    left: 70%; /* Relative to the right edge of layers (which are 70% wide) */
    justify-content: flex-start;
}

.detail-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111;
    line-height: 1.3;
}

.layer-detail.left .detail-text {
    text-align: right;
    margin-right: 15px;
}

.layer-detail.right .detail-text {
    text-align: left;
    margin-left: 15px;
}

.detail-line {
    width: 60px;
    height: 0;
    border-top: 2px dashed #111;
}

/* Positioning details to match layer heights */
.detail-1 { bottom: 95%; }
.detail-2 { bottom: 75%; }
.detail-3 { bottom: 50%; }
.detail-4 { bottom: 25%; }
.detail-5 { bottom: 0%; }

/* State 12 Content (Innovation Layout) */
.state-12-content {
    position: absolute;
    top: -25vh; /* Compensate for the parent hero container alignment */
    left: 0;
    width: 100vw; /* Take up full screen width */
    height: 100vh; /* Take up full screen height */
    background-color: #ffffff; /* Hide background elements like the video */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15vh;
    opacity: 0;
    pointer-events: none;
    transition: all 0.8s ease;
    z-index: 10;
    overflow: hidden;
}

body.state-12 .state-12-content {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.3s;
}

/* Hide previous state elements when in state 12 */
body.state-12 .state-11-content,
body.state-12 .state-9-text,
body.state-12 .state-9-graphic,
body.state-12 .layer-detail,
body.state-12 .layers-container {
    opacity: 0 !important;
    pointer-events: none;
}

.state-12-title {
    font-size: 2rem;
    font-weight: 800;
    color: #111;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 2vh;
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.8s ease;
}

body.state-12 .state-12-title {
    transform: translateY(0);
    opacity: 1;
    transition-delay: 0.5s;
}

.innovation-swirl {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Red Swirl Background using CSS */
.innovation-swirl::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vh;
    height: 50vh;
    border-radius: 50%;
    border: 40px solid #D90916;
    border-left-color: transparent;
    border-bottom-color: transparent;
    box-shadow: 10px -10px 40px rgba(217,9,22,0.3);
    opacity: 0;
    transition: all 1s ease;
    z-index: 0;
}

.innovation-swirl::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(180deg);
    width: 50vh;
    height: 50vh;
    border-radius: 50%;
    border: 40px solid #D90916;
    border-left-color: transparent;
    border-bottom-color: transparent;
    box-shadow: 10px -10px 40px rgba(217,9,22,0.3);
    opacity: 0;
    transition: all 1s ease;
    z-index: 0;
}

body.state-12 .innovation-swirl::before {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg);
    transition-delay: 0.7s;
}

body.state-12 .innovation-swirl::after {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(225deg);
    transition-delay: 0.7s;
}

.innovation-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: #D90916;
    letter-spacing: 2px;
    z-index: 5;
    background: white;
    padding: 10px 40px;
    border-radius: 30px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

body.state-12 .innovation-text {
    opacity: 1;
    transform: scale(1);
    transition-delay: 1s;
}

.machine-wrapper {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
    opacity: 0;
    transition: all 0.8s ease;
}

.top-left-machine {
    top: 6%;
    left: -2%;
    transform: translateX(-50px);
}

.bottom-right-machine {
    bottom: 6%;
    right: -2%;
    transform: translateX(50px);
}

body.state-12 .top-left-machine,
body.state-12 .bottom-right-machine {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 1.2s;
}

.machine-bubble {
    background: #ffffff;
    padding: 30px 35px;
    border-radius: 20px;
    width: 360px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08), 0 5px 15px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
}

.machine-bubble:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px rgba(217,9,22,0.1), 0 10px 20px rgba(0,0,0,0.06);
    border-color: rgba(217,9,22,0.2);
}

.machine-bubble h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #111;
    margin-bottom: 15px;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.machine-bubble p {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.65;
}

/* Subtle red accent line */
.machine-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 35px; /* Aligned with padding */
    width: 60px;
    height: 4px;
    background: #D90916;
    border-radius: 0 0 4px 4px;
    transition: width 0.4s ease;
}

.machine-bubble:hover::before {
    width: 100px;
}

/* Speech bubble arrows */
.right-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -16px;
    transform: translateY(-50%);
    border-width: 16px 0 16px 16px;
    border-style: solid;
    border-color: transparent transparent transparent #ffffff;
    filter: drop-shadow(4px 0px 3px rgba(0,0,0,0.04));
}

.left-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -16px;
    transform: translateY(-50%);
    border-width: 16px 16px 16px 0;
    border-style: solid;
    border-color: transparent #ffffff transparent transparent;
    filter: drop-shadow(-4px 0px 3px rgba(0,0,0,0.04));
}

.machine-img {
    width: 250px;
    height: auto;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* Navbar Responsive */
    .navbar {
        padding: 20px 5%;
    }

    .hamburger {
        display: block;
    }

    .nav-links {
        position: absolute;
        left: -100%;
        top: 100%;
        flex-direction: column;
        background-color: #ffffff;
        width: 100%;
        text-align: center;
        transition: 0.3s ease;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        padding: 20px 0;
        gap: 0;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links a {
        margin: 15px 0;
        display: block;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    /* Hero Section Responsive Layout */
    body.state-1 .hero-video-wrapper {
        top: 15vh;
        left: 5%;
        width: 90%;
        height: 50.625vw;
        transform: translateY(0);
    }

    body.state-2 .hero-video-wrapper,
    body.state-3 .hero-video-wrapper,
    body.state-4 .hero-video-wrapper,
    body.state-5 .hero-video-wrapper,
    body.state-6 .hero-video-wrapper,
    body.state-7 .hero-video-wrapper,
    body.state-8 .hero-video-wrapper,
    body.state-9 .hero-video-wrapper,
    body.state-10 .hero-video-wrapper,
    body.state-11 .hero-video-wrapper,
    body.state-12 .hero-video-wrapper {
        top: 15vh;
        left: 5%;
        width: 90%;
        height: 50.625vw;
        transform: translateY(0) scale(0.95);
    }

    .hero-text {
        top: calc(15vh + 50.625vw + 30px);
        left: 5%;
        width: 90%;
        text-align: center;
        transform: translateY(0) translateX(-50px);
    }

    body.state-1 .hero-text {
        top: calc(15vh + 50.625vw + 30px);
        transform: translateY(0) translateX(0);
    }

    body.state-2 .hero-text,
    body.state-3 .hero-text,
    body.state-4 .hero-text,
    body.state-5 .hero-text,
    body.state-6 .hero-text,
    body.state-7 .hero-text,
    body.state-8 .hero-text,
    body.state-9 .hero-text,
    body.state-10 .hero-text,
    body.state-11 .hero-text {
        top: calc(15vh + 50.625vw + 30px);
        transform: translateY(0) translateX(-50px);
    }

    .hero-text h1 {
        font-size: 2.2rem;
        margin-bottom: 15px;
    }

    .hero-text p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .state-2-text {
        margin-top: 25px;
    }

    /* Make State 4 Card fit mobile */
    .state-4-card {
        width: 90%;
        height: auto; 
        min-height: auto; 
        max-height: none;
        top: 25vh; /* Center it better vertically */
    }

    .card-content {
        padding: 30px 25px; /* Reduce padding significantly to fit content */
    }

    .card-content h3 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .card-content p {
        font-size: 1rem;
        margin-bottom: 25px;
    }

    /* State 5 Split Cards Responsive */
    .state-5-container {
        width: 95%;
        gap: 10px;
        transform: translateX(-50%) translateY(20vh); /* Adjust vertical placement */
    }

    body.state-5 .state-5-container {
        transform: translateX(-50%) translateY(0);
    }

    .split-card {
        flex: 0 0 calc(50% - 5px);
        height: auto; 
        min-height: 220px; 
    }

    .card-content-split {
        padding: 20px 15px; 
        background: linear-gradient(to right, rgba(253,253,253,0.95) 60%, rgba(253,253,253,0.1) 100%);
    }

    .card-content-split h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .card-content-split p {
        font-size: 0.85rem;
        max-width: 100%;
    }

    /* Move state-2 text out of the way for state-4 on mobile */
    body.state-4 .state-2-text {
        opacity: 0;
        transform: translateY(-60vh); 
    }

    /* Footer Responsive */
    .footer-links-section {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 10vh 5% 2vh;
        gap: 15px;
    }

    .footer-col {
        flex: 0 0 45%;
        margin-bottom: 20px;
    }

    .footer-col h4 {
        margin-bottom: 15px;
        font-size: 1rem;
    }

    .footer-col ul li {
        margin-bottom: 12px;
    }

    .footer-col-divider {
        display: none;
    }

    /* State 7/8 Responsive */
    .state-7-text, .state-8-text {
        top: 15vh;
        left: 5% !important;
        right: auto !important;
        width: 90%;
        text-align: center !important;
        transform: translateY(0) !important;
    }

    body.state-7 .state-7-text,
    body.state-8 .state-8-text {
        transform: translateY(0) !important;
    }

    body.state-8 .state-7-text,
    body.state-9 .state-8-text {
        transform: translateY(0) translateX(-100vw) !important;
    }

    .state-7-text h2, .state-8-text h2 {
        font-size: 2.2rem;
        margin-bottom: 20px;
    }

    .state-7-graphic, .state-8-graphic {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-content: center;
        gap: 20px;
        top: 45vh;
        left: 0 !important;
        width: 100vw;
        height: 50vh;
        transform: none !important;
    }

    body.state-7 .state-7-graphic,
    body.state-8 .state-8-graphic {
        transform: none !important;
    }

    body.state-8 .state-7-graphic,
    body.state-9 .state-8-graphic {
        opacity: 0;
        pointer-events: none;
    }

    .red-curve, .red-curve-left {
        display: none; /* Hide large curves on mobile */
    }

    .prod-item {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 35vw !important;
        max-width: 150px !important;
        margin: 5px;
    }

    .prod-details, .prod-details-right {
        display: none; /* Hide hover tooltips on mobile since there is no hover */
    }

    /* State 9/10 Text and Layout Responsive */
    .state-9-text {
        top: 15vh;
        left: 5%;
        width: 90%;
        text-align: center;
        transform: translateY(0) translateX(-100vw);
    }

    body.state-9 .state-9-text,
    body.state-10 .state-9-text {
        transform: translateY(0) translateX(0);
    }

    body.state-11 .state-9-text {
        transform: translateY(0) translateX(-100vw);
    }

    .state-9-text h2 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .state-9-text .red-subtitle {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .state-9-text p {
        font-size: 0.9rem;
        max-width: 100%;
        margin: 0 auto;
    }

    .state-9-graphic {
        width: 100vw;
    }

    .red-curve-bottom-right {
        display: none; /* Hide large obstructing red curve on mobile */
    }

    /* State 10/11 Layers Mobile */
    .layers-container {
        top: 48vh;
        width: 35vw;
        right: 50vw !important; /* Force center on all states */
        transform: translateX(50%) !important;
    }

    body.state-11 .layers-container {
        top: 35vh; /* Move up when text fades out */
    }

    .layer-img {
        width: 100%; /* Fill the container so it centers perfectly */
    }

    .layer-detail.left {
        right: 100%;
    }

    .layer-detail.right {
        left: 100%; /* Adjust right detail to match 100% image width */
    }

    .layer-detail {
        width: 110px;
    }

    .detail-text {
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .detail-line {
        width: 15px;
    }

    .layer-detail.left .detail-text {
        margin-right: 5px;
    }

    .layer-detail.right .detail-text {
        margin-left: 5px;
    }

    /* State 12 Responsive (Innovation Section) */
    .state-12-content {
        padding-top: 10vh;
        overflow-y: auto; /* Allow scrolling if content is too tall */
    }

    .state-12-title {
        font-size: 1.3rem;
        padding: 0 15px;
        margin-bottom: 2vh;
        transform: translateY(-20px);
    }

    .innovation-swirl {
        flex-direction: column;
        height: auto;
        gap: 20px;
        padding-bottom: 5vh;
    }

    .innovation-swirl::before,
    .innovation-swirl::after {
        width: 30vh;
        height: 30vh;
        border-width: 20px;
    }

    .machine-wrapper {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none !important; /* Override desktop translate */
        width: 100%;
        justify-content: center;
    }

    .machine-bubble {
        width: 90%;
        max-width: 400px;
        padding: 20px 25px;
    }

    /* Hide the desktop speech bubble arrows on mobile */
    .machine-bubble.right-arrow::after,
    .machine-bubble.left-arrow::after {
        display: none;
    }

    /* Hide the machine images on mobile to prevent clutter/cutoff */
    .machine-img {
        display: none;
    }

    .innovation-text {
        font-size: 1.2rem;
        padding: 8px 25px;
    }
}

/* --- State 13 Footer Content --- */
body.state-13 .state-12-content {
    opacity: 1; /* Keep solid white to hide background video during transition */
    pointer-events: none;
    /* Do not translate away, otherwise it reveals the video underneath */
}

.state-13-content {
    position: absolute;
    top: -24vh; 
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: all 0.8s ease;
    z-index: 10;
    background-color: #ffffff;
}

body.state-13 .state-13-content {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.3s;
}

.footer-links-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 5% 5vh;
    gap: 40px;
    background-color: #ffffff;
    flex-grow: 1;
}

.footer-col {
    flex: 1;
    max-width: 250px;
}

.footer-col-divider {
    width: 1px;
    background-color: #e0e0e0;
    height: 180px;
    margin-top: 20px;
}

.footer-col h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: #111;
    text-transform: uppercase;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col ul li {
    margin-bottom: 18px;
}

.footer-col ul li a {
    color: #111;
    text-decoration: none;
    font-weight: 800;
    font-size: 1rem;
    transition: color 0.3s;
}

.footer-col ul.underlined-links li a {
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 2px;
}

.footer-col ul li a:hover {
    color: #D90916;
}

.footer-huge-text-container {
    width: 100%;
    text-align: center;
    background: linear-gradient(to bottom, #ffffff 45%, #000000 45%);
    line-height: 0.75;
    overflow: hidden;
}

.huge-text-bg {
    font-size: 15vw;
    font-weight: 900;
    color: #D90916;
    margin: 0;
    padding: 0;
    letter-spacing: -0.2vw;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    display: inline-block;
    transform: translateY(10%);
    white-space: nowrap;
}

.footer-bottom-bar {
    background-color: #000000;
    color: #ffffff;
    text-align: center;
    padding: 30px 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.footer-bottom-bar a.riolabz-link {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
}
