:root {
    --brand-red: #F22F30;
    --brand-white: #ffffff;
    --font-serif: 'Libre Caslon Text', serif;
    --font-sans: 'Linear Grotesk', 'Inter', sans-serif;

    --h-start-width: 42vw;
    --h-start-height: 75vh;
    --h-end-size: clamp(80px, 12vw, 150px);

    --h-start-left: 0%;
    --h-end-left: 25%;
    --h-start-top: 50%;
    --h-end-top: 50%;
    --h-start-tx: 0%;
    --h-end-tx: -50%;
    --h-start-ty: -50%;
    --h-end-ty: -50%;
}

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

body {
    background-color: var(--brand-red);
    color: var(--brand-white);
    margin: 0;
    font-family: var(--font-sans);
}

.scroll-track {
    height: 250vh;
    /* Giving decent space to scroll */
    width: 100%;
}

.sticky-container {
    position: sticky;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 4rem;
    --scroll-progress: 0;
    /* Updated via JS */
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    width: 100%;
    z-index: 20;
}

.line {
    flex-grow: 1;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.4);
    margin-right: 1.5rem;
    position: relative;
    /* Opacity controlled by scroll, or stays visible. Stays visible in ref image. */
}

.arrow-right::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    border: solid rgba(255, 255, 255, 0.6);
    border-width: 1px 1px 0 0;
    padding: 3px;
}

.brand-credits-logo {
    height: 12px;
    width: auto;
}

/* Contact Info / Bottom Left */
.bottom-left-info {
    position: absolute;
    left: 0;
    bottom: -1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.bottom-left-info p {
    margin: 0;
    opacity: 0.9;
}

.contact-email {
    color: var(--brand-white);
    text-decoration: none;
    font-weight: 600;
}

/* Container for main content */
.container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    margin: 2rem 0;
}

/* H Mask Animation */
.h-mask-container {
    position: absolute;
    left: calc(var(--h-start-left) + (var(--h-end-left) - var(--h-start-left)) * var(--scroll-progress));
    top: calc(var(--h-start-top) + (var(--h-end-top) - var(--h-start-top)) * var(--scroll-progress));

    width: calc(var(--h-start-width) + (var(--h-end-size) - var(--h-start-width)) * var(--scroll-progress));
    height: calc(var(--h-start-height) + (var(--h-end-size) - var(--h-start-height)) * var(--scroll-progress));

    transform: translate(calc(var(--h-start-tx) + (var(--h-end-tx) - var(--h-start-tx)) * var(--scroll-progress)),
            calc(var(--h-start-ty) + (var(--h-end-ty) - var(--h-start-ty)) * var(--scroll-progress)));

    background-color: var(--brand-white);

    -webkit-mask-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzMyIiBoZWlnaHQ9IjczMiIgdmlld0JveD0iMCAwIDczMiA3MzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zNjYuMDEzIDM3OS41NDdDMjY3LjEzOSAzNzkuNTQ3IDI2MS42NjIgNDI4Ljk0MSAyNjAuMjUzIDQ2Mi43QzI1Ny40NjIgNTI5Ljk3OCAyNjAuMjUzIDczMiAyNjAuMjUzIDczMkgwVjBIMjYwLjI1M0MyNjAuMjUzIDAgMjU1LjI1NSAxOTguMTEzIDI2MC4yNTMgMjYzLjg5MkMyNjIuOTEyIDI5OC45OSAyNzQuMzE3IDM1Ni4wNjggMzY2LjAxMyAzNTYuMDY4QzQ1Ny43MDkgMzU2LjA2OCA0NjkuMDg4IDI5OC45OSA0NzEuNzc0IDI2My44OTJDNDc2Ljc0NSAxOTguMTEzIDQ3MS43NDcgMCA0NzEuNzQ3IDBINzMyVjczMkg0NzEuNzQ3QzQ3MS43NDcgNzMyIDQ3NC41MzkgNTI5Ljk1MiA0NzEuNzQ3IDQ2Mi43QzQ3MC4zNjQgNDI4Ljk2OCA0NjQuODYxIDM3OS41NDcgMzY1Ljk4NyAzNzkuNTQ3SDM2Ni4wMTNaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K');
    mask-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzMyIiBoZWlnaHQ9IjczMiIgdmlld0JveD0iMCAwIDczMiA3MzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zNjYuMDEzIDM3OS41NDdDMjY3LjEzOSAzNzkuNTQ3IDI2MS42NjIgNDI4Ljk0MSAyNjAuMjUzIDQ2Mi43QzI1Ny40NjIgNTI5Ljk3OCAyNjAuMjUzIDczMiAyNjAuMjUzIDczMkgwVjBIMjYwLjI1M0MyNjAuMjUzIDAgMjU1LjI1NSAxOTguMTEzIDI2MC4yNTMgMjYzLjg5MkMyNjIuOTEyIDI5OC45OSAyNzQuMzE3IDM1Ni4wNjggMzY2LjAxMyAzNTYuMDY4QzQ1Ny43MDkgMzU2LjA2OCA0NjkuMDg4IDI5OC45OSA0NzEuNzc0IDI2My44OTJDNDc2Ljc0NSAxOTguMTEzIDQ3MS43NDcgMCA0NzEuNzQ3IDBINzMyVjczMkg0NzEuNzQ3QzQ3MS43NDcgNzMyIDQ3NC41MzkgNTI5Ljk1MiA0NzEuNzQ3IDQ2Mi43QzQ3MC4zNjQgNDI4Ljk2OCA0NjQuODYxIDM3OS41NDcgMzY1Ljk4NyAzNzkuNTQ3SDM2Ni4wMTNaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

.bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: calc(1 - var(--scroll-progress) * 2);
}

/* States Automation */
/* State A (initial) elements fade OUT on scroll */
.state-a {
    opacity: calc(1 - var(--scroll-progress) * 3.33);
}

/* State B (final) elements fade IN late on scroll */
.state-b {
    opacity: calc((var(--scroll-progress) - 0.66) * 3);
}

/* Content Elements Placement */
.center-slogan {
    position: absolute;
    left: var(--h-end-left);
    top: calc(50% + (var(--h-end-size) * 1.307) / 2 + 3vh);
    transform: translateX(-50%);
    text-align: center;
    margin: 0;
    width: 100%;
}

/* Scroll Indicator (Always visible alongside State A) */
.scroll-indicator {
    position: absolute;
    /* Pin to bottom specifically instead of dependent on H mask */
    bottom: 5vh;
    left: 50vw;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    z-index: 15;
}

/* Tweak scale for very small heights to fit everything on screen gracefully */
@media (max-height: 650px) {
    .scroll-indicator {
        bottom: 3vh;
        transform: translateX(-50%) scale(0.85);
    }
}

@media (max-height: 550px) {
    .center-slogan {
        top: calc(50% + (var(--h-end-size) * 1.307) / 2 + 2vh);
        transform: translateX(-50%) scale(0.85);
    }

    .scroll-indicator {
        bottom: 1vh;
        transform: translateX(-50%) scale(0.7);
    }
}

.scroll-text {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    opacity: 0.7;
}

.scroll-line-container {
    width: 1px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.scroll-line {
    width: 100%;
    height: 100%;
    background-color: var(--brand-white);
    position: absolute;
    top: -100%;
    left: 0;
    animation: scrollDownAnim 2s cubic-bezier(0.76, 0, 0.24, 1) infinite;
}

@keyframes scrollDownAnim {
    0% {
        top: -100%;
    }

    50% {
        top: 0;
    }

    100% {
        top: 100%;
    }
}

.bottom-right-slogan {
    position: absolute;
    bottom: -2rem;
    /* Pull down slightly within bounds */
    right: 5vw;
    margin: 0;
}

/* Right Content Area */
.content {
    position: absolute;
    right: 5vw;
    width: 38vw;
    height: 75vh;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.dictionary-section {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
}

.logo-wrapper {
    position: absolute;
    top: 0;
    left: 0;
}

.main-logo {
    width: auto;
    height: 120px;
    object-position: left;
}

.middle-section {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
}

/* Typography styles matching original */
.word {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    letter-spacing: -0.01em;
}

.pos {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 400;
    display: block;
    margin-bottom: 1.5rem;
}

.meaning {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 400;
    opacity: 0.9;
    max-width: 90%;
}

.slogan {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 600;
    /* As requested in early versions or ref */
}

.sub-slogan {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 400;
    opacity: 0.9;
    line-height: 1.6;
}

/* Responsive for 1280px Desktop / Tablets */
@media (max-width: 1280px) {
    :root {
        --h-start-size: clamp(70px, 10vw, 130px);
        --h-end-width: 44vw;
        --h-end-height: 70vh;
    }

    .sticky-container {
        padding: 2rem 3rem;
    }

    .main-logo {
        height: 100px;
    }

    .slogan {
        font-size: 1.5rem;
    }

    .sub-slogan {
        font-size: 1rem;
    }

    .content {
        width: 42vw;
        right: 3vw;
        height: 70vh;
    }
}

/* Responsive for 1024px iPad / Tablet Portraits */
@media (max-width: 1024px) {
    :root {
        --h-start-width: 100%;
        --h-start-height: 34vh;
        --h-end-size: clamp(80px, 12vw, 150px);

        --h-start-left: 50%;
        --h-end-left: 50%;
        --h-start-top: 0vh;
        --h-end-top: 25vh;
        --h-start-tx: -50%;
        --h-end-tx: -50%;
        --h-start-ty: 0%;
        --h-end-ty: -50%;
    }

    .dictionary-section {
        display: block !important;
        position: absolute;
        top: 6vh;
        left: 0;
        width: 100%;
        padding: 0 1.5rem;
        box-sizing: border-box;
        text-align: center;
        transform: none;
    }

    .dictionary-section .word {
        font-size: 1.25rem;
        margin-bottom: 0.2rem;
    }

    .dictionary-section .meaning {
        font-size: 0.9rem;
        margin-top: 0.8rem;
    }

    .center-slogan {
        top: calc(25vh + (var(--h-end-size) * 1.307) / 2 + 3vh);
    }

    .top-bar {
        justify-content: center;
        margin-bottom: 2rem;
        position: relative;
        z-index: 20;
    }

    .line {
        display: none;
    }

    .content {
        position: absolute;
        width: 100%;
        height: auto;
        top: 36vh;
        bottom: auto;
        left: 0;
        right: auto;
        transform: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
        padding: 0 1.5rem;
        z-index: 25;
    }

    .logo-wrapper {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin-top: 0;
    }

    .middle-section {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin-top: 1rem;
    }

    .main-logo {
        height: 45px;
        margin-bottom: 1rem;
    }

    .middle-section {
        max-width: 600px;
    }

    .bottom-right-slogan {
        position: absolute;
        width: 100%;
        top: 68vh;
        left: 0;
        right: auto;
        bottom: auto;
        text-align: center;
        margin: 0;
        font-size: 1.5rem;
    }

    .bottom-left-info {
        position: absolute;
        width: 100%;
        top: auto;
        bottom: 5vh;
        left: 0;
        right: auto;
        text-align: center;
        margin: 0;
        padding-bottom: env(safe-area-inset-bottom);
        font-size: 0.8rem;
        opacity: calc((var(--scroll-progress) - 0.66) * 3) !important;
    }

    .scroll-indicator {
        top: auto;
        bottom: 8vh;
        left: auto;
        right: 1.5rem;
        transform: scale(0.65);
        transform-origin: bottom right;
    }

    .scroll-line {
        height: 40px;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .sticky-container {
        padding: 1.5rem;
    }
}