:root {
    --bg-dark: #050816;
    --bg-soft: #0f172a;
    --surface: rgba(15, 23, 42, .72);
    --surface-2: rgba(30, 41, 59, .78);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #22d3ee;
    --accent-2: #3b82f6;
    --accent-3: #8b5cf6;
    --border: rgba(148, 163, 184, .18);
    --shadow: 0 24px 80px rgba(0, 0, 0, .35);
    --radius: 24px;
    font-family: Inter, system-ui, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(34, 211, 238, .16), transparent 32%),
        radial-gradient(circle at bottom right, rgba(139, 92, 246, .16), transparent 32%),
        linear-gradient(135deg, var(--bg-dark), var(--bg-soft));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent);
    z-index: -1;
}

a {
    color: inherit;
}

main {
    width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
    padding: 96px 0 64px;
}

/* HEADER */
.site-header {
    position: sticky;
    top: 16px;
    z-index: 9999;
    width: min(1200px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-radius: 999px;
    background: rgba(2, 6, 23, .78);
    border: 1px solid var(--border);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
}

.site-brand {
    font-size: 22px;
    font-weight: 900;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav a,
.theme-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .25s ease;
}

.site-nav a:hover,
.theme-toggle:hover {
    color: var(--accent);
    background: rgba(255,255,255,.08);
    border-color: rgba(34,211,238,.25);
    transform: translateY(-2px);
}

.theme-toggle {
    width: 42px;
    padding: 0;
    color: var(--text);
    border-color: var(--border);
}

/* UTILITIES */
.glassmorphism,
.profile-card,
.about-card,
.skill-card,
.contact-info,
.contact-form,
.empty-state,
.project-card,
.featured-project,
.project-search-form,
.project-detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.reveal-section,
.reveal-item {
    animation: revealUp .75s ease both;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-container {
    width: 100%;
}

.section-header,
.section-heading {
    margin-bottom: 42px;
}

.section-label,
.hero-label {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.section-header h2,
.section-heading h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1;
    font-weight: 900;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* HERO */
.hero-section,
.about-section,
.skills-section,
.education-section,
.projects-section,
.contact-section {
    margin-bottom: 96px;
}

.hero-container {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 72px;
    align-items: center;
}

.hero-text {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.hero-title {
    font-size: clamp(3rem, 7vw, 5.8rem);
    line-height: .95;
    font-weight: 950;
    letter-spacing: -3px;
    background: linear-gradient(135deg, #fff, var(--accent), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    max-width: 620px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.8;
}

.hero-contact {
    display: grid;
    gap: 14px;
    margin-top: 10px;
}

.contact-item,
.info-item {
    padding: 15px 18px;
    border-radius: 18px;
    background: rgba(15,23,42,.58);
    border: 1px solid var(--border);
    transition: .25s ease;
}

.contact-item:hover {
    transform: translateX(8px);
    border-color: rgba(34,211,238,.45);
}

.contact-item small,
.info-item small {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.contact-item strong,
.info-item strong {
    color: var(--text);
    overflow-wrap: anywhere;
}

.hero-image {
    display: flex;
    justify-content: center;
}

.image-wrapper {
    position: relative;
    width: min(100%, 460px);
    aspect-ratio: 1;
}

.image-glow {
    position: absolute;
    inset: -38px;
    border-radius: 42px;
    background: linear-gradient(135deg, rgba(34,211,238,.32), rgba(139,92,246,.28));
    filter: blur(60px);
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
    50% {
        transform: scale(1.05);
        opacity: .75;
    }
}

.profile-image {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 34px;
    border: 2px solid rgba(34,211,238,.6);
    box-shadow: 0 32px 90px rgba(34,211,238,.18);
}

/* CARDS */
.about-card {
    padding: 42px;
    color: var(--muted);
    line-height: 1.85;
    font-size: 1.08rem;
}

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

.skill-card,
.project-card {
    padding: 28px;
    transition: .3s ease;
}

.skill-card:hover,
.project-card:hover {
    transform: translateY(-7px);
    border-color: rgba(34,211,238,.45);
    box-shadow: 0 28px 90px rgba(34,211,238,.1);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.skill-header h3,
.project-card h3 {
    color: var(--text);
    font-size: 1.25rem;
}

.skill-percent {
    color: var(--accent);
    font-weight: 900;
}

.skill-bar {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148,163,184,.18);
}

.skill-progress {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 1.4s ease;
}

/* PROJECT */
.projects-page {
    padding: 72px 0;
}

.projects-hero {
    min-height: 260px;
    padding: 42px;
    margin-bottom: 34px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    border-radius: 32px;
    background:
        radial-gradient(circle at top right, rgba(34,211,238,.2), transparent 35%),
        radial-gradient(circle at bottom left, rgba(139,92,246,.18), transparent 35%),
        var(--surface);
}

.projects-hero h1 {
    margin: 12px 0;
    font-size: clamp(42px, 7vw, 78px);
    line-height: .95;
    letter-spacing: -3px;
    background: linear-gradient(135deg, #fff, var(--accent), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.projects-hero p,
.project-card p,
.featured-project p,
.project-section p {
    color: var(--muted);
    line-height: 1.8;
}

.project-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 22px;
    margin-bottom: 32px;
}

.project-search-form input,
.project-search-form select,
.form-group input,
.form-group textarea {
    flex: 1;
    min-width: 220px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(2, 6, 23, .55);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.project-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.project-thumbnail {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.project-badge {
    width: fit-content;
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--accent);
    background: rgba(34,211,238,.12);
    border: 1px solid rgba(34,211,238,.3);
    font-weight: 800;
}

.project-badge.success {
    color: #6ee7b7;
    background: rgba(16,185,129,.14);
    border-color: rgba(16,185,129,.34);
}

.featured-project {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px;
    align-items: center;
    padding: 34px;
    margin-bottom: 34px;
}

.project-more {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
}

/* DETAIL PROJECT */
.project-detail-wrapper {
    padding: 60px 0;
}

.project-detail-card {
    padding: 32px;
    overflow: hidden;
}

.project-detail-header {
    margin-bottom: 32px;
}

.project-detail-header span {
    color: var(--accent);
    font-weight: 800;
}

.project-detail-header h2 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    color: var(--text);
    margin: 8px 0;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.project-section {
    margin-top: 28px;
}

.project-section h3 {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 1.5rem;
}

.stack-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.stack-list span {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text);
    background: rgba(30,41,59,.88);
    border: 1px solid var(--border);
}

.diagram-frame {
    padding: 20px;
    overflow-x: auto;
    border-radius: 18px;
    color: var(--muted);
    background: rgba(2,6,23,.55);
    border: 1px solid var(--border);
}

.download-btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    padding: 13px 22px;
    border: none;
    border-radius: 14px;
    color: #020617;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    transition: .25s ease;
}

.btn-primary:hover,
.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(34,211,238,.25);
}

/* CONTACT */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 42px;
}

.contact-info,
.contact-form {
    padding: 36px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.form-group textarea {
    min-height: 140px;
    resize: vertical;
}

.alert {
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
}

.alert-success {
    color: #86efac;
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.3);
}

.empty-state {
    grid-column: 1 / -1;
    padding: 56px 30px;
    text-align: center;
    color: var(--muted);
    border-style: dashed;
}

/* FOOTER */
footer,
.footer {
    width: min(1200px, calc(100% - 48px));
    margin: 60px auto 32px;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    border-radius: 24px;
    background: rgba(2,6,23,.45);
    border: 1px solid var(--border);
}

/* =========================
   FINAL PREMIUM LIGHT MODE
   ========================= */

.theme-transition,
.theme-transition *{
    transition:
        background .3s ease,
        color .3s ease,
        border-color .3s ease,
        box-shadow .3s ease;
}

body.light-mode{
    --text:#08111f;
    --muted:#475569;
    --accent:#0284c7;
    --border:rgba(14,165,233,.18);

    background:
        radial-gradient(circle at 12% 8%, rgba(14,165,233,.28), transparent 34%),
        radial-gradient(circle at 88% 18%, rgba(124,58,237,.22), transparent 32%),
        radial-gradient(circle at 50% 95%, rgba(34,211,238,.22), transparent 35%),
        linear-gradient(
            135deg,
            #f8fbff 0%,
            #dbeafe 45%,
            #f5f3ff 100%
        ) !important;

    color:var(--text) !important;
}

body.light-mode::before{
    background-image:
        linear-gradient(rgba(14,165,233,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14,165,233,.08) 1px, transparent 1px);

    background-size:42px 42px;

    opacity:.9;
}

/* GLASS EFFECT */

body.light-mode .site-header,
body.light-mode footer,
body.light-mode .glassmorphism,
body.light-mode .profile-card,
body.light-mode .about-card,
body.light-mode .skill-card,
body.light-mode .contact-info,
body.light-mode .contact-form,
body.light-mode .empty-state,
body.light-mode .project-card,
body.light-mode .featured-project,
body.light-mode .project-search-form,
body.light-mode .project-detail-card{
    background:
        linear-gradient(
            135deg,
            rgba(255,255,255,.76),
            rgba(255,255,255,.48)
        ) !important;

    border:1px solid rgba(255,255,255,.72) !important;

    backdrop-filter:
        blur(22px)
        saturate(160%) !important;

    box-shadow:
        0 22px 70px rgba(14,165,233,.14),
        0 10px 28px rgba(15,23,42,.08),
        inset 0 1px 0 rgba(255,255,255,.85) !important;
}

/* CONTACT CARD */

body.light-mode .contact-item,
body.light-mode .info-item{
    background:
        linear-gradient(
            135deg,
            rgba(255,255,255,.88),
            rgba(219,234,254,.62)
        ) !important;

    border:1px solid rgba(14,165,233,.18) !important;

    box-shadow:
        0 12px 36px rgba(14,165,233,.12),
        inset 0 1px 0 rgba(255,255,255,.85) !important;
}

body.light-mode .contact-item strong,
body.light-mode .info-item strong{
    color:#08111f !important;
}

/* TEXT */

body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4{
    color:#08111f !important;
}

body.light-mode p,
body.light-mode small,
body.light-mode .hero-description,
body.light-mode .project-card p,
body.light-mode .featured-project p,
body.light-mode .project-section p{
    color:#475569 !important;
}

/* TITLE GRADIENT */

body.light-mode .site-brand,
body.light-mode .hero-title,
body.light-mode .section-header h2,
body.light-mode .projects-hero h1{
    background:
        linear-gradient(
            135deg,
            #020617,
            #0284c7,
            #7c3aed
        ) !important;

    -webkit-background-clip:text !important;
    -webkit-text-fill-color:transparent !important;
}

/* NAVBAR */

body.light-mode .site-nav a{
    color:#334155 !important;
}

body.light-mode .site-nav a:hover{
    color:#0284c7 !important;

    background:
        rgba(14,165,233,.12) !important;
}

/* FORM */

body.light-mode input,
body.light-mode select,
body.light-mode textarea{
    background:
        rgba(255,255,255,.78) !important;

    color:#0f172a !important;

    border-color:
        rgba(14,165,233,.22) !important;
}

/* TOGGLE */

body.light-mode .theme-toggle{
    background:
        linear-gradient(
            135deg,
            #ffffff,
            #dbeafe
        ) !important;

    color:#0284c7 !important;

    border:
        1px solid rgba(14,165,233,.28) !important;
}

/* BUTTON */

body.light-mode .btn-primary,
body.light-mode .download-btn{
    color:#ffffff !important;

    background:
        linear-gradient(
            135deg,
            #0284c7,
            #2563eb,
            #7c3aed
        ) !important;

    box-shadow:
        0 16px 38px rgba(37,99,235,.25),
        inset 0 1px 0 rgba(255,255,255,.32) !important;
}