/* ========================================
   MD SOFTWARE — Endgame
   ======================================== */

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

:root {
    --bg: #09090b;
    --surface: #111113;
    --border: #1e1e22;
    --border-hover: #2e2e33;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --accent: #e4e4e7;
    --radius: 10px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

body > *:not(#bg-canvas) {
    position: relative;
    z-index: 1;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

a { text-decoration: none; color: inherit; }

em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
}

/* ---- NAV ---- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 24px;
    transition: background 0.3s, backdrop-filter 0.3s;
}

.nav.scrolled {
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 14px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

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

.nav-cta {
    padding: 8px 18px;
    background: var(--text);
    color: var(--bg) !important;
    border-radius: 100px;
    font-weight: 500;
    font-size: 13px !important;
    transition: opacity 0.2s !important;
}

.nav-cta:hover {
    opacity: 0.85;
    color: var(--bg) !important;
}

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

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.3s var(--ease), opacity 0.2s;
}

/* ---- HERO ---- */
.hero {
    position: relative;
    padding: 180px 0 140px;
    overflow: hidden;
}

.hero-badge {
    display: inline-block;
    font-size: 13px;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    margin-bottom: 28px;
}

.hero-title {
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.035em;
    margin-bottom: 28px;
    color: var(--text);
}

.hero-title em {
    color: var(--text-secondary);
}

.hero-sub {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-tertiary);
    max-width: 520px;
    margin-bottom: 44px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--text);
    color: var(--bg);
    font-size: 14px;
    font-weight: 500;
    border-radius: 100px;
    transition: opacity 0.2s;
}

.btn-pill:hover { opacity: 0.85; }

.btn-ghost {
    font-size: 14px;
    color: var(--text-tertiary);
    font-weight: 500;
    transition: color 0.2s;
}

.btn-ghost:hover { color: var(--text); }

.hero-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
}

/* ---- WORK ---- */
.work {
    padding: 80px 0 120px;
}

.section-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 48px;
}

.work-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
    padding: 36px 0;
    border-top: 1px solid var(--border);
    transition: border-color 0.3s;
    cursor: pointer;
}

.work-item:last-child {
    border-bottom: 1px solid var(--border);
}

.work-item:hover {
    border-color: var(--border-hover);
}

.work-item:hover + .work-item {
    border-top-color: var(--border-hover);
}

.work-item:hover .work-item-name {
    color: var(--text);
}

.work-item:hover .work-item-arrow {
    opacity: 1;
    transform: translateX(0);
}

.work-item-info {
    flex: 1;
}

.work-item-name {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: color 0.3s;
}

.work-item-desc {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-tertiary);
    max-width: 520px;
    margin-bottom: 16px;
}

.work-item-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.work-item-tags span {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 100px;
    background: var(--surface);
    color: var(--text-tertiary);
    border: 1px solid var(--border);
}

.work-item-arrow {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.35s var(--ease);
    margin-top: 6px;
}

/* ---- ABOUT ---- */
.about {
    padding: 120px 0;
    border-top: 1px solid var(--border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
}

.about-title {
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.about-title em {
    color: var(--text-secondary);
}

.about-body p {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.about-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.stat-val {
    display: block;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 4px;
}

.stat-lbl {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ---- CONTACT ---- */
.contact {
    padding: 120px 0;
    border-top: 1px solid var(--border);
}

.contact-inner {
    max-width: 560px;
}

.contact-title {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.contact-sub {
    font-size: 16px;
    color: var(--text-tertiary);
    margin-bottom: 48px;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.contact-method {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    transition: border-color 0.2s;
}

.contact-method:last-child {
    border-bottom: 1px solid var(--border);
}

.contact-method:hover {
    border-color: var(--border-hover);
}

.contact-method-label {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    flex-shrink: 0;
    width: 100px;
}

.contact-method-value {
    font-size: 15px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

a.contact-method:hover .contact-method-value {
    color: var(--text);
}

/* ---- FOOTER ---- */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copy {
    font-size: 13px;
    color: var(--text-tertiary);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

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

/* ---- FADE IN SYSTEM ---- */
[data-fade] {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

[data-fade="up"] { transform: translateY(24px); }
[data-fade="down"] { transform: translateY(-24px); }
[data-fade="left"] { transform: translateX(24px); }
[data-fade="right"] { transform: translateX(-24px); }
[data-fade="scale"] { transform: scale(0.96); }
[data-fade="in"] { transform: none; }

[data-fade].is-visible {
    opacity: 1;
    transform: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .hero {
        padding: 140px 0 100px;
    }

    .hero-title {
        font-size: clamp(32px, 8vw, 48px);
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .nav-links {
        position: fixed;
        inset: 0;
        background: var(--bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 28px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .nav-links.open {
        opacity: 1;
        pointer-events: all;
    }

    .nav-links a {
        font-size: 18px;
    }

    .nav-cta {
        font-size: 16px !important;
        padding: 12px 28px;
    }

    .nav-toggle {
        display: flex;
        z-index: 101;
    }

    .nav-toggle.open span:first-child {
        transform: rotate(45deg) translate(3px, 3px);
    }

    .nav-toggle.open span:last-child {
        transform: rotate(-45deg) translate(3px, -3px);
    }

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

    .about-stats {
        flex-direction: column;
        gap: 24px;
    }

    .work-item {
        padding: 28px 0;
    }

    .work-item-name {
        font-size: 22px;
    }

    .work-item-arrow {
        display: none;
    }

    .footer-inner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .contact-method {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
