html {
    font-size: clamp(10px, calc(100vw / 120), 50px);
}

:root {
    --bg-dark: #0a0a0a;
    --bg-darker: #050505;
    --text-light: #f0f0f0;
    --accent-gold: #ffd700;
    --accent-blue: #007bff;
    --white: #ffffff;
    --transition: all 0.3s ease;

    /* Shared scalable spacing + type tokens */
    --page-inline-pad: 2rem;
    --section-inline-pad: 3rem;
    --content-max: 40rem;

    --font-small: 0.8rem;
    --font-body: 1rem;
    --font-medium: 1.5rem;
    --font-large: 2.2rem;
    --font-heading: 3.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navbar & Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
}

.navbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1.5rem 2rem;
    /* Balanced breathing room */
}

.nav-links {
    position: fixed;
    right: 0;
    top: 0;
    transform: translate3d(100%, 0, 0); /* Force GPU */
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: #0a0a0c; /* Solid fallback */
    background: rgba(10, 10, 12, 0.98); /* Near-opaque for high performance */
    backdrop-filter: blur(20px); /* Static blur is much faster than animated blur */
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    height: 100vh;
    min-height: 100svh;
    height: 100dvh;
    text-align: center;
    gap: clamp(1.25rem, 2.2vh, 2.2rem);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 999;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    padding-right: 2rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: 2rem;
    overflow-y: auto;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    will-change: transform;
}

/* Hide visual scrollbar for Webkit browsers */
.nav-links::-webkit-scrollbar {
    display: none;
}

/* Cinematic background layer - Fixed to prevent "void" when scrolling */
.nav-links::before {
    content: "";
    position: fixed; /* Stays put while content scrolls */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0c; /* Deep base color */
    background: radial-gradient(circle at center, rgba(0, 123, 255, 0.07) 0%, rgba(10, 10, 12, 1) 100%);
    pointer-events: none;
    z-index: -1;
}

.nav-links.active {
    transform: translate3d(0, 0, 0);
}

.nav-links li {
    opacity: 0;
    transform: translate3d(0, 10px, 0); /* Reduced travel distance */
    transition: opacity 0.4s ease, transform 0.4s ease;
    will-change: opacity, transform;
}

.nav-links.active li {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Staggered link entry - Timing adjusted to start mostly AFTER slide */
.nav-links.active li:nth-child(1) { transition-delay: 0.35s; }
.nav-links.active li:nth-child(2) { transition-delay: 0.4s; }
.nav-links.active li:nth-child(3) { transition-delay: 0.45s; }
.nav-links.active li:nth-child(4) { transition-delay: 0.5s; }
.nav-links.active li:nth-child(5) { transition-delay: 0.55s; }
.nav-links.active li:nth-child(6) { transition-delay: 0.6s; }
.nav-links.active li:nth-child(7) { transition-delay: 0.65s; }
.nav-links.active li:nth-child(8) { transition-delay: 0.7s; }
.nav-links.active li:nth-child(9) { transition-delay: 0.75s; }
.nav-links.active li.lang-dropdown-container { transition-delay: 0.8s; }


.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 300;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.4rem;
    display: inline-block;
    position: relative;
    padding: 0.8rem 2rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    transition: all 0.4s ease;
    transform: translateX(-50%);
    opacity: 0.7;
}

.nav-links a:hover {
    color: var(--accent-gold);
    letter-spacing: 0.55rem;
    text-shadow: 0 0 2rem rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}

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

.lang-dropdown-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 2.5rem;
}

.lang-dropdown-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: 1rem 3rem;
    border-radius: 10rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    text-transform: uppercase;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    letter-spacing: 2px;
}

.lang-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 2rem rgba(255, 215, 0, 0.1);
}

.lang-dropdown-menu {
    display: flex !important; /* Ensure it stays flex for animation */
    flex-direction: column;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: center;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, margin-top 0.4s ease;
    gap: 0.6rem;
}

.lang-dropdown-container.active .lang-dropdown-menu {
    max-height: 400px !important;
    opacity: 1 !important;
    margin-top: 0.5rem; /* Reduced from 1.5rem to fix the gap */
}

.lang-dropdown-menu li {
    width: auto;
    opacity: 0;
    transform: translate3d(0, -10px, 0); /* Slide down from slightly above */
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.lang-dropdown-container.active .lang-dropdown-menu li {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Staggered entry for language options */
.lang-dropdown-container.active .lang-dropdown-menu li:nth-child(1) { transition-delay: 0.1s; }
.lang-dropdown-container.active .lang-dropdown-menu li:nth-child(2) { transition-delay: 0.18s; }
.lang-dropdown-container.active .lang-dropdown-menu li:nth-child(3) { transition-delay: 0.26s; }
.lang-dropdown-container.active .lang-dropdown-menu li:nth-child(4) { transition-delay: 0.34s; }

.lang-dropdown-menu .lang-btn {
    background: none;
    border: none;
    color: var(--text-light);
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    text-transform: uppercase;
    transition: all 0.3s ease;
    opacity: 0.5;
    letter-spacing: 1px;
}

.lang-dropdown-menu .lang-btn:hover {
    color: var(--accent-gold);
    opacity: 1;
    transform: scale(1.1);
}

.lang-dropdown-menu .lang-btn.active {
    display: none;
}

.hamburger {
    display: flex;
    /* Always visible */
    flex-direction: column;
    gap: 0.375rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    /* Above the nav menu */
}

.hamburger span {
    width: 1.875rem;
    height: 0.125rem;
    background: var(--text-light);
    transition: var(--transition);
}

/* Hamburger Open Animation */
.hamburger.open span:nth-child(1) {
    transform: translateY(0.5rem) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-0.5rem) rotate(-45deg);
}



/* Section 1: Hero */
.hero-section {
    position: relative;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    overflow: hidden;
    transition: background-color 3s ease;
    /* Smooth shift to midnight blue */
}

.hero-section.magic-active {
    background-color: #050a1a;
    /* Deep midnight blue */
}

/* SEO H1 Trick */
#seo-h1 {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    /* Bumped up significantly per user request */
    font-weight: 300;
    letter-spacing: 0.25rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    z-index: 10;
    opacity: 0;
    /* Hidden initially */
    transition: opacity 2s ease;
    /* Gradual fade in */
    pointer-events: none;
}

#seo-h1.revealed {
    opacity: 1;
}

#starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#star-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Initially hide the background starfield */
#starfield {
    opacity: 1;
    /* Keep canvas visible for mouse interaction */
    transition: filter 2s ease;
}

#starfield.revealed {
    filter: brightness(1.3) contrast(1.1);
}

.star-container {
    position: relative;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#nebula {
    position: absolute;
    width: 25rem;
    height: 25rem;
    background: radial-gradient(circle, rgba(64, 156, 255, 0.15) 0%, rgba(255, 215, 0, 0.05) 40%, transparent 70%);
    filter: blur(3.75rem);
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 2s ease, transform 2s ease;
}

.hero-section.magic-active #nebula {
    opacity: 0.8;
    transform: scale(1.5);
    background: radial-gradient(circle, rgba(100, 180, 255, 0.2) 0%, rgba(150, 100, 255, 0.1) 50%, transparent 80%);
}

.magic-star-container {
    width: 7.5rem;
    height: 7.5rem;
    cursor: pointer;
    margin: 0 auto;
    -webkit-tap-highlight-color: transparent; /* Remove blue hitbox on mobile */
    transition: transform 0.5s ease, filter 0.5s ease;
    /* Toned down Ethereal Glow to prevent banding */
    filter:
        drop-shadow(0 0 0.3125rem #fff) drop-shadow(0 0 0.625rem rgba(255, 255, 255, 0.6)) drop-shadow(0 0 1.25rem rgba(0, 123, 255, 0.3)) drop-shadow(0 0 2.5rem rgba(255, 215, 0, 0.15));
    display: flex;
    justify-content: center;
    align-items: center;
}

.magic-star-container:hover {
    filter:
        drop-shadow(0 0 0.5rem #fff) drop-shadow(0 0 0.9375rem rgba(255, 255, 255, 0.8)) drop-shadow(0 0 1.875rem rgba(0, 123, 255, 0.5)) drop-shadow(0 0 3.125rem rgba(255, 215, 0, 0.25));
}

.star-svg {
    width: 100%;
    height: 100%;
}

.magic-star-container.spin {
    animation: spinY 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.magic-star-container.levitate {
    animation: levitate 3s ease-in-out infinite;
}

@keyframes spinY {
    from {
        transform: rotateY(0deg);
    }

    to {
        transform: rotateY(720deg);
    }
}

@keyframes levitate {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-1.25rem);
    }
}

.text-wrapper {
    margin-top: 1.875rem;
    height: 2.5rem;
}

.handwriting {
    font-family: 'Dancing Script', cursive;
    font-size: 2.2rem;
    color: white;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
    transform: translateY(0.625rem);
    text-shadow: 0 0 0.625rem rgba(255, 255, 255, 0.5);
}

html[lang="ru"] .handwriting {
    font-family: 'Lobster', cursive;
    font-size: 2.2rem; /* Lobster is quite bold and large naturally */
}

.magic-star-container:hover+.text-wrapper .handwriting {
    opacity: 1;
    transform: translateY(0);
}

.handwriting.revealed {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Section 2: Projects Strip */
.projects-strip {
    position: relative;
    min-height: 25rem;
    /* Increased from 18.75rem */
    display: flex;
    justify-content: flex-end;
    /* Align content to the right */
    align-items: center;
    padding: 2rem 10%;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3)), url('src/projects-bg.svg');
    background-color: #111;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Parallax effect */
    border-top: 0.0625rem solid #222;
    border-bottom: 0.0625rem solid #222;
}

.projects-strip .section-content {
    text-align: right;
    max-width: 37.5rem;
    padding: 0;
}

.projects-strip h2 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    letter-spacing: 0.0625rem;
    line-height: 1.2;
}

.btn-projects {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.9rem 2.4rem;
    border: 0.0625rem solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    text-decoration: none;
    text-transform: capitalize;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05rem;
    background: transparent;
    overflow: hidden;
    transition: all 0.4s ease;
}

.btn-projects::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 20%,
        rgba(255, 255, 255, 0.15) 40%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0.15) 60%,
        rgba(255, 255, 255, 0.03) 80%,
        transparent 100%
    );
    transform: skewX(-15deg);
    pointer-events: none;
}

@keyframes wipe-forward {
    0% { left: -100%; }
    100% { left: 150%; }
}

.btn-projects:hover::before {
    animation: wipe-forward 1s ease forwards;
}

.btn-projects::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.06) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.btn-projects:hover {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0.75rem rgba(255, 255, 255, 0.08);
}

.btn-projects:hover::after {
    opacity: 1;
}

.btn-projects::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.06) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

@keyframes magic-pulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.btn-projects:hover {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0.75rem rgba(255, 255, 255, 0.08);
}

.btn-projects:hover::before {
    left: 150%;
}

.btn-projects:hover::after {
    opacity: 1;
}



/* Section 3: Production/Postproduction */
.gradient-section.right-to-left {
    min-height: 31.25rem;
    display: flex;
    flex-direction: column;
    /* Stack text and button */
    justify-content: flex-end;
    /* Align to the bottom */
    align-items: flex-end;
    /* Align to the right */
    position: relative;
    background-color: #000;
    padding: 0 10% 5rem;
    /* Breathing room at the bottom */
    overflow: hidden;
}

/* Reveal Overlay for Section 3 animation */
.reveal-overlay {
    position: absolute;
    top: 0;
    right: 0;
    /* Align to the right */
    width: 35%;
    /* Reduced to be more concentrated */
    height: 100%;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 70%, rgba(0, 0, 0, 0) 100%);
    z-index: 2;
    transform: translateX(100%);
    /* Start off-screen right */
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.gradient-section.right-to-left .section-content {
    position: relative;
    text-align: right;
    /* Text aligned to the right */
    z-index: 3;
    transform: translateX(120%);
    /* Start slightly more off-screen right for a trailing effect */
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
    /* Slight delay */
    opacity: 0;
}

/* Revealed State */
.animate-on-scroll.revealed .reveal-overlay {
    transform: translateX(0);
}

.animate-on-scroll.revealed .section-content {
    transform: translateX(0);
    opacity: 1;
}

/* Mouse Hover Override: Hide when mouse is on the left part */
.animate-on-scroll.revealed.hover-hide .reveal-overlay {
    transform: translateX(150%);
    /* Increased to ensure it clears the screen */
}

.animate-on-scroll.revealed.hover-hide .section-content {
    transform: translateX(150%);
    /* Increased to ensure all letters clear the padding and screen */
    opacity: 1;
    /* Keep visible while sliding */
    transition-delay: 0s;
    /* Move immediately with the overlay */
}

.gradient-section.right-to-left::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12.5rem;
    /* Adjust height of the gradient as needed */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 1;
    pointer-events: none;
}

.section-3-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('src/production-bg.svg');
    background-size: cover;
    background-position: center calc(50% + 1.25rem);
    z-index: 0;
}



.gradient-section h2 {
    position: relative;
    z-index: 3;
    font-size: 1.8rem;
    font-weight: 400;
    max-width: 34.375rem;
    /* Reduced to contain text to about 20% width */
    line-height: 1.4;
    letter-spacing: 0.0625rem;
    color: white;
    text-shadow: 0.125rem 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
}

.gradient-section .btn-projects {
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    z-index: 3;
    position: relative;
}

.gradient-section .btn-projects:hover {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 1rem rgba(255, 255, 255, 0.12);
    color: white;
}

/* Section 4: White Space */
.white-space-section {
    background: #fff;
    color: #000;
    text-align: center;
    padding: 8rem 5% 4rem;
    /* Reduced padding to bring section 5 closer */
    display: flex;
    justify-content: center;
    align-items: center;
}

.white-space-section p {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.125rem;
    max-width: 56.25rem;
    line-height: 1.3;
}

/* Sections 5, 6, 7: F-Scheme Sections */
.f-scheme-section {
    min-height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
}

.f-scheme-section.magazine-layout {
    padding: 0;
}

.f-image-part {
    flex: 1;
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Keep parallax if desired */
}

.f-text-part {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 5% 10%;
    background: var(--bg-dark);
}

#section-5 {
    background-color: #ffffff;
    margin-top: -1px;
    /* Overlap by 1px to fix subpixel background rendering gaps between white sections */
}

#section-5 .f-image-part {
    flex: 1.2;
    /* Slightly wider for the image as per mockup */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: #fff;
}

.mockup-image-container {
    width: 100%;
    height: 80%;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
    /* Subtle shadow for the "box" effect */
}

/* Shared Magazine Layout Styles (Sections 5, 6, etc.) */
.f-scheme-section.magazine-layout {
    background-color: #ffffff;
}

.f-scheme-section.magazine-layout .f-image-part {
    flex: 1.2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    background: #fff;
}

.f-scheme-section.magazine-layout .f-text-part {
    flex: 1;
    background: #fff;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 4rem 5rem;
}

.mockup-image-container {
    width: 100%;
    height: 80%;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
}

#section-5 .mockup-image-container {
    background-image: url('src/narrative-bg.svg');
}

#section-6 .mockup-image-container {
    background-image: url('src/directing-bg.jpg');
}

#section-7 .mockup-image-container {
    background-image: url('src/animation-bg.svg');
}

.f-scheme-section.magazine-layout h2 {
    font-family: 'Playfair Display', serif;
    color: #1a1a1a;
    margin: 0;
    font-size: 2.4rem;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.03125rem;
    margin-bottom: 1.5rem;
}

.f-scheme-section.magazine-layout .narrative-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.1875rem;
    text-transform: uppercase;
    color: #8b7355;
    margin-bottom: 1rem;
}

.f-scheme-section.magazine-layout .narrative-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 300;
    color: #333;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.f-scheme-section.magazine-layout ul {
    list-style: none;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.f-scheme-section.magazine-layout li {
    font-family: 'Inter', sans-serif;
    color: #333;
    font-size: 1.05rem;
    font-weight: 300;
    position: relative;
    padding-left: 1.8rem;
    line-height: 1.6;
}

.f-scheme-section.magazine-layout li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: #c9a84c;
    font-weight: 400;
}

/* Comparison Slider (Section 7) */
.comparison-slider {
    position: relative;
    width: 100%;
    height: 80%;
    overflow: hidden;
    cursor: ew-resize;
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
}

.image-before,
.image-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.image-before {
    z-index: 2;
    /* Initial diagonal clip: from top-left to middle-bottom */
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.image-after {
    z-index: 1;
}

.slider-handle {
    position: absolute;
    top: -10%;
    /* Extend to cover diagonal */
    left: 50%;
    width: 0.25rem;
    height: 120%;
    /* Extend to cover diagonal */
    background: white;
    z-index: 3;
    transform: translateX(-50%) rotate(15.5deg);
    /* Flipped only the divider axis */
    pointer-events: none;
    box-shadow: 0 0 1.25rem rgba(0, 0, 0, 0.5);
}

.handle-line {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0.625rem rgba(0, 0, 0, 0.3);
}

.slider-handle .label {
    position: absolute;
    top: 50%;
    background: white;
    color: black;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.2);
}

.before-label {
    right: 1.25rem;
    transform: translateY(-120%) rotate(-15.5deg);
}

.after-label {
    left: 1.25rem;
    transform: translateY(20%) rotate(-15.5deg);
}

#section-7 .f-image-part {
    background-color: #fff;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}


.f-scheme-section .section-content {
    max-width: 37.5rem;
    padding: 0;
}

.f-scheme-section h2 {
    font-size: 3rem;
    font-weight: 300;
    margin-bottom: 2rem;
    letter-spacing: 0.0625rem;
}

.f-scheme-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.f-scheme-section li {
    font-size: 1.2rem;
    font-weight: 300;
    color: #ccc;
    position: relative;
    padding-left: 1.5rem;
}

.f-scheme-section li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
}

/* Section 8: Split (About & Contact) */
.split-section {
    display: flex;
    min-height: 100vh;
    padding: 0;
    background: var(--bg-darker);
}

.about-me,
.contact-form-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10%;
}

.about-me {
    background: #151515;
    /* Lightened from #0d0d0d */
    position: relative;
    /* Base for pseudo-element divider */
}

/* Floating Divider */
.about-me::after {
    content: "";
    position: absolute;
    right: 0;
    top: 15%;
    /* Spacing from top */
    height: 70%;
    /* Line height */
    width: 0.0625rem;
    background: rgba(255, 255, 255, 0.1);
}

.portrait-placeholder {
    width: 15.625rem;
    height: 18.75rem;
    background: #1a1a1a;
    margin-bottom: 2rem;
    border: 0.0625rem solid #333;
    overflow: hidden;
    /* Ensure image doesn't spill out */
}

.portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Maintain aspect ratio and fill the box */
    display: block;
}

.about-text h3 {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: 0.03125rem;
    color: var(--text-light);
}

.about-text p {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 300;
    color: #ccc;
    max-width: 28.125rem;
    line-height: 1.6;
}

.contact-form-container {
    background: #151515;
    /* Lightened from #0d0d0d */
}

.contact-form-container form {
    max-width: 31.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

input,
textarea {
    display: block;
    /* Normalize layout */
    width: 100%;
    /* Ensure they fill the container width */
    padding: 1rem 1.2rem;
    /* Slightly reduced vertical padding */
    background: transparent;
    border: 0.0625rem solid #222;
    border-radius: 0;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    /* Explicit line-height for better cursor alignment */
    transition: var(--transition);
}

textarea {
    resize: none;
    /* Disable manual resize handle */
    overflow-y: auto;
    /* Enable vertical scroll if text overflows */
    min-height: 9.375rem;
    /* Ensure a good default height */
}

/* Custom Scrollbar for Textarea */
textarea::-webkit-scrollbar {
    width: 0.5rem;
}

textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

textarea::-webkit-scrollbar-thumb {
    background: #444;
    /* Grey handle */
    border-radius: 0.25rem;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #666;
    /* Lighter grey on hover */
}

input:focus,
textarea:focus {
    border-color: var(--accent-gold);
    outline: none;
}

.btn-send {
    padding: 1.2rem;
    background: var(--text-light);
    color: var(--bg-dark);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 0.125rem;
    transition: var(--transition);
    margin-top: 1rem;
}

.btn-send:hover {
    background: var(--accent-gold);
}

/* Footer */
footer {
    padding: 4rem 5%;
    border-top: 0.0625rem solid #222;
    background: var(--bg-darker);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

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

.footer-links a {
    color: #666;
    text-decoration: none;
    font-size: 0.8rem;
}

/* Responsive */
/* --- Responsive Refinements --- */

@media (max-width: 1024px) {

    /* Root adjustment for tablets to prevent excessive shrinking */
    html {
        font-size: 12px;
    }

    /* Hamburger UI Touch Bump */
    .hamburger {
        gap: 0.6rem;
    }

    .hamburger span {
        width: 3rem;
        height: 0.25rem;
    }

    .hamburger.open span:nth-child(1) {
        transform: translateY(0.85rem) rotate(45deg);
    }

    .hamburger.open span:nth-child(3) {
        transform: translateY(-0.85rem) rotate(-45deg);
    }

    /* Navigation Links Scale Up */
    .nav-links a {
        font-size: 2.2rem;
        letter-spacing: 0.2rem;
    }

    .lang-dropdown-btn,
    .lang-dropdown-menu .lang-btn {
        font-size: 2rem;
    }

    /* Hero Section Refinements for Tablet */
    #seo-h1 {
        font-size: 1.8rem;
        top: 4%;
        letter-spacing: 0.4rem;
    }

    .magic-star-container {
        width: 10rem;
        height: 10rem;
    }

    .hero-section .handwriting {
        opacity: 1;
        transform: translateY(0);
        font-size: clamp(3.2rem, 8vw, 5rem);
        margin-top: 2rem;
    }

    .star-container {
        margin-top: 0;
    }

    /* Magazine Layout Adjustments */
    .f-scheme-section.magazine-layout {
        flex-direction: column;
        min-height: auto;
    }

    .f-scheme-section .section-content {
        max-width: 100%;
    }

    .f-scheme-section.magazine-layout .f-image-part,
    .f-scheme-section.magazine-layout .f-text-part {
        width: 100%;
        min-height: auto;
    }

    .f-scheme-section.magazine-layout .f-image-part {
        background-attachment: scroll;
        padding: 2rem;
    }

    .f-scheme-section.magazine-layout .f-text-part,
    .f-scheme-section.magazine-layout .narrative-content {
        display: contents;
    }

    .f-scheme-section.magazine-layout .narrative-label,
    .f-scheme-section.magazine-layout .narrative-content>h2,
    .f-scheme-section.magazine-layout .narrative-subtitle,
    .f-scheme-section.magazine-layout .narrative-content>ul {
        width: 100%;
        max-width: 100%;
        padding-inline: clamp(2rem, 8vw, 4rem);
    }

    .f-scheme-section.magazine-layout .narrative-label {
        order: 1;
        margin-top: 3.5rem;
        margin-bottom: 0.8rem;
        font-size: 1.6rem;
        letter-spacing: 0.25rem;
    }

    .f-scheme-section.magazine-layout .narrative-content>h2 {
        order: 2;
        margin-bottom: 1rem;
        font-size: clamp(2.8rem, 7vw, 3.8rem);
        line-height: 1.2;
    }

    #section-5 .f-image-part,
    #section-6 .f-image-part,
    #section-7 .f-image-part,
    .f-scheme-section.magazine-layout .f-image-part {
        order: 3;
        padding: 1.5rem clamp(2rem, 8vw, 4rem);
        background: transparent;
    }

    .f-scheme-section.magazine-layout .narrative-subtitle {
        order: 4;
        margin-top: 0.5rem;
        margin-bottom: 2rem;
        font-size: 2.4rem;
        line-height: 1.5;
        font-weight: 400;
    }

    .f-scheme-section.magazine-layout .narrative-content>ul {
        order: 5;
        padding-bottom: 5rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .f-scheme-section.magazine-layout .narrative-content>ul li {
        font-size: 1.9rem;
        line-height: 1.6;
        padding-left: 2.8rem;
    }

    /* Horizontal Dividers for Tablet Pass */
    #section-3 {
        border-top: 1px solid rgba(122, 88, 0, 0.15);
    }

    #section-4.white-space-section {
        border-top: 1px solid rgba(122, 88, 0, 0.15);
        padding: 10rem 5%;
    }

    .white-space-section p {
        font-size: 5rem;
    }

    #section-6.f-scheme-section.magazine-layout,
    #section-7.f-scheme-section.magazine-layout {
        border-top: 1px solid rgba(122, 88, 0, 0.1);
    }

    .mockup-image-container,
    .comparison-slider {
        height: clamp(20rem, 60vw, 40rem);
    }

    /* Section 2 Shift Down */
    .projects-strip {
        min-height: auto;
        justify-content: flex-start;
        align-items: flex-start;
        padding: calc(clamp(15rem, 40vw, 25rem) + 2rem) clamp(2rem, 8vw, 4rem) 3rem;
        background: #0d0d0f;
        position: relative;
        overflow: hidden;
    }

    .projects-strip::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: clamp(15rem, 40vw, 25rem);
        background:
            linear-gradient(to bottom, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.35)),
            url('src/projects-bg.svg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        border-bottom: 1px solid #222;
    }

    .projects-strip .section-content {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: none;
        text-align: left;
    }

    .projects-strip h2 {
        font-size: 2.2rem;
        margin-bottom: 2rem;
    }

    /* Section 3 Sleeve Optimization */
    #section-3.gradient-section.right-to-left {
        min-height: auto;
        padding: 0;
        background: #FFF9E5;
        border-top-color: #E2D3A5;
        border-bottom-color: #E2D3A5;
        justify-content: flex-start;
        align-items: flex-start;
        overflow: hidden;
    }

    #section-3 .reveal-overlay {
        display: none;
    }

    #section-3 .section-3-bg {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        aspect-ratio: 3340 / 1400;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center top;
        background-color: #FFF9E5;
        border-bottom: 1px solid #E2D3A5;
        z-index: 1;
    }

    #section-3.gradient-section.right-to-left .section-content {
        position: relative;
        transform: none;
        opacity: 1;
        width: 100%;
        max-width: none;
        text-align: left;
        padding: 2rem clamp(2rem, 8vw, 4rem) 4rem;
        background: #FFF9E5;
        color: #555555;
        z-index: 2;
    }

    #section-3.gradient-section.right-to-left .section-content h2 {
        color: #7A5800;
        text-shadow: none;
        margin-top: 0;
        margin-bottom: 2rem;
        font-size: clamp(2rem, 3.8vw, 2.8rem);
        line-height: 1.5;
        letter-spacing: 0.03rem;
        max-width: 100%;
    }

    #section-3.gradient-section.right-to-left .btn-projects {
        border-color: rgba(170, 122, 0, 0.5);
        color: #AA7A00;
        background: transparent;
        padding: 1rem 2.5rem;
        font-size: 1.3rem;
    }

    #section-3.gradient-section.right-to-left .btn-projects:hover {
        border-color: rgba(170, 122, 0, 0.7);
        box-shadow: 0 0 1rem rgba(170, 122, 0, 0.12);
    }

    /* Split Section (About & Contact) Tablet Optimization */
    .split-section {
        flex-direction: column;
        min-height: auto;
    }

    .about-me,
    .contact-form-container {
        width: 100%;
        padding: 6rem 10%;
        align-items: center;
        text-align: center;
    }

    .about-me::after {
        display: none;
    }

    .portrait-placeholder {
        margin: 0 auto 3rem;
        width: 20rem;
        height: 24rem;
    }

    .about-text h3 {
        font-size: 3rem;
        margin-bottom: 2rem;
    }

    .about-text p {
        margin: 0 auto;
        font-size: 1.6rem;
        max-width: 90%;
        line-height: 1.8;
    }

    .contact-form-container form {
        width: 100%;
        max-width: 90%;
        margin: 0 auto;
    }

    .contact-form-container input,
    .contact-form-container textarea {
        font-size: 1.6rem;
        padding: 1.5rem;
    }

    .btn-send {
        font-size: 1.6rem;
        padding: 1.5rem;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 10px;
    }

    .navbar {
        padding-inline: clamp(0.85rem, 4.5vw, 1.25rem);
    }

    .nav-links a {
        font-size: 2.0rem;
        letter-spacing: 1.2px;
    }

    .projects-strip h2 {
        font-size: clamp(1.6rem, 6vw, 2rem);
    }

    .white-space-section p {
        font-size: clamp(2.6rem, 8vw, 3.8rem);
    }


    .split-section {
        flex-direction: column;
        min-height: auto;
    }

    .about-me,
    .contact-form-container {
        padding: 4rem 5%;
    }

    .portrait-placeholder {
        width: 16rem;
        height: 19.2rem;
        margin-bottom: 2rem;
    }

    .about-text h3 {
        font-size: 2.4rem;
    }

    .about-text p {
        font-size: 1.4rem;
    }

    .contact-form-container input,
    .contact-form-container textarea,
    .btn-send {
        font-size: 1.4rem;
    }

    .footer-content {
        justify-content: center;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* 480px Pass - Narrow Mobile */
@media (max-width: 480px) {

    .nav-links {
        gap: 1.5rem;
    }

    .nav-links a {
        font-size: 1.8rem;
    }

    .lang-dropdown-btn,
    .lang-dropdown-menu .lang-btn {
        font-size: 1.8rem;
    }

    .hero-section #magic-text {
        font-size: 2.8rem;
        /* Keep script font large enough to be legible */
    }

    .projects-strip {
        padding-top: calc(clamp(150px, 48vw, 220px) + 1.1rem);
    }

    .projects-strip::before {
        height: clamp(150px, 48vw, 220px);
    }
}

#form-status {
    margin-top: 1rem;
    font-family: 'Inter', sans-serif;
}

input[name="email"].valid {
    border-color: #4ade80 !important;
}

input[name="email"].invalid {
    border-color: #f87171 !important;
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Fix browser autofill styling to match dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #0a0a0a inset !important;
    -webkit-text-fill-color: var(--text-light) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Software Dropdown Styles */
.nav-links.active li.software-dropdown-container { transition-delay: 0.75s; }
.software-dropdown-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.software-dropdown-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 300;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
    letter-spacing: 0.4rem;
    padding: 1rem 2rem;
}
.software-dropdown-btn:hover {
    color: var(--accent-gold);
    letter-spacing: 0.55rem;
    text-shadow: 0 0 2rem rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}
.software-dropdown-menu {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: center;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.4s ease-in-out;
    gap: 1rem;
}
.software-dropdown-container.active .software-dropdown-menu {
    max-height: 200px !important;
    opacity: 1 !important;
}
.software-dropdown-menu li {
    width: auto;
    opacity: 0;
    transform: translate3d(0, -10px, 0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.software-dropdown-container.active .software-dropdown-menu li {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}
.software-dropdown-container.active .software-dropdown-menu li:nth-child(1) { transition-delay: 0.1s; }
.software-dropdown-container.active .software-dropdown-menu li:nth-child(2) { transition-delay: 0.18s; }

.software-dropdown-menu .software-dropdown-item {
    font-family: inherit;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.4rem;
    font-weight: 300;
    opacity: 0.7;
    text-transform: uppercase;
    padding: 0.8rem 2rem;
    color: var(--text-light);
    text-decoration: none;
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.software-dropdown-menu .software-dropdown-item:hover {
    opacity: 1;
    color: var(--accent-gold);
    letter-spacing: 0.55rem;
    text-shadow: 0 0 2rem rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}
