/*
 * Social Business Map — layout per Figma "מסך ראשי" (1440 frame).
 * Colours that belong to a category come in through --sbm-color.
 */

.sbm {
  --sbm-cream: #fffbf6;
  --sbm-panel: #fff1e1;
  --sbm-panel-business: #ffecd8;
  --sbm-intro-accent: #ff49b0;
  --sbm-intro-text: #4f3689;
  --sbm-sky: #56ccf2;
  --sbm-rule: #a8deef;
  direction: rtl;
  font-family: "Alef", sans-serif;
}

.sbm *,
.sbm *::before,
.sbm *::after {
  box-sizing: border-box;
}

/* Dotted rule: 5px round dots, ~9px apart (Figma "Line 2" / "Line 3"). */
.sbm-dots {
  display: block;
  height: 5px;
  margin: 0;
  border: 0;
  background-image: radial-gradient(circle, currentColor 2.4px, transparent 2.6px);
  background-size: 9px 5px;
  background-repeat: repeat-x;
  background-position: right center;
}

/* ------------------------------------------------------------------ *
 * Stage: map + floating panel
 * ------------------------------------------------------------------ */

.sbm-stage {
  position: relative;
  height: 878px;
  scroll-margin-top: 20px;
}

.sbm-map {
  position: absolute;
  inset: 0;
  background: var(--sbm-cream);
}

.sbm-illustration {
  position: absolute;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.sbm-map--unavailable::after {
  content: "המפה אינה זמינה כרגע";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--sbm-intro-text);
  font-size: 18px;
}

.sbm-panel {
  --sbm-color: var(--sbm-intro-accent);
  position: absolute;
  top: 116px;
  left: 96px; /* Figma keeps the panel on the left edge of the map */
  z-index: 2;
  width: 340px;
  min-height: 665px;
  max-height: calc(100% - 116px - 24px);
  overflow-y: auto;
  padding: 58px 44px 40px;
  border-radius: 32px;
  background: var(--sbm-panel);
  color: var(--sbm-intro-text);
  scrollbar-width: thin;
}

.sbm-panel[data-view="business"] {
  background: var(--sbm-panel-business);
  color: var(--sbm-color);
}

/* Search */
.sbm-search {
  position: relative;
  color: var(--sbm-sky);
}

.sbm-panel[data-view="business"] .sbm-search {
  color: var(--sbm-color);
}

.sbm-search__input {
  display: block;
  width: 100%;
  height: 62px;
  margin: 0;
  padding: 0 46px 0 20px;
  border: 5px dotted var(--sbm-sky);
  border-radius: 25px;
  background: transparent;
  color: var(--sbm-intro-text);
  font: 700 15px/20px "Alef", sans-serif;
  text-align: right;
  appearance: none;
}

.sbm-search__input::placeholder {
  color: var(--sbm-intro-text);
  opacity: 1;
}

.sbm-panel[data-view="business"] .sbm-search__input {
  border-color: var(--sbm-color);
}

.sbm-panel[data-view="business"] .sbm-search__input,
.sbm-panel[data-view="business"] .sbm-search__input::placeholder {
  color: var(--sbm-color);
  font-weight: 400;
}

.sbm-search__input::-webkit-search-cancel-button {
  cursor: pointer;
}

.sbm-search__input:focus {
  outline: none;
}

.sbm-search__input:focus-visible {
  box-shadow: 0 0 0 3px rgba(79, 54, 137, 0.25);
}

.sbm-search__icon {
  position: absolute;
  top: 50%;
  right: 19px;
  display: flex;
  transform: translateY(-50%);
  color: var(--sbm-intro-text);
  pointer-events: none;
}

.sbm-panel[data-view="business"] .sbm-search__icon {
  color: var(--sbm-color);
}

.sbm-search__results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 3;
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border-radius: 18px;
  background: #fffaf3;
  box-shadow: 0 8px 24px rgba(79, 54, 137, 0.16);
}

.sbm-search__result,
.sbm-search__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--sbm-intro-text);
  font-size: 15px;
  line-height: 1.3;
}

.sbm-search__result {
  cursor: pointer;
}

.sbm-search__result:hover,
.sbm-search__result.is-active {
  background: #fff1e1;
}

.sbm-search__dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sbm-color);
}

/* Shared text */
.sbm-view {
  padding-top: 38px;
}

.sbm-view[hidden] {
  display: none;
}

.sbm-view .sbm-dots {
  color: var(--sbm-sky);
}

.sbm-panel[data-view="business"] .sbm-dots {
  color: var(--sbm-color);
}

/* Intro view */
.sbm-intro__title {
  margin: 0;
  color: var(--sbm-intro-accent);
  font: 700 22px/30px "Alef", sans-serif;
}

.sbm-intro__subtitle {
  margin: 12px 0 0;
  color: var(--sbm-intro-accent);
  font: 700 15px/20px "Alef", sans-serif;
  text-align: justify;
}

.sbm-intro__subtitle a {
  color: inherit;
  text-decoration: none;
}

.sbm-intro__subtitle a:hover,
.sbm-intro__subtitle a:focus-visible {
  text-decoration: underline;
}

.sbm-view--intro .sbm-dots {
  margin-top: 2px;
}

.sbm-intro__text {
  margin-top: 25px;
  color: var(--sbm-intro-text);
  font: 700 15px/1.2 "Alef", sans-serif;
  text-align: justify;
}

.sbm-intro__text p,
.sbm-business__description p {
  margin: 0 0 0.8em;
}

.sbm-intro__text > :last-child,
.sbm-business__description > :last-child {
  margin-bottom: 0;
}

.sbm-intro__image {
  display: block;
  width: calc(100% + 26px);
  max-width: none;
  height: auto;
  margin: 0 -13px;
  transform: rotate(3.96deg);
}

/* Business view */
.sbm-business__name {
  margin: 0;
  color: var(--sbm-color);
  font: 700 32px/30px "Alef", sans-serif;
}

.sbm-business__meta {
  margin: 17px 0 0;
  color: var(--sbm-color);
  font: 700 15px/1.2 "Alef", sans-serif;
}

.sbm-view--business .sbm-dots {
  margin-top: 31px;
}

.sbm-business__description {
  margin-top: 31px;
  color: var(--sbm-color);
  font: 400 15px/1.2 "Alef", sans-serif;
}

.sbm-business__description a {
  color: inherit;
}

.sbm-business__social {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
  padding: 0 5px;
}

.sbm-business__social[hidden],
.sbm-business__link[hidden],
.sbm-view [hidden] {
  display: none;
}

.sbm-business__link {
  display: inline-flex;
  padding: 4px;
  color: var(--sbm-color);
  transition: transform 0.15s ease;
}

.sbm-business__link:hover,
.sbm-business__link:focus-visible {
  transform: scale(1.15);
}

.sbm-business__image {
  display: block;
  width: calc(100% + 40px);
  max-width: none;
  height: auto;
  margin: 20px -20px 0;
}

.sbm-view > :first-child {
  margin-top: 0;
}

/* intro_image is always last; give it room above */
.sbm-intro__text + .sbm-intro__image,
.sbm-dots + .sbm-intro__image {
  margin-top: 0;
}

/* ------------------------------------------------------------------ *
 * Legend
 * ------------------------------------------------------------------ */

.sbm-legend {
  width: min(1248px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 75px;
}

.sbm-legend__rule {
  color: var(--sbm-rule);
}

.sbm-legend__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 49px 0 0;
  padding: 0;
  list-style: none;
}

.sbm-legend__row {
  display: flex;
  align-items: flex-start;
  gap: 31px;
  padding-right: 4px;
  color: var(--sbm-color);
}

.sbm-legend__dot {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--sbm-color);
}

.sbm-legend__text {
  margin: 0;
  font-size: 16px;
  line-height: 30px;
}

.sbm-legend__category {
  font-weight: 700;
}

/* "name |" stays together, so wrapped lines never start with a separator. */
.sbm-legend__item,
.sbm-legend__head {
  white-space: nowrap;
}

.sbm-legend__business {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
}

.sbm-legend__business:hover,
.sbm-legend__business:focus-visible,
.sbm-legend__business.is-active {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sbm-legend__business:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1200px) {
  .sbm-panel {
    left: 40px;
  }
}

@media (max-width: 900px) {
  .sbm-stage {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .sbm-map {
    position: relative;
    inset: auto;
    height: 62vh;
    min-height: 380px;
  }

  .sbm-panel {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    min-height: 0;
    max-height: none;
    margin: -36px 16px 0;
    padding: 32px 28px 32px;
    overflow: visible;
    border-radius: 28px;
  }

  .sbm-intro__image,
  .sbm-business__image {
    width: min(290px, 100%);
    margin-inline: auto;
  }

  .sbm-legend {
    padding: 40px 0 56px;
  }

  .sbm-legend__rows {
    gap: 14px;
    margin-top: 32px;
  }

  .sbm-legend__row {
    gap: 14px;
    padding-right: 0;
  }

  .sbm-legend__dot {
    width: 16px;
    height: 16px;
    margin-top: 7px;
  }

  .sbm-legend__text {
    font-size: 15px;
    line-height: 26px;
  }
}
