/* ============================================================
   Minbin Jiang — terminal / blueprint aesthetic
   dark · monospace · single terminal-green accent · no gradients
   ============================================================ */

:root {
  --bg:        #0a0e14;
  --panel:     #0e141c;
  --panel-2:   #10171f;
  --line:      #1b2530;
  --line-hi:   #2b3947;
  --text:      #c9d3df;
  --muted:     #7f8b9a;
  --dim:       #566374;
  --acc:       #00ff9c;   /* terminal green */
  --acc-dim:   rgba(0,255,156,.10);
  --acc-line:  rgba(0,255,156,.35);
  --cyan:      #38bdf8;
  --amber:     #ffb000;
  --maxw:      1140px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* faint blueprint grid over the whole page */
  background-image:
    linear-gradient(rgba(43,57,71,.20) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43,57,71,.20) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); }

/* selection */
::selection { background: var(--acc); color: #06210f; }

/* ---------- shared type ---------- */
h1,h2,h3,h4 { font-family: var(--mono); letter-spacing: -0.01em; font-weight: 700; }

.kicker {
  font-family: var(--mono); color: var(--acc); font-size: 12.5px;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.kicker::before { content: "//"; color: var(--dim); }

.section { padding: 92px 0; position: relative; }
.section h2 { font-size: clamp(24px, 3.2vw, 34px); color: #eef3f8; max-width: 780px; line-height: 1.2; }
.section-lede { margin-top: 16px; color: var(--muted); font-size: 16.5px; max-width: 720px; }
.section-alt { background: rgba(14,20,28,.55); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--mono); display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line-hi); background: transparent; color: var(--text);
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--acc); color: var(--acc); }
.btn-primary { border-color: var(--acc-line); color: var(--acc); background: var(--acc-dim); }
.btn-primary:hover { background: rgba(0,255,156,.16); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn::before { content: "$"; color: var(--dim); }
.btn:hover::before { color: var(--acc); }

/* ============================================================
   NAV
   ============================================================ */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 1000; transition: background .25s, border-color .25s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(10,14,20,.88); backdrop-filter: blur(8px); border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; max-width: var(--maxw); margin: 0 auto; }
.brand { font-family: var(--mono); font-weight: 700; font-size: 15px; color: #eef3f8; display: flex; align-items: center; }
.brand .prompt { color: var(--acc); }
.brand .caret { color: var(--acc); animation: blink 1.1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.nav-links { display: flex; align-items: center; gap: 24px; font-family: var(--mono); }
.nav-links a { color: var(--muted); font-size: 13.5px; }
.nav-links a:not(.btn):hover { color: var(--acc); }
.nav-links a:not(.btn)::before { content: ""; color: var(--dim); }

/* ============================================================
   HERO — terminal intro + architecture diagram
   ============================================================ */
.hero { position: relative; padding: 132px 0 72px; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }

.term {
  font-family: var(--mono); font-size: 13.5px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.term-bar .r { background: #ff5f56; } .term-bar .y { background: #ffbd2e; } .term-bar .g { background: #27c93f; }
.term-bar span { margin-left: 8px; color: var(--dim); font-size: 12px; }
.term-body { padding: 20px 20px 24px; }
.term-line { white-space: pre-wrap; }
.term-line .p { color: var(--acc); }
.term-line .path { color: var(--cyan); }
.term-out { color: var(--text); }

.hero h1 { font-size: clamp(26px, 3.6vw, 38px); color: #f2f6fa; line-height: 1.15; margin: 14px 0 6px; letter-spacing: -.02em; }
.hero h1 .accent { color: var(--acc); }
.hero .role { font-family: var(--mono); color: var(--muted); font-size: 14px; }
.hero .lede { margin-top: 18px; color: var(--text); font-size: 15.5px; max-width: 560px; font-family: var(--sans); }
.hero-cta { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px 28px; font-family: var(--mono); font-size: 12.5px; }
.hero-meta div span { color: var(--dim); }
.hero-meta div b { color: var(--acc); font-weight: 600; }

/* ---------- ask-AI chat ---------- */
.chat {
  display: flex; flex-direction: column; height: 468px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.chat-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.chat-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.chat-bar .r { background: #ff5f56; } .chat-bar .y { background: #ffbd2e; } .chat-bar .g { background: #27c93f; }
.chat-bar span { margin-left: 8px; color: var(--dim); font-size: 12px; font-family: var(--mono); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 4px; }

.msg { display: flex; gap: 10px; max-width: 94%; }
.msg-av {
  width: 26px; height: 26px; flex: none; border-radius: 6px; border: 1px solid var(--line-hi);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; color: var(--acc); background: var(--panel-2);
}
.msg-bubble { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px; color: var(--text); font-size: 13.5px; line-height: 1.55; }
.msg-bubble strong { color: #eef3f8; }
.msg-bubble a { color: var(--acc); text-decoration: underline; text-underline-offset: 2px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .msg-av { color: var(--cyan); }
.msg.user .msg-bubble { background: var(--acc-dim); border-color: var(--acc-line); color: #dcefe6; }

.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blinkdot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blinkdot { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }

.chips-q { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; }
.chip-q {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line-hi); background: var(--panel-2);
  padding: 6px 11px; border-radius: 999px; cursor: pointer; transition: border-color .15s, color .15s;
}
.chip-q:hover { border-color: var(--acc); color: var(--acc); }

.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.chat-input input {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; color: var(--text); font-family: var(--mono); font-size: 12.5px; outline: none;
}
.chat-input input:focus { border-color: var(--acc-line); }
.chat-input .btn { border-radius: 6px; }

/* architecture diagram panel */
.arch { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.arch-cap { font-family: var(--mono); font-size: 11.5px; color: var(--dim); margin-bottom: 10px; display: flex; justify-content: space-between; }
.arch-cap b { color: var(--muted); font-weight: 500; }
.arch svg { width: 100%; height: auto; display: block; }

/* footprint map */
.map-panel { margin-top: 40px; }
.map { width: 100%; height: 440px; border-radius: 4px; overflow: hidden; }
.leaflet-container { background: var(--panel) !important; font-family: var(--mono); }
/* darken the light OSM tiles (tile pane only — markers/lines stay full colour) */
.map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.9) saturate(.6); }
.leaflet-control-attribution { font-size: 9px; opacity: .45; background: rgba(10,14,20,.6) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.pulse-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 rgba(0,255,156,.6); animation: pulse 2.4s infinite; }
.leaflet-tooltip { font-family: var(--mono); font-size: 11px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-hi); box-shadow: none; }
.leaflet-tooltip-top::before { border-top-color: var(--line-hi); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,255,156,.5); }
  70% { box-shadow: 0 0 0 15px rgba(0,255,156,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,255,156,0); }
}

/* ============================================================
   CLOSED LOOP (pipeline)
   ============================================================ */
.loop { margin-top: 44px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.loop-stage { padding: 22px 20px; border-right: 1px solid var(--line); background: var(--panel); position: relative; transition: background .2s; }
.loop-stage:last-child { border-right: none; }
.loop-stage:hover { background: var(--panel-2); }
.loop-stage .n { font-family: var(--mono); font-size: 12px; color: var(--acc); letter-spacing: .1em; }
.loop-stage h3 { font-size: 16px; color: #eef3f8; margin: 8px 0 10px; }
.loop-stage ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.loop-stage li { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-left: 14px; position: relative; line-height: 1.5; }
.loop-stage li::before { content: "›"; position: absolute; left: 0; color: var(--acc); }
.loop-stage::after { content: "→"; position: absolute; right: -9px; top: 24px; color: var(--acc); font-family: var(--mono); z-index: 2; background: var(--bg); padding: 0 1px; }
.loop-stage:last-child::after { display: none; }

/* ============================================================
   WORK — case log
   ============================================================ */
.work-grid { margin-top: 40px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.work-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; transition: border-color .18s, transform .18s; }
.work-item:hover { border-color: var(--line-hi); transform: translateY(-3px); }
.work-tag { font-family: var(--mono); font-size: 12px; color: var(--acc); margin-bottom: 10px; }
.work-tag .br { color: var(--dim); }
.work-item h3 { font-size: 16.5px; color: #eef3f8; margin-bottom: 10px; line-height: 1.3; }
.work-item p { color: var(--muted); font-size: 14.5px; font-family: var(--sans); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.chips li { font-family: var(--mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); padding: 4px 9px; border-radius: 4px; background: var(--panel-2); }
.chips li::before { content: ""; }
.chips-lg li { font-size: 13px; padding: 6px 12px; }

/* ============================================================
   STACK
   ============================================================ */
.stack-cols { margin-top: 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.stack-col h4 { font-family: var(--mono); font-size: 13px; color: var(--acc); margin-bottom: 14px; }
.stack-col h4::before { content: "> "; color: var(--dim); }

/* ============================================================
   WRITING
   ============================================================ */
.posts { list-style: none; margin-top: 34px; border-top: 1px solid var(--line); }
.posts li { border-bottom: 1px solid var(--line); }
.posts a {
  display: flex; align-items: baseline; gap: 14px; padding: 15px 4px;
  font-family: var(--mono); font-size: 14px; color: var(--text); transition: color .15s, padding .15s;
}
.posts a:hover { color: var(--acc); padding-left: 10px; }
.posts .post-date { color: var(--dim); font-size: 12px; flex: none; }
.posts .arr { margin-left: auto; color: var(--dim); }
.posts a:hover .arr { color: var(--acc); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 44px; align-items: start; }
.about-grid p { color: var(--muted); margin-top: 16px; font-size: 15.5px; }
.about-grid strong { color: var(--text); font-weight: 600; }
.about-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 26px; font-family: var(--mono); }
.about-card h4 { font-size: 12.5px; color: var(--acc); margin: 0 0 14px; letter-spacing: .05em; }
.about-card h4:nth-of-type(2) { margin-top: 24px; }
.tick { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.tick li { position: relative; padding-left: 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tick li::before { content: "[x]"; position: absolute; left: 0; color: var(--acc); font-size: 11px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { text-align: left; }
.contact-inner { max-width: 760px; }
.contact-actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { border-top: 1px solid var(--line); padding: 28px 0; font-family: var(--mono); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--dim); flex-wrap: wrap; gap: 10px; }
.footer-tag { color: var(--acc); }
.disclaimer { margin: 18px auto 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.6; color: var(--dim); max-width: var(--maxw); font-family: var(--sans); }

/* ============================================================
   scroll reveal
   ============================================================ */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .loop { grid-template-columns: repeat(2, 1fr); }
  .loop-stage:nth-child(2n)::after { display: none; }
  .work-grid, .stack-cols { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .nav-links a:not(.btn) { display: none; }
  .loop, .work-grid, .stack-cols { grid-template-columns: 1fr; }
  .loop-stage { border-right: none; border-bottom: 1px solid var(--line); }
  .loop-stage::after { content: "↓"; right: auto; left: 24px; top: auto; bottom: -9px; }
  .section { padding: 64px 0; }
  .term-body { padding: 16px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .brand .caret { animation: none; }
}
