:root {
    --bg: #090b0a;
    --surface: #101311;
    --text: #f0f2f0;
    --muted: #909792;
    --line: #252a27;
    --accent: #40df8b;
    --max: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: "Poppins", sans-serif; overflow-x: hidden; }
body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #07100a; }

.site-header {
    position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 70px;
    display: flex; align-items: center; gap: 32px; padding: 0 max(24px, calc((100% - var(--max)) / 2));
    border-bottom: 1px solid transparent; background: rgba(9, 11, 10, .9); backdrop-filter: blur(14px);
}
.site-header.scrolled { border-color: var(--line); }
.logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -.07em; }
.logo span, em { color: var(--accent); font-style: normal; }
.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a { color: var(--muted); font-size: .76rem; transition: color .2s; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav-cta { padding: 9px 14px; border: 1px solid var(--line); font-size: .76rem; transition: border-color .2s; }
.nav-cta:hover { border-color: var(--accent); }
.menu-toggle { display: none; border: 0; background: none; }

.hero {
    position: relative; max-width: var(--max); min-height: 100svh; margin: auto; padding: 130px 0 80px;
    display: grid; grid-template-columns: 1fr .72fr; align-items: center; gap: 90px;
}
.eyebrow, .section-kicker {
    display: flex; align-items: center; gap: 12px; color: var(--muted);
    font-size: .68rem; font-weight: 500; letter-spacing: .15em; text-transform: uppercase;
}
.eyebrow span { width: 24px; height: 1px; background: var(--accent); }
.hero h1 { margin: 20px 0 24px; font-size: clamp(4.7rem, 9vw, 8.2rem); line-height: .88; letter-spacing: -.085em; font-weight: 600; }
.hero-role { display: flex; align-items: center; gap: 10px; color: #b8bebb; font-size: .79rem; }
.hero-role i { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.motto { margin-top: 30px; font-size: 1.08rem; }
.hero-intro { max-width: 560px; margin-top: 13px; color: var(--muted); font-size: .88rem; line-height: 1.8; }
.hero-actions { display: flex; gap: 10px; margin-top: 30px; }
.button {
    min-height: 44px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 15px;
    border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: .75rem; font-weight: 500; transition: background .2s, color .2s, border-color .2s;
}
.button-primary { border-color: var(--accent); background: var(--accent); color: #07100a; }
.button-primary:hover { background: #7aefae; }
.button-secondary:hover { border-color: var(--accent); }
.hero-meta { display: flex; gap: 24px; margin-top: 32px; color: #737a75; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
.hero-meta span:first-child { display: flex; align-items: center; gap: 8px; }
.hero-meta i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hero-visual { align-self: end; }
.profile-frame { aspect-ratio: .78; overflow: hidden; background: var(--surface); }
.profile-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.75); }
.scroll-cue { position: absolute; bottom: 28px; left: 0; color: #656b67; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; }
.scroll-cue span { display: inline-block; width: 25px; height: 1px; margin-right: 9px; vertical-align: middle; background: #656b67; }

.section { max-width: var(--max); margin: auto; padding: 115px 0; scroll-margin-top: 60px; border-top: 1px solid var(--line); }
.section-kicker { margin-bottom: 45px; }
.section-kicker span { color: var(--accent); }
.section-title h2, .contact h2 { font-size: clamp(2.8rem, 5.5vw, 5rem); line-height: 1; letter-spacing: -.065em; font-weight: 500; }
.about-layout, .skills-heading, .projects-heading { display: grid; grid-template-columns: 1.1fr .75fr; gap: 100px; align-items: end; }
.about-copy p, .skills-heading > p, .projects-heading > p { color: var(--muted); font-size: .86rem; line-height: 1.85; }
.about-copy .lead { margin-bottom: 15px; color: #d1d6d3; font-size: 1rem; }
.text-link { display: inline-block; margin-top: 25px; padding-bottom: 4px; border-bottom: 1px solid var(--accent); color: var(--accent); font-size: .75rem; }
.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 70px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact-card { min-height: 145px; padding: 22px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.fact-card:last-child { border-right: 0; }
.fact-card > span { color: #5f6661; font-size: .63rem; }
.fact-card small { margin-top: auto; color: var(--muted); font-size: .61rem; letter-spacing: .1em; text-transform: uppercase; }
.fact-card strong { margin-top: 6px; font-size: .85rem; font-weight: 500; line-height: 1.5; }

.skills-section, .achievements-section { max-width: var(--max); background: none; }
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 60px; border-top: 1px solid var(--line); }
.skill-card { min-height: 270px; padding: 25px 25px 25px 0; border-right: 1px solid var(--line); }
.skill-card + .skill-card { padding-left: 25px; }
.skill-card:last-child { border-right: 0; }
.skill-card-head { display: flex; justify-content: space-between; color: #606762; font-size: .63rem; }
.skill-icon { color: var(--accent); font-size: .66rem; }
.skill-card h3 { margin: 65px 0 25px; font-size: 1rem; font-weight: 500; }
.tags, .tech-row { display: flex; flex-wrap: wrap; gap: 7px 15px; }
.tags span, .tech-row span { color: var(--muted); font-size: .66rem; }
.tags span::before, .tech-row span::before { content: "·"; margin-right: 5px; color: var(--accent); }

.featured-project {
    display: grid; grid-template-columns: 1.2fr .8fr; gap: 65px; align-items: center;
    margin-top: 70px; padding-bottom: 90px; border-bottom: 1px solid var(--line);
}
.project-reverse { grid-template-columns: .8fr 1.2fr; }
.project-reverse .project-gallery { order: 2; }
.project-gallery { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.project-gallery button, .achievement-image, .certificate-image { overflow: hidden; border: 0; background: var(--surface); cursor: zoom-in; }
.project-gallery img, .achievement-image img, .certificate-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.project-gallery button:hover img, .achievement-image:hover img, .certificate-image:hover img { transform: scale(1.02); }
.gallery-main { min-height: 410px; grid-row: span 2; }
.gallery-small { min-height: 202px; }
.single-image { display: block; }
.single-image .gallery-main { display: block; width: 100%; }
.project-number { position: absolute; top: 12px; left: 12px; padding: 6px 8px; background: var(--bg); color: var(--accent); font-size: .55rem; }
.project-type, .award-label, .certificate-card span { color: var(--accent); font-size: .61rem; letter-spacing: .12em; text-transform: uppercase; }
.project-info h3 { margin: 18px 0; font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1.08; letter-spacing: -.05em; font-weight: 500; }
.project-info > p { color: var(--muted); font-size: .8rem; line-height: 1.8; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 24px 0; }
.feature-list span { color: #c2c8c4; font-size: .67rem; }
.feature-list span::before { content: "—"; margin-right: 7px; color: var(--accent); }

.achievement-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1px; margin-top: 60px; background: var(--line); border: 1px solid var(--line); }
.achievement-card { background: var(--bg); }
.achievement-large { grid-row: span 2; }
.achievement-image { width: 100%; height: 205px; }
.achievement-large .achievement-image { height: 400px; }
.achievement-copy { padding: 22px; }
.achievement-copy h3 { margin: 9px 0 14px; font-size: 1.1rem; font-weight: 500; }
.achievement-copy ul { display: flex; flex-wrap: wrap; gap: 7px 15px; list-style: none; color: var(--muted); font-size: .64rem; }

.certificate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 55px; background: var(--line); border: 1px solid var(--line); }
.certificate-card { background: var(--bg); }
.certificate-image { width: 100%; height: 300px; }
.certificate-card > div { padding: 22px; }
.certificate-card h3 { margin: 9px 0 5px; font-size: .95rem; font-weight: 500; }
.certificate-card p { color: var(--muted); font-size: .69rem; }
.coding-profile { display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 25px; margin-top: 35px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.coding-profile > div { display: flex; align-items: center; gap: 14px; }
.code-bracket { color: var(--accent); font-weight: 600; }
.coding-profile small { color: var(--accent); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.coding-profile h3 { font-size: 1.1rem; font-weight: 500; }
.coding-profile p { color: var(--muted); font-size: .73rem; line-height: 1.7; }
.coding-profile p strong { color: var(--text); }

.contact { max-width: var(--max); padding-bottom: 60px; }
.contact-inner { padding: 75px 0 20px; }
.contact h2 { max-width: 800px; }
.contact-inner > p { max-width: 570px; margin-top: 22px; color: var(--muted); font-size: .83rem; line-height: 1.8; }
.contact-email { display: inline-block; margin-top: 32px; padding-bottom: 5px; border-bottom: 1px solid var(--accent); color: var(--accent); font-size: 1rem; }
.social-links { display: flex; flex-wrap: wrap; gap: 25px; margin-top: 65px; padding-top: 22px; border-top: 1px solid var(--line); }
.social-links a { color: var(--muted); font-size: .72rem; transition: color .2s; }
.social-links a:hover { color: var(--text); }
footer { max-width: var(--max); margin: auto; padding: 30px 0 40px; display: flex; justify-content: space-between; color: #686f6a; font-size: .61rem; letter-spacing: .08em; text-transform: uppercase; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
.lightbox { width: min(92vw, 1100px); max-height: 90vh; margin: auto; padding: 0; border: 1px solid var(--line); background: var(--bg); }
.lightbox::backdrop { background: rgba(0,0,0,.9); }
.lightbox img { width: 100%; max-height: 88vh; object-fit: contain; }
.lightbox-close { position: absolute; top: -36px; right: 0; border: 0; background: none; cursor: pointer; font-size: 1.5rem; }

@media (max-width: 1220px) {
    .hero, .section, .skills-section, .achievements-section, .contact, footer { margin-left: 24px; margin-right: 24px; }
}
@media (max-width: 900px) {
    .nav-cta { display: none; }
    .menu-toggle { z-index: 102; display: grid; gap: 5px; margin-left: auto; cursor: pointer; }
    .menu-toggle span { width: 18px; height: 1px; background: var(--text); transition: transform .2s; }
    .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
    .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }
    .nav { position: fixed; inset: 0; z-index: 101; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 20px; padding: 30px; background: var(--bg); opacity: 0; visibility: hidden; }
    .nav.open { opacity: 1; visibility: visible; }
    .nav a { font-size: 1.7rem; letter-spacing: -.05em; }
    .hero { grid-template-columns: 1fr; gap: 60px; padding-top: 130px; }
    .hero-visual { max-width: 480px; }
    .scroll-cue { display: none; }
    .about-layout, .skills-heading, .projects-heading { grid-template-columns: 1fr; gap: 30px; }
    .facts-grid, .skills-grid { grid-template-columns: 1fr 1fr; }
    .featured-project, .project-reverse { grid-template-columns: 1fr; }
    .project-reverse .project-gallery { order: 0; }
    .achievement-grid { grid-template-columns: 1fr 1fr; }
    .achievement-large { grid-column: span 2; grid-row: auto; }
    .coding-profile { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .site-header { height: 60px; padding: 0 16px; }
    .hero, .section, .skills-section, .achievements-section, .contact, footer { margin-left: 16px; margin-right: 16px; }
    .hero { padding: 105px 0 65px; gap: 45px; }
    .hero h1 { font-size: clamp(4rem, 22vw, 5.6rem); }
    .hero-role, .hero-meta { flex-wrap: wrap; }
    .hero-actions .button { flex: 1; padding: 0 10px; }
    .section { padding: 80px 0; }
    .section-title h2, .contact h2 { font-size: 2.8rem; }
    .facts-grid, .skills-grid, .certificate-grid, .achievement-grid { grid-template-columns: 1fr; }
    .fact-card { min-height: 125px; border-right: 0; border-bottom: 1px solid var(--line); }
    .skill-card, .skill-card + .skill-card { min-height: 230px; padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .skill-card h3 { margin-top: 45px; }
    .featured-project { gap: 28px; margin-top: 45px; padding-bottom: 65px; }
    .gallery-main { min-height: 300px; }
    .gallery-small { min-height: 147px; }
    .achievement-large { grid-column: auto; }
    .achievement-image, .achievement-large .achievement-image { height: 240px; }
    .certificate-image { height: 210px; }
    .contact-email { font-size: .78rem; }
    footer { flex-direction: column; gap: 13px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Refined visual layer */
body {
    background:
        radial-gradient(circle at 78% 8%, rgba(64, 223, 139, .055), transparent 28rem),
        var(--bg);
}

.nav a { position: relative; }
.nav a::after {
    content: ""; position: absolute; right: 0; bottom: -9px; left: 0; height: 1px;
    background: var(--accent); transform: scaleX(0); transition: transform .2s;
}
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }
.nav-cta, .button { border-radius: 6px; }
.nav-cta:hover { background: rgba(64, 223, 139, .07); }
.button { transition: transform .2s, background .2s, color .2s, border-color .2s; }
.button:hover { transform: translateY(-2px); }

.hero::after {
    content: ""; position: absolute; right: -12%; bottom: 7%; z-index: -1;
    width: 420px; height: 420px; border: 1px solid rgba(64, 223, 139, .08); border-radius: 50%;
}
.profile-frame {
    position: relative; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 22px 22px 0 rgba(64, 223, 139, .045);
}
.profile-frame::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, transparent 65%, rgba(9, 11, 10, .35));
}
.profile-frame img { filter: saturate(.82); transition: transform .6s ease; }
.profile-frame:hover img { transform: scale(1.015); }

.section { padding-top: 125px; padding-bottom: 125px; }
.fact-card, .skill-card, .achievement-card, .certificate-card { transition: background .25s, transform .25s; }
.fact-card:hover, .achievement-card:hover, .certificate-card:hover { background: rgba(64, 223, 139, .035); }
.skill-card:hover {
    transform: translateY(-4px);
    background: linear-gradient(180deg, rgba(64, 223, 139, .035), transparent);
}

.project-gallery button, .achievement-image, .certificate-image {
    border: 1px solid var(--line); border-radius: 10px;
}
.project-number {
    border: 1px solid var(--line); border-radius: 4px;
    background: rgba(9, 11, 10, .88); backdrop-filter: blur(8px);
}

.contact-inner {
    padding: 75px 55px 55px; border: 1px solid var(--line); border-radius: 14px;
    background: linear-gradient(125deg, var(--surface), rgba(64, 223, 139, .035));
}
.social-links a { transition: color .2s, transform .2s; }
.social-links a:hover { transform: translateY(-2px); }

@media (max-width: 900px) {
    .nav a::after { display: none; }
}

@media (max-width: 620px) {
    .contact-inner { padding: 42px 22px; }
    .hero::after { display: none; }
}

/* ============================================================
   IMMERSIVE LAYER — loader, starfield, noise, cursor, motion
   ============================================================ */

/* Page loader */
.loader {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
    background: var(--bg);
    transition: opacity .7s ease, visibility .7s ease;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-mark { font-size: 2.6rem; font-weight: 700; letter-spacing: -.07em; }
.loader-mark span { color: var(--accent); }
.loader-line { width: 180px; height: 2px; background: var(--line); overflow: hidden; border-radius: 2px; }
.loader-line span { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: loaderSlide 1s ease-in-out infinite; }
@keyframes loaderSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(420%); } }

/* Starfield + noise + ambient */
#starfield { position: fixed; inset: 0; z-index: -3; width: 100%; height: 100%; pointer-events: none; }
.noise {
    position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Cursor spotlight */
.spotlight {
    position: fixed; z-index: -1; top: 0; left: 0; width: 540px; height: 540px; pointer-events: none;
    transform: translate(-50%, -50%); opacity: 0; transition: opacity .5s ease;
    background: radial-gradient(circle, rgba(64, 223, 139, .08), transparent 62%);
}
@media (hover: hover) and (pointer: fine) { .spotlight.active { opacity: 1; } }

/* Scroll progress */
.scroll-progress { position: fixed; z-index: 200; top: 0; left: 0; width: 100%; height: 2px; background: transparent; }
.scroll-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), #9ff5c4); box-shadow: 0 0 12px rgba(64, 223, 139, .6); }

/* Hero — animated gradient name + orbits + glow */
.hero h1 em {
    background: linear-gradient(115deg, var(--accent), #b6f7d3 40%, var(--accent) 75%);
    background-size: 220% 220%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.hero-visual { position: relative; }
.profile-glow {
    position: absolute; inset: -6% -6% -10%; z-index: -1; border-radius: 50%;
    background: radial-gradient(circle, rgba(64, 223, 139, .22), transparent 68%);
    filter: blur(34px); animation: glowPulse 5s ease-in-out infinite;
}
@keyframes glowPulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
.orbit {
    position: absolute; left: 50%; top: 50%; z-index: -1; border-radius: 50%;
    border: 1px solid rgba(64, 223, 139, .12); transform: translate(-50%, -50%);
}
.orbit-one { width: 118%; height: 118%; animation: spin 26s linear infinite; }
.orbit-two { width: 138%; height: 138%; border-style: dashed; border-color: rgba(64, 223, 139, .07); animation: spin 40s linear infinite reverse; }
.orbit-one::before {
    content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
    border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.profile-frame img { will-change: transform; }

/* Stats band — animated counters */
.stats-band {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
    margin-top: 1px; background: var(--line); border: 1px solid var(--line); border-top: 0;
}
.stat { padding: 30px 22px; background: var(--bg); transition: background .25s; }
.stat:hover { background: rgba(64, 223, 139, .04); }
.stat strong { display: block; font-size: clamp(2.2rem, 4vw, 3.1rem); font-weight: 600; letter-spacing: -.04em; line-height: 1; color: var(--accent); }
.stat small { display: block; margin-top: 10px; color: var(--muted); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }

/* Reveal — richer entrance + stagger */
.reveal { transform: translateY(26px); transition: opacity .7s cubic-bezier(.22, 1, .36, 1), transform .7s cubic-bezier(.22, 1, .36, 1); }

/* Magnetic buttons + card tilt */
.button, .nav-cta { will-change: transform; }
.skill-card, .fact-card, .achievement-card, .certificate-card, .stat { transform-style: preserve-3d; }

/* Card sheen on featured projects */
.project-gallery button::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .12), transparent 70%);
    transition: opacity .4s; mix-blend-mode: overlay;
}
.project-gallery button:hover::after { opacity: 1; }
.project-gallery button { position: relative; }

/* Link underline sweep for text links */
.text-link, .contact-email { position: relative; }

/* Section kicker number — subtle accent box */
.section-kicker span { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; }

@media (max-width: 900px) {
    .stats-band { grid-template-columns: 1fr 1fr; }
    .orbit-two { display: none; }
}
@media (max-width: 620px) {
    .stats-band { grid-template-columns: 1fr 1fr; }
    .stat { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .loader-line span, .hero h1 em, .profile-glow, .orbit { animation: none !important; }
    #starfield, .spotlight { display: none; }
}
