/* ---------------------------
   Theme variables, reset, layout
   --------------------------- */
:root {
    --accent: #8b5cf6;
    /* purple accent */
    --accent-2: #6d28d9;
    --bg-dark: #0b0f17;
    --bg-dark-2: #071021;
    --panel-dark: rgba(255, 255, 255, 0.03);
    --text-dark: #e6eef6;
    --muted-dark: #98a2b3;

    --bg-light: #f6f7fb;
    --panel-light: rgba(10, 12, 15, 0.04);
    --text-light: #091123;
    --muted-light: #6b7280;

    --radius: 14px;
    --shadow-lg: 0 20px 50px rgba(2, 6, 23, 0.6);
    --shadow-soft: 0 8px 24px rgba(2, 6, 23, 0.18);
    --container: 1200px;
    --gap: 24px;
    --transition: 420ms cubic-bezier(.2, .9, .2, 1);
}

body.preload main {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms ease, transform 600ms ease;
}

body main {
    opacity: 1;
    transform: none;
}


/* Preloader styles */
#preloader {
    position: fixed;
    z-index: 9999;
    background: var(--bg);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}

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


/* Theme classes applied on <html> by JS */
html.theme-dark {
    --bg: linear-gradient(180deg, var(--bg-dark), var(--bg-dark-2));
    --panel: var(--panel-dark);
    --text: var(--text-dark);
    --muted: var(--muted-dark);
    --shadow: var(--shadow-lg);
}

html.theme-light {
    --bg: linear-gradient(180deg, var(--bg-light), #ffffff);
    --panel: var(--panel-light);
    --text: var(--text-light);
    --muted: var(--muted-light);
    --shadow: var(--shadow-soft);
}

html.theme-light .section-alt {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgb(231 227 245) 20%, rgb(231 227 245) 80%, rgba(255, 255, 255, 0) 100%);
}

/* Initial page load protection */
html.preload * {
    transition: none !important;
}

/* Reset & base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    transition: background var(--transition), color var(--transition);
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px
}

/* Typography */
h1,
h2,
h3 {
    margin: 0;
    font-family: 'Poppins', "Inter", sans-serif
}

h1 {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.02
}

h2 {
    font-size: 22px
}

.muted {
    color: var(--muted);
    font-size: 0.95rem
}


/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 120;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03)
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0
}

.brand {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none
}

.brand-dot {
    color: var(--accent);
    margin-left: 6px
}

.main-nav {}

.nav-list {
    display: flex;
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 220ms, background 220ms
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: var(--panel)
}

/* Actions */
.actions {
    display: flex;
    align-items: center;
    gap: 8px
}

.theme-toggle {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border: 0;
    padding: 8px;
    border-radius: 999px;
    color: #061827;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.12)
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer
}

.hamb {
    width: 22px;
    height: 2px;
    background: var(--text);
    position: relative;
    display: inline-block
}

.hamb::before,
.hamb::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 2px;
    background: var(--text);
    left: 0
}

.hamb::before {
    top: -7px
}

.hamb::after {
    top: 7px
}

/* Mobile menu */
.mobile-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px 0
}

.mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0
}

.mobile-menu a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text)
}

/* Section base */
.section {
    padding: 72px 0;
    position: relative;
    overflow: visible
}


.section-alt {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(18, 17, 37, 0.75) 15%, rgba(18, 17, 37, 0.75) 85%, rgba(255, 255, 255, 0) 100%)
}


/* HERO */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 48px;
    align-items: center
}

.hero-left {
    max-width: 720px
}

.eyebrow {
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.06em
}

.headline {
    font-weight: 800;
    margin-bottom: 6px
}

.subline {
    font-size: 1.125rem;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px
}

.cursor {
    color: var(--accent);
    font-weight: 700;
    opacity: 1;
    animation: blink 900ms steps(1) infinite
}

@keyframes blink {
    50% {
        opacity: 0
    }
}

.lead {
    color: var(--muted);
    margin: 18px 0 22px;
    font-size: 1.03rem
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    transition: transform var(--transition), box-shadow var(--transition)
}

.btn-primary,
.btn.btn-primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #061827;
    box-shadow: 0 12px 30px rgba(109, 40, 217, 0.12)
}

.btn-outline,
.btn.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text)
}

/* hero card (right) */
.hero-card {
    position: relative;
    background: var(--panel);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    overflow: visible
}

.hero-card-media {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px
}

.hero-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.hero-card-body h3 {
    margin: 0;
    font-size: 1.05rem
}

.hero-links {
    margin-top: 8px
}

.hero-links .link {
    color: var(--accent);
    text-decoration: none;
    margin-right: 10px;
    font-weight: 700
}

/* floating decorative shapes */
.bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.22;
    mix-blend-mode: screen;
    transform: translate3d(0, 0, 0)
}

.shape-1 {
    width: 360px;
    height: 360px;
    left: -8%;
    top: -4%;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    animation: floatY 9s ease-in-out infinite
}

.shape-2 {
    width: 220px;
    height: 220px;
    right: 8%;
    top: 10%;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    opacity: 0.14;
    animation: floatX 11s ease-in-out infinite
}

.shape-3 {
    width: 140px;
    height: 140px;
    left: 22%;
    bottom: 10%;
    background: linear-gradient(135deg, #8b5cf6, #00e5a8);
    opacity: 0.12;
    animation: floatY 12s ease-in-out infinite
}

@keyframes floatY {
    0% {
        transform: translateY(-8px)
    }

    50% {
        transform: translateY(8px)
    }

    100% {
        transform: translateY(-8px)
    }
}

@keyframes floatX {
    0% {
        transform: translateX(-6px)
    }

    50% {
        transform: translateX(6px)
    }

    100% {
        transform: translateX(-6px)
    }
}

/* ABOUT */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: center
}

.about-image img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.4)
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 14px
}

.stat {
    background: var(--panel);
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow)
}

.stat-num {
    font-weight: 800;
    font-size: 20px
}

.tech-box {
    background: var(--panel);
    padding: 14px;
    border-radius: 12px;
    margin-top: 12px
}

.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.tech-pill {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--muted)
}

.skills-wrap {
    margin-top: 40px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

/* Glassmorphism for skill-card */
.skill-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow:
        inset 0 0 0.5px rgba(255, 255, 255, 0.25),
        0 15px 40px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.skill-card:hover {
    box-shadow:
        inset 0 0 1px rgba(255, 255, 255, 0.3),
        0 20px 50px rgba(0, 0, 0, 0.35);
    transform: scale(1.03);
}

.skill-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.skill-meta h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text);
}

.skill-meta p {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.skill-tags {
    margin-top: 20px;
}

.skill-tags .tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    border-radius: 999px;
    margin-right: 10px;
    color: var(--muted);
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease, color 0.2s ease;
}

.skill-tags .tag:hover {
    background: var(--accent-light);
    color: var(--text);
}


/* PROJECTS */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 18px
}

.proj-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition)
}

.proj-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow)
}

.proj-media img {
    width: 100%;
    display: block;
    height: 170px;
    object-fit: cover
}

.proj-body {
    padding: 14px
}

.proj-tags {
    display: flex;
    gap: 8px;
    margin-top: 12px
}

.proj-tags span {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted)
}

/* CONTROLS */
.projects-controls {
    margin-top: 18px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text)
}

/* CTA & footer */
.cta {
    text-align: center;
    padding: 54px 0
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding: 18px 0;
    margin-top: 32px
}

.footer-grid {
    display: flex;
    align-items: center;
    justify-content: space-between
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.6);
    z-index: 220
}

.modal.show {
    display: flex
}

.modal-panel {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    max-width: 920px;
    width: 94%;
    box-shadow: var(--shadow)
}

.modal-close {
    position: absolute;
    right: 18px;
    top: 18px;
    background: transparent;
    border: 0;
    color: var(--text);
    font-size: 18px;
    cursor: pointer
}

/* Reveal helpers */
.animate-up {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 520ms var(--transition), transform 520ms var(--transition)
}

.animate-scale {
    opacity: 0;
    transform: scale(.98);
    transition: opacity 520ms var(--transition), transform 520ms var(--transition)
}

.animate-left {
    opacity: 0;
    transform: translateX(-18px);
    transition: opacity 520ms var(--transition), transform 520ms var(--transition)
}

.animate-right {
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 520ms var(--transition), transform 520ms var(--transition)
}

.in-view {
    opacity: 1;
    transform: none
}

/* delays */
.delay-1 {
    transition-delay: 140ms
}

.delay-2 {
    transition-delay: 260ms
}

.delay-3 {
    transition-delay: 380ms
}

.delay-4 {
    transition-delay: 520ms
}


/* Contact */

.contact-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.contact-form .form-group {
    margin-bottom: 1rem;
}

.contact-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.3);
}

.contact-details {
    margin-top: 1.5rem;
}

.social-links {
    margin-top: 1rem;
}

.social-links a {
    color: var(--accent);
    font-weight: 600;
}


/* Responsive */
@media (max-width:1000px) {
    .hero-grid {
        grid-template-columns: 1fr
    }

    .grid-2 {
        grid-template-columns: 1fr
    }
}

@media (max-width:680px) {
    .nav-list {
        display: none
    }

    .mobile-toggle {
        display: inline-block
    }

    .hero-card-media {
        width: 140px;
        height: 140px
    }

    .hero-grid {
        gap: 28px
    }

    .container {
        padding: 0 16px
    }
}