/**
 * Kisima — shared blog/services sidebar
 */

.kisima-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kisima-sidebar__card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--kisima-radius, 16px);
  padding: 1.35rem 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.kisima-sidebar__card h3 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kisima-navy, #0b1324);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f1f5f9;
}

.kisima-sidebar__card h3 i {
  color: var(--kisima-blue, #2563eb);
  font-size: 1rem;
}

.kisima-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kisima-sidebar__list li + li {
  margin-top: 0.35rem;
}

.kisima-sidebar__list a {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: #334155;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.2s ease, color 0.2s ease;
}

.kisima-sidebar__list a:hover {
  background: #eff6ff;
  color: var(--kisima-blue-dark, #1e40af);
}

.kisima-sidebar__cta {
  background: linear-gradient(135deg, var(--kisima-navy, #0b1324), var(--kisima-blue-dark, #1e40af));
  color: #e2e8f0;
  border: none;
}

.kisima-sidebar__cta h3 {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.kisima-sidebar__cta p {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.kisima-sidebar__cta-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kisima-sidebar__cta-btns a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.kisima-sidebar__cta-btns a:hover {
  transform: translateY(-1px);
}

.kisima-sidebar__cta-btns .kisima-sidebar__wa {
  background: #25d366;
  color: #fff;
}

.kisima-sidebar__cta-btns .kisima-sidebar__calc {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* FAQ accordion */
.kisima-sidebar__faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: #fafbfc;
}

.kisima-sidebar__faq-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: #1e293b;
  padding: 0.75rem 0.85rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  cursor: pointer;
}

.kisima-sidebar__faq-btn .kisima-sidebar__faq-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--kisima-blue, #2563eb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  transition: transform 0.2s ease;
}

.kisima-sidebar__faq-item.is-open .kisima-sidebar__faq-icon {
  transform: rotate(45deg);
}

.kisima-sidebar__faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.kisima-sidebar__faq-item.is-open .kisima-sidebar__faq-answer {
  max-height: 280px;
}

.kisima-sidebar__faq-answer-inner {
  padding: 0 0.85rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #64748b;
}

.kisima-sidebar__faq-answer-inner a {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--kisima-blue, #2563eb);
  font-weight: 600;
  text-decoration: none;
}

.kisima-sidebar__faq-answer-inner a:hover {
  text-decoration: underline;
}

@media (max-width: 1023px) {
  .kisima-sidebar {
    margin-top: 0.5rem;
  }
}

/* ———————————————————————————————————————————
 * Smart-sticky sidebar on big devices (≥1024px)
 *
 * Behaviour:
 *   1. The sidebar scrolls naturally with the page at first.
 *   2. Once the sidebar's bottom would scroll past the bottom of
 *      the viewport, it pins so the bottom stays 1rem above the
 *      viewport bottom — the sidebar stays visible while the main
 *      content continues to scroll.
 *   3. When the user scrolls back up past the sidebar's natural
 *      position, it releases and scrolls normally again.
 *
 * Implementation:
 *   - The sidebar's column is forced to STRETCH to the height of
 *     the main content (overriding any `align-items: start` on the
 *     parent grid) so sticky has room to operate.
 *   - `top: min(1rem, calc(100vh - <sidebar-height> - 1rem))`
 *     produces a NEGATIVE top value when the sidebar is at least as
 *     tall as the viewport, which is what gives the "scroll first,
 *     then pin" effect. A small JS helper writes the real sidebar
 *     height into `--kisima-sidebar-h`. The `min()` falls back to
 *     classic top-stick for the rare case of a very short sidebar.
 * ——————————————————————————————————————————— */
@media (min-width: 1024px) {
  /* Let the sidebar column stretch to match main-content height so
     the sticky sidebar can stay pinned through the full scroll. */
  .kisima-layout__grid--sidebar,
  .kisima-post-layout {
    align-items: stretch !important;
  }

  /* Make sure the immediate sidebar wrapper actually fills its grid cell. */
  .kisima-layout__aside,
  .kisima-post-layout > #sidebar-container,
  .kisima-layout__grid--sidebar > #sidebar-container {
    align-self: stretch;
    height: 100%;
  }

  /* The floating behaviour — applied wherever the sidebar lives */
  .kisima-sidebar,
  #sidebar-container .kisima-sidebar,
  .kisima-layout__aside .kisima-sidebar,
  .kisima-post-layout > #sidebar-container .kisima-sidebar,
  .col-lg-4 > #sidebar-container .kisima-sidebar {
    position: sticky;
    /* Scroll first, then pin so the bottom of the sidebar sits 1rem
       above the bottom of the viewport. */
    top: min(1rem, calc(100vh - var(--kisima-sidebar-h, 100vh) - 1rem));
    bottom: auto;
  }
}
