/* ── Jack Qiu — jackqiu.dev ─────────────────────────────────────────
   Engineering-drawing aesthetic: vellum grid, ink lines, safety orange.
   Dark mode = blueprint. */

:root {
  --paper: #f4f1ea;
  --paper-2: #ece8de;
  --ink: #1c1f26;
  --ink-soft: #4b505c;
  --line: #b9b3a4;
  --line-soft: #d6d1c4;
  --accent: #e05c1f;          /* safety orange */
  --accent-soft: #e05c1f22;
  --grid: #00000009;
  --grid-major: #00000012;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1a2b;         /* blueprint navy */
    --paper-2: #12213655;
    --ink: #dfe8f2;
    --ink-soft: #9fb2c8;
    --line: #3a5271;
    --line-soft: #24374f;
    --accent: #ff8a3d;
    --accent-soft: #ff8a3d26;
    --grid: #ffffff08;
    --grid-major: #ffffff10;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 8px 8px, 8px 8px, 40px 40px, 40px 40px;
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  line-height: 1.55;
  font-size: 16px;
}
.mono, .overline, .sec-label, .readout, .arm-note, .title-block, .spec dt,
.bom table, .bom-note, .colophon, .loop, .build-link, .hero-links a {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

/* ── Sheet frame ── */
.sheet {
  max-width: 1100px;
  margin: 24px auto 48px;
  border: 2px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  padding: clamp(20px, 4vw, 56px);
  position: relative;
  background: transparent;
}
.zone-ticks { position: absolute; display: flex; justify-content: space-around;
  color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.zone-top { top: -22px; left: 0; right: 0; }
.zone-left { left: -20px; top: 0; bottom: 0; flex-direction: column; align-items: center; }
@media (max-width: 1180px) { .zone-ticks { display: none; } }

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  padding-bottom: 140px;  /* room for title block */
  position: relative;
}
.overline { font-size: 12px; letter-spacing: .08em; color: var(--ink-soft); margin: 0 0 8px; }
.hero h1 {
  font-size: clamp(64px, 11vw, 128px);
  line-height: .9;
  margin: 0 0 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tagline { max-width: 46ch; font-size: 18px; margin: 0 0 24px; position: relative; padding-top: 18px; }
.tagline em { font-style: normal; color: var(--accent); font-weight: 600; }
.dim-line {
  position: absolute; top: 0; left: 0; width: 120px; height: 10px;
  border-left: 1px solid var(--ink-soft); border-right: 1px solid var(--ink-soft);
}
.dim-line::before {
  content: ""; position: absolute; left: 0; right: 0; top: 4px;
  border-top: 1px solid var(--ink-soft);
}
.hero-links { display: flex; gap: 20px; flex-wrap: wrap; }
.hero-links a, .build-link, .contact-links a {
  color: var(--ink); text-decoration: none; font-size: 14px;
  border-bottom: 1.5px solid var(--accent); padding-bottom: 1px;
}
.hero-links a:hover, .build-link:hover, .contact-links a:hover { color: var(--accent); }

/* ── Arm panel ── */
.arm-panel {
  margin: 0; border: 1px solid var(--line);
  background: var(--paper-2);
  padding: 12px;
  user-select: none;
}
.arm-panel svg { width: 100%; height: auto; display: block; touch-action: none; cursor: crosshair; }
.envelope { fill: none; stroke: var(--line); stroke-dasharray: 4 6; }
.arm-base rect { fill: none; stroke: var(--ink); stroke-width: 2; }
.arm-base line { stroke: var(--ink-soft); stroke-width: 1.5; }
.link { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }
.joint { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.effector { fill: var(--accent); stroke: none; }
.target line, .target circle { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.readout {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft); margin-top: 10px;
}
.readout b { color: var(--accent); font-weight: 600; min-width: 5ch; display: inline-block; }
.arm-note { font-size: 10px; letter-spacing: .06em; color: var(--ink-soft); margin-top: 8px; }

/* ── Title block ── */
.title-block {
  position: absolute; right: 0; bottom: 0;
  display: grid; grid-template-columns: auto repeat(4, auto);
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 12px;
}
.tb-photo {
  grid-row: 1 / span 3; border: 1px solid var(--ink); padding: 3px;
  display: flex; align-items: stretch;
}
.tb-photo img {
  width: 76px; height: 100%; object-fit: cover; display: block;
  filter: saturate(.85) contrast(1.05);
}
.tb-cell { border: 1px solid var(--ink); padding: 6px 12px 5px; white-space: nowrap; }
.tb-cell span { display: block; font-size: 9px; color: var(--ink-soft); letter-spacing: .08em; }
.tb-wide { grid-column: span 3; color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-bottom: 24px; }
  .title-block { position: static; margin-top: 24px; grid-template-columns: repeat(2, 1fr); }
  .tb-cell { white-space: normal; }
  .tb-wide { grid-column: span 2; }
}

/* ── Section labels ── */
section, footer.contact { margin-top: 72px; }
.sec-label {
  font-size: 13px; letter-spacing: .14em; font-weight: 600;
  display: flex; align-items: center; gap: 12px; margin: 0 0 28px;
}
.sec-label::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.sec-no { color: var(--accent); }

/* ── Process loop ── */
.loop {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px 0; align-items: center;
  font-size: 14px; font-weight: 500;
}
.loop li {
  border: 1.5px solid var(--ink); padding: 8px 14px; background: var(--paper);
  position: relative;
}
.loop li:not(:last-child) { margin-right: 34px; }
.loop li:not(:last-child)::after {
  content: "→"; color: var(--accent);
  position: absolute; right: -28px; top: 50%; transform: translateY(-50%);
}
.loop li:last-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.loop-note { max-width: 60ch; color: var(--ink-soft); margin-top: 20px; }

/* ── Builds ── */
.builds .build {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 12px 40px;
}
.build header { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.build h3 { margin: 0; font-size: 26px; }
.build-sub { margin: 0; color: var(--ink-soft); font-size: 15px; }
.build p { margin: 0; max-width: 62ch; }
.spec { margin: 0; align-self: start; border: 1px solid var(--line); background: var(--paper-2); font-size: 12.5px; }
.spec > div { display: grid; grid-template-columns: 56px 1fr; border-bottom: 1px solid var(--line-soft); }
.spec > div:last-child { border-bottom: none; }
.spec dt { padding: 7px 10px; color: var(--accent); font-weight: 600; border-right: 1px solid var(--line-soft); }
.spec dd { margin: 0; padding: 7px 10px; }
.build-link { font-size: 13px; justify-self: start; }
@media (max-width: 760px) { .builds .build { grid-template-columns: 1fr; } }

/* ── Prior art plates ── */
.prior-note { max-width: 62ch; color: var(--ink-soft); margin: -8px 0 28px; }
.prior-note a { color: var(--ink); border-bottom: 1.5px solid var(--accent); text-decoration: none; padding-bottom: 1px; }
.prior-note a:hover { color: var(--accent); }
.plates {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px;
}
.plate {
  margin: 0; border: 1px solid var(--line); background: var(--paper-2); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.plate img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border: 1px solid var(--line);
}
.plate figcaption {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; line-height: 1.55; color: var(--ink-soft);
}
.plate figcaption b { color: var(--accent); font-weight: 600; }
@media (max-width: 760px) { .plates { grid-template-columns: 1fr; } }

/* ── BOM ── */
.bom-scroll { overflow-x: auto; border: 2px solid var(--ink); }
.bom table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 640px; }
.bom th, .bom td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.bom thead th {
  background: var(--ink); color: var(--paper);
  font-size: 11px; letter-spacing: .1em; border-color: var(--ink);
}
.bom td:first-child, .bom td:last-child { color: var(--accent); white-space: nowrap; }
.bom-note { font-size: 11px; letter-spacing: .05em; color: var(--ink-soft); margin-top: 12px; }

/* ── Contact ── */
.contact p { max-width: 56ch; font-size: 18px; }
.contact em { font-style: normal; color: var(--accent); font-weight: 600; }
.contact-links { display: flex; gap: 24px; flex-wrap: wrap; margin: 24px 0 48px; font-size: 15px; }
.colophon {
  font-size: 10.5px; letter-spacing: .05em; color: var(--ink-soft);
  border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 0;
}
