* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background-color: #030303; color: #e0e0e0; font-family: 'Playfair Display', serif; }

.hidden { opacity: 0; visibility: hidden; pointer-events: none !important; }
.pointer-auto { pointer-events: auto; }

#webgl-canvas { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1; }
#main-ui { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }

#framework-header {
    position: absolute; top: 8%; left: 50%; transform: translateX(-50%);
    text-align: center; font-family: 'Cinzel', serif; letter-spacing: 6px;
    color: #d80000; line-height: 1.2; font-size: 3.5rem; width: 90%; text-shadow: 0 0 20px rgba(0,0,0,1);
}
#framework-header span { font-size: 1.5rem; letter-spacing: 4px; opacity: 0.9; color: #fff; font-weight: 400; }

#tooltip {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Cinzel', serif; font-size: 5rem; font-weight: bold; letter-spacing: 15px; color: #fff;
    text-shadow: 0 0 40px rgba(0,0,0,1); transition: opacity 0.3s;
}

#detail-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 20; pointer-events: auto; transition: opacity 0.6s ease; }
.video-bg-container { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1; background: #000; overflow: hidden; }
#story-video-bg { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; position: absolute; top:0; left:0; transition: filter 1s ease; }

.gritty-video { filter: grayscale(40%) contrast(1.1) brightness(0.85); opacity: 0.7 !important; }

#dual-video-wrapper { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; overflow: hidden; }
.dual-video { position: absolute; top: 0; height: 100vh; object-fit: cover; transition: width 0.7s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.7s ease, z-index 0.1s; }
.left-vid { left: 0; width: 60%; z-index: 1; opacity: 0.6; -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%); mask-image: linear-gradient(to right, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%); }
.right-vid { right: 0; width: 60%; z-index: 1; opacity: 0.6; -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%); mask-image: linear-gradient(to left, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%); }

.modal-bg-media { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; background-size: cover; background-position: center; z-index: 1; opacity: 0.6; transition: 0.5s ease; filter: brightness(0.4) contrast(1.2); }
.ken-burns-effect { animation: kenBurns 40s ease-in-out infinite alternate; }
@keyframes kenBurns { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.15) translate(-3%, -2%); } }

.modal-gradient-overlay { position: absolute; top: 0; left: 0; width: 65vw; height: 100vh; background: linear-gradient(to right, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%); z-index: 2; pointer-events: none; }

.modal-content.cinematic-scroll { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; padding: 0; background: transparent; border: none; overflow-y: auto; z-index: 3; }
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-thumb { background: #d80000; }

.modal-body-left { width: 100%; max-width: 900px; padding: 18vh 60px 20vh 80px; min-height: 100vh; overflow: visible; }
.chapter-label { color: #d88c22; font-family: sans-serif; font-size: 1rem; font-weight: bold; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 20px; }
.modal-body-left h1 { font-family: 'Playfair Display', serif; font-size: 4rem; line-height: 1.1; color: #fff; margin-bottom: 40px; text-shadow: 0 5px 15px rgba(0,0,0,1); }
.story-text p { font-size: 1.3rem; line-height: 1.8; color: #fff; margin-bottom: 30px; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }

.parallax-item { opacity: 0; margin: 60px 0; transition: opacity 1s ease-out, transform 1s cubic-bezier(0.25, 0.8, 0.25, 1); will-change: opacity, transform; position: relative;}
.parallax-item.from-left { transform: translateX(-150px); text-align: left; }
.parallax-item.from-right { transform: translateX(150px); text-align: right; }
.parallax-item.is-visible { opacity: 1; transform: translateX(0); }
.parallax-img { width: 65%; height: auto; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,0.8); cursor: crosshair; transform-style: preserve-3d; transition: transform 0.1s ease-out; position: relative; z-index: 1; }

.scattered-wrapper { width: 100%; display: flex; flex-direction: column; align-items: flex-start; margin: 40px 0; }
.blueprint-section { margin: 60px 0; width: 100%; padding: 20px; background: rgba(0,0,0,0.4); border-left: 4px solid #d88c22; border-radius: 4px; opacity: 0; transform: translateY(50px); transition: 1s ease-out; }
.blueprint-section.is-visible { opacity: 1; transform: translateY(0); }
.blueprint-img { width: 100%; height: auto; filter: sepia(0.4) contrast(1.1); border-radius: 4px; }
.parallax-caption { font-family: sans-serif; font-size: 0.9rem; color: #d88c22; margin-top: 15px; font-style: italic; }

.workbench-container { position: relative; height: 850px; width: 100%; margin: 80px 0; }
.workbench-photo { position: absolute; width: 320px; height: auto; border: 8px solid #fff; border-bottom: 35px solid #fff; box-shadow: 0 15px 35px rgba(0,0,0,0.8); opacity: 0; transform: translateY(150px) rotate(0deg); transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); cursor: crosshair; }
.workbench-photo.is-visible { opacity: 1; transform: rotate(var(--rotation)); }
.workbench-photo:hover { z-index: 100 !important; transform: scale(1.7) rotate(0deg) !important; box-shadow: 0 30px 60px rgba(0,0,0,0.9); border-color: #eee; }

.kinetic-mosaic-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); grid-auto-rows: 150px; gap: 15px; margin: 60px 0; }
.mosaic-item { position: relative; overflow: hidden; border-radius: 8px; cursor: crosshair; }
.mosaic-item.mosaic-large { grid-column: span 2; grid-row: span 2; }
.mosaic-item.mosaic-tall { grid-row: span 2; }
.mosaic-item.mosaic-wide { grid-column: span 2; }
.mosaic-img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(30%); transition: 0.5s ease; border: 2px solid transparent;}
.kinetic-mosaic-container:hover .mosaic-img { opacity: 0.3; filter: grayscale(100%); }
.kinetic-mosaic-container .mosaic-item:hover .mosaic-img { opacity: 1; filter: grayscale(0%); transform: scale(1.15); z-index: 10; box-shadow: 0 10px 30px rgba(216,0,0,0.6); border: 2px solid #d80000; }

.floating-gallery-container { position: relative; width: 100%; height: 2000px; margin: 80px 0; overflow: visible; }
.floating-img { position: absolute; border-radius: 6px; box-shadow: 0 15px 35px rgba(0,0,0,0.8); opacity: 0; transform: translateY(150px) rotate(0deg); transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); cursor: crosshair; filter: grayscale(10%); }
.floating-img.is-visible { opacity: 1; transform: translateY(0) rotate(var(--rot)); }
.floating-img:hover { z-index: 150 !important; transform: scale(1.8) rotate(0deg) !important; filter: grayscale(0%); box-shadow: 0 30px 60px rgba(216,0,0,0.8); border: 3px solid #d80000; }

.fade-up-item { opacity: 0; transform: translateY(40px); transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); will-change: opacity, transform; }
.fade-up-item.is-visible { opacity: 1; transform: translateY(0); }

.economy-img { transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.5s ease, filter 0.5s ease; filter: sepia(0.2) contrast(1.1) brightness(0.8); }
.economy-img:hover { transform: scale(1.15) !important; z-index: 100 !important; box-shadow: 0 30px 60px rgba(216,0,0,0.6); filter: sepia(0) contrast(1.2) brightness(1.1); border: 2px solid #d80000; }

#video-play-trigger { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90px; height: 90px; border: 2px solid #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); transition: 0.3s; z-index: 50; cursor: pointer; }
#video-play-trigger:hover { background: #d80000; border-color: #d80000; transform: translate(-50%, -50%) scale(1.1); }
.play-icon { width: 0; height: 0; border-top: 15px solid transparent; border-bottom: 15px solid transparent; border-left: 25px solid #fff; margin-left: 5px; }
#btn-stop-video { position: fixed; top: 30px; left: 50%; transform: translateX(-50%); background: rgba(216,0,0,0.8); border: 1px solid #fff; color: #fff; cursor: pointer; font-size: 0.8rem; padding: 10px 20px; border-radius: 30px; z-index: 55; font-family: sans-serif; letter-spacing: 1px; font-weight: bold; transition: 0.3s; }
#btn-stop-video:hover { background: #ff0000; transform: translateX(-50%) scale(1.05); }
.btn-close { position: fixed; top: 30px; right: 40px; background: rgba(0,0,0,0.8); border: 1px solid #d88c22; color: #d88c22; cursor: pointer; font-size: 0.8rem; padding: 10px 20px; border-radius: 30px; z-index: 55; display: flex; justify-content: center; align-items: center; transition: 0.3s; font-family: sans-serif; letter-spacing: 1px; font-weight: bold; }
.btn-close:hover { background: #d88c22; color: #000; }
#btn-back { position: fixed; top: 30px; left: 30px; padding: 12px 24px; background: rgba(0,0,0,0.6); border: 1px solid #d80000; color: #fff; font-family: 'Cinzel', serif; cursor: pointer; transition: 0.3s; z-index: 50; }

#right-nav { position: fixed; right: 40px; top: 15%; bottom: 15%; width: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 45; pointer-events: none; }
.nav-track { display: flex; flex-direction: column; justify-content: space-between; height: 75%; border-left: 1px dashed rgba(255, 255, 255, 0.3); padding-left: 24px; pointer-events: auto; }
.nav-dot { width: 14px; height: 14px; background: rgba(255,255,255,0.2); border-radius: 50%; position: absolute; left: -7px; cursor: pointer; transition: 0.3s; pointer-events: auto; }
.nav-dot-wrapper.hovered .nav-dot, .nav-dot:hover { background: #d80000; box-shadow: 0 0 15px #d80000; transform: scale(1.4); }
.nav-card { position: absolute; right: 35px; width: 280px; background: #fff; padding: 15px; box-shadow: -10px 10px 30px rgba(0,0,0,0.5); border-radius: 4px; opacity: 0; visibility: hidden; transform: translateX(10px); transition: 0.3s; pointer-events: none; }
.nav-card::after { content: ''; position: absolute; right: -8px; top: 15px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 8px solid #fff; }
.nav-dot-wrapper.hovered .nav-card, .nav-dot-wrapper:hover .nav-card { opacity: 1; visibility: visible; transform: translateX(0); }
.nav-card-chapter { font-family: sans-serif; font-size: 0.75rem; color: #888; text-transform: uppercase; margin-bottom: 5px; font-weight:bold; }
.nav-card-title { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin-bottom: 8px; color: #111; line-height:1.2; }
.nav-card-img { display: block; width: 100%; height: 120px; object-fit: cover; margin-bottom: 10px; border: 1px solid #eee; background: #ccc; }
.nav-card-desc { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 0.85rem; line-height: 1.4; color: #444; }

#btn-credits { position: fixed; bottom: 40px; right: 40px; width: 45px; height: 45px; border-radius: 50%; background: rgba(0,0,0,0.6); border: 1px solid #d80000; color: #fff; cursor: pointer; z-index: 40; transition: opacity 0.5s, transform 0.3s; }
#btn-credits:hover { background: #d80000; transform: scale(1.1); }
#credits-tooltip { position: fixed; bottom: 95px; right: 30px; font-family: 'Cinzel', serif; font-size: 0.8rem; letter-spacing: 3px; color: #fff; pointer-events: none; transition: opacity 0.3s ease; text-shadow: 0 0 10px #000; z-index: 30; }
#btn-credits:hover + #credits-tooltip { opacity: 1; visibility: visible; }
.btn-close-credits { position: absolute; top: 15px; right: 15px; background: none; border: none; color: #aaa; cursor: pointer; font-size: 1.5rem; transition: 0.3s; }
.btn-close-credits:hover { color: #fff; }

#credits-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(8, 8, 8, 0.98); z-index: 60; display: flex; justify-content: center; align-items: center; pointer-events: auto; transition: 0.4s; }
.credits-content { position: relative; height: auto; max-height: 80vh; max-width: 600px; background: #111; border-top: 1px solid #8b7d6b; border-bottom: 1px solid #8b7d6b; box-shadow: 0 20px 50px rgba(0,0,0,0.8); overflow-y: auto; text-align: center; }
.credits-content .modal-body { padding: 40px; }
.credits-content h1 { font-family: 'Cinzel', serif; letter-spacing: 3px; color: #d80000; margin-bottom: 5px; }
.credits-text p { font-family: sans-serif; font-size: 1rem; color: #aaa; line-height: 1.6; margin-bottom:5px; }
.credits-text strong { color: #fff; font-family: 'Playfair Display', serif; font-size: 1.2rem; letter-spacing: 3px; display:block; margin-top:15px; }

@media screen and (max-width: 768px) {
    #framework-header { font-size: 1.8rem; top: 5%; }
    #framework-header span { font-size: 0.8rem; }
    #tooltip { font-size: 2.5rem; letter-spacing: 5px; }
    .modal-body-left { padding: 25vh 20px 10vh 20px; max-width: 100%; }
    .modal-body-left h1 { font-size: 2.2rem; }
    .parallax-img { width: 100% !important; margin-left:0 !important; margin-right:0 !important; } 
    .workbench-container { height: 400px; margin: 40px 0; }
    .workbench-photo { width: 160px; border-bottom: 20px solid #fff; }
    .kinetic-mosaic-container { grid-template-columns: repeat(2, 1fr); }
    .floating-gallery-container { height: 1200px; }
    .floating-img { width: 80% !important; left: 10% !important; }
    .btn-close { right: 15px; top: 15px; font-size: 0.7rem; padding: 8px 12px; }
    #btn-stop-video { top: 15px; font-size: 0.7rem; padding: 8px 12px; }
    #btn-back { top: 15px; left: 15px; padding: 8px 12px; font-size: 0.75rem; }
    #btn-credits { bottom: 20px; right: 20px; }
    .left-vid, .right-vid { width: 100%; mask-image: none; -webkit-mask-image: none; opacity: 0.8; }
    .right-vid { display: none; }
}