/* ==========================================================================
   MINIMALIST ART SYSTEM
   ========================================================================== */
:root {
  /* Obsidian (Dark Mode) default */
  --bg-color: #0b0b0b;
  --text-color: #e5e5e5;
  --text-muted: #555555;
  --text-accent: #888888;
  --image-opacity: 0.95;
  
  --font-serif: 'Cormorant Garamond', serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-speed: 1s;
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);

  /* Grid Dimensions */
  --grid-width: 80vw;
  --grid-height: 53.33vw;
}

/* Paper (Light Mode) */
body.light-mode {
  --bg-color: #f4f4f2;
  --text-color: #121212;
  --text-muted: #b0b0a8;
  --text-accent: #666660;
  --image-opacity: 1;
}

/* ==========================================================================
   BASE RULES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-mono);
  font-weight: 200;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  cursor: none; /* Hide native cursor */
  transition: background-color var(--transition-speed) var(--ease-smooth), 
              color var(--transition-speed) var(--ease-smooth);
}

/* ==========================================================================
   CUSTOM CURSOR
   ========================================================================== */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background-color: var(--text-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-smooth), 
              height 0.3s var(--ease-smooth), 
              background-color 0.3s var(--ease-smooth);
}

/* Hovering over the photograph */
.custom-cursor.photo-hover {
  width: 24px;
  height: 24px;
  background-color: transparent;
  border: 1px solid var(--text-color);
}



/* ==========================================================================
   CANVAS LAYOUT
   ========================================================================== */
.canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  padding: 40px;
}

.exhibition-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: none;
}

/* 3D Photo Grid Container */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  width: var(--grid-width);
  height: var(--grid-height);
  max-width: 1200px;
  max-height: 80vh;
  position: relative;
  transform-style: preserve-3d;
  perspective: 1500px;
  background-color: rgba(255, 255, 255, 0.01);
  transition: transform 0.4s var(--ease-smooth);
}


body.light-mode .photo-grid {
  background-color: rgba(0, 0, 0, 0.01);
}

/* Individual Mosaic Tile */
.tile {
  position: relative;
  background-repeat: no-repeat;
  
  /* Sized to container size, managed dynamically via JS clientRect */
  background-size: var(--real-width, var(--grid-width)) var(--real-height, var(--grid-height));
  
  /* Slice calculation based on column/row position */
  background-position: calc(var(--col) * 100% / 3) calc(var(--row) * 100% / 3);
  
  /* 3D position transforms */
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), var(--tz, 0px)) 
             rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rz, 0deg))
             scale(var(--sc, 1));
             
  filter: grayscale(100%) contrast(1.1) brightness(0.92);
  opacity: 0.88;
  
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              filter 0.15s ease,
              opacity 0.15s ease,
              background-size 0.5s ease;
              
  will-change: transform, filter;
  outline: 1px solid transparent; /* Anti-aliasing helper for rotated edges */
}

/* Active Step Sequencer Highlight (Subtle breathing opacity shift) */
.tile.active-step {
  opacity: 1 !important;
  filter: grayscale(100%) contrast(1.1) brightness(0.95) !important;
  z-index: 100;
}


/* Cursor style over active grid */
.custom-cursor.grid-hover {
  width: 24px;
  height: 24px;
  background-color: transparent;
  border: 1px solid var(--text-color);
}

.custom-cursor.grid-scrambled {
  width: 32px;
  height: 32px;
  border: 1px dashed var(--text-color);
  background-color: rgba(255, 255, 255, 0.02);
}

body.light-mode .custom-cursor.grid-scrambled {
  background-color: rgba(0, 0, 0, 0.01);
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
  .canvas {
    padding: 20px;
  }
  :root {
    --grid-width: 90vw;
    --grid-height: 60vw;
  }
}
