:root {
  --paper: #f4f1ea;
  --ink: #16181d;
  --muted: #5d6068;
  --line: #d9d4c8;
  --grid: rgba(22, 24, 29, 0.05);
  --accent: #e8590c;
  --accent-soft: rgba(232, 89, 12, 0.1);
  --trace: #2f7d5b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121418;
    --ink: #ece9e2;
    --muted: #9a9ca3;
    --line: #2a2d34;
    --grid: rgba(236, 233, 226, 0.04);
    --accent: #ff7a2e;
    --accent-soft: rgba(255, 122, 46, 0.12);
    --trace: #5cc495;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
a { color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
}
nav .wrap { display: flex; justify-content: space-between; align-items: center; height: 56px; }
nav .logo { font-weight: 700; text-decoration: none; letter-spacing: -0.02em; }
nav .logo span { color: var(--accent); }
nav ul { list-style: none; display: flex; gap: 24px; }
nav ul a { text-decoration: none; font-size: 13px; color: var(--muted); }
nav ul a:hover { color: var(--accent); }

/* Hero */
.hero { padding: 96px 0 40px; }
.tag { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--trace); margin-bottom: 28px; }
.tag::before { content: ""; width: 7px; height: 7px; background: var(--trace); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
h1 {
  font-size: clamp(44px, 8vw, 88px); line-height: 0.98;
  letter-spacing: -0.04em; font-weight: 700; max-width: 14ch;
}
h1 em { font-style: normal; color: var(--accent); }
.hero p.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 58ch; margin-top: 24px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  padding: 12px 18px; border: 1.5px solid var(--ink);
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--accent); }

.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px 40px; margin-top: 64px; }
.specs dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.specs dd { font-weight: 500; margin-top: 2px; }

/* Sections: no dividers, the heading carries each transition */
section { padding: 64px 0; }
.sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px; }
.sec-head .num { color: var(--accent); font-size: 13px; }
.sec-head h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.03em; }

/* About */
.about { display: grid; grid-template-columns: 1fr 1.3fr; gap: 48px; align-items: start; }
.about-lead { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; letter-spacing: -0.02em; font-weight: 500; }
.about-body { display: flex; flex-direction: column; gap: 16px; color: var(--muted); font-size: 16.5px; }
.about-off { font-size: 13px; color: var(--trace); }

/* Projects: open rows that alternate image side */
.projects { display: flex; flex-direction: column; gap: 88px; }
.project { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.project:nth-child(even) .visual { order: 2; }

.visual {
  aspect-ratio: 4 / 3; position: relative;
  background: var(--accent-soft);
  display: grid; place-items: center; overflow: hidden;
}
.visual svg { width: 62%; max-width: 300px; height: auto; color: var(--accent); }
.visual img.photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 20px 20px 34px;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.25));
}
.visual .ph {
  position: absolute; bottom: 10px; left: 12px;
  font-size: 10px; color: var(--muted); letter-spacing: .05em;
}

.body { display: flex; flex-direction: column; gap: 12px; }
.meta { display: flex; gap: 20px; font-size: 12px; color: var(--muted); }
.meta .status { color: var(--trace); }
.project h3 { font-size: clamp(24px, 3vw, 30px); letter-spacing: -0.02em; line-height: 1.15; }
.project p { color: var(--muted); font-size: 15.5px; }
.project ul { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.project li { padding-left: 18px; position: relative; }
.project li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.tools { font-size: 12px; color: var(--muted); padding-top: 4px; }
.tools span + span::before { content: " / "; color: var(--accent); }

.more { font-size: 13px; color: var(--accent); text-decoration: none; }
.more:hover { text-decoration: underline; }

/* Timeline */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.cols h3.col-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 20px; }
.timeline { list-style: none; border-left: 1.5px solid var(--line); }
.timeline li { position: relative; padding: 0 0 28px 24px; }
.timeline li::before {
  content: ""; position: absolute; left: -5.5px; top: 7px;
  width: 9px; height: 9px; background: var(--accent);
}
.timeline .role { font-weight: 700; }
.timeline .org { color: var(--muted); font-size: 14px; }
.timeline .when { font-size: 12px; color: var(--trace); margin: 2px 0 6px; }
.timeline p { font-size: 14.5px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.skills h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 12px; }
.skills ul { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15.5px; }

/* Contact */
.contact { text-align: center; padding: 96px 0 112px; }
.contact h2 { font-size: clamp(36px, 6vw, 64px); letter-spacing: -0.04em; line-height: 1; }
.contact p { color: var(--muted); margin: 16px auto 32px; max-width: 48ch; }
.contact .cta { justify-content: center; }
footer { padding: 24px 0 32px; font-size: 12px; color: var(--muted); }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .tag::before { animation: none; }
}

@media (max-width: 760px) {
  nav ul { gap: 14px; }
  nav ul li.hide-sm { display: none; }
  .hero { padding: 64px 0 24px; }
  section { padding: 48px 0; }
  .cols, .about, .project { grid-template-columns: 1fr; }
  .about, .project { gap: 20px; }
  .projects { gap: 56px; }
  .project:nth-child(even) .visual { order: 0; }
  .specs { gap: 16px 32px; }
  .skills { grid-template-columns: repeat(2, 1fr); gap: 28px 20px; }
  .wrap { padding: 0 16px; }
}

/* Project detail pages */
.back { display: block; width: fit-content; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 28px; }
.back:hover { color: var(--accent); }
.page-hero h1 { font-size: clamp(40px, 7vw, 76px); max-width: 16ch; }
.page-hero .visual { margin-top: 56px; aspect-ratio: 21 / 8; }
.page-hero .visual svg { width: 70%; max-width: 640px; }

.prose { max-width: 68ch; color: var(--muted); font-size: 17px; display: flex; flex-direction: column; gap: 16px; }
.prose strong { color: var(--ink); font-weight: 500; }

.flow { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 40px; counter-reset: flow; }
.flow li { position: relative; padding-top: 14px; border-top: 2px solid var(--accent); font-size: 14px; }
.flow li b { display: block; font-size: 15px; margin-bottom: 2px; }
.flow li span { color: var(--muted); font-size: 13px; }
.flow li::before { counter-increment: flow; content: "0" counter(flow); display: block; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--accent); margin-bottom: 6px; }

.subsys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; }
.subsys h3 { font-size: 22px; letter-spacing: -0.02em; margin-bottom: 8px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 10px; display: block; }
.subsys p { color: var(--muted); font-size: 15.5px; }

.parts { width: 100%; border-collapse: collapse; font-size: 15px; }
.parts th { text-align: left; font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 16px 12px 0; }
.parts td { padding: 12px 16px 12px 0; border-top: 1px solid var(--line); vertical-align: top; }
.parts td.used { color: var(--muted); font-size: 13px; }
.parts a { color: var(--accent); text-decoration: none; }
.parts a:hover { text-decoration: underline; }

.build { display: flex; flex-direction: column; gap: 64px; }
.build-step { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; }
.build-step h3 { font-size: clamp(24px, 3vw, 30px); letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 10px; }
.build-step .needs { list-style: none; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.build-step .needs li::before { content: "+ "; color: var(--accent); font-family: "JetBrains Mono", monospace; }
.build-step .summary { color: var(--muted); font-size: 16px; margin-bottom: 20px; }
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; font-size: 15.5px; }
.steps > li::before { content: counter(step, decimal-leading-zero); font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--accent); padding-top: 3px; }
.steps ul { grid-column: 2; list-style: none; margin-top: 6px; color: var(--muted); font-size: 14.5px; display: flex; flex-direction: column; gap: 4px; }
.steps ul li::before { content: "→ "; color: var(--accent); }
.note { margin-top: 20px; font-size: 13px; color: var(--trace); }

.team { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.team b { display: block; }
.team span { color: var(--muted); font-size: 13px; }
.team .me b { color: var(--accent); }

@media (max-width: 760px) {
  .page-hero .visual { aspect-ratio: 16 / 9; margin-top: 36px; }
  .flow { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; }
  .subsys, .build-step { grid-template-columns: 1fr; gap: 20px; }
  .subsys { gap: 36px; }
  .team { grid-template-columns: repeat(2, 1fr); }
  .parts th:nth-child(2), .parts td.used { display: none; }
}
