@font-face {
    font-family: 'Museo Moderno';
    src: url('../fonts/MuseoModerno-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

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

body {
    background-color: #f2f0ef;
    font-family: 'Museo Moderno', sans-serif;
    color: #3b3430;
    overflow: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

html {
    background-color: #f2f0ef;
}

.invert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f2f0ef;
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: difference;
    opacity: 1;
    clip-path: inset(0 100% 0 0);
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
}

.title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 600;
    color: #3b3430;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('../Cradle/without.svg?v=2');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    margin: 0;
    padding: 0;
}

#canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 27%;
    background: #f2f0ef;
    z-index: 1;
}

#newtons-cradle {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

/* Navigation labels */
.popup-nav {
    position: absolute;
    bottom: calc(5% - 32px);
    left: calc(50% + 36px);
    transform: translateX(-50%);
    display: flex;
    gap: 1.8rem;
    z-index: 1100;
}

.nav-label {
    font-family: 'Museo Moderno', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #3b3431;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
}

.nav-label:hover {
    opacity: 0.7;
    font-weight: 500;
}

.nav-label.active {
    color: #c2b9b4;
}

.toggle-container {
    position: absolute;
    bottom: 0.625%;
    left: 26.625%;
    z-index: 10;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 25px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(59, 52, 50, 0.8);
    border-radius: 25px;
    transition: background-color 0.3s ease;
    border: 2px solid rgba(59, 52, 50, 0.8);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 17px;
    width: 17px;
    left: 50%;
    bottom: 2px;
    margin-left: -8.5px;
    background-color: #4d4746;
    border-radius: 50%;
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(59, 52, 50, 0.8);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(-11px);
}

.toggle-switch input:not(:checked) + .toggle-slider:before {
    transform: translateX(11px);
}

.toggle-switch:hover .toggle-slider {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        margin-bottom: 1rem;
    }
    
    #canvas-container {
        height: 400px;
    }
}

@media (max-width: 480px) {
    #canvas-container {
        height: 300px;
    }
}

/* Popup Styles */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 10001;
    display: none;
    opacity: 0;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(15vh + 96px);
    pointer-events: none;
}

.popup.active {
    display: flex;
}

.popup-box {
    width: 48%;
    max-width: 665px;
    height: 280px;
    background-color: inherit;
    border-radius: 24px;
    padding: 14px 28px 0px 28px;
    margin-bottom: -6px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-top: 48px;
    overflow: hidden;
    pointer-events: auto;
}

.popup-invert-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f2f0ef;
    mix-blend-mode: difference;
    opacity: 1;
    clip-path: inset(0 100% 0 0);
    pointer-events: none;
    z-index: 1002;
    border-radius: inherit;
}

.project-image,
.algorithmic-knots {
    position: relative;
    z-index: 1003;
}

.popup-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(242, 240, 239, 0.5);
    background-color: transparent;
    color: rgba(242, 240, 239, 0.5);
    font-size: 9px;
    font-weight: 300;
    font-family: 'Museo Moderno', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
    line-height: 1;
    padding: 0;
}

.popup-close:hover {
    background-color: #f2f0ef;
    color: #3b3430;
    transform: rotate(90deg);
}

/* About popup specific */
.popup-main {
    color: #f2f0ef;
    margin-bottom: 20px;
}

.popup-main h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0px;
    color: #f2f0ef;
}

.popup-main p {
    font-size: 11px;
    line-height: 1.38;
    margin-bottom: 7px;
    color: #f2f0ef;
    font-weight: 300;
    text-align: justify;
}

/* Stacked footer with gradient layers (About popup) */
.stacked-footer {
    position: relative;
    margin-top: 20px;
    min-height: 80px;
}

.stack-layer {
    position: absolute;
    left: -28px;
    right: -28px;
    bottom: 0px;
    border-radius: 16px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.stack-layer-1 {
    height: 92px;
    background-color: rgba(242, 240, 239, 0.2);
    z-index: 3;
}

.stack-layer-2 {
    height: 104px;
    background-color: rgba(242, 240, 239, 0.15);
    z-index: 2;
}

.stack-layer-3 {
    height: 116px;
    background-color: rgba(242, 240, 239, 0.1);
    z-index: 1;
}

/* Contact footer with gradient layers (Contact popup) */
.contact-footer {
    position: absolute;
    bottom: 0;
    left: 28px;
    right: 28px;
    height: 125px;
}

.contact-layer {
    position: absolute;
    left: -28px;
    right: -28px;
    bottom: 0px;
    border-radius: 16px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.contact-layer-1 {
    height: 35px;
    background-color: rgba(242, 240, 239, 0.25);
    z-index: 3;
}

.contact-layer-2 {
    height: 65px;
    background-color: rgba(242, 240, 239, 0.20);
    z-index: 2;
}

.contact-layer-3 {
    height: 95px;
    background-color: rgba(242, 240, 239, 0.15);
    z-index: 1;
}

.contact-layer-4 {
    height: 125px;
    background-color: rgba(242, 240, 239, 0.10);
    z-index: 0;
}

.footer-content {
    position: relative;
    z-index: 4;
    padding: 12px 0px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tech-section {
    width: 100%;
    position: relative;
    z-index: 1;
}

.tech-section h3 {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 0px;
    color: #f2f0ef;
}

.tech-section p {
    font-size: 11px;
    line-height: 1.38;
    color: #f2f0ef;
    font-weight: 300;
}

.popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px;
    gap: 60px;
}

.popup-profile {
    flex-shrink: 0;
}

.popup-profile-img {
    width: 280px;
    height: 280px;
    border-radius: 12px;
    object-fit: cover;
}

.popup-text {
    max-width: 700px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.popup-text p {
    font-size: 28px;
    line-height: 1.6;
    color: #3b3430;
    font-weight: 400;
    margin: 0;
    text-align: justify;
}

.popup-social {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: flex-end;
    margin-top: -46px;
}

.social-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    text-decoration: none;
}

.social-icon svg,
.social-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.social-icon.linkedin {
    width: 48px;
    height: 48px;
    margin-right: -6px;
}

.social-icon.instagram {
    width: 32px;
    height: 32px;
}

.social-icon.instagram img {
    object-fit: contain;
}

.social-icon.email {
    width: 31px;
    height: 31px;
}

.social-icon.email svg {
    width: 27px;
    height: 27px;
}

.social-icon.linkedin {
    color: #0077b5;
}

.social-icon.email {
    color: #3b3430;
}

.social-icon.instagram {
    color: #E4405F;
}

.social-icon:hover {
    transform: scale(1.1);
}

/* Project popup layout */
.popup-project {
    display: flex;
    align-items: stretch;
    gap: 20px;
    height: calc(100% - 14px);
    padding-top: 0px;
}

.project-image {
    flex-shrink: 0;
    width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    position: relative;
}

.project-image img {
    max-width: 150%;
    max-height: 150%;
    object-fit: contain;
}

.project-image picture {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.prinsys-image {
    transform: translateX(12px);
    mask-image: linear-gradient(to right, black 30%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
}

.algorithmic-image {
    max-width: 95% !important;
    max-height: 95% !important;
}

.encrypted-image {
    max-width: 95% !important;
    max-height: 95% !important;
}

.islanding-image {
    max-width: 135% !important;
    max-height: 135% !important;
    transform: translateX(-.4%);
}

.islanding-video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 84%;
    aspect-ratio: 4 / 3;
    transform: translate(-50%, -48%);
    border-radius: 8px;
    overflow: hidden;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    background-color: #000;
}

.islanding-video {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block;
}

.islanding-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    z-index: 3;
    transition: opacity 0.2s ease;
}

.islanding-video-overlay:hover .islanding-pause-overlay {
    opacity: 1;
}

.islanding-pause-overlay svg {
    width: 36px;
    height: 36px;
    fill: rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.islanding-pause-overlay .islanding-icon-play {
    display: none;
}

.islanding-pause-overlay.paused .islanding-icon-pause {
    display: none;
}

.islanding-pause-overlay.paused .islanding-icon-play {
    display: block;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    background-color: rgba(242, 240, 239, 0.3);
    border: 2px dashed rgba(242, 240, 239, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Museo Moderno', sans-serif;
    color: #f2f0ef;
    font-size: 14px;
    font-weight: 300;
}

.project-text {
    flex: 1;
    color: #f2f0ef;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-text h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0px;
    color: #f2f0ef;
}

.project-text h3 {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 0px;
    color: #f2f0ef;
}

.project-text p {
    font-size: 11px;
    line-height: 1.38;
    font-weight: 300;
    color: #f2f0ef;
    text-align: justify;
}

/* Project popups (orange, yellow, green, blue) - 20% larger text */
.popup-project .project-text h2 {
    font-size: 25px;
    font-weight: 600;
    margin-bottom: -6px;
}

.popup-project .project-text h3 {
    font-size: 16px;
    font-weight: 400;
}

.popup-project .project-text p {
    font-size: 12px;
}

#popup-2 .project-text {
    transform: translateY(-21px);
}

.algorithmic-layout {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 0;
}

.algorithmic-layout .project-text {
    flex: none;
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
}

.algorithmic-layout .project-text p {
    text-align: justify;
}

.algorithmic-knots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.algorithmic-knots .knots-square {
    display: none;
}

.algorithmic-knots .knots-horizontal {
    width: 24%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    display: block;
    transform: scale(0.9);
}

/* Contact content overlay */
.contact-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 125px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding-bottom: 5px;
    overflow: hidden;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

.contact-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 25px;
    padding: 0 10px;
    position: relative;
}

.contact-link {
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-link:hover .contact-label,
.contact-link:hover .contact-value {
    opacity: 1;
    font-weight: 500;
}

.contact-info-row:hover .contact-label,
.contact-info-row:hover .contact-value {
    opacity: 1;
    font-weight: 500;
}

.contact-label {
    font-size: 11px;
    font-weight: 300;
    color: #f2f0ef;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.contact-value {
    font-size: 11px;
    font-weight: 300;
    color: #f2f0ef;
    text-align: right;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.contact-layer {
    transition: filter 0.3s ease;
}

@media (max-width: 1024px) {
    .popup-content {
        flex-direction: column;
        padding: 60px 40px;
        gap: 40px;
    }
    
    .popup-profile-img {
        width: 220px;
        height: 220px;
    }
    
    .popup-text p {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .popup-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
    
    .popup-content {
        padding: 40px 30px;
        gap: 30px;
    }
    
    .popup-profile-img {
        width: 180px;
        height: 180px;
    }
    
    .popup-text p {
        font-size: 18px;
    }
    
    .social-icon {
        width: 35px;
        height: 35px;
    }
}

/* Mobile & Tablet Layout (≤1024px) */
@media (max-width: 1024px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        background-color: #f2f0ef;
        padding: 0;
    }
    
    /* Add mobile header */
    body::before {
        content: 'Remington Williams';
        display: block !important;
        font-family: 'Museo Moderno', sans-serif;
        font-size: clamp(30px, 8.5vw, 50px) !important;
        font-weight: 600;
        color: #3b3430;
        text-align: center !important;
        padding: 40px 0 24px 0 !important;
        background-color: #f2f0ef;
        position: sticky;
        top: 0;
        z-index: 1;
        white-space: nowrap;
        width: 100%;
    }
    
    /* Hide desktop elements */
    .container,
    #canvas-container,
    .toggle-container,
    .popup-nav,
    .invert-overlay {
        display: none !important;
    }
    
    /* Show popups as vertical scroll sections */
    .popup {
        position: relative;
        display: block !important;
        opacity: 1 !important;
        width: 100%;
        height: auto;
        padding: 0 16px 16px 16px;
        margin: 0;
        pointer-events: auto;
        z-index: 10;
        background-color: #f2f0ef;
    }
    
    .popup-box {
        width: 100%;
        max-width: 100%;
        height: auto;
        border-radius: 24px;
        padding: 16px 20px 0 20px;
        margin: 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
    }
    
    /* Hide close button on mobile */
    .popup-close {
        display: none;
    }
    
    /* About section (red) */
    #popup-0 .popup-box {
        background-color: #7a0000;
        padding-bottom: 0;
    }
    
    #popup-0 .popup-main {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 0px;
        margin-bottom: 0;
    }
    
    #popup-0 .popup-main h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    #popup-0 .popup-main p {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 0;
    }
    
    #popup-0 .stacked-footer {
        position: relative;
        margin-top: 15px;
        min-height: 200px;
        margin-left: -20px;
        margin-right: -20px;
        margin-bottom: 0;
    }
    
    #popup-0 .stack-layer-1 {
        height: 160px;
    }
    
    #popup-0 .stack-layer-2 {
        height: 180px;
    }
    
    #popup-0 .stack-layer-3 {
        height: 200px;
    }
    
    #popup-0 .footer-content {
        position: absolute;
        bottom: 0px;
        left: 0;
        right: 0;
        padding: 20px;
        gap: 8px;
    }
    
    #popup-0 .tech-section h3 {
        font-size: 13px;
        margin-bottom: 2px;
        font-weight: 700;
    }
    
    #popup-0 .tech-section p {
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 0;
    }
    
    /* Project sections */
    .popup-project {
        flex-direction: column;
        height: auto;
        gap: 20px;
        padding-top: 0px;
    }
    
    .project-image {
        width: 100%;
        height: auto;
        min-height: 300px;
        order: 1;
    }
    
    .project-text {
        width: 100%;
        order: 2;
        padding-bottom: 24px;
        margin-top: -12px;
    }
    
    .popup-project .project-text h2 {
        font-size: 22px;
        margin-bottom: -2px;
    }
    
    .popup-project .project-text h3 {
        font-size: 16px;
        margin-bottom: 8px;
        font-weight: 700;
    }
    
    .popup-project .project-text p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Prinsys (orange) - use vertical image */
    #popup-1 .popup-box {
        background-color: #cc4e00;
    }
    
    #popup-1 .project-image {
        min-height: 450px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -24px;
        margin-bottom: -38px;
    }
    
    #popup-1 .project-image img {
        max-width: 200%;
        max-height: 800px;
        transform: none !important;
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }
    
    #popup-1 .project-image picture {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    /* Encrypted Chat (yellow) */
    #popup-2 .popup-box {
        background-color: #cca300;
    }
    
    #popup-2 .project-image img {
        max-width: 100% !important;
        max-height: 400px !important;
    }
    
    #popup-2 .project-text {
        transform: none;
    }
    
    /* Algorithmic Crafting (green) */
    #popup-3 .popup-box {
        background-color: #457a00;
    }
    
    #popup-3 .algorithmic-layout {
        flex-direction: column;
        gap: 24px;
    }
    
    #popup-3 .algorithmic-knots {
        flex-wrap: wrap;
        gap: 0;
        min-height: auto;
        justify-content: center;
    }
    
    #popup-3 .algorithmic-knots .knots-square {
        display: block;
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    #popup-3 .algorithmic-knots .knots-horizontal {
        display: none;
    }
    
    /* Islanding NYC (blue) */
    #popup-4 .popup-box {
        background-color: #004e7a;
    }
    
    #popup-4 .project-image {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -38px;
        margin-bottom: -38px;
    }
    
    #popup-4 .project-image .islanding-image {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    #popup-4 .islanding-video-overlay {
        width: 84%;
        aspect-ratio: 4 / 3;
        transform: translate(-50%, -48%);
        top: 50%;
        left: 50%;
    }
    
    #popup-4 .islanding-pause-overlay {
        opacity: 0;
    }
    
    #popup-4 .islanding-pause-overlay.paused {
        opacity: 1;
    }
    
    #popup-4 .islanding-pause-overlay .islanding-icon-play {
        display: none;
    }
    
    #popup-4 .islanding-pause-overlay.paused .islanding-icon-play {
        display: block;
    }
    
    #popup-4 .islanding-pause-overlay .islanding-icon-pause {
        display: none;
    }
    
    /* Contact (purple) */
    #popup-5 .popup-box {
        background-color: #401268;
        padding-bottom: 0;
    }
    
    #popup-5 .popup-main {
        padding-top: 0px;
        margin-bottom: 24px;
    }
    
    #popup-5 .popup-main h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    #popup-5 .popup-main p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    #popup-5 .contact-footer {
        position: relative;
        left: 0;
        right: 0;
        height: 140px;
        margin-left: -20px;
        margin-right: -20px;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    #popup-5 .contact-layer-1 {
        height: 35px;
    }
    
    #popup-5 .contact-layer-2 {
        height: 70px;
    }
    
    #popup-5 .contact-layer-3 {
        height: 105px;
    }
    
    #popup-5 .contact-layer-4 {
        height: 140px;
    }
    
    #popup-5 .contact-content {
        height: 140px;
        padding: 0 20px 0 20px;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
    }
    
    #popup-5 .contact-info-row {
        height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
    }
    
    #popup-5 .contact-label,
    #popup-5 .contact-value {
        font-size: 13px;
    }
}
