/* "Explore my work" workbench. Loaded only on /explore/.
   Default rules (no JS, or List view) render a plain grid of project notes.
   `.bench-ready` (added by js/explore.js) switches on the spatial workbench. */

:root {
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bench-line: #c9cfbf;
  --bench-grid: rgba(69, 92, 71, 0.07);
  --shadow-lift: 0 14px 30px -20px rgba(40, 45, 39, 0.45);
}

.explore-page .container {
  width: min(1160px, calc(100% - 64px));
}
.explore-head {
  max-width: 680px;
}
.explore-head h1 {
  margin-bottom: 16px;
}
.explore-head .index-intro {
  margin-bottom: 28px;
}

/* ---------- toolbar ---------- */
.bench-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 8px;
}
.bench-filters,
.bench-mode,
.bench-zoom,
.bench-view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bench-view-controls {
  gap: 8px 20px;
}
.bench-zoom[hidden],
.bench-view-controls[hidden] {
  display: none;
}
.bench-toolbar button,
.bench-panel button {
  font: 14px/1.3 var(--sans);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--paper);
  transition:
    background-color 160ms,
    color 160ms,
    transform 200ms var(--ease-out);
}
.bench-toolbar button:hover,
.bench-panel button:hover {
  background: var(--sage-soft);
}
.bench-toolbar button[aria-pressed="true"] {
  background: var(--sage);
  color: var(--paper);
}
.bench-toolbar button:active,
.bench-panel button:active {
  transform: translateY(1px);
}
.bench-zoom button[data-zoom="in"],
.bench-zoom button[data-zoom="out"] {
  min-width: 44px;
  font-size: 18px;
  padding: 4px 0;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.bench-toolbar {
  margin-bottom: 16px;
}
.bench-status {
  min-height: 1.5em;
  margin: 4px 0 12px;
  font: 13px/1.5 var(--sans);
  color: var(--muted);
}

/* ---------- list layout (no JS and List view) ---------- */
.bench-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}
.bench-item {
  min-width: 0;
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}
.bench-item .bench-object,
.bench-zones,
.bench-links,
.bench-hint {
  display: none;
}
.bench-tags {
  margin: 0 0 4px;
  font: 13px/1.5 var(--sans);
  color: var(--muted);
}
.bench-title {
  font-size: 22px;
  margin-bottom: 8px;
}
.bench-title a {
  text-decoration: none;
}
.bench-title a:hover {
  text-decoration: underline;
}
.bench-detail p {
  margin-bottom: 10px;
}
.bench-detail .compact-meta {
  display: block;
}
.bench-evidence {
  font: 600 14px/1.55 var(--sans);
}
.bench-caveat {
  font: 14px/1.55 var(--sans);
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 12px;
}
.bench-figure {
  margin: 12px 0;
}
.bench-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #161a16;
}
.bench-figure figcaption {
  margin-top: 6px;
  font: 12px/1.5 var(--sans);
  color: var(--muted);
}
.bench-item:target {
  background: linear-gradient(var(--sage-soft), var(--sage-soft)) no-repeat 0 0 / 3px 100%;
  padding-left: 16px;
}

/* ---------- spatial workbench ---------- */
.bench-ready .bench:not(.is-list) {
  position: relative;
  height: clamp(520px, 72vh, 760px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--bench-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bench-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.bench-ready .bench:not(.is-list) .bench-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.bench-ready .bench:not(.is-list) .bench-viewport.is-dragging {
  cursor: grabbing;
}
.bench-ready .bench:not(.is-list) .bench-plane {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 820px;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 0;
  transition: opacity 320ms var(--ease-out);
}
.bench-ready .bench.is-ready:not(.is-list) .bench-plane {
  opacity: 1;
}
.bench-ready .bench:not(.is-list) .bench-zones,
.bench-ready .bench:not(.is-list) .bench-links {
  display: block;
  position: absolute;
  inset: 0;
  width: 1200px;
  height: 820px;
  pointer-events: none;
}
.bench-zone {
  position: absolute;
  border: 1px dashed var(--bench-line);
  border-radius: 16px;
  transition: opacity 280ms var(--ease-out);
}
.bench-zone span {
  position: absolute;
  top: -12px;
  left: 18px;
  padding: 0 8px;
  background: var(--paper);
  font: italic 16px/1.4 var(--serif);
  color: var(--muted);
}
.bench-zone.is-muted {
  opacity: 0.25;
}
.bench-link path {
  fill: none;
  stroke: #b7bfab;
  stroke-width: 1.25;
  stroke-dasharray: 4 5;
  transition: stroke 200ms;
}
.bench-link text {
  font: 12px/1 var(--sans);
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
}
.bench-link.is-lit path {
  stroke: var(--sage);
  stroke-width: 1.75;
  stroke-dasharray: none;
}
.bench-link.is-lit text {
  fill: var(--sage-hover);
}
.bench-link {
  transition: opacity 280ms var(--ease-out);
}
.bench-link.is-muted {
  opacity: 0.12;
}

.bench-ready .bench:not(.is-list) .bench-items {
  display: block;
  position: absolute;
  inset: 0;
}
.bench-ready .bench:not(.is-list) .bench-item {
  position: absolute;
  width: 190px;
  padding: 0;
  border: 0;
  transition:
    opacity 280ms var(--ease-out),
    filter 280ms var(--ease-out);
}
.bench-ready .bench:not(.is-list) .bench-item > .bench-detail {
  display: none;
}
.bench-ready .bench:not(.is-list) .bench-object {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 10px 12px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  /* Opaque so connector lines (centre to centre) pass under the cards. */
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    transform 320ms var(--ease-out),
    box-shadow 320ms var(--ease-out),
    border-color 200ms,
    background-color 200ms;
}
.bench-ready .bench:not(.is-list) .bench-object:hover,
.bench-ready .bench:not(.is-list) .bench-object:focus-visible {
  transform: translateY(-4px);
  border-color: var(--bench-line);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
}
.bench-ready .bench:not(.is-list) .bench-item.is-selected .bench-object {
  border-color: var(--sage);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
}
.bench-ready .bench:not(.is-list) .bench-item.is-muted {
  opacity: 0.22;
  filter: grayscale(1);
}
.bench-ready .bench.has-panel:not(.is-list) .bench-item:not(.is-selected) {
  opacity: 0.55;
}
.bench-ready .bench.has-panel:not(.is-list) .bench-item.is-muted {
  opacity: 0.18;
}
.bench-sketch {
  display: block;
  height: 104px;
  margin-bottom: 6px;
}
.bench-sketch img,
.bench-sketch svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transition: transform 420ms var(--ease-out);
}
.bench-object:hover .bench-sketch img,
.bench-object:hover .bench-sketch svg {
  transform: rotate(-1.2deg) scale(1.03);
}
.bench-label {
  display: block;
  font: 19px/1.3 var(--serif);
}
.bench-note {
  display: block;
  margin-top: 2px;
  font: 12px/1.45 var(--sans);
  color: var(--muted);
}

.bench-ready .bench:not(.is-list) .bench-hint {
  display: block;
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  margin: 0;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(252, 250, 240, 0.92);
  font: 12px/1.5 var(--sans);
  color: var(--muted);
  pointer-events: none;
}
.bench-ready .bench.has-panel .bench-hint {
  display: none;
}

/* ---------- detail panel ---------- */
.bench-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: min(380px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-lift);
  animation: bench-panel-in 360ms var(--ease-out);
}
.bench-panel[hidden] {
  display: none;
}
.bench-panel:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@keyframes bench-panel-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
/* Opens on the side away from the selected card, so its neighbours stay visible. */
.bench.panel-left .bench-panel {
  right: auto;
  left: 12px;
  animation-name: bench-panel-in-left;
}
@keyframes bench-panel-in-left {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
}
.bench-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 20px;
  border-bottom: 1px solid var(--rule);
}
.bench-panel-kicker {
  margin: 0;
  font: 13px/1.5 var(--sans);
  color: var(--muted);
}
.bench-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 8px;
  overscroll-behavior: contain;
}
.bench-panel-body .project-links {
  gap: 4px 16px;
}
.bench-panel-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--rule);
}

@media (max-width: 899px) {
  .bench-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 66%;
    animation-name: bench-panel-up;
  }
  @keyframes bench-panel-up {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
  }
}

@media (max-width: 719px) {
  .explore-page .container {
    width: calc(100% - 40px);
  }
  .bench-items {
    grid-template-columns: 1fr;
  }
  .bench-ready .bench:not(.is-list) {
    height: 72vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bench-object:hover .bench-sketch img,
  .bench-object:hover .bench-sketch svg,
  .bench-ready .bench:not(.is-list) .bench-object:hover {
    transform: none;
  }
}
