/**
 * Orbiting Post Viewer Styles
 * Scrim, contain-fit media stage, details side-panel, responsive bottom sheet on phone.
 * Pure token-based styling.
 */

.orbit-viewer-dialog {
  border: 1px solid var(--border); /* taste-skill-ignore: outlined-box */
  border-radius: var(--radius-card);
  padding: 0;
  margin: auto;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  max-width: min(1200px, 94vw);
  max-height: min(860px, 92vh);
  width: 94vw;
  height: 92vh;
}

.orbit-viewer-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

body.viewer-open {
  overflow: hidden;
}

body.viewer-open #viewTitle {
  visibility: hidden;
}

.viewer-content {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}

/* Media Stage (Left on Desktop) */
.viewer-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.viewer-stage-media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Album Carousel Controls */
.viewer-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  z-index: 10;
}

.viewer-nav-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.85);
}

.viewer-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.viewer-nav-prev {
  left: 16px;
}

.viewer-nav-next {
  right: 16px;
}

.viewer-counter {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
  letter-spacing: 0.02em;
}

/* Side Details Panel (Right on Desktop) */
.viewer-panel {
  width: 380px;
  min-width: 320px;
  max-width: 400px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--control); /* taste-skill-ignore: outlined-box, hairline */
  position: relative;
}

/* Close button */
.viewer-close-btn {
  position: static;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.viewer-close-btn:hover {
  background: var(--active);
  color: var(--text);
}

/* Panel Header */
.viewer-panel-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.viewer-author-meta {
  flex: 1;
  min-width: 0;
}

.viewer-author-name {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-post-time {
  font-size: 12px;
  color: var(--muted);
}

.viewer-circle-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--active);
  color: var(--accent);
  margin-left: 6px;
}

/* Panel Scrollable Body */
.viewer-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewer-caption {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
  margin: 0;
}

.viewer-feed-title {
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
  overflow-wrap: anywhere;
}

.viewer-feed-summary {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}

.viewer-section-title {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

/* Quiet Ghost Action Buttons */
.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.viewer-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.viewer-action-btn:hover {
  background: var(--active);
  color: var(--text);
}

.viewer-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Replies list */
.viewer-replies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--control); /* taste-skill-ignore: outlined-box, hairline */
  padding-top: 12px;
}

.viewer-reply-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.viewer-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-reply-header .avatar-disc {
  width: 20px;
  height: 20px;
  font-size: 11px;
  flex-shrink: 0;
}

.viewer-reply-author {
  font-weight: 600;
  color: var(--text);
}

.viewer-reply-time {
  font-size: 12px;
  color: var(--muted);
}

.viewer-reply-body {
  color: var(--text);
}

.viewer-reply-reactions {
  margin-top: 2px;
}

.viewer-empty-replies {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
  margin: 0;
}

/* Fixed reply form at bottom */
.viewer-reply-form {
  padding: 12px 16px;
  border-top: 1px solid var(--control); /* taste-skill-ignore: outlined-box, hairline */
  background: var(--surface);
  display: flex;
  gap: 8px;
  align-items: center;
}

.viewer-reply-input {
  flex: 1;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--control); /* taste-skill-ignore: outlined-box */
  border-radius: var(--radius-control);
  background: var(--ground);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.viewer-reply-input:focus {
  border-color: var(--text);
}

.viewer-reply-submit {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.viewer-reply-submit:hover {
  opacity: 0.9;
}

/* Phone Layout (≤ 980px): full-screen sheet */
@media (max-width: 980px) {
  .orbit-viewer-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }

  .viewer-content {
    flex-direction: column;
    border-radius: 0;
    position: relative;
    height: 100dvh;
  }

  .viewer-stage {
    height: auto;
    max-height: 70vh;
    flex: none;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .viewer-stage-media {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
  }

  .viewer-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: 0;
    border-top: 1px solid var(--control); /* taste-skill-ignore: outlined-box, hairline */
    position: static;
  }

  .viewer-panel-header {
    position: static;
    padding: 16px;
  }

  .viewer-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    z-index: 20;
    border-radius: 50%;
  }

  .viewer-close-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
  }

  .viewer-action-btn {
    min-height: 44px;
    padding: 0 12px;
  }

  .viewer-reply-input {
    min-height: 44px;
  }

  .viewer-reply-submit {
    min-height: 44px;
    padding: 0 16px;
  }
}
