/* ============================================================
   BUBU Studio · Work page · Freeform scatter (mattgondek.com feel)
   ============================================================ */

.work-body {
  background: #F5EFE6;
  background-image: none;
  overflow: auto;
  overflow-x: hidden;
  height: auto;
  min-height: 100vh;
  padding-bottom: calc(var(--dock-h) + 24px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* On work.html, html must also allow scrolling — html/body are locked in styles.css */
html.work-html,
html:has(> body.work-body) {
  height: auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* On the work page, windows are opened as fixed viewport overlays so they
   are never hidden behind the dock or lost above the scroll position. */
.work-body .window {
  position: fixed;
}
.work-body .window--max {
  position: fixed;
}

.work-body::before {
  content: none;
}

/* ============ HEADER ============ */
.work-header {
  padding-top: calc(var(--menubar-h) + 40px);
  padding-bottom: 32px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.work-header__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.work-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6660;
  margin: 0 0 8px;
}

.work-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.01em;
  color: #1A1715;
  margin: 0 0 14px;
}

.work-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #4a4640;
  max-width: 560px;
  margin: 0 auto;
}

/* ============ FREEFORM CANVAS ============ */
.work-canvas {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 24px auto 0;
  /* Fit inside viewport: leave room for header (~180px), dock (~90px) and caption clearance (~40px). */
  height: clamp(560px, calc(100vh - 320px), 720px);
  padding: 0 24px 40px;
  z-index: 2;
}

.scatter {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1A1715;
  transition: transform 0.28s cubic-bezier(.2,.7,.3,1.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.scatter:hover {
  transform: translate(-50%, -50%) scale(calc(var(--scale, 1) * 1.06));
}

.scatter {
  user-select: none;
  -webkit-user-select: none;
}

/* Desktop only: block touch-action so pointer drag works.
   On mobile/tablet, allow vertical scrolling through icons. */
@media (hover: hover) and (pointer: fine) {
  .scatter {
    touch-action: none;
  }
}

.scatter.is-dragging {
  cursor: grabbing;
  opacity: 0.9;
  z-index: 50;
}

.scatter:focus-visible {
  outline: none;
}
.scatter:focus-visible .scatter__drip {
  outline: 2px solid #E85D6E;
  outline-offset: 6px;
  border-radius: 8px;
}

.scatter__drip {
  display: block;
  width: 120px;
  height: 156px;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.16));
  transition: filter 0.28s ease;
}

.scatter:hover .scatter__drip {
  filter: drop-shadow(0 10px 24px rgba(0,0,0,0.22));
}

.scatter__drip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
  pointer-events: none;
}

.scatter__caption {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #1A1715;
  text-align: center;
  letter-spacing: -0.005em;
  max-width: 140px;
}

.scatter__caption em {
  display: inline-block;
  margin-top: 2px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: 12px;
  font-weight: 400;
  color: #7A7570;
  letter-spacing: 0;
}

.scatter--quiet {
  opacity: 0.72;
}
.scatter--quiet:hover {
  opacity: 1;
}
.scatter--quiet .scatter__caption {
  color: #6B6660;
}

/* ============ FOOTER ============ */
.work-footer {
  padding: 40px 24px 40px;
  text-align: center;
  border-top: 1px solid rgba(0,0,0,0.06);
  margin-top: 60px;
}

.work-footer__inner {
  max-width: 640px;
  margin: 0 auto;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #6B6660;
  line-height: 1.7;
}

.work-footer a {
  color: #1A1715;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  transition: border-color 0.2s;
}
.work-footer a:hover {
  border-bottom-color: #E85D6E;
}

/* ============ RESPONSIVE ============ */

/* Medium screens: shrink canvas height and item scale a bit */
@media (max-width: 1100px) {
  .work-canvas {
    height: 640px;
  }
  .scatter__drip {
    width: 108px;
    height: 140px;
  }
}

/* Mobile: switch from freeform scatter to a calm 2-column grid. */
@media (max-width: 720px) {
  .work-header {
    padding-top: calc(var(--menubar-h) + 32px);
    padding-bottom: 16px;
  }
  .work-title {
    font-size: 44px;
  }
  .work-subtitle {
    font-size: 14px;
  }

  .work-canvas {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 16px;
    padding: 32px 20px 60px;
    max-width: 480px;
  }

  .scatter {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    padding: 8px 4px;
  }

  .scatter:hover {
    transform: none;
  }

  .scatter--quiet {
    opacity: 0.85;
  }

  .scatter__drip {
    width: 108px;
    height: 140px;
  }

  .scatter__caption {
    font-size: 12.5px;
    max-width: none;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .scatter__drip {
    width: 92px;
    height: 120px;
  }
}
