:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --ink: #111827;
  --muted: #5f6b7a;
  --subtle: #8792a2;
  --line: #dbe3ef;
  --line-strong: #b8c5d8;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #059669;
  --orange: #d97706;
  --red: #dc2626;
  --purple: #7c3aed;
  --code-bg: #0f172a;
  --code-ink: #dbeafe;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(37, 99, 235, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.72;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 18px rgba(37, 99, 235, .35);
  transform: scaleX(0);
  transform-origin: left center;
}

@supports (animation-timeline: scroll()) {
  .scroll-progress {
    animation: scrollProgress linear both;
    animation-timeline: scroll();
  }
}

@keyframes scrollProgress {
  to {
    transform: scaleX(1);
  }
}

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

code,
pre {
  font-family: "SFMono-Regular", "Cascadia Code", Consolas, Menlo, monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px max(22px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(184, 197, 216, .65);
  background: rgba(246, 248, 251, .88);
  backdrop-filter: blur(16px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.logo-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(5, 150, 105, .12);
}

nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

nav a:hover {
  color: var(--blue);
}

nav a[aria-current="true"] {
  color: var(--blue);
  font-weight: 900;
}

main {
  width: min(var(--max), calc(100vw - 44px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  padding: 64px 0 42px;
}

.terminal-card,
.project,
.signal-grid article,
.pipeline,
.hero-insights article,
.earlier-grid article,
.timeline article,
.skills-grid article,
.extras-grid article,
.contact {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .56s ease, transform .56s ease, box-shadow .24s ease, border-color .24s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.terminal-card {
  position: relative;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
}

.terminal-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 18px auto;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(147, 197, 253, .22);
  border-radius: 22px;
  transform: rotate(12deg);
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(219, 234, 254, .14);
  background: rgba(2, 6, 23, .72);
}

.terminal-head span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-head span:nth-child(1) {
  background: #ef4444;
}

.terminal-head span:nth-child(2) {
  background: #f59e0b;
}

.terminal-head span:nth-child(3) {
  background: #22c55e;
}

.terminal-head code {
  margin-left: 8px;
  color: #93c5fd;
  font-size: 13px;
}

.terminal-card pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(36px, 4.6vw, 58px);
  line-height: 1.14;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.34;
}

h4 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 15px;
}

.lead {
  max-width: 820px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 17px;
}

.hero-subtitle {
  max-width: 760px;
  margin-bottom: 16px;
  color: var(--blue);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 800;
  line-height: 1.42;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button:hover {
  transform: translateY(-1px);
}

.hero-insights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 34px;
}

.hero-insights article {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: rgba(255, 255, 255, .82);
}

.hero-insights article::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid rgba(37, 99, 235, .28);
  pointer-events: none;
}

.hero-insights span {
  display: block;
  margin-bottom: 12px;
  color: var(--subtle);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.hero-insights strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.hero-insights p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.section {
  padding: 58px 0;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 22px;
}

.section-heading > p {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.signal-grid article {
  position: relative;
  padding: 22px;
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(37, 99, 235, .28), rgba(8, 145, 178, .12)) border-box;
  border: 1px solid transparent;
}

.signal-grid article::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 98px;
  height: 98px;
  border: 1px solid rgba(37, 99, 235, .1);
  border-radius: 22px;
  transform: rotate(18deg);
}

.signal-grid article > span {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--cyan);
  font-weight: 900;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.signal-grid article:hover,
.project:hover,
.project.is-open,
.earlier-grid article:hover,
.skills-grid article:hover {
  border-color: rgba(37, 99, 235, .28);
  box-shadow: 0 22px 52px rgba(15, 23, 42, .11);
  transform: translateY(-2px);
}

.icon,
.pipe-icon {
  display: block;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  padding: 7px;
  border: 1px solid rgba(37, 99, 235, .22);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #eff6ff);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.icon-green {
  color: var(--green);
  border-color: rgba(5, 150, 105, .24);
  background: linear-gradient(180deg, #fff, #ecfdf5);
}

.icon-orange {
  color: var(--orange);
  border-color: rgba(217, 119, 6, .25);
  background: linear-gradient(180deg, #fff, #fff7ed);
}

.icon-cyan {
  color: var(--cyan);
  border-color: rgba(8, 145, 178, .24);
  background: linear-gradient(180deg, #fff, #ecfeff);
}

.signal-grid p,
.project p,
.earlier-grid p,
.timeline p,
.skills-grid p {
  color: var(--muted);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  background: rgba(255, 255, 255, .92);
}

.pipeline div {
  position: relative;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.pipeline div:last-child {
  border-right: 0;
}

.pipeline div:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 22px;
  right: -11px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--blue);
  text-align: center;
  line-height: 22px;
  font-weight: 900;
}

.pipeline strong,
.pipeline span {
  display: block;
}

.pipeline strong {
  margin-bottom: 8px;
  font-size: 17px;
}

.pipeline .pipe-icon {
  margin-bottom: 14px;
}

.pipeline span {
  color: var(--muted);
  font-size: 14px;
}

.projects {
  counter-reset: project;
}

.project-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: -6px 0 18px;
}

.project-toolbar button {
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.project-toolbar button:hover {
  border-color: rgba(37, 99, 235, .35);
  color: var(--blue);
  background: #eff6ff;
}

.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
  overflow: hidden;
  border-color: rgba(184, 197, 216, .72);
  background:
    linear-gradient(180deg, rgba(239, 246, 255, .72), rgba(255, 255, 255, 0) 82px),
    #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .075);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.project::before {
  counter-increment: project;
  content: "project_" counter(project, decimal-leading-zero);
  grid-column: 1 / -1;
  color: var(--subtle);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.project::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(37, 99, 235, .36), rgba(8, 145, 178, .12), transparent);
  pointer-events: none;
}

.project.primary-project {
  border-color: rgba(37, 99, 235, .26);
}

.project.incident {
  border-color: rgba(217, 119, 6, .25);
}

.project.primary-project::after {
  background: linear-gradient(90deg, rgba(37, 99, 235, .52), rgba(8, 145, 178, .18), transparent);
}

.project.incident::after {
  background: linear-gradient(90deg, rgba(217, 119, 6, .5), rgba(37, 99, 235, .12), transparent);
}

.project-type {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.project-side {
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.project-side span {
  flex-basis: 100%;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 900;
}

.project-side code {
  padding: 4px 7px;
  border: 1px solid #d7e3f6;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--blue);
  font-weight: 900;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1;
}

details[open] summary::before {
  content: "-";
}

summary:hover {
  color: var(--cyan);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
  animation: detailIn .22s ease both;
}

.detail-grid > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

@keyframes detailIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin: 7px 0;
  color: var(--muted);
}

.earlier-grid,
.skills-grid,
.extras-grid {
  display: grid;
  gap: 14px;
}

.earlier-grid {
  grid-template-columns: repeat(2, 1fr);
}

.skills-grid {
  grid-template-columns: repeat(3, 1fr);
}

.extras-grid {
  grid-template-columns: repeat(2, 1fr);
}

.earlier-grid article,
.skills-grid article,
.extras-grid article {
  padding: 22px;
}

.earlier-grid article {
  background: rgba(255, 255, 255, .76);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline article {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.timeline time {
  color: var(--blue);
  font-weight: 900;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  margin: 58px 0;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .09), transparent 45%),
    #fff;
}

.contact h2 {
  max-width: 820px;
  margin-bottom: 8px;
}

.contact p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-list a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--blue);
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 1040px) {
  .hero,
  .project,
  .contact {
    grid-template-columns: 1fr;
  }

  .signal-grid,
  .hero-insights,
  .pipeline,
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-side {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  main {
    width: min(100vw - 28px, var(--max));
  }

  .hero {
    padding-top: 34px;
  }

  .signal-grid,
  .hero-insights,
  .pipeline,
  .detail-grid,
  .earlier-grid,
  .skills-grid,
  .extras-grid,
  .timeline article {
    grid-template-columns: 1fr;
  }

  .pipeline div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pipeline div:last-child {
    border-bottom: 0;
  }

  .pipeline div:not(:last-child)::after {
    top: auto;
    right: 20px;
    bottom: -11px;
    transform: rotate(90deg);
  }

  .project,
  .hero-insights article,
  .terminal-card pre,
  .signal-grid article,
  .earlier-grid article,
  .skills-grid article,
  .extras-grid article {
    padding: 18px;
  }

  .project-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .project-toolbar::before {
    line-height: 1.5;
  }

  h1 {
    font-size: 36px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .hero-actions {
    display: none;
  }

  main {
    width: 100%;
  }

  .section,
  .hero,
  .contact {
    padding: 20px;
    margin: 0;
  }

  .terminal-card,
  .project,
  .signal-grid article,
  .pipeline,
  .earlier-grid article,
  .timeline article,
  .skills-grid article,
  .extras-grid article,
  .contact {
    box-shadow: none;
    break-inside: avoid;
  }
}
