:root {
    --bg:        #0d1117;
    --bg-card:   #161b22;
    --bg-hover:  #1c2128;
    --border:    #30363d;
    --accent:    #58a6ff;
    --accent-2:  #a371f7;
    --text:      #e6edf3;
    --muted:     #8b949e;
    --gradient:  linear-gradient(135deg, #58a6ff 0%, #a371f7 100%);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ─── NAV ─────────────────────────────────── */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(13, 17, 23, 0.80);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, background-color 0.2s;
}
a.nav-logo:hover {
    border-color: var(--accent);
    background-color: rgba(88, 166, 255, 0.08);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    position: relative;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    padding-bottom: 3px;
    transition: color 0.25s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--gradient);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover {
    color: var(--text);
}

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

/* ─── LAYOUT ──────────────────────────────── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 2rem;
}

section { padding: 96px 0; }

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 1rem;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 40px; height: 3px;
    background: var(--gradient);
    border-radius: 2px;
}

/* ─── HERO ────────────────────────────────── */
#hero {
    padding-top: 160px;
    padding-bottom: 120px;
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    top: -200px; right: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(88,166,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.25);
    color: var(--accent);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1.75rem;
}

.hero-title {
    font-size: clamp(2.2rem, 5.5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}
.hero-title .gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 520px;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ─── BUTTONS ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
    border: none;
    font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 20px rgba(88,166,255,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(88,166,255,0.4); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ─── STACK ───────────────────────────────── */
#stack { padding-top: 0; }

.stack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
}
.badge:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

/* ─── SERVICES ────────────────────────────── */
#services { background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.service-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}
.service-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.service-icon {
    font-size: 2rem;
    margin-bottom: 1.1rem;
    display: block;
}

.service-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.service-card p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.65;
}

/* ─── PORTFOLIO ───────────────────────────── */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.project-thumb {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    position: relative;
    overflow: hidden;
}

.project-thumb.t1 { background: linear-gradient(135deg, #1a2744, #0d2137); }
.project-thumb.t2 { background: linear-gradient(135deg, #1e1a2e, #2a1a3e); }
.project-thumb.t3 { background: linear-gradient(135deg, #132118, #1a2e1a); }
.project-thumb.t4 { background: linear-gradient(135deg, #2a1a1a, #3a2020); }
.project-thumb.t5 { background: linear-gradient(135deg, #1a2020, #0d2020); }

.project-body { padding: 1.25rem; }

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}
.tag {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent);
    padding: 0.15rem 0.55rem;
    border-radius: 5px;
    font-size: 0.725rem;
    font-weight: 500;
}
.tag.purple {
    background: rgba(163, 113, 247, 0.1);
    color: var(--accent-2);
}

.project-body h3 {
    font-size: 0.975rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.project-body p {
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ─── CONTACT ─────────────────────────────── */
#contact { padding-bottom: 120px; }

.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 3rem;
    align-items: start;
}

.contact-info .section-title {
    margin-bottom: 1.25rem;
}

.contact-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.contact-info p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}
.contact-link:hover { color: var(--accent); }

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
}

.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.45rem;
    letter-spacing: 0.02em;
}

input, select, textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

input::placeholder, textarea::placeholder { color: #484f58; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

select {
    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='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}
select option { background: #161b22; }

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

.btn-submit {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 0.95rem;
}

.form-status {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    text-align: center;
    min-height: 1.2em;
}
.form-status--ok  { color: #3fb950; }
.form-status--err { color: #f85149; }

/* ─── PROJECT PAGE ───────────────────────── */
.project-page {
    padding-top: 96px;
    padding-bottom: 96px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.825rem;
    color: var(--muted);
    margin-bottom: 2rem;
}
.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }

.project-header {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}
.project-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 1rem 0 0.875rem;
}
.project-lead {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 680px;
    line-height: 1.75;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.75rem;
}
.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.meta-label {
    font-size: 0.725rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.meta-value {
    font-size: 0.9rem;
    font-weight: 500;
}

.project-section { margin-bottom: 3rem; }

.project-section h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 1rem;
}
.project-section p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
    max-width: 720px;
}
.project-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 720px;
}
.project-section li {
    font-size: 0.95rem;
    color: var(--text);
    padding-left: 1.25rem;
    position: relative;
    line-height: 1.6;
}
.project-section li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.screenshot {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    border: 2px dashed var(--border);
    background: var(--bg-card);
    object-fit: cover;
    display: block;
    transition: border-color 0.2s;
}
.screenshot:hover { border-color: var(--accent); }
.screenshot-caption {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}

.screenshots-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}
.gallery-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.gallery-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: top;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: border-color 0.2s, transform 0.2s;
    display: block;
}
.gallery-item img:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}
.gallery-caption {
    font-size: 0.775rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.4;
}

.project-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* ─── LIGHTBOX ───────────────────────────── */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.lightbox-overlay.active { display: flex; }

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
    padding: 0.25rem;
}
.lightbox-close:hover { opacity: 1; }

.gallery-item img  { cursor: zoom-in; }
.screenshot        { cursor: zoom-in; }

/* ─── FOOTER ──────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: 1.75rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.825rem;
}

/* ─── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
    nav { padding: 0 1.25rem; }
    .nav-links { display: none; }

    .container { padding: 0 1.25rem; }
    section { padding: 64px 0; }

    .hero-title { font-size: 2.2rem; }

    .contact-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .form-card { padding: 1.5rem; }
}

@media (max-width: 480px) {
    .hero-actions { flex-direction: column; }
    .btn { justify-content: center; }
}