/* ============================================
   PixelCalm — Viewer & Screensaver Page Styles
   ============================================ */

/* ── Screensaver Page ── */
.screensaver-page {
  padding-top: var(--space-8);
}

.screensaver-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 600px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-8);
}

.screensaver-hero canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.screensaver-hero-controls {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  display: flex;
  gap: var(--space-2);
  z-index: 2;
}

.screensaver-info {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-10);
}

.screensaver-main h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
}

.screensaver-description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.screensaver-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.screensaver-author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.screensaver-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.screensaver-author-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.screensaver-author-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Sidebar Actions ── */
.screensaver-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.action-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(10px);
}

.action-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.action-buttons .btn {
  width: 100%;
  justify-content: center;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.stats-row .stat-value {
  font-size: var(--text-xl);
}

/* ── Embed Code ── */
.embed-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.embed-code:hover {
  border-color: var(--border-default);
}

@media (max-width: 1024px) {
  .screensaver-info {
    grid-template-columns: 1fr;
  }

  .screensaver-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .action-panel {
    flex: 1;
    min-width: 260px;
  }
}

/* ── Viewer Overlay ── */
.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-viewer);
  background: var(--bg-primary);
  display: none;
}

.viewer-overlay.active {
  display: block;
}

.viewer-overlay canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.viewer-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-viewer) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(to top, rgba(2, 0, 16, 0.8), transparent);
  transition: opacity var(--duration-slow) var(--ease-out);
}

.viewer-controls.hidden {
  opacity: 0;
  pointer-events: none;
}

.viewer-controls .btn-icon {
  width: 44px;
  height: 44px;
  font-size: 18px;
  background: rgba(18, 14, 46, 0.6);
  backdrop-filter: blur(16px);
}

.viewer-close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: calc(var(--z-viewer) + 1);
  transition: opacity var(--duration-slow) var(--ease-out);
}

.viewer-close.hidden {
  opacity: 0;
  pointer-events: none;
}

.viewer-title {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: calc(var(--z-viewer) + 1);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.viewer-title.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Clock Overlay ── */
.clock-overlay {
  position: fixed;
  z-index: calc(var(--z-viewer) + 2);
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.clock-overlay.bottom-right {
  bottom: var(--space-16);
  right: var(--space-8);
  text-align: right;
}

.clock-overlay.center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.clock-time {
  font-size: var(--text-5xl);
  font-weight: 300;
  letter-spacing: 0.05em;
}

.clock-date {
  font-size: var(--text-sm);
  opacity: 0.6;
  margin-top: var(--space-1);
}

.clock-overlay.hidden {
  opacity: 0;
}

/* ── Explore Page ── */
.explore-header {
  padding-top: var(--space-10);
  padding-bottom: var(--space-8);
  text-align: center;
}

.explore-header h1 {
  margin-bottom: var(--space-3);
}

.explore-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.explore-grid {
  margin-bottom: var(--space-16);
}
