:root {
    --bg: #0a0b0d;
    --surface: #111317;
    --surface-2: #171a1f;
    --border: #1f232a;
    --border-hover: #2a2f38;
    --text: #e7e9ee;
    --text-dim: #8b919c;
    --text-mute: #8a8f99;
    --accent: #c6f24e;
    --accent-dim: #8aad2e;
    --danger: #ff5577;
    --r: 8px;
    --nav-h: 80px;
    --max: 1200px;
    --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 48px 48px;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
body::before {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.015;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--text); text-decoration: none; transition: color 160ms ease; }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 0.6em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.5rem, 5vw, 4.25rem); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: clamp(2rem, 3.5vw, 3rem); line-height: 1.1; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
::selection { background: var(--accent); color: #0a0b0d; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; width: 100%; }
.section { padding: clamp(5rem, 10vw, 8rem) 0; border-bottom: 1px solid var(--border); position: relative; z-index: 2; }
.section-sm { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.section:last-of-type { border-bottom: 0; }
.eyebrow {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.25rem;
    display: inline-block;
}
.eyebrow::before { content: "— "; color: var(--accent); }
.mono { font-family: var(--mono); }
.text-dim { color: var(--text-dim); }
.text-mute { color: var(--text-mute); }
.lead { font-size: 1.125rem; color: var(--text-dim); max-width: 56ch; line-height: 1.65; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 180ms ease;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    font-family: var(--sans);
}
.btn-primary { background: var(--accent); color: #0a0b0d; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); color: #0a0b0d; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 10px 18px; font-size: 0.85rem; }
.btn-arrow { transition: transform 180ms ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(10,11,13,0.72);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.nav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}
.nav-brand {
    display: inline-flex;
    align-items: center;
    height: 100%;
}
.nav-brand img {
    display: block;
    height: 56px;
    width: auto;
}
.nav-links {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    gap: 28px;
    align-items: center;
}
.nav-links a {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    position: relative;
    padding: 6px 0;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
    content: "";
    position: absolute;
    bottom: -2px; left: 50%;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateX(-50%);
}
.nav-cta { display: inline-flex; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.nav-toggle, .nav-toggle-label { display: none; }
.nav-toggle-label {
    width: 28px; height: 20px;
    position: relative;
    cursor: pointer;
    z-index: 110;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: transform 220ms ease, opacity 160ms ease, top 220ms ease;
}
.nav-toggle-label span { top: 9px; }
.nav-toggle-label span::before { top: -8px; }
.nav-toggle-label span::after { top: 8px; }

main { padding-top: var(--nav-h); position: relative; z-index: 2; }

.hero {
    min-height: calc(100vh - var(--nav-h));
    display: flex;
    align-items: center;
    padding: clamp(4rem, 8vw, 7rem) 0;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 2;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
    width: 100%;
}
.hero-title { margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2rem; }

.terminal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.75;
}
.terminal-chrome {
    display: flex;
    gap: 7px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.terminal-chrome span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border-hover);
}
.terminal-chrome span:nth-child(1) { background: #ff5f57; }
.terminal-chrome span:nth-child(2) { background: #febc2e; }
.terminal-chrome span:nth-child(3) { background: #28c840; }
.terminal-body { padding: 20px 18px; color: var(--text-dim); }
.terminal-body .line { opacity: 0; transform: translateY(4px); animation: fadeUp 420ms ease forwards; }
.terminal-body .line:nth-child(1) { animation-delay: 100ms; }
.terminal-body .line:nth-child(2) { animation-delay: 300ms; }
.terminal-body .line:nth-child(3) { animation-delay: 500ms; }
.terminal-body .line:nth-child(4) { animation-delay: 700ms; }
.terminal-body .line:nth-child(5) { animation-delay: 900ms; }
.terminal-body .prompt { color: var(--accent); margin-right: 8px; }
.terminal-body .out { color: var(--accent); margin-right: 8px; }
.terminal-body .cmd { color: var(--text); }
.caret {
    display: inline-block;
    width: 8px; height: 1em;
    background: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1s steps(1) infinite;
    margin-left: 2px;
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

.section-head { margin-bottom: 56px; max-width: 720px; }
.section-head h2 { margin-bottom: 0.75rem; }
.section-head p { color: var(--text-dim); font-size: 1.05rem; max-width: 56ch; }

.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--border);
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.service-card {
    background: var(--surface);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    transition: background 180ms ease;
    min-height: 220px;
}
.service-card:hover { background: var(--surface-2); }
.service-card .idx {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--accent);
}
.service-card .icon {
    position: absolute;
    top: 28px; right: 28px;
    color: var(--text-mute);
    font-size: 20px;
    transition: color 180ms ease;
}
.service-card:hover .icon { color: var(--accent); }
.service-card h3 { margin: 0; }
.service-card p { color: var(--text-dim); margin: 0; flex: 1; }
.service-card .arrow {
    align-self: flex-end;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 1.1rem;
    transition: transform 180ms ease;
}
.service-card:hover .arrow { transform: translateX(4px); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 28px;
    transition: border-color 180ms ease, transform 200ms ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: start;
}
.contact-left h2 { margin-bottom: 1rem; }
.contact-direct {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.contact-direct .meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.contact-direct a, .contact-direct .val {
    font-family: var(--mono);
    font-size: 1rem;
    color: var(--text);
}
.contact-direct a:hover { color: var(--accent); }

.form-field { display: block; margin-bottom: 16px; }
.form-field label {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 8px;
}
.form-field input,
.form-field textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 14px 16px;
    font-family: var(--sans);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 160ms ease;
    outline: none;
}
.form-field textarea { resize: vertical; min-height: 140px; }
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }

.alert {
    padding: 14px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-success { border-color: var(--accent); color: var(--accent); }
.alert-danger, .alert-warning { border-color: var(--danger); color: var(--danger); }

.stats-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin-top: 56px;
}
.stat {
    background: var(--surface);
    padding: 32px 28px;
}
.stat .num {
    font-family: var(--mono);
    font-size: 2.25rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: -0.02em;
    line-height: 1;
    display: block;
    margin-bottom: 10px;
}
.stat .label {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: start;
}
.about-copy p { color: var(--text-dim); font-size: 1.05rem; line-height: 1.7; }
.about-copy :where(h2,h3,h4) { color: var(--text); margin-top: 1.5em; }
.about-full { max-width: 100%; }

.prose { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.prose p { color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose :where(h2,h3,h4) { margin-top: 1.8em; color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: 6px; margin: 1.5em 0; }
.prose ul, .prose ol { color: var(--text-dim); padding-left: 1.4em; }
.prose blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 20px;
    margin: 1.5em 0;
    color: var(--text);
    font-style: normal;
}

.error-wrap {
    min-height: calc(100vh - var(--nav-h) - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
}
.error-code {
    font-family: var(--mono);
    font-size: clamp(6rem, 20vw, 12rem);
    font-weight: 500;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.03em;
    margin: 0 0 20px;
}
.error-wrap p { color: var(--text-dim); margin-bottom: 32px; }

.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 72px 0 0;
    position: relative;
    z-index: 2;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    padding-bottom: 56px;
}
.footer h4 {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin: 0 0 20px;
    font-weight: 500;
}
.footer-brand .wordmark {
    display: inline-block;
    margin-bottom: 18px;
}
.footer-brand .wordmark img {
    display: block;
    height: 72px;
    width: auto;
}
.footer-brand p { color: var(--text-dim); max-width: 32ch; }
.footer-nav, .footer-contact { list-style: none; margin: 0; padding: 0; }
.footer-nav li, .footer-contact li { margin-bottom: 10px; }
.footer-nav a { color: var(--text-dim); font-size: 0.95rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-contact li { color: var(--text-dim); font-size: 0.95rem; font-family: var(--mono); display: flex; align-items: flex-start; gap: 10px; }
.footer-contact li i { color: var(--accent); width: 16px; margin-top: 4px; font-size: 0.95rem; text-align: center; flex-shrink: 0; }
.footer-contact a { color: var(--text-dim); }
.footer-contact a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 10px; flex-wrap: wrap; }
.footer-social a {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    transition: all 180ms ease;
}
.footer-social a:hover { border-color: var(--accent); color: var(--accent); }
.subfooter {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
}
.subfooter .copy, .subfooter .ver {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--text-mute);
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .service-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .subfooter { justify-content: center; text-align: center; }
}

@media (min-width: 768px) {
    .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr; }
    .contact-grid { grid-template-columns: 1fr 1.2fr; }
    .about-grid { grid-template-columns: 1.2fr 1fr; }
}

@media (min-width: 1024px) {
    body { font-size: 15px; }
    .service-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-grid { grid-template-columns: 1.1fr 1fr; }
}

@media (max-width: 900px) {
    .nav-cta .label-full { display: none; }
}

@media (max-width: 768px) {
    .nav-toggle-label { display: block; }
    .nav-links, .nav-cta { display: none; }
    .nav-toggle:checked ~ .nav-mobile { opacity: 1; pointer-events: auto; transform: translateY(0); }
    .nav-toggle:checked ~ .nav .nav-toggle-label span { background: transparent; }
    .nav-toggle:checked ~ .nav .nav-toggle-label span::before { top: 0; transform: rotate(45deg); }
    .nav-toggle:checked ~ .nav .nav-toggle-label span::after { top: 0; transform: rotate(-45deg); }
    body:has(.nav-toggle:checked) { overflow: hidden; }
    .nav-mobile {
        position: fixed;
        top: var(--nav-h); left: 0; right: 0; bottom: 0;
        background: #0a0b0d;
        display: flex;
        flex-direction: column;
        padding: 32px 24px;
        gap: 8px;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity 220ms ease, transform 220ms ease;
        z-index: 200;
        overflow-y: auto;
    }
    .nav-mobile a {
        font-family: var(--mono);
        font-size: 0.95rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        padding: 16px 4px;
        color: var(--text-dim);
        border-bottom: 1px solid var(--border);
    }
    .nav-mobile a.active { color: var(--accent); }
    .nav-mobile a.btn-primary {
        margin-top: 20px;
        align-self: stretch;
        justify-content: center;
        color: #0a0b0d;
        border-bottom: 1px solid var(--accent);
        padding: 14px 20px;
    }
}

@media (min-width: 769px) {
    .nav-mobile { display: none; }
}

/* legacy flash alert residue (used by Contact flashdata) safe style */
.alert.alert-success { border-color: var(--accent); background: rgba(198,242,78,0.06); }
.alert.alert-danger { border-color: var(--danger); background: rgba(255,85,119,0.06); }
.alert.alert-warning { border-color: #ffb84d; color: #ffb84d; background: rgba(255,184,77,0.06); }

/* portfolio */
.portfolio-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; } }
@media (min-width: 1024px) { .portfolio-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.project-card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    color: var(--text);
    transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
    position: relative;
}
.project-card:hover { border-color: var(--border-hover); background: var(--surface-2); color: var(--text); transform: translateY(-2px); }
.project-card:hover h3 { color: var(--accent); }
.project-media { overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 14px 14px 10px; }
.project-media img { width: 100%; height: auto; display: block; transition: transform 420ms ease; border-radius: 4px; }
.project-card:hover .project-media img { transform: scale(1.03); }
.project-body { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.project-eyebrow { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.project-body h3 { margin: 0; transition: color 160ms ease; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-body p { margin: 0; }
.project-arrow { font-family: var(--mono); color: var(--accent); margin-left: auto; }

.section-cta { display: flex; justify-content: center; margin-top: 40px; }
