/* Markaz-e-ilm feed: full-screen page, home row, admin bits */

/* ---------- Full-screen feed ---------- */
body.page-feed { overflow: hidden; }

.fd { position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff; }
.fd-scroll { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; outline: 0; }
.fd-scroll::-webkit-scrollbar { display: none; }

.fd-slide { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; justify-content: center; }
.fd-frame { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; }
.fd-media { display: block; width: 100%; height: 100%; object-fit: contain; }

.fd-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 20px; cursor: pointer; transition: background-color .15s; }
.fd-btn:hover { background: rgba(0,0,0,.7); color: #fff; }
.fd-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fd-btn[hidden] { display: none; }

.fd-back { position: absolute; z-index: 2; top: calc(12px + env(safe-area-inset-top)); left: 12px; }
.fd-mute { position: absolute; z-index: 2; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); }
.fd-arrows { display: none; }

.fd-rail { position: absolute; z-index: 1; right: 8px; bottom: calc(150px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.fd-action { display: grid; justify-items: center; gap: 2px; width: 56px; padding: 0; border: 0; background: none; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.8); cursor: pointer; }
.fd-action i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.4); font-size: 21px; text-shadow: none; transition: transform .12s, background-color .15s; }
.fd-action:hover i { background: rgba(0,0,0,.65); }
.fd-action:active i { transform: scale(.88); }
.fd-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 10px; }
.fd-action.is-liked i { color: #ff4d67; }
.fd-action--stat { cursor: default; }
.fd-action--stat i, .fd-action--stat:hover i { background: none; height: 26px; }

.fd-sheet { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.fd-sheet[hidden] { display: none; }
.fd-sheet__shade { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.fd-sheet__panel { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 480px; height: 70%; background: #fff; color: #14213d; border-radius: 18px 18px 0 0; overflow: hidden; }
.fd-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid #e5e9f2; }
.fd-sheet__head h2 { margin: 0; color: inherit; font-size: 16px; font-weight: 600; }
.fd-sheet__close { width: 44px; height: 44px; border: 0; background: none; color: #6b7487; font-size: 16px; cursor: pointer; }
.fd-sheet__close:hover { color: #14213d; }
.fd-sheet__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 12px; }
.fd-sheet__note { margin: 24px 0; text-align: center; color: #6b7487; font-size: 14px; }
.fd-sheet__more { display: block; margin: 8px auto 0; padding: 8px 12px; border: 0; background: none; color: #0251B7; font-size: 13px; font-weight: 600; cursor: pointer; }
.fd-sheet__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #e5e9f2; }
.fd-sheet__form textarea { flex: 1 1 auto; min-width: 0; min-height: 42px; max-height: 110px; padding: 9px 14px; border: 1px solid #d5dbe8; border-radius: 21px; background: #fff; color: #14213d; font-size: 16px; line-height: 1.4; resize: none; outline: 0; }
.fd-sheet__form textarea:focus { border-color: #0251B7; }
.fd-sheet__form button { flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #0251B7; color: #fff; font-size: 16px; cursor: pointer; }
.fd-sheet__guest { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #e5e9f2; }

.fd-comment { display: flex; gap: 10px; padding: 10px 0; }
.fd-comment__pic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #e5e9f2; }
.fd-comment__main { flex: 1 1 auto; min-width: 0; }
.fd-comment__head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.fd-comment__head b { font-weight: 600; overflow-wrap: anywhere; }
.fd-comment__head time { flex: 0 0 auto; color: #6b7487; font-size: 12px; }
.fd-comment p { margin: 2px 0 0; color: #14213d; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.fd-comment__del { flex: 0 0 auto; align-self: flex-start; width: 36px; height: 36px; border: 0; background: none; color: #6b7487; cursor: pointer; }
.fd-comment__del:hover { color: #c62f3e; }

.fd-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 68px calc(20px + env(safe-area-inset-bottom)) 16px; background: linear-gradient(to top, rgba(0,0,0,.75), transparent); pointer-events: none; }
.fd-caption p { margin: 0; color: #fff; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.fd-caption p.is-open { display: block; max-height: 45vh; overflow-y: auto; pointer-events: auto; }
.fd-more { padding: 4px 0 0; border: 0; background: none; color: rgba(255,255,255,.8); font-size: 13px; font-weight: 600; cursor: pointer; pointer-events: auto; }

.fd-pinned { position: absolute; z-index: 1; top: calc(20px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; }

.fd-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.2); pointer-events: none; }
.fd-bar i { display: block; width: 0; height: 100%; background: #fff; }

.fd-paused { position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.45); font-size: 40px; pointer-events: none; }
.fd-paused[hidden] { display: none; }
.fd-spinner { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: fd-spin .8s linear infinite; pointer-events: none; }
.fd-spinner[hidden] { display: none; }
@keyframes fd-spin { to { transform: rotate(360deg); } }
.fd-error { position: absolute; top: 50%; left: 24px; right: 24px; margin: 0; transform: translateY(-50%); text-align: center; color: #fff; font-size: 14px; pointer-events: none; }

.fd-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.fd-empty i { font-size: 44px; opacity: .7; }
.fd-empty h1 { margin: 0; color: #fff; font-size: 20px; }
.fd-empty p { margin: 0; color: rgba(255,255,255,.7); }

/* Wide screens: a phone-shaped column, with buttons beside it */
@media (min-width: 768px) {
  .fd { background: #111; }
  .fd-frame { width: min(100%, 56.25vh); width: min(100%, 56.25dvh); }
  .fd-mute { right: calc(50% - 28.125vh - 60px); right: calc(50% - 28.125dvh - 60px); bottom: 24px; }
  .fd-rail { bottom: 24px; }
  .fd-sheet__panel { height: 76%; border-radius: 18px; margin-bottom: 4vh; }
  .fd-arrows { position: absolute; z-index: 2; top: 50%; right: 24px; transform: translateY(-50%); display: grid; gap: 12px; }
  .fd-arrows .fd-btn { background: rgba(255,255,255,.14); }
  .fd-arrows .fd-btn:hover { background: rgba(255,255,255,.26); }
}

/* ---------- Home row ---------- */
.fd-strip { display: flex; gap: 10px; padding: 0 16px 4px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-left: 16px; scrollbar-width: none; }
.fd-strip::-webkit-scrollbar { display: none; }
.fd-card { position: relative; flex: 0 0 auto; width: 140px; aspect-ratio: 9 / 14; border-radius: 18px; overflow: hidden; background: #1c2233; color: #fff; text-decoration: none; scroll-snap-align: start; transition: transform .15s; }
.fd-card:hover { color: #fff; transform: translateY(-2px); }
.fd-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-card__play { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.5); font-size: 15px; }
.fd-card__pin { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.5); font-size: 14px; }
.fd-card__play ~ .fd-card__pin { right: 40px; }
.fd-card__views { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border-radius: 14px; background: rgba(0,0,0,.5); font-size: 12px; font-weight: 600; }
.fd-card__text { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 10px 10px; background: linear-gradient(to top, rgba(0,0,0,.75), transparent); font-size: 12px; line-height: 1.35; }
/* Clamp on an inner span: with padding on the same box, a third line peeks out below the clamp */
.fd-card__text > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; max-height: 2.7em; }
.fd-card--more { display: grid; place-items: center; align-content: center; gap: 6px; background: #e4e6ec; color: #14213d; font-weight: 600; font-size: 15px; }
.fd-card--more:hover { color: #14213d; }
.fd-card--more i { font-size: 22px; }

.fd-web-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.fd-web-head h2 { margin: 0; }
.fd-web-strip { padding: 0 0 4px; scroll-padding-left: 0; }
.fd-web-strip .fd-card { width: 200px; }

/* ---------- Admin ---------- */
.fd-admin-thumb { position: relative; display: block; width: 54px; height: 72px; border-radius: 8px; overflow: hidden; background: #1c2233; color: #fff; }
.fd-admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-admin-thumb i { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 22px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.fd-preview img { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; }
