/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

:root {
    --color-text: #ffffff;
    --color-background: #000000;
    --font-family: 'Inter', sans-serif;
    --transition-ease: cubic-bezier(0.075, 0.82, 0.165, 1);
}

body {
    font-family: var(--font-family);
    background: var(--color-background);
    color: var(--color-text);
    font-size: 16px;
    line-height: 24px;
    letter-spacing: -0.01em;
    font-weight: 400;
}

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


/* ==========================================================================
   Navigation
   ========================================================================== */

.main-nav {
    display: flex;
    flex-direction: column;
    margin: 160px 16px;
}

.nav-header {
    margin-bottom: 80px;
    font-size: 0;
}

.nav-title {
    display: block;
    font-size: 16px;
    font-weight: 500;
    opacity: 1;
    line-height: 16px;
    margin: 0;
    padding: 0;
}

.nav-subtitle {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 11px;
    margin: 12px 0 0 0;
    padding: 0;
}

.nav-subtitle:hover {
    opacity: 1;
}

.nav-back-link {
    opacity: 0.5;
}

.nav-back-link:hover {
    opacity: 1;
}

.nav-current {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 1;
    line-height: 11px;
    margin: 12px 0 0 0;
    padding: 0;
}

.nav-links {
    display: flex;
    flex-direction: column;
}

.nav-links a {
    font-size: 14px;
    font-weight: 300;
    opacity: 0.3;
    transition: opacity 0.2s;
    margin-bottom: 4px;
}

.nav-links a:hover {
    opacity: 1;
}

body.home-list .nav-links a {
    margin-bottom: 16px;
}

.home-links {
    flex-direction: row;
    align-items: center;
    gap: 0.5em;
}

.home-links a {
    margin-bottom: 0 !important;
}

.link-separator {
    font-size: 14px;
    font-weight: 300;
    opacity: 0.2;
    user-select: none;
}


/* ==========================================================================
   Design Page
   ========================================================================== */

body.design .nav-links a {
    display: block;
    position: relative;
    transition: none;
}

body.design .nav-links a span {
    display: inline;
}

body.design .nav-links a img {
    display: none;
    position: absolute;
    pointer-events: none;
}


/* ==========================================================================
   Tech Page
   ========================================================================== */

.tech-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.tech-box {
    display: block;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
}

.tech-box:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.tech-box h2 {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 4px;
}

.tech-box p {
    font-size: 12px;
    opacity: 0.4;
    line-height: 18px;
}

.tech-box-with-image {
    padding: 0;
    overflow: hidden;
}

.tech-box-with-image img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    display: block;
    background: #0a0a0a;
}

.tech-box-with-image h2,
.tech-box-with-image p {
    padding: 0 16px;
}

.tech-box-with-image h2 {
    padding-top: 16px;
}

.tech-box-with-image p {
    padding-bottom: 16px;
}

body.tech .nav-links a {
    display: block;
    position: relative;
    transition: none;
}

body.tech .nav-links a > span {
    display: inline;
}

body.tech .nav-links a > span span:first-child {
    opacity: 0.5;
    margin-left: 0.3em;
}


/* ==========================================================================
   Desktop Styles (1020px+)
   ========================================================================== */

@media screen and (min-width: 1020px) {
    body {
        font-size: 24px;
        line-height: 36px;
    }

    .main-nav {
        margin: 160px 24px 160px calc(8.333% + 48px);
    }

    .nav-header {
        margin-bottom: 120px;
    }

    .nav-title {
        font-size: 24px;
    }

    .nav-links a {
        font-size: 20px;
        margin-bottom: 0;
    }

    body.home-list .nav-links a {
        margin-bottom: 24px;
    }

    .link-separator {
        font-size: 20px;
    }

    /* Animated line effect for Design page */
    body.design .nav-links a::before {
        content: '';
        display: block;
        float: left;
        position: relative;
        width: 0;
        height: 2px;
        top: 18px;
        background: var(--color-text);
        transition: width 0.4s var(--transition-ease),
                    margin 0.4s var(--transition-ease);
    }

    body.design .nav-links a:hover::before {
        width: 24px;
        margin-right: 12px;
    }

    /* Image preview on hover */
    body.design .nav-links a img {
        display: none;
        position: fixed;
        top: 50%;
        right: 8%;
        transform: translateY(-50%);
        width: 50vw;
        max-width: 800px;
        max-height: 600px;
        object-fit: contain;
    }

    body.design .nav-links a:hover img {
        display: block;
    }

    /* Tech grid - 3 columns on desktop */
    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .tech-box {
        padding: 20px;
    }

    .tech-box h2 {
        font-size: 16px;
    }

    .tech-box p {
        font-size: 14px;
    }

    .tech-box-with-image h2,
    .tech-box-with-image p {
        padding: 0 20px;
    }

    .tech-box-with-image h2 {
        padding-top: 20px;
    }

    .tech-box-with-image p {
        padding-bottom: 20px;
    }

    .tech-box-with-image img {
        height: 160px;
    }
}


/* ==========================================================================
   Tablet Styles (760px - 1019px)
   ========================================================================== */

@media screen and (min-width: 760px) and (max-width: 1019px) {
    body {
        font-size: 18px;
        line-height: 28px;
    }
}


/* ==========================================================================
   Project Detail Pages
   ========================================================================== */

.project-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-background);
    z-index: 100;
}

.project-header a {
    font-size: 16px;
    font-weight: 500;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.project-header a:hover {
    opacity: 1;
}

.project-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 16px 40px;
}

.project-content h1 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 20px;
}

.project-link {
    display: inline-block;
    font-size: 16px;
    opacity: 0.3;
    margin-bottom: 40px;
    transition: opacity 0.2s;
}

.project-link:hover {
    opacity: 1;
}

.project-gallery {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.project-gallery img,
.project-gallery video,
.project-gallery iframe {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}


/* ==========================================================================
   Tech Lab
   ========================================================================== */

.tech-hub {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 16px 40px;
}

.tech-hub h1 {
    font-size: 32px;
    font-weight: 500;
    margin-bottom: 12px;
}

.tech-intro {
    font-size: 18px;
    opacity: 0.6;
    margin-bottom: 60px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.tool-card {
    padding: 32px;
    border: 1px solid var(--color-text);
    transition: background 0.2s;
    position: relative;
    display: block;
}

.tool-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tool-card.coming-soon {
    opacity: 0.4;
    cursor: default;
}

.tool-card.coming-soon:hover {
    background: transparent;
}

.tool-card h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
}

.tool-card p {
    font-size: 16px;
    opacity: 0.6;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tool-status {
    display: inline-block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.4;
}


/* ==========================================================================
   Tech Tool Pages
   ========================================================================== */

.tool-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--color-background);
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-header h1 {
    font-size: 18px;
    font-weight: 500;
}

.nav-back {
    font-size: 16px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.nav-back:hover {
    opacity: 1;
}

.tool-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 16px 60px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.upload-zone {
    border: 2px dashed var(--color-text);
    border-radius: 8px;
    padding: 80px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 300px;
}

.upload-zone:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.02);
}

.upload-zone.dragover {
    border-color: var(--color-text);
    background: rgba(255, 255, 255, 0.05);
}

.upload-prompt p {
    font-size: 18px;
    margin-bottom: 8px;
}

.upload-prompt small {
    font-size: 14px;
    opacity: 0.4;
}

.processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 80px 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.image-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-box label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.4;
}

.image-box img {
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--color-text);
    background: transparent;
    color: var(--color-text);
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--color-text);
    color: var(--color-background);
}

.btn-secondary {
    opacity: 0.4;
}

.btn-secondary:hover {
    opacity: 1;
}

.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px;
    border: 1px solid rgba(255, 100, 100, 0.3);
    background: rgba(255, 100, 100, 0.05);
    border-radius: 4px;
}

.error p {
    color: #ff6b6b;
    text-align: center;
}


/* ==========================================================================
   Mobile Styles (< 760px)
   ========================================================================== */

@media screen and (max-width: 759px) {
    .nav-header {
        margin-bottom: 100px;
    }

    body.design .main-nav,
    body.tech .main-nav,
    body.tech-lab .main-nav {
        margin: 160px 16px 50vh 16px;
    }

    body.design .nav-links a,
    body.tech .nav-links a,
    body.tech-lab .nav-links a {
        margin-bottom: 4px;
    }

    .project-content {
        padding-top: 60px;
    }

    .project-gallery {
        gap: 20px;
    }
}


/* ==========================================================================
   Desktop Project Detail
   ========================================================================== */

@media screen and (min-width: 1020px) {
    .project-header {
        padding: 24px;
    }

    .project-header a {
        font-size: 24px;
    }

    .project-content {
        padding: 120px 48px 80px;
    }

    .project-content h1 {
        font-size: 48px;
        margin-bottom: 24px;
    }

    .project-link {
        font-size: 24px;
    }

    .project-gallery {
        gap: 60px;
    }
}
