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

:root {
    --color-bg: #0a0a0f;
    --color-text: #e8e6e3;
    --color-text-dim: rgba(232,230,227,0.75);
    --color-accent: #6c63ff;
    --color-accent-2: #00d4aa;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: auto; }

body {
    overflow-x: hidden;
    overflow-y: auto;
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* ========== PRELOADER ========== */
#preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#preloader.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#preloader-canvas-container {
    width: 100%;
    height: 100%;
}

#preloader-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ========== SOCIAL ICONS HEADER ========== */
#social-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: auto;
}

.social-icons {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    transform-style: preserve-3d;
}

.social-icons li {
    position: relative;
    background-color: rgba(41, 41, 41, 0.6);
    margin-right: 8px;
    width: 48px;
    height: 48px;
    transition: 0.4s;
}

.social-icons li:last-of-type {
    margin-right: 0;
}

.social-icons li::before {
    content: "";
    position: absolute;
    top: 0;
    left: -5px;
    background-color: rgba(36, 36, 36, 0.6);
    height: 100%;
    width: 5px;
    transform-origin: right;
    transform: skewY(-45deg);
}

.social-icons li::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    background-color: rgba(36, 36, 36, 0.6);
    width: 100%;
    height: 6px;
    transform-origin: top;
    transform: skewX(-45deg);
}

.social-icons li a span {
    position: absolute;
    top: 0;
    left: 0;
    display: flex !important;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    width: 100%;
    height: 100%;
    font-size: 1.2em;
    transition: 0.4s;
}

.social-icons li:hover a span {
    z-index: 1000;
    transition: 0.5s;
    color: white;
    box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.05);
}

.social-icons li:hover > a span:nth-of-type(1) { transform: translate(5px, -5px); }
.social-icons li:hover > a span:nth-of-type(2) { transform: translate(10px, -10px); }
.social-icons li:hover > a span:nth-of-type(3) { transform: translate(15px, -15px); }
.social-icons li:hover > a span:nth-of-type(4) { transform: translate(20px, -20px); }
.social-icons li:hover > a span:nth-of-type(5) { transform: translate(25px, -25px); }

.social-icons li a span:nth-of-type(1) { opacity: 0; }
.social-icons li a span:nth-of-type(2) { opacity: 0; }
.social-icons li a span:nth-of-type(3) { opacity: 0; }
.social-icons li a span:nth-of-type(4) { opacity: 0; }
.social-icons li a span:nth-of-type(5) { opacity: 1; }

.social-icons li:hover a span:nth-of-type(1) { opacity: 0.2; }
.social-icons li:hover a span:nth-of-type(2) { opacity: 0.4; }
.social-icons li:hover a span:nth-of-type(3) { opacity: 0.6; }
.social-icons li:hover a span:nth-of-type(4) { opacity: 0.8; }
.social-icons li:hover a span:nth-of-type(5) { opacity: 1; }

.social-icons li:nth-of-type(1):hover span {
    background-color: #1d9bf0;
    background-image: linear-gradient(270deg, #1d9bf0, #0d8bd9);
    background-size: 400% 400%;
    animation: socialGradient 6s ease infinite;
}

.social-icons li:nth-of-type(2):hover span {
    background-color: #5865f2;
    background-image: linear-gradient(270deg, #5865f2, #7289da);
    background-size: 400% 400%;
    animation: socialGradient 6s ease infinite;
}

.social-icons li:nth-of-type(3):hover span {
    background-color: #6c63ff;
    background-image: linear-gradient(270deg, #6c63ff, #a78bfa);
    background-size: 400% 400%;
    animation: socialGradient 6s ease infinite;
}

.social-icons li:nth-of-type(4):hover span {
    background-color: #0088cc;
    background-image: linear-gradient(270deg, #0088cc, #00d4aa);
    background-size: 400% 400%;
    animation: socialGradient 6s ease infinite;
}

@keyframes socialGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@media (max-width: 768px) {
    .social-icons li {
        width: 38px;
        height: 38px;
        margin-right: 6px;
    }
    .social-icons li a span { font-size: 1em; }
    .social-icons li:hover > a span:nth-of-type(1) { transform: translate(3px, -3px); }
    .social-icons li:hover > a span:nth-of-type(2) { transform: translate(6px, -6px); }
    .social-icons li:hover > a span:nth-of-type(3) { transform: translate(9px, -9px); }
    .social-icons li:hover > a span:nth-of-type(4) { transform: translate(12px, -12px); }
    .social-icons li:hover > a span:nth-of-type(5) { transform: translate(15px, -15px); }
}

/* ========== 3D TEXT ANIMATION ========== */
#text-anim-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 25;
    pointer-events: none;
}

#text-anim-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ========== 3D VIEWPORT (fixed background) ========== */
#viewport-wrapper {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

#viewport {
    position: absolute;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: url(../asset/bg.jpg);
    background-size: cover;
    background-position: center;
}

#viewport canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========== HIDE ORIGINAL UI ========== */
.dg.ac { display: none !important; }
#map {
    position: fixed !important;
    right: 0 !important; bottom: 0 !important;
    left: auto !important; top: auto !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: scale(0.6) !important;
    transform-origin: 100% 100% !important;
}
#map *, #map input, #map button, #map a {
    visibility: hidden !important;
    pointer-events: none !important;
}
#map-main { width: 450px; height: 300px; }
#style-list, #credits {
    visibility: hidden !important;
    position: fixed !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* ========== SCROLL DRIVER (invisible tall div) ========== */
#scroll-container {
    position: relative;
    z-index: 20;
}

/* ========== FIXED TEXT OVERLAY ========== */
#text-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 30;
    pointer-events: none;
}

.scene-text {
    position: absolute;
    max-width: 550px;
    opacity: 0;
    pointer-events: none;
}

#text-0 {
    max-width: none;
    width: 90vw;
    visibility: hidden;
}

.scene-text[data-position="center"] {
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.scene-text[data-position="left"] {
    top: 50%; left: 8%;
    transform: translateY(-50%);
    text-align: left;
}

.scene-text[data-position="right"] {
    top: 50%; right: 8%;
    transform: translateY(-50%);
    text-align: right;
}

.scene-text-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tag-line {
    display: block;
    width: 40px; height: 1px;
    background: var(--color-accent);
}

.tag-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 4px;
    color: var(--color-accent);
}

.scene-text-num {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--color-accent);
    display: block;
    margin-bottom: 14px;
    text-shadow: 0 0 20px rgba(108,99,255,0.5);
}

.scene-text-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 16px;
    text-shadow: 0 4px 40px rgba(0,0,0,0.8), 0 0 80px rgba(0,0,0,0.5);
}

.scene-text-title span {
    display: inline-block;
    white-space: pre;
}

#text-0 .scene-text-title {
    font-size: clamp(60px, 13vw, 200px);
    line-height: 0.9;
    letter-spacing: -0.03em;
    margin-bottom: 28px;
    text-shadow: 0 4px 60px rgba(0,0,0,0.6);
    white-space: nowrap;
}

.scene-text-title-final {
    font-size: clamp(60px, 10.5vw, 120px) !important;
    line-height: 0.9 !important;
}

#text-5 {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#text-5 .corner-btn {
    margin-top: 24px;
}

.scene-text-sub {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-accent);
    font-weight: 400;
    text-shadow: 0 2px 20px rgba(0,0,0,0.9), 0 0 40px rgba(0,0,0,0.7);
}

.scene-text-sub span {
    display: inline-block;
}

#text-0 .scene-text-sub {
    font-size: 15px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* CTA */
.corner-btn {
    cursor: pointer;
    position: relative;
    display: inline-block;
    padding: 14px 36px;
    margin-top: 28px;
    background: transparent;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    border-top-right-radius: 10px;
    border-bottom-left-radius: 10px;
    transition: all 0.6s ease;
    opacity: 0;
    pointer-events: auto;
}

.corner-btn:after,
.corner-btn:before {
    content: "";
    width: 10px;
    height: 10px;
    position: absolute;
    border: 0px solid var(--color-accent);
    transition: all 0.6s ease;
    pointer-events: none;
}

.corner-btn:after {
    top: -1px;
    left: -1px;
    border-top: 3px solid var(--color-accent);
    border-left: 3px solid var(--color-accent);
}

.corner-btn:before {
    bottom: -1px;
    right: -1px;
    border-bottom: 3px solid var(--color-accent);
    border-right: 3px solid var(--color-accent);
}

.corner-btn:hover {
    border-top-right-radius: 0px;
    border-bottom-left-radius: 0px;
    color: var(--color-accent);
    text-shadow: 0 0 20px rgba(108,99,255,0.4);
}

.corner-btn:hover:before,
.corner-btn:hover:after {
    width: 100%;
    height: 100%;
}

/* ========== PROGRESS BAR ========== */
.progress-track {
    width: 2px;
    height: 80px;
    background: rgba(255,255,255,0.08);
    position: relative;
}

.progress-fill {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 0%;
    background: var(--color-accent);
    box-shadow: 0 0 8px rgba(108,99,255,0.5);
    transition: height 0.05s linear;
}

.progress-label {
    display: block;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
}

/* ========== PACE LOADER ========== */
.pace { pointer-events: none; user-select: none; }
.pace-inactive { display: none; }
.pace .pace-progress {
    background: var(--color-accent);
    position: fixed; z-index: 2000;
    top: 0; right: 100%; width: 100%; height: 2px;
}
.pace .pace-activity {
    display: block; position: fixed; z-index: 2000;
    top: 15px; right: 15px; width: 14px; height: 14px;
    border: solid 2px transparent;
    border-top-color: var(--color-accent);
    border-left-color: var(--color-accent);
    border-radius: 10px;
    animation: pace-spinner 400ms linear infinite;
}
@keyframes pace-spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
    .scene-text {
        max-width: 90%;
    }

    .scene-text[data-position="left"] {
        left: 5%;
    }

    .scene-text[data-position="right"] {
        right: auto;
        left: 5%;
        text-align: left;
    }

    #text-0 .scene-text-title {
        font-size: clamp(48px, 16vw, 120px);
    }

    .scene-text-title {
        font-size: clamp(24px, 8vw, 40px);
    }

    .max-md-hidden {
        display: none;
    }
}

@media (max-width: 480px) {
    #text-0 .scene-text-title {
        font-size: clamp(40px, 18vw, 90px);
    }

    .scene-text-sub { font-size: 13px; }
}
