/* ═══════ VISUAL ART PAGE ═══════ */
:root {
  --gap: 10px;
}

body {
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  opacity: 0;
  animation: fadeIn 1.5s ease 0.3s both;
}

.page-title {
  font-family: 'Azeret Mono', monospace;
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--fg-bright);
  text-align: center;
  flex: 1;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.action-btn {
  font-family: 'Azeret Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
  background: none;
  border: 1px solid var(--muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(248,183,3,0.04);
}

.gallery-hint {
  font-family: 'Azeret Mono', monospace;
  font-size: clamp(0.65rem, 1.3vw, 0.8rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 1rem;
  animation: fadeIn 2s ease 1.5s both;
}
.gallery-hint em {
  font-style: normal;
  color: var(--accent);
}

.masonry {
  column-count: 3;
  column-gap: var(--gap);
  width: 100%;
  opacity: 0;
  animation: fadeIn 1.5s ease 0.6s both;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--gap);
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  transition: transform 0.4s ease, opacity 0.4s ease;
  transform-origin: center center;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 1.2s ease, transform 0.5s ease;
  pointer-events: none;
}

.gallery-item:hover img { transform: scale(1.02); }

.gallery-item .draw-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

/* ═══════ GLITCH ═══════ */
.gallery-item.glitched img {
  filter: invert(1) contrast(1.2) saturate(0.8);
  transition: filter 0.3s ease;
}

.gallery-item.glitched::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='6' seed='0' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: staticScroll 0.15s steps(4) infinite;
}

.gallery-item.glitched::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.12;
  background: repeating-linear-gradient(to bottom, transparent, transparent 2px, rgba(0,0,0,0.8) 2px, rgba(0,0,0,0.8) 4px);
}

@keyframes staticScroll {
  0%   { background-position: 0 0; }
  25%  { background-position: -128px -64px; }
  50%  { background-position: 64px -128px; }
  75%  { background-position: -64px 64px; }
  100% { background-position: 128px -32px; }
}

.gallery-item:not(.glitched):hover img {
  filter: saturate(1.15) hue-rotate(5deg);
}

.gallery-item.voiding {
  animation: sendToVoid 0.8s ease forwards;
  pointer-events: none;
}

@keyframes sendToVoid {
  0%   { opacity: 1; transform: scale(1) rotate(0deg); filter: none; }
  30%  { opacity: 0.8; transform: scale(0.9) rotate(2deg); filter: blur(1px) saturate(3) hue-rotate(60deg); }
  60%  { opacity: 0.4; transform: scale(0.5) rotate(-5deg); filter: blur(4px) saturate(5) hue-rotate(120deg); }
  100% { opacity: 0; transform: scale(0) rotate(15deg); filter: blur(12px) saturate(0); }
}

/* ═══════ MOBILE SCRIBBLE TOGGLE ═══════ */
.mode-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--muted);
  color: var(--fg);
  font-family: 'Azeret Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.6rem 1rem;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  border-radius: 2px;
}
.mode-toggle:hover,
.mode-toggle:active {
  border-color: var(--accent);
  color: var(--accent);
}
.mode-toggle.scribble-active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(248, 183, 3, 0.15);
}
.mode-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Default on mobile: drawing is OFF, scrolling works */
body.scroll-mode .draw-layer {
  pointer-events: none !important;
  touch-action: auto !important;
}

/* Only show on iPad (1024px) and smaller */
@media (max-width: 1024px) {
  .mode-toggle { display: flex; }
}

@media (max-width: 700px) {
  .masonry { column-count: 2; }
  .page-wrapper { padding: 1rem 0.75rem; }
  .header-actions { gap: 0.5rem; }
  .action-btn { font-size: 0.65rem; padding: 0.4rem 0.7rem; }
}
@media (max-width: 400px) {
  .masonry { column-count: 1; }
}
