/* ==========================================================================
   1. VARIABLES & FONTS
   ========================================================================== */
@font-face {
    font-family: 'DinaRemasterII';
    src: url('https://raw.githubusercontent.com/ViktorSekovski/DinaRemasterIi-Woff/main/DinaRemasterII.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Colors */
    --orange: #F48F6E;
    --white: #f4f5ef;
    --blue: #044da6;
    --pink: #ee8fa1;
    --bordergrey: #cccccc;
    --lightgrey: #9E9E9E;
    --grey: #606060;

    /* Layout & Animation */
    --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --grey: #f4f5ef;
        --white: #0f100a;
        --blue: #206cca;
        --pink: #d5929e;
    }
}

/* ==========================================================================
   2. RESET & GLOBAL BASE
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    font-size: clamp(16px, 1.6vw, 2.3vw);
    scroll-behavior: smooth;
    /* CRITICAL: Default to native scroll. JS adds 'lenis' class to override. */
    overflow-y: auto; 
    overscroll-behavior-y: none;
}

/* Lenis Integration */
html.lenis { height: auto; }
html.lenis.lenis-smooth { scroll-behavior: auto; }
html.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
html.lenis.lenis-stopped { overflow: hidden; }

body {
    min-height: 100vh;
    width: 100%;
    line-height: 1.5;
    font-family: "Libre Baskerville", serif;
    color: var(--grey);
    background-color: var(--white);
    overflow-x: hidden;
    /* Cursor */
    cursor: url("./images/mouse.svg") 5 5, auto;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --- PERFORMANCE OPTIMIZED BACKGROUND --- 
   Moves the gradient to a pseudo-element. 
   This runs on the GPU and fixes the lag without changing the look.
*/
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 25% 15%, var(--orange) 0%, transparent 12%),
        radial-gradient(circle at 75% 80%, var(--pink) 0%, transparent 12%),
        var(--white);
    background-size: 1100px 1100px, 1100px 1100px, auto;
    background-position: -80% 50%, 140% 250%, center;
    will-change: transform;
}

@media (min-width: 769px) {
    body::before {
        animation: subtleDrift 120s ease-in-out infinite alternate;
    }
}

@keyframes subtleDrift {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(-20px, 20px); }
    100% { transform: translate(20px, -20px); }
}

/* Pause animation when page is hidden or loading */
body.paused::before, body.htmx-request::before {
    animation-play-state: paused !important;
}

/* Base Media Styles */
img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
    transform: translateZ(0); /* Hardware acceleration hint */
}

a, button {
    cursor: url("./images/hand.svg") 7 0, pointer;
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6 { font-weight: 400; }

h1 {
    font-family: "Jacquard 12", "DinaRemasterII", serif;
    font-size: clamp(8vw, 17vw, 20vw);
    color: var(--blue) !important;
    line-height: 0.75;
    font-weight: 500;
    padding-right: clamp(40px, 10vw, 11vw);
}

h2 {
    font-family: "DinaRemasterII", serif;
    text-transform: uppercase;
    font-size: clamp(2.5rem, 9vw, 11vw);
    line-height: 1;
    color: var(--blue);
}

h3 {
    font-family: "Libre Baskerville", serif;
    font-size: clamp(1.8rem, 3.2vw, 3.2rem);
    font-style: italic;
    color: var(--orange);
    line-height: 0.9;
}

h4 {
    font-family: "Libre Baskerville", serif;
    font-size: clamp(1.6rem, 3vw, 3rem);
    color: var(--grey);
}

h5, h6 {
    font-family: "DinaRemasterII", monospace;
    color: var(--orange);
    text-transform: uppercase;
    line-height: 1.2;
}

/* UPDATED: Bigger h5 and h6 fonts */
h5 { font-size: clamp(1.2rem, 1.6vw, 1.8rem); }
h6 { font-size: clamp(1rem, 1.4vw, 1.6rem); font-weight: 900; }

p {
    font-family: "Libre Baskerville", serif;
    line-height: 1.65;
}

/* ==========================================================================
   4. NAVIGATION
   ========================================================================== */
nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(20px, 2.08vw, 30px);
    position: sticky;
    top: 0;
    z-index: 100;
    /* UPDATED: No background or border on both mobile and desktop */
}

#logo {
    font-family: "Jacquard 12", serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--pink);
    display: block;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Header Links */
.header-link, #menu-btn span {
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(1rem, 1.2vw, 1.5rem);
    color: var(--pink);
    position: relative;
    display: inline-block;
    transition: color 0.2s;
}

.header-link::after, #menu-btn span::after {
    content: "";
    width: 0;
    height: 2px;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--blue);
    transition: width 0.2s ease-in-out;
}

.header-link:hover, #menu-btn:hover span { color: var(--blue); }
.header-link:hover::after, #menu-btn:hover span::after { width: 100%; }

/* Slide Menu (Checkbox Hack) */
.menu-toggle { display: none; }

.menu-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    opacity: 0; 
    visibility: hidden;
    transition: all 0.25s ease-in-out;
    z-index: 1490;
}

.slide-menu {
    position: fixed; 
    top: 0; 
    right: 0; 
    width: 30vw; 
    height: 100vh;
    background-color: var(--white);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1500;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end; /* UPDATED: Align content to right */
    padding: 4rem 2rem 4rem 0; /* UPDATED: Right padding instead of left */
    box-shadow: -10px 0 40px rgba(0,0,0,0.1);
    overflow-y: auto; /* UPDATED: Enable scrolling within menu */
}

#menu-toggle:checked ~ .menu-overlay { 
    opacity: 1; 
    visibility: visible; 
}

/* UPDATED: Prevent body scroll when menu is open */
#menu-toggle:checked ~ body,
body:has(#menu-toggle:checked) {
    overflow: hidden;
}

#menu-toggle:checked ~ .slide-menu { 
    transform: translateX(0); 
}

.menu-content {
    width: 80%;
}

.menu-content ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: right; /* UPDATED: Back to right alignment */
    align-items: flex-end; /* UPDATED: Back to right alignment */
}

.menu-content p {
    text-align: right; /* UPDATED: Right align paragraphs too */
    margin-bottom: 1rem;
}

.menu-link {
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--pink);
    text-transform: uppercase;
    position: relative;
    transition: color 0.2s;
}

.menu-link:hover { 
    color: var(--blue); 
}

/* UPDATED: Add underline effect like header links */
.menu-link::after {
    content: "";
    width: 0;
    height: 2px;
    position: absolute;
    bottom: -2px;
    right: 0; /* UPDATED: Start from right for right-aligned text */
    background-color: var(--blue);
    transition: width 0.2s ease-in-out;
}

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

.menu-close {
    position: absolute; 
    top: 2rem; 
    right: 2rem;
    width: 44px; 
    height: 44px;
    cursor: url("./images/hand.svg") 7 0, pointer;
}

.menu-close span {
    position: absolute; 
    top: 50%; 
    left: 50%;
    width: 28px; 
    height: 3px; 
    background: var(--pink);
    transform-origin: center;
}

.menu-close span:first-child { 
    transform: translate(-50%, -50%) rotate(45deg); 
}

.menu-close span:last-child { 
    transform: translate(-50%, -50%) rotate(-45deg); 
}

/* ==========================================================================
   5. LAYOUT SECTIONS
   ========================================================================== */
#main {
    width: 100%;
    max-width: 1440px; 
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    transform: translateZ(0);
}

/* Page 1: Hero */
#page-1 {
    width: 100%;
    min-height: 100vh;
    padding-top: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

#hero-head, #main-head { padding: 0 clamp(40px, 8vw, 120px); }
#main-head { text-align: right; }
#hero-head { text-align: left; }

#mini {
    text-align: center;
    z-index: 1;
    margin-top: -2vw;
    margin-bottom: 2rem; /* UPDATED: Add space below mini section */
}
#mini h6 { display: inline-block; position: relative; right: -30%; }

#main-mid {
    text-align: right;
    padding-right: 8vw;
    margin-top: 1rem;
}
#main-mid h5 { font-size: clamp(1rem, 2.5vw, 3rem); font-weight: 300; }

#first-bottom {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 2rem 2rem 2rem;
    position: absolute;
    bottom: 0;
}

/* UPDATED: Arrows inline */
#arrow-div {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.arrow {
    width: clamp(0.2rem, 1.74vw, 2rem);
    height: clamp(0.2rem, 1.74vw, 2rem);
    background-color: var(--orange);
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
}
.arrow i { color: var(--white); font-size: 1.2rem; }

/* Page 2: Work */
#page-2 {
    margin: clamp(60px, 8vw, 120px) auto 8vw;
    padding: 0 clamp(15px, 2.08vw, 30px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

#work-top { align-self: center; }
#work-bottom { align-self: flex-end; padding-right: clamp(40px, 10vw, 5rem); }


#page-2 > img {
    pointer-events: none;
    width: 70px;
    height: 70px;
    left: 50%;
}

/* Work Items */
#expandable-container { width: 100%; }

.page2-ele {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: clamp(5px, 1.2vw, 20px) 0;
    border-bottom: 4px dotted var(--pink);
    position: relative;
    cursor: url("./images/hand.svg") 7 0, pointer;
}
#first-ele { border-top: 4px dotted var(--pink); }

.page2-ele h2 { transition: transform 0.4s var(--ease), opacity 0.4s; flex: 1; }
.page2-ele:hover h2 { opacity: 0.6; transform: translateX(20px); }

.expand-indicator {
    font-size: 1.5rem; color: var(--pink); transition: transform 0.3s;
}
.page2-ele.active .expand-indicator { transform: rotate(180deg); }
.page2-ele.active { flex-direction: column; align-items: flex-start; }

/* UPDATED: Hover Image follows cursor */
.page2-ele > img {
    position: fixed;
    width: clamp(250px, 24vw, 350px);
    height: clamp(240px, 23vw, 330px);
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   PROJECT MODAL LAYOUT
   ========================================================================== */

.project-modal-container.future-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(40px, 5vw, 80px);
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: clamp(40px, 4vw, 80px);
    background-color: var(--white);
    align-items: start;
    position: relative;
}

.project-text-col {
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 2vw, 40px);
}

.project-meta {
    font-family: "DinaRemasterII", monospace;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    gap: 8px;
    opacity: 0.7;
    align-items: center;
}

.project-meta .separator {
    width: 4px;
    height: 4px;
    background-color: var(--grey);
    border-radius: 50%;
    opacity: 0.5;
}

.project-headline {
    font-family: "Libre Baskerville", serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.3;
    color: var(--blue);
    font-weight: 400;
    margin-bottom: 20px;
}

.project-body-grid {
    display: grid;
    grid-template-columns: 0.6fr 1.4fr;
    gap: 30px;
    margin-top: 20px;
    align-items: start;
}

.project-services-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: "DinaRemasterII", monospace;
    font-size: 22px;
}

.project-services-list li {
    display: flex;
    align-items: center;
    padding: 0;
    padding-left: 30px;
    gap: 5px;
    line-height: 1.4;
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(14px, 1.5vw, 2rem);
    text-decoration: underline dashed var(--orange);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    color: var(--pink);
    position: relative;
}

.project-services-list li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--pink);
    font-size: 1.2em;
}

.project-services-list li:hover {
    opacity: 0.85;
    transform: translateX(2px);
}

.project-services-list li:hover::before {
    color: var(--blue);
}

.project-description {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project-gallery-col {
    display: flex;
    flex-direction: column;
    gap: clamp(40px, 4vw, 80px);
    width: 100%;
    align-items: stretch;
}

.gallery-item {
    width: 100%;
    overflow: hidden;
    background-color: var(--bordergrey);
    display: block;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.35s var(--ease);
}

.gallery-item:hover img {
    transform: scale(1);
}

@media (max-width: 900px) {
    .project-modal-container.future-layout {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 20px;
    }

    .project-text-col {
        position: relative;
        top: 0;
        gap: 15px;
    }

    .project-body-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .project-headline {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .project-services-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 15px;
        border-bottom: 1px solid var(--bordergrey);
        padding-bottom: 15px;
    }
    
    .project-services-list li {
        width: fit-content;
    }

    .project-description {
        gap: 15px;
    }

    .project-gallery-col {
        gap: 15px;
    }

    .gallery-item {
        max-height: 80vh;
    }

    .gallery-item img {
        object-position: center center;
    }
}

/* Services Arrow */
.services-arrow { margin: 7vh 0 15vh 0; max-width: 800px; margin-left: auto; margin-right: auto; padding: 0 2rem; }
.service-item { 
    font-family: "DinaRemasterII", monospace; font-size: clamp(1.2rem, 2.2vw, 2.5rem); 
    color: var(--grey); padding: 0.5rem 0; display: flex; align-items: center; gap: 0.8rem;
    opacity: 0; animation: slideInService 0.6s ease-out forwards; animation-delay: var(--delay);
}
.arrow-icon { color: var(--pink); font-size: 1.2em; }
@keyframes slideInService { 
    from { opacity: 0; transform: translateX(-30px); } 
    to { opacity: 1; transform: translateX(0); } 
}
/* Services Arrow - 2x2 Grid Layout */
.services-arrow { 
    margin: 7vh 0 15vh 0; 
    max-width: 1200px; 
    margin-left: auto; 
    margin-right: auto; 
    padding: 0 2rem; 
}

.services-index-title {
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(1.4rem, 2.2vw, 2.8rem);
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3rem;
    font-weight: 700;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem 4rem;
}

.service-category-block {
    display: flex;
    flex-direction: column;
}

.service-category-header {
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(1rem, 1.4vw, 1.6rem);
    color: var(--orange);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-weight: 700;
}
/* Swiss Style Async 2x2 Grid */
.grids {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr; /* Asymmetric widths */
    grid-template-rows: auto auto;
    gap: 0; /* Align borders perfectly */
    border-top: 1px solid var(--bordergrey);
    border-left: 1px solid var(--bordergrey);
}

.grids .item {
    padding: var(--spacing-md);
    border-right: 1px solid var(--bordergrey);
    border-bottom: 1px solid var(--bordergrey);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Ensure the titles align with your services */
.grids .item:nth-child(odd) {
    background-color: transparent;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .grids {
        grid-template-columns: 1fr;
    }
}
/* Swiss Style Async 2x2 Grid */
.grids {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr; /* Asymmetric widths */
    grid-template-rows: auto auto;
    gap: 0; /* Align borders perfectly */
    border-top: 1px solid var(--bordergrey);
    border-left: 1px solid var(--bordergrey);
}

.grids .item {
    padding: var(--spacing-md);
    border-right: 1px solid var(--bordergrey);
    border-bottom: 1px solid var(--bordergrey);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Ensure the titles align with your services */
.grids .item:nth-child(odd) {
    background-color: transparent;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .grids {
        grid-template-columns: 1fr;
    }
}
/* Hide checkbox */
.service-toggle {
    display: none;
}

/* Service Item (Label) */
.service-item { 
    font-family: "DinaRemasterII", monospace; 
    font-size: clamp(1rem, 1.6vw, 1.8rem); 
    color: var(--grey); 
    padding: 0.8rem 0; 
    display: flex; 
    align-items: center; 
    gap: 0.8rem;
    opacity: 0; 
    animation: slideInService 0.6s ease-out forwards; 
    animation-delay: var(--delay);
    transition: all 0.2s ease;
    cursor: url("./images/hand.svg") 7 0, pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
}

.service-item:hover {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.expand-indicator { 
    color: var(--pink); 
    font-size: 0.8em; 
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Rotate indicator when expanded */
.service-toggle:checked + .service-item {
    color: var(--blue);
}

.service-toggle:checked + .service-item .expand-indicator {
    transform: rotate(180deg);
}

/* Service Content (Hidden by default) */
.service-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.3s ease,
                margin 0.3s ease;
    margin: 0;
    padding: 0;
}

/* Expand content when checkbox is checked */
.service-toggle:checked ~ .service-content {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 1.5rem;
    padding-top: 0.5rem;
}

.service-content p {
    font-family: "Libre Baskerville", serif;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.6;
    color: var(--grey);
    margin-bottom: 1rem;
}

.service-contact {
    font-family: "DinaRemasterII", monospace;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--pink);
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s ease;
}

.service-contact::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--blue);
    transition: width 0.2s ease;
}

.service-contact:hover {
    color: var(--blue);
}

.service-contact:hover::after {
    width: 100%;
}

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

/* Mobile Adjustments */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .services-index-title {
        margin-bottom: 2rem;
    }
    
    .service-toggle:checked ~ .service-content {
        max-height: 400px;
        margin-bottom: 1.5rem;
    }
}
/* Chrome Scroll */
@property --chrome-progress-y {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

/* CSS-only fallback for Chrome scroll when JavaScript is disabled */
.chrome-scroll-section .text {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity 0.3s ease;
}

/* Enhanced animations when JavaScript is available */
body.js-enabled .chrome-scroll-section .text {
    opacity: var(--opacity);
    transform: translateX(var(--x)) translateY(var(--y)) scale(var(--scale)) rotate(var(--rotation));
    filter: blur(var(--chrome-blur));
}

/* Extended bottom margin for specific chrome scroll section */
.chrome-scroll-section.extended-bottom .chrome-container {
    padding-bottom: 25vh !important;
}

.chrome-scroll-section { 
    padding: 10vh 0; 
    position: relative; 
    overflow: hidden; 
}

#chrome-scroll .container,
.chrome-scroll-section .container,
.chrome-scroll-section .chrome-container {
    width: 100%;
    overflow-x: clip;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 5%, #fff 15%, #fff 85%, rgba(255,255,255,0.3) 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 5%, #fff 15%, #fff 85%, rgba(255,255,255,0.3) 95%, transparent 100%);
}

#chrome-scroll .text-container,
.chrome-scroll-section .text-container {
    display: flex;
    flex-direction: column;
    text-align: center; 
}

#chrome-scroll .text,
.chrome-scroll-section .text {
    --chrome-progress-y: 0;
    --direction: 1;
    --radius-x: 100vw;
    --radius-y: 20vh;
    --angle-start: 90deg;
    --angle-end: 90deg;
    --rotation-start: -10deg;
    --progress-y-inverted: calc(1 - var(--chrome-progress-y));
    --progress-ease-clamped: var(--chrome-eased-expo, 0);
    --opacity: var(--chrome-eased-quart, 0);
    --scale: calc(1 + (0.6 * var(--chrome-eased-quart-inv, 0)));
    --rotation: calc(var(--rotation-start) * var(--direction) * var(--chrome-eased-in-cubic, 0));
    --start-x: calc(var(--radius-x) * var(--direction));
    --x: calc(var(--start-x) - (var(--start-x) * var(--progress-ease-clamped)));
    --y: calc(30vh * var(--progress-y-inverted));

    margin-inline: auto;
    font-size: clamp(0.4rem, 2.5vw, 1.5rem);
    text-align: center;
    opacity: var(--opacity);
    transform: translateX(var(--x)) translateY(var(--y)) scale(var(--scale)) rotate(var(--rotation));
    animation: zipper 1ms linear forwards;
    animation-timeline: view(block);
    animation-range: entry 0% contain 100%;
    will-change: transform, opacity, filter;
    position: relative;
    --chrome-blur: 3px;
    filter: blur(var(--chrome-blur));
    padding: 0.6rem 0;
}

#chrome-scroll .text:nth-child(even),
.chrome-scroll-section .text:nth-child(even) {
    --direction: -1;
}

@keyframes zipper {
    from {
        --chrome-progress-y: 0;
    }
    to {
        --chrome-progress-y: 1;
    }
}

#chrome-scroll .focal-marker,
.chrome-scroll-section .focal-marker {
    position: absolute;
    left: 50%;
    top: 20vh;
    transform: translateX(-50%) translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow:
        0 0 1px rgba(255, 255, 255, 0.12),
        0 0 6px rgba(255, 255, 255, 0.06) inset;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.65;
}

#chrome-scroll h4,
#chrome-scroll h5,
.chrome-scroll-section h4,
.chrome-scroll-section h5 {
    color: var(--grey);
    font-size: clamp(1.6rem, 3vw, 3rem);
}

#unicorn h2 {
    color: var(--pink);
}

/* Skills Marquee - UPDATED: Minimal vertical spacing */
.skill {
    display: flex; 
    overflow: hidden; 
    gap: 1rem;
    mask-image: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent);
    margin: 0.5rem 0; /* Changed from 1rem to 0.5rem - even less space */
    opacity: 0.8;
}
.skill div { 
    display: flex; 
    animation: slide 20s linear infinite; 
}
.skill span {
    background: var(--orange); 
    color: #fff;
    padding: 0.3rem 0.8rem; 
    border-radius: 4px;
    font-family: "DinaRemasterII", monospace;
    margin: 0 0.5rem; 
    white-space: nowrap;
    font-size: clamp(0.85rem, 1.1vw, 1.2rem);
}
@keyframes slide { 
    0% { transform: translateX(0); } 
    100% { transform: translateX(-100%); } 
}

/* Page 3: About */
#page-3 {
    width: 100%; 
    min-height: 100vh;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    padding: 10vh 2rem clamp(50px, 8vw, 120px);
}

#t-f-div {
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 4rem; 
    max-width: 1200px;
}

#page-3 img {
    width: 25%; 
    min-width: 280px;
    filter: grayscale(15%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

#t-s-div { 
    max-width: 600px; 
}

#t-s-div button {
    margin-top: 2rem; 
    padding: 1rem 2rem;
    border: 1px solid var(--grey); 
    border-radius: 50px;
    font-family: "DinaRemasterII", monospace;
    transition: all 0.3s;
    background: transparent;
}

#t-s-div button:hover {
    background: var(--blue); 
    color: var(--white); 
    border-color: var(--blue);
}

/* UPDATED: Add underline effect to all #page-3 links */
#page-3 a {
    position: relative;
    display: inline-block;
}

#page-3 a::after {
    content: "";
    width: 0;
    height: 2px;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--blue);
    transition: width 0.2s ease-in-out;
}

#page-3 a:hover {
    color: var(--blue);
}

#page-3 a:hover::after {
    width: 100%;
}

#third-bottom {
    margin-top: 2rem;
}

#third-bottom h5 {
    margin-bottom: 0.5rem;
}

#third-bottom a {
    color: var(--pink);
}

/* Footer */
footer {
    border-top: 2px dashed var(--bordergrey);
    padding: 4rem 2rem 2rem; 
    margin-top: 5vh;
}

#foot-div {
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
    flex-wrap: wrap;
}

#foot-name h1 { 
    font-size: clamp(3rem, 12vw, 15vw); 
    line-height: 0.8; 
}

#foot-name h6 { 
    margin-left: 1rem; 
    margin-top: 1rem; 
    color: var(--grey); 
}

#social { 
    display: flex; 
    flex-direction: column; 
    text-align: right; 
    gap: 0.5rem; 
}

.foot-head a { 
    font-family: "DinaRemasterII", monospace; 
    font-size: clamp(14px, 1.8vw, 2.2rem);
    color: var(--grey); 
    transition: color 0.2s;
    position: relative;
    display: inline-block;
}

.foot-head a:hover { 
    color: var(--blue); 
}

/* UPDATED: Add underline effect to footer links */
.foot-head a::after {
    content: "";
    width: 0;
    height: 2px;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--blue);
    transition: width 0.2s ease-in-out;
}

.foot-head a:hover::after {
    width: 100%;
}

/* UPDATED: Center copyright text */
#foot-bottom {
    text-align: center;
    margin-top: 3rem;
}

#foot-bottom h6 {
    color: var(--grey);
}

/* Contact Letter */
.contact {
    display: flex; 
    justify-content: center; 
    margin: 3vw auto 7vh;
}

.letter {
    width: 15vw; 
    min-width: 120px;
    transition: transform 0.2s, filter 0.2s;
}

/* UPDATED: Pink filter on hover */
.contact a:hover .letter { 
    transform: scale(1.1) rotate(5deg);
    filter: brightness(0) saturate(100%) invert(71%) sepia(13%) saturate(1089%) hue-rotate(300deg) brightness(98%) contrast(92%);
}

/* ==========================================================================
   6. RESPONSIVE / MOBILE OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 900px) {
    .slide-menu { width: 50vw; }
    #t-f-div { flex-direction: column; }
    #page-3 img { width: 80%; max-width: 400px; margin-bottom: 2rem; }
}

@media (max-width: 768px) {
    /* Fix Scroll on Mobile */
    html, body {
        overflow-y: auto !important;
        height: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* UPDATED: Prevent body scroll when menu open */
    body:has(#menu-toggle:checked) {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }
    
    /* Mobile Header */
    nav { 
        padding: 15px; 
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background-color: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: none;
        box-shadow: none;
        z-index: 1000;
        transform: none;
    }
    
    .nav-right .header-link { display: none; }
    
    /* UPDATED: Bigger, more impressive mobile hero */
    #page-1 { 
        padding-top: 80px; /* Add space for sticky header */
        justify-content: center;
        min-height: 100vh;
    }
    
    #hero-head h1, #main-head h1 { 
        font-size: clamp(12vw, 18vw, 20vw);
        line-height: 0.85;
        padding-right: 20px;
    }
    
    #hero-head, #main-head { 
        padding: 0 1.5rem;
    }
    
    #main-mid { 
        text-align: center; 
        padding: 0 1.5rem;
        margin-top: 2rem;
    }
    
    /* UPDATED: More space for mini section */
    #mini { 
        margin-top: 1.5rem;
        margin-bottom: 3rem;
    }
    
    #mini h6 { 
        position: static;
        font-size: 1rem;
    }
    
    /* FIXED: Make arrows visible on mobile */
    #first-bottom {
        position: relative;
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        padding: 2rem 1.5rem;
        margin-top: auto;
    }
    
    #first-bottom h5 {
        text-align: center;
    }
    
    #arrow-div {
        display: flex !important;
        gap: 1rem;
        align-items: center;
    }
    
    .arrow {
        width: 2rem !important;
        height: 2rem !important;
        display: flex !important;
    }
    
    /* Work / Images */
    .page2-ele { flex-wrap: wrap; }
    .page2-ele > img { display: none !important; }
    
    /* Flower stays visible but smaller */
    #page-2 > img {
        width: 40px !important;
        top: 10px;
        right: 10px;
    }
    
    /* UPDATED: Smaller me-front image on mobile, better spacing */
    #page-3 img { 
        width: 50% !important;
        max-width: 200px !important;
        margin-bottom: 2.5rem;
        min-width: 150px;
    }
    
    /* UPDATED: Center about h1 with more space */
    #page-3 .fade-in-title {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    /* FIXED: Better about section layout on mobile */
    #t-s-div {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    #t-s-div p {
        text-align: left;
        margin-bottom: 1.5rem;
        width: 100%;
    }
    
    #t-s-div button {
        align-self: flex-start;
        margin-top: 0.5rem;
    }
    
    #third-bottom {
        width: 100%;
        text-align: left;
        align-self: flex-start;
        margin-top: 2rem;
    }
    
    #third-bottom h5 {
        text-align: left;
    }
    
    /* Grid System */
    .grid { flex-wrap: wrap; }
    .grid .item { width: 50%; border-width: 1px; }
    .grid .item:hover { width: 50%; }
    
    /* Footer */
    #foot-div { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 2rem; 
    }
    
    #social { 
        align-items: flex-start; 
        text-align: left; 
    }
    
    #foot-bottom {
        text-align: center;
    }
    
    /* Performance Tweaks */
    body::before {
        background-attachment: fixed;
        animation: none;
    }
}

@media (max-width: 480px) {
    .slide-menu { width: 80vw; }
    .grid .item { width: 100%; aspect-ratio: 4/1; }
    
    /* Even bigger hero on small phones */
    #hero-head h1, #main-head h1 { 
        font-size: clamp(14vw, 20vw, 22vw);
    }
}