/* Project Preview Panel Styles */

/* When preview is active, keep body normal */
body.preview-active {
  /* Body scrolls normally */
  overflow: visible;
}

/* Panel container - fixed positioning */
.preview-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 500;
  pointer-events: none; /* This was blocking scroll! */
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: none; /* Hide completely when not active */
}

.preview-panel.active {
  pointer-events: none; /* Panel itself still none - children will have auto */
  opacity: 1;
  display: block;
}

/* Divider */
.panel-divider {
  position: fixed;
  top: 0;
  left: 50%;
  width: 4px;
  height: 100vh;
  background: #e0e0e0;
  cursor: col-resize;
  z-index: 502;
  transition: background 0.2s ease;
  transform: translateX(-2px);
  pointer-events: auto;
}

.panel-divider:hover,
.panel-divider.dragging {
  background: #000000;
}

.panel-divider::before {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0;
  bottom: 0;
  cursor: col-resize;
}

/* Preview content */
.preview-content {
  position: fixed;
  top: 0;
  left: 50%;
  right: 0;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  transition: left 0.1s ease;
  transform-origin: center center;
  pointer-events: auto;
  overflow: hidden;
}

/* Preview header */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
  background: #ffffff;
  flex-shrink: 0;
}

.preview-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #000000;
  font-family: 'Georgia', serif;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #f5f5f5;
  color: #000000;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.github-link:hover {
  background: #000000;
  color: #ffffff;
}

.github-link svg {
  width: 18px;
  height: 18px;
}

.close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  color: #000000;
  font-size: 24px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
  padding: 0;
}

.close-button:hover {
  background: #000000;
  color: #ffffff;
}

/* Preview iframe container */
.preview-iframe-container {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  transition: pointer-events 0.1s ease;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  margin: 0;
}


/* Disable pointer events on iframe during drag */
body.dragging-divider .preview-iframe-container,
body.dragging-divider .preview-iframe {
  pointer-events: none;
  overflow-y: hidden;
}

.preview-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: #666666;
  font-family: 'Georgia', serif;
}

/* Fallback message for sites that block iframes */
.preview-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 40px;
  max-width: 400px;
  display: none;
}

.preview-fallback.active {
  display: block;
}

.preview-fallback-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #000000;
  font-family: 'Georgia', serif;
}

.preview-fallback-text {
  font-size: 15px;
  color: #666666;
  margin-bottom: 24px;
  line-height: 1.6;
  font-family: 'Georgia', serif;
}

.preview-fallback-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #000000;
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Georgia', serif;
}

.preview-fallback-button:hover {
  transform: scale(1.05);
}

.preview-fallback-button svg {
  width: 16px;
  height: 16px;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.preview-iframe.loaded {
  opacity: 1;
}

/* Preview image for GIFs/PNGs */
.preview-image {
  width: calc(100% - 40px);
  height: auto;
  display: block;
  object-fit: contain;
  background: #ffffff;
  margin: 0 20px 20px 20px;
  flex-shrink: 0;
}

/* Preview caption text */
.preview-caption {
  width: calc(100% - 40px);
  margin: 0 20px 16px 20px;
  padding: 0 0 16px 0;
  font-size: 16px;
  line-height: 1.7;
  color: #333333;
  font-family: 'Georgia', serif;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* Main page adjustments - resize to fit left of divider */
.page.preview-active {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 50%;
  height: 100vh;
  max-width: none;
  margin: 0;
  overflow-y: scroll !important;
  overflow-x: hidden;
  transition: width 0.1s ease;
  padding: 96px 36px;
  /* Enable ALL interactions */
  pointer-events: auto !important;
  user-select: text;
  /* Ensure scroll works */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 1;
  /* Remove centering to allow scroll */
  justify-content: flex-start !important;
  /* Ensure it can receive wheel events */
  touch-action: auto;
}

/* Ensure normal page scrolling when preview is NOT active */
/* Note: Don't override .page styles here - let simple.css handle defaults */

/* Only disable pointer events on main page during drag */
body.dragging-divider .page {
  pointer-events: none;
  user-select: none;
  overflow-y: hidden;
}

/* Project cards - make clickable */
.project-list .experience-item {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
  padding: 8px;
  margin: -8px;
}

.project-list .experience-item:hover {
  transform: translateX(4px);
  background: rgba(0, 0, 0, 0.02);
}

.project-list .experience-item:active {
  transform: translateX(2px) scale(0.98);
}

/* Animation states */
.preview-panel.opening .preview-content {
  animation: expandFromOrigin 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.preview-panel.closing .preview-content {
  animation: collapseToOrigin 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

/* Mobile - fullscreen overlay */
@media (max-width: 768px) {
  .panel-divider {
    display: none;
  }
  
  .preview-content {
    left: 0 !important;
    right: 0 !important;
    width: 100%;
  }
  
  .preview-header {
    padding: 16px 20px;
  }
  
  .preview-title {
    font-size: 18px;
  }
  
  .page.preview-active {
    display: none;
  }
}

/* Prevent text selection while dragging */
body.dragging-divider {
  user-select: none;
  cursor: col-resize;
}

body.dragging-divider * {
  cursor: col-resize !important;
}

