:root {
  --cream: #e8e6df;
  --cream-dark: #dfddd5;
  --ink: #111;
  --ink-soft: #1a1a1a;
  --ink-60: rgba(17, 17, 17, 0.60);
  --ink-30: rgba(17, 17, 17, 0.30);
  --ink-10: rgba(17, 17, 17, 0.10);
  --accent: #c1272d;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --font-display: 'Instrument Serif', 'EB Garamond', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---------- mini site head ---------- */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  font-family: var(--font-mono);
  background: rgba(232,230,223,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink);
}
.top-nav .nav-home {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}
.top-nav .nav-crumb {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-decoration: none;
}
.top-nav a.nav-crumb:hover { color: var(--accent); }
.top-nav .nav-crumb.is-here { color: var(--ink-60); }
.top-nav .nav-crumb-sep { color: var(--ink-60); font-size: 11px; }
/* Gallery switcher — segmented control so it's obvious there are two
   galleries to flip between. */
.top-nav .nav-switch {
  display: inline-flex;
  border: 1px solid var(--ink);
  flex-shrink: 0;
}
.top-nav .nav-switch-cell {
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink);
  transition: color 0.15s, background-color 0.15s;
}
.top-nav .nav-switch-cell.is-here {
  background: var(--ink);
  color: var(--cream);
  cursor: default;
}
.top-nav a.nav-switch-cell:hover {
  background: var(--accent);
  color: var(--cream);
}
.top-nav .nav-spacer { flex: 1; }
.top-nav .nav-site { display: flex; gap: 12px; }
.top-nav .nav-site a {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-60);
  text-decoration: none;
}
.top-nav .nav-site a:hover { color: var(--accent); }

/* ---------- header ---------- */
.site-head {
  max-width: 1200px;
  margin: 0 auto;
  padding: 9vh 6vw 5vh;
}
.site-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-60);
}
.site-head h1 {
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin: 18px 0 14px;
}
.lead {
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--ink-soft);
}
.lead b { color: var(--ink); font-weight: 600; }

/* ---------- grid ---------- */
.grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 6vw 12vh;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 34px;
}
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

/* ---------- card ---------- */
.card {
  border: 1px solid var(--ink-10);
  border-radius: 16px;
  background: var(--cream-dark);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 50px -20px rgba(13,13,14,0.35);
}

/* preview */
.preview {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  cursor: pointer;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-10);
}
.pv-stage { position: absolute; inset: 0; }

.pv-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  user-select: none;
  will-change: transform, opacity, clip-path;
}
.pv-panel.pv-a { z-index: 2; background: var(--ink); color: var(--cream); }
.pv-panel.pv-b { z-index: 1; background: var(--cream); color: var(--ink); }
.pv-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.55;
}
.pv-label {
  font-size: clamp(1.6rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pv-content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }

.pv-fx { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.pv-fx svg { width: 100%; height: 100%; display: block; }
.pv-fx canvas { width: 100% !important; height: 100% !important; display: block; }

/* play affordance */
.pv-hint {
  position: absolute;
  bottom: 12px; right: 12px;
  z-index: 8;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(250,246,239,0.75);
  background: rgba(13,13,14,0.45);
  padding: 5px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* body */
.card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-name { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.01em; }
.card-zh { font-size: 0.95rem; color: var(--ink-60); }
.card-tagline { color: var(--ink-soft); font-size: 0.98rem; }

.deps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.dep {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--ink-10);
  color: var(--ink-60);
  background: var(--cream);
}

.actions { display: flex; gap: 10px; margin-top: auto; padding-top: 8px; }
button {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  background: var(--cream);
  color: var(--ink);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
button:hover { background: var(--ink-10); }
button.copy { background: var(--ink); color: var(--cream); border-color: var(--ink); }
button.copy:hover { background: var(--ink-soft); }
button.copied { background: var(--accent); border-color: var(--accent); color: #fff; }

/* footer */
.site-foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4vh 6vw 8vh;
  border-top: 1px solid var(--ink-10);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-30);
}

/* toast */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
