:root {
  --bg: #f1efe8;
  --ink: #16161d;
  --muted: #8f8b7c;
  --pill-bg: #efe8d2;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Space Mono", monospace;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4rem 3.2rem;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}
.header-left { display: flex; gap: 2rem; align-items: baseline; }
.brand { font-weight: 700; }
.role { color: var(--muted); }
.header-nav { display: flex; gap: 2.4rem; }
.header-nav a { color: var(--ink); text-decoration: none; }
.header-nav a:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 3rem;
  padding: 5.5rem 3.2rem 7rem;
  flex-wrap: wrap;
}
.hero-intro p:first-child {
  font-size: 1.35rem;
  color: #6d6a5e;
  line-height: 1.5;
}
.hero-intro strong { color: var(--ink); }
.hero-serif {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 1.7rem;
  margin-top: 0.4rem;
  color: var(--ink);
}
.hero-history { min-width: 30rem; padding-top: 0.4rem; }
.history-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 2rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  padding: 0.35rem 0;
}
.history-row .year { color: #9c9889; }
.history-row .position { text-align: right; }

/* ---------- 3D shelf ---------- */
.shelf {
  position: relative;
  height: 92vh;
  min-height: 560px;
  overflow: hidden;
}
.shelf-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.55s ease;
  pointer-events: none;
}
.bg-default   { background: #f0eee6; opacity: 1; }
.bg-projects  { background: linear-gradient(170deg, #c08a64 0%, #a06a47 100%); }
.bg-brandings { background: linear-gradient(170deg, #a2a763 0%, #8f9552 100%); }
.bg-fun       { background: linear-gradient(170deg, #1d2ed6 0%, #1120b4 100%); }
.bg-cv        { background: linear-gradient(170deg, #d4ca6c 0%, #c2b755 100%); }

.shelf[data-state="projects"]  .bg-projects,
.shelf[data-state="brandings"] .bg-brandings,
.shelf[data-state="fun"]       .bg-fun,
.shelf[data-state="cv"]        .bg-cv { opacity: 1; }

.shelf-copy {
  position: absolute;
  top: 9%;
  width: 100%;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}
.shelf-caption,
.shelf-title {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.shelf-caption {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
}
.shelf-title {
  position: absolute;
  top: 0;
  width: 100%;
  font-size: 1.9rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
}
.shelf:not([data-state="default"]) .shelf-caption { opacity: 0; transform: translateY(-8px); }
.shelf:not([data-state="default"]) .shelf-title   { opacity: 1; transform: translateY(0); }

.shelf-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.shelf-canvas canvas { display: block; }
.shelf-canvas.book-hover { cursor: pointer; }

.shelf-hint {
  position: absolute;
  bottom: 1.2rem;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.35);
  z-index: 2;
  pointer-events: none;
  transition: color 0.4s ease;
}
.shelf:not([data-state="default"]) .shelf-hint { color: rgba(255, 255, 255, 0.5); }

/* ---------- works ---------- */
.works { padding: 5rem 3.2rem 6rem; }
.works-heading { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.8rem; }

.filters { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 2.4rem; }
.filter {
  font-family: "Space Mono", monospace;
  font-size: 0.9rem;
  padding: 0.55rem 1.6rem;
  border-radius: 999px;
  border: 1px solid #c9c5b6;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.filter:hover { background: rgba(0, 0, 0, 0.05); }
.filter.active { background: #16233c; border-color: #16233c; color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.4rem 2rem;
}
.card { cursor: none; }
.card.hidden { display: none; }
.thumb {
  aspect-ratio: 6 / 5;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-ctrlu    { background: #82c8f5; }
.thumb-survey   { background: linear-gradient(150deg, #c74fe0 0%, #8c1fb4 100%); }
.thumb-martian  { background: linear-gradient(150deg, #57c96b 0%, #2a3f8f 100%); }
.thumb-coding   { background: linear-gradient(150deg, #3d43b8 0%, #23277a 100%); }
.thumb-touchbiz { background: linear-gradient(150deg, #90c944 0%, #1f7a5c 100%); }

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  line-height: 1.45;
}
.card-sub { color: #a09c8d; text-align: right; }

/* ---------- cursor pill ---------- */
.cursor-pill {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  background: var(--pill-bg);
  color: #4a4738;
  font-size: 0.95rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}
.cursor-pill.visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.pill-icon { width: 1.1rem; height: 1.1rem; display: none; }
.cursor-pill[data-mode="view"] .icon-eye,
.cursor-pill[data-mode="locked"] .icon-lock { display: block; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .site-header, .hero, .works { padding-left: 1.4rem; padding-right: 1.4rem; }
  .hero { padding-top: 3rem; padding-bottom: 4rem; }
  .hero-history { min-width: 0; width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .role { display: none; }
  .card { cursor: pointer; }
}
