:root {
    /* Colors */
    --white: #ffffff;
    --black: #1b1c1b;
    --red: #e73e2a;
    --text-secondary: #888;
    --gray-light: #e0e0e0;
    
    /* Typography */
    --font-main: 'Inter', sans-serif;
    
    /* Spacing */
    --padding-desktop: 2%;
    --padding-tablet: 5%;
    --padding-mobile: 5%;
    
    /* Dimensions */
    --item-width: 200px;
    --item-height: 300px;
    
    /* Transitions */
    --transition-fast: 0.3s ease;
    --transition-medium: 0.4s ease;
    --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-elastic: 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* =========================================
   RESET & BASE STYLES
   ========================================= */

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--white);
    color: var(--black);
    font-family: var(--font-main);
    line-height: 1.5;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Selection styles */
::selection {
    background: var(--red);
    color: var(--white);
}

::-moz-selection {
    background: var(--red);
    color: var(--white);
}

/* =========================================
   ANIMATIONS
   ========================================= */

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

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

main {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem var(--padding-desktop);
    position: sticky;
    top: 0;
    z-index: 100;
    color: var(--white);
    mix-blend-mode: difference;
    transition: mix-blend-mode 0.3s ease;
}

/* Disable mix-blend-mode when menu is open */
header:has(nav.active) {
    mix-blend-mode: normal;
}

header:has(nav.active) .logo,
header:has(nav.active) .burger-menu span {
    color: var(--black);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: -0.06em;
    z-index: 1001;
}

/* Desktop Navigation */
nav {
    display: flex;
    align-items: center;
    gap: 8rem;
}

nav a {
    font-size: 0.8rem;
    font-weight: 400;
    position: relative;
    display: inline-block;
    transition: color var(--transition-fast);
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transition: width var(--transition-medium);
}

nav a:hover::after {
    width: 100%;
}

/* Burger Menu (Hidden on desktop) */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    cursor: pointer;
    z-index: 1001;
    mix-blend-mode: difference;
    transition: mix-blend-mode 0.3s ease;
}

.burger-menu.active {
    mix-blend-mode: normal;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--white);
    transition: all var(--transition-medium);
    transform-origin: center;
}

/* =========================================
   HERO SECTION
   ========================================= */

.hero {
    width: 100%;
    padding: 1.5rem var(--padding-desktop);
    display: flex;
    justify-content: flex-end;
}

.highlight {
    color: var(--red);
    font-weight: 700;
}

/* =========================================
   PORTFOLIO SCROLL
   ========================================= */

.portfolio-scroll {
    width: 100%;
    margin-top: 70px;
    margin-bottom: 15px;
}

.scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding: 0 5%;
    gap: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

.scroll-container:active {
    cursor: grabbing;
}

.scroll-item {
    flex: 0 0 350px;
    margin-bottom: 80px;
}

.scroll-item a {
    display: block;
}

.image-box {
    width: 100%;
    height: 400px;
    background-color: var(--gray-light);
    overflow: hidden;
    margin-bottom: 5px;
}

.image-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.scroll-item:hover .image-box img {
    transform: scale(1.06);
}

/* Portfolio Text */
.item-text h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 550;
    margin-bottom: 2px;
    display: inline-block;
    position: relative;
    padding-bottom: 1px;
    cursor: pointer;
    transition: color var(--transition-slow);
}

.item-text h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-elastic);
}

.scroll-item:hover h3::after {
    transform: scaleX(1);
}

.item-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.02em;
}

/* =========================================
   ABOUT PAGE
   ========================================= */

.about-page {
    padding: 8vh var(--padding-desktop) 10vh;
}

.about-title {
    font-size: clamp(3.5rem, 8vw, 4.6rem);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.06em;
    margin: 2rem 0;
}

.about-title.--right {
    text-align: right;
}

.about-title.--left {
    margin-top: -1rem;
    text-align: left;
}

.about-grid {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 4rem;
}

.about-content {
    flex: 1;
    max-width: 1000px;
    margin-left: 8%;
}

.right-image-container {
    flex: 0 0 35%;
    max-width: 500px;
    margin-right: 5.5%;
}

.right-image-container img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.description-text {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    line-height: 1.7;
    margin-top: 2rem;
    font-weight: 500;
    color: var(--black);
    letter-spacing: -0.04em;
}

.description-text.--right {
    text-align: right;
}

/* =========================================
   FOOTER
   ========================================= */

footer {
    width: 100%;
    padding: 70px var(--padding-desktop) 20px;
    background-color: var(--white);
}

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

.copyright {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--black);
}

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

.footer-links a {
    font-size: 0.8rem;
    font-weight: 400;
    position: relative;
    display: inline-block;
    transition: color var(--transition-fast);
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transition: width var(--transition-medium);
}

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

/* =========================================
   ERROR 404 PAGE
   ========================================= */

.error-page-body {
    height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--white);
}

.error-container {
    text-align: center;
    padding: 2rem;
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.error-code {
    font-size: clamp(10rem, 25vw, 25vw);
    font-weight: 900;
    line-height: 0.8;
    letter-spacing: -0.06em;
    margin: 0;
    color: var(--black);
    background: linear-gradient(to bottom, var(--black) 60%, transparent 60%);
    -webkit-background-clip: text;
    background-clip: text;
}

.error-msg {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    margin: 1rem 0 3rem;
    font-weight: 400;
}

.back-link {
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.back-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--black);
    transition: width var(--transition-medium);
}

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

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

/* ----------------------------------------
   TABLET & SMALL LAPTOPS (≤ 1024px)
   ---------------------------------------- */
@media (max-width: 1024px) {
    :root {
        --padding-desktop: var(--padding-tablet);
    }
    
    header,
    .hero,
    footer {
        padding-left: var(--padding-tablet);
        padding-right: var(--padding-tablet);
    }
    
    /* Navigation spacing */
    nav {
        gap: 2rem;
    }
    
    .footer-links {
        gap: 2rem;
    }
    
    /* About section adjustments */
    .about-content {
        margin-left: 4%;
        margin-bottom: 6rem;
    }
    
    .right-image-container {
        margin-right: 3%;
    }
    
    /* Portfolio items */
    .scroll-item {
        flex: 0 0 300px;
        width: 300px;
    }
}

/* ----------------------------------------
   TABLET PORTRAIT (≤ 768px)
   ---------------------------------------- */
@media (max-width: 768px) {
    :root {
        --padding-desktop: var(--padding-mobile);
    }
    
    /* ===== HEADER & NAVIGATION ===== */
    
    /* Show burger menu */
    .burger-menu {
        display: flex;
    }
    
    /* Mobile navigation overlay */
    nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: transparent;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3rem;
        visibility: hidden;
        pointer-events: none;
        transition: background-color 0.4s ease, 
                    visibility 0.4s ease;
        z-index: 900;
    }
    
    nav.active {
        visibility: visible;
        pointer-events: all;
        background-color: #ffffff !important;
    }
    
    /* Mobile nav links */
    nav a {
        font-size: clamp(2rem, 6vw, 3rem);
        font-weight: 600;
        color: var(--black);
        letter-spacing: -0.04em;
        transform: translateY(30px);
        opacity: 0;
        transition: transform var(--transition-slow),
                    opacity var(--transition-slow);
    }
    
    nav.active a {
        transform: translateY(0);
        opacity: 1;
    }
    
    /* Stagger animation for links */
    nav.active a:nth-child(1) { transition-delay: 0.1s; }
    nav.active a:nth-child(2) { transition-delay: 0.15s; }
    nav.active a:nth-child(3) { transition-delay: 0.2s; }
    nav.active a:nth-child(4) { transition-delay: 0.25s; }
    nav.active a:nth-child(5) { transition-delay: 0.3s; }
    
    /* Burger animation to X */
    .burger-menu.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    .burger-menu.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }
    
    .burger-menu.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    .burger-menu.active span {
        background-color: var(--black);
    }
    
    /* ===== HERO ===== */
    .hero {
        justify-content: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    /* ===== PORTFOLIO ===== */
    .portfolio-scroll {
        margin-top: 40px;
        margin-bottom: 60px;
    }
    
    .scroll-container {
        gap: 20px;
    }
    
    .scroll-item {
        flex: 0 0 85vw;
        width: 85vw;
        height: auto;
        margin-bottom: 40px;
    }
    
    .image-box {
        height: 350px;
    }
    
    .image-box img {
        height: 350px;
    }
    
    /* ===== ABOUT PAGE ===== */
    .about-page {
        padding-top: 4vh;
        padding-bottom: 5vh;
    }
    
    .about-title {
        text-align: left;
        margin: 1rem 0;
    }
    
    .about-title.--right {
        text-align: left;
    }
    
    .about-grid {
        flex-direction: column;
        gap: 2rem;
        margin-bottom: 3rem;
    }
    
    .about-content {
        margin-left: 0;
        margin-bottom: 3rem;
        order: 2;
    }
    
    .right-image-container {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 2rem;
        order: 1;
    }
    
    .description-text {
        text-align: left;
        margin-top: 1.5rem;
    }
    
    .description-text.--right {
        text-align: left;
    }
    
    /* ===== FOOTER ===== */
    footer {
        padding-top: 50px;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-links a {
        font-size: 0.9rem;
    }
}

/* ----------------------------------------
   MOBILE SMALL (≤ 480px)
   ---------------------------------------- */
@media (max-width: 480px) {
    header {
        padding: 1rem var(--padding-mobile);
    }
    
    .logo {
        font-size: 0.9rem;
    }
    
    .burger-menu {
        width: 24px;
        height: 18px;
    }
    
    nav {
        gap: 2.5rem;
    }
    
    nav a {
        font-size: 2rem;
    }
    
    .scroll-item {
        flex: 0 0 90vw;
        width: 90vw;
    }
    
    .image-box,
    .image-box img {
        height: 300px;
    }
    
    .about-title {
        font-size: 2.5rem;
    }
    
    .description-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    footer {
        padding-top: 40px;
    }
}

/* ----------------------------------------
   LARGE SCREENS (≥ 1440px)
   ---------------------------------------- */
@media (min-width: 1440px) {
    .scroll-container {
        padding: 0 8%;
    }
    
    .about-content {
        margin-left: 10%;
    }
    
    .right-image-container {
        margin-right: 8%;
    }
}

/* ----------------------------------------
   EXTRA LARGE SCREENS (≥ 1920px)
   ---------------------------------------- */
@media (min-width: 1920px) {
    .scroll-container {
        padding: 0 12%;
    }
    
    .scroll-item {
        flex: 0 0 400px;
        width: 400px;
        height: 450px;
    }
    
    .image-box {
        height: 450px;
    }
    
    .image-box img {
        height: 450px;
    }
}

/* =========================================
   ACCESSIBILITY & MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 4px;
}