* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: white;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 19px, #e5f2f9 19px, #e5f2f9 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, #e5f2f9 19px, #e5f2f9 20px);
  background-size: 20px 20px;
  background-position: 10px 10px;
  color: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  font-family: "MabryPro-Light", Arial, sans-serif;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* Mobile zoom is handled in JavaScript */

#canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

.artifact {
  position: absolute;
  cursor: pointer;
  user-select: none;
  will-change: transform, opacity;
}

.artifact.dragging {
  transition: none;
  z-index: 1000;
  cursor: grabbing;
}

.artifact-box {
  padding: 0;
  margin: 0;
  pointer-events: none; /* Don't capture pointer events on the box */
  display: inline-block; /* Hug contents */
}

.artifact-box img {
  width: 100%;
  height: 100%;
  object-fit: fill; /* Fill the box exactly - box will match image size */
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  pointer-events: auto; /* Only the image captures pointer events */
}

/* Focus overlay */
#focus-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  pointer-events: auto;
}

#focus-overlay.active {
  display: block;
}

/* Focus container - centered column with 15% gutters */
#focus-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2001;
  display: none;
  overflow-y: auto; /* Allow vertical scrolling for tall content */
  overflow-x: hidden; /* Hide horizontal overflow, padding gives shadows space */
  pointer-events: auto;
  cursor: pointer; /* Pointing hand cursor */
}

#focus-container * {
  cursor: pointer; /* Ensure all children also show pointer cursor */
}

#focus-container.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10vh 40px 10vh 40px; /* Generous horizontal padding for shadows */
  box-sizing: border-box;
}

.focus-label {
  font-family: 'Baskervville', serif;
  font-size: 1.2rem;
  color: #333333;
  text-align: left;
  width: 100%;
  max-width: 500px; /* Match image max-width on desktop */
  margin-bottom: 2em;
  line-height: 1.5;
  pointer-events: auto;
  user-select: text;
  padding: 0 20px; /* Inner padding for text alignment with artifact */
  box-sizing: border-box;
  white-space: pre-line; /* Preserve line breaks from JSON */
}

@media (max-width: 768px) {
  #focus-container.active {
    padding: 5vh 40px 5vh 40px; /* Generous horizontal padding for shadows */
  }
  
  .focus-label {
    max-width: 100%; /* Full width, padding handles alignment */
    padding: 0 20px; /* Inner padding for text alignment with artifact */
    font-size: 1.1rem; /* Slightly smaller on mobile for better fit */
    line-height: 1.6; /* Slightly more line height for readability */
    box-sizing: border-box;
  }
  
  .focus-artifact {
    padding: 20px; /* Padding gives shadows space to extend on all sides */
    box-sizing: border-box;
    max-width: 100%; /* Full width, padding handles shadow space */
  }
  
  /* Prevent text selection issues on mobile */
  body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
}

.focus-artifact {
  /* Artifact scales to fill column width */
  position: relative;
  pointer-events: none;
  width: 100%;
  max-width: 500px; /* Match label max-width on desktop */
  flex-shrink: 0; /* Don't shrink */
  cursor: pointer; /* Pointing hand cursor */
  padding: 20px; /* Padding gives shadows space to extend on all sides */
  box-sizing: border-box;
}

/* Desktop: max-width already set above */

/* Mobile styles are defined above in the mobile media query */

.focus-artifact .artifact-box img {
  object-fit: contain !important; /* Maintain aspect ratio in focus mode */
  cursor: pointer !important; /* Pointer cursor in focus mode, not move cursor */
}

.focus-artifact .artifact-box {
  cursor: pointer !important; /* Pointer cursor in focus mode */
}

.focus-artifact .artifact-box {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Maintain aspect ratio */
}

