/* 3dmodel.css */
:root {
    --primary-bg: #0a0a0a;
    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;
    --accent-glow: rgba(0, 212, 255, 0.6);
}

body {
    background-color: var(--primary-bg);
    color: var(--text-main);
    overflow-x: hidden; /* ← 必須在 body 上裁切橫向，不能放在 main 上，否則 sticky 失效 */
}

.service-3dmodel {
    font-family: 'Noto Sans TC', sans-serif;
    /* ⚠️ 絕對不能在這裡加 overflow:hidden/auto/scroll，會讓所有子元素的 sticky 失效 */
}

/* Typography Overrides */
.service-3dmodel h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}
.service-3dmodel h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
}
.service-3dmodel p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
}

/* Section 1: Hero */
.hero-section {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* 所有 hero 影片預設隱藏，.active 的才顯示 (crossfade，同首頁作法) */
.hero-bg-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}
.hero-bg-video.active {
    opacity: 1;
}
.video-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(10,10,10,0.9) 100%);
    z-index: 2;
}
.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 900px;
    padding: 0 2rem;
}

/* Section 2: Principle */
.principle-section {
    padding: 8rem 2rem;
    background: var(--primary-bg);
}
.principle-section .container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
.principle-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
}
.principle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.scanner-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 4px,
        rgba(0, 212, 255, 0.1) 4px,
        rgba(0, 212, 255, 0.1) 8px
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}
.scanner-overlay::after {
    content: '';
    position: absolute;
    top: -100%; left: 0; width: 100%; height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(0, 212, 255, 0.5), transparent);
    animation: scanLine 3s infinite linear;
    display: none;
}
.principle-image:hover .scanner-overlay {
    opacity: 1;
}
.principle-image:hover .scanner-overlay::after {
    display: block;
}

@keyframes scanLine {
    0% { top: -20%; }
    100% { top: 100%; }
}

@media (max-width: 768px) {
    .principle-section .container {
        grid-template-columns: 1fr;
    }
    .principle-content { order: 2; }
    .principle-image { order: 1; }
}

/* Section 3: Scrolljacking Video */
.scrolljacking-section {
    height: 500vh;          /* tall enough to scroll through full video */
    position: relative;
    background: #000;
    /* ⚠️ DO NOT add overflow:hidden here — it breaks position:sticky */
}
.sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    overflow: hidden;       /* Scroll video: 兩支影片都在 DOM 裡，CSS 依螢幕寬度顯示其中一支 */
}
.scroll-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}
#scroll-video-portrait {
    display: none;
}
@media (max-width: 768px) {
    #scroll-video-landscape { display: none; }
    #scroll-video-portrait  { display: block; }
}
.floating-quotes {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}
.quote {
    position: absolute;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 700;
    text-align: center;
    padding: 0 2rem;
    opacity: 0;
    text-shadow: 0 4px 20px rgba(0,0,0,0.8);
    max-width: 900px;
}

/* Section 4: Deliverables */
.deliverables-section {
    padding: 8rem 2rem;
    background: var(--primary-bg);
}
.deliverables-section .container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6rem;
}
.deliverable-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
.card-3d .card-image {
    order: 1;
}
.card-3d .card-text {
    order: 2;
}
.card-ortho .card-image {
    order: 2;
}
.card-ortho .card-text {
    order: 1;
}
.deliverable-card img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .deliverable-card {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .card-3d .card-image, .card-ortho .card-image { order: 1; }
    .card-3d .card-text, .card-ortho .card-text { order: 2; }
}

/* Magnifier Effect */
.magnifier-container {
    position: relative;
    cursor: none;
}
.magnifier-lens {
    position: absolute;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    width: 150px;
    height: 150px;
    background-repeat: no-repeat;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5), inset 0 0 20px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    transform: translate(-50%, -50%);
}
.magnifier-container:hover .magnifier-lens {
    opacity: 1;
}

/* Section 5: Use Cases (Bento Box) */
.use-cases-section {
    padding: 8rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}
.section-title {
    text-align: center;
    margin-bottom: 4rem;
}
.bento-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 350px;
    gap: 1.5rem;
}
.bento-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
}
.bento-item.case-1 { grid-column: span 2; grid-row: span 2; }
.bento-item.case-2 { grid-column: span 1; grid-row: span 1; }
.bento-item.case-3 { grid-column: span 1; grid-row: span 1; }
.bento-item.case-4 { grid-column: span 1; grid-row: span 1; }
.bento-item.case-5 { grid-column: span 2; grid-row: span 1; }

.bento-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}
.bento-bg img, .bento-bg video {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}
.bento-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
    transition: background 0.3s ease;
}
.bento-item:hover .bento-bg::after {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 100%);
}

.bento-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 2rem;
    z-index: 2;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.bento-item:hover .bento-content {
    transform: translateY(0);
}

.bento-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}
.bento-content h3 span {
    display: block;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.25rem;
}
.bento-content p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ddd;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}
.bento-item:hover .bento-content p {
    opacity: 1;
    max-height: 150px;
    margin-top: 1rem;
}

/* Case 1 Special Hover (Image Switch) */
.bento-item.case-1 .bg-secondary {
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
}
.bento-item.case-1:hover .bg-primary { opacity: 0; }
.bento-item.case-1:hover .bg-secondary { opacity: 1; }

@media (max-width: 992px) {
    .bento-box {
        grid-template-columns: repeat(2, 1fr);
    }
    .bento-item.case-1 { grid-column: span 2; grid-row: span 2; }
    .bento-item.case-2 { grid-column: span 1; grid-row: span 1; }
    .bento-item.case-3 { grid-column: span 1; grid-row: span 1; }
    .bento-item.case-4 { grid-column: span 1; grid-row: span 1; }
    .bento-item.case-5 { grid-column: span 1; grid-row: span 1; }
}

@media (max-width: 768px) {
    .bento-box {
        grid-template-columns: 1fr;
        grid-auto-rows: 300px;
    }
    .bento-item { grid-column: span 1 !important; grid-row: span 1 !important; }
}


