/* ==========================================
   GOOGLE FONTS
========================================== */
@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&display=swap");

/* ==========================================
   RESET & ROOT
========================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root {
    --bg: #020617;
    --bg2: #0f172a;
    --bg3: #1e293b;
    --primary: #3b82f6;
    --secondary: #8b5cf6;
    --cyan: #06b6d4;
    --white: #ffffff;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --glass: rgba(255, 255, 255, .06);
    --glass-border: rgba(255, 255, 255, .08);
    --radius: 24px;
    --transition: .35s ease;
    --shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

/* ==========================================
   BODY
========================================== */
body {
    font-family: 'Comfortaa', sans-serif;
    color: var(--text);
    line-height: 1.8;
    overflow-x: hidden;
    background:
            radial-gradient(circle at 10% 20%, rgba(59, 130, 246, .25), transparent 30%),
            radial-gradient(circle at 90% 10%, rgba(139, 92, 246, .30), transparent 30%),
            radial-gradient(circle at 50% 90%, rgba(6, 182, 212, .18), transparent 30%),
            linear-gradient(135deg, var(--bg), var(--bg2), var(--bg3));
    background-attachment: fixed;
}

/* ==========================================
   SCROLLBAR & SELECTION
========================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    border-radius: 20px;
    background: linear-gradient(var(--primary), var(--secondary));
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--secondary), var(--cyan));
}

::selection {
    background: rgba(96, 165, 250, .35);
    color: var(--white);
}

/* ==========================================
   HEADER & HERO ELEMENTS
========================================== */
header {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    padding: 120px 24px 60px 24px; /* Balanced paddings for top logo/nav spacing */
    position: relative;
    overflow: hidden;
}

header.scrolled .hero-tag {
    background: rgba(255, 255, 255, .12);
}

/* FIX: Prevent background glows from swallowing button clicks */
header::before,
header::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 1;
}

header::before {
    width: min(700px, 90vw);
    height: min(700px, 90vw);
    right: -250px;
    top: -250px;
    background: radial-gradient(circle, rgba(139, 92, 246, .35), transparent 70%);
    animation: floatGlow 10s ease-in-out infinite;
}

header::after {
    width: min(650px, 85vw);
    height: min(650px, 85vw);
    left: -220px;
    bottom: -220px;
    background: radial-gradient(circle, rgba(59, 130, 246, .35), transparent 70%);
    animation: floatGlow 12s ease-in-out infinite;
}

.logo {
    position: fixed;
    left: 30px;
    top: 25px;
    z-index: 1000;
}

.logo img {
    width: 145px;
}

.logo img:hover {
    transform: scale(1.05);
}

.hero-tag {
    position: absolute;
    right: 40px;
    top: 35px;
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    color: var(--white);
    font-size: .82rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 10;
}

header h1 {
    position: relative;
    z-index: 10;
    font-size: clamp(2.5rem, 7vw, 7rem); /* Safer minimum size for small mobiles */
    line-height: 1.1;
    letter-spacing: -2px;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(90deg, white, #60a5fa, #a78bfa, white);
    background-size: 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 8s infinite, floatText 6s ease-in-out infinite;
}

header p {
    max-width: 760px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: rgba(255, 255, 255, .82);
    margin-bottom: 45px;
    position: relative;
    z-index: 10;
}

/* ==========================================
   NAVIGATION
========================================== */
nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 12px 35px rgba(0, 0, 0, .25);
}

nav a {
    color: var(--white);
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600;
    transition: all .3s ease;
}

nav a:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    transform: translateY(-3px);
}

/* ==========================================
   HERO BUTTONS
========================================== */
.hero-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 20; /* Brought forward to ensure they capture clicks */
    width: 100%;
    max-width: 500px; /* Prevents full-width stretch on desktop desktops */
}

.primary-btn,
.secondary-btn,
header button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition);
    cursor: pointer;
}

.primary-btn {
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--cyan));
    background-size: 250%;
    box-shadow: 0 20px 45px rgba(59, 130, 246, .30);
    border: none;
}

.primary-btn:hover {
    background-position: right;
    transform: translateY(-5px);
    box-shadow: 0 25px 55px rgba(59, 130, 246, .45);
}

.secondary-btn {
    color: var(--white);
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(20px);
}

.secondary-btn:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, .08);
}

/* ==========================================
   MAIN & CARDS
========================================== */
main {
    width: min(1200px, 92%);
    margin: auto;
    padding: 80px 0;
}

section {
    margin-bottom: 70px;
}

.section-card {
    background: rgba(15, 23, 42, .65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 28px;
    padding: 45px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
    transition: all var(--transition);
}

.section-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 25px 60px rgba(37, 99, 235, .25), 0 0 35px rgba(124, 58, 237, .18);
}

.section-card h2 {
    font-size: 2.2rem;
    margin-bottom: 25px;
    color: var(--white);
    position: relative;
}

.section-card h2::after {
    content: "";
    display: block;
    width: 90px;
    height: 4px;
    margin-top: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.section-card p {
    color: rgba(255, 255, 255, .78);
    font-size: 1rem;
    line-height: 1.9;
}

.section-card ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.section-card li {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    padding: 22px;
    color: var(--white);
    transition: var(--transition);
}

.section-card li:hover {
    transform: translateY(-8px);
    background: rgba(96, 165, 250, .12);
    border-color: rgba(96, 165, 250, .30);
}

/* ==========================================
   PROJECTS
========================================== */
#projects {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#projects .section-card-list-item {
    animation: fadeUp .8s ease both;
}

article {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 22px;
    padding: 30px;
    transition: all var(--transition);
}

article::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(var(--primary), var(--secondary));
}

article:hover {
    transform: translateY(-8px);
    border-color: rgba(96, 165, 250, .35);
    background: rgba(255, 255, 255, .06);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .30);
}

article h3 {
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 15px;
}

article p {
    color: rgba(255, 255, 255, .75);
    line-height: 1.8;
}

#projects > a {
    align-self: flex-start;
    margin-top: 30px;
    padding: 16px 34px;
    border-radius: 14px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
    background-size: 250% 250%;
    box-shadow: 0 12px 35px rgba(59, 130, 246, .35);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#projects a:hover {
    background-position: right center;
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 18px 45px rgba(59, 130, 246, .45);
}

#projects a:active {
    transform: translateY(-2px) scale(.98);
}

#projects a::after {
    content: "→";
    margin-left: 10px;
    transition: transform .3s ease;
}

#projects a:hover::after {
    transform: translateX(6px);
}

/* ==========================================
   FORMS & LABELS
========================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .9);
}

input,
textarea,
select {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    color: var(--white);
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    transition: all .3s ease;
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 180px;
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, .45);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 20px rgba(59, 130, 246, .20);
}

select {
    padding-right: 55px;
    font-weight: 500;
    background-color: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 18px;
}

select:hover {
    border-color: rgba(96, 165, 250, .5);
    background-color: rgba(255, 255, 255, .08);
    box-shadow: 0 10px 30px rgba(59, 130, 246, .12);
}

select:focus {
    border-color: #60a5fa;
    background-color: rgba(255, 255, 255, .10);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, .18), 0 12px 30px rgba(0, 0, 0, .25);
}

select:active {
    transform: scale(.99);
}

select:disabled {
    opacity: .6;
    cursor: not-allowed;
}

select option {
    background: #0f172a;
    padding: 12px;
}

fieldset {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    padding: 20px;
}

legend {
    color: var(--white);
    padding: 0 10px;
    font-weight: 600;
}

fieldset input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
    margin: 0;
}

fieldset label {
    color: var(--white);
    cursor: pointer;
    margin-right: 30px;
}

.checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 18px 0;
    color: rgba(255, 255, 255, .9);
    cursor: pointer;
    line-height: 1.6;
}

.checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-option span {
    flex: 1;
}

form button {
    align-self: flex-start;
    padding: 16px 36px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--cyan));
    background-size: 250%;
    transition: var(--transition);
    box-shadow: 0 20px 45px rgba(37, 99, 235, .30);
}

form button:hover {
    background-position: right;
    transform: translateY(-4px);
    box-shadow: 0 25px 55px rgba(37, 99, 235, .45);
}

/* ==========================================
   FOOTER & MEDIA
========================================== */
footer {
    margin-top: 100px;
    padding: 50px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .02);
    backdrop-filter: blur(20px);
}

footer p {
    color: rgba(255, 255, 255, .60);
    font-size: .95rem;
}

img {
    max-width: 100%;
    display: block;
    transition: var(--transition);
}

/* ==========================================
   PERFORMANCE & UTILITIES
========================================== */
form button,
.primary-btn,
.secondary-btn,
.section-card,
article {
    will-change: transform;
    backface-visibility: hidden;
}

.fade-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity .8s ease, transform .8s ease;
}

.fade-up.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   RESPONSIVE DESIGN
========================================== */
@media (max-width: 1024px) {
    header h1 { font-size: 4rem; }
    header p { max-width: 650px; font-size: 1.1rem; }
    main { padding: 0 25px; }
}

@media (max-width: 768px) {
    .logo { position: absolute; left: 18px; top: 18px; }
    .logo img { width: 110px; }

    .hero-tag {
        position: static;
        margin-bottom: 20px;
        font-size: .75rem;
        display: inline-block;
    }

    header {
        padding: 100px 20px 140px 20px;
    }
    header h1 { font-size: 3rem; letter-spacing: -1px; }
    header p { font-size: 1rem; margin-bottom: 30px; }

    /* FIX: Force flex-direction to column so the buttons clean-stack instead of overlapping or breaking */
    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }

    .primary-btn,
    .secondary-btn,
    form button {
        width: 100%;
        text-align: center;
    }

    /* SHIFTED NAV BOTTOM FIX */
    nav {
        top: auto;
        bottom: 20px;
        left: 15px;
        right: 15px;
        transform: none;
        border-radius: 24px;
        flex-direction: row;
        width: calc(100% - 30px);
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        padding: 8px 12px;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 -12px 35px rgba(0, 0, 0, .35);
    }

    nav a {
        width: auto;
        text-align: center;
        padding: 10px 18px;
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    .section-card { padding: 28px; }
    #services ul, .section-card ul { grid-template-columns: 1fr; }
    fieldset label { display: flex; margin-bottom: 15px; }
}

@media (max-width: 480px) {
    header h1 { font-size: 2.4rem; }
    header p { font-size: .95rem; }
    .section-card, article { padding: 22px; }
}

/* ==========================================
   ACCESSIBILITY & ANIMATIONS
========================================== */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

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

@keyframes floatGlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(35px); }
}

@keyframes floatText {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes particleMove {
    from { transform: translateY(100vh); }
    to { transform: translateY(-120px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}