/* ================= chrishwang.me — design system =================
   Shell: cash.app-inspired dark. Geist display, Roboto Mono labels.
   Project bands carry their OWN brands: DataChime paper, Hana night. */

:root {
  --bg: #0A0B0D;
  --surface: #101216;
  --ink: #F5F4F0;
  --mute: #8A909C;
  --line: rgba(255, 255, 255, 0.08);

  /* DataChime tokens */
  --dc-paper: #FAFAF8;
  --dc-ink: #0C0D10;
  --dc-mute: #5B616B;
  --dc-line: #E8E6E1;
  --dc-cyan: #06b6d4;

  /* HanaBitcoin tokens */
  --hana-night: #06080d;
  --hana-ink: #f4f1e8;
  --hana-mute: #9aa2b4;
  --hana-btc: #f7931a;
  --hana-gold: #e7c07e;
  --hana-grad: linear-gradient(180deg, #ffc866, #f7931a);

  --sidebar-w: 360px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "Roboto Mono", ui-monospace, "SF Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  font-weight: 500;
}

::selection { background: rgba(6, 182, 212, 0.25); }

/* ================= sidebar ================= */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  z-index: 10;
  background: var(--bg);
}
.sidebar-inner { padding: 56px 44px; width: 100%; }

.avatar-wrap { width: 92px; height: 92px; margin-bottom: 24px; }
.avatar, .avatar-fallback {
  width: 100%; height: 100%;
  border-radius: 28px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--line);
}
.avatar-fallback {
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 30px; letter-spacing: -0.02em;
  color: var(--mute);
}

.side-name {
  font-size: 30px; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 8px;
}
.side-role { color: var(--mute); margin-bottom: 24px; }

.side-about { font-size: 14.5px; color: var(--ink); margin-bottom: 12px; max-width: 34ch; }
.side-about.dim { color: var(--mute); }

.side-tags { color: var(--mute); margin-top: 18px; font-size: 10.5px; }

.side-contacts { display: flex; gap: 10px; margin: 22px 0 30px; }
.contact-btn {
  position: relative;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: none; cursor: pointer;
  color: var(--ink);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.contact-btn svg { width: 18px; height: 18px; }
.contact-btn:hover { background: var(--surface); transform: translateY(-2px); }

.copied-tip {
  position: absolute;
  left: 50%; top: -34px;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink); color: #0A0B0D;
  font-size: 9.5px;
  padding: 5px 10px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap;
}
.contact-btn.copied .copied-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* toggle — segmented pill */
.toggle {
  position: relative;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  background: var(--surface);
}
.toggle-btn {
  position: relative; z-index: 2;
  border: 0; background: none; cursor: pointer;
  color: var(--mute);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 22px; border-radius: 999px;
  transition: color 0.3s var(--ease);
}
.toggle-btn[aria-selected="true"] { color: #0A0B0D; }
.toggle-pill {
  position: absolute; z-index: 1;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: var(--ink);
  border-radius: 999px;
  transition: transform 0.35s var(--ease);
}
body[data-view="projects"] .toggle-pill { transform: translateX(100%); }

.side-foot { color: var(--mute); margin-top: 34px; }

/* ================= main ================= */
.main { margin-left: var(--sidebar-w); }

.view { min-height: 100vh; }
.view[hidden] { display: none; }

/* --- work hero --- */
.hero { position: relative; padding: clamp(90px, 18vh, 190px) 72px 96px; overflow: hidden; }
.hero-inner { position: relative; z-index: 2; max-width: 720px; }

.webgl {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  color: var(--mute);
  margin-bottom: 22px;
}
.tick {
  width: 14px; height: 2px;
  background: var(--ink);
  display: inline-block;
}
.tick-cyan { background: var(--dc-cyan); }

.display {
  font-size: clamp(44px, 5.4vw, 76px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin-bottom: 28px;
}
.hero-sub { font-size: 18px; color: var(--mute); max-width: 52ch; }

/* --- metrics --- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.metric {
  padding: 34px 28px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.metric:last-child { border-right: 0; }
.metric-n {
  font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-l { color: var(--mute); font-size: 10.5px; }

/* --- content blocks --- */
.block { padding: 88px 72px; border-bottom: 1px solid var(--line); max-width: 900px; }
.block h3 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 18px; }
.block p { color: var(--mute); font-size: 16.5px; max-width: 62ch; }
.block em { color: var(--ink); font-style: normal; font-weight: 600; }
.dim { color: var(--mute); font-weight: 500; }

.xp { list-style: none; margin: 8px 0 26px; }
.xp li {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.xp li:last-child { border-bottom: 0; }
.xp-co { font-weight: 600; font-size: 15.5px; }
.xp-t { color: var(--mute); font-size: 14.5px; }
.xp-d { color: var(--mute); font-size: 10.5px; white-space: nowrap; }

/* --- certifications --- */
.certs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin: 4px 0 34px;
}
.certs li {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  transition: background 0.25s var(--ease);
}
.certs li:hover { background: var(--surface); }
.cert-n { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.cert-i { color: var(--mute); font-size: 9.5px; }

/* --- NOW: text left, diagram right --- */
.now {
  max-width: 1320px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 640px);
  gap: 64px;
  align-items: center;
}
.now-copy { min-width: 0; }

/* --- operating model diagram --- */
.om {
  --om-side-w: 190px;
  --om-gap: 24px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px 36px 38px 44px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
}
.om-row {
  display: grid;
  grid-template-columns: 1fr var(--om-side-w);
  align-items: center;
  gap: var(--om-gap);
}
.om-nodes { display: flex; justify-content: center; align-items: flex-start; gap: 44px; }
.om-node { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.om-node figcaption {
  color: var(--mute); font-size: 9px;
  white-space: nowrap; letter-spacing: 0.14em;
}
.om-avatar {
  width: 68px; height: 68px; border-radius: 999px;
  border: 1px solid var(--line); object-fit: cover;
}
.om-bot {
  width: 56px; height: 56px; border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 7px;
  box-sizing: border-box;
}
.bot-res { color: #8FBFB3; }
.bot-vs { color: #A99BD1; }
.bot-priv { color: #C79999; }
.om-side {
  display: flex; flex-direction: column; gap: 5px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}
.om-tag { color: var(--ink); font-size: 10px; }
.om-help { color: var(--mute); font-size: 12.5px; line-height: 1.45; }
.om-link {
  width: 1px; height: 32px;
  margin: 10px auto;
  background: linear-gradient(180deg, var(--line), rgba(255,255,255,0.25), var(--line));
  position: relative;
  /* keep the connector centered over the node column, not the full row */
  transform: translateX(calc((var(--om-side-w) + var(--om-gap)) / -2));
}
.om-link::after {
  content: "";
  position: absolute;
  left: 50%; top: 0;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 999px;
  background: var(--ink);
  opacity: 0;
}

/* one continuous cycle: human -> agents -> systems of record -> back up */
.om-link.l1::after { animation: om-flow-1 6s linear infinite; }
.om-link.l2::after { animation: om-flow-2 6s linear infinite; }
@keyframes om-flow-1 {
  0%   { top: 0; opacity: 0; }
  3%   { opacity: 0.9; }
  20%  { top: calc(100% - 5px); opacity: 0.9; }
  24%  { top: calc(100% - 5px); opacity: 0; }
  100% { top: calc(100% - 5px); opacity: 0; }
}
@keyframes om-flow-2 {
  0%, 26% { top: 0; opacity: 0; }
  29%  { opacity: 0.9; }
  46%  { top: calc(100% - 5px); opacity: 0.9; }
  50%  { top: calc(100% - 5px); opacity: 0; }
  100% { top: calc(100% - 5px); opacity: 0; }
}

/* return path: evidence flows back up to the human */
.om-loop {
  position: absolute;
  left: 20px;
  top: 72px;
  bottom: 66px;
  width: 1px;
  background: linear-gradient(180deg, var(--line), rgba(255,255,255,0.16), var(--line));
}
.om-loop::before, .om-loop::after {
  content: "";
  position: absolute;
}
.om-loop::before {
  /* horizontal stubs at both ends */
  left: 0; top: 0;
  width: 12px; height: 100%;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.om-loop::after {
  left: 0;
  top: 0;
  width: 5px; height: 5px;
  margin-left: -2px;
  border-radius: 999px;
  background: var(--mute);
  opacity: 0;
  animation: om-rise 6s linear infinite;
}
@keyframes om-rise {
  0%, 58% { top: calc(100% - 5px); opacity: 0; }
  62%  { opacity: 0.8; }
  90%  { top: 0; opacity: 0.8; }
  95%  { top: 0; opacity: 0; }
  100% { top: 0; opacity: 0; }
}

/* animated system-of-record glyph */
.om-sor-node { color: var(--mute); }
.sor { width: 46px; height: 46px; }
.sor-row { animation: sor-write 3.2s ease-in-out infinite; }
.sor .r2 { animation-delay: 0.5s; }
.sor .r3 { animation-delay: 1s; }
.sor-d2 .sor-row { animation-delay: 0.9s; }
.sor-d2 .r2 { animation-delay: 1.4s; }
.sor-d2 .r3 { animation-delay: 1.9s; }
.sor-d3 .sor-row { animation-delay: 1.8s; }
.sor-d3 .r2 { animation-delay: 2.3s; }
.sor-d3 .r3 { animation-delay: 2.8s; }
@keyframes sor-write {
  0%, 100% { opacity: 0.35; }
  30% { opacity: 1; }
}
.sor-dot { animation: sor-pulse 3.2s ease-in-out infinite; }
@keyframes sor-pulse {
  0%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.creds { color: var(--mute); margin-bottom: 30px; }

/* --- pills --- */
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 999px;
  padding: 14px 26px;
  font-weight: 600; font-size: 15px;
  text-decoration: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.pill:hover { transform: translateY(-2px); }
.pill .arrow { transition: transform 0.25s var(--ease); }
.pill:hover .arrow { transform: translateX(4px); }

.pill-light { background: var(--ink); color: #0A0B0D; }
.pill-ink { background: var(--dc-ink); color: #FFFFFF; }
.pill-gold {
  background: var(--hana-grad); color: #1a0f00;
  box-shadow: 0 6px 28px rgba(247, 147, 26, 0.28);
}

/* ================= projects view ================= */
.proj-intro { padding: clamp(90px, 18vh, 190px) 72px 96px; max-width: 820px; }

.proj { position: relative; overflow: hidden; padding: 130px 72px; }
.proj-inner { position: relative; z-index: 2; max-width: 680px; }

.proj-title {
  font-size: clamp(36px, 4.2vw, 58px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 24px;
}
.proj-body { font-size: 17px; max-width: 54ch; margin-bottom: 30px; }

.proj-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }

/* — DataChime band: their light paper world — */
.proj-dc { background: var(--dc-paper); color: var(--dc-ink); }
.proj-dc .eyebrow { color: var(--dc-mute); }
.proj-dc .proj-body { color: var(--dc-mute); }
.proj-dc .proj-inner {
  max-width: 1260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 580px);
  gap: 64px;
  align-items: center;
}
.proj-copy { min-width: 0; }
.dc-video-card {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--dc-line);
  box-shadow: 0 24px 60px rgba(12, 13, 16, 0.14);
}
.dc-video-card video { display: block; width: 100%; height: auto; }
.proj-dc .dc-mark { width: 30px; height: 30px; color: var(--dc-ink); }
.dc-word { font-weight: 600; font-size: 19px; letter-spacing: -0.02em; }
.proj-dc ::selection { background: rgba(6, 182, 212, 0.2); }

/* — Hana band: their night world — */
.proj-hana {
  background: var(--hana-night); color: var(--hana-ink);
  border-top: 1px solid rgba(231, 217, 185, 0.1);
  border-bottom: 1px solid rgba(231, 217, 185, 0.1);
}
.proj-hana .proj-inner {
  max-width: 1260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 580px);
  gap: 64px;
  align-items: center;
}
.hana-video-card {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(231, 217, 185, 0.18);
  box-shadow: 0 24px 70px rgba(247, 147, 26, 0.16);
}
.hana-video-card video { display: block; width: 100%; height: auto; }
.proj-hana .proj-body { color: var(--hana-mute); }
.kicker-gold { color: var(--hana-gold) !important; }
.hana-mark { width: 30px; height: 30px; }
.hana-word { font-weight: 500; font-size: 19px; letter-spacing: -0.02em; color: var(--hana-ink); }
.hana-word b {
  background: var(--hana-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
.hana-pair { font-size: 19px; font-weight: 600; margin-bottom: 18px; }
.hana-pair .kr { color: var(--hana-gold); font-weight: 500; word-break: keep-all; }
.proj-stack { color: var(--hana-mute); margin-bottom: 30px; }

/* — closer — */
.proj-more { border-bottom: 1px solid var(--line); }
.proj-more .proj-body { color: var(--mute); }

/* ================= footer ================= */
.foot {
  display: flex; justify-content: space-between;
  padding: 36px 72px;
  color: var(--mute);
}

/* ================= reveal animation ================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }

/* ================= responsive ================= */
@media (max-width: 1420px) {
  .now { grid-template-columns: 1fr; gap: 36px; }
  .now .om { max-width: 640px; }
}
@media (max-width: 1180px) {
  .proj-dc .proj-inner { grid-template-columns: 1fr; gap: 36px; }
  .dc-video-card { max-width: 620px; }
  .proj-hana .proj-inner { grid-template-columns: 1fr; gap: 36px; }
  .hana-video-card { max-width: 620px; }
}
@media (max-width: 1080px) {
  .webgl { opacity: 0.45; }
  .om { padding: 26px 20px; }
  .om-row { grid-template-columns: 1fr; gap: 14px; }
  .om-side { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; align-items: center; text-align: center; }
  .om-link { transform: none; }
  .om-loop { display: none; }
  .om-nodes { gap: 20px; }
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-inner { padding: 44px 28px 36px; }
  .main { margin-left: 0; }
  .hero, .proj-intro { padding: 72px 28px; }
  .block, .proj { padding: 72px 28px; }
  .foot { padding: 28px; }
  .xp li { grid-template-columns: 1fr; gap: 2px; }
}

/* ================= reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .webgl { display: none; }
  .om-link::after, .om-loop::after, .sor-row, .sor-dot { animation: none; }
  .hero { background: radial-gradient(ellipse 70% 60% at 70% 30%, rgba(255,255,255,0.04), transparent); }
  .proj-dc { background: linear-gradient(160deg, #FFFFFF, var(--dc-paper)); }
  .proj-hana { background: radial-gradient(ellipse 60% 50% at 70% 40%, rgba(247,147,26,0.08), var(--hana-night)); }
}
