/* ===== Mastodon feed widget ===== */
#masto-widget {
  position: absolute;
  /* centered under the flip card */
  top: 100px;
  left: calc(50% - 160px);
  width: 320px;
  max-height: 500px;
  overflow-y: auto;
  z-index: 1;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  cursor: grab;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  padding: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

#masto-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 8px;
}

#masto-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

#masto-user {
  display: flex;
  flex-direction: column;
}

#masto-display {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
}

#masto-handle {
  font-size: 12px;
  color: #888;
  text-decoration: none;
}
#masto-handle:hover {
  text-decoration: underline;
}

#masto-posts {
  display: flex;
  flex-direction: column;
}

.masto-post {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.masto-post:last-child {
  border-bottom: none;
}

.masto-post-time {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 4px;
}

.masto-post-content {
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  word-break: break-word;
}

.masto-post-content p {
  margin: 0 0 6px;
}

.masto-post-content p:last-child {
  margin-bottom: 0;
}

.masto-post-content a {
  color: #6364ff;
  text-decoration: none;
}
.masto-post-content a.mention.hashtag,
.masto-post-content a[rel="tag"] {
  color: pink;
}

.masto-media-wrap {
  position: relative;
  margin-top: 8px;
}

.masto-post-media {
  display: flex;
  gap: 4px;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.masto-post-media::-webkit-scrollbar { display: none; }

.masto-post-media img {
  flex: 0 0 auto;
  width: 48%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.masto-media-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 20px;
  line-height: 28px;
  text-align: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.masto-arrow-right {
  right: 4px;
}
.masto-arrow-left {
  left: 4px;
}
.masto-media-arrow:hover {
  background: rgba(0, 0, 0, 0.55);
}

.masto-post-stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11px;
  color: #aaa;
}

.masto-loading {
  text-align: center;
  padding: 20px;
  color: #aaa;
  font-size: 13px;
}

/* ---- Lightbox overlay ---- */
#masto-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
#masto-lightbox.visible {
  display: flex;
}
#masto-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#masto-load-more {
  text-align: center;
  padding: 10px 0;
  color: pink;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 2px;
}
#masto-load-more:hover {
  color: #e8a0b4;
}

/* Hide on mobile / portrait */
@media only screen and (max-width: 820px) and (orientation: portrait) {
  #masto-widget { display: none; }
}
