* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #141018;
  color: #ece8f0;
  line-height: 1.5;
}

a { color: #c9a4ff; }
a:hover { color: #e0c8ff; }

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid #2a2433;
  background: linear-gradient(180deg, #1c1524 0%, #141018 100%);
}

.site-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  color: #9a92a8;
  font-size: 0.95rem;
}

main { padding: 1.25rem 0 2.5rem; }

.meta {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  color: #7d758a;
}

.feed { display: grid; gap: 1rem; }

.loading, .empty, .error {
  color: #9a92a8;
  font-size: 0.95rem;
}

.post {
  background: #1c1524;
  border: 1px solid #2f2838;
  border-radius: 12px;
  overflow: hidden;
}

.post-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem 0;
  font-size: 0.78rem;
  color: #8f879c;
}

.post-stats { white-space: nowrap; }

.post-image {
  display: block;
  padding: 0;
  border: none;
  margin: 0;
  cursor: zoom-in;
  background: #0f0c14;
  overflow: hidden;
  font: inherit;
  color: inherit;
}

.post-image:focus-visible {
  outline: 2px solid #c9a4ff;
  outline-offset: -2px;
}

.post-images {
  display: grid;
  gap: 3px;
  margin-top: 0.65rem;
  grid-template-columns: repeat(4, 1fr);
}

.post-images--count-1 {
  grid-template-columns: 1fr;
}

.post-images--count-2 {
  grid-template-columns: 1fr 1fr;
}

.post-image--hero {
  grid-column: span 2;
}

.post-images .post-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f0c14;
}

.post-image--hero img {
  min-height: 11rem;
  max-height: 22rem;
}

.post-image:not(.post-image--hero) img {
  min-height: 5rem;
  max-height: 9rem;
}

.post-images--count-1 .post-image img {
  min-height: 14rem;
  max-height: 32rem;
}

.post-images--count-2 .post-image img {
  min-height: 12rem;
  max-height: 24rem;
}

/* Lightbox */
body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(8, 6, 12, 0.92);
  cursor: zoom-out;
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 56rem);
  max-height: 86vh;
  margin: 0 3rem;
}

.lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  border: none;
  background: rgba(28, 21, 36, 0.85);
  color: #ece8f0;
  font-size: 1.75rem;
  line-height: 1;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(48, 38, 58, 0.95);
  color: #fff;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
}

.lightbox-prev { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 0.75rem; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
  position: absolute;
  z-index: 2;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.85rem;
  color: #b8b0c4;
  pointer-events: none;
}

@media (max-width: 480px) {
  .post-images:not(.post-images--count-1):not(.post-images--count-2) {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-image--hero {
    grid-column: span 1;
  }

  .post-image--hero img {
    min-height: 8rem;
    max-height: 14rem;
  }

  .lightbox-stage { margin: 0 2.5rem; }
  .lightbox-prev { left: 0.35rem; }
  .lightbox-next { right: 0.35rem; }
}

.post-text {
  padding: 0.85rem 0.9rem 0.25rem;
  font-size: 0.92rem;
  white-space: normal;
  word-break: break-word;
}

.post-share {
  padding: 0.5rem 0.9rem 0.85rem;
  font-size: 0.78rem;
  color: #7d758a;
}

.post-share a {
  color: #9a92a8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-share a:hover {
  color: #c9a4ff;
}

@media (min-width: 640px) {
  .site-header h1 { font-size: 1.85rem; }
  .post-text { font-size: 0.95rem; }
}
