@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&family=Noto+Kufi+Arabic:wght@400;500;600;700&display=swap');

:root {
  --ink: #16221d;
  --muted: #6b7770;
  --cream: #f4f6f2;
  --paper: #ffffff;
  --line: #e2e8e2;
  --green: #177548;
  --green-dark: #114c33;
  --gold: #d8a23b;
  --gold-light: #fef3c7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Cairo', 'Noto Kufi Arabic', 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
}

button {
  cursor: pointer;
  font: inherit;
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.object-contain { object-fit: contain; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs { font-size: 0.75rem; }
.text-\[11px\] { font-size: 11px; }
.text-emerald-600 { color: #059669; }
.text-emerald-700 { color: #047857; }
.text-emerald-800 { color: #065f46; }
.text-emerald-950 { color: #022c22; }
.text-gray-500 { color: #6b7280; }
.opacity-75 { opacity: 0.75; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.max-w-\[190px\] { max-width: 190px; }
.cursor-pointer { cursor: pointer; }

/* Bidi Latin Badge */
.bidi-latin-badge {
  display: inline-block;
  padding: 0 4px;
  margin: 0 2px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: #022c22;
  background-color: rgba(236, 253, 245, 0.7);
  border: 1px solid rgba(167, 243, 208, 0.6);
  border-radius: 4px;
  font-size: 13px;
  vertical-align: baseline;
  direction: ltr;
  unicode-bidi: isolate;
}

.feed-page {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* ==========================================================================
   Smart Sticky Compact Top Bar
   ========================================================================== */
.sticky-compact-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
  transform: translateY(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sticky-compact-header.visible {
  transform: translateY(0);
}

.compact-header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compact-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: #eaf4ee;
  border: 1px solid #c9e3d4;
  padding: 4px 10px;
  border-radius: 99px;
  transition: all 0.2s;
}

.compact-top-btn:hover {
  background: #d4ebd9;
}

/* ==========================================================================
   Main Hero Masthead Banner
   ========================================================================== */
.simple-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 136px;
  padding: 22px 18px 26px;
  margin: 0 -16px 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #12432f 0%, #1c5f3e 50%, #b88628 135%);
  color: #fff;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 12px 28px rgba(18, 67, 47, 0.2);
}

.simple-header::after {
  content: '';
  position: absolute;
  width: 170px;
  height: 170px;
  left: -40px;
  bottom: -85px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(255, 255, 255, 0.05),
              0 0 0 36px rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.masthead-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 76px;
  height: 86px;
  padding: 6px;
  background: #ffffff;
  border-radius: 18px 18px 24px 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  transform: rotate(-3deg);
  flex-shrink: 0;
}

.masthead-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.masthead-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  text-align: right;
  flex: 1;
}

.masthead-kicker {
  color: #e5c36e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.masthead-line {
  position: absolute;
  z-index: 1;
  right: 18px;
  bottom: 12px;
  width: 48px;
  height: 3.5px;
  border-radius: 99px;
  background: var(--gold);
}

/* ==========================================================================
   Real-Time Search Box
   ========================================================================== */
.search-container {
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  box-shadow: 0 3px 12px rgba(23, 117, 72, 0.03);
  transition: all 0.2s;
}

.search-input-wrapper:focus-within {
  border-color: var(--green);
  box-shadow: 0 4px 16px rgba(23, 117, 72, 0.12);
}

.search-icon {
  color: #334155;
  flex-shrink: 0;
  margin-left: 10px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 13.5px;
  color: #0f172a;
  outline: none;
  font-weight: 500;
  font-family: inherit;
}

.search-input::placeholder {
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  opacity: 1;
}

.search-clear-btn {
  border: none;
  background: #e2e8f0;
  color: #1e293b;
  border-radius: 50%;
  padding: 4px;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.search-clear-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.search-feedback {
  margin-top: 6px;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
  padding: 0 4px;
}

/* ==========================================================================
   Post Card & Typography
   ========================================================================== */
.posts-list {
  display: grid;
  gap: 20px;
}

.post-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(20, 50, 35, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #f6f8f5;
}

.post-exact-date {
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
}

.post-copy {
  padding: 12px 18px 14px;
  text-align: right;
}

.post-text {
  margin: 0;
  color: #24332b;
  font-size: 13.5px;
  line-height: 1.85;
}

/* ==========================================================================
   Media Grid & Zoom Overlay
   ========================================================================== */
.media-container {
  background: #edf1ed;
  border-top: 1px solid #f0f3ef;
  border-bottom: 1px solid #f0f3ef;
}

.single-image-wrapper {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.post-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.single-image-wrapper:hover .post-image {
  transform: scale(1.015);
}

.multi-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  background: #e2e8e2;
}

.grid-image-wrapper {
  position: relative;
  cursor: pointer;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.grid-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.grid-image-wrapper:hover .grid-image {
  transform: scale(1.02);
}

.image-zoom-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 34, 26, 0.75);
  color: #fff;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: background 0.2s;
}

.single-image-wrapper:hover .image-zoom-overlay,
.grid-image-wrapper:hover .image-zoom-overlay {
  background: rgba(18, 34, 26, 0.92);
}

.image-zoom-overlay.compact {
  font-size: 10px;
  padding: 4px 8px;
}

/* Video styles */
.post-video {
  display: block;
  width: 100%;
  max-height: 520px;
  background: #000;
}

/* ==========================================================================
   Post Stats & Actions
   ========================================================================== */
.post-stats {
  padding: 8px 18px 4px;
}

.reactions-pill {
  display: inline-block;
  background: #f1f6f2;
  color: #3b5344;
  border: 1px solid #dfeae2;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
}

.post-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #edf1ed;
  background: #fbfdfa;
}

.action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #e1e8e2;
  border-radius: 10px;
  background: #ffffff;
  color: #4b5850;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
}

.action.primary:hover {
  background: #177548;
  color: #ffffff;
  border-color: #177548;
}

.action.share {
  flex: 0 0 auto;
  min-width: 90px;
}

.action.share:hover {
  background: #eef5f0;
  color: #177548;
  border-color: #cde0d3;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-search-state {
  text-align: center;
  padding: 48px 16px;
  background: #fff;
  border-radius: 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.empty-reset-btn {
  margin-top: 10px;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
}

/* ==========================================================================
   Developer Promotion Footer Card (boussad.siamer.xyz)
   ========================================================================== */
.dev-footer-card {
  margin-top: 36px;
  background: linear-gradient(145deg, #ffffff 0%, #f4f8f4 100%);
  border: 1.5px solid #dbe6de;
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 6px 20px rgba(23, 117, 72, 0.05);
  text-align: right;
}

.dev-footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #16643c;
  font-weight: 700;
  font-size: 11.5px;
  background: #e6f3eb;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.dev-footer-text {
  margin: 0 0 16px;
  color: #4f5f56;
  font-size: 12.5px;
  line-height: 1.7;
}

.dev-footer-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #e5ede6;
  flex-wrap: wrap;
  gap: 10px;
}

.dev-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #177548;
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(23, 117, 72, 0.25);
  transition: all 0.2s;
}

.dev-profile-link:hover {
  background: #125c38;
  transform: translateY(-1px);
}

/* ==========================================================================
   Fullscreen Lightbox Modal
   ========================================================================== */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
}

.lightbox-backdrop.active {
  display: flex;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  z-index: 10;
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.lightbox-close-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.lightbox-close-btn:hover {
  background: #dc2626;
}

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-img {
  max-width: 95%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  touch-action: pinch-zoom;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  transform: translateY(-50%);
  pointer-events: none;
}

.nav-btn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.35);
}

.nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
