/* Projects archive — constellation of circular thumbnails on a portrait canvas.
   Scrolling untangles them, they can be dragged and pinned, the caption in the
   top-left corner reads title + genre of whatever is hovered.
   Data comes from the .proj-grid cards; this only styles the field. */

.const {
  margin: 0 0 3rem;
  font-family: var(--font-serif, 'Sorts Mill Goudy', Georgia, 'Times New Roman', serif);
}

.const-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  margin: 0 0 1.5rem;
}
.const-filters,
.const-view {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.const-view {
  margin-left: auto;
}

.const-chip {
  font: inherit;
  font-family: var(--font-serif, 'Sorts Mill Goudy', Georgia, 'Times New Roman', serif);
  font-size: 0.9rem;
  line-height: 1;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  padding: 0.42rem 0.85rem 0.36rem;
  color: #555;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.const-chip:hover {
  color: #111;
  border-color: #111;
}
.const-chip[aria-pressed="true"] {
  background: #111;
  border-color: #111;
  color: #fff;
}
.const-chip:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

/* The canvas is the whole viewport: full-bleed width, one viewport tall, no frame */
.const-field {
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  height: 150vh;
  height: 150svh;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Caption: a full-width subtitle band that sticks directly under the site header
   while the canvas scrolls through; text aligned with the page's left edge */
.const-caption {
  position: sticky;
  top: var(--menu-h, 56px);
  z-index: 10;
  width: 100%;
  box-sizing: border-box;
  transition: top 0.3s ease;
  padding: 0.9rem 1.5rem 0.85rem;   /* same side padding as .site-menu → text aligns with the brand */
  background: rgba(17, 17, 17, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
/* menu.js hides the header while scrolling down; follow it to the top edge */
body:has(.site-menu.hidden) .const-caption {
  top: 0;
}
.const-caption__title {
  display: block;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.15;
  color: #fff;
  transition: color 0.25s;
}
.const-caption__meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.const-caption:not(.is-project) .const-caption__title {
  color: rgba(255, 255, 255, 0.75);
}

.const-item {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.const-item:hover,
.const-item:focus-within,
.const-item.is-dragging {
  z-index: 5;
}

.const-circle {
  display: block;
  width: calc(var(--r) * 2px);
  height: calc(var(--r) * 2px);
  margin: calc(var(--r) * -1px) 0 0 calc(var(--r) * -1px);
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  background: #f3f3f3;
  cursor: grab;
  touch-action: none;
  transform-origin: center;
  transition: opacity 0.6s ease, filter 0.6s ease, box-shadow 0.3s ease,
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.const-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
.const-item:hover .const-circle,
.const-circle:focus-visible {
  transform: scale(1.07);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.14);
  outline: none;
}
.const-item.is-dragging .const-circle {
  cursor: grabbing;
  transform: scale(1.07);
  transition: box-shadow 0.3s ease;
}
.const-item.is-pinned .const-circle {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.const-item.is-dim .const-circle {
  opacity: 0.22;
  filter: grayscale(1);
}

/* In circles view the chips replace the category sub-navigation, and the canvas is the
   last thing on the page so the final screen is entirely play area */
.archive-page.has-const:not(.is-list-view) .subnav,
.archive-page.has-const:not(.is-list-view) + .site-footer {
  display: none;
}
.archive-page.has-const:not(.is-list-view) {
  padding-bottom: 0;
}
.const:not(.is-list) {
  margin-bottom: 0;
}

/* archive.css sets display:grid on the list, which would beat the hidden attribute */
.proj-grid[hidden] {
  display: none !important;
}

/* List view: hide the field and chips; the sub-navigation returns */
.const.is-list .const-field,
.const.is-list .const-filters {
  display: none;
}

@media (max-width: 600px) {
  .const-chip {
    font-size: 0.82rem;
    padding: 0.38rem 0.7rem 0.32rem;
  }
  .const-caption {
    padding: 0.7rem 1rem 0.65rem;
  }
  .const-caption__title {
    font-size: 1.25rem;
  }
  .const-caption__meta {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .const-circle,
  .const-caption__title {
    transition: none;
  }
}
