/* Feed / Wall v3 — "The Stream". All /feed page styles live here.
   Design tokens from css/vars.css. Cyan literals rgba(102,217,255,…) are the
   project-wide cyan (same as the glass border spec). */

.page-feed {
  --feed-top: 75px;
}

@media (max-width: 900px) {
  .page-feed { --feed-top: 61px; }
}

@media (max-width: 560px) {
  .page-feed { --feed-top: 61px; }
}

.page-feed .page-title {
  margin-bottom: 6px;
  font-size: 20px;
}

.feed-count {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
}

.feed-toolbar {
  position: sticky;
  top: var(--feed-top, 75px);
  z-index: 50;
  max-width: 640px;
  margin: 14px auto 18px;
  padding: 8px 10px 10px;
  background: rgba(8, 8, 12, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: .5px solid var(--border);
  border-radius: 12px;
}

.feed-toolbar-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 6px;
}

.feed-toolbar-chips::-webkit-scrollbar { display: none; }

.feed-chip {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1.2;
  padding: 5px 13px;
  border-radius: 999px;
  border: .5px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.feed-chip:hover { color: var(--text); }

.feed-chip[aria-pressed="true"] {
  border-color: var(--accent2);
  color: var(--accent2);
  background: rgba(102, 217, 255, .1);
}

.feed-chip:focus-visible,
.feed-tag:focus-visible,
.feed-action:focus-visible,
.feed-read-more:focus-visible,
.feed-carousel-btn:focus-visible,
.feed-carousel-dot:focus-visible,
.feed-mute:focus-visible,
.feed-lb-btn:focus-visible,
.feed-image:focus-visible,
.feed-carousel-track:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

.feed-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.5px;
  height: 2px;
  border-radius: 0 0 12px 12px;
  pointer-events: none;
  background: linear-gradient(to right,
    var(--accent2) var(--p, 0%),
    rgba(102, 217, 255, .1) var(--p, 0%));
}

.feed-wall {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .page-content.page-feed { padding-left: 12px; padding-right: 12px; }
  .feed-wall { gap: 14px; }
}

.feed-sentinel { height: 1px; width: 100%; }

/* ---------- cards ---------- */

.feed-card {
  position: relative;
  background: rgba(10, 10, 15, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: .5px solid rgba(102, 217, 255, .14);
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .32);
  overflow: hidden;
  scroll-margin-top: calc(var(--feed-top, 75px) + 68px);
  content-visibility: auto;
  contain-intrinsic-size: auto 640px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .38s ease, transform .38s ease, border-color .3s ease;
}

.feed-card.feed-visible {
  opacity: 1;
  transform: none;
}

.feed-card.feed-pinned {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .feed-card:hover { border-color: rgba(102, 217, 255, .2); }
}

.feed-card.feed-flash {
  animation: feedFlash 1.2s ease;
}

@keyframes feedFlash {
  0%   { box-shadow: 0 0 0 2px rgba(102, 217, 255, .9), 0 0 26px rgba(102, 217, 255, .35); }
  70%  { box-shadow: 0 0 0 2px rgba(102, 217, 255, .9), 0 0 26px rgba(102, 217, 255, .35); }
  100% { box-shadow: 0 0 0 2px rgba(102, 217, 255, 0), 0 0 0 rgba(102, 217, 255, 0); }
}

/* ---------- card header ---------- */

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.feed-author {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.feed-author-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #14141c;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}

.feed-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.feed-author-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.feed-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.feed-pin-label {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---------- media ---------- */

.feed-media { position: relative; }

.feed-media-box {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 70vh;
  overflow: hidden;
  background: #07070b;
}

.feed-media-box.is-video { aspect-ratio: 16 / 9; }

.feed-media-sk {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(100deg, #101018 30%, #1b1b28 50%, #101018 70%);
  background-size: 200% 100%;
  animation: feedShimmer 1.4s linear infinite;
  transition: opacity .3s ease;
}

.feed-media-box.is-loaded .feed-media-sk { opacity: 0; }

.feed-image,
.feed-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.feed-image {
  object-fit: cover;
  cursor: zoom-in;
  transition: transform .4s ease;
}

.feed-video {
  object-fit: contain;
  background: #000;
}

@media (hover: hover) and (pointer: fine) {
  .feed-card:hover .feed-image { transform: scale(1.015); }
}

.feed-media-single {
  position: relative;
  z-index: 0;
  display: flex;
  justify-content: center;
}

.feed-ambi {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background: var(--ambi) center / cover no-repeat;
  filter: blur(40px) saturate(1.25);
  opacity: .35;
  transform: scale(1.08);
  pointer-events: none;
  animation: feedAmbi 7s ease-in-out infinite alternate;
}

@keyframes feedAmbi {
  from { opacity: .28; transform: scale(1.06); }
  to   { opacity: .4;  transform: scale(1.12); }
}

@media (max-width: 767px) {
  .feed-ambi { display: none; }
}

.feed-mute {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 9, .72);
  border: .5px solid rgba(102, 217, 255, .25);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---------- carousel ---------- */

.feed-carousel { position: relative; }

.feed-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.feed-carousel-track::-webkit-scrollbar { display: none; }

.feed-carousel-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.feed-carousel-slide .feed-media-box { max-height: 70vh; }

.feed-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: rgba(5, 6, 9, .7);
  border: .5px solid rgba(102, 217, 255, .3);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@media (hover: hover) and (pointer: fine) {
  .feed-carousel-btn {
    display: grid;
    opacity: .75;
    transition: opacity .2s ease, border-color .2s ease;
  }
  .feed-carousel:hover .feed-carousel-btn { opacity: 1; }
  .feed-carousel-btn:hover { border-color: rgba(102, 217, 255, .6); }
}

.feed-carousel-prev { left: 10px; }
.feed-carousel-next { right: 10px; }

.feed-carousel-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  font-size: 12px;
  color: var(--text);
  background: rgba(5, 6, 9, .72);
  border: .5px solid rgba(102, 217, 255, .25);
  border-radius: 999px;
  padding: 3px 9px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.feed-carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
}

.feed-carousel-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.feed-carousel-dot.is-active {
  background: var(--accent2);
  transform: scale(1.25);
}

/* ---------- body ---------- */

.feed-body { padding: 4px 16px 2px; }

.feed-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  margin: 10px 0 8px;
}

.feed-body-clamp {
  position: relative;
  overflow: hidden;
}

.feed-body-clamp:not(.is-open)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  background: linear-gradient(to bottom, rgba(10, 10, 15, 0), rgba(10, 10, 15, .85));
  pointer-events: none;
}

.feed-body-inner {
  overflow: hidden;
  transition: height .32s ease;
}

.feed-body-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted2);
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-body-inner.feed-expanded .feed-body-content {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.feed-body-content p { margin: 0 0 10px; }
.feed-body-content p:last-child { margin-bottom: 0; }
.feed-body-content ul,
.feed-body-content ol { margin: 8px 0; padding-left: 22px; }
.feed-body-content li { margin: 3px 0; }
.feed-body-content h2,
.feed-body-content h3,
.feed-body-content h4 { margin: 14px 0 8px; font-size: 16px; color: var(--text); }
.feed-body-content a { color: var(--accent2); text-decoration: underline; }
.feed-body-content img { max-width: 100%; height: auto; border-radius: 8px; }
.feed-body-content blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.feed-body-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: rgba(102, 217, 255, .08);
  border-radius: 4px;
  padding: 1px 5px;
}
.feed-body-content pre {
  background: rgba(0, 0, 0, .45);
  border: .5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
}
.feed-body-content pre code { background: none; padding: 0; }

.feed-read-more {
  display: block;
  margin-top: 6px;
  padding: 3px 0;
  background: none;
  border: none;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.feed-read-more[hidden] { display: none; }

.feed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.feed-tag {
  font-size: 12px;
  line-height: 1.3;
  padding: 3px 10px;
  border-radius: 999px;
  border: .5px solid rgba(102, 217, 255, .22);
  background: rgba(102, 217, 255, .06);
  color: var(--accent2);
  cursor: pointer;
  transition: background .2s ease;
}

.feed-tag:hover { background: rgba(102, 217, 255, .14); }

.feed-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  border-top: .5px solid var(--border);
}

.feed-action {
  font-size: 12.5px;
  padding: 5px 14px;
  border-radius: 999px;
  border: .5px solid rgba(102, 217, 255, .2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}

.feed-action:hover {
  color: var(--text);
  border-color: rgba(102, 217, 255, .4);
}

/* ---------- dividers ---------- */

.feed-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 0;
}

.feed-divider-line {
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: .35;
}

.feed-divider-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: .9;
  white-space: nowrap;
}

/* ---------- skeletons ---------- */

.feed-skel {
  background: rgba(10, 10, 15, .55);
  border: .5px solid rgba(102, 217, 255, .14);
  border-radius: 12px;
  overflow: hidden;
}

.feed-skel-media {
  aspect-ratio: 4 / 3;
}

.feed-skel-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 18px;
}

.feed-skel-bar {
  display: block;
  height: 12px;
  border-radius: 6px;
}

.feed-skel-media,
.feed-skel-bar {
  background: linear-gradient(100deg, #101018 30%, #1b1b28 50%, #101018 70%);
  background-size: 200% 100%;
  animation: feedShimmer 1.4s linear infinite;
}

@keyframes feedShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- toast ---------- */

.feed-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  transform: translate(-50%, 10px);
  z-index: 1200;
  font-size: 13px;
  color: var(--text);
  background: rgba(8, 8, 12, .92);
  border: .5px solid rgba(102, 217, 255, .3);
  border-radius: 999px;
  padding: 9px 16px;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .25s ease, transform .25s ease;
}

.feed-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- gallery lightbox (.feed-lb — feed-only, not Islam) ---------- */

.feed-lb-lock { overflow: hidden; }

.feed-lb {
  position: fixed;
  inset: 0;
  z-index: 1100;
  opacity: 0;
  transition: opacity .25s ease;
}

.feed-lb.show { opacity: 1; }

.feed-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 6, .93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.feed-lb-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.feed-lb-stage {
  position: relative;
  display: flex;
  max-width: min(1100px, 92vw);
  max-height: 82vh;
}

.feed-lb-media {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}

.feed-lb-counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 13px;
  color: var(--text);
  background: rgba(8, 8, 12, .75);
  border: .5px solid rgba(102, 217, 255, .25);
  border-radius: 999px;
  padding: 5px 13px;
  white-space: nowrap;
}

.feed-lb-btn {
  position: absolute;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 12, .72);
  border: .5px solid rgba(102, 217, 255, .3);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}

.feed-lb-btn:hover {
  border-color: rgba(102, 217, 255, .6);
  color: var(--accent2);
}

.feed-lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.feed-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.feed-lb-close { top: 14px; right: 16px; width: 40px; height: 40px; font-size: 18px; }

@media (max-width: 560px) {
  .feed-lb-content { padding: 12px; }
  .feed-lb-prev { left: 8px; }
  .feed-lb-next { right: 8px; }
  .feed-lb-btn { width: 38px; height: 38px; font-size: 20px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .feed-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .feed-progress { display: none; }
  .feed-ambi { animation: none; }
  .feed-image { transition: none; }
  .feed-body-inner { transition: none; }
  .feed-skel-media,
  .feed-skel-bar { animation: none; }
  .feed-toast { transition: none; }
  .feed-lb { transition: none; }
}
