/**
 * دليل جنوب للأعمال — VIP + أحدث 4 · كثافة عالية · نافذة ستوري منشأة.
 */

:root {
  --jf-dir-deep: #0b3d5c;
  --jf-dir-mid: #156089;
  --jf-dir-soft: #e8f2f8;
  --jf-dir-line: #b7d0e3;
  --jf-dir-gap: 0.28rem;
  --jf-dir-radius: 8px;
}

.jf-dir {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.jf-dir__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-inline: 0.05rem;
}

.jf-dir__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--jf-dir-deep);
  letter-spacing: -0.01em;
}

.jf-dir__all {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--jf-dir-mid);
  text-decoration: none;
}

.jf-dir__frame {
  border: 1.5px solid var(--jf-dir-line);
  background: var(--jf-dir-soft);
  border-radius: 10px;
  padding: var(--jf-dir-gap);
  display: flex;
  flex-direction: column;
  gap: var(--jf-dir-gap);
}

.jf-dir__hero,
.jf-dir__cell {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  border-radius: var(--jf-dir-radius);
  text-decoration: none;
  color: #fff;
  background: var(--jf-dir-deep);
  cursor: pointer;
  font: inherit;
  text-align: start;
  -webkit-tap-highlight-color: transparent;
}

.jf-dir__hero:focus-visible,
.jf-dir__cell:focus-visible {
  outline: 2px solid var(--jf-dir-mid);
  outline-offset: 2px;
}

.jf-dir__hero {
  aspect-ratio: 16 / 9;
}

.jf-dir__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--jf-dir-gap);
}

.jf-dir__cell {
  aspect-ratio: 4 / 3;
  min-width: 0;
}

.jf-dir__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.jf-dir__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 0.45rem 0.5rem 0.4rem;
  background: linear-gradient(
    to top,
    rgba(11, 61, 92, 0.95) 0%,
    rgba(21, 96, 137, 0.68) 55%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  pointer-events: none;
}

.jf-dir__caption--sm {
  padding: 0.3rem 0.35rem 0.28rem;
}

.jf-dir__vip {
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: #c9a227;
  color: #1a1a1a;
}

.jf-dir__name {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #fff;
}

.jf-dir__caption--sm .jf-dir__name {
  font-size: 0.68rem;
}

.jf-dir__empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--jf-dir-mid);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: var(--jf-dir-radius);
  background: rgba(255, 255, 255, 0.5);
}

.jf-dir__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--jf-dir-gap);
}

.jf-dir__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.4rem 0.5rem;
  border-radius: 9px;
  font-family: var(--jf-font);
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  line-height: 1.25;
}

.jf-dir__btn--ghost {
  border: 1.5px solid var(--jf-dir-line);
  color: var(--jf-dir-deep);
  background: #fff;
}

.jf-dir__btn--solid {
  background: var(--jf-dir-deep);
  color: #fff;
  border: 1.5px solid var(--jf-dir-deep);
}

/* ——— نافذة ستوري المنشأة ——— */
.jf-biz-story {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.jf-biz-story.is-open {
  display: flex;
}

.jf-biz-story__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 24, 36, 0.72);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.jf-biz-story__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  max-height: min(92dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: 14px;
  border: 1.5px solid var(--jf-dir-line);
  background: linear-gradient(180deg, #f3f8fc 0%, #fff 40%);
  box-shadow: 0 12px 40px rgba(11, 61, 92, 0.28);
}

.jf-biz-story__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.jf-biz-story__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--jf-dir-deep);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jf-biz-story__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--jf-dir-line);
  background: #fff;
  color: var(--jf-dir-deep);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.jf-biz-story__close:hover,
.jf-biz-story__close:focus-visible {
  background: var(--jf-dir-soft);
  outline: none;
  border-color: var(--jf-dir-mid);
}

.jf-biz-story__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: min(68dvh, 560px);
  margin-inline: auto;
  border-radius: 12px;
  overflow: hidden;
  background: var(--jf-dir-deep);
  border: 1.5px solid rgba(11, 61, 92, 0.2);
}

.jf-biz-story__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jf-biz-story__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.jf-biz-story__save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.55rem 0.75rem;
  border-radius: 11px;
  border: 0;
  background: var(--jf-dir-deep);
  color: #fff;
  font-family: var(--jf-font);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.jf-biz-story__save:disabled {
  opacity: 0.65;
  cursor: wait;
}

.jf-biz-story__page {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--jf-dir-mid);
  text-decoration: none;
  padding: 0.25rem;
}

body.jf-biz-story-lock {
  overflow: hidden;
}

@media (min-width: 640px) {
  .jf-dir__hero {
    aspect-ratio: 2 / 1;
  }

  .jf-dir__cell {
    aspect-ratio: 3 / 2;
  }

  .jf-biz-story__panel {
    width: min(100%, 400px);
  }
}

html.dark .jf-dir__title,
html.dark .jf-biz-story__label {
  color: #d7e8f5;
}
html.dark .jf-dir__frame {
  background: #102433;
  border-color: #1e3a4d;
}
html.dark .jf-dir__btn--ghost,
html.dark .jf-biz-story__close {
  background: transparent;
  color: #d7e8f5;
  border-color: #2a4d66;
}
html.dark .jf-biz-story__panel {
  background: linear-gradient(180deg, #102433 0%, #0f1720 100%);
  border-color: #2a4d66;
}
