:root {
    --bg: #000;
    --surface: #101012;
    --border: #26262c;
    --text: #f4f4f6;
    --muted: #a3a3ad;
    --accent: #8b6fe0;
    --accent-strong: #6b46d6;
    --accent-soft: rgba(139, 111, 224, 0.15);
    --radius: 10px;
    --max: 1000px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2rem); margin-bottom: 2rem; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1rem; color: var(--muted); }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.accent { color: var(--accent); }

/* ───── Nav ───── */
.nav {
    position: fixed; inset: 0 0 auto 0; z-index: 50;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s;
}
.nav.scrolled { border-color: var(--border); }
.nav__inner {
    max-width: var(--max); margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo {
    font-family: "JetBrains Mono", monospace;
    font-weight: 800;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 0 18px rgba(139, 111, 224, 0.45);
}
.logo__cursor { animation: blink 1.1s steps(1) infinite; }
.logo--small { font-size: 1.1rem; }
@keyframes blink { 50% { opacity: 0; } }
.nav__links { display: flex; gap: 24px; font-size: .95rem; }
.nav__links a { transition: color .2s; }
.nav__links a:hover, .nav__links a.active { color: var(--accent); }
.nav__links { align-items: center; }
.nav__gh {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; margin-left: 4px;
    border: 1px solid var(--accent); border-radius: 999px;
    color: var(--accent); font-size: .88rem;
    transition: background .2s, color .2s;
}
.nav__links a.nav__gh:hover { background: var(--accent); color: #fff; }

.nav__toggle {
    display: none; background: none; border: 0; cursor: pointer; padding: 6px;
    flex-direction: column; gap: 5px;
}
.nav__toggle span { width: 22px; height: 2px; background: var(--text); transition: .3s; }

/* ───── Hero ───── */
.hero { min-height: 100vh; display: flex; align-items: center; padding: 100px 0 60px; }
.hero__inner {
    display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; width: 100%;
}
.eyebrow { color: var(--accent); font-weight: 500; margin-bottom: .5rem; letter-spacing: .05em; }
.hero h1 { font-size: clamp(3rem, 8vw, 5rem); letter-spacing: -0.03em; margin-bottom: 1rem; }
.hero__sub { font-size: 1.1rem; max-width: 34ch; margin-bottom: 2rem; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Site mark: white dither tinted purple via multiply */
.mark {
    margin: 0;
    position: relative;
    background: var(--accent);
    isolation: isolate;
    /* fade every edge into the page so there's no visible box */
    -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 45%, transparent 100%);
            mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 45%, transparent 100%);
}
.mark img {
    mix-blend-mode: multiply;
    filter: contrast(1.35) brightness(.95); /* crush JPEG grey to pure black */
    transition: transform 1.2s ease, filter .6s;
}
.mark:hover img { transform: scale(1.04); filter: contrast(1.25) brightness(1.1); }

/* ───── Buttons ───── */
.btn {
    display: inline-block; padding: 11px 22px; border-radius: 999px;
    font-weight: 500; font-size: .95rem; transition: .25s;
}
.btn--solid { background: var(--accent-strong); color: #fff; }
.btn--solid:hover { background: var(--accent); box-shadow: 0 0 24px rgba(139,111,224,.5); }
.btn--ghost { border: 1px solid var(--accent); color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }

/* ───── About ───── */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about__text h2 { margin-bottom: 1.25rem; font-size: clamp(2rem, 4vw, 2.4rem); }
.about__text p { max-width: 42ch; }

.about__art { position: relative; height: 340px; display: grid; place-items: center; }
.bat { position: absolute; overflow: visible; }
.bat--1 { width: min(58%, 240px); top: 34%; left: 22%; animation: drift 5s ease-in-out infinite; }
.bat--2 { width: 92px; top: 10%; left: 8%;  animation: drift 4s ease-in-out infinite -1.3s; opacity: .85; }
.bat--3 { width: 70px; top: 27%; right: 3%; animation: drift 3.6s ease-in-out infinite -2.2s; opacity: .7; }
.bat .frame--down { opacity: 0; }
.bat .frame--up   { animation: flap-up .5s steps(1) infinite; }
.bat .frame--down { animation: flap-down .5s steps(1) infinite; }
.bat--2 .frame { animation-duration: .42s; }
.bat--3 .frame { animation-duration: .38s; }
@keyframes flap-up   { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes flap-down { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes drift { 50% { transform: translate(6px, -12px); } }
.spark, .ring, .dot { position: absolute; color: var(--accent); }
.spark { font-size: 1.4rem; animation: twinkle 3s ease-in-out infinite; }
.spark--1 { top: 22%; left: 12%; }
.spark--2 { top: 4%;  right: 20%; animation-delay: .8s; }
.spark--3 { bottom: 12%; right: 6%; font-size: 1.8rem; animation-delay: 1.6s; }
.ring { width: 22px; height: 22px; border: 5px solid var(--accent-strong); border-radius: 50%; }
.ring--1 { top: 10%; right: 12%; width: 18px; height: 18px; border-width: 4px; }
.ring--2 { bottom: 8%; right: 18%; }
.dot { width: 8px; height: 8px; background: var(--accent-strong); border-radius: 50%; }
.dot--1 { top: 32%; left: 8%; }
.dot--2 { bottom: 18%; left: 12%; }

@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.8) rotate(20deg); } }

/* ───── Cards / grids ───── */
.grid { display: grid; gap: 24px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: border-color .25s, transform .25s;
}
.card:hover { border-color: rgba(139, 111, 224, .5); transform: translateY(-3px); }
.card h3 { margin-bottom: 14px; }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
    font-size: .72rem; padding: 2px 10px;
    border: 1.5px solid var(--accent-strong); border-radius: 999px;
    color: var(--text);
}

/* ───── Projects ───── */
.project p { font-size: .92rem; }
.project__thumb {
    aspect-ratio: 16 / 9; margin-bottom: 18px; border-radius: 6px;
    background:
        radial-gradient(circle at 70% 30%, rgba(139,111,224,.35), transparent 60%),
        radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px) 0 0 / 6px 6px,
        #0a0a0c;
    display: grid; place-items: center;
    color: var(--accent);
}
.project .tags { margin-bottom: 16px; }
.project__links { display: flex; gap: 16px; font-size: .88rem; color: var(--accent); }
.project__links a:hover { text-decoration: underline; }

.project__thumb > span { font-family: "JetBrains Mono", monospace; font-size: 1.15rem; letter-spacing: .02em; }
.grid > * { min-width: 0; } /* stop long terminal lines from stretching grid columns */
.project__label {
    font-family: "JetBrains Mono", monospace; font-size: .75rem; color: var(--accent);
    text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem;
}
.project--featured {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center;
}
.project--featured .project__thumb { margin: 0; }
.project--featured h3 { font-size: 1.3rem; }

/* ───── Terminal / interests ───── */
.prompt { font-family: "JetBrains Mono", monospace; color: var(--muted); margin-right: .35em; }
.eyebrow { font-family: "JetBrains Mono", monospace; }
.about__sub { margin: 1.75rem 0 .75rem; font-size: .95rem; }
.interests { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.interests li { color: var(--muted); font-size: .95rem; }
.interests li::before { content: "> "; font-family: "JetBrains Mono", monospace; color: var(--accent); }

/* ───── Timeline ───── */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline__item {
    display: grid; grid-template-columns: 44px 1fr; gap: 26px;
    position: relative; padding-bottom: 24px;
}
.timeline__item:not(:last-child)::before {
    content: ""; position: absolute; left: 21px; top: 44px; bottom: 0;
    width: 2px; background: var(--accent-strong);
}
.timeline__year {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent-strong); color: #fff;
    display: grid; place-items: center;
    font-size: .72rem; font-weight: 700;
    margin-top: 4px;
}
.timeline .card { padding: 20px 24px; }
.timeline .card h3 { margin-bottom: 4px; }
.timeline__org { color: var(--accent); font-size: .85rem; margin-bottom: .75rem; }
.timeline .card p:last-child { margin: 0; font-size: .9rem; }

/* ───── Contact ───── */
.contact { text-align: center; max-width: 560px; }
.contact h2 { margin-bottom: 1rem; }
.contact p { margin-bottom: 2rem; }
.socials { display: flex; gap: 24px; justify-content: center; margin-top: 2rem; color: var(--muted); }
.socials a:hover { color: var(--accent); }

/* ───── Footer ───── */
.footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: .85rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ───── Reveal on scroll ───── */
/* only hide content once JS has confirmed it's running, so a script error can never blank the page */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

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

/* ───── Responsive ───── */
@media (max-width: 820px) {
    .hero__inner, .about { grid-template-columns: 1fr; }
    .hero { min-height: auto; padding-top: 110px; }
    .about__art { height: 240px; order: -1; }
    .grid--3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .section { padding: 60px 0; }
    .grid--3, .grid--2 { grid-template-columns: 1fr; }
    .project--featured { grid-template-columns: 1fr; gap: 18px; }
    .project__thumb.term { aspect-ratio: auto; }
    .nav__toggle { display: flex; }
    .nav__links {
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; gap: 0;
        background: rgba(0,0,0,.95); border-bottom: 1px solid var(--border);
        max-height: 0; overflow: hidden; transition: max-height .3s ease;
    }
    .nav__links { align-items: stretch; }
    .nav__links a { padding: 14px 16px; }
    .nav__links a.nav__gh { align-self: flex-start; margin: 6px 16px 14px; padding: 6px 14px; }
    .nav.open .nav__links { max-height: 320px; }
    .nav.open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav.open .nav__toggle span:nth-child(2) { opacity: 0; }
    .nav.open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    .timeline__item { gap: 16px; }
}

/* ───── Project terminals & screenshots (real tool output) ───── */
.project__thumb.term {
    display: flex; flex-direction: column; place-items: initial;
    background: #08080b; border: 1px solid var(--border); overflow: hidden;
}
.term__bar {
    display: flex; align-items: center; gap: 6px; padding: 7px 10px;
    background: #121218; border-bottom: 1px solid var(--border);
}
.term__bar i { width: 8px; height: 8px; border-radius: 50%; background: #2c2c36; }
.term__bar i:first-child { background: var(--accent-strong); }
.term__bar span { margin-left: 6px; font-family: "JetBrains Mono", monospace; font-size: .68rem; color: var(--muted); }
.term pre {
    margin: 0; padding: 10px 12px; flex: 1; overflow: hidden;
    font-family: "JetBrains Mono", monospace; font-size: .64rem; line-height: 1.55;
    color: #c9c9d3; white-space: pre;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
            mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.t-prompt { color: var(--accent); }
.t-head { color: #f4f4f6; font-weight: 500; }
.t-warn { color: #ff8fa3; }
.t-ok { color: #8fe3b0; }
.t-kw { color: var(--accent); }

.project__shot { background: #000; overflow: hidden; border: 1px solid var(--border); }
.project__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }

/* ───── Writeups ───── */
.section__intro { max-width: 60ch; margin: -1.25rem 0 2rem; }
.writeup { display: block; }
.writeup__meta {
    font-family: "JetBrains Mono", monospace; font-size: .72rem; color: var(--accent);
    text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5rem;
}
.writeup h3 { margin-bottom: .5rem; }
.writeup p:not(.writeup__meta) { font-size: .92rem; }
.writeup--empty { border-style: dashed; grid-column: 1 / -1; }
.writeup--empty:hover { transform: none; }

/* ───── Goals ───── */
.goals { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.goals li { color: var(--muted); font-size: .95rem; }
.goals li::before { content: "[ ] "; font-family: "JetBrains Mono", monospace; color: var(--accent); }
.goals li.done::before { content: "[x] "; }
.goals li.done { text-decoration: line-through; opacity: .7; }

.contact__cta { justify-content: center; }

/* ───── Writeup article pages ───── */
.article { max-width: 760px; margin: 0 auto; padding: 120px 24px 80px; }
.article__back { font-family: "JetBrains Mono", monospace; font-size: .85rem; color: var(--accent); }
.article h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 1.5rem 0 .75rem; }
.article h2 { font-size: 1.35rem; margin: 2.5rem 0 1rem; }
.article p, .article li { color: #c3c3cc; }
.article ul, .article ol { padding-left: 1.2rem; }
.article pre {
    background: #08080b; border: 1px solid var(--border); border-radius: 8px;
    padding: 14px 16px; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: .82rem; line-height: 1.6;
}
.article code { font-family: "JetBrains Mono", monospace; font-size: .88em; color: #d9cffb; }
.article pre code { color: #c9c9d3; }
.article img { border-radius: 8px; border: 1px solid var(--border); margin: 1rem 0; }
.article .tags { margin-top: 1rem; }

/* ───── PGP key ───── */
.pgp { margin-top: 1.75rem; display: grid; gap: 8px; justify-items: center; }
.pgp__link {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: "JetBrains Mono", monospace; font-size: .85rem; color: var(--accent);
}
.pgp__link:hover { text-decoration: underline; }
.pgp__fp {
    font-family: "JetBrains Mono", monospace; font-size: .72rem; color: var(--muted);
    word-break: break-word; text-align: center;
}
