/* Projects / Bento section */

.projects{
  position: relative;
  z-index: 3;
  padding: 88px var(--pad-x) 96px;
  max-width: var(--maxw);
  margin: 0 auto;
  border-top: 1px solid var(--border-soft);
}
.pj-head{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: clamp(20px, 4vw, 60px);
  margin-bottom: 56px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-soft);
}
.pj-eyebrow{
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
}
.pj-eyebrow .serif{ color: var(--accent); font-size: 1.05em; }
.pj-intro{
  margin: 0;
  max-width: 36ch;
  font-size: 13.5px;
  color: var(--fg-2);
  line-height: 1.55;
  text-align: right;
  justify-self: end;
}

/* Bento grid */
.pj-bento{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 14px;
}
.pj-bento > .pj:nth-child(1){ grid-column: 1 / span 2; grid-row: 1 / span 2; }
.pj-bento > .pj:nth-child(2){ grid-column: 3;          grid-row: 1; }
.pj-bento > .pj:nth-child(3){ grid-column: 4;          grid-row: 1; }
.pj-bento > .pj:nth-child(4){ grid-column: 1 / -1;     grid-row: 3; }
.pj-bento > .pj:nth-child(5){ grid-column: 3;          grid-row: 2; }
.pj-bento > .pj:nth-child(6){ grid-column: 4;          grid-row: 2; }

/* Card — deeper, more depth */
.pj{
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  background:
    linear-gradient(180deg, var(--bg-3) 0%, var(--bg-1) 100%);
  overflow: hidden;
  isolation: isolate;
  transition: border-color .4s ease, transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s ease;
  opacity: 0; transform: translateY(14px);
  animation: pj-rise 1s cubic-bezier(.2,.7,.2,1) both;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 12px 30px -16px rgba(0,0,0,0.7);
}
.pj-lg{ min-height: 380px; }
.pj-wd{ min-height: 200px; }
@keyframes pj-rise{
  to { opacity: 1; transform: translateY(0); }
}
.pj:hover{
  border-color: rgba(168,85,247,0.45);
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 18px 40px -16px rgba(0,0,0,0.85),
    0 0 0 1px rgba(168,85,247,0.15);
}

.pj-glow{
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
                              rgba(168,85,247,0.14), transparent 60%);
}
.pj.is-hover .pj-glow{ opacity: 1; }

.pj-h, .pj-body, .pj-f{ position: relative; z-index: 2; }

.pj-h{
  display: flex; justify-content: space-between;
  margin-bottom: 12px;
}

.pj-body{ flex: 1; display: flex; flex-direction: column; min-height: 0; }

.pj-cat{
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.pj-name{
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 8px;
  color: var(--fg);
  text-wrap: balance;
}
.pj-lg .pj-name{ font-size: clamp(1.5rem, 2.2vw, 1.95rem); }
.pj-wd .pj-name{ font-size: clamp(1.25rem, 1.8vw, 1.6rem); }

.pj-desc{
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 0 0 14px;
  max-width: 42ch;
}
.pj-lg .pj-desc{ font-size: 13.5px; max-width: 50ch; margin-bottom: 18px; }

/* Widget container */
.pj-widget{
  flex: 1;
  display: flex;
  align-items: stretch;
  margin-bottom: 14px;
  min-height: 0;
}

.pj-metrics{
  display: flex; gap: 24px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
  flex-wrap: wrap;
}
.pj-metric{ display: flex; flex-direction: column; gap: 3px; }
.pj-metric-v{
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1;
}
.pj-metric-k{
  font-size: 9.5px;
  color: var(--fg-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pj-f{
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.pj-tags{ display: flex; gap: 5px; flex-wrap: wrap; }
.pj-tag{
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255,255,255,0.025);
  color: var(--fg-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pj-cta{
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  color: var(--fg-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .3s ease, transform .3s ease;
}
.pj:hover .pj-cta{ color: var(--accent); transform: translateX(2px); }
.pj:hover .pj-cta svg{ transform: translate(2px,-2px); }
.pj-cta svg{ transition: transform .3s ease; }

/* ───────── Widgets ───────── */
.wg{
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  overflow: hidden;
  min-height: 110px;
}
.wg-head{
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.02);
}
.wg-dot{
  display: inline-block; width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  box-shadow: 0 0 6px rgba(168,85,247,0.7);
  animation: wg-blink 1.5s ease-in-out infinite;
}
@keyframes wg-blink{ 50%{ opacity: 0.4; } }

/* Pipeline */
.wg-pipeline{ min-height: 180px; }
.wg-pipe{
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 12px 8px;
  align-items: end;
}
.wg-pipe-col{
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.wg-pipe-bar{
  position: relative;
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 16px;
  transition: height .8s cubic-bezier(.4,0,.2,1);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 4px;
}
.wg-pipe-n{
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: rgba(0,0,0,0.85);
  font-weight: 600;
  background: rgba(255,255,255,0.95);
  padding: 1px 5px;
  border-radius: 3px;
}
.wg-pipe-k{
  font-size: 9px;
  color: var(--fg-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Latency */
.wg-latency{ min-height: 110px; }
.wg-map{ flex: 1; width: 100%; }
.wg-lat-bar{
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  background: rgba(0,0,0,0.3);
}
.wg-lat-v{
  font-family: 'Geist', sans-serif;
  font-size: 18px;
  color: var(--fg);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.wg-lat-v .small{ font-size: 10px; margin-left: 2px; }

/* Flow */
.wg-flow{ min-height: 110px; padding: 6px; }
.wg-flow-svg{ flex: 1; width: 100%; height: 100%; }

/* Treasury */
.wg-treasury{
  min-height: 130px;
  position: relative;
  cursor: crosshair;
}
.wg-tr-svg{ flex: 1; width: 100%; height: 100%; padding: 8px; }
.wg-tr-cursor{
  position: absolute;
  top: 8px; bottom: 32px;
  width: 1px;
  background: rgba(168,85,247,0.6);
  pointer-events: none;
  transition: left .15s ease;
}
.wg-tr-tooltip{
  position: absolute;
  bottom: 8px;
  transform: translateX(-50%);
  display: flex; gap: 8px; align-items: baseline;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(10,10,12,0.9);
  border: 1px solid var(--border-soft);
  pointer-events: none;
  white-space: nowrap;
  transition: left .15s ease;
}
.wg-tr-v{
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* Cohort */
.wg-cohort{ min-height: 110px; padding: 6px; }
.wg-cohort-svg{ flex: 1; width: 100%; height: 100%; }

/* Lab */
.wg-lab{ min-height: 130px; padding: 6px; }
.wg-lab-svg{ flex: 1; width: 100%; height: 100%; }

/* Responsive */
@media (max-width: 920px){
  .projects{ padding: 80px 20px 100px; }
  .pj-head{ grid-template-columns: 1fr; gap: 16px; margin-bottom: 36px; }
  .pj-intro{ text-align: left; justify-self: start; }
  .pj-bento{ grid-template-columns: 1fr; grid-auto-rows: auto; }
  .pj-bento > .pj{ grid-column: 1 !important; grid-row: auto !important; min-height: 280px; }
}
