/* Shared post-view modal */
.post-modal {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: none;
}

.post-modal--open {
  display: block;
}

.post-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 16, 0.78);
  backdrop-filter: blur(4px);
}

.post-modal__panel {
  position: relative;
  width: min(1000px, calc(100vw - var(--space-8)));
  max-height: calc(100vh - var(--space-8));
  margin: var(--space-4) auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--color-bg-secondary);
}

.post-modal__panel--no-media {
  grid-template-columns: 1fr;
  max-width: 620px;
}

.post-modal__panel--no-media .post-modal__media {
  display: none;
}

.post-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg-secondary) 90%, transparent);
  color: var(--color-text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 3;
}

.post-modal__media {
  background: #08080e;
  min-height: 320px;
}

.post-modal__media .carousel,
.post-modal__media .carousel__slide,
.post-modal__media .carousel__track {
  height: 100%;
}

.post-modal__media .carousel {
  position: relative;
}

.post-modal__media .carousel__slide {
  display: none;
}

.post-modal__media .carousel__slide--active {
  display: block;
}

.post-modal__media .carousel__img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  cursor: default;
  display: block;
}

.post-modal__details {
  padding: var(--space-5);
  overflow-y: auto;
}

.post-modal__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.post-modal__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
}

.post-modal__name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.post-modal__meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.post-modal__score {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-accent-2);
}

.post-modal__stars {
  margin-bottom: var(--space-3);
  color: var(--color-accent-2);
}

.post-modal__body {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
}

.post-modal__actions {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.post-action-btn {
  border: 1px solid var(--color-border);
  background: var(--color-bg-glass);
  color: var(--color-text-primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  padding: var(--space-2) var(--space-3);
}

.post-action-btn:hover {
  border-color: var(--color-border-hover);
  background: var(--color-soft-fill-2);
}

.post-action-btn--active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.post-action-btn--warn:hover {
  color: var(--color-error);
}

.post-modal__media .carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.post-modal__media .carousel__btn--prev { left: var(--space-2); }
.post-modal__media .carousel__btn--next { right: var(--space-2); }

.post-modal__media .carousel__dots {
  position: absolute;
  bottom: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-1);
}

.post-modal__media .carousel__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.post-modal__media .carousel__dot--active {
  background: #fff;
}

@media (max-width: 900px) {
  .post-modal__panel {
    grid-template-columns: 1fr;
    max-height: calc(100vh - var(--space-4));
    margin: var(--space-2) auto;
    width: calc(100vw - var(--space-4));
  }

  .post-modal__media {
    min-height: 240px;
    max-height: 48vh;
  }
}
