:root {
    --bg: #0e0b1a;
    --bg-soft: rgba(139, 92, 246, 0.06);

    --card: rgba(139, 92, 246, 0.08);
    --card-strong: rgba(139, 92, 246, 0.13);
    --card-border: rgba(167, 139, 250, 0.18);

    --text: #f5f3ff;
    --text-muted: #c4b5fd;

    --primary: #a78bfa;
    --primary-strong: #7c3aed;

    --secondary: rgba(139, 92, 246, 0.14);

    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.28);

    --radius-xl: 28px;
    --radius-lg: 20px;

    --container: 1120px;
}

body.light-mode {
    --bg: #faf8ff;
    --bg-soft: rgba(255, 255, 255, 0.96);

    --card: rgba(255, 255, 255, 0.90);
    --card-strong: rgba(255, 255, 255, 0.98);
    --card-border: rgba(124, 58, 237, 0.12);

    --text: #1e1b4b;
    --text-muted: #7c3aed;

    --primary: #7c3aed;
    --primary-strong: #5b21b6;

    --secondary: #ede9fe;

    --shadow: 0 18px 40px rgba(109, 40, 217, 0.14);
    --shadow-soft: 0 10px 24px rgba(109, 40, 217, 0.09);
}

/* Custom scrollbar — global */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, 0.55); }
* { scrollbar-width: thin; scrollbar-color: rgba(167, 139, 250, 0.3) transparent; }

/* Select / dropdown — fix dark mode native rendering */

select {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--secondary);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 8px 32px 8px 12px;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a78bfa' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    transition: border-color 0.18s, box-shadow 0.18s;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
}

select:hover { border-color: var(--primary); }

select option {
    background-color: #1a1330;
    color: #f5f3ff;
}

body.light-mode select option {
    background-color: #faf8ff;
    color: #1e1b4b;
}

/* Base */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
    background: #0e0b1a;
}

body {
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at 15% 0%, rgba(139, 92, 246, 0.22), transparent 38%),
        radial-gradient(circle at 85% 5%, rgba(217, 70, 239, 0.14), transparent 32%),
        radial-gradient(circle at 50% 90%, rgba(124, 58, 237, 0.10), transparent 40%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
    animation: pageFade 0.65s ease;
}

body.light-mode {
    background:
        radial-gradient(circle at 15% 0%, rgba(167, 139, 250, 0.12), transparent 40%),
        radial-gradient(circle at 88% 8%, rgba(217, 70, 239, 0.07), transparent 35%),
        var(--bg);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(20px);
    background: rgba(14, 11, 26, 0.55);
    border-bottom: 1px solid rgba(167, 139, 250, 0.10);
    animation: slideDown 0.55s ease;
}

body.light-mode .site-header {
    background: rgba(250, 248, 255, 0.82);
    border-bottom: 1px solid rgba(124, 58, 237, 0.10);
}

.header-inner {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.brand-logo {
    height: 34px;
    width: auto;
}

.brand-logo-light {
    display: none;
}

body.light-mode .brand-logo-dark {
    display: none;
}

body.light-mode .brand-logo-light {
    display: block;
}

/* Header icon buttons (login / logout) */

.header-icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--text-muted);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform 0.22s ease,
        color 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.22s ease;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    text-decoration: none;
}

.header-icon-btn:hover {
    transform: translateY(-2px);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.20);
}

/* Theme Switch */

.theme-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--text);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.22s ease;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    flex-shrink: 0;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.20);
}

.theme-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    transition: opacity 0.28s ease, transform 0.28s ease;
    color: var(--text);
}

.theme-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.sun-icon {
    opacity: 0;
    transform: translateY(8px) scale(0.8) rotate(-20deg);
}

.moon-icon {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
}

body.light-mode .sun-icon {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
}

body.light-mode .moon-icon {
    opacity: 0;
    transform: translateY(-8px) scale(0.8) rotate(20deg);
}

/* Hero */

.hero {
    padding: 34px 0 34px;
}

.hero-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    border-radius: 30px;
    padding: 26px 22px 30px;
    border: 1px solid var(--card-border);
    background: linear-gradient(180deg, var(--bg-soft), var(--card));
    box-shadow: var(--shadow);
    isolation: isolate;
    animation: fadeUp 0.7s ease both;
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(167, 139, 250, 0.30),
        transparent 40%,
        rgba(217, 70, 239, 0.14)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.hero-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(28px);
    z-index: 0;
    pointer-events: none;
}

.hero-orb-1 {
    width: 240px;
    height: 240px;
    top: -80px;
    left: -60px;
    background: rgba(139, 92, 246, 0.24);
    animation: breatheOrb 7s ease-in-out infinite;
}

.hero-orb-2 {
    width: 200px;
    height: 200px;
    right: -50px;
    bottom: -50px;
    background: rgba(217, 70, 239, 0.18);
    animation: breatheOrb 9s ease-in-out infinite reverse;
}

.hero-image-stage,
.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-image-stage {
    width: min(100%, 880px);
    margin: 0 auto 26px;
    display: grid;
    place-items: center;
    min-height: 300px;
    animation: floatSoft 6s ease-in-out infinite;
}

.hero-image {
    position: relative;
    z-index: 1;
    display: block;
    width: min(100%, 820px);
    max-height: 500px;
    object-fit: contain;
    object-position: center bottom;
    filter:
        drop-shadow(0 22px 42px rgba(0, 0, 0, 0.22))
        drop-shadow(0 10px 20px rgba(79, 111, 255, 0.16));
}

.hero-copy {
    max-width: 680px;
    margin: 0 auto;
}

.hero-copy h1 {
    margin: 0 0 14px;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.hero-text {
    margin: 0 auto;
    max-width: 700px;
    font-size: 1.06rem;
    line-height: 1.85;
    color: var(--text-muted);
}

/* Projects */

.projects {
    padding: 24px 0 60px;
}

.section-heading {
    margin-bottom: 20px;
    animation: fadeUp 0.8s ease both;
}

.section-heading h2 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.section-heading p {
    margin: 0;
    color: var(--text-muted);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.project-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-soft), var(--card));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
    animation: fadeUp 0.9s ease both;
    isolation: isolate;
    min-height: 100%;
}

.project-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(167, 139, 250, 0.22),
        transparent 42%,
        rgba(217, 70, 239, 0.10)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.project-card:hover::after {
    background: linear-gradient(
        135deg,
        rgba(167, 139, 250, 0.55),
        rgba(217, 70, 239, 0.25) 50%,
        rgba(167, 139, 250, 0.35)
    );
}

.project-card-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    right: -80px;
    top: -80px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.28), transparent 65%);
    filter: blur(22px);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-card-glow {
    opacity: 1.4;
}

.project-card:hover {
    transform: translateY(-7px);
    box-shadow:
        0 28px 52px rgba(0, 0, 0, 0.30),
        0 0 28px rgba(167, 139, 250, 0.18);
}

.project-top,
.project-actions {
    position: relative;
    z-index: 1;
}

.project-top {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.project-logo-wrap {
    width: 78px;
    height: 78px;
    border-radius: 22px;
    background: var(--card-strong);
    border: 1px solid var(--card-border);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.project-card:hover .project-logo-wrap {
    transform: scale(1.04);
    box-shadow:
        0 10px 22px rgba(79, 111, 255, 0.10),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

.project-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.project-info h3 {
    margin: 0 0 8px;
    font-size: 1.18rem;
}

.project-info p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.68;
}

.project-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    min-width: 120px;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 700;
    text-align: center;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.32);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
}

.btn-primary:hover::before {
    left: 160%;
}

.btn-primary:hover {
    box-shadow: 0 16px 36px rgba(124, 58, 237, 0.45);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
    border-color: var(--card-border);
}

/* Footer - Simple Premium */

.site-footer {
    margin-top: auto;
    padding: 10px 0 5px;
}

.footer-simple {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 48px;
    /*border-radius: 18px;*/
    /*border: 1px solid var(--card-border);
    background: linear-gradient(180deg, var(--bg-soft), var(--card));*/
    /*box-shadow: var(--shadow-soft);*/
    font-size: 0.92rem;
    color: var(--text-muted);
    overflow: hidden;
}

/*.footer-simple::before {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    right: -40px;
    bottom: -50px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(124,156,255,0.14), transparent 70%);
    filter: blur(20px);
    pointer-events: none;
}*/

.footer-powered,
.footer-since,
.footer-divider {
    position: relative;
    z-index: 1;
}

.footer-powered strong {
    color: var(--text);
    font-weight: 700;
}

.footer-divider {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0.6;
}

/* Error pages (404, 403, ...) */

.error-page {
    padding: 40px 0 60px;
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
}

.error-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    border-radius: 30px;
    padding: 56px 32px 52px;
    border: 1px solid var(--card-border);
    background: linear-gradient(180deg, var(--bg-soft), var(--card));
    box-shadow: var(--shadow);
    isolation: isolate;
    animation: fadeUp 0.7s ease both;
    max-width: 560px;
    margin: 0 auto;
}

.error-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(167,139,250,0.30), transparent 40%, rgba(217,70,239,0.14));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.error-body {
    position: relative;
    z-index: 1;
}

.error-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: var(--card-strong);
    border: 1px solid var(--card-border);
    display: grid;
    place-items: center;
    margin: 0 auto 28px;
    color: var(--primary);
}

.error-icon svg {
    width: 36px;
    height: 36px;
}

.error-code {
    margin: 0 0 8px;
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.error-title {
    margin: 0 0 12px;
    font-size: 1.4rem;
    font-weight: 700;
}

.error-text {
    margin: 0 auto 32px;
    max-width: 380px;
    color: var(--text-muted);
    line-height: 1.7;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Animations */

@keyframes pageFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatSoft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes breatheOrb {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.18);
        opacity: 0.75;
    }
}

/* Card stagger entrance */

.card-grid > *:nth-child(1) { animation-delay: 0.05s; }
.card-grid > *:nth-child(2) { animation-delay: 0.15s; }
.card-grid > *:nth-child(3) { animation-delay: 0.25s; }
.card-grid > *:nth-child(4) { animation-delay: 0.35s; }

/* Responsive */

@media (max-width: 860px) {
    .hero {
        padding: 26px 0 28px;
    }

    .hero-card {
        padding: 20px 16px 24px;
        border-radius: 24px;
    }

    .hero-image-stage {
        margin-bottom: 18px;
        min-height: 220px;
        width: 100%;
    }

    .hero-image {
        max-height: 340px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-inner {
        min-height: 56px;
        padding: 10px 0;
    }

    .brand-logo {
        height: 30px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .theme-icon,
    .theme-icon svg {
        width: 18px;
        height: 18px;
    }

    .hero {
        padding-top: 20px;
    }

    .hero-card {
        padding: 16px 14px 22px;
        border-radius: 20px;
    }

    .hero-orb-1 {
        width: 140px;
        height: 140px;
        top: -40px;
        left: -30px;
    }

    .hero-orb-2 {
        width: 120px;
        height: 120px;
        right: -20px;
        bottom: -20px;
    }

    .hero-image-stage {
        min-height: 180px;
        margin-bottom: 16px;
    }

    .hero-image {
        width: 100%;
        max-height: 250px;
    }

    .hero-copy h1 {
        font-size: 1.95rem;
        line-height: 1.06;
    }

    .hero-text {
        font-size: 1rem;
        line-height: 1.75;
    }

    .project-card {
        padding: 18px;
        border-radius: 20px;
    }

    .project-top {
        align-items: flex-start;
    }

    .project-logo-wrap {
        width: 72px;
        height: 72px;
        border-radius: 20px;
    }

    .project-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        min-width: unset;
    }

    .site-footer {
        padding: 8px 0 0;
    }

    .footer-simple {
        height: 44px;
        font-size: 0.88rem;
        border-radius: 16px;
        gap: 10px;
    }
}