/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --accent-color: #6abff4;
    --accent-hover: #5aa8db;
    --bg-color: #f7f9fb;
    --text-color: #1e1e1e;
    --card-bg: #ffffff;
    --nav-bg: rgba(247, 249, 251, 0.85); /* Slightly more opaque */
    --border-color: rgba(0,0,0,0.08);
    --font-main: 'Inter', sans-serif;
    
    --radius-md: 20px;
    --radius-lg: 32px;
    --radius-full: 50%;
    
    --shadow-sm: 0 5px 15px rgba(0,0,0,0.05);
    --shadow-lg: 0 25px 50px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --accent-color: #d40848;
    --accent-hover: #b0063c;
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2a2a2a;
    --nav-bg: rgba(26, 26, 26, 0.85);
    --border-color: rgba(255,255,255,0.08);
    --shadow-sm: 0 5px 15px rgba(0,0,0,0.3);
    --shadow-lg: 0 25px 50px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-main);
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.4s, color 0.4s;
    line-height: 1.6;
    overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

/* =========================================
   2. ONBOARDING OVERLAY
   ========================================= */
.onboarding-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-color);
    z-index: 9999; /* Topmost */
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.6s ease;
}
.onboarding-overlay.fade-out { opacity: 0; pointer-events: none; }

.onboarding-content {
    text-align: center;
    animation: slideUpFade 0.8s ease-out;
}
.onboarding-content h1 { font-size: 3rem; margin-bottom: 0.5rem; }
.onboarding-options {
    display: flex; gap: 2rem; justify-content: center; margin-top: 2rem;
}
.mode-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 180px; height: 180px; gap: 10px;
    background: var(--card-bg); color: var(--text-color);
    border: 2px solid var(--border-color); box-shadow: var(--shadow-lg);
    transition: 0.3s;
}
.mode-btn:hover { transform: translateY(-5px); border-color: var(--accent-color); }
.mode-btn.outline { background: transparent; }
.mode-btn .small { font-size: 0.8rem; opacity: 0.7; font-weight: 400; }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   3. NAVBAR
   ========================================= */
.navbar {
    position: fixed; top: 0; width: 100%; height: 80px; padding: 0 5%;
    display: flex; justify-content: space-between; align-items: center;
    background: var(--nav-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    z-index: 1000; border-bottom: 1px solid var(--border-color);
}
.logo { font-weight: 800; font-size: 1.5rem; letter-spacing: -1px; }
.nav-links { list-style: none; display: flex; gap: 2rem; }
.nav-links a {
    text-decoration: none; color: var(--text-color);
    font-weight: 500; font-size: 0.9rem; opacity: 0.7;
    position: relative; transition: opacity 0.3s;
}
.nav-links a::after {
    content: ''; position: absolute; width: 0; height: 2px;
    bottom: -5px; left: 0; background: var(--accent-color); transition: width 0.3s ease;
}
.nav-links a:hover, .nav-links a.active { opacity: 1; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

.hamburger { display: none; flex-direction: column; gap: 6px; background: none; border: none; cursor: pointer; z-index: 2100; padding: 5px; }
.hamburger .bar { width: 25px; height: 2px; background: var(--text-color); border-radius: 2px; transition: 0.3s; transform-origin: center; }
.hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* =========================================
   4. SIDE WIDGET
   ========================================= */
.side-widget { position: fixed; right: 2rem; top: 50%; z-index: 100; cursor: grab; user-select: none; }
.side-widget:active { cursor: grabbing; }
.widget-container {
    display: flex; flex-direction: column; gap: 1rem; align-items: center;
    background: var(--nav-bg); backdrop-filter: blur(20px);
    padding: 1rem 0.8rem; border-radius: 50px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
}
.widget-btn {
    display: flex; justify-content: center; align-items: center;
    width: 44px; height: 44px; border-radius: var(--radius-full);
    border: none; background: transparent; color: var(--text-color);
    cursor: pointer; transition: 0.2s; text-decoration: none;
}
.widget-btn:hover { background: var(--accent-color); color: #fff; transform: scale(1.1); }
.divider { height: 1px; width: 100%; background: var(--border-color); margin: 5px 0; }

/* =========================================
   5. HERO
   ========================================= */
.hero-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 8rem 5% 4rem; gap: 4rem; }
.hero-content h1 { font-size: 4rem; font-weight: 800; letter-spacing: -2px; margin-bottom: 0.5rem; line-height: 1.1; }
.dynamic-text { font-size: 2rem; color: var(--accent-color); font-weight: 600; margin-bottom: 1.5rem; }

.skills-container { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.skill-tag {
    display: inline-block; padding: 0.5rem 1.2rem;
    border-radius: 50px; font-size: 0.85rem; font-weight: 600;
    border: 1px solid var(--accent-color); color: var(--text-color);
    transition: 0.3s; cursor: default;
}
.skill-tag:hover { background: var(--accent-color); color: #fff; transform: translateY(-2px); }

.hero-image-container { position: relative; width: 280px; height: 280px; flex-shrink: 0; display: flex; justify-content: center; align-items: center; }
.profile-img { width: 260px; height: 260px; border-radius: var(--radius-full); object-fit: cover; z-index: 2; border: 4px solid var(--card-bg); box-shadow: var(--shadow-lg); }
.img-backdrop {
    position: absolute; width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--accent-color), transparent);
    border-radius: var(--radius-full); filter: blur(30px); opacity: 0.5; z-index: 1;
    animation: pulse 4s infinite alternate;
}
@keyframes pulse { 0% { opacity: 0.4; transform: scale(0.95); } 100% { opacity: 0.7; transform: scale(1.05); } }

/* =========================================
   6. DICE
   ========================================= */
.projects-section { text-align: center; }
.dice-container { perspective: 1000px; margin: 4rem auto; width: 140px; height: 140px; }
.scene { width: 100%; height: 100%; transform-style: preserve-3d; }
.cube { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1); }

.cube__face {
    position: absolute; width: 140px; height: 140px;
    background: #fff; border: 1px solid #ddd; border-radius: 24px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.1); display: flex; padding: 12px;
}
[data-theme="dark"] .cube__face { background: #222; border: 1px solid #444; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.pip { display: block; width: 22px; height: 22px; border-radius: 50%; background-color: var(--accent-color); box-shadow: inset 0 3px 2px rgba(0,0,0,0.2); }

.dice-column { display: flex; flex-direction: column; justify-content: space-between; }
.cube__face--1 { justify-content: center; align-items: center; transform: rotateY(0deg) translateZ(70px); }
.cube__face--2 { justify-content: space-between; transform: rotateY(90deg) translateZ(70px); }
.cube__face--2 .pip:nth-child(2) { align-self: flex-end; }
.cube__face--3 { justify-content: space-between; transform: rotateY(180deg) translateZ(70px); }
.cube__face--3 .pip:nth-child(2) { align-self: center; }
.cube__face--3 .pip:nth-child(3) { align-self: flex-end; }
.cube__face--4 { justify-content: space-between; transform: rotateY(-90deg) translateZ(70px); }
.cube__face--5 { justify-content: space-between; transform: rotateX(90deg) translateZ(70px); }
.cube__face--5 .dice-center { justify-content: center; }
.cube__face--6 { justify-content: space-between; transform: rotateX(-90deg) translateZ(70px); }

.dice-controls { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 2rem; }
.btn-text { background: none; border: none; color: var(--text-color); text-decoration: underline; cursor: pointer; font-size: 0.9rem; opacity: 0.6; margin-top: 10px; }
.btn-text:hover { opacity: 1; color: var(--accent-color); }

/* =========================================
   7. CAROUSEL
   ========================================= */
.carousel-wrapper { position: relative; max-width: 1200px; margin: 0 auto; display: flex; align-items: center; width: 100%; }
.project-carousel { display: flex; gap: 2rem; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2rem 1rem; width: 100%; scrollbar-width: none; }
.project-carousel::-webkit-scrollbar { display: none; }

.project-card {
    min-width: 300px; max-width: 300px; scroll-snap-align: center;
    background: var(--card-bg); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
    transition: 0.3s; overflow: hidden;
}
.project-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.card-img-placeholder { height: 160px; width: 100%; background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%); display: block; }
[data-theme="dark"] .card-img-placeholder { background: linear-gradient(135deg, #444 0%, #333 100%); }
.card-content { padding: 1.5rem; text-align: left; }

.nav-arrow { width: 48px; height: 48px; border-radius: 50%; background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-color); cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: var(--shadow-sm); z-index: 10; flex-shrink: 0; transition: 0.3s; }
.nav-arrow:hover { background: var(--accent-color); color: #fff; transform: scale(1.1); }
.carousel-dots { display: flex; justify-content: center; gap: 10px; margin: 2rem 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(128,128,128,0.3); cursor: pointer; transition: 0.3s; }
.dot.active { background: var(--accent-color); transform: scale(1.2); }

/* =========================================
   8. EDUCATION & EXPERIENCE (Scroll Reveal)
   ========================================= */
.panel { padding: 6rem 5%; min-height: 80vh; }
.section-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 3rem; letter-spacing: -1px; }

/* Scroll Animation Initial State */
.scroll-reveal { opacity: 0; transform: translateY(40px); transition: all 0.6s ease-out; }
.scroll-reveal.visible { opacity: 1; transform: translateY(0); }

/* Timeline Boxes */
.timeline { border-left: 2px solid var(--accent-color); padding-left: 2rem; }
.timeline-item { margin-bottom: 3rem; position: relative; background: var(--card-bg); padding: 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.timeline-item::before { content: ''; position: absolute; left: -2.6rem; top: 20px; width: 1rem; height: 1rem; background: var(--bg-color); border: 3px solid var(--accent-color); border-radius: 50%; }

.grid-experience { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.job-card { background: var(--card-bg); padding: 2rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: transform 0.3s; border: 1px solid var(--border-color); }
.job-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

/* =========================================
   9. CONTACT (Falling Text)
   ========================================= */
.falling-text-container { position: relative; min-height: 100px; margin-bottom: 2rem; }
.fall-item { opacity: 0; transform: translateY(-50px); transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); font-size: 1.1rem; margin-bottom: 0.5rem; font-weight: 500; }
.falling-text-container.visible .fall-item { opacity: 1; transform: translateY(0); }
.falling-text-container.visible .fall-item:nth-child(1) { transition-delay: 0.1s; }
.falling-text-container.visible .fall-item:nth-child(2) { transition-delay: 0.3s; }
.falling-text-container.visible .fall-item:nth-child(3) { transition-delay: 0.5s; }

/* =========================================
   10. MODALS & FORMS
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(15px); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.mega-modal { background: var(--card-bg); width: 90%; max-width: 900px; height: 85vh; border-radius: var(--radius-lg); position: relative; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-color); }
.modal-body-scroll { padding: 3rem; overflow-y: auto; height: 100%; }
.close-modal { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-color); border: none; color: var(--text-color); font-size: 1.5rem; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: 0.3s; z-index: 10; }
.close-modal:hover { background: var(--accent-color); color: #fff; transform: rotate(90deg); }

.cv-preview-frame { flex-grow: 1; background: #525659; border-radius: var(--radius-md); overflow: hidden; margin-bottom: 2rem; min-height: 500px; }
.cv-preview-frame iframe { width: 100%; height: 100%; border: none; }
.download-buttons { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }
.cv-btn { display: flex; align-items: center; gap: 10px; text-decoration: none; border: 1px solid var(--border-color); color: var(--text-color); background: var(--bg-color); }

.btn-primary { background: var(--accent-color); color: #fff; border: none; padding: 0.8rem 2rem; border-radius: 50px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: 1rem; display: inline-block; text-decoration: none; }
.btn-primary:hover { transform: scale(1.05); background: var(--accent-hover); }

.contact-form { max-width: 500px; margin-top: 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea { width: 100%; padding: 1rem; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-color); font-family: inherit; transition: 0.3s; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent-color); }

/* =========================================
   11. MOBILE MENU
   ========================================= */
.mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--nav-bg); backdrop-filter: blur(25px);
    z-index: 2000; display: flex; flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.4s;
}
.mobile-menu-overlay.active { opacity: 1; pointer-events: auto; }

.mobile-links { list-style: none; text-align: center; margin-bottom: 2rem; }
.mobile-links li { margin: 1rem 0; }
.m-link { font-size: 2.5rem; font-weight: 800; color: var(--text-color); text-decoration: none; }
.mobile-socials { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
.social-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--card-bg); border: 1px solid var(--border-color); display: flex; justify-content: center; align-items: center; color: var(--text-color); font-weight: 700; text-decoration: none; box-shadow: var(--shadow-sm); transition: 0.2s; cursor: pointer; }
.social-icon:hover { transform: scale(1.1); background: var(--accent-color); color: #fff; }

.mobile-theme-control { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.switch-label { font-weight: 600; opacity: 0.8; }
.theme-switch-wrapper { position: relative; display: inline-block; width: 80px; height: 40px; }
.theme-switch-wrapper input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--card-bg); transition: .4s; border: 2px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.slider.round { border-radius: 40px; }
.slider:before { position: absolute; content: ""; height: 32px; width: 32px; left: 4px; bottom: 2px; background-color: var(--accent-color); transition: .4s; border-radius: 50%; }
input:checked + .slider:before { transform: translateX(38px); }
.icon-indicator { font-size: 18px; z-index: 1; opacity: 0.5; }

/* UTILS & RESPONSIVE */
footer { text-align: center; padding: 4rem 5%; border-top: 1px solid var(--border-color); margin-top: 4rem; opacity: 0.6; font-size: 0.9rem; }
.arena-hidden { display: none; }
.arena-visible { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.kbd-hint { font-size: 0.8em; opacity: 0.7; margin-left: 5px; font-weight: 400; }

/* =========================================
   CONSTRUCTION MODAL
   ========================================= */
.construction-modal-size {
    max-width: 500px; /* Smaller and neater than the project modal */
    height: auto;
    max-height: 80vh;
}

.construction-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem !important;
}

.construction-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: bounce 2s infinite;
}

.construction-layout h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.construction-layout p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    opacity: 0.8;
    line-height: 1.6;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-20px);}
    60% {transform: translateY(-10px);}
}

@media (max-width: 768px) {
    .nav-links, .side-widget, .kbd-hint { display: none; }
    .hamburger { display: flex; }
    .hero-section { flex-direction: column; text-align: center; padding-top: 6rem; }
    .hero-image-container { width: 200px; height: 200px; }
    .profile-img { width: 180px; height: 180px; }
}