/* ==========================================================================
   Base & CSS Variables (Dark/Light Mode)
   ========================================================================== */
:root {
    /* Deep Velvet Dark Theme (Default) */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-glass: rgba(30, 30, 30, 0.6);
    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;
    
    /* Golden Accents */
    --gold-primary: #bf953f;
    --gold-gradient: linear-gradient(to right, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);
    --gold-hover: #d4af37;
    
    /* Layout & UI */
    --border-radius: 12px;
    --transition: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
}

html.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #e0e0e0;
    --bg-glass: rgba(255, 255, 255, 0.6);
    --text-main: #121212;
    --text-muted: #4a4a4a;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
    cursor: none; /* Custom Cursor */
}

/* ==========================================================================
   Typography & Reusables
   ========================================================================== */
h1, h2, h3, .brand-logo {
    font-family: var(--font-heading);
}

.text-center { text-align: center; }

.container {
    width: 90%;
    max-width: 1300px;
    margin: 0 auto;
}

.gold-text {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
    display: inline-block;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 2rem;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
    display: inline-block;
}

/* ==========================================================================
   Custom Cursor
   ========================================================================== */
.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--gold-primary);
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

.cursor-outline {
    width: 30px;
    height: 30px;
    border: 1px solid var(--gold-primary);
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

.cursor-hover .cursor-outline {
    width: 50px;
    height: 50px;
    background-color: rgba(191, 149, 63, 0.1);
}

.spark {
    position: fixed;
    width: 4px;
    height: 4px;
    background: var(--gold-primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    animation: sparkAnim 0.8s forwards;
}

@keyframes sparkAnim {
    0% { opacity: 1; transform: scale(1) translate(0,0); }
    100% { opacity: 0; transform: scale(0) translate(var(--tx), var(--ty)); }
}

/* Hide custom cursor on touch devices */
@media (max-width: 768px) {
    body { cursor: auto; }
    .cursor-dot, .cursor-outline, #cursor-sparks { display: none; }
}

/* ==========================================================================
   Preloader
   ========================================================================== */
#preloader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: var(--bg-primary);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-out, visibility 1s;
}

.logo-morph {
    font-size: 4rem;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
    animation: pulseLogo 2s infinite alternate;
    text-align: center;
}

.progress-bar-container {
    width: 200px;
    height: 2px;
    background: var(--bg-secondary);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--gold-gradient);
    transition: width 0.1s linear;
}

@keyframes pulseLogo {
    0% { filter: drop-shadow(0 0 5px rgba(191,149,63,0.2)); }
    100% { filter: drop-shadow(0 0 20px rgba(191,149,63,0.8)); }
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
#header {
    position: fixed;
    top: 0; width: 100%;
    z-index: 1000;
    background: transparent;
    transition: background 0.4s, backdrop-filter 0.4s;
}

#header.scrolled {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.scroll-progress {
    height: 2px;
    background: var(--gold-gradient);
    width: 0%;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.brand-logo {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0%; height: 2px;
    background: var(--gold-gradient);
    transition: width 0.3s ease;
}

.nav-link:hover::after { width: 100%; }

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--gold-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.5s;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger .bar {
    width: 25px; height: 2px;
    background: var(--gold-primary);
    transition: all 0.3s;
}

.mobile-menu {
    position: fixed;
    top: 0; right: -100%;
    width: 70%; height: 100vh;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.mobile-menu.active { right: 0; }

.mobile-nav-links {
    list-style: none;
    text-align: center;
}

.mobile-nav-links li { margin: 2rem 0; }
.mobile-nav-links a {
    font-size: 1.5rem;
    color: var(--text-main);
    text-decoration: none;
    font-family: var(--font-heading);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#hero-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    opacity: 0.6;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.profile-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem auto;
    border-radius: 50%;
}

.profile-border {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    background: var(--gold-gradient);
    animation: rotateBorder 10s linear infinite;
    z-index: 1;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    border: 4px solid var(--bg-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

@keyframes rotateBorder {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-title {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.hero-title span {
    opacity: 0;
    display: inline-block;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--text-muted);
    opacity: 0; /* Fade in via JS */
    transform: translateY(20px);
}

.scroll-down {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--gold-primary);
    font-size: 2rem;
    animation: bounce 2s infinite;
    z-index: 2;
}

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

/* ==========================================================================
   About Section
   ========================================================================== */
.about-section {
    padding: 100px 0;
    position: relative;
    overflow: hidden;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    min-height: 120px; /* Space for typewriter */
}

/* Timeline */
.about-timeline {
    border-left: 2px solid var(--gold-primary);
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -39px;
    top: 5px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--gold-gradient);
    box-shadow: 0 0 10px var(--gold-primary);
}

.timeline-item h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.timeline-item p { color: var(--text-muted); }

/* Infinite Marquee */
.marquee-container {
    margin-top: 5rem;
    width: 100%;
    overflow: hidden;
    background: var(--bg-secondary);
    padding: 1.5rem 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    /* REMOVED: transform: skewY(-2deg); so it stays perfectly straight */
}

.marquee-content {
    display: flex;
    white-space: nowrap;
    /* CHANGED: reduced the time from 30s to 12s to make it much faster */
    animation: marqueeAnim 12s linear infinite; 
}

.marquee-content span {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.marquee-content .dot {
    margin: 0 2rem;
    color: var(--text-muted);
}

@keyframes marqueeAnim {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.projects-section {
    padding: 100px 0;
    background: var(--bg-secondary);
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.project-card {
    background: transparent;
    height: 400px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%; height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.project-card:hover .card-inner,
.project-card:focus .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.card-front {
    background: var(--bg-primary);
    border: 1px solid rgba(191, 149, 63, 0.2);
    overflow: hidden;
}

.card-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><circle cx="50" cy="50" r="40" stroke="%23bf953f" stroke-width="2" fill="none"/></svg>') repeat;
    z-index: 0;
}

.card-front h3, .card-front p { z-index: 1; }

.card-front h3 {
    font-size: 1.8rem;
    color: var(--gold-primary);
    margin-bottom: 0.5rem;
}

.card-back {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gold-primary);
    transform: rotateY(180deg);
}

.card-back h3 { margin-bottom: 1rem; color: var(--text-main); }
.card-back p { margin-bottom: 2rem; color: var(--text-muted); font-size: 0.9rem;}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-section {
    padding: 100px 0;
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0;
}

.social-icon {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: var(--gold-primary);
    font-size: 1.2rem;
    border: 1px solid rgba(191, 149, 63, 0.3);
    transition: background 0.3s, color 0.3s;
}

.social-icon:hover {
    background: var(--gold-gradient);
    color: #000;
}

.map-placeholder {
    width: 100%; height: 200px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(191, 149, 63, 0.2);
}

.map-placeholder span {
    z-index: 1;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.map-placeholder:hover .map-bg { transform: scale(1.1); }

.map-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(45deg, rgba(191,149,63,0.05) 0, rgba(191,149,63,0.05) 10px, transparent 10px, transparent 20px);
    transition: transform 0.5s;
}

/* Form Styles */
.contact-form {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.input-group {
    position: relative;
    margin-bottom: 2rem;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 10px 0;
    font-size: 1rem;
    color: var(--text-main);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    outline: none;
    resize: none;
    transition: border-color 0.3s;
}

.input-group label {
    position: absolute;
    top: 10px; left: 0;
    color: var(--text-muted);
    pointer-events: none;
    transition: 0.3s ease all;
}

.input-group input:focus, .input-group textarea:focus {
    border-bottom-color: var(--gold-primary);
}

.input-group input:focus ~ label, .input-group input:valid ~ label,
.input-group textarea:focus ~ label, .input-group textarea:valid ~ label {
    top: -20px;
    font-size: 0.8rem;
    color: var(--gold-primary);
}

.error-msg {
    color: #ff4d4d;
    font-size: 0.8rem;
    position: absolute;
    bottom: -20px;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.input-group.error .error-msg { opacity: 1; }
.input-group.error input, .input-group.error textarea {
    border-bottom-color: #ff4d4d;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

/* Buttons */
.btn-submit, .btn-primary {
    display: inline-block;
    padding: 12px 30px;
    background: transparent;
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    transition: color 0.3s;
}

.btn-submit { width: 100%; display: flex; justify-content: center; align-items: center; }

.btn-submit:hover, .btn-primary:hover {
    color: #000;
}

.btn-submit::before, .btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: var(--gold-gradient);
    transition: left 0.4s;
    z-index: -1;
}

.btn-submit:hover::before, .btn-primary:hover::before { left: 0; }

.spinner {
    display: none;
    width: 20px; height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .spinner { display: block; }
.btn-submit.loading::before { left: 0; }
.btn-submit.loading { color: #000; pointer-events: none; }

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleAnim 0.6s linear;
    pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    position: relative;
    background: var(--bg-primary);
    padding: 60px 0 20px;
    text-align: center;
}

.custom-shape-divider-top {
    position: absolute;
    top: -119px; left: 0; width: 100%;
    overflow: hidden;
    line-height: 0;
}

.custom-shape-divider-top svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 120px;
}

.custom-shape-divider-top .shape-fill { fill: var(--bg-primary); }

.footer-logo {
    font-size: 3rem;
    font-family: var(--font-heading);
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.footer p { color: var(--text-muted); font-size: 0.9rem; }

#back-to-top {
    position: absolute;
    bottom: 20px; right: 20px;
    width: 45px; height: 45px;
    background: var(--bg-secondary);
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: var(--gold-gradient); color: #000; transform: translateY(-5px); }

/* ==========================================================================
   Animations & Reveal Classes
   ========================================================================== */
.hidden-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hidden-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Responsive Media Queries
   ========================================================================== */
@media (max-width: 992px) {
    .about-grid, .contact-wrapper { grid-template-columns: 1fr; }
    .hero-title { font-size: 4rem; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .hero-title { font-size: 3rem; }
    .section-title { font-size: 2.5rem; }
    .contact-form { padding: 2rem; }
}
