/* --- Web3D Section (Section 1) --- */
.web3d-section {
    position: relative;
    /* Height is now determined by content or grid size, user said 2nd section (scroll down) */
    min-height: 100vh;
    width: 100%;
    /* Extra gap from Hero Section */
    margin-top: 100px;
    /* Space between Hero Buttons and Grid */
    /* padding-top: 80px; Removed to let guide sit naturally if needed */
    box-sizing: border-box;
    background-color: var(--color-bg);
    overflow: hidden;
    margin-bottom: 0px;
    /* Increased margin per user request */
    padding-left: 0;
    padding-right: 0;
    display: flex;
    flex-direction: column;
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Fix for anchor link to show top of models perfectly */
    scroll-margin-top: 100px;
    /* Increased slightly to clear fixed header + top spacing */
    /* Header height */
}

/* Scroll margin for other sections */
#interactive,
#gallery,
#contact {
    scroll-margin-top: 100px;
}

/* Web3D Header (Title + Guide) */
.web3d-header {
    width: 100%;
    /* max-width is handled by inner content for items, but full 100% for line context */
    max-width: 100%;
    padding: 0;
    /* Remove padding here, put on inner */
    margin-bottom: 20px;
    position: relative;
    /* Context for pseudo-element line */
    padding-bottom: 20px;
    /* Space for line */
    display: block;
    /* inner is flex */
}

.header-inner {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    box-sizing: border-box;
}

/* Full width thin line under the header items */
.web3d-header::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    /* Full width of header container */
    height: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    /* Very light, thin line */
}

.web3d-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.05em;
    margin: 0;
    position: relative;
    padding-bottom: 15px;
    /* Space for line */
}

/* Add horizontal line to Web3D Title */
/* .web3d-title::after removed */

/* Match WORKS title to Web3D page sample style */
/* Match WORKS title to Web3D page sample style */
.web3d-style-title {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    letter-spacing: 0.05em !important;
    /* padding-bottom: 20px; Removed, handled by header padding/line spacing */
    border-bottom: none !important;
    position: relative;
    text-transform: none !important;
    margin-bottom: 0px !important;
    /* Managed by header */
    width: auto;
    /* Auto width inside flex container */
}

/* .web3d-style-title::after removed */



/* Control Guide - Right Aligned, Compact */
.control-guide {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.guide-grid {
    display: flex;
    gap: 20px;
    align-items: center;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
}

.icon-box {
    width: 24px;
    height: 24px;
    /* Smaller icon */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
}

.guide-text strong {
    font-size: 0.75rem;
    /* Smaller text */
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Ensure secondary text in guide is visible if added back */

/* Ensure secondary text in guide is visible always now */
.guide-text span {
    display: block;
    font-size: 0.75rem;
    /* Increased slightly */
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.2;
    white-space: nowrap;
    /* Keep text on one line if possible */
}

/* On very small screens you might want to adjust if needed, but user asked for them to be there */
@media (max-width: 480px) {
    .guide-text span {
        font-size: 0.7rem;
    }
}


.web3d-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 42vh 42vh;
    /* Slightly smaller to try fit on screen */
    width: 100%;
    max-width: var(--container-width);
    /* Limit width as requested */
    gap: 20px;
    /* Add gap between frames */
    padding: 0 var(--spacing-md);
    /* Side padding */
}

.web3d-viewer {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    /* Smooth corners */
}

.web3d-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Mobile Web3D Grid */
@media (max-width: 768px) {
    .web3d-grid-container {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 300px);
        /* Stack vertically */
    }

    .guide-grid {
        gap: 20px;
    }
}

.web3d-item:hover {
    /* Legacy style check */
}


/* Scroll Indicator - Positioning Updated for Hero Section */
.scroll-indicator {
    position: absolute;
    bottom: 120px;
    /* Position above controls (controls are at 40px bottom) */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 15;
    /* Above canvas (0) and below controls (20) if overlap, but clearly visible */
    pointer-events: none;
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s;
}

.scroll-indicator span {
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.scroll-indicator .line {
    width: 1px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.scroll-indicator .line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-accent);
    transform: translateY(-100%);
    animation: scrollLine 2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}


/* --- Interactive Media Section (Section 2) --- */
.interactive-section {
    position: relative;
    /* height: 100vh;  Let height be determined by content or keep min-height */
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: transparent;
    margin-bottom: 50px;
    /* Reduced gap as requested (was spacing-xl) */
}

.video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 1;
    object-fit: cover;
}

.interactive-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dim video for text readability */
    z-index: 2;
}

.interactive-section .container {
    position: relative;
    z-index: 3;
    text-align: center;
}

.interactive-section .section-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
    letter-spacing: -0.02em;
}

.interactive-section .section-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}


/* --- Gallery Section (Section 3) --- */
.gallery-section {
    padding-top: 0;
    padding-bottom: var(--spacing-xl);
    width: 100%;
    max-width: 100%;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    /* Added gap */
}

.gallery-grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.gallery-grid::after {
    content: '';
    display: block;
    clear: both;
}

/* Desktop Defaults (4 columns) */
.grid-sizer,
.grid-item {
    width: 25% !important;
    float: left !important;
    padding: 1px;
    box-sizing: border-box;
}

/* Tablet (3 columns) */
@media (max-width: 1200px) {

    .grid-sizer,
    .grid-item {
        width: 33.333% !important;
    }
}

/* Mobile (Web3D 1x4, Gallery 2-col, Padding) */
@media (max-width: 768px) {

    /* Web3D: 1x4 Layout */
    .web3d-section {
        height: auto;
        min-height: 100vh;
        /* "좌우 여백을 확보해줘" - Padding for mobile */
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .web3d-grid {
        grid-template-columns: 1fr;
        /* 1 Column */
        grid-template-rows: repeat(4, 25vh);
        /* 4 rows stacked */
    }

    /* Interactive: Padding for mobile */
    .interactive-section {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
        box-sizing: border-box;
    }

    .interactive-section .section-title {
        font-size: 2rem;
    }

    /* Gallery: 2 Columns */
    .grid-sizer,
    .grid-item {
        width: 50% !important;
    }
}

.project-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: #111;
    width: 100%;
    display: block;
}

.project-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition-slow);
    vertical-align: bottom;
}

.project-card:hover img {
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--spacing-md);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-title {
    font-size: var(--text-lg);
    font-weight: 400;
    transform: translateY(20px);
    transition: transform var(--transition-base);
}

.project-card:hover .project-title {
    transform: translateY(0);
}

.project-category {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--spacing-xs);
    transform: translateY(20px);
    transition: transform var(--transition-base);
    transition-delay: 0.05s;
}

.project-card:hover .project-category {
    transform: translateY(0);
}


/* --- Contact Section (Section 4) --- */
.contact-section {
    padding: var(--spacing-xl) 0;
    background-color: #0a0a0a;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-section {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
}

.contact-text h2 {
    margin-bottom: 2rem;
}

.contact-desc {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    max-width: 100%;
}

.contact-info h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
}


/* --- Lightbox Styles --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.visible {
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    animation: zoom 0.6s;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    padding: 0 20px;
    z-index: 2002;
    transition: color 0.3s ease;
    outline: none;
}

.lightbox-nav:hover {
    color: var(--color-text-muted);
}

.lightbox-nav.prev {
    left: 10px;
}

.lightbox-nav.next {
    right: 10px;
}

@media (max-width: 768px) {
    .lightbox-nav {
        font-size: 2rem;
        padding: 0 10px;
    }
}

@keyframes zoom {
    from {
        transform: translate(-50%, -50%) scale(0)
    }

    to {
        transform: translate(-50%, -50%) scale(1)
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scrollLine {
    0% {
        transform: translateY(-100%);
    }

    50% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(100%);
    }
}

/* --- Interactive Section Components --- */
.videoWrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    overflow: hidden;
}

.videoWrap iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.youtube-link-btn {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 12px 30px;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.youtube-link-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

/* =========================================
   [RESTORED DESKTOP LAYOUT STYLES]
   (Moved from index_web3d.html)
   ========================================= */

/* --- Interactive Section (Desktop) --- */
.container-interactive {
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.interactive-left {
    flex: 0.8;
    padding-right: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
}

.interactive-right {
    flex: 1.4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

.interactive-main-title {
    font-family: var(--font-primary);
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    white-space: nowrap;
    margin: 0;
}

.interactive-sub-title {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 300;
    font-style: normal;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 30px 0;
}

.interactive-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    margin: 15px 0;
}

/* [PC] Restore original size */
.interactive-desc-list-desktop p {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.1rem;
    /* [Fixed] Restored PC Size */
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 5px 0;
}

/* [Mobile] 10% larger than previous reduced size (0.75rem -> 0.85rem) */
.interactive-desc-list-mobile p {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem !important;
    /* [Fixed] 10% Increase */
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 5px 0;
}

.interactive-desc-list-mobile {
    display: none;
}

.youtube-wrapper {
    width: 90%;
    max-width: 700px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    background: #000;
}

/* --- Contact Section (Desktop) --- */
.contact-content {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row-reverse;
    gap: 40px;
    justify-content: space-between;
    /* [Fixed] Add right padding/margin equivalent */
    width: 95%;
    margin-right: 5%;
    /* Force 5% Right Margin */
    box-sizing: border-box;
}

.contact-text {
    flex: 2;
    min-width: auto;
    text-align: right;
}

.contact-info {
    flex: 1;
    min-width: 300px;
    text-align: right;
}

.contact-text h3,
.contact-info h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: #b5b5b5;
    display: inline-block;
}

.contact-info h3 {
    font-size: 1.2rem;
}

.contact-desc {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: #919191;
    margin: 0;
    padding: 0;
    white-space: normal;
    word-break: keep-all;
    max-width: 500px;
    margin-left: auto;
}

.contact-details {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--color-text-muted);
    line-height: 1.8;
}

/* [Fixed] Contact Divider Length Matching (Increased to 300px) */
.contact-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 10px 0 20px auto;
    /* Right align */
    width: 300px;
    /* [Fixed] Increased to 300px to match Contact Info width */
    max-width: none;
    /* Override max-width */
}

/* [PC] Mobile specific overrides are in layout.css */