/* Component container */
.sns-strip {
  margin: 2.5rem auto;
  max-width: 1440px;
  padding: 0 1rem;
  position: relative;
}

/* Head (title + CTA) */
.sns-strip__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.sns-strip__cta {
  min-width: 9rem;
  height: 2.5rem;
}

/* Tabs wrapper (reuses your site-wide .tabs styling for buttons) */
.sns-strip__tabs {
  margin-top: 1rem;
}

/* Pane (tab content) */
.sns-strip__pane {
  margin-top: 1.25rem;
  display: none; /* hidden by default */
}
.sns-strip__pane.is-active {
  display: block; /* only the active pane is visible */
}

/* Swiper width tuning – now strictly within the component */
.sns-strip .swiper .swiper-slide {
  width: auto !important; /* follow the card width */
  padding-right: 0.5rem;
}

/* Instagram pane: explicit slide width to prevent external CSS interference */
.sns-strip [id$="-pane-insta"] .swiper-slide {
  width: 238px !important;
}

/* Scrollbar style – scoped */
.sns-strip .swiper-scrollbar {
  display: none;
}

/* JS/Swiper-less fallback – scoped */
.sns-strip .sns-strip--native {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  overflow-x: auto;
  gap: 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}
.sns-strip .sns-strip--native > .swiper-wrapper {
  display: contents; /* render wrapper as passthrough */
}
.sns-strip .sns-strip--native .swiper-slide {
  scroll-snap-align: start;
}

/* Keep margins compact on small screens */
@media (max-width: 767px) {
  .sns-strip {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }
}

/* Instagram grid isolated */
.sns-strip .sns-strip__insta {
  margin: 0 auto;
  max-width: 1200px;
}
.sns-strip .sns-strip__title {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}
.sns-strip .sns-strip__title-inner {
  position: relative;
  display: flex;
  align-items: center;
}
.sns-strip .sns-strip__star-left,
.sns-strip .sns-strip__star-right {
  width: 2.5rem;
  height: auto;
}
.sns-strip .sns-strip__title-text {
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.sns-strip .sns-strip__container {
  margin-top: 2.5rem;
}

.sns-strip .empty-state {
  text-align: center;
}

.sns-strip .sns-strip__insta-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 0;
}

.sns-strip .sns-strip__insta-item {
  display: block;
  cursor: pointer;
  border: 0.0625rem solid #221a15;
  border-radius: 0.5rem;
  width: 238px;
}

.sns-strip .sns-strip__insta-item .insta-item__img,
.sns-strip .sns-strip__insta-item img {
  aspect-ratio: 1;
  width: 100%;
  max-width: 238px;
  object-fit: cover;
  border: 0.5rem solid #f090a9;
  border-radius: 0.4375rem;
}

/* Responsive tweak */
@media (max-width: 767px) {
  .sns-strip .sns-strip__insta-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}
@media (max-width: 420px) {
  .sns-strip .sns-strip__insta-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   X card (isolated) – replaces legacy `.x-item*`
   ========================================================================== */

.sns-strip .sns-strip__x-card {
  /* 以前の x-item--sns-list に相当する白背景スマホ枠 */
  background-image: url("/assets/images/common/bg-phone-white-sns.svg");
  background-repeat: no-repeat;
  background-size: 100%;
  display: flex;
  justify-content: left;
  width: 100%;
  height: 100%;
}

.sns-strip .sns-strip__x-card-container {
  display: flex;
  flex-direction: column;
  width: calc(100% - 1.2rem);
  padding: 3rem 0.6875rem 1.5rem 0.5rem; /* top right bottom left */
  padding-bottom: 3rem; /* 下を少し広めに */
  margin-left: 0.625rem;
  align-items: center;
}

.sns-strip .sns-strip__x-card-link {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* Header */
.sns-strip .sns-strip__x-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sns-strip .sns-strip__x-card-icon {
  aspect-ratio: 1;
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border: 0.0625rem solid #221a15;
  border-radius: 3rem;
}

.sns-strip .sns-strip__x-card-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 76%;
}

.sns-strip .sns-strip__x-card-name-wrapper {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.sns-strip .sns-strip__x-card-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-weight: 600;
  font-size: max(1.125rem, 14px);
  line-height: 1.3;
}

.sns-strip .sns-strip__x-card-time {
  color: #6c6c6c;
  font-family: Quicksand, system-ui, sans-serif;
  font-weight: 500;
  font-size: max(1rem, 12px);
  line-height: 1.3;
  padding-top: 0.1875rem;
  white-space: nowrap;
}

.sns-strip .sns-strip__x-card-region {
  color: #eb537b;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
}

.sns-strip .sns-strip__x-card-shop-name {
  color: #eb537b;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-weight: 600;
  font-size: max(0.875rem, 12px);
  line-height: 1.6;
}

/* Body text */
.sns-strip .sns-strip__x-card-text {
  margin-top: 1rem;
  flex: 1; /* 画像が下に来るようにテキストでスペースを消費 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7; /* 旧 x-swiper 時の見た目に合わせてやや多め */
  overflow: hidden;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 400;
}

/* Image */
.sns-strip .sns-strip__x-card-img {
  margin-top: 0.8125rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 339px;
  aspect-ratio: 339/247;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* Buttons */
.sns-strip .sns-strip__x-card-btns {
  position: relative;
  top: -0.1875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.sns-strip .sns-strip__x-card .link-button {
  height: 2.875rem;
  width: 10.34375rem; /* 165.5px */
  max-width: 12.5rem;
  margin: 0 auto;
  font-size: max(0.6rem, 12px);
  line-height: 1;
}

/* Swiper slide treatment inside the component */
.sns-strip .swiper .swiper-slide {
  width: auto; /* スライド幅 = カード幅 */
  padding-right: 0.5rem;
}

/* Responsive */
@media (max-width: 1300px) {
  .sns-strip .sns-strip__x-card-text {
    -webkit-line-clamp: 5;
  }
}

@media (max-width: 1023px) {
  .sns-strip .sns-strip__x-card-shop-name {
    -webkit-line-clamp: 1;
  }
  .sns-strip .sns-strip__x-card-text {
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 850px) {
  .sns-strip .sns-strip__x-card-name-wrapper {
    align-items: flex-start;
    flex-direction: column;
  }
  .sns-strip .sns-strip__x-card-text {
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 767px) {
  .sns-strip .sns-strip__x-card {
    background-image: url("/assets/images/common/bg-phon-white-sp.svg"); /* SP用の白枠 */
    width: 19.6875rem; /* 315px */
  }

  .sns-strip .sns-strip__x-card-container {
    padding: 3.1875rem 0.6875rem 1.8125rem;
  }

  .sns-strip .sns-strip__x-card-icon {
    width: 3.5rem;
    height: 3.5rem;
  }
  .sns-strip .sns-strip__x-card-name {
    font-size: 14px;
  }
  .sns-strip .sns-strip__x-card-time {
    font-size: 12px;
  }
  .sns-strip .sns-strip__x-card-region {
    font-size: 11px;
  }
  .sns-strip .sns-strip__x-card-shop-name {
    font-size: 12px;
  }
  .sns-strip .sns-strip__x-card-text {
    font-size: 12px;
    -webkit-line-clamp: 6;
    margin-top: 0.5rem;
  }

  .sns-strip .sns-strip__x-card-img {
    margin: 0.5rem 0 0.625rem;
    max-width: 282px;
    aspect-ratio: 282/188;
  }

  .sns-strip .sns-strip__x-card .link-button {
    height: 2.75rem;
    width: 8.5625rem;
    font-size: 12px;
  }
}

/* =========================================================
   X pane: stepped vertical rhythm (like legacy .x-item list)
   - Apply only inside the X pane of sns-strip
   - Uses margin-top (not transform) to avoid Swiper clipping
   ========================================================= */

/* Make Swiper line up slides from the top (needed for margins to show as "steps") */
.sns-strip [id$="-pane-x"] .swiper-wrapper {
  align-items: flex-start;
}

/* Default: no extra offset */
.sns-strip [id$="-pane-x"] .swiper-slide {
  margin-top: 0;
  aspect-ratio: 19/32;
  width: 378px !important;
}

/* Desktop / tablet: step every 3 slides (2nd and 3rd) */
@media (min-width: 768px) {
  .sns-strip [id$="-pane-x"] .swiper-slide:nth-child(3n + 2) {
    margin-top: 3.5rem;
  }
  .sns-strip [id$="-pane-x"] .swiper-slide:nth-child(3n + 3) {
    margin-top: 1.5rem;
  }

  /* Give a little extra room so the scrollbar doesn't overlap the lowest card */
  .sns-strip [id$="-pane-x"] .swiper {
    padding-bottom: 3.75rem; /* roughly = biggest step + spacing */
  }
}

/* Small screens: keep a flat row (like the old SP behaviour) */
@media (max-width: 767px) {
  .sns-strip [id$="-pane-x"] .swiper-slide {
    margin-top: 0 !important;
    width: 315px !important;
  }
  .sns-strip [id$="-pane-x"] .swiper {
    padding-bottom: 0;
  }
  .sns-strip [id$="-pane-insta"] .swiper-slide {
    width: 180px !important;
  }
}

/* Fallback path (when Swiper isn't available and we switch to native grid scroll) */
.sns-strip [id$="-pane-x"] .sns-strip--native {
  align-items: start; /* harmless for grid; keeps intent clear */
}
.sns-strip [id$="-pane-x"] .sns-strip--native .swiper-slide {
  /* grid items; margin-top works the same */
}

/* Center swiper content when it doesn't overflow */
.sns-strip .swiper.is-centered {
  /* Make the swiper container a flex box so we can center its wrapper */
  display: flex;
}

.sns-strip .swiper.is-centered .swiper-wrapper {
  /* Shrink to content width and center the whole wrapper block */
  width: max-content;
  margin: 0 auto;

  /* Avoid tiny sub-pixel shifts from Swiper's translate when not needed */
  transform: translate3d(0, 0, 0) !important;
}

/* ============================
   X pane (native fallback only)
   - When Swiper is absent, center if content is narrower than the viewport.
   - If content overflows, justify-content won't change layout (safe).
   ============================ */
.sns-strip [id$="-pane-x"] .sns-strip--native {
  justify-content: center;
}

/* ============================
   Instagram: center when JS marks list as "is-centered"
   - Switch grid -> flex ONLY in this case to avoid layout shifts.
   ============================ */
.sns-strip .sns-strip__insta-list.is-centered {
  display: flex; /* override original grid */
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem; /* keep the same spacing */
}
.sns-strip .sns-strip__insta-list.is-centered > li {
  display: flex; /* ensure children shrink to content width */
}
