/* =====================================================================
 * Aluta — Timeline page click-to-view (custom PDF.js viewer)
 *
 * JS adds .aluta-tl-has-doc to any column/section whose ACF doc slot has
 * a file uploaded. Hover dims the column and shows a "View Document"
 * label; click opens the file in a PDF.js canvas viewer (no download
 * button, no print button). PDFs render to canvas — pages can be paged
 * + zoomed but the file is never exposed via a download surface.
 * ===================================================================== */

/* ── Column hover hint ─────────────────────────────────────────── */

.aluta-tl-has-doc {
  position: relative;
  cursor: pointer;
  transition: filter 0.25s ease;
}

.aluta-tl-has-doc > .elementor-widget-wrap,
.aluta-tl-has-doc > .elementor-element-populated,
.aluta-tl-has-doc > .elementor-container {
  position: relative;
  z-index: 1;
}

.aluta-tl-has-doc::after {
  content: '👁  View Document';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

.aluta-tl-has-doc:hover::after,
.aluta-tl-has-doc:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.aluta-tl-has-doc:focus-visible {
  outline: 2px solid #c62828;
  outline-offset: 2px;
}

@media (hover: none) {
  /* Touch devices — show a persistent eye badge instead. */
  .aluta-tl-has-doc::before {
    content: '👁';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
  }
}

/* ── Modal viewer (custom PDF.js shell) ────────────────────────── */

body.aluta-doc-modal-open {
  overflow: hidden;
}

.aluta-doc-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.aluta-doc-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.aluta-doc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.aluta-doc-modal-stage {
  position: relative;
  width: min(1100px, 95vw);
  height: min(90vh, 95vh);
  background: #1f1f1f;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* ── Toolbar ──────────────────────────────────────────────────── */

.aluta-doc-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #2a2a2a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.aluta-doc-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aluta-doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: #f0f0f0;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.aluta-doc-btn:hover:not(:disabled),
.aluta-doc-btn:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  outline: none;
}

.aluta-doc-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.aluta-doc-modal-close:hover,
.aluta-doc-modal-close:focus-visible {
  background: #c62828 !important;
  border-color: #c62828 !important;
  color: #ffffff !important;
}

.aluta-doc-page-info,
.aluta-doc-zoom-info {
  display: inline-block;
  min-width: 60px;
  padding: 0 6px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #f0f0f0;
  user-select: none;
}

/* ── Canvas scroll area ───────────────────────────────────────── */

.aluta-doc-modal-scroll {
  position: relative;
  flex: 1;
  overflow: auto;
  background: #1f1f1f;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

.aluta-doc-modal-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-drag: none;
}

/* Block image-style drag/drop on the canvas. */
.aluta-doc-modal-canvas {
  pointer-events: auto;
}

.aluta-doc-modal-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: aluta-doc-spin 0.8s linear infinite;
  display: none;
  z-index: 3;
}

@keyframes aluta-doc-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.aluta-doc-modal-error {
  margin: auto;
  color: #d0d0d0;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  text-align: center;
}

/* ── Mobile ───────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .aluta-doc-modal-stage {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  .aluta-doc-modal-toolbar {
    padding: 8px;
    gap: 6px;
  }
  .aluta-doc-btn {
    width: 28px;
    height: 28px;
  }
  .aluta-doc-page-info,
  .aluta-doc-zoom-info {
    min-width: 50px;
    font-size: 12px;
  }
}
