/* Marey Lab 49 – Chronophotography Widget Styles */

:root {
  --ml-black: #1c1917;
  --ml-white: #f5f5f5;
  --ml-strip: #374151;
  --ml-brass: #fbbf24;
  --ml-paper: #e8dcc8;
  --ml-shadow: rgba(0,0,0,0.7);
}

.marey-lab-49-widget {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--ml-black);
  font-family: 'Courier New', Courier, monospace;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}

.marey-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
}

/* ── UI OVERLAY ── */
.marey-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
}

/* Study Info */
.marey-study-info {
  pointer-events: none;
  color: var(--ml-white);
  max-width: 60%;
}
.marey-study-date {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ml-brass);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
}
.marey-study-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--ml-white);
  text-shadow: 1px 1px 0 #000, 2px 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 0.05em;
}
.marey-study-technique {
  font-size: 0.65rem;
  color: rgba(245,245,245,0.55);
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Controls row */
.marey-controls {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.marey-btn {
  background: rgba(28,25,23,0.75);
  border: 1px solid var(--ml-brass);
  color: var(--ml-brass);
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  transition: background 0.15s, color 0.15s;
  backdrop-filter: blur(4px);
}
.marey-btn:hover { background: var(--ml-brass); color: var(--ml-black); }
.marey-btn:active { transform: scale(0.96); }
.marey-play-pause svg { width: 1rem; height: 1rem; }
.marey-play-pause.is-playing svg path { d: path("M6 19h4V5H6v14zm8-14v14h4V5h-4z"); }

.marey-frame-counter {
  color: var(--ml-white);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  min-width: 4rem;
  text-align: center;
}
.marey-frame-sep { margin: 0 0.2rem; opacity: 0.4; }

.marey-timestamp {
  color: var(--ml-brass);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.marey-export-gif {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 0.3rem 0.7rem;
}

/* Study Navigation */
.marey-study-nav {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.marey-study-nav .marey-btn {
  font-size: 1rem;
  padding: 0.4rem 0.5rem;
  line-height: 1;
}
.marey-study-dots {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.marey-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(245,245,245,0.3);
  border: 1px solid var(--ml-brass);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.marey-dot.active {
  background: var(--ml-brass);
  transform: scale(1.4);
}

/* ── LIGHTBOX ── */
.marey-lightbox {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.marey-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(28,25,23,0.92);
  backdrop-filter: blur(8px);
}
.marey-lightbox-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  animation: mlFadeIn 0.25s ease;
}
.marey-lightbox-img {
  max-width: 80vw;
  max-height: 70vh;
  border: 2px solid var(--ml-brass);
  box-shadow: 0 0 40px rgba(251,191,36,0.3);
  image-rendering: pixelated;
  filter: sepia(0.3) contrast(1.1);
}
.marey-lightbox-caption {
  margin-top: 1rem;
  color: var(--ml-white);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

@keyframes mlFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── GRID OVERLAY ── */
.marey-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(251,191,36,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251,191,36,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mix-blend-mode: screen;
}

/* ── SWIPE HINT ── */
.marey-hint {
  position: absolute;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(245,245,245,0.4);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  pointer-events: none;
  animation: mlPulse 2s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes mlPulse {
  0%,100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ── GIF EXPORT PROGRESS ── */
.marey-gif-progress {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(28,25,23,0.9);
  border: 1px solid var(--ml-brass);
  color: var(--ml-brass);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.8rem;
  border-radius: 2px;
  pointer-events: none;
  z-index: 50;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .marey-study-title { font-size: 1rem; }
  .marey-study-info { max-width: 75%; }
  .marey-export-gif { display: none; }
}
