/* Monochrome pixel theme. One hue: black, white and the grays between.
   Font = self-made 5x7 pixel font (see tools/gen-font.py).
   Font sizes use multiples of 10px so every font-pixel lands on whole screen pixels. */
@font-face { font-family: "JD Pixel"; src: url("/fonts/jdpixel.woff") format("woff"); font-display: swap; }

:root {
  --bg: #0a0a0a; --bg2: #050505; --panel: #141414; --edge: #333;
  --ink: #f2f2f2; --muted: #9a9a9a; --lav: #555; --line: #2a2a2a;
  --yellow: #ffffff; --pink: #e6e6e6; --green: #cfcfcf; --blue: #dedede; --orange: #b5b5b5; --red: #ffffff;
}
* { box-sizing: border-box; font-synthesis: none; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; scrollbar-color: var(--lav) var(--bg2); scrollbar-width: thin; background-color: var(--bg2); }
body {
  margin: 0; color: var(--ink); background-color: var(--bg2);
  background-image: radial-gradient(1200px 700px at 50% -10%, #1b1b1b 0%, #0d0d0d 55%, #050505 100%);
  background-attachment: fixed;
  font: 20px/30px "JD Pixel", "Courier New", monospace;
  -webkit-font-smoothing: none; font-smooth: never; text-rendering: optimizeSpeed;
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--lav); border: 3px solid var(--bg2); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::selection { background: var(--ink); color: #000; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
img, svg { image-rendering: pixelated; }
a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { color: #000; background: var(--ink); text-decoration: none; }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 4px; }
.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #000; padding: 10px 20px; z-index: 100; }
.skip:focus { left: 10px; top: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* starfield + CRT scanlines + soft vignette */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 85;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .5) 100%);
}
body.crt::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .2) 0 2px, transparent 2px 4px);
}

/* pixel frame: stepped corners made of box-shadows */
.px {
  background-color: var(--panel);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 4px);
  margin: 4px;
  box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge),
    inset 4px 4px 0 0 rgba(255, 255, 255, .09), inset -4px -4px 0 0 rgba(0, 0, 0, .6), 8px 8px 0 4px #202020;
}
.pad { padding: 20px; }

/* buttons */
.btn {
  font: inherit; text-transform: uppercase; cursor: pointer; text-decoration: none; display: inline-block;
  background: var(--ink); color: #000; border: 0; padding: 10px 20px; margin: 4px 8px 8px 4px;
  box-shadow: 0 -4px 0 0 #000, 0 4px 0 0 #000, -4px 0 0 0 #000, 4px 0 0 0 #000,
    inset -4px -4px 0 0 rgba(0, 0, 0, .2), 8px 8px 0 4px rgba(0, 0, 0, .55);
}
.btn:hover {
  background: #000; color: var(--ink); text-decoration: none;
  box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink),
    inset -4px -4px 0 0 rgba(255, 255, 255, .12), 8px 8px 0 4px rgba(255, 255, 255, .22);
}
.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink);
}
.btn.alt {
  background: #000; color: var(--ink);
  box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink),
    inset -4px -4px 0 0 rgba(255, 255, 255, .1), 8px 8px 0 4px rgba(255, 255, 255, .18);
}
.btn.alt:hover {
  background: var(--ink); color: #000;
  box-shadow: 0 -4px 0 0 #000, 0 4px 0 0 #000, -4px 0 0 0 #000, 4px 0 0 0 #000,
    inset -4px -4px 0 0 rgba(0, 0, 0, .2), 8px 8px 0 4px rgba(0, 0, 0, .55);
}
.btn.ghost {
  background: var(--bg2); color: var(--ink);
  box-shadow: 0 -4px 0 0 var(--lav), 0 4px 0 0 var(--lav), -4px 0 0 0 var(--lav), 4px 0 0 0 var(--lav),
    inset -4px -4px 0 0 rgba(255, 255, 255, .06), 8px 8px 0 4px rgba(255, 255, 255, .1);
}
.btn.ghost:hover {
  background: var(--ink); color: #000;
  box-shadow: 0 -4px 0 0 #000, 0 4px 0 0 #000, -4px 0 0 0 #000, 4px 0 0 0 #000,
    inset -4px -4px 0 0 rgba(0, 0, 0, .2), 8px 8px 0 4px rgba(0, 0, 0, .55);
}
.btn.small { padding: 0 10px; margin: 4px; }
.btn:disabled { opacity: .5; cursor: wait; }

/* header */
.top { position: sticky; top: 0; z-index: 50; background: var(--bg2); border-bottom: 4px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 60px; }
.logo { color: var(--ink); text-decoration: none; text-transform: uppercase; white-space: nowrap; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0 20px; }
.nav a { color: var(--muted); text-decoration: none; text-transform: uppercase; padding: 0 5px; }
.nav a:hover, .nav a.active { color: #000; background: var(--ink); }
.menu-btn { display: none; }

/* headings */
h1, h2, h3 { font-weight: normal; margin: 0; }
h1 { font-size: 50px; line-height: 60px; color: var(--ink); text-shadow: 4px 4px 0 #000, 8px 8px 0 #333; overflow-wrap: anywhere; }
h2 { font-size: 40px; line-height: 50px; color: var(--pink); text-transform: uppercase; text-shadow: 4px 4px 0 #000; margin-bottom: 30px; position: relative; padding-bottom: 20px; }
h2::before { content: "▶ "; color: var(--lav); }
h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: repeating-linear-gradient(90deg, var(--lav) 0 8px, transparent 8px 16px); }
h3 { font-size: 20px; color: var(--ink); text-transform: uppercase; margin-bottom: 10px; }
section { padding: 50px 0; }
[hidden] { display: none !important; }

/* hero */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 40px; padding: 70px 0 50px; }
.eyebrow { color: var(--muted); margin: 0 0 10px; }
.hero-title { font-size: 30px; line-height: 40px; color: var(--pink); margin: 20px 0 10px; text-transform: uppercase; }
.tagline { min-height: 60px; margin: 0 0 20px; color: var(--ink); }
.tagline.typing::after { content: "█"; color: var(--ink); animation: blink 1s steps(1) infinite; }
.badge { display: inline-block; background: var(--ink); color: #000; padding: 0 10px; margin: 0 0 20px; box-shadow: 4px 4px 0 #333; text-transform: uppercase; }
.hero-art { position: relative; padding: 16px; }
.hero-art::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-conic-gradient(rgba(255, 255, 255, .05) 0% 25%, transparent 0% 50%);
  background-size: 10px 10px;
}
.hero-art canvas { position: relative; width: 240px; height: 240px; display: block; animation: bob 1.2s steps(2) infinite; filter: drop-shadow(8px 8px 0 #333); }
.cta { margin: 20px 0 0; }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1.4s steps(1) infinite; }

/* layouts */
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; align-items: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; }
.prose p { margin: 0 0 20px; white-space: pre-line; overflow-wrap: anywhere; }
.prose p:last-child { margin: 0; }
.stats { margin: 4px; }
.stats dt { color: var(--muted); text-transform: uppercase; }
.stats dd { margin: 0 0 15px; color: var(--ink); overflow-wrap: anywhere; }

/* skills (segmented HP bars) */
.skillbox h3 { color: var(--ink); }
.skill { margin: 0 0 15px; }
.skill b { font-weight: normal; display: flex; justify-content: space-between; gap: 10px; }
.skill b span:last-child { color: var(--muted); }
.bar10 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 5px; }
.bar10 i { height: 20px; background: #222; }
.bar10 i.on { background: var(--ink); box-shadow: inset 0 -6px 0 0 rgba(0, 0, 0, .25); }

/* cards */
.card { padding: 20px; display: flex; flex-direction: column; gap: 10px; outline: 2px solid transparent; outline-offset: 2px; transition: transform .2s steps(2), outline-color .2s; }
.card:hover { transform: translateY(-6px); outline-color: var(--ink); }
.card p { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.card .meta { color: var(--muted); }
.sprite { width: 64px; height: 64px; display: block; }
.sprite.mini { width: 20px; height: 20px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.thumb {
  width: 100%; height: 120px; background: var(--bg2); padding: 10px;
  background-image: repeating-conic-gradient(rgba(255, 255, 255, .04) 0% 25%, transparent 0% 50%);
  background-size: 8px 8px;
}
.thumb canvas { width: 100%; height: 100%; object-fit: contain; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #0d0d0d; color: var(--pink); padding: 0 10px; border: 2px solid var(--lav); }
.actions { margin-top: auto; padding-top: 10px; }

/* experience timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 40px; border-left: 4px solid var(--lav); display: grid; gap: 30px; }
.timeline li { position: relative; padding: 20px; }
.timeline li::before { content: ""; position: absolute; left: -64px; top: 24px; width: 20px; height: 20px; background: var(--ink); box-shadow: 0 0 0 4px #000; }
.timeline .when { color: var(--muted); }
.timeline .org { color: var(--pink); }
.timeline p { margin: 10px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* contact */
.form label { display: block; margin: 0 0 20px; color: var(--green); text-transform: uppercase; }
.form input, .form textarea, .chat-form input {
  display: block; width: 100%; margin-top: 8px; padding: 10px; font: inherit; text-transform: none;
  background: var(--bg2); color: var(--ink); border: 4px solid var(--edge); border-radius: 0; resize: vertical;
  caret-color: var(--ink);
}
.form input:focus, .form textarea:focus, .chat-form input:focus { border-color: var(--ink); outline: none; }
.form input::placeholder, .form textarea::placeholder, .chat-form input::placeholder { color: var(--muted); }
.status { min-height: 30px; margin: 10px 0 0; }
.status.ok { color: var(--ink); } .status.ok:not(:empty)::before { content: "✓ "; }
.status.err { color: var(--ink); text-decoration: underline; } .status.err:not(:empty)::before { content: "✕ "; }
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.links a { display: block; overflow-wrap: anywhere; }
.links span { color: var(--muted); text-transform: uppercase; margin-right: 10px; }

.foot { padding: 40px 0 120px; color: var(--muted); text-align: center; }

/* chatbot */
.chat-toggle { position: fixed; right: 24px; bottom: 24px; z-index: 60; background: var(--ink); transition: opacity .2s steps(2), transform .2s steps(2); }
.chat-toggle.is-tucked { opacity: 0; transform: translateY(10px); pointer-events: none; }
.chat {
  position: fixed; right: 24px; bottom: 100px; z-index: 70; width: min(380px, 100% - 48px); height: min(520px, 100dvh - 180px);
  display: flex; flex-direction: column; margin: 0; padding: 0; background: var(--bg2);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 10px 20px; background: var(--ink); color: #000; }
.chat-log { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 15px; }
.msg { max-width: 88%; padding: 5px 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--panel); border-left: 4px solid var(--ink); }
.msg.me { align-self: flex-end; background: var(--ink); color: #000; border-right: 4px solid #000; }
.chat .chips { padding: 0 15px 5px; }
.chip { font: inherit; cursor: pointer; background: var(--bg2); color: var(--ink); border: 2px solid var(--lav); padding: 0 10px; }
.chip:hover { background: var(--ink); color: #000; }
.chat-form { display: flex; gap: 8px; padding: 10px 15px 15px; align-items: center; }
.chat-form input { margin: 0; }

/* ---------- animated pixel cursor (mouse / pen only) ---------- */
.cursor, .cursor-trail, .cursor-ring, .cursor-pulse {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  mix-blend-mode: difference; will-change: transform, opacity;
}
.cursor { width: 18px; height: 18px; opacity: 0; transition: opacity .12s linear; }
.cursor canvas { display: block; width: 100%; height: 100%; }
.cursor-trail { background: var(--ink); opacity: 0; transition: opacity .2s linear; }
.cursor-trail[data-i="0"] { width: 8px; height: 8px; }
.cursor-trail[data-i="1"] { width: 6px; height: 6px; }
.cursor-trail[data-i="2"] { width: 4px; height: 4px; }
.cursor-trail[data-i="3"] { width: 3px; height: 3px; }
.cursor-ring { width: 36px; height: 36px; border: 2px solid var(--ink); opacity: 0; }
.cursor-pulse { width: 28px; height: 28px; border: 2px solid var(--ink); opacity: 0; }
@media (pointer: fine) {
  html.cursor-on, html.cursor-on * { cursor: none !important; }
}
@media (pointer: coarse) {
  .cursor, .cursor-trail, .cursor-ring, .cursor-pulse { display: none; }
}

@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg2); border-bottom: 4px solid var(--line); flex-direction: column; align-items: flex-start; padding: 10px 20px 20px; gap: 10px; }
  .nav.open { display: flex; }
  .hero { grid-template-columns: 1fr; text-align: left; padding-top: 40px; }
  .hero-art { order: -1; justify-self: center; }
  .hero-art canvas { width: 160px; height: 160px; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  h1 { font-size: 30px; line-height: 40px; text-shadow: 2px 2px 0 #000, 4px 4px 0 #333; }
  h2 { font-size: 30px; line-height: 40px; }
  .hero-title { font-size: 20px; line-height: 30px; }
  .grid { grid-template-columns: 1fr; }
  .chat { right: 10px; width: calc(100% - 20px); }
  .chat-toggle { right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
