/* ------------------------------------------------------------------
   Personal site — black & white, mono / editorial
   Type and art never overlap: clean bars, full-strength painting bands.
   Font: Geist Mono. Art: Henri Rousseau, 1891 (public domain).
------------------------------------------------------------------- */

:root {
  --ink: #111111;
  --body: #4a4a4a;
  --paper: #ffffff;
  --muted: #8a8a8a;
  --rule: #ececec;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.jungle-scene {
  width: 100vw;
  height: 320px;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  background: #ffffff;
}

.jungle-scene canvas,
.jungle-scene svg,
.scene-react-root {
  display: block;
  width: 100%;
  height: 100%;
}

.sprite-image {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.wrap {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Top bar: name + nav, clean white, no overlays --- */
.top { border-bottom: 1px solid var(--rule); }

.top-inner {
  max-width: 840px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.brand {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.top nav {
  display: flex;
  gap: 22px;
  font-size: 13.5px;
}

.top nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.top nav a:hover,
.top nav a.active { border-bottom-color: var(--ink); }

/* --- Paintings: full canvas, full color, rotating gallery --- */
.gallery {
  width: 100%;
  margin: 34px 0 0;
  overflow: hidden;
  border-block: 1px solid var(--rule);
  background: var(--paper);
  position: relative;
}

.gallery-label {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 100%;
  padding: 12px 24px;
  color: var(--ink);
  font-size: 12px;
  background: var(--paper);
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.gallery-viewport {
  overflow: hidden;
  overflow-y: hidden;
}

.gallery-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: max-content;
  padding: 0;
  will-change: transform;
  animation: gallery-drift 420s linear infinite;
}

@keyframes gallery-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-33.3333%, 0, 0); }
}

.gallery-slide {
  flex: 0 0 clamp(160px, 20vw, 260px);
  margin: 0;
}

.gallery-slide img {
  display: block;
  width: 100%;
  height: 185px;
  object-fit: cover;
  background: var(--paper);
  border: 0;
}

.gallery-slide figcaption {
  min-height: 42px;
  padding: 8px 10px 10px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

.gallery-slide figcaption span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

/* --- Type --- */
main { padding: 48px 0 8px; }

h1 {
  color: var(--ink);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.25;
  margin: 0 0 26px;
  letter-spacing: -0.03em;
}

h2 {
  color: var(--ink);
  font-weight: 600;
  font-size: 20px;
  margin: 40px 0 12px;
  letter-spacing: -0.02em;
}

p { margin: 0 0 18px; }

.post-meta {
  color: var(--muted);
  font-size: 13px;
}

.post-page {
  padding-bottom: 60px;
}

.beach-bug-page .wrap,
.beach-bug-page .top {
  position: relative;
  z-index: 2;
}

.scarab-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.scarab-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(64px, calc((100vw - 840px) / 2), 170px);
  min-width: 64px;
}

.scarab-rail-left { left: 0; }
.scarab-rail-right { right: 0; }

.scarab {
  position: absolute;
  top: -120px;
  left: 0;
  width: 48px;
  height: 64px;
  opacity: 0.58;
  transform-origin: center;
  animation: scarab-walk-down var(--scarab-duration, 28s) linear infinite;
  animation-delay: var(--scarab-delay, 0s);
  will-change: transform;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.scarab-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  shape-rendering: crispEdges;
}

.scarab-svg rect {
  shape-rendering: crispEdges;
}

.scarab-shadow-pixel {
  fill: rgba(17, 17, 17, 0.09);
}

.scarab-black,
.scarab-legs rect,
.scarab-antennae rect {
  fill: #111111;
}

.scarab-mid {
  fill: #2f2f2f;
}

.scarab-light {
  fill: #dcdcdc;
}

.scarab-cut {
  fill: #f7f7f7;
}

.scarab-legs-left {
  transform-origin: 8px 12px;
  animation: scarab-left-legs 360ms steps(2, end) infinite;
}

.scarab-legs-right {
  transform-origin: 10px 12px;
  animation: scarab-right-legs 360ms steps(2, end) infinite;
}

@keyframes scarab-walk-down {
  from {
    transform:
      translate3d(var(--scarab-x, 20px), -130px, 0)
      rotate(var(--scarab-tilt, 0deg))
      scale(var(--scarab-scale, 0.72));
  }
  45% {
    transform:
      translate3d(calc(var(--scarab-x, 20px) + var(--scarab-drift, 8px)), 45vh, 0)
      rotate(var(--scarab-tilt-opposite, 0deg))
      scale(var(--scarab-scale, 0.72));
  }
  to {
    transform:
      translate3d(var(--scarab-x, 20px), calc(100vh + 140px), 0)
      rotate(var(--scarab-tilt, 0deg))
      scale(var(--scarab-scale, 0.72));
  }
}

@keyframes scarab-left-legs {
  50% { transform: translate3d(1px, 1px, 0); }
}

@keyframes scarab-right-legs {
  50% { transform: translate3d(-1px, -1px, 0); }
}

strong {
  font-weight: 500;
  color: var(--ink);
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #c9c9c9;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-color: var(--ink); }

.reveal-ready .copy-reveal {
  opacity: 0;
  transform: translateY(5px);
  clip-path: inset(0 0 100% 0);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    clip-path 220ms steps(4, end);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal-ready .copy-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  clip-path: inset(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ready .copy-reveal {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }
}

.conversation {
  margin: 22px 0 0;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  position: relative;
}

.chat-prompt {
  color: var(--ink);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--paper);
  padding-bottom: 8px;
  z-index: 1;
}

.chat-log {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
}

.message {
  border-left: 2px solid var(--rule);
  padding-left: 12px;
}

.message.user {
  color: var(--ink);
}

.message.assistant {
  color: var(--body);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-form input,
.chat-form button {
  font: inherit;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 11px;
}

.chat-form input:focus,
.chat-form button:focus {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.chat-form button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Writings + projects --- */
.post-list { list-style: none; padding: 0; margin: 0 0 48px; }

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.post-list .date {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.project-list {
  display: grid;
  gap: 0;
  margin: 0 0 48px;
}

.project-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.project-item h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.project-item p {
  max-width: 660px;
  margin-bottom: 0;
}

.project-item > a,
.project-status {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.music-page {
  padding-bottom: 36px;
}

.music-intro {
  color: var(--muted);
  margin-top: -12px;
}

.music-section {
  margin: 36px 0 0;
}

.music-section h2 {
  margin-bottom: 14px;
}

.music-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.music-card {
  min-width: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 12px;
}

.music-art {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 12px;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    #f7f7f7;
  background-size: 12px 12px;
  color: var(--ink);
  text-align: center;
  border: 1px solid var(--rule);
}

.music-art span {
  max-width: 88%;
  font-size: 11px;
  line-height: 1.25;
}

.music-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-card h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}

.music-card p {
  margin-bottom: 0;
  font-size: 12.5px;
  line-height: 1.45;
}

/* --- Footer: clean white, hairline rules --- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 36px;
}

.site-footer-inner {
  max-width: 840px;
  margin: 0 auto;
  padding: 22px 24px 48px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.site-footer a { color: var(--ink); }

.credit {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 480px) {
  h1 { font-size: 23px; }
  .jungle-scene { height: 220px; }
  .gallery-label { padding-inline: 18px; }
  .gallery-slide { flex-basis: 46vw; }
  .gallery-slide img { height: 135px; }
  main { padding-top: 36px; }
  .top-inner { align-items: flex-start; }
  .top nav { gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
  .chat-form { grid-template-columns: 1fr; }
  .project-item { grid-template-columns: 1fr; gap: 8px; }
  .music-grid { grid-template-columns: 1fr; }
  .scarab-field { display: none; }
}

@media (max-width: 1020px) {
  .scarab {
    opacity: 0.28;
    width: 42px;
    height: 55px;
  }
}
