/* ================================================
   Portfolio — Bayu Sanjani
   ================================================ */

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

:root {
    --dark: #1a1a2e;
    --darker: #0f0f1e;
    --accent: #667eea;
    --accent-light: #8a9af0;
    --light: #f8f9fa;
    --gray: #666;
    --gray-light: #999;
    --section-alt: #ffffff;
    --border: #e5e7eb;
}

html {
    scroll-behavior: smooth;
    /* offset for sticky navbar when jumping to anchors */
    scroll-padding-top: 72px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--dark);
    line-height: 1.7;
    background: var(--light);
}

/* ================================================
   Navbar
   ================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 6%;
    background: rgba(15, 15, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: padding 0.2s ease, background 0.2s ease;
}

/* shrink a bit when scrolled (toggled via JS) */
.navbar.scrolled {
    padding: 12px 6%;
    background: rgba(15, 15, 30, 0.95);
}

.nav-logo {
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

/* underline effect on hover */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* hamburger -> X */
.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu {
    display: flex;
    flex-direction: column;
    background: var(--darker);
    padding: 14px 6%;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.mobile-menu a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 12px 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

/* ================================================
   Hero — animated gradient background
   ================================================ */
.hero {
    background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #1a1a4e);
    background-size: 400% 400%;
    animation: gradientShift 14s ease infinite;
    color: #fff;
    padding: 110px 20px 100px;
    text-align: center;
}

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

.hero-content {
    max-width: 700px;
    margin: 0 auto;
    /* fade + slide in on load */
    animation: fadeUp 1s ease 0.2s both;
}

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

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.tagline {
    font-size: 1.3rem;
    color: var(--accent-light);
    font-weight: 600;
    margin-bottom: 18px;
}

.bio {
    font-size: 1.05rem;
    opacity: 0.85;
    margin-bottom: 25px;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.skills span {
    background: rgba(255,255,255,0.12);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.cta {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 13px 36px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.cta:hover {
    background: #5568d3;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

/* ================================================
   Projects
   ================================================ */
.projects {
    max-width: 1000px;
    margin: 0 auto;
    padding: 80px 20px;
    background: var(--section-alt);
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 45px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--accent);
    margin: 12px auto 0;
    border-radius: 3px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.project-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}

.project-thumb {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-emoji {
    font-size: 3.5rem;
}

.warm   { background: linear-gradient(135deg, #faf3e7, #f5e6d3); }
.indigo { background: linear-gradient(135deg, #667eea, #764ba2); }
.teal   { background: linear-gradient(135deg, #11998e, #38ef7d); }
.purple { background: linear-gradient(135deg, #8E2DE2, #4A00E0); }
.sky    { background: linear-gradient(135deg, #2980b9, #6dd5fa); }

.project-info {
    padding: 22px 24px 26px;
}

.project-info h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.project-info p {
    color: var(--gray);
    font-size: 0.92rem;
    margin-bottom: 14px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tags span {
    background: #eef0f5;
    color: #555;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* live demo + source links — appear on hover */
.card-links {
    display: flex;
    gap: 14px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.project-card:hover .card-links {
    opacity: 1;
    transform: translateY(0);
}

.card-links a {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1.5px solid transparent;
    transition: border-color 0.2s ease;
}

.card-links a:hover {
    border-color: var(--accent);
}

.card-links a:nth-child(2) {
    color: var(--gray);
}

.card-links a:nth-child(2):hover {
    border-color: var(--gray);
}

/* ================================================
   About
   ================================================ */
.about {
    background: var(--light);
    max-width: 1000px;
    margin: 0 auto;
    padding: 80px 20px;
}

.about-content {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 50px;
    align-items: start;
}

.about-text p {
    color: var(--gray);
    margin-bottom: 16px;
    font-size: 1rem;
}

.tools h3 {
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.tools ul {
    list-style: none;
}

.tools li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
    font-size: 0.95rem;
    position: relative;
    padding-left: 22px;
}

.tools li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.tools li:last-child {
    border-bottom: none;
}

/* ================================================
   Contact
   ================================================ */
.contact {
    background: var(--section-alt);
    max-width: 640px;
    margin: 0 auto;
    padding: 80px 20px;
}

.contact-intro {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
    margin-top: -25px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

.form-field input,
.form-field textarea {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--dark);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.contact-form .cta {
    align-self: flex-start;
    margin-top: 4px;
}

.form-status {
    font-size: 0.9rem;
    color: #15803d;
    font-weight: 600;
}

.form-status.error {
    color: #dc2626;
}

/* ================================================
   Footer
   ================================================ */
footer {
    background: var(--dark);
    color: #fff;
    text-align: center;
    padding: 36px 20px;
}

footer p {
    opacity: 0.75;
    font-size: 0.88rem;
}

/* ================================================
   Scroll-to-top button
   ================================================ */
.scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 90;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: #5568d3;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 700px) {
    .hero {
        padding: 80px 20px 70px;
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .tagline {
        font-size: 1.1rem;
    }

    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .project-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .scroll-top {
        bottom: 18px;
        right: 18px;
        width: 42px;
        height: 42px;
    }

    /* on touch devices always show card links since no hover */
    .card-links {
        opacity: 1;
        transform: none;
    }
}
